hydra 0.12.0 → 0.13.0
raw patch · 544 files changed
+188651/−43595 lines, 544 filesdep +base64-bytestringdep +processdep +timedep −aeson-prettydep ~aesondep ~basedep ~bytestringnew-component:exe:update-generation-testsnew-component:exe:update-haskell-eval-libnew-component:exe:update-haskell-kernelnew-component:exe:update-haskell-sourcesnew-component:exe:update-json-kernelnew-component:exe:update-json-mainnew-component:exe:update-json-manifestnew-component:exe:update-json-testnew-component:exe:update-kernel-testsnew-component:exe:verify-json-kernel
Dependencies added: base64-bytestring, process, time
Dependencies removed: aeson-pretty
Dependency ranges changed: aeson, base, bytestring, containers, filepath, hspec, hspec-discover, text
Files
- CHANGELOG.md +0/−16
- README.md +293/−131
- hydra.cabal +677/−79
- src/exec/update-generation-tests/Main.hs +46/−0
- src/exec/update-haskell-eval-lib/Main.hs +17/−0
- src/exec/update-haskell-kernel/Main.hs +16/−0
- src/exec/update-haskell-sources/Main.hs +34/−0
- src/exec/update-json-kernel/Main.hs +32/−0
- src/exec/update-json-main/Main.hs +32/−0
- src/exec/update-json-manifest/Main.hs +12/−0
- src/exec/update-json-test/Main.hs +32/−0
- src/exec/update-kernel-tests/Main.hs +32/−0
- src/exec/verify-json-kernel/Main.hs +207/−0
- src/gen-main/haskell/Hydra/Accessors.hs +42/−7
- src/gen-main/haskell/Hydra/Adapt/Literals.hs +221/−156
- src/gen-main/haskell/Hydra/Adapt/Modules.hs +72/−48
- src/gen-main/haskell/Hydra/Adapt/Simple.hs +377/−125
- src/gen-main/haskell/Hydra/Adapt/Terms.hs +751/−637
- src/gen-main/haskell/Hydra/Adapt/Utils.hs +73/−50
- src/gen-main/haskell/Hydra/Annotations.hs +115/−109
- src/gen-main/haskell/Hydra/Arity.hs +13/−3
- src/gen-main/haskell/Hydra/Ast.hs +34/−1
- src/gen-main/haskell/Hydra/Checking.hs +513/−0
- src/gen-main/haskell/Hydra/Classes.hs +25/−0
- src/gen-main/haskell/Hydra/CodeGeneration.hs +296/−0
- src/gen-main/haskell/Hydra/CoderUtils.hs +367/−0
- src/gen-main/haskell/Hydra/Coders.hs +15/−7
- src/gen-main/haskell/Hydra/Compute.hs +17/−1
- src/gen-main/haskell/Hydra/Constants.hs +25/−3
- src/gen-main/haskell/Hydra/Constraints.hs +8/−1
- src/gen-main/haskell/Hydra/Core.hs +168/−99
- src/gen-main/haskell/Hydra/Decode/Accessors.hs +130/−0
- src/gen-main/haskell/Hydra/Decode/Ast.hs +209/−0
- src/gen-main/haskell/Hydra/Decode/Classes.hs +39/−0
- src/gen-main/haskell/Hydra/Decode/Coders.hs +65/−0
- src/gen-main/haskell/Hydra/Decode/Compute.hs +48/−0
- src/gen-main/haskell/Hydra/Decode/Constraints.hs +38/−0
- src/gen-main/haskell/Hydra/Decode/Core.hs +541/−94
- src/gen-main/haskell/Hydra/Decode/Grammar.hs +107/−0
- src/gen-main/haskell/Hydra/Decode/Json.hs +61/−0
- src/gen-main/haskell/Hydra/Decode/Json/Model.hs +61/−0
- src/gen-main/haskell/Hydra/Decode/Module.hs +115/−0
- src/gen-main/haskell/Hydra/Decode/Parsing.hs +69/−0
- src/gen-main/haskell/Hydra/Decode/Phantoms.hs +34/−0
- src/gen-main/haskell/Hydra/Decode/Query.hs +229/−0
- src/gen-main/haskell/Hydra/Decode/Relational.hs +86/−0
- src/gen-main/haskell/Hydra/Decode/Tabular.hs +62/−0
- src/gen-main/haskell/Hydra/Decode/Testing.hs +669/−0
- src/gen-main/haskell/Hydra/Decode/Topology.hs +62/−0
- src/gen-main/haskell/Hydra/Decode/Typing.hs +98/−0
- src/gen-main/haskell/Hydra/Decode/Util.hs +90/−0
- src/gen-main/haskell/Hydra/Decode/Variants.hs +142/−0
- src/gen-main/haskell/Hydra/Decode/Workflow.hs +78/−0
- src/gen-main/haskell/Hydra/Decoding.hs +1535/−257
- src/gen-main/haskell/Hydra/Describe/Core.hs +0/−79
- src/gen-main/haskell/Hydra/Describe/Mantle.hs +0/−20
- src/gen-main/haskell/Hydra/Encode/Accessors.hs +163/−0
- src/gen-main/haskell/Hydra/Encode/Ast.hs +204/−0
- src/gen-main/haskell/Hydra/Encode/Classes.hs +27/−0
- src/gen-main/haskell/Hydra/Encode/Coders.hs +45/−0
- src/gen-main/haskell/Hydra/Encode/Compute.hs +46/−0
- src/gen-main/haskell/Hydra/Encode/Constraints.hs +37/−0
- src/gen-main/haskell/Hydra/Encode/Core.hs +187/−199
- src/gen-main/haskell/Hydra/Encode/Grammar.hs +120/−0
- src/gen-main/haskell/Hydra/Encode/Json.hs +49/−0
- src/gen-main/haskell/Hydra/Encode/Json/Model.hs +49/−0
- src/gen-main/haskell/Hydra/Encode/Module.hs +109/−0
- src/gen-main/haskell/Hydra/Encode/Parsing.hs +49/−0
- src/gen-main/haskell/Hydra/Encode/Phantoms.hs +31/−0
- src/gen-main/haskell/Hydra/Encode/Query.hs +247/−0
- src/gen-main/haskell/Hydra/Encode/Relational.hs +86/−0
- src/gen-main/haskell/Hydra/Encode/Tabular.hs +61/−0
- src/gen-main/haskell/Hydra/Encode/Testing.hs +822/−0
- src/gen-main/haskell/Hydra/Encode/Topology.hs +46/−0
- src/gen-main/haskell/Hydra/Encode/Typing.hs +129/−0
- src/gen-main/haskell/Hydra/Encode/Util.hs +73/−0
- src/gen-main/haskell/Hydra/Encode/Variants.hs +254/−0
- src/gen-main/haskell/Hydra/Encode/Workflow.hs +63/−0
- src/gen-main/haskell/Hydra/Encoding.hs +413/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Eithers.hs +112/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Flows.hs +377/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Lists.hs +218/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Maps.hs +143/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Maybes.hs +81/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Pairs.hs +32/−0
- src/gen-main/haskell/Hydra/Eval/Lib/Sets.hs +27/−0
- src/gen-main/haskell/Hydra/Ext/Haskell/Ast.hs +194/−1
- src/gen-main/haskell/Hydra/Ext/Haskell/Coder.hs +271/−207
- src/gen-main/haskell/Hydra/Ext/Haskell/Language.hs +48/−42
- src/gen-main/haskell/Hydra/Ext/Haskell/Operators.hs +40/−12
- src/gen-main/haskell/Hydra/Ext/Haskell/Serde.hs +114/−96
- src/gen-main/haskell/Hydra/Ext/Haskell/Utils.hs +69/−34
- src/gen-main/haskell/Hydra/Ext/Org/Json/Coder.hs +335/−248
- src/gen-main/haskell/Hydra/Ext/Org/Json/Decoding.hs +23/−14
- src/gen-main/haskell/Hydra/Ext/Org/Json/Language.hs +21/−18
- src/gen-main/haskell/Hydra/Ext/Org/Yaml/Model.hs +7/−1
- src/gen-main/haskell/Hydra/Extract/Core.hs +150/−123
- src/gen-main/haskell/Hydra/Extract/Helpers.hs +82/−0
- src/gen-main/haskell/Hydra/Extract/Json.hs +37/−22
- src/gen-main/haskell/Hydra/Extract/Mantle.hs +0/−22
- src/gen-main/haskell/Hydra/Extract/Util.hs +25/−0
- src/gen-main/haskell/Hydra/Formatting.hs +37/−35
- src/gen-main/haskell/Hydra/Grammar.hs +19/−1
- src/gen-main/haskell/Hydra/Grammars.hs +87/−63
- src/gen-main/haskell/Hydra/Graph.hs +7/−2
- src/gen-main/haskell/Hydra/Hoisting.hs +639/−0
- src/gen-main/haskell/Hydra/Inference.hs +1085/−1179
- src/gen-main/haskell/Hydra/Json.hs +0/−40
- src/gen-main/haskell/Hydra/Json/Bootstrap.hs +1504/−0
- src/gen-main/haskell/Hydra/Json/Decode.hs +286/−0
- src/gen-main/haskell/Hydra/Json/Encode.hs +132/−0
- src/gen-main/haskell/Hydra/Json/Model.hs +43/−0
- src/gen-main/haskell/Hydra/Json/Parser.hs +114/−0
- src/gen-main/haskell/Hydra/Json/Writer.hs +71/−0
- src/gen-main/haskell/Hydra/Languages.hs +12/−9
- src/gen-main/haskell/Hydra/Lexical.hs +105/−80
- src/gen-main/haskell/Hydra/Literals.hs +4/−1
- src/gen-main/haskell/Hydra/Mantle.hs +0/−246
- src/gen-main/haskell/Hydra/Module.hs +19/−5
- src/gen-main/haskell/Hydra/Monads.hs +123/−98
- src/gen-main/haskell/Hydra/Names.hs +16/−17
- src/gen-main/haskell/Hydra/Parsers.hs +152/−0
- src/gen-main/haskell/Hydra/Parsing.hs +64/−0
- src/gen-main/haskell/Hydra/Phantoms.hs +6/−1
- src/gen-main/haskell/Hydra/Query.hs +11/−1
- src/gen-main/haskell/Hydra/Reduction.hs +555/−170
- src/gen-main/haskell/Hydra/Reflect.hs +242/−0
- src/gen-main/haskell/Hydra/Relational.hs +4/−1
- src/gen-main/haskell/Hydra/Rewriting.hs +1729/−916
- src/gen-main/haskell/Hydra/Schemas.hs +393/−144
- src/gen-main/haskell/Hydra/Serialization.hs +227/−198
- src/gen-main/haskell/Hydra/Show/Accessors.hs +52/−47
- src/gen-main/haskell/Hydra/Show/Core.hs +303/−274
- src/gen-main/haskell/Hydra/Show/Graph.hs +6/−4
- src/gen-main/haskell/Hydra/Show/Mantle.hs +0/−52
- src/gen-main/haskell/Hydra/Show/Meta.hs +55/−0
- src/gen-main/haskell/Hydra/Show/Typing.hs +8/−4
- src/gen-main/haskell/Hydra/Show/Util.hs +21/−0
- src/gen-main/haskell/Hydra/Sorting.hs +53/−15
- src/gen-main/haskell/Hydra/Sources/Decode/Accessors.hs +1352/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Ast.hs +2117/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Classes.hs +187/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Coders.hs +466/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Compute.hs +394/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Constraints.hs +221/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Core.hs +6219/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Grammar.hs +1109/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Json/Model.hs +485/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Module.hs +1106/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Parsing.hs +559/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Phantoms.hs +221/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Query.hs +2272/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Relational.hs +953/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Tabular.hs +543/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Testing.hs +7425/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Topology.hs +478/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Typing.hs +1078/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Util.hs +743/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Variants.hs +1558/−0
- src/gen-main/haskell/Hydra/Sources/Decode/Workflow.hs +641/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Accessors.hs +1109/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Ast.hs +1211/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Classes.hs +109/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Coders.hs +230/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Compute.hs +242/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Constraints.hs +134/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Core.hs +4477/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Grammar.hs +702/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Json/Model.hs +302/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Module.hs +616/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Parsing.hs +246/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Phantoms.hs +112/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Query.hs +1544/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Relational.hs +517/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Tabular.hs +324/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Testing.hs +5049/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Topology.hs +309/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Typing.hs +834/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Util.hs +440/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Variants.hs +1814/−0
- src/gen-main/haskell/Hydra/Sources/Encode/Workflow.hs +333/−0
- src/gen-main/haskell/Hydra/Substitution.hs +91/−43
- src/gen-main/haskell/Hydra/Tabular.hs +31/−1
- src/gen-main/haskell/Hydra/Tarjan.hs +115/−83
- src/gen-main/haskell/Hydra/Templates.hs +73/−58
- src/gen-main/haskell/Hydra/Testing.hs +884/−5
- src/gen-main/haskell/Hydra/Topology.hs +6/−1
- src/gen-main/haskell/Hydra/Typing.hs +72/−5
- src/gen-main/haskell/Hydra/Unification.hs +107/−111
- src/gen-main/haskell/Hydra/Util.hs +68/−0
- src/gen-main/haskell/Hydra/Variants.hs +150/−212
- src/gen-main/haskell/Hydra/Workflow.hs +4/−1
- src/gen-test/haskell/Generation/Hydra/Test/AnnotationsSpec.hs +216/−0
- src/gen-test/haskell/Generation/Hydra/Test/FormattingSpec.hs +69/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/CharsSpec.hs +85/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/EithersSpec.hs +190/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/EqualitySpec.hs +190/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/FlowsSpec.hs +183/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/ListsSpec.hs +1370/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/LiteralsSpec.hs +578/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/LogicSpec.hs +74/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/MapsSpec.hs +319/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/MathSpec.hs +468/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/MaybesSpec.hs +146/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/PairsSpec.hs +48/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/SetsSpec.hs +289/−0
- src/gen-test/haskell/Generation/Hydra/Test/Lib/StringsSpec.hs +497/−0
- src/gen-test/haskell/Generation/Hydra/Test/MonadsSpec.hs +67/−0
- src/gen-test/haskell/Generation/Hydra/Test/ReductionSpec.hs +216/−0
- src/gen-test/haskell/Generation/Hydra/Test/SortingSpec.hs +350/−0
- src/gen-test/haskell/Generation/Spec.hs +44/−0
- src/gen-test/haskell/Hydra/Test/Annotations.hs +2362/−0
- src/gen-test/haskell/Hydra/Test/Checking/Advanced.hs +522/−0
- src/gen-test/haskell/Hydra/Test/Checking/AlgebraicTypes.hs +1322/−0
- src/gen-test/haskell/Hydra/Test/Checking/All.hs +33/−0
- src/gen-test/haskell/Hydra/Test/Checking/Collections.hs +1028/−0
- src/gen-test/haskell/Hydra/Test/Checking/Failures.hs +37/−0
- src/gen-test/haskell/Hydra/Test/Checking/Fundamentals.hs +4054/−0
- src/gen-test/haskell/Hydra/Test/Checking/NominalTypes.hs +6294/−0
- src/gen-test/haskell/Hydra/Test/EtaExpansion.hs +2255/−0
- src/gen-test/haskell/Hydra/Test/Formatting.hs +175/−0
- src/gen-test/haskell/Hydra/Test/Hoisting.hs +5843/−0
- src/gen-test/haskell/Hydra/Test/Inference/AlgebraicTypes.hs +1227/−0
- src/gen-test/haskell/Hydra/Test/Inference/AlgorithmW.hs +437/−0
- src/gen-test/haskell/Hydra/Test/Inference/All.hs +33/−0
- src/gen-test/haskell/Hydra/Test/Inference/Failures.hs +2182/−0
- src/gen-test/haskell/Hydra/Test/Inference/Fundamentals.hs +2637/−0
- src/gen-test/haskell/Hydra/Test/Inference/KernelExamples.hs +281/−0
- src/gen-test/haskell/Hydra/Test/Inference/NominalTypes.hs +697/−0
- src/gen-test/haskell/Hydra/Test/Json/Coder.hs +311/−0
- src/gen-test/haskell/Hydra/Test/Json/Parser.hs +450/−0
- src/gen-test/haskell/Hydra/Test/Json/Roundtrip.hs +217/−0
- src/gen-test/haskell/Hydra/Test/Json/Writer.hs +302/−0
- src/gen-test/haskell/Hydra/Test/Lib/Chars.hs +252/−0
- src/gen-test/haskell/Hydra/Test/Lib/Eithers.hs +735/−0
- src/gen-test/haskell/Hydra/Test/Lib/Equality.hs +765/−0
- src/gen-test/haskell/Hydra/Test/Lib/Flows.hs +1373/−0
- src/gen-test/haskell/Hydra/Test/Lib/Lists.hs +3200/−0
- src/gen-test/haskell/Hydra/Test/Lib/Literals.hs +1973/−0
- src/gen-test/haskell/Hydra/Test/Lib/Logic.hs +257/−0
- src/gen-test/haskell/Hydra/Test/Lib/Maps.hs +960/−0
- src/gen-test/haskell/Hydra/Test/Lib/Math.hs +1653/−0
- src/gen-test/haskell/Hydra/Test/Lib/Maybes.hs +673/−0
- src/gen-test/haskell/Hydra/Test/Lib/Pairs.hs +149/−0
- src/gen-test/haskell/Hydra/Test/Lib/Sets.hs +658/−0
- src/gen-test/haskell/Hydra/Test/Lib/Strings.hs +1374/−0
- src/gen-test/haskell/Hydra/Test/Monads.hs +429/−0
- src/gen-test/haskell/Hydra/Test/Ordering.hs +1076/−0
- src/gen-test/haskell/Hydra/Test/Reduction.hs +843/−0
- src/gen-test/haskell/Hydra/Test/Rewriting.hs +3973/−0
- src/gen-test/haskell/Hydra/Test/Serialization.hs +174/−0
- src/gen-test/haskell/Hydra/Test/Sorting.hs +452/−0
- src/gen-test/haskell/Hydra/Test/Substitution.hs +206/−0
- src/gen-test/haskell/Hydra/Test/TestGraph.hs +37/−326
- src/gen-test/haskell/Hydra/Test/TestSuite.hs +80/−10839
- src/gen-test/haskell/Hydra/Test/TestTerms.hs +61/−0
- src/gen-test/haskell/Hydra/Test/TestTypes.hs +496/−0
- src/gen-test/haskell/Hydra/Test/Unification.hs +635/−0
- src/main/haskell/Hydra/Dsl/Accessors.hs +0/−103
- src/main/haskell/Hydra/Dsl/Annotations.hs +23/−22
- src/main/haskell/Hydra/Dsl/AsTerm.hs +31/−0
- src/main/haskell/Hydra/Dsl/AsType.hs +24/−0
- src/main/haskell/Hydra/Dsl/Ast.hs +0/−189
- src/main/haskell/Hydra/Dsl/Bootstrap.hs +25/−1
- src/main/haskell/Hydra/Dsl/Coders.hs +0/−105
- src/main/haskell/Hydra/Dsl/Common.hs +0/−13
- src/main/haskell/Hydra/Dsl/Compute.hs +0/−95
- src/main/haskell/Hydra/Dsl/Core.hs +0/−575
- src/main/haskell/Hydra/Dsl/Grammar.hs +0/−38
- src/main/haskell/Hydra/Dsl/Grammars.hs +2/−0
- src/main/haskell/Hydra/Dsl/Graph.hs +0/−133
- src/main/haskell/Hydra/Dsl/Json.hs +0/−26
- src/main/haskell/Hydra/Dsl/Lib/Chars.hs +0/−31
- src/main/haskell/Hydra/Dsl/Lib/Equality.hs +0/−38
- src/main/haskell/Hydra/Dsl/Lib/Flows.hs +0/−46
- src/main/haskell/Hydra/Dsl/Lib/Lists.hs +0/−109
- src/main/haskell/Hydra/Dsl/Lib/Literals.hs +0/−144
- src/main/haskell/Hydra/Dsl/Lib/Logic.hs +0/−29
- src/main/haskell/Hydra/Dsl/Lib/Maps.hs +0/−69
- src/main/haskell/Hydra/Dsl/Lib/Math.hs +0/−31
- src/main/haskell/Hydra/Dsl/Lib/Optionals.hs +0/−46
- src/main/haskell/Hydra/Dsl/Lib/Sets.hs +0/−51
- src/main/haskell/Hydra/Dsl/Lib/Strings.hs +0/−55
- src/main/haskell/Hydra/Dsl/Literals.hs +3/−2
- src/main/haskell/Hydra/Dsl/Mantle.hs +0/−318
- src/main/haskell/Hydra/Dsl/Meta/Accessors.hs +105/−0
- src/main/haskell/Hydra/Dsl/Meta/Ast.hs +191/−0
- src/main/haskell/Hydra/Dsl/Meta/Base.hs +28/−0
- src/main/haskell/Hydra/Dsl/Meta/Coders.hs +111/−0
- src/main/haskell/Hydra/Dsl/Meta/Common.hs +15/−0
- src/main/haskell/Hydra/Dsl/Meta/Compute.hs +100/−0
- src/main/haskell/Hydra/Dsl/Meta/Core.hs +596/−0
- src/main/haskell/Hydra/Dsl/Meta/DeepCore.hs +162/−0
- src/main/haskell/Hydra/Dsl/Meta/Grammar.hs +40/−0
- src/main/haskell/Hydra/Dsl/Meta/Graph.hs +135/−0
- src/main/haskell/Hydra/Dsl/Meta/Json.hs +28/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Chars.hs +33/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Eithers.hs +48/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Equality.hs +42/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Flows.hs +56/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Lists.hs +122/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Literals.hs +173/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Logic.hs +35/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Maps.hs +74/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Math.hs +129/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Maybes.hs +51/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Pairs.hs +18/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Sets.hs +56/−0
- src/main/haskell/Hydra/Dsl/Meta/Lib/Strings.hs +56/−0
- src/main/haskell/Hydra/Dsl/Meta/Literals.hs +83/−0
- src/main/haskell/Hydra/Dsl/Meta/Module.hs +101/−0
- src/main/haskell/Hydra/Dsl/Meta/Parsing.hs +53/−0
- src/main/haskell/Hydra/Dsl/Meta/Phantoms.hs +437/−0
- src/main/haskell/Hydra/Dsl/Meta/Terms.hs +534/−0
- src/main/haskell/Hydra/Dsl/Meta/Testing.hs +780/−0
- src/main/haskell/Hydra/Dsl/Meta/Topology.hs +105/−0
- src/main/haskell/Hydra/Dsl/Meta/Types.hs +282/−0
- src/main/haskell/Hydra/Dsl/Meta/Typing.hs +180/−0
- src/main/haskell/Hydra/Dsl/Meta/Util.hs +28/−0
- src/main/haskell/Hydra/Dsl/Meta/Variants.hs +206/−0
- src/main/haskell/Hydra/Dsl/Module.hs +0/−93
- src/main/haskell/Hydra/Dsl/PhantomLiterals.hs +0/−82
- src/main/haskell/Hydra/Dsl/Phantoms.hs +0/−351
- src/main/haskell/Hydra/Dsl/Prims.hs +128/−43
- src/main/haskell/Hydra/Dsl/ShorthandTypes.hs +0/−117
- src/main/haskell/Hydra/Dsl/TBase.hs +0/−26
- src/main/haskell/Hydra/Dsl/TTerms.hs +0/−352
- src/main/haskell/Hydra/Dsl/TTypes.hs +0/−201
- src/main/haskell/Hydra/Dsl/Tabular.hs +3/−8
- src/main/haskell/Hydra/Dsl/Terms.hs +208/−217
- src/main/haskell/Hydra/Dsl/Testing.hs +0/−142
- src/main/haskell/Hydra/Dsl/Tests.hs +2/−0
- src/main/haskell/Hydra/Dsl/Topology.hs +0/−103
- src/main/haskell/Hydra/Dsl/Types.hs +152/−132
- src/main/haskell/Hydra/Dsl/Typing.hs +0/−112
- src/main/haskell/Hydra/Generation.hs +316/−81
- src/main/haskell/Hydra/Kernel.hs +20/−5
- src/main/haskell/Hydra/Lib/Chars.hs +8/−1
- src/main/haskell/Hydra/Lib/Eithers.hs +60/−0
- src/main/haskell/Hydra/Lib/Equality.hs +10/−1
- src/main/haskell/Hydra/Lib/Flows.hs +26/−2
- src/main/haskell/Hydra/Lib/Lists.hs +49/−0
- src/main/haskell/Hydra/Lib/Literals.hs +112/−4
- src/main/haskell/Hydra/Lib/Logic.hs +4/−0
- src/main/haskell/Hydra/Lib/Maps.hs +24/−3
- src/main/haskell/Hydra/Lib/Math.hs +144/−2
- src/main/haskell/Hydra/Lib/Maybes.hs +60/−0
- src/main/haskell/Hydra/Lib/Optionals.hs +0/−45
- src/main/haskell/Hydra/Lib/Pairs.hs +18/−0
- src/main/haskell/Hydra/Lib/Sets.hs +15/−0
- src/main/haskell/Hydra/Lib/Strings.hs +14/−0
- src/main/haskell/Hydra/Minimal.hs +1/−1
- src/main/haskell/Hydra/Sources/All.hs +38/−26
- src/main/haskell/Hydra/Sources/CoderUtils.hs +853/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/All.hs +92/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Eithers.hs +210/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Flows.hs +420/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Lists.hs +387/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Maps.hs +232/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Maybes.hs +185/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Pairs.hs +88/−0
- src/main/haskell/Hydra/Sources/Eval/Lib/Sets.hs +88/−0
- src/main/haskell/Hydra/Sources/Haskell/Ast.hs +919/−453
- src/main/haskell/Hydra/Sources/Haskell/Coder.hs +1097/−861
- src/main/haskell/Hydra/Sources/Haskell/Language.hs +139/−123
- src/main/haskell/Hydra/Sources/Haskell/Operators.hs +263/−224
- src/main/haskell/Hydra/Sources/Haskell/Serde.hs +413/−346
- src/main/haskell/Hydra/Sources/Haskell/Utils.hs +245/−207
- src/main/haskell/Hydra/Sources/Json/Bootstrap.hs +55/−0
- src/main/haskell/Hydra/Sources/Json/Coder.hs +462/−397
- src/main/haskell/Hydra/Sources/Json/Decode.hs +525/−0
- src/main/haskell/Hydra/Sources/Json/Decoding.hs +129/−108
- src/main/haskell/Hydra/Sources/Json/Encode.hs +261/−0
- src/main/haskell/Hydra/Sources/Json/Extract.hs +146/−132
- src/main/haskell/Hydra/Sources/Json/Language.hs +111/−98
- src/main/haskell/Hydra/Sources/Json/Model.hs +48/−0
- src/main/haskell/Hydra/Sources/Json/Parser.hs +392/−0
- src/main/haskell/Hydra/Sources/Json/Writer.hs +206/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Literals.hs +339/−288
- src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Modules.hs +146/−122
- src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Simple.hs +604/−249
- src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Terms.hs +853/−764
- src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Utils.hs +206/−184
- src/main/haskell/Hydra/Sources/Kernel/Terms/All.hs +119/−16
- src/main/haskell/Hydra/Sources/Kernel/Terms/Annotations.hs +358/−361
- src/main/haskell/Hydra/Sources/Kernel/Terms/Arity.hs +94/−70
- src/main/haskell/Hydra/Sources/Kernel/Terms/Checking.hs +798/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/CodeGeneration.hs +542/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Constants.hs +120/−77
- src/main/haskell/Hydra/Sources/Kernel/Terms/Decode/Core.hs +0/−238
- src/main/haskell/Hydra/Sources/Kernel/Terms/Decoding.hs +781/−411
- src/main/haskell/Hydra/Sources/Kernel/Terms/Describe/Core.hs +0/−114
- src/main/haskell/Hydra/Sources/Kernel/Terms/Describe/Mantle.hs +0/−62
- src/main/haskell/Hydra/Sources/Kernel/Terms/Encode/Core.hs +0/−507
- src/main/haskell/Hydra/Sources/Kernel/Terms/Encoding.hs +492/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Core.hs +860/−666
- src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Helpers.hs +229/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Mantle.hs +0/−72
- src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Util.hs +88/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Formatting.hs +138/−107
- src/main/haskell/Hydra/Sources/Kernel/Terms/Grammars.hs +200/−179
- src/main/haskell/Hydra/Sources/Kernel/Terms/Hoisting.hs +1009/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Inference.hs +1310/−1506
- src/main/haskell/Hydra/Sources/Kernel/Terms/Languages.hs +67/−51
- src/main/haskell/Hydra/Sources/Kernel/Terms/Lexical.hs +317/−223
- src/main/haskell/Hydra/Sources/Kernel/Terms/Literals.hs +67/−49
- src/main/haskell/Hydra/Sources/Kernel/Terms/Monads.hs +269/−223
- src/main/haskell/Hydra/Sources/Kernel/Terms/Names.hs +97/−75
- src/main/haskell/Hydra/Sources/Kernel/Terms/Parsers.hs +299/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Reduction.hs +944/−411
- src/main/haskell/Hydra/Sources/Kernel/Terms/Reflect.hs +340/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Rewriting.hs +2281/−1173
- src/main/haskell/Hydra/Sources/Kernel/Terms/Schemas.hs +918/−502
- src/main/haskell/Hydra/Sources/Kernel/Terms/Serialization.hs +489/−468
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Accessors.hs +118/−104
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Core.hs +427/−394
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Graph.hs +59/−45
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Mantle.hs +0/−102
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Meta.hs +116/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Typing.hs +65/−50
- src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Util.hs +80/−0
- src/main/haskell/Hydra/Sources/Kernel/Terms/Sorting.hs +140/−67
- src/main/haskell/Hydra/Sources/Kernel/Terms/Substitution.hs +244/−136
- src/main/haskell/Hydra/Sources/Kernel/Terms/Tarjan.hs +164/−159
- src/main/haskell/Hydra/Sources/Kernel/Terms/Templates.hs +143/−128
- src/main/haskell/Hydra/Sources/Kernel/Terms/Unification.hs +181/−163
- src/main/haskell/Hydra/Sources/Kernel/Terms/Variants.hs +0/−322
- src/main/haskell/Hydra/Sources/Kernel/Types/Accessors.hs +119/−52
- src/main/haskell/Hydra/Sources/Kernel/Types/All.hs +14/−4
- src/main/haskell/Hydra/Sources/Kernel/Types/Ast.hs +166/−82
- src/main/haskell/Hydra/Sources/Kernel/Types/Classes.hs +30/−0
- src/main/haskell/Hydra/Sources/Kernel/Types/Coders.hs +99/−83
- src/main/haskell/Hydra/Sources/Kernel/Types/Compute.hs +83/−51
- src/main/haskell/Hydra/Sources/Kernel/Types/Constraints.hs +32/−27
- src/main/haskell/Hydra/Sources/Kernel/Types/Core.hs +556/−354
- src/main/haskell/Hydra/Sources/Kernel/Types/Grammar.hs +95/−51
- src/main/haskell/Hydra/Sources/Kernel/Types/Graph.hs +58/−58
- src/main/haskell/Hydra/Sources/Kernel/Types/Json.hs +0/−48
- src/main/haskell/Hydra/Sources/Kernel/Types/Mantle.hs +0/−122
- src/main/haskell/Hydra/Sources/Kernel/Types/Module.hs +113/−80
- src/main/haskell/Hydra/Sources/Kernel/Types/Parsing.hs +65/−0
- src/main/haskell/Hydra/Sources/Kernel/Types/Phantoms.hs +26/−23
- src/main/haskell/Hydra/Sources/Kernel/Types/Query.hs +166/−130
- src/main/haskell/Hydra/Sources/Kernel/Types/Relational.hs +83/−67
- src/main/haskell/Hydra/Sources/Kernel/Types/Tabular.hs +49/−30
- src/main/haskell/Hydra/Sources/Kernel/Types/Testing.hs +829/−64
- src/main/haskell/Hydra/Sources/Kernel/Types/Topology.hs +52/−41
- src/main/haskell/Hydra/Sources/Kernel/Types/Typing.hs +128/−57
- src/main/haskell/Hydra/Sources/Kernel/Types/Util.hs +55/−0
- src/main/haskell/Hydra/Sources/Kernel/Types/Variants.hs +97/−0
- src/main/haskell/Hydra/Sources/Kernel/Types/Workflow.hs +67/−68
- src/main/haskell/Hydra/Sources/Libraries.hs +265/−445
- src/main/haskell/Hydra/Sources/Test/All.hs +23/−0
- src/main/haskell/Hydra/Sources/Test/Annotations.hs +261/−0
- src/main/haskell/Hydra/Sources/Test/Checking/Advanced.hs +190/−0
- src/main/haskell/Hydra/Sources/Test/Checking/AlgebraicTypes.hs +425/−0
- src/main/haskell/Hydra/Sources/Test/Checking/All.hs +51/−0
- src/main/haskell/Hydra/Sources/Test/Checking/Collections.hs +353/−0
- src/main/haskell/Hydra/Sources/Test/Checking/Failures.hs +74/−0
- src/main/haskell/Hydra/Sources/Test/Checking/Fundamentals.hs +910/−0
- src/main/haskell/Hydra/Sources/Test/Checking/NominalTypes.hs +1651/−0
- src/main/haskell/Hydra/Sources/Test/EtaExpansion.hs +422/−0
- src/main/haskell/Hydra/Sources/Test/Formatting.hs +59/−16
- src/main/haskell/Hydra/Sources/Test/Hoisting.hs +2137/−0
- src/main/haskell/Hydra/Sources/Test/Inference/AlgebraicTypes.hs +264/−91
- src/main/haskell/Hydra/Sources/Test/Inference/AlgorithmW.hs +38/−21
- src/main/haskell/Hydra/Sources/Test/Inference/All.hs +51/−0
- src/main/haskell/Hydra/Sources/Test/Inference/Failures.hs +100/−57
- src/main/haskell/Hydra/Sources/Test/Inference/Fundamentals.hs +220/−47
- src/main/haskell/Hydra/Sources/Test/Inference/InferenceSuite.hs +0/−23
- src/main/haskell/Hydra/Sources/Test/Inference/KernelExamples.hs +89/−20
- src/main/haskell/Hydra/Sources/Test/Inference/NominalTypes.hs +122/−87
- src/main/haskell/Hydra/Sources/Test/Inference/Simple.hs +0/−272
- src/main/haskell/Hydra/Sources/Test/Json/Coder.hs +231/−0
- src/main/haskell/Hydra/Sources/Test/Json/Parser.hs +181/−0
- src/main/haskell/Hydra/Sources/Test/Json/Roundtrip.hs +129/−0
- src/main/haskell/Hydra/Sources/Test/Json/Writer.hs +152/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Chars.hs +93/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Eithers.hs +184/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Equality.hs +194/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Flows.hs +267/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Lists.hs +406/−374
- src/main/haskell/Hydra/Sources/Test/Lib/Literals.hs +558/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Logic.hs +84/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Maps.hs +256/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Math.hs +412/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Maybes.hs +188/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Pairs.hs +69/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Sets.hs +171/−0
- src/main/haskell/Hydra/Sources/Test/Lib/Strings.hs +253/−189
- src/main/haskell/Hydra/Sources/Test/Monads.hs +96/−0
- src/main/haskell/Hydra/Sources/Test/Ordering.hs +375/−0
- src/main/haskell/Hydra/Sources/Test/Reduction.hs +330/−0
- src/main/haskell/Hydra/Sources/Test/Rewriting.hs +1235/−0
- src/main/haskell/Hydra/Sources/Test/Serialization.hs +194/−0
- src/main/haskell/Hydra/Sources/Test/Sorting.hs +160/−0
- src/main/haskell/Hydra/Sources/Test/Substitution.hs +146/−0
- src/main/haskell/Hydra/Sources/Test/TestGraph.hs +77/−326
- src/main/haskell/Hydra/Sources/Test/TestSuite.hs +130/−49
- src/main/haskell/Hydra/Sources/Test/TestTerms.hs +65/−0
- src/main/haskell/Hydra/Sources/Test/TestTypes.hs +439/−0
- src/main/haskell/Hydra/Sources/Test/Unification.hs +415/−0
- src/main/haskell/Hydra/Sources/Yaml/Model.hs +63/−82
- src/main/haskell/Hydra/Staging/Json/Serde.hs +0/−84
- src/main/haskell/Hydra/Staging/Lib/Names.hs +304/−0
- src/main/haskell/Hydra/Staging/Testing/Generation/Generate.hs +306/−0
- src/main/haskell/Hydra/Staging/Testing/Generation/HaskellCodec.hs +533/−0
- src/main/haskell/Hydra/Staging/Testing/Generation/Transform.hs +192/−0
- src/main/haskell/Hydra/Staging/Yaml/Coder.hs +7/−5
- src/main/haskell/Hydra/Staging/Yaml/Language.hs +5/−3
- src/main/haskell/Hydra/Staging/Yaml/Modules.hs +19/−22
- src/main/haskell/Hydra/Staging/Yaml/Serde.hs +2/−0
- src/main/haskell/Hydra/Tools/Bytestrings.hs +2/−0
- src/main/haskell/Hydra/Tools/Monads.hs +0/−6
- src/main/haskell/Org/Example/Lispy.hs +98/−0
- src/test/haskell/GenerationSpec.hs +11/−0
- src/test/haskell/Hydra/Adapt/LiteralsSpec.hs +3/−2
- src/test/haskell/Hydra/Adapt/TermsSpec.hs +13/−14
- src/test/haskell/Hydra/AnnotationsSpec.hs +0/−131
- src/test/haskell/Hydra/ArbitraryCore.hs +25/−17
- src/test/haskell/Hydra/CoreCodersSpec.hs +215/−20
- src/test/haskell/Hydra/Dsl/TypesSpec.hs +9/−11
- src/test/haskell/Hydra/InferenceSpec.hs +0/−1699
- src/test/haskell/Hydra/Json/AesonSpec.hs +80/−0
- src/test/haskell/Hydra/MonadsSpec.hs +9/−10
- src/test/haskell/Hydra/ReductionSpec.hs +0/−175
- src/test/haskell/Hydra/Reference/AlgorithmW.hs +45/−20
- src/test/haskell/Hydra/Reference/AlgorithmWBridge.hs +21/−38
- src/test/haskell/Hydra/Reference/AlgorithmWSpec.hs +7/−8
- src/test/haskell/Hydra/RewritingSpec.hs +0/−605
- src/test/haskell/Hydra/SerializationSpec.hs +0/−113
- src/test/haskell/Hydra/SortingSpec.hs +0/−157
- src/test/haskell/Hydra/Staging/Json/CoderSpec.hs +0/−140
- src/test/haskell/Hydra/Staging/Json/Serde.hs +86/−0
- src/test/haskell/Hydra/Staging/Json/SerdeSpec.hs +0/−107
- src/test/haskell/Hydra/Staging/TestGraph.hs +0/−46
- src/test/haskell/Hydra/Staging/Yaml/CoderSpec.hs +1/−2
- src/test/haskell/Hydra/Staging/Yaml/SerdeSpec.hs +22/−16
- src/test/haskell/Hydra/TestData.hs +0/−57
- src/test/haskell/Hydra/TestSuiteSpec.hs +449/−13
- src/test/haskell/Hydra/TestUtils.hs +113/−27
- src/test/haskell/Hydra/UpdateGenerationTests.hs +46/−0
- src/test/haskell/Spec.hs +1/−0
- stack.yaml +3/−0
− CHANGELOG.md
@@ -1,16 +0,0 @@-Note: this change log tracks hydra-haskell changes only, exlusive of hydra-java, hydra-scala, and hydra-extensions--# 0.1.0--This is the first packaged release of Hydra. It contains everything developed so far, including:-* Hydra's core type and data languages-* Core models for graphs and modules, computation, BNF grammars, phantom types, and basic operations on types and terms-* Hindley-Milner style type inference-* Hydra's adapter (type/type rewriting) system-* Haskell and Java coders for both types and terms-* Partial Scala coder for terms-* Type and term DSLs-* Additional coders for Avro, JSON, PDL, RDF+SHACL, and YAML-* Models for GraphQL, OWL, ShEx, and TinkerPop-style property graphs-* QuickCheck tests-
README.md view
@@ -1,219 +1,381 @@ # Hydra-Haskell -Hydra is a functional programming language which aims to be highly flexible and portable.-It has its roots in graph databases and type theory, and provides APIs in Haskell, Java, and Python.-See the main Hydra [README](https://github.com/CategoricalData/hydra) for more details.-This Haskell package contains Hydra's Haskell API and Haskell sources specifically.+Hydra is a functional programming language based on the [LambdaGraph](https://bit.ly/lg-kgc2024) data model,+exploring an isomorphism between typed lambda calculus and labeled hypergraphs.+See the main Hydra [README](https://github.com/CategoricalData/hydra) for project overview and use cases.++This package contains Hydra's **Haskell implementation**, which serves as the bootstrapping implementation for the entire Hydra project. Releases are available [on Hackage](https://hackage.haskell.org/package/hydra). +## Code Organization++Hydra-Haskell uses the **src/main vs src/gen-main** separation pattern (see [Code organization wiki page](https://github.com/CategoricalData/hydra/wiki/Code-organization) for details).++- **`src/main/haskell/`** - Hand-written source code+ - `Hydra/Dsl/` - DSL syntax definitions+ - `Hydra/Sources/` - Kernel specifications written in the DSL+ - `Hydra/Lib/` - Native primitive implementations+ - `Hydra/Generation.hs` - Code generation utilities++- **`src/gen-main/haskell/`** - Generated code+ - `Hydra/Core.hs`, `Hydra/Graph.hs`, etc. - Complete kernel implementation+ - Generated by running `writeHaskell` in GHCi++- **`src/gen-test/haskell/`** - Generated test code+ - Kernel tests generated from test sources using `writeHaskell`+ - Generation tests created using language-specific test generators+ - See [Testing](#test) section for details++Haskell serves as the **bootstrapping implementation** - the DSL sources here generate code for Java, Python, and other languages.++## Documentation++For comprehensive documentation about Hydra's architecture, type system, and implementation details, see:++- **[Concepts](https://github.com/CategoricalData/hydra/wiki/Concepts)** - Core concepts: Type, Term, Graph, Flow monad, primitives, coders+- **[Implementation](https://github.com/CategoricalData/hydra/blob/main/docs/src/implementation.md)** - Detailed guide covering type modules, DSLs, primitives, coders, and the bootstrap process+- **[DSL Guide](https://github.com/CategoricalData/hydra/blob/main/docs/src/dsl-guide.md)** - Comprehensive guide to Hydra's domain-specific languages+- **[Code Organization](https://github.com/CategoricalData/hydra/wiki/Code-organization)** - The src/main vs src/gen-main pattern+- **[Testing](https://github.com/CategoricalData/hydra/wiki/Testing)** - Common test suite and language-specific testing+- **[Developer Recipes](https://github.com/CategoricalData/hydra/blob/main/docs/src/recipes/index.md)** - Step-by-step guides for extending Hydra++This README focuses on practical instructions for building, testing, and generating code with Hydra-Haskell.+ ## Build -Haskell is Hydra's bootstrapping language, which means that,-while the entire Hydra kernel is written in the Hydra language itself,-the sources are written in a Haskell-based domain-specific language (DSL).-You can find the DSL-based sources [here](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Sources);-anything written in the DSL is also mapped into the generated Java and Python sources.-You can find the generated Haskell sources [here](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/gen-main/haskell).-To build Hydra-Haskell and enter the GHCi REPL,-first install the [Haskell Tool Stack](https://docs.haskellstack.org/en/stable) ("Stack"),-and then use:+Haskell is Hydra's **bootstrapping language**. The entire Hydra kernel is written using Haskell-based domain-specific languages (DSLs):+- **DSL syntax**: [src/main/haskell/Hydra/Dsl](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Dsl) - Specify the syntax for Hydra programs written in Haskell+- **DSL-based sources**: [src/main/haskell/Hydra/Sources](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Sources) - Type definitions and core logic written in Haskell DSL+- **Generated code**: [src/gen-main/haskell](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/gen-main/haskell) - Haskell code generated from DSL sources+- **Primitives**: [src/main/haskell/Hydra/Lib](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Lib) - Hydra's standard libraries of primitive functions and constants, implemented in Haskell. These libraries are registered in [Libraries.hs](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Sources/Libraries.hs). +The DSL sources are also used to generate Java and Python implementations, ensuring parity across each Hydra language variant.++### Build and REPL++First, install the [Haskell Tool Stack](https://docs.haskellstack.org/en/stable):+ ```bash-stack ghci+# On macOS+brew install haskell-stack++# Other platforms: see https://docs.haskellstack.org/en/stable/install_and_upgrade/ ``` +Then build and enter the GHCi REPL:++```bash+stack ghci hydra:lib+```++Note: The `hydra:lib` target is required to avoid loading test modules. Running `stack ghci` without a target will load all components including test dependencies, which you may not need.+ ## Test -To run all tests at the command line, use:+Run all tests: ```bash stack test ``` -If you are familiar with Hydra-Haskell internals and you want to enter the test environment interactively:+For interactive testing with access to test utilities: ```bash stack ghci hydra:lib hydra:hydra-test ``` -Or just `stack ghci hydra:hydra-test` if you want to treat the library as an external dependency.-Now in the REPL, you can access test resources,--```haskell-:t Hydra.TestUtils.termTestContext-```--or run individual Hspec test cases.+Then in the REPL, you can run individual tests: ```haskell Test.Hspec.hspec Hydra.TestSuiteSpec.spec ``` +See the [Testing wiki page](https://github.com/CategoricalData/hydra/wiki/Testing) for details on Hydra's common test suite, which ensures parity across all Hydra language variants.+ ## Code generation -Hydra is a self-hosting compiler in Haskell, which means that it can generate-all of its own Haskell source code, with the exception of a few built-in-artifacts such as Haskell-specific implementations of Hydra's primitive-functions.+Hydra is **self-hosting**: it can generate its own source code from DSL definitions. -We are currently working on "closing the loop" in Java and Python, as well,-but that code is currently in `hydra-ext`; see the [Hydra-Ext README](https://github.com/CategoricalData/hydra/blob/main/hydra-ext/README.md)-for details on Java and Python code generation, as well as many other coders-including property graphs and their formats, RDF and their formats, Avro,-Protobuf, C++, Scala, and others.+### Generate Haskell code -You can generate Hydra's Haskell sources by first entering the GHCi REPL as above, then:+Enter the GHCi REPL and import the generation module: ```haskell import Hydra.Generation+``` -writeHaskell "src/gen-main/haskell" mainModules+Generate all main modules provided in Hydra-Haskell:++```haskell+-- First arg: output directory+-- Second arg: universe modules (for dependency resolution)+-- Third arg: modules to generate+writeHaskell "src/gen-main/haskell" mainModules mainModules ``` -The first argument to `writeHaskell` is the base directory to which the generated files are to be written,-and the second is the list of modules you want to generate (in this case, a special list containing all built-in modules).-To generate only the Hydra kernel, use:+Generate only the Hydra kernel (excluding other Hydra-Haskell artifacts like the Haskell coder, the JSON coder, etc.): ```haskell-writeHaskell "src/gen-main/haskell" kernelModules+writeHaskell "src/gen-main/haskell" kernelModules kernelModules ``` -For individual modules, use list syntax, e.g.+Generate specific main modules: ```haskell-writeHaskell "src/gen-main/haskell" [haskellLanguageModule, haskellCoderModule]+-- For specific modules, include dependencies in the universe+writeHaskell "src/gen-main/haskell" mainModules [haskellLanguageModule, haskellCoderModule] ``` -To generate test modules, use:+Generate kernel test modules: ```haskell-writeHaskell "src/gen-test/haskell" testModules+let allModules = mainModules ++ testModules+writeHaskell "src/gen-test/haskell" allModules baseTestModules ``` -### JSON and YAML generation+Or use the convenience script: -JSON and YAML are slightly different than the languages above, in that they are pure data languages, without accompanying syntax for schemas (types).-Hydra terms can be serialized to either JSON or YAML by first providing a type, then any number of terms corresponding to that type.-For example:+```bash+./bin/update-kernel-tests.sh+``` -```haskell-:module Hydra.Kernel-import Hydra.Codegen-import Hydra.Langs.Json.Serde-import Hydra.Dsl.Terms as Terms+This generates tests that validate the Hydra kernel implementation. --- Choose a graph in which to execute flows; we will use the Hydra kernel graph.-g = hydraCoreGraph-flow = fromFlowIo g+Generate language-specific generation tests (tests that verify code generation to Haskell): --- Choose a type for terms to encode. In this case, we will be encoding numeric precision values.-typ = TypeVariable _Precision+```bash+./bin/update-generation-tests.sh+``` --- Construct an instance of the chosen type. In this case, we construct a precision value, then encode it as a term.-term = Terms.inject _Precision (Field _Precision_bits $ Terms.int32 64)+These two types of tests serve different purposes:+- **Kernel tests**: Validate core Hydra functionality (type checking, reduction, etc.)+- **Generation tests**: Verify that Hydra can correctly generate code in target languages --- Create the adapting coder-coder <- flow $ jsonStringCoder typ+Note `src/gen-test` as opposed to `src/gen-main`. --- Apply the encoding, which turns the term into a JSON string.-flow (coderEncode coder term) >>= putStrLn+### Generate code for other languages++Java and Python code generation is handled by the [Hydra-Ext](https://github.com/CategoricalData/hydra/tree/main/hydra-ext) package.+From the `hydra-ext` directory:++```bash+cd ../hydra-ext && stack ghci ``` -For a more sophisticated example involving recursive types, use:+Then in GHCi: ```haskell-typ = TypeVariable _Type-term = Terms.inject _Type (Field _Type_literal $ Terms.inject _LiteralType (Field _LiteralType_boolean $ Terms.record _UnitType []))+import Hydra.Ext.Generation++-- Generate Python kernel+-- Second arg: universe modules (for dependency resolution)+-- Third arg: modules to generate+writePython "../hydra-python/src/gen-main/python" kernelModules kernelModules++-- Generate Java kernel+writeJava "../hydra-java/src/gen-main/java" kernelModules kernelModules ``` -in place of the `Precision` type and term above.-This defines a type (in this case, the type of all types), and also a term which is an instance of that type (so in this case, an encoded type).+And similar for test artifacts. See the Hydra-Ext README for more details.+Hydra-Ext also includes coders for many other languages and formats: Avro, Protobuf, C++, C#, Scala, GraphQL, JSON Schema, RDF, and more. -## Haskell API+## Working with Hydra -### Structures+### Core types -The most important structural types in Hydra are `Type` and `Term` (provided in the generated [Hydra.Core](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Core.hs) module in Haskell),-and `Graph` and `Element` (provided in the generated [Hydra.Mantle](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Mantle.hs) module).-`Type` provides a datatype, and a `Term` is an instance of a known `Type`.-An `Element` is a named term together with its type, and a `Graph` is a collection of elements.-A `Module` is a collection of elements in the same logical namespace, sometimes called a "model" if most of the elements represent type definitions.-The main purpose of Hydra is to define and carry out transformations between graphs,-where those graphs may be almost anything which fits into Hydra's type system -- data, schemas, source code, other transformations, etc.-"Graphs" in the traditional sense are partially supported at this time, including property graphs and RDF graphs.+Some of the fundamental types in Hydra are: -Types, terms, graphs, elements, and many other entities are parameterized by an annotation type, so you will usually see `Type m`, `Term m`, `Context m`, etc. in the code.-The most common annotation type is called `Meta` (which is just a map of string-valued keys to terms), so you will also encounter `Type Meta`, etc.+- **`Type`** - Represents the structure of data (literals, records, unions, functions, etc.)+- **`Term`** - Represents data or computation (instances of types)+- **`Binding`** - A named binding (name + term + type scheme), also called an *element*.+- **`Graph`** - A collection of elements with an environment, types, primitives, and schema graph+- **`Module`** - A namespace containing elements with dependencies on other modules -### Transformations+These are defined in [Hydra/Sources/Kernel/Types](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Sources/Kernel/Types)+and code-generated into [Hydra.Core](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Core.hs),+[Hydra.Graph](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Graph.hs), and+[Hydra.Module](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Module.hs). -Transformations in Hydra take the form of simple functions or, more commonly, expressions involving the `Flow` monad-(a special case of the [State](https://wiki.haskell.org/State_Monad) monad, which has been implemented in many programming languages)-as well as a bidirectional flow called `Coder` and a two-level transformation (types and terms) called `Adapter`.-All of these constructs are provided in the generated [Hydra.Compute](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/gen-main/haskell/Hydra/Compute.hs) module in Haskell,-along with the `Context` type which you will see almost everywhere in Hydra;-a `Context` provides a graph, the schema of that graph (which is itself a graph), a set of primitive functions, an evaluation strategy, and other constructs which are needed for computation.-A context is part of the state which flows through a graph transformation as it is being applied.+See [Concepts](https://github.com/CategoricalData/hydra/wiki/Concepts) for detailed explanations. -In Haskell, you will often see `Flow` and `Context` combined as the `GraphFlow` alias:+### The Flow monad +Transformations in Hydra use the `Flow` monad for:+- State management (graph context)+- Error handling+- Logging and tracing+ ```haskell-type GraphFlow m = Flow (Context m)+type Flow s a = s -> Trace -> FlowState s a ``` -There are two helper types, `FlowState` and `Trace`, which are used together with `Flow`; a `FlowState` is the result of evaluating a `Flow`,-while `Trace` encapsulates a stack trace and error or logger messages.-Since `Flow` is a monad, you can create a `GraphFlow` with `f = pure x`, where `x` is anything you would like to enter into a transformation pipeline.-The transformation is actually applied when you call `unFlow` and pass in a graph context and a trace, i.e.+Common usage pattern: ```haskell-unFlow f cx emptyTrace+import Hydra.Compute (Flow, FlowState, unFlow, emptyTrace)++-- Create a Flow+myComputation :: Flow Graph String+myComputation = pure "result"++-- Execute it+let state = unFlow myComputation graph emptyTrace+case flowStateValue state of+ Just result -> putStrLn result+ Nothing -> print (flowStateMessages $ flowStateTrace state) ``` -This gives you a flow state, which you can think of as the exit point of a transformation.-Inside the state object is either a concrete value (if the transformation succeeded) or `Nothing` (if the transformation failed), a stack trace, and a list of messages.-You will always find at least one message if the transformation failed; this is analogous to an exception in mainstream programming languages.+### Coders and adapters -A `Coder`, as mentioned above, is a construct which has a `Flow` in either direction between two types.-As a trivial example, consider this coder which serializes integers to strings using Haskell's built-in `show` function, then reads the strings back to integers using `read`:+**Coders** are bidirectional transformations: ```haskell-intStringCoder :: Coder () () Int String-intStringCoder = Coder {- coderEncode = pure . show,- coderDecode = pure . read}+data Coder s1 s2 v1 v2 = Coder {+ coderEncode :: v1 -> Flow s2 v2,+ coderDecode :: v2 -> Flow s1 v1+} ``` -The `()`'s indicate that this coder is stateless in both directions, which makes the use of `Coder` overkill in this case.-For a more realistic, but still simple example, see the [JSON coder](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Ext/Json/Coder.hs), which makes use of state for error propagation.-For a more sophisticated example, see the [Haskell coder](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Ext/Haskell/Coder.hs)-or the [Java coder](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Ext/Java/Coder.hs);-these make use of all of the facilities of a graph flow, including lexical lookups, type decoding, annotations, etc.+**Adapters** also transform types, enabling schema evolution and language mapping. +See the [Implementation wiki](https://github.com/CategoricalData/hydra/blob/main/docs/src/implementation.md#cross-language-compilation-coders) for details.+ ### DSLs -Constructing types and terms directly from the `Type` and `Term` APIs mentioned above is perfectly correct, but not very convenient.-For example, the type of all lists of strings may be expressed as `TypeList $ TypeLiteral LiteralTypeString`,-and a specific instance of that type (a term) may be expressed as `TermList [TermLiteral $ LiteralString "foo", TermLiteral $ LiteralString "bar"]`.+Hydra provides multiple domain-specific languages for constructing types and terms: -Since all of the work of defining transformations in Hydra consists of specifying types and terms, we make the task (much) easier using domain-specific languages (DSLs).-These DSLs are specific to the host language, so we have Haskell DSLs in hydra-haskell, and (similar, but distinct) Java DSLs in hydra-java.-For example, the type of a list of strings is just `list string` if you include the [Types](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Dsl/Types.hs) DSL,-and the specific list of strings we mentioned is just `list [string "foo", string "bar"]`, or (better yet) `list ["foo", "bar"]` if you include the [Terms](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Dsl/Terms.hs) DSL.-There is additional syntactic sugar in Hydra-Haskell which aims to make defining models and transformations as easy as possible;-see the [Sources](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Sources) directory for many examples.+**Untyped DSLs** ([Hydra/Dsl/Types.hs](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Dsl/Types.hs),+[Hydra/Dsl/Terms.hs](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Dsl/Terms.hs)):+```haskell+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Terms as Terms -### Phantom types+personType = Types.record [+ "name" >: string,+ "age" >: int32] -A minority of Hydra's primary sources, rather than providing models (type definitions), provide collections of functions.-For example, look at [Basics.hs](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Sources/Basics.hs)-or [Utils.hs](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Sources/Adapters/Utils.hs).-There are not many of these files because the syntax for constructing transformations natively in Hydra DSLs is still in flux,-but you will notice that the type signatures in these modules look very different.-For example, you will see signatures like `Definition (Precision -> String)` which appear to use native Haskell types such as `String`,-or generated types like `Precision`, rather than Hydra's low-level constructs (`Type`, `Term`, etc.).-This is a convenience for the programmer which will will be expanded upon as more of Hydra's kernel (indispensable code which is needed in each host language)-is pulled out of raw Haskell and into the DSLs.-If you are curious how these types work, see the [Phantoms](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Impl/Haskell/Sources/Phantoms.hs) model-and [these slides](https://www.slideshare.net/joshsh/transpilers-gone-wild-introducing-hydra/34).-Phantom types are available both in Haskell and Java.+alice = Terms.record [+ "name" >: Terms.string "Alice",+ "age" >: Terms.int32 30]+```++**Phantom-typed DSLs** ([Hydra/Dsl/Meta/Phantoms.hs](https://github.com/CategoricalData/hydra/blob/main/hydra-haskell/src/main/haskell/Hydra/Dsl/Meta/Phantoms.hs)) - Compile-time type safety:+```haskell+import Hydra.Dsl.Meta.Phantoms++safeFn :: TTerm (Int -> String)+safeFn = lambda "x" (Strings.toUpper (var "x")) -- Type-checked at compile time+```++**Library DSLs** ([Hydra/Dsl/Meta/Lib](https://github.com/CategoricalData/hydra/tree/main/hydra-haskell/src/main/haskell/Hydra/Dsl/Meta/Lib)) - Wrappers for primitive functions:+```haskell+import Hydra.Dsl.Meta.Lib.Lists as Lists+import Hydra.Dsl.Meta.Lib.Strings as Strings++example = Lists.map (Strings.toUpper) (list ["hello", "world"])+```++See the [DSL system section](https://github.com/CategoricalData/hydra/blob/main/docs/src/implementation.md#dsl-system) in the Implementation wiki for comprehensive coverage.++### JSON and YAML serialization++Serialize Hydra terms to JSON or YAML:++```haskell+import Hydra.Kernel+import Hydra.Codegen+import Hydra.Langs.Json.Serde+import Hydra.Dsl.Terms as Terms++-- Get the Hydra core graph+let g = hydraCoreGraph+let flow = fromFlowIo g++-- Define a type+let typ = TypeVariable _Precision++-- Create a term of that type+let term = Terms.inject _Precision (Field _Precision_bits $ Terms.int32 64)++-- Create a JSON coder for the type+coder <- flow $ jsonStringCoder typ++-- Encode to JSON+result <- flow (coderEncode coder term)+putStrLn result+```++## Self-hosting demonstration++Hydra-Haskell is a [self-hosting compiler](https://en.wikipedia.org/wiki/Self-hosting_(compilers)) - it can generate its own source code.++Complete self-hosting cycle:++```bash+# Generate all kernel code+stack ghci hydra:lib+import Hydra.Sources.All+import Hydra.Generation+writeHaskell "src/gen-main/haskell" mainModules mainModules+:q++# Generate kernel tests+./bin/update-kernel-tests.sh++# Generate language-specific generation tests+./bin/update-generation-tests.sh++# Run all tests+stack test+```++Alternatively, use GHCi for all generation steps:++```bash+stack ghci hydra:lib+import Hydra.Sources.All+import Hydra.Generation+writeHaskell "src/gen-main/haskell" mainModules mainModules+let allModules = mainModules ++ testModules+writeHaskell "src/gen-test/haskell" allModules baseTestModules+:q+stack test+```++The generated code includes:+- All core types (Type, Term, Graph, Module, etc.)+- Type inference and checking+- Term reduction and rewriting+- Coders and adapters+- Primitive functions (signatures only; implementations are in Hydra/Lib)++What remains hand-written:+- `Hydra.Lib` - Native primitive implementations+- `Hydra.Sources` - DSL-based specifications (input to code generation)+- `Hydra.Dsl` - DSL syntax+- `Hydra.Generation` - I/O and generation utilities+- Test runners++See the [Bootstrap process](https://github.com/CategoricalData/hydra/blob/main/docs/src/implementation.md#the-bootstrap-process) section for details on extending Hydra.+For example:+- [Adding new primitive functions](https://github.com/CategoricalData/hydra/blob/main/docs/src/recipes/adding-primitives.md)+- [Extending Hydra Core](https://github.com/CategoricalData/hydra/blob/main/docs/src/recipes/extending-hydra-core.md)++## Troubleshooting++### Stack version warnings++If you see warnings like:+```+Stack has not been tested with GHC versions above 9.0, and using 9.10.2, this may fail+Stack has not been tested with Cabal versions above 3.4, but version 3.12.1.0 was found, this may fail+```++**Solution:** Update Stack to the latest version:+```bash+stack upgrade+# or on macOS with Homebrew:+brew upgrade stack+```++**Explanation:** These are compatibility warnings that appear when using newer GHC/Cabal versions. If your builds complete successfully, the warnings are harmless - Stack works fine with newer versions even before official testing. Upgrading Stack eliminates the warnings.
hydra.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack name: hydra-version: 0.12.0+version: 0.13.0 synopsis: Graph programming language-description: Hydra is an implementation of the LambdaGraph data model, which takes advantage of an isomorphism between labeled hypergraphs and typed lambda calculus: in Hydra, "graphs are programs, and programs are graphs". The language is designed to be embedded in other programming languages, transforming data, schemas, and functional programs into multiple other languages in a way which maintains type safety, Hydra is self-hosting in Haskell, i.e. it generates its own executable source code from Hydra sources.+description: Hydra is an implementation of the LambdaGraph data model, which takes advantage of an isomorphism between labeled hypergraphs and typed lambda calculus: in Hydra, "graphs are programs, and programs are graphs". The language is designed to be embedded in other programming languages -- currently Haskell, Java, and Python. Hydra transforms data, schemas, and functional programs into multiple other languages in a way which maintains type safety. It is self-hosting in Haskell -- it generates its own executable source code from Hydra sources -- and it is designed to become self-hosting in its other implementation languages, as well. category: Data homepage: https://github.com/CategoricalData/hydra#readme bug-reports: https://github.com/CategoricalData/hydra/issues@@ -17,7 +17,6 @@ license-file: LICENSE build-type: Simple extra-source-files:- CHANGELOG.md LICENSE README.md stack.yaml@@ -28,50 +27,57 @@ library exposed-modules:- Hydra.Dsl.Accessors Hydra.Dsl.Annotations- Hydra.Dsl.Ast+ Hydra.Dsl.AsTerm+ Hydra.Dsl.AsType Hydra.Dsl.Bootstrap- Hydra.Dsl.Coders- Hydra.Dsl.Common- Hydra.Dsl.Compute- Hydra.Dsl.Core- Hydra.Dsl.Grammar Hydra.Dsl.Grammars- Hydra.Dsl.Graph- Hydra.Dsl.Json- Hydra.Dsl.Lib.Chars- Hydra.Dsl.Lib.Equality- Hydra.Dsl.Lib.Flows- Hydra.Dsl.Lib.Lists- Hydra.Dsl.Lib.Literals- Hydra.Dsl.Lib.Logic- Hydra.Dsl.Lib.Maps- Hydra.Dsl.Lib.Math- Hydra.Dsl.Lib.Optionals- Hydra.Dsl.Lib.Sets- Hydra.Dsl.Lib.Strings Hydra.Dsl.Literals Hydra.Dsl.LiteralTypes- Hydra.Dsl.Mantle- Hydra.Dsl.Module- Hydra.Dsl.PhantomLiterals- Hydra.Dsl.Phantoms+ Hydra.Dsl.Meta.Accessors+ Hydra.Dsl.Meta.Ast+ Hydra.Dsl.Meta.Base+ Hydra.Dsl.Meta.Coders+ Hydra.Dsl.Meta.Common+ Hydra.Dsl.Meta.Compute+ Hydra.Dsl.Meta.Core+ Hydra.Dsl.Meta.DeepCore+ Hydra.Dsl.Meta.Grammar+ Hydra.Dsl.Meta.Graph+ Hydra.Dsl.Meta.Json+ Hydra.Dsl.Meta.Lib.Chars+ Hydra.Dsl.Meta.Lib.Eithers+ Hydra.Dsl.Meta.Lib.Equality+ Hydra.Dsl.Meta.Lib.Flows+ Hydra.Dsl.Meta.Lib.Lists+ Hydra.Dsl.Meta.Lib.Literals+ Hydra.Dsl.Meta.Lib.Logic+ Hydra.Dsl.Meta.Lib.Maps+ Hydra.Dsl.Meta.Lib.Math+ Hydra.Dsl.Meta.Lib.Maybes+ Hydra.Dsl.Meta.Lib.Pairs+ Hydra.Dsl.Meta.Lib.Sets+ Hydra.Dsl.Meta.Lib.Strings+ Hydra.Dsl.Meta.Literals+ Hydra.Dsl.Meta.Module+ Hydra.Dsl.Meta.Parsing+ Hydra.Dsl.Meta.Phantoms+ Hydra.Dsl.Meta.Terms+ Hydra.Dsl.Meta.Testing+ Hydra.Dsl.Meta.Topology+ Hydra.Dsl.Meta.Types+ Hydra.Dsl.Meta.Typing+ Hydra.Dsl.Meta.Util+ Hydra.Dsl.Meta.Variants Hydra.Dsl.Prims- Hydra.Dsl.ShorthandTypes Hydra.Dsl.Tabular- Hydra.Dsl.TBase Hydra.Dsl.Terms- Hydra.Dsl.Testing Hydra.Dsl.Tests- Hydra.Dsl.Topology- Hydra.Dsl.TTerms- Hydra.Dsl.TTypes Hydra.Dsl.Types- Hydra.Dsl.Typing Hydra.Generation Hydra.Kernel Hydra.Lib.Chars+ Hydra.Lib.Eithers Hydra.Lib.Equality Hydra.Lib.Flows Hydra.Lib.Lists@@ -79,22 +85,38 @@ Hydra.Lib.Logic Hydra.Lib.Maps Hydra.Lib.Math- Hydra.Lib.Optionals+ Hydra.Lib.Maybes+ Hydra.Lib.Pairs Hydra.Lib.Sets Hydra.Lib.Strings Hydra.Minimal Hydra.Settings Hydra.Sources.All+ Hydra.Sources.CoderUtils+ Hydra.Sources.Eval.Lib.All+ Hydra.Sources.Eval.Lib.Eithers+ Hydra.Sources.Eval.Lib.Flows+ Hydra.Sources.Eval.Lib.Lists+ Hydra.Sources.Eval.Lib.Maps+ Hydra.Sources.Eval.Lib.Maybes+ Hydra.Sources.Eval.Lib.Pairs+ Hydra.Sources.Eval.Lib.Sets Hydra.Sources.Haskell.Ast Hydra.Sources.Haskell.Coder Hydra.Sources.Haskell.Language Hydra.Sources.Haskell.Operators Hydra.Sources.Haskell.Serde Hydra.Sources.Haskell.Utils+ Hydra.Sources.Json.Bootstrap Hydra.Sources.Json.Coder+ Hydra.Sources.Json.Decode Hydra.Sources.Json.Decoding+ Hydra.Sources.Json.Encode Hydra.Sources.Json.Extract Hydra.Sources.Json.Language+ Hydra.Sources.Json.Model+ Hydra.Sources.Json.Parser+ Hydra.Sources.Json.Writer Hydra.Sources.Kernel.Terms.Adapt.Literals Hydra.Sources.Kernel.Terms.Adapt.Modules Hydra.Sources.Kernel.Terms.Adapt.Simple@@ -103,49 +125,52 @@ Hydra.Sources.Kernel.Terms.All Hydra.Sources.Kernel.Terms.Annotations Hydra.Sources.Kernel.Terms.Arity+ Hydra.Sources.Kernel.Terms.Checking+ Hydra.Sources.Kernel.Terms.CodeGeneration Hydra.Sources.Kernel.Terms.Constants- Hydra.Sources.Kernel.Terms.Decode.Core Hydra.Sources.Kernel.Terms.Decoding- Hydra.Sources.Kernel.Terms.Describe.Core- Hydra.Sources.Kernel.Terms.Describe.Mantle- Hydra.Sources.Kernel.Terms.Encode.Core+ Hydra.Sources.Kernel.Terms.Encoding Hydra.Sources.Kernel.Terms.Extract.Core- Hydra.Sources.Kernel.Terms.Extract.Mantle+ Hydra.Sources.Kernel.Terms.Extract.Helpers+ Hydra.Sources.Kernel.Terms.Extract.Util Hydra.Sources.Kernel.Terms.Formatting Hydra.Sources.Kernel.Terms.Grammars+ Hydra.Sources.Kernel.Terms.Hoisting Hydra.Sources.Kernel.Terms.Inference Hydra.Sources.Kernel.Terms.Languages Hydra.Sources.Kernel.Terms.Lexical Hydra.Sources.Kernel.Terms.Literals Hydra.Sources.Kernel.Terms.Monads Hydra.Sources.Kernel.Terms.Names+ Hydra.Sources.Kernel.Terms.Parsers Hydra.Sources.Kernel.Terms.Reduction+ Hydra.Sources.Kernel.Terms.Reflect Hydra.Sources.Kernel.Terms.Rewriting Hydra.Sources.Kernel.Terms.Schemas Hydra.Sources.Kernel.Terms.Serialization Hydra.Sources.Kernel.Terms.Show.Accessors Hydra.Sources.Kernel.Terms.Show.Core Hydra.Sources.Kernel.Terms.Show.Graph- Hydra.Sources.Kernel.Terms.Show.Mantle+ Hydra.Sources.Kernel.Terms.Show.Meta Hydra.Sources.Kernel.Terms.Show.Typing+ Hydra.Sources.Kernel.Terms.Show.Util Hydra.Sources.Kernel.Terms.Sorting Hydra.Sources.Kernel.Terms.Substitution Hydra.Sources.Kernel.Terms.Tarjan Hydra.Sources.Kernel.Terms.Templates Hydra.Sources.Kernel.Terms.Unification- Hydra.Sources.Kernel.Terms.Variants Hydra.Sources.Kernel.Types.Accessors Hydra.Sources.Kernel.Types.All Hydra.Sources.Kernel.Types.Ast+ Hydra.Sources.Kernel.Types.Classes Hydra.Sources.Kernel.Types.Coders Hydra.Sources.Kernel.Types.Compute Hydra.Sources.Kernel.Types.Constraints Hydra.Sources.Kernel.Types.Core Hydra.Sources.Kernel.Types.Grammar Hydra.Sources.Kernel.Types.Graph- Hydra.Sources.Kernel.Types.Json- Hydra.Sources.Kernel.Types.Mantle Hydra.Sources.Kernel.Types.Module+ Hydra.Sources.Kernel.Types.Parsing Hydra.Sources.Kernel.Types.Phantoms Hydra.Sources.Kernel.Types.Query Hydra.Sources.Kernel.Types.Relational@@ -153,23 +178,63 @@ Hydra.Sources.Kernel.Types.Testing Hydra.Sources.Kernel.Types.Topology Hydra.Sources.Kernel.Types.Typing+ Hydra.Sources.Kernel.Types.Util+ Hydra.Sources.Kernel.Types.Variants Hydra.Sources.Kernel.Types.Workflow Hydra.Sources.Libraries+ Hydra.Sources.Test.All+ Hydra.Sources.Test.Annotations+ Hydra.Sources.Test.Checking.Advanced+ Hydra.Sources.Test.Checking.AlgebraicTypes+ Hydra.Sources.Test.Checking.All+ Hydra.Sources.Test.Checking.Collections+ Hydra.Sources.Test.Checking.Failures+ Hydra.Sources.Test.Checking.Fundamentals+ Hydra.Sources.Test.Checking.NominalTypes+ Hydra.Sources.Test.EtaExpansion Hydra.Sources.Test.Formatting+ Hydra.Sources.Test.Hoisting Hydra.Sources.Test.Inference.AlgebraicTypes Hydra.Sources.Test.Inference.AlgorithmW+ Hydra.Sources.Test.Inference.All Hydra.Sources.Test.Inference.Failures Hydra.Sources.Test.Inference.Fundamentals- Hydra.Sources.Test.Inference.InferenceSuite Hydra.Sources.Test.Inference.KernelExamples Hydra.Sources.Test.Inference.NominalTypes- Hydra.Sources.Test.Inference.Simple+ Hydra.Sources.Test.Json.Coder+ Hydra.Sources.Test.Json.Parser+ Hydra.Sources.Test.Json.Roundtrip+ Hydra.Sources.Test.Json.Writer+ Hydra.Sources.Test.Lib.Chars+ Hydra.Sources.Test.Lib.Eithers+ Hydra.Sources.Test.Lib.Equality+ Hydra.Sources.Test.Lib.Flows Hydra.Sources.Test.Lib.Lists+ Hydra.Sources.Test.Lib.Literals+ Hydra.Sources.Test.Lib.Logic+ Hydra.Sources.Test.Lib.Maps+ Hydra.Sources.Test.Lib.Math+ Hydra.Sources.Test.Lib.Maybes+ Hydra.Sources.Test.Lib.Pairs+ Hydra.Sources.Test.Lib.Sets Hydra.Sources.Test.Lib.Strings+ Hydra.Sources.Test.Monads+ Hydra.Sources.Test.Ordering+ Hydra.Sources.Test.Reduction+ Hydra.Sources.Test.Rewriting+ Hydra.Sources.Test.Serialization+ Hydra.Sources.Test.Sorting+ Hydra.Sources.Test.Substitution Hydra.Sources.Test.TestGraph Hydra.Sources.Test.TestSuite+ Hydra.Sources.Test.TestTerms+ Hydra.Sources.Test.TestTypes+ Hydra.Sources.Test.Unification Hydra.Sources.Yaml.Model- Hydra.Staging.Json.Serde+ Hydra.Staging.Lib.Names+ Hydra.Staging.Testing.Generation.Generate+ Hydra.Staging.Testing.Generation.HaskellCodec+ Hydra.Staging.Testing.Generation.Transform Hydra.Staging.Yaml.Coder Hydra.Staging.Yaml.Language Hydra.Staging.Yaml.Modules@@ -177,6 +242,7 @@ Hydra.Tools.Bytestrings Hydra.Tools.Debug Hydra.Tools.Monads+ Org.Example.Lispy Hydra.Accessors Hydra.Adapt.Literals Hydra.Adapt.Modules@@ -186,16 +252,68 @@ Hydra.Annotations Hydra.Arity Hydra.Ast+ Hydra.Checking+ Hydra.Classes+ Hydra.CodeGeneration Hydra.Coders+ Hydra.CoderUtils Hydra.Compute Hydra.Constants Hydra.Constraints Hydra.Core+ Hydra.Decode.Accessors+ Hydra.Decode.Ast+ Hydra.Decode.Classes+ Hydra.Decode.Coders+ Hydra.Decode.Compute+ Hydra.Decode.Constraints Hydra.Decode.Core+ Hydra.Decode.Grammar+ Hydra.Decode.Json+ Hydra.Decode.Json.Model+ Hydra.Decode.Module+ Hydra.Decode.Parsing+ Hydra.Decode.Phantoms+ Hydra.Decode.Query+ Hydra.Decode.Relational+ Hydra.Decode.Tabular+ Hydra.Decode.Testing+ Hydra.Decode.Topology+ Hydra.Decode.Typing+ Hydra.Decode.Util+ Hydra.Decode.Variants+ Hydra.Decode.Workflow Hydra.Decoding- Hydra.Describe.Core- Hydra.Describe.Mantle+ Hydra.Encode.Accessors+ Hydra.Encode.Ast+ Hydra.Encode.Classes+ Hydra.Encode.Coders+ Hydra.Encode.Compute+ Hydra.Encode.Constraints Hydra.Encode.Core+ Hydra.Encode.Grammar+ Hydra.Encode.Json+ Hydra.Encode.Json.Model+ Hydra.Encode.Module+ Hydra.Encode.Parsing+ Hydra.Encode.Phantoms+ Hydra.Encode.Query+ Hydra.Encode.Relational+ Hydra.Encode.Tabular+ Hydra.Encode.Testing+ Hydra.Encode.Topology+ Hydra.Encode.Typing+ Hydra.Encode.Util+ Hydra.Encode.Variants+ Hydra.Encode.Workflow+ Hydra.Encoding+ Hydra.Eval.Lib.Eithers+ Hydra.Eval.Lib.Flows+ Hydra.Eval.Lib.Lists+ Hydra.Eval.Lib.Maps+ Hydra.Eval.Lib.Maybes+ Hydra.Eval.Lib.Pairs+ Hydra.Eval.Lib.Sets Hydra.Ext.Haskell.Ast Hydra.Ext.Haskell.Coder Hydra.Ext.Haskell.Language@@ -207,24 +325,33 @@ Hydra.Ext.Org.Json.Language Hydra.Ext.Org.Yaml.Model Hydra.Extract.Core+ Hydra.Extract.Helpers Hydra.Extract.Json- Hydra.Extract.Mantle+ Hydra.Extract.Util Hydra.Formatting Hydra.Grammar Hydra.Grammars Hydra.Graph+ Hydra.Hoisting Hydra.Inference- Hydra.Json+ Hydra.Json.Bootstrap+ Hydra.Json.Decode+ Hydra.Json.Encode+ Hydra.Json.Model+ Hydra.Json.Parser+ Hydra.Json.Writer Hydra.Languages Hydra.Lexical Hydra.Literals- Hydra.Mantle Hydra.Module Hydra.Monads Hydra.Names+ Hydra.Parsers+ Hydra.Parsing Hydra.Phantoms Hydra.Query Hydra.Reduction+ Hydra.Reflect Hydra.Relational Hydra.Rewriting Hydra.Schemas@@ -232,9 +359,52 @@ Hydra.Show.Accessors Hydra.Show.Core Hydra.Show.Graph- Hydra.Show.Mantle+ Hydra.Show.Meta Hydra.Show.Typing+ Hydra.Show.Util Hydra.Sorting+ Hydra.Sources.Decode.Accessors+ Hydra.Sources.Decode.Ast+ Hydra.Sources.Decode.Classes+ Hydra.Sources.Decode.Coders+ Hydra.Sources.Decode.Compute+ Hydra.Sources.Decode.Constraints+ Hydra.Sources.Decode.Core+ Hydra.Sources.Decode.Grammar+ Hydra.Sources.Decode.Json.Model+ Hydra.Sources.Decode.Module+ Hydra.Sources.Decode.Parsing+ Hydra.Sources.Decode.Phantoms+ Hydra.Sources.Decode.Query+ Hydra.Sources.Decode.Relational+ Hydra.Sources.Decode.Tabular+ Hydra.Sources.Decode.Testing+ Hydra.Sources.Decode.Topology+ Hydra.Sources.Decode.Typing+ Hydra.Sources.Decode.Util+ Hydra.Sources.Decode.Variants+ Hydra.Sources.Decode.Workflow+ Hydra.Sources.Encode.Accessors+ Hydra.Sources.Encode.Ast+ Hydra.Sources.Encode.Classes+ Hydra.Sources.Encode.Coders+ Hydra.Sources.Encode.Compute+ Hydra.Sources.Encode.Constraints+ Hydra.Sources.Encode.Core+ Hydra.Sources.Encode.Grammar+ Hydra.Sources.Encode.Json.Model+ Hydra.Sources.Encode.Module+ Hydra.Sources.Encode.Parsing+ Hydra.Sources.Encode.Phantoms+ Hydra.Sources.Encode.Query+ Hydra.Sources.Encode.Relational+ Hydra.Sources.Encode.Tabular+ Hydra.Sources.Encode.Testing+ Hydra.Sources.Encode.Topology+ Hydra.Sources.Encode.Typing+ Hydra.Sources.Encode.Util+ Hydra.Sources.Encode.Variants+ Hydra.Sources.Encode.Workflow Hydra.Substitution Hydra.Tabular Hydra.Tarjan@@ -243,6 +413,7 @@ Hydra.Topology Hydra.Typing Hydra.Unification+ Hydra.Util Hydra.Variants Hydra.Workflow other-modules:@@ -252,48 +423,473 @@ src/gen-main/haskell build-depends: HsYAML >=0.2.1 && <0.3- , aeson >=2.2.0 && <2.3- , aeson-pretty >=0.8.9 && <0.9- , base >=4.20.0 && <4.21- , bytestring >=0.12.0 && <0.13- , containers ==0.7.*+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8 , directory >=1.3.6 && <1.4- , filepath >=1.5.0 && <1.6+ , filepath >=1.4.200 && <1.6 , scientific >=0.3.7 && <0.4 , split >=0.2.3 && <0.3- , text >=2.1.0 && <2.2+ , text >=2.0.2 && <2.2 , vector >=0.12.0 && <0.14 default-language: Haskell2010 +executable update-generation-tests+ main-is: Main.hs+ other-modules:+ Generation.Hydra.Test.AnnotationsSpec+ Generation.Hydra.Test.FormattingSpec+ Generation.Hydra.Test.Lib.CharsSpec+ Generation.Hydra.Test.Lib.EithersSpec+ Generation.Hydra.Test.Lib.EqualitySpec+ Generation.Hydra.Test.Lib.FlowsSpec+ Generation.Hydra.Test.Lib.ListsSpec+ Generation.Hydra.Test.Lib.LiteralsSpec+ Generation.Hydra.Test.Lib.LogicSpec+ Generation.Hydra.Test.Lib.MapsSpec+ Generation.Hydra.Test.Lib.MathSpec+ Generation.Hydra.Test.Lib.MaybesSpec+ Generation.Hydra.Test.Lib.PairsSpec+ Generation.Hydra.Test.Lib.SetsSpec+ Generation.Hydra.Test.Lib.StringsSpec+ Generation.Hydra.Test.MonadsSpec+ Generation.Hydra.Test.ReductionSpec+ Generation.Hydra.Test.SortingSpec+ Generation.Spec+ Hydra.Test.Annotations+ Hydra.Test.Checking.Advanced+ Hydra.Test.Checking.AlgebraicTypes+ Hydra.Test.Checking.All+ Hydra.Test.Checking.Collections+ Hydra.Test.Checking.Failures+ Hydra.Test.Checking.Fundamentals+ Hydra.Test.Checking.NominalTypes+ Hydra.Test.EtaExpansion+ Hydra.Test.Formatting+ Hydra.Test.Hoisting+ Hydra.Test.Inference.AlgebraicTypes+ Hydra.Test.Inference.AlgorithmW+ Hydra.Test.Inference.All+ Hydra.Test.Inference.Failures+ Hydra.Test.Inference.Fundamentals+ Hydra.Test.Inference.KernelExamples+ Hydra.Test.Inference.NominalTypes+ Hydra.Test.Json.Coder+ Hydra.Test.Json.Parser+ Hydra.Test.Json.Roundtrip+ Hydra.Test.Json.Writer+ Hydra.Test.Lib.Chars+ Hydra.Test.Lib.Eithers+ Hydra.Test.Lib.Equality+ Hydra.Test.Lib.Flows+ Hydra.Test.Lib.Lists+ Hydra.Test.Lib.Literals+ Hydra.Test.Lib.Logic+ Hydra.Test.Lib.Maps+ Hydra.Test.Lib.Math+ Hydra.Test.Lib.Maybes+ Hydra.Test.Lib.Pairs+ Hydra.Test.Lib.Sets+ Hydra.Test.Lib.Strings+ Hydra.Test.Monads+ Hydra.Test.Ordering+ Hydra.Test.Reduction+ Hydra.Test.Rewriting+ Hydra.Test.Serialization+ Hydra.Test.Sorting+ Hydra.Test.Substitution+ Hydra.Test.TestGraph+ Hydra.Test.TestSuite+ Hydra.Test.TestTerms+ Hydra.Test.TestTypes+ Hydra.Test.Unification+ Paths_hydra+ hs-source-dirs:+ src/exec/update-generation-tests+ src/gen-test/haskell+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hspec >=2.11.0 && <2.12+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-haskell-eval-lib+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-haskell-eval-lib+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-haskell-kernel+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-haskell-kernel+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-haskell-sources+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-haskell-sources+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-json-kernel+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-json-kernel+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-json-main+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-json-main+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-json-manifest+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-json-manifest+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-json-test+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/update-json-test+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable update-kernel-tests+ main-is: Main.hs+ other-modules:+ Generation.Hydra.Test.AnnotationsSpec+ Generation.Hydra.Test.FormattingSpec+ Generation.Hydra.Test.Lib.CharsSpec+ Generation.Hydra.Test.Lib.EithersSpec+ Generation.Hydra.Test.Lib.EqualitySpec+ Generation.Hydra.Test.Lib.FlowsSpec+ Generation.Hydra.Test.Lib.ListsSpec+ Generation.Hydra.Test.Lib.LiteralsSpec+ Generation.Hydra.Test.Lib.LogicSpec+ Generation.Hydra.Test.Lib.MapsSpec+ Generation.Hydra.Test.Lib.MathSpec+ Generation.Hydra.Test.Lib.MaybesSpec+ Generation.Hydra.Test.Lib.PairsSpec+ Generation.Hydra.Test.Lib.SetsSpec+ Generation.Hydra.Test.Lib.StringsSpec+ Generation.Hydra.Test.MonadsSpec+ Generation.Hydra.Test.ReductionSpec+ Generation.Hydra.Test.SortingSpec+ Generation.Spec+ Hydra.Test.Annotations+ Hydra.Test.Checking.Advanced+ Hydra.Test.Checking.AlgebraicTypes+ Hydra.Test.Checking.All+ Hydra.Test.Checking.Collections+ Hydra.Test.Checking.Failures+ Hydra.Test.Checking.Fundamentals+ Hydra.Test.Checking.NominalTypes+ Hydra.Test.EtaExpansion+ Hydra.Test.Formatting+ Hydra.Test.Hoisting+ Hydra.Test.Inference.AlgebraicTypes+ Hydra.Test.Inference.AlgorithmW+ Hydra.Test.Inference.All+ Hydra.Test.Inference.Failures+ Hydra.Test.Inference.Fundamentals+ Hydra.Test.Inference.KernelExamples+ Hydra.Test.Inference.NominalTypes+ Hydra.Test.Json.Coder+ Hydra.Test.Json.Parser+ Hydra.Test.Json.Roundtrip+ Hydra.Test.Json.Writer+ Hydra.Test.Lib.Chars+ Hydra.Test.Lib.Eithers+ Hydra.Test.Lib.Equality+ Hydra.Test.Lib.Flows+ Hydra.Test.Lib.Lists+ Hydra.Test.Lib.Literals+ Hydra.Test.Lib.Logic+ Hydra.Test.Lib.Maps+ Hydra.Test.Lib.Math+ Hydra.Test.Lib.Maybes+ Hydra.Test.Lib.Pairs+ Hydra.Test.Lib.Sets+ Hydra.Test.Lib.Strings+ Hydra.Test.Monads+ Hydra.Test.Ordering+ Hydra.Test.Reduction+ Hydra.Test.Rewriting+ Hydra.Test.Serialization+ Hydra.Test.Sorting+ Hydra.Test.Substitution+ Hydra.Test.TestGraph+ Hydra.Test.TestSuite+ Hydra.Test.TestTerms+ Hydra.Test.TestTypes+ Hydra.Test.Unification+ Paths_hydra+ hs-source-dirs:+ src/exec/update-kernel-tests+ src/gen-test/haskell+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hspec >=2.11.0 && <2.12+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010++executable verify-json-kernel+ main-is: Main.hs+ other-modules:+ Paths_hydra+ hs-source-dirs:+ src/exec/verify-json-kernel+ ghc-options: -rtsopts+ build-depends:+ HsYAML >=0.2.1 && <0.3+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8+ , directory >=1.3.6 && <1.4+ , filepath >=1.4.200 && <1.6+ , hydra+ , scientific >=0.3.7 && <0.4+ , split >=0.2.3 && <0.3+ , text >=2.0.2 && <2.2+ , vector >=0.12.0 && <0.14+ default-language: Haskell2010+ test-suite hydra-test type: exitcode-stdio-1.0 main-is: Spec.hs other-modules:+ GenerationSpec Hydra.Adapt.LiteralsSpec Hydra.Adapt.TermsSpec- Hydra.AnnotationsSpec Hydra.ArbitraryCore Hydra.CoreCodersSpec Hydra.Dsl.TypesSpec- Hydra.InferenceSpec+ Hydra.Json.AesonSpec Hydra.MonadsSpec- Hydra.ReductionSpec Hydra.Reference.AlgorithmW Hydra.Reference.AlgorithmWBridge Hydra.Reference.AlgorithmWSpec- Hydra.RewritingSpec- Hydra.SerializationSpec- Hydra.SortingSpec- Hydra.Staging.Json.CoderSpec- Hydra.Staging.Json.SerdeSpec- Hydra.Staging.TestGraph+ Hydra.Staging.Json.Serde Hydra.Staging.Yaml.CoderSpec Hydra.Staging.Yaml.SerdeSpec Hydra.TestData Hydra.TestSuiteSpec Hydra.TestUtils+ Hydra.UpdateGenerationTests+ Generation.Hydra.Test.AnnotationsSpec+ Generation.Hydra.Test.FormattingSpec+ Generation.Hydra.Test.Lib.CharsSpec+ Generation.Hydra.Test.Lib.EithersSpec+ Generation.Hydra.Test.Lib.EqualitySpec+ Generation.Hydra.Test.Lib.FlowsSpec+ Generation.Hydra.Test.Lib.ListsSpec+ Generation.Hydra.Test.Lib.LiteralsSpec+ Generation.Hydra.Test.Lib.LogicSpec+ Generation.Hydra.Test.Lib.MapsSpec+ Generation.Hydra.Test.Lib.MathSpec+ Generation.Hydra.Test.Lib.MaybesSpec+ Generation.Hydra.Test.Lib.PairsSpec+ Generation.Hydra.Test.Lib.SetsSpec+ Generation.Hydra.Test.Lib.StringsSpec+ Generation.Hydra.Test.MonadsSpec+ Generation.Hydra.Test.ReductionSpec+ Generation.Hydra.Test.SortingSpec+ Generation.Spec+ Hydra.Test.Annotations+ Hydra.Test.Checking.Advanced+ Hydra.Test.Checking.AlgebraicTypes+ Hydra.Test.Checking.All+ Hydra.Test.Checking.Collections+ Hydra.Test.Checking.Failures+ Hydra.Test.Checking.Fundamentals+ Hydra.Test.Checking.NominalTypes+ Hydra.Test.EtaExpansion+ Hydra.Test.Formatting+ Hydra.Test.Hoisting+ Hydra.Test.Inference.AlgebraicTypes+ Hydra.Test.Inference.AlgorithmW+ Hydra.Test.Inference.All+ Hydra.Test.Inference.Failures+ Hydra.Test.Inference.Fundamentals+ Hydra.Test.Inference.KernelExamples+ Hydra.Test.Inference.NominalTypes+ Hydra.Test.Json.Coder+ Hydra.Test.Json.Parser+ Hydra.Test.Json.Roundtrip+ Hydra.Test.Json.Writer+ Hydra.Test.Lib.Chars+ Hydra.Test.Lib.Eithers+ Hydra.Test.Lib.Equality+ Hydra.Test.Lib.Flows+ Hydra.Test.Lib.Lists+ Hydra.Test.Lib.Literals+ Hydra.Test.Lib.Logic+ Hydra.Test.Lib.Maps+ Hydra.Test.Lib.Math+ Hydra.Test.Lib.Maybes+ Hydra.Test.Lib.Pairs+ Hydra.Test.Lib.Sets+ Hydra.Test.Lib.Strings+ Hydra.Test.Monads+ Hydra.Test.Ordering+ Hydra.Test.Reduction+ Hydra.Test.Rewriting+ Hydra.Test.Serialization+ Hydra.Test.Sorting+ Hydra.Test.Substitution Hydra.Test.TestGraph Hydra.Test.TestSuite+ Hydra.Test.TestTerms+ Hydra.Test.TestTypes+ Hydra.Test.Unification Paths_hydra hs-source-dirs: src/test/haskell@@ -302,19 +898,21 @@ HUnit , HsYAML >=0.2.1 && <0.3 , QuickCheck- , aeson >=2.2.0 && <2.3- , aeson-pretty >=0.8.9 && <0.9- , base >=4.20.0 && <4.21- , bytestring >=0.12.0 && <0.13- , containers ==0.7.*+ , aeson >=2.1.0 && <2.3+ , base >=4.19.0 && <4.22+ , base64-bytestring >=1.2.1 && <1.3+ , bytestring >=0.11.5 && <0.13+ , containers >=0.6.7 && <0.8 , directory >=1.3.6 && <1.4- , filepath >=1.5.0 && <1.6- , hspec- , hspec-discover+ , filepath >=1.4.200 && <1.6+ , hspec >=2.11.0 && <2.12+ , hspec-discover >=2.11.0 && <2.12 , hydra , mtl+ , process , scientific >=0.3.7 && <0.4 , split >=0.2.3 && <0.3- , text >=2.1.0 && <2.2+ , text >=2.0.2 && <2.2+ , time , vector >=0.12.0 && <0.14 default-language: Haskell2010
+ src/exec/update-generation-tests/Main.hs view
@@ -0,0 +1,46 @@+#!/usr/bin/env stack+{- stack script+ --resolver lts-22.28+ --package hydra+-}++module Main where++import Hydra.Kernel+import Hydra.Staging.Testing.Generation.Generate+import Hydra.Staging.Testing.Generation.HaskellCodec (haskellTestGenerator)+import qualified Hydra.Sources.Test.TestSuite as TestSuite+import qualified Hydra.Test.TestSuite as GenTests+++main :: IO ()+main = do+ putStrLn "=== Generate Hydra generation tests ==="+ putStrLn ""++ -- Get the namespaces from TestSuite's term dependencies+ let testNamespaces = moduleTermDependencies TestSuite.module_++ -- Build the lookup function from namespaces and test group hierarchy+ let lookupFn = createTestGroupLookup testNamespaces GenTests.allTests++ -- Get the list of test modules by looking up each namespace+ -- For now, use the libPairs and otherPairs from TestSuite (the actual Module values)+ let testModules = TestSuite.testSuiteModules++ -- Generate generation tests to src/gen-test/haskell+ let outputDir = "src/gen-test/haskell"++ putStrLn $ "Generating tests into: " ++ outputDir+ putStrLn ""++ generateGenerationTestSuite haskellTestGenerator outputDir testModules lookupFn++ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "To view the generated tests:"+ putStrLn $ " ls -R " ++ outputDir+ putStrLn ""+ putStrLn "To run the generated tests:"+ putStrLn " stack test"
+ src/exec/update-haskell-eval-lib/Main.hs view
@@ -0,0 +1,17 @@+module Main where++import Hydra.Generation+import Hydra.Sources.All+import Hydra.Sources.Eval.Lib.All++main :: IO ()+main = do+ putStrLn "=== Generate Hydra eval lib (Haskell) ==="+ putStrLn ""+ putStrLn "Generating eval lib modules to src/gen-main/haskell..."+ putStrLn ""++ writeHaskell "src/gen-main/haskell" mainModules evalLibModules++ putStrLn ""+ putStrLn "=== Done! ==="
+ src/exec/update-haskell-kernel/Main.hs view
@@ -0,0 +1,16 @@+module Main where++import Hydra.Generation+import Hydra.Sources.All++main :: IO ()+main = do+ putStrLn "=== Generate Hydra kernel (Haskell) ==="+ putStrLn ""+ putStrLn "Generating main modules to src/gen-main/haskell..."+ putStrLn ""++ writeHaskell "src/gen-main/haskell" mainModules mainModules++ putStrLn ""+ putStrLn "=== Done! ==="
+ src/exec/update-haskell-sources/Main.hs view
@@ -0,0 +1,34 @@+module Main where++import Hydra.Generation+import Hydra.Sources.All+import Hydra.Sources.Kernel.Types.All++import System.Directory (getCurrentDirectory, doesFileExist)+import System.Exit (exitFailure)++main :: IO ()+main = do+ -- Guard: this executable uses relative paths and must be run from hydra-haskell/+ cwd <- getCurrentDirectory+ let marker = "hydra.cabal"+ exists <- doesFileExist marker+ if not exists+ then do+ putStrLn $ "Error: this executable must be run from the hydra-haskell/ directory."+ putStrLn $ " Current directory: " ++ cwd+ putStrLn $ " Expected to find: " ++ marker+ putStrLn $ " Hint: cd to hydra-haskell/ and re-run, or use: (cd ../hydra-haskell && stack exec update-haskell-sources)"+ exitFailure+ else do+ putStrLn "=== Generate encoder/decoder source modules (Haskell) ==="+ putStrLn ""+ putStrLn "Generating decoder source modules to src/gen-main/haskell..."+ writeDecoderSourceHaskell "src/gen-main/haskell" mainModules kernelTypesModules++ putStrLn ""+ putStrLn "Generating encoder source modules to src/gen-main/haskell..."+ writeEncoderSourceHaskell "src/gen-main/haskell" mainModules kernelTypesModules++ putStrLn ""+ putStrLn "=== Done! ==="
+ src/exec/update-json-kernel/Main.hs view
@@ -0,0 +1,32 @@+module Main where++import Hydra.Generation (writeModulesJson)+import Hydra.Sources.All (kernelModules)+import Hydra.Sources.Eval.Lib.All (evalLibModules)+import System.Exit (exitFailure)+import Control.Exception (catch, SomeException)+++main :: IO ()+main = do+ let allMods = kernelModules ++ evalLibModules+ putStrLn "=== Generate Hydra kernel JSON ==="+ putStrLn ""+ putStrLn $ "Generating " ++ show (length allMods) ++ " kernel + eval lib modules to JSON..."+ putStrLn ""++ result <- catch (writeModulesJson True "src/gen-main/json" allMods allMods >> return True)+ (\e -> do+ putStrLn $ "Error: " ++ show (e :: SomeException)+ return False)++ if result+ then do+ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "Generated files are in: src/gen-main/json/"+ else do+ putStrLn ""+ putStrLn "=== FAILED ==="+ exitFailure
+ src/exec/update-json-main/Main.hs view
@@ -0,0 +1,32 @@+module Main where++import Hydra.Generation (writeModulesJson)+import Hydra.Sources.All (mainModules)+import Hydra.Sources.Eval.Lib.All (evalLibModules)+import System.Exit (exitFailure)+import Control.Exception (catch, SomeException)+++main :: IO ()+main = do+ let allMods = mainModules ++ evalLibModules+ putStrLn "=== Generate Hydra main modules JSON ==="+ putStrLn ""+ putStrLn $ "Generating " ++ show (length allMods) ++ " main + eval lib modules to JSON..."+ putStrLn ""++ result <- catch (writeModulesJson True "src/gen-main/json" allMods allMods >> return True)+ (\e -> do+ putStrLn $ "Error: " ++ show (e :: SomeException)+ return False)++ if result+ then do+ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "Generated files are in: src/gen-main/json/"+ else do+ putStrLn ""+ putStrLn "=== FAILED ==="+ exitFailure
+ src/exec/update-json-manifest/Main.hs view
@@ -0,0 +1,12 @@+module Main where++import Hydra.Generation (writeManifestJson)+++main :: IO ()+main = do+ putStrLn "=== Generate JSON manifest ==="+ putStrLn ""+ writeManifestJson "src/gen-main/json"+ putStrLn ""+ putStrLn "=== Done! ==="
+ src/exec/update-json-test/Main.hs view
@@ -0,0 +1,32 @@+module Main where++import Hydra.Generation (writeModulesJson)+import Hydra.Sources.All (mainModules)+import Hydra.Sources.Test.All (testModules)+import System.Exit (exitFailure)+import Control.Exception (catch, SomeException)+++main :: IO ()+main = do+ putStrLn "=== Generate Hydra test modules JSON ==="+ putStrLn ""+ putStrLn $ "Generating " ++ show (length testModules) ++ " test modules to JSON..."+ putStrLn ""++ let universeModules = mainModules ++ testModules+ result <- catch (writeModulesJson True "src/gen-test/json" universeModules testModules >> return True)+ (\e -> do+ putStrLn $ "Error: " ++ show (e :: SomeException)+ return False)++ if result+ then do+ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "Generated files are in: src/gen-test/json/"+ else do+ putStrLn ""+ putStrLn "=== FAILED ==="+ exitFailure
+ src/exec/update-kernel-tests/Main.hs view
@@ -0,0 +1,32 @@+#!/usr/bin/env stack+{- stack script+ --resolver lts-22.28+ --package hydra+-}++module Main where++import Hydra.Generation+import Hydra.Sources.All++main :: IO ()+main = do+ putStrLn "=== Generate Hydra kernel tests ==="+ putStrLn ""+ putStrLn "Generating kernel test modules to src/gen-test/haskell..."+ putStrLn ""++ -- Universe provides all modules for dependency resolution+ -- testModules now includes all test suite modules (including Reduction, etc.)+ -- writeHaskell computes transitive closure to include only what's needed+ let allModules = mainModules ++ testModules+ writeHaskell "src/gen-test/haskell" allModules testModules++ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "To view the generated test modules:"+ putStrLn " ls -R src/gen-test/haskell"+ putStrLn ""+ putStrLn "To run the tests:"+ putStrLn " stack test"
+ src/exec/verify-json-kernel/Main.hs view
@@ -0,0 +1,207 @@+-- | Verification tool that decodes all kernel modules from JSON and compares with originals.+-- This is a standalone executable that does not run with regular tests (too slow).+--+-- This tests that: JSON file → parse → Term → Module equals the original Module++module Main where++import Hydra.Kernel+import Hydra.Module (_Module)+import Hydra.Sources.All (kernelModules)+import Hydra.Generation (modulesToGraph)+import Hydra.CodeGeneration (namespaceToPath)+import qualified Hydra.Json.Model as Json+import qualified Hydra.Json.Decode as JsonDecode+import qualified Hydra.Decode.Module as DecodeModule+import qualified Hydra.Decode.Core as DecodeCore+import qualified Hydra.Rewriting as Rewriting++import Control.Monad (forM, when)+import System.Exit (exitFailure, exitSuccess)+import System.Directory (doesFileExist)+import System.FilePath ((</>))+import System.IO (hFlush, stdout)+import qualified Data.Map as M+import qualified Data.ByteString.Lazy as BS+import qualified Data.Aeson as A+import qualified Data.Aeson.KeyMap as AKM+import qualified Data.Aeson.Key as AK+import qualified Data.Text as T+import qualified Data.Vector as V+import qualified Data.Scientific as SC++flushPut :: String -> IO ()+flushPut s = putStrLn s >> hFlush stdout++-- | Convert Aeson JSON value to Hydra JSON value+aesonToHydra :: A.Value -> Json.Value+aesonToHydra v = case v of+ A.Object km -> Json.ValueObject $ M.fromList (mapPair <$> AKM.toList km)+ where+ mapPair (k, v') = (AK.toString k, aesonToHydra v')+ A.Array a -> Json.ValueArray (aesonToHydra <$> V.toList a)+ A.String t -> Json.ValueString $ T.unpack t+ A.Number s -> Json.ValueNumber $ SC.toRealFloat s+ A.Bool b -> Json.ValueBoolean b+ A.Null -> Json.ValueNull++-- | Parse JSON from file using Aeson (fast)+parseJsonFile :: FilePath -> IO (Either String Json.Value)+parseJsonFile fp = do+ content <- BS.readFile fp+ return $ aesonToHydra <$> A.eitherDecode content++-- | Extract a Type from a term that represents a type definition+termToType :: Graph -> Term -> Maybe Type+termToType g term = case DecodeCore.type_ g term of+ Left _ -> Nothing+ Right typ -> Just typ++-- | Build a schema map (Name -> Type) from a graph's schema.+-- This is used by the JSON decoder to resolve type variables.+buildSchemaMap :: Graph -> M.Map Name Type+buildSchemaMap g = case graphSchema g of+ Nothing -> M.empty+ Just schemaGraph -> M.fromList $ concatMap (extractType schemaGraph) $ graphElements schemaGraph+ where+ extractType sg binding = case termToType sg (bindingTerm binding) of+ Just typ -> [(bindingName binding, stripTypeAnnotationsTop typ)]+ Nothing -> []++ -- Strip only top-level annotations+ stripTypeAnnotationsTop (TypeAnnotated (AnnotatedType t _)) = stripTypeAnnotationsTop t+ stripTypeAnnotationsTop t = t++main :: IO ()+main = do+ flushPut "=== Verify JSON Kernel ==="+ flushPut ""++ let basePath = "src/gen-main/json"++ flushPut "Building graph from kernel modules..."+ -- Build the graph from all kernel modules - this provides the type info+ let graph = modulesToGraph kernelModules kernelModules++ flushPut "Building schema map for JSON decoding..."+ let schemaMap = buildSchemaMap graph+ flushPut $ " Schema map has " ++ show (M.size schemaMap) ++ " type definitions"++ -- Use TypeVariable to reference the Module type - the decoder will resolve it+ let modType = TypeVariable _Module+ flushPut "Using TypeVariable for Module type (decoder will resolve it)."++ flushPut "Counting modules..."+ let numModules = length kernelModules+ flushPut $ "Verifying " ++ show numModules ++ " kernel modules..."+ putStrLn ""++ -- For each module, read JSON file, decode to Term, then to Module, and compare+ results <- forM kernelModules $ \origMod -> do+ let ns = moduleNamespace origMod+ nsStr = unNamespace ns+ filePath = basePath </> namespaceToPath ns ++ ".json"++ flushPut $ " Processing: " ++ nsStr++ exists <- doesFileExist filePath+ if not exists+ then do+ flushPut $ " ✗ " ++ nsStr ++ " (file not found)"+ return (False, nsStr ++ ": file not found")+ else do+ -- Parse JSON using Aeson (fast!)+ parseResult <- parseJsonFile filePath+ case parseResult of+ Left err -> do+ flushPut $ " ✗ " ++ nsStr ++ " (JSON parse error)"+ flushPut $ " " ++ err+ return (False, nsStr ++ ": JSON parse error")+ Right jsonVal -> do+ flushPut $ " JSON parsed successfully"++ -- Decode JSON to Term using type-directed decoder with Module type+ -- The schemaMap is used to resolve type variables+ case JsonDecode.fromJson schemaMap modType jsonVal of+ Left err -> do+ flushPut $ " ✗ " ++ nsStr ++ " (JSON decode error)"+ flushPut $ " " ++ err+ return (False, nsStr ++ ": " ++ err)+ Right term -> do+ flushPut $ " JSON decoded to Term"++ -- Decode Term to Module+ case DecodeModule.module_ graph term of+ Left (DecodingError err) -> do+ flushPut $ " ✗ " ++ nsStr ++ " (module decode error)"+ flushPut $ " " ++ err+ return (False, nsStr ++ ": " ++ err)+ Right decodedMod ->+ let compareMod = if isTypeModule origMod then decodedMod else stripTypeAnnotations decodedMod+ compareOrig = if isTypeModule origMod then origMod else stripTypeAnnotations origMod+ in if compareMod == compareOrig+ then do+ flushPut $ " ✓ " ++ nsStr+ return (True, nsStr)+ else do+ flushPut $ " ✗ " ++ nsStr ++ " (content mismatch)"+ let diff = findDifference compareOrig compareMod+ flushPut $ " " ++ diff+ return (False, nsStr ++ ": " ++ diff)++ let failures = filter (not . fst) results+ successes = filter fst results++ putStrLn ""+ if null failures+ then do+ putStrLn "=== SUCCESS ==="+ putStrLn $ "All " ++ show (length successes) ++ " modules verified successfully!"+ exitSuccess+ else do+ putStrLn "=== FAILED ==="+ putStrLn $ show (length failures) ++ " modules failed verification:"+ mapM_ (putStrLn . (" " ++) . snd) (take 20 failures)+ when (length failures > 20) $+ putStrLn $ " ... and " ++ show (length failures - 20) ++ " more"+ exitFailure++-- | Check whether a module contains only native type definitions (no term definitions).+isTypeModule :: Module -> Bool+isTypeModule m = all isNativeType (moduleElements m)++-- | Strip type annotations from a module for comparison with raw (pre-inference) modules.+-- Removes TypeLambda, TypeApplication, binding TypeSchemes, and lambda domain types from terms,+-- but preserves user annotations.+stripTypeAnnotations :: Module -> Module+stripTypeAnnotations m = m {+ moduleElements = fmap stripBinding (moduleElements m) }+ where+ stripBinding b = b {+ bindingTerm = Rewriting.removeTypesFromTerm (bindingTerm b),+ bindingType = Nothing }++-- | Find the first difference between two modules+findDifference :: Module -> Module -> String+findDifference orig decoded+ | moduleNamespace orig /= moduleNamespace decoded =+ "namespace differs: " ++ unNamespace (moduleNamespace orig) ++ " vs " ++ unNamespace (moduleNamespace decoded)+ | length (moduleElements orig) /= length (moduleElements decoded) =+ "element count differs: " ++ show (length (moduleElements orig)) ++ " vs " ++ show (length (moduleElements decoded))+ | moduleTermDependencies orig /= moduleTermDependencies decoded =+ "termDependencies differ"+ | moduleTypeDependencies orig /= moduleTypeDependencies decoded =+ "typeDependencies differ"+ | moduleDescription orig /= moduleDescription decoded =+ "description differs"+ | otherwise =+ "elements differ (checking first mismatch...)" ++ findElementDiff (moduleElements orig) (moduleElements decoded)++findElementDiff :: [Binding] -> [Binding] -> String+findElementDiff [] [] = ""+findElementDiff (o:os) (d:ds)+ | o == d = findElementDiff os ds+ | bindingName o /= bindingName d = " - name: " ++ unName (bindingName o) ++ " vs " ++ unName (bindingName d)+ | bindingType o /= bindingType d = " - type differs for " ++ unName (bindingName o)+ | otherwise = " - term differs for " ++ unName (bindingName o)+findElementDiff _ _ = " - different element counts"
src/gen-main/haskell/Hydra/Accessors.hs view
@@ -1,18 +1,25 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for term access patterns module Hydra.Accessors where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | An edge in an accessor graph, connecting two nodes via a path data AccessorEdge = AccessorEdge {+ -- | The source node of the edge accessorEdgeSource :: AccessorNode,+ -- | The accessor path connecting source to target accessorEdgePath :: AccessorPath,+ -- | The target node of the edge accessorEdgeTarget :: AccessorNode} deriving (Eq, Ord, Read, Show) @@ -24,9 +31,12 @@ _AccessorEdge_target = (Core.Name "target") +-- | A graph of accessor nodes and edges, representing term access patterns data AccessorGraph = AccessorGraph {+ -- | All nodes in the graph accessorGraphNodes :: [AccessorNode],+ -- | All edges in the graph accessorGraphEdges :: [AccessorEdge]} deriving (Eq, Ord, Read, Show) @@ -36,10 +46,14 @@ _AccessorGraph_edges = (Core.Name "edges") +-- | A node in an accessor graph, representing a term or subterm data AccessorNode = AccessorNode {+ -- | The qualified name of the term accessorNodeName :: Core.Name,+ -- | A human-readable label for the node accessorNodeLabel :: String,+ -- | A unique identifier for the node accessorNodeId :: String} deriving (Eq, Ord, Read, Show) @@ -51,6 +65,7 @@ _AccessorNode_id = (Core.Name "id") +-- | A sequence of term accessors forming a path through a term newtype AccessorPath = AccessorPath { unAccessorPath :: [TermAccessor]}@@ -60,31 +75,51 @@ -- | A function which maps from a term to a particular immediate subterm data TermAccessor = - TermAccessorAnnotatedSubject |+ -- | Access the body of an annotated term+ TermAccessorAnnotatedBody |+ -- | Access the function of an application term TermAccessorApplicationFunction |+ -- | Access the argument of an application term TermAccessorApplicationArgument |+ -- | Access the body of a lambda term TermAccessorLambdaBody |+ -- | Access the default case of a union elimination TermAccessorUnionCasesDefault |+ -- | Access a specific branch of a union elimination by field name TermAccessorUnionCasesBranch Core.Name |- TermAccessorLetEnvironment |+ -- | Access the body of a let term+ TermAccessorLetBody |+ -- | Access a specific binding in a let term by variable name TermAccessorLetBinding Core.Name |+ -- | Access an element of a list by index TermAccessorListElement Int |+ -- | Access a key in a map by index TermAccessorMapKey Int |+ -- | Access a value in a map by index TermAccessorMapValue Int |- TermAccessorOptionalTerm |+ -- | Access the term inside a Just value+ TermAccessorMaybeTerm |+ -- | Access an element of a product (tuple) by index TermAccessorProductTerm Int |+ -- | Access a field of a record by field name TermAccessorRecordField Core.Name |+ -- | Access an element of a set by index TermAccessorSetElement Int |+ -- | Access the term inside a sum variant TermAccessorSumTerm |+ -- | Access the body of a type lambda term TermAccessorTypeLambdaBody |+ -- | Access the term being applied to a type TermAccessorTypeApplicationTerm |+ -- | Access the term inside a union injection TermAccessorInjectionTerm |+ -- | Access the term inside a wrapped term TermAccessorWrappedTerm deriving (Eq, Ord, Read, Show) _TermAccessor = (Core.Name "hydra.accessors.TermAccessor") -_TermAccessor_annotatedSubject = (Core.Name "annotatedSubject")+_TermAccessor_annotatedBody = (Core.Name "annotatedBody") _TermAccessor_applicationFunction = (Core.Name "applicationFunction") @@ -96,7 +131,7 @@ _TermAccessor_unionCasesBranch = (Core.Name "unionCasesBranch") -_TermAccessor_letEnvironment = (Core.Name "letEnvironment")+_TermAccessor_letBody = (Core.Name "letBody") _TermAccessor_letBinding = (Core.Name "letBinding") @@ -106,7 +141,7 @@ _TermAccessor_mapValue = (Core.Name "mapValue") -_TermAccessor_optionalTerm = (Core.Name "optionalTerm")+_TermAccessor_maybeTerm = (Core.Name "maybeTerm") _TermAccessor_productTerm = (Core.Name "productTerm")
src/gen-main/haskell/Hydra/Adapt/Literals.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Adapter framework for literal types and terms module Hydra.Adapt.Literals where@@ -6,8 +8,7 @@ import qualified Hydra.Coders as Coders import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core-import qualified Hydra.Describe.Core as Core_-import qualified Hydra.Extract.Core as Core__+import qualified Hydra.Extract.Core as Core_ import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists@@ -16,25 +17,27 @@ import qualified Hydra.Lib.Math as Math import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Monads as Monads-import qualified Hydra.Show.Core as Core___+import qualified Hydra.Reflect as Reflect+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Util as Util import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -- | Compare two precision values-comparePrecision :: (Mantle.Precision -> Mantle.Precision -> Mantle.Comparison)+comparePrecision :: (Util.Precision -> Util.Precision -> Util.Comparison) comparePrecision p1 p2 = ((\x -> case x of- Mantle.PrecisionArbitrary -> ((\x -> case x of- Mantle.PrecisionArbitrary -> Mantle.ComparisonEqualTo- Mantle.PrecisionBits _ -> Mantle.ComparisonGreaterThan) p2)- Mantle.PrecisionBits v1 -> ((\x -> case x of- Mantle.PrecisionArbitrary -> Mantle.ComparisonLessThan- Mantle.PrecisionBits v2 -> (Logic.ifElse (Equality.lt v1 v2) Mantle.ComparisonLessThan Mantle.ComparisonGreaterThan)) p2)) p1)+ Util.PrecisionArbitrary -> ((\x -> case x of+ Util.PrecisionArbitrary -> Util.ComparisonEqualTo+ Util.PrecisionBits _ -> Util.ComparisonGreaterThan) p2)+ Util.PrecisionBits v1 -> ((\x -> case x of+ Util.PrecisionArbitrary -> Util.ComparisonLessThan+ Util.PrecisionBits v2 -> (Logic.ifElse (Equality.lt v1 v2) Util.ComparisonLessThan Util.ComparisonGreaterThan)) p2)) p1) -- | Convert a float value to a different float type convertFloatValue :: (Core.FloatType -> Core.FloatValue -> Core.FloatValue)@@ -42,12 +45,13 @@ let decoder = (\fv -> (\x -> case x of Core.FloatValueBigfloat v1 -> v1 Core.FloatValueFloat32 v1 -> (Literals.float32ToBigfloat v1)- Core.FloatValueFloat64 v1 -> (Literals.float64ToBigfloat v1)) fv) - encoder = (\d -> (\x -> case x of- Core.FloatTypeBigfloat -> (Core.FloatValueBigfloat d)- Core.FloatTypeFloat32 -> (Core.FloatValueFloat32 (Literals.bigfloatToFloat32 d))- Core.FloatTypeFloat64 -> (Core.FloatValueFloat64 (Literals.bigfloatToFloat64 d))) target)- in (encoder (decoder fv))+ Core.FloatValueFloat64 v1 -> (Literals.float64ToBigfloat v1)) fv)+ in + let encoder = (\d -> (\x -> case x of+ Core.FloatTypeBigfloat -> (Core.FloatValueBigfloat d)+ Core.FloatTypeFloat32 -> (Core.FloatValueFloat32 (Literals.bigfloatToFloat32 d))+ Core.FloatTypeFloat64 -> (Core.FloatValueFloat64 (Literals.bigfloatToFloat64 d))) target)+ in (encoder (decoder fv)) -- | Convert an integer value to a different integer type convertIntegerValue :: (Core.IntegerType -> Core.IntegerValue -> Core.IntegerValue)@@ -61,18 +65,19 @@ Core.IntegerValueUint8 v1 -> (Literals.uint8ToBigint v1) Core.IntegerValueUint16 v1 -> (Literals.uint16ToBigint v1) Core.IntegerValueUint32 v1 -> (Literals.uint32ToBigint v1)- Core.IntegerValueUint64 v1 -> (Literals.uint64ToBigint v1)) iv) - encoder = (\d -> (\x -> case x of- Core.IntegerTypeBigint -> (Core.IntegerValueBigint d)- Core.IntegerTypeInt8 -> (Core.IntegerValueInt8 (Literals.bigintToInt8 d))- Core.IntegerTypeInt16 -> (Core.IntegerValueInt16 (Literals.bigintToInt16 d))- Core.IntegerTypeInt32 -> (Core.IntegerValueInt32 (Literals.bigintToInt32 d))- Core.IntegerTypeInt64 -> (Core.IntegerValueInt64 (Literals.bigintToInt64 d))- Core.IntegerTypeUint8 -> (Core.IntegerValueUint8 (Literals.bigintToUint8 d))- Core.IntegerTypeUint16 -> (Core.IntegerValueUint16 (Literals.bigintToUint16 d))- Core.IntegerTypeUint32 -> (Core.IntegerValueUint32 (Literals.bigintToUint32 d))- Core.IntegerTypeUint64 -> (Core.IntegerValueUint64 (Literals.bigintToUint64 d))) target)- in (encoder (decoder iv))+ Core.IntegerValueUint64 v1 -> (Literals.uint64ToBigint v1)) iv)+ in + let encoder = (\d -> (\x -> case x of+ Core.IntegerTypeBigint -> (Core.IntegerValueBigint d)+ Core.IntegerTypeInt8 -> (Core.IntegerValueInt8 (Literals.bigintToInt8 d))+ Core.IntegerTypeInt16 -> (Core.IntegerValueInt16 (Literals.bigintToInt16 d))+ Core.IntegerTypeInt32 -> (Core.IntegerValueInt32 (Literals.bigintToInt32 d))+ Core.IntegerTypeInt64 -> (Core.IntegerValueInt64 (Literals.bigintToInt64 d))+ Core.IntegerTypeUint8 -> (Core.IntegerValueUint8 (Literals.bigintToUint8 d))+ Core.IntegerTypeUint16 -> (Core.IntegerValueUint16 (Literals.bigintToUint16 d))+ Core.IntegerTypeUint32 -> (Core.IntegerValueUint32 (Literals.bigintToUint32 d))+ Core.IntegerTypeUint64 -> (Core.IntegerValueUint64 (Literals.bigintToUint64 d))) target)+ in (encoder (decoder iv)) -- | Generate a disclaimer message for type conversions disclaimer :: (Bool -> String -> String -> String)@@ -83,149 +88,209 @@ target, (Logic.ifElse lossy " (lossy)" "")]) +-- | Create an adapter for literal types literalAdapter :: (Core.LiteralType -> Compute.Flow Coders.AdapterContext (Compute.Adapter t0 t0 Core.LiteralType Core.LiteralType Core.Literal Core.Literal)) literalAdapter lt = - let alts = (\t -> (\x -> case x of- Core.LiteralTypeBinary -> - let step = Compute.Coder {- Compute.coderEncode = (\lit -> (\x -> case x of- Core.LiteralBinary v2 -> (Flows.pure (Core.LiteralString (Literals.binaryToString v2)))) lit),- Compute.coderDecode = (\lit -> (\x -> case x of- Core.LiteralString v2 -> (Flows.pure (Core.LiteralBinary (Literals.stringToBinary v2)))) lit)}- in (Flows.pure [- Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = t,- Compute.adapterTarget = Core.LiteralTypeString,- Compute.adapterCoder = step}])- Core.LiteralTypeBoolean -> (Flows.bind Monads.getState (\cx -> - let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx)) - hasIntegers = (Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes constraints)))- hasStrings = (Sets.member Mantle.LiteralVariantString (Coders.languageConstraintsLiteralVariants constraints))- in (Logic.ifElse hasIntegers (Flows.bind (integerAdapter Core.IntegerTypeUint8) (\adapter -> - let step_ = (Compute.adapterCoder adapter) - step = Compute.Coder {- Compute.coderEncode = (\lit -> (\x -> case x of- Core.LiteralBoolean v2 -> (Flows.bind (Compute.coderEncode step_ (Core.IntegerValueUint8 (Logic.ifElse v2 1 0))) (\iv -> Flows.pure (Core.LiteralInteger iv)))) lit),- Compute.coderDecode = (\lit -> (\x -> case x of- Core.LiteralInteger v2 -> (Flows.bind (Compute.coderDecode step_ v2) (\val -> (\x -> case x of- Core.IntegerValueUint8 v3 -> (Flows.pure (Core.LiteralBoolean (Equality.equal v3 1)))) val))) lit)}+ let forBinary = (\t -> + let matchBinary = (\lit -> (\x -> case x of+ Core.LiteralBinary v1 -> (Flows.pure (Core.LiteralString (Literals.binaryToString v1)))) lit)+ in + let matchString = (\lit -> (\x -> case x of+ Core.LiteralString v1 -> (Flows.pure (Core.LiteralBinary (Literals.stringToBinary v1)))) lit)+ in + let step = Compute.Coder {+ Compute.coderEncode = matchBinary,+ Compute.coderDecode = matchString} in (Flows.pure [ Compute.Adapter { Compute.adapterIsLossy = False, Compute.adapterSource = t,- Compute.adapterTarget = (Core.LiteralTypeInteger (Compute.adapterTarget adapter)),- Compute.adapterCoder = step}]))) (Logic.ifElse hasStrings (Flows.pure ( - let encode = (\lit -> Flows.bind (Core__.booleanLiteral lit) (\b -> Flows.pure (Core.LiteralString (Logic.ifElse b "true" "false")))) - decode = (\lit -> Flows.bind (Core__.stringLiteral lit) (\s -> Logic.ifElse (Equality.equal s "true") (Flows.pure (Core.LiteralBoolean True)) (Logic.ifElse (Equality.equal s "false") (Flows.pure (Core.LiteralBoolean False)) (Monads.unexpected "boolean literal" s))))- in [- Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = t, Compute.adapterTarget = Core.LiteralTypeString,- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = encode,- Compute.coderDecode = decode}}])) (Flows.fail "no alternatives available for boolean encoding")))))- Core.LiteralTypeFloat v1 -> (Flows.bind Monads.getState (\cx -> - let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx)) - hasFloats = (Logic.not (Sets.null (Coders.languageConstraintsFloatTypes constraints)))- in (Logic.ifElse hasFloats (Flows.bind (floatAdapter v1) (\adapter -> - let step = (Utils.bidirectional (\dir -> \l -> (\x -> case x of- Core.LiteralFloat v2 -> (Flows.map (\x -> Core.LiteralFloat x) (Utils.encodeDecode dir (Compute.adapterCoder adapter) v2))- _ -> (Monads.unexpected "floating-point literal" (Core___.literal l))) l))- in (Flows.pure [- Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.LiteralTypeFloat (Compute.adapterTarget adapter)),- Compute.adapterCoder = step}]))) (Flows.fail "no float types available"))))- Core.LiteralTypeInteger v1 -> (Flows.bind Monads.getState (\cx -> - let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx)) - hasIntegers = (Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes constraints)))- in (Logic.ifElse hasIntegers (Flows.bind (integerAdapter v1) (\adapter -> - let step = (Utils.bidirectional (\dir -> \lit -> (\x -> case x of- Core.LiteralInteger v2 -> (Flows.map (\x -> Core.LiteralInteger x) (Utils.encodeDecode dir (Compute.adapterCoder adapter) v2))- _ -> (Monads.unexpected "integer literal" (Core___.literal lit))) lit))- in (Flows.pure [- Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.LiteralTypeInteger (Compute.adapterTarget adapter)),- Compute.adapterCoder = step}]))) (Flows.fail "no integer types available"))))- Core.LiteralTypeString -> (Flows.fail "no substitute for the literal string type")) t)- in (Flows.bind Monads.getState (\cx -> - let supported = (Utils.literalTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))- in (Utils.chooseAdapter alts supported Core___.literalType Core_.literalType lt)))+ Compute.adapterCoder = step}]))+ in + let forBoolean = (\t -> + let matchBoolean = (\step_ -> \lit -> (\x -> case x of+ Core.LiteralBoolean v1 -> (Flows.bind (Compute.coderEncode step_ (Core.IntegerValueUint8 (Logic.ifElse v1 1 0))) (\iv -> Flows.pure (Core.LiteralInteger iv)))) lit)+ in + let matchInteger = (\step_ -> \lit -> + let forValue = (\val -> (\x -> case x of+ Core.IntegerValueUint8 v1 -> (Core.LiteralBoolean (Equality.equal v1 1))) val)+ in ((\x -> case x of+ Core.LiteralInteger v1 -> (Flows.bind (Compute.coderDecode step_ v1) (\val -> Flows.pure (forValue val)))) lit))+ in (Flows.bind Monads.getState (\cx -> + let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx))+ in + let hasIntegers = (Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes constraints)))+ in + let hasStrings = (Sets.member Variants.LiteralVariantString (Coders.languageConstraintsLiteralVariants constraints))+ in + let withIntegers = + let withAdapter = (\adapter -> + let step_ = (Compute.adapterCoder adapter)+ in + let step = Compute.Coder {+ Compute.coderEncode = (matchBoolean step_),+ Compute.coderDecode = (matchInteger step_)}+ in (Flows.pure [+ Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.LiteralTypeInteger (Compute.adapterTarget adapter)),+ Compute.adapterCoder = step}]))+ in (Flows.bind (integerAdapter Core.IntegerTypeUint8) (\adapter -> withAdapter adapter))+ in + let withStrings = + let encode = (\lit -> Flows.bind (Core_.booleanLiteral lit) (\b -> Flows.pure (Core.LiteralString (Logic.ifElse b "true" "false"))))+ in + let decode = (\lit -> Flows.bind (Core_.stringLiteral lit) (\s -> Logic.ifElse (Equality.equal s "true") (Flows.pure (Core.LiteralBoolean True)) (Logic.ifElse (Equality.equal s "false") (Flows.pure (Core.LiteralBoolean False)) (Monads.unexpected "boolean literal" s))))+ in [+ Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = t,+ Compute.adapterTarget = Core.LiteralTypeString,+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = encode,+ Compute.coderDecode = decode}}]+ in (Logic.ifElse hasIntegers withIntegers (Logic.ifElse hasStrings (Flows.pure withStrings) (Flows.fail "no alternatives available for boolean encoding"))))))+ in + let forFloat = (\t -> \ft -> + let withFloats = + let adapt = (\adapter -> \dir -> \l -> (\x -> case x of+ Core.LiteralFloat v1 -> (Flows.map (\x -> Core.LiteralFloat x) (Utils.encodeDecode dir (Compute.adapterCoder adapter) v1))+ _ -> (Monads.unexpected "floating-point literal" (Core__.literal l))) l)+ in (Flows.bind (floatAdapter ft) (\adapter -> + let step = (Utils.bidirectional (adapt adapter))+ in (Flows.pure [+ Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.LiteralTypeFloat (Compute.adapterTarget adapter)),+ Compute.adapterCoder = step}])))+ in (Flows.bind Monads.getState (\cx -> + let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx))+ in + let hasFloats = (Logic.not (Sets.null (Coders.languageConstraintsFloatTypes constraints)))+ in (Logic.ifElse hasFloats withFloats (Flows.fail "no float types available")))))+ in + let forInteger = (\t -> \it -> + let withIntegers = + let adapt = (\adapter -> \dir -> \lit -> (\x -> case x of+ Core.LiteralInteger v1 -> (Flows.map (\x -> Core.LiteralInteger x) (Utils.encodeDecode dir (Compute.adapterCoder adapter) v1))+ _ -> (Monads.unexpected "integer literal" (Core__.literal lit))) lit)+ in (Flows.bind (integerAdapter it) (\adapter -> + let step = (Utils.bidirectional (adapt adapter))+ in (Flows.pure [+ Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.LiteralTypeInteger (Compute.adapterTarget adapter)),+ Compute.adapterCoder = step}])))+ in (Flows.bind Monads.getState (\cx -> + let constraints = (Coders.languageConstraints (Coders.adapterContextLanguage cx))+ in + let hasIntegers = (Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes constraints)))+ in (Logic.ifElse hasIntegers withIntegers (Flows.fail "no integer types available")))))+ in + let alts = (\t -> (\x -> case x of+ Core.LiteralTypeBinary -> (forBinary t)+ Core.LiteralTypeBoolean -> (forBoolean t)+ Core.LiteralTypeFloat v1 -> (forFloat t v1)+ Core.LiteralTypeInteger v1 -> (forInteger t v1)+ Core.LiteralTypeString -> (Flows.fail "no substitute for the literal string type")) t)+ in (Flows.bind Monads.getState (\cx -> + let supported = (Utils.literalTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))+ in (Utils.chooseAdapter alts supported Core__.literalType Core__.literalType lt))) +-- | Create an adapter for float types floatAdapter :: (Core.FloatType -> Compute.Flow Coders.AdapterContext (Compute.Adapter t0 t1 Core.FloatType Core.FloatType Core.FloatValue Core.FloatValue)) floatAdapter ft = - let alts = (\t -> Flows.mapList (makeAdapter t) ((\x -> case x of- Core.FloatTypeBigfloat -> [- Core.FloatTypeFloat64,- Core.FloatTypeFloat32]- Core.FloatTypeFloat32 -> [- Core.FloatTypeFloat64,- Core.FloatTypeBigfloat]- Core.FloatTypeFloat64 -> [- Core.FloatTypeBigfloat,- Core.FloatTypeFloat32]) t)) - makeAdapter = (\source -> \target -> - let lossy = (Equality.equal (comparePrecision (Variants.floatTypePrecision source) (Variants.floatTypePrecision target)) Mantle.ComparisonGreaterThan) - step = Compute.Coder {- Compute.coderEncode = (\fv -> Flows.pure (convertFloatValue target fv)),- Compute.coderDecode = (\fv -> Flows.pure (convertFloatValue source fv))}- msg = (disclaimer lossy (Core_.floatType source) (Core_.floatType target))+ let makeAdapter = (\source -> \target -> + let lossy = (Equality.equal (comparePrecision (Reflect.floatTypePrecision source) (Reflect.floatTypePrecision target)) Util.ComparisonGreaterThan)+ in + let step = Compute.Coder {+ Compute.coderEncode = (\fv -> Flows.pure (convertFloatValue target fv)),+ Compute.coderDecode = (\fv -> Flows.pure (convertFloatValue source fv))}+ in + let msg = (disclaimer lossy (Core__.floatType source) (Core__.floatType target)) in (Monads.warn msg (Flows.pure (Compute.Adapter { Compute.adapterIsLossy = lossy, Compute.adapterSource = source, Compute.adapterTarget = target, Compute.adapterCoder = step}))))- in (Flows.bind Monads.getState (\cx -> - let supported = (Utils.floatTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))- in (Utils.chooseAdapter alts supported Core___.floatType Core_.floatType ft)))+ in + let altTypes = (\t -> (\x -> case x of+ Core.FloatTypeBigfloat -> [+ Core.FloatTypeFloat64,+ Core.FloatTypeFloat32]+ Core.FloatTypeFloat32 -> [+ Core.FloatTypeFloat64,+ Core.FloatTypeBigfloat]+ Core.FloatTypeFloat64 -> [+ Core.FloatTypeBigfloat,+ Core.FloatTypeFloat32]) t)+ in + let alts = (\t -> Flows.mapList (makeAdapter t) (altTypes t))+ in (Flows.bind Monads.getState (\cx -> + let supported = (Utils.floatTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))+ in (Utils.chooseAdapter alts supported Core__.floatType Core__.floatType ft))) +-- | Create an adapter for integer types integerAdapter :: (Core.IntegerType -> Compute.Flow Coders.AdapterContext (Compute.Adapter t0 t1 Core.IntegerType Core.IntegerType Core.IntegerValue Core.IntegerValue)) integerAdapter it = let interleave = (\xs -> \ys -> Lists.concat (Lists.transpose [ xs,- ys])) - signedOrdered = (Lists.filter (\v -> Logic.and (Variants.integerTypeIsSigned v) (Logic.not (Equality.equal (Variants.integerTypePrecision v) Mantle.PrecisionArbitrary))) Variants.integerTypes)- unsignedOrdered = (Lists.filter (\v -> Logic.and (Logic.not (Variants.integerTypeIsSigned v)) (Logic.not (Equality.equal (Variants.integerTypePrecision v) Mantle.PrecisionArbitrary))) Variants.integerTypes)- signedPref = (interleave signedOrdered unsignedOrdered)- unsignedPref = (interleave unsignedOrdered signedOrdered)- signedNonPref = (Lists.reverse unsignedPref)- unsignedNonPref = (Lists.reverse signedPref)- signed = (\i -> Lists.concat [- Lists.drop (Math.mul i 2) signedPref,- [- Core.IntegerTypeBigint],- (Lists.drop (Math.add (Math.sub 8 (Math.mul i 2)) 1) signedNonPref)])- unsigned = (\i -> Lists.concat [- Lists.drop (Math.mul i 2) unsignedPref,- [- Core.IntegerTypeBigint],- (Lists.drop (Math.add (Math.sub 8 (Math.mul i 2)) 1) unsignedNonPref)])- alts = (\t -> Flows.mapList (makeAdapter t) ((\x -> case x of- Core.IntegerTypeBigint -> (Lists.reverse unsignedPref)- Core.IntegerTypeInt8 -> (signed 1)- Core.IntegerTypeInt16 -> (signed 2)- Core.IntegerTypeInt32 -> (signed 3)- Core.IntegerTypeInt64 -> (signed 4)- Core.IntegerTypeUint8 -> (unsigned 1)- Core.IntegerTypeUint16 -> (unsigned 2)- Core.IntegerTypeUint32 -> (unsigned 3)- Core.IntegerTypeUint64 -> (unsigned 4)) t))- makeAdapter = (\source -> \target -> - let lossy = (Logic.not (Equality.equal (comparePrecision (Variants.integerTypePrecision source) (Variants.integerTypePrecision target)) Mantle.ComparisonLessThan)) - step = Compute.Coder {- Compute.coderEncode = (\iv -> Flows.pure (convertIntegerValue target iv)),- Compute.coderDecode = (\iv -> Flows.pure (convertIntegerValue source iv))}- msg = (disclaimer lossy (Core_.integerType source) (Core_.integerType target))- in (Monads.warn msg (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = source,- Compute.adapterTarget = target,- Compute.adapterCoder = step}))))- in (Flows.bind Monads.getState (\cx -> - let supported = (Utils.integerTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))- in (Utils.chooseAdapter alts supported Core___.integerType Core_.integerType it)))+ ys]))+ in + let signedOrdered = (Lists.filter (\v -> Logic.and (Reflect.integerTypeIsSigned v) (Logic.not (Equality.equal (Reflect.integerTypePrecision v) Util.PrecisionArbitrary))) Reflect.integerTypes)+ in + let unsignedOrdered = (Lists.filter (\v -> Logic.and (Logic.not (Reflect.integerTypeIsSigned v)) (Logic.not (Equality.equal (Reflect.integerTypePrecision v) Util.PrecisionArbitrary))) Reflect.integerTypes)+ in + let signedPref = (interleave signedOrdered unsignedOrdered)+ in + let unsignedPref = (interleave unsignedOrdered signedOrdered)+ in + let signedNonPref = (Lists.reverse unsignedPref)+ in + let unsignedNonPref = (Lists.reverse signedPref)+ in + let signed = (\i -> Lists.concat [+ Lists.drop (Math.mul i 2) signedPref,+ [+ Core.IntegerTypeBigint],+ (Lists.drop (Math.add (Math.sub 8 (Math.mul i 2)) 1) signedNonPref)])+ in + let unsigned = (\i -> Lists.concat [+ Lists.drop (Math.mul i 2) unsignedPref,+ [+ Core.IntegerTypeBigint],+ (Lists.drop (Math.add (Math.sub 8 (Math.mul i 2)) 1) unsignedNonPref)])+ in + let makeAdapter = (\source -> \target -> + let lossy = (Logic.not (Equality.equal (comparePrecision (Reflect.integerTypePrecision source) (Reflect.integerTypePrecision target)) Util.ComparisonLessThan))+ in + let step = Compute.Coder {+ Compute.coderEncode = (\iv -> Flows.pure (convertIntegerValue target iv)),+ Compute.coderDecode = (\iv -> Flows.pure (convertIntegerValue source iv))}+ in + let msg = (disclaimer lossy (Core__.integerType source) (Core__.integerType target))+ in (Monads.warn msg (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = source,+ Compute.adapterTarget = target,+ Compute.adapterCoder = step}))))+ in + let altTypes = (\t -> (\x -> case x of+ Core.IntegerTypeBigint -> (Lists.reverse unsignedPref)+ Core.IntegerTypeInt8 -> (signed 1)+ Core.IntegerTypeInt16 -> (signed 2)+ Core.IntegerTypeInt32 -> (signed 3)+ Core.IntegerTypeInt64 -> (signed 4)+ Core.IntegerTypeUint8 -> (unsigned 1)+ Core.IntegerTypeUint16 -> (unsigned 2)+ Core.IntegerTypeUint32 -> (unsigned 3)+ Core.IntegerTypeUint64 -> (unsigned 4)) t)+ in + let alts = (\t -> Flows.mapList (makeAdapter t) (altTypes t))+ in (Flows.bind Monads.getState (\cx -> + let supported = (Utils.integerTypeIsSupported (Coders.languageConstraints (Coders.adapterContextLanguage cx)))+ in (Utils.chooseAdapter alts supported Core__.integerType Core__.integerType it)))
src/gen-main/haskell/Hydra/Adapt/Modules.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Entry point for Hydra's adapter (type/term rewriting) framework module Hydra.Adapt.Modules where@@ -9,30 +11,36 @@ import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core import qualified Hydra.Decode.Core as Core_-import qualified Hydra.Describe.Core as Core__ import qualified Hydra.Graph as Graph import qualified Hydra.Lexical as Lexical import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Module as Module import qualified Hydra.Monads as Monads import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Schemas as Schemas-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Given a target language, an encoding function, and a type, adapt and encode the type adaptTypeToLanguageAndEncode :: (Coders.Language -> (Core.Type -> Compute.Flow Graph.Graph t0) -> Core.Type -> Compute.Flow Graph.Graph t0)-adaptTypeToLanguageAndEncode lang enc typ = ((\x -> case x of- Core.TypeVariable _ -> (enc typ)- _ -> (Flows.bind (adaptTypeToLanguage lang typ) (\adaptedType -> enc adaptedType))) (Rewriting.deannotateType typ))+adaptTypeToLanguageAndEncode lang enc typ = + let dflt = (Flows.bind (adaptTypeToLanguage lang typ) (\adaptedType -> enc adaptedType))+ in ((\x -> case x of+ Core.TypeVariable _ -> (enc typ)+ _ -> dflt) (Rewriting.deannotateType typ)) -- | Given a target language and a source type, find the target type to which the latter will be adapted adaptTypeToLanguage :: (Coders.Language -> Core.Type -> Compute.Flow Graph.Graph Core.Type)@@ -40,52 +48,68 @@ -- | Map a Hydra module to a list of type and/or term definitions which have been adapted to the target language adaptedModuleDefinitions :: (Coders.Language -> Module.Module -> Compute.Flow Graph.Graph [Module.Definition])-adaptedModuleDefinitions lang mod = - let els = (Module.moduleElements mod) - adaptersFor = (\types -> Flows.bind (Flows.mapList (languageAdapter lang) types) (\adapters -> Flows.pure (Maps.fromList (Lists.zip types adapters))))- classify = (\adapters -> \pair -> - let el = (fst pair) - tt = (snd pair)- term = (Core.typedTermTerm tt)- typ = (Core.typedTermType tt)- name = (Core.bindingName el)- in (Logic.ifElse (Annotations.isNativeType el) (Flows.bind (Flows.bind (Core_.type_ term) (\coreTyp -> adaptTypeToLanguage lang coreTyp)) (\adaptedTyp -> Flows.pure (Module.DefinitionType (Module.TypeDefinition {- Module.typeDefinitionName = name,- Module.typeDefinitionType = adaptedTyp})))) (Optionals.maybe (Flows.fail (Strings.cat2 "no adapter for element " (Core.unName name))) (\adapter -> Flows.bind (Compute.coderEncode (Compute.adapterCoder adapter) term) (\adapted -> Flows.pure (Module.DefinitionTerm (Module.TermDefinition {- Module.termDefinitionName = name,- Module.termDefinitionTerm = adapted,- Module.termDefinitionType = (Compute.adapterTarget adapter)})))) (Maps.lookup typ adapters))))- in (Flows.bind (Lexical.withSchemaContext (Flows.mapList Schemas.elementAsTypedTerm els)) (\tterms -> - let types = (Sets.toList (Sets.fromList (Lists.map (\arg_ -> Rewriting.deannotateType (Core.typedTermType arg_)) tterms)))- in (Flows.bind (adaptersFor types) (\adapters -> Flows.mapList (classify adapters) (Lists.zip els tterms)))))+adaptedModuleDefinitions lang mod = (Flows.bind Monads.getState (\cx -> + let els = (Module.moduleElements mod)+ in + let adaptersFor = (\types -> Flows.bind (Flows.mapList (languageAdapter lang) types) (\adapters -> Flows.pure (Maps.fromList (Lists.zip types adapters))))+ in + let classify = (\adapters -> \pair -> + let el = (Pairs.first pair)+ in + let tt = (Pairs.second pair)+ in + let term = (Core.typeApplicationTermBody tt)+ in + let typ = (Core.typeApplicationTermType tt)+ in + let name = (Core.bindingName el)+ in (Logic.ifElse (Annotations.isNativeType el) (Flows.bind (Flows.bind (Monads.withTrace "adapt module definitions" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx term))) (\coreTyp -> adaptTypeToLanguage lang coreTyp)) (\adaptedTyp -> Flows.pure (Module.DefinitionType (Module.TypeDefinition {+ Module.typeDefinitionName = name,+ Module.typeDefinitionType = adaptedTyp})))) (Maybes.maybe (Flows.fail (Strings.cat2 "no adapter for element " (Core.unName name))) (\adapter -> Flows.bind (Compute.coderEncode (Compute.adapterCoder adapter) term) (\adapted -> Flows.pure (Module.DefinitionTerm (Module.TermDefinition {+ Module.termDefinitionName = name,+ Module.termDefinitionTerm = adapted,+ Module.termDefinitionType = (Schemas.typeToTypeScheme (Compute.adapterTarget adapter))})))) (Maps.lookup typ adapters))))+ in (Flows.bind (Lexical.withSchemaContext (Flows.mapList Schemas.elementAsTypeApplicationTerm els)) (\tterms -> + let types = (Sets.toList (Sets.fromList (Lists.map (\arg_ -> Rewriting.deannotateType (Core.typeApplicationTermType arg_)) tterms)))+ in (Flows.bind (adaptersFor types) (\adapters -> Flows.mapList (classify adapters) (Lists.zip els tterms))))))) +-- | Given a target language, a unidirectional last-mile encoding, and a source type, construct a unidirectional adapting coder for terms of that type constructCoder :: (Coders.Language -> (Core.Term -> Compute.Flow t0 t1) -> Core.Type -> Compute.Flow Graph.Graph (Compute.Coder t0 t2 Core.Term t1)) constructCoder lang encodeTerm typ = (Monads.withTrace (Strings.cat2 "coder for " (Core__.type_ typ)) (Flows.bind (languageAdapter lang typ) (\adapter -> Flows.pure (Utils.composeCoders (Compute.adapterCoder adapter) (Utils.unidirectionalCoder encodeTerm))))) +-- | Given a target language and a source type, produce an adapter, which rewrites the type and its terms according to the language's constraints languageAdapter :: (Coders.Language -> Core.Type -> Compute.Flow Graph.Graph (Compute.Adapter t0 t1 Core.Type Core.Type Core.Term Core.Term))-languageAdapter lang typ = (Flows.bind Monads.getState (\g -> - let cx0 = Coders.AdapterContext {- Coders.adapterContextGraph = g,- Coders.adapterContextLanguage = lang,- Coders.adapterContextAdapters = Maps.empty}- in (Flows.bind (Monads.withState cx0 (Flows.bind (Terms.termAdapter typ) (\ad -> Flows.bind Monads.getState (\cx -> Flows.pure (ad, cx))))) (\result -> - let adapter = (fst result) - cx = (snd result)- encode = (\term -> Monads.withState cx (Compute.coderEncode (Compute.adapterCoder adapter) term))- decode = (\term -> Monads.withState cx (Compute.coderDecode (Compute.adapterCoder adapter) term))- ac = Compute.Coder {+languageAdapter lang typ = + let getPair = (\typ -> Flows.bind (Terms.termAdapter typ) (\ad -> Flows.bind Monads.getState (\cx -> Flows.pure (ad, cx))))+ in (Flows.bind Monads.getState (\g -> + let cx0 = Coders.AdapterContext {+ Coders.adapterContextGraph = g,+ Coders.adapterContextLanguage = lang,+ Coders.adapterContextAdapters = Maps.empty}+ in (Flows.bind (Monads.withState cx0 (getPair typ)) (\result -> + let adapter = (Pairs.first result)+ in + let cx = (Pairs.second result)+ in + let encode = (\term -> Monads.withState cx (Compute.coderEncode (Compute.adapterCoder adapter) term))+ in + let decode = (\term -> Monads.withState cx (Compute.coderDecode (Compute.adapterCoder adapter) term))+ in (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),+ Compute.adapterSource = (Compute.adapterSource adapter),+ Compute.adapterTarget = (Compute.adapterTarget adapter),+ Compute.adapterCoder = Compute.Coder { Compute.coderEncode = encode,- Compute.coderDecode = decode}- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),- Compute.adapterSource = (Compute.adapterSource adapter),- Compute.adapterTarget = (Compute.adapterTarget adapter),- Compute.adapterCoder = ac}))))))+ Compute.coderDecode = decode}})))))) -transformModule :: (Coders.Language -> (Core.Term -> Compute.Flow t0 t1) -> (Module.Module -> M.Map Core.Type (Compute.Coder t0 t2 Core.Term t1) -> [(Core.Binding, Core.TypedTerm)] -> Compute.Flow Graph.Graph t3) -> Module.Module -> Compute.Flow Graph.Graph t3)-transformModule lang encodeTerm createModule mod = (Monads.withTrace (Strings.cat2 "transform module " (Module.unNamespace (Module.moduleNamespace mod))) ( - let els = (Module.moduleElements mod) - codersFor = (\types -> Flows.bind (Flows.mapList (constructCoder lang encodeTerm) types) (\cdrs -> Flows.pure (Maps.fromList (Lists.zip types cdrs))))- in (Flows.bind (Lexical.withSchemaContext (Flows.mapList Schemas.elementAsTypedTerm els)) (\tterms -> - let types = (Lists.nub (Lists.map Core.typedTermType tterms))- in (Flows.bind (codersFor types) (\coders -> createModule mod coders (Lists.zip els tterms)))))))+-- | Given a target language, a unidirectional last mile encoding, and an intermediate helper function, transform a given module into a target representation+transformModule :: (Coders.Language -> (Core.Term -> Compute.Flow t0 t1) -> (Module.Module -> M.Map Core.Type (Compute.Coder t0 t2 Core.Term t1) -> [(Core.Binding, Core.TypeApplicationTerm)] -> Compute.Flow Graph.Graph t3) -> Module.Module -> Compute.Flow Graph.Graph t3)+transformModule lang encodeTerm createModule mod = + let els = (Module.moduleElements mod)+ in + let transform = (Flows.bind (Lexical.withSchemaContext (Flows.mapList Schemas.elementAsTypeApplicationTerm els)) (\tterms -> + let types = (Lists.nub (Lists.map Core.typeApplicationTermType tterms))+ in (Flows.bind (Flows.mapList (constructCoder lang encodeTerm) types) (\cdrs -> + let coders = (Maps.fromList (Lists.zip types cdrs))+ in (createModule mod coders (Lists.zip els tterms))))))+ in (Monads.withTrace (Strings.cat2 "transform module " (Module.unNamespace (Module.moduleNamespace mod))) transform)
src/gen-main/haskell/Hydra/Adapt/Simple.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Simple, one-way adapters for types and terms module Hydra.Adapt.Simple where@@ -6,24 +8,29 @@ import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph+import qualified Hydra.Hoisting as Hoisting import qualified Hydra.Inference as Inference+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Literals as Literals_ import qualified Hydra.Module as Module+import qualified Hydra.Names as Names import qualified Hydra.Reduction as Reduction+import qualified Hydra.Reflect as Reflect import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Schemas as Schemas import qualified Hydra.Show.Core as Core_-import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -35,53 +42,65 @@ let supported = (Sets.member ft (Coders.languageConstraintsFloatTypes constraints)) in let alt = (adaptFloatType constraints)- in (Logic.ifElse supported (Just ft) ((\x -> case x of- Core.FloatTypeBigfloat -> Nothing- Core.FloatTypeFloat32 -> (alt Core.FloatTypeFloat64)- Core.FloatTypeFloat64 -> (alt Core.FloatTypeBigfloat)) ft))+ in + let forUnsupported = (\ft -> (\x -> case x of+ Core.FloatTypeBigfloat -> (alt Core.FloatTypeFloat64)+ Core.FloatTypeFloat32 -> (alt Core.FloatTypeFloat64)+ Core.FloatTypeFloat64 -> (alt Core.FloatTypeBigfloat)) ft)+ in (Logic.ifElse supported (Just ft) (forUnsupported ft)) --- | Adapt a graph and its schema to the given language constraints, prior to inference+-- | Adapt a graph and its schema to the given language constraints. The doExpand flag controls eta expansion of partial applications. Adaptation is type-preserving: binding-level TypeSchemes are adapted (not stripped). Note: case statement hoisting is done separately, prior to adaptation. adaptDataGraph :: (Coders.LanguageConstraints -> Bool -> Graph.Graph -> Compute.Flow Graph.Graph Graph.Graph) adaptDataGraph constraints doExpand graph0 = - let litmap = (adaptLiteralTypesMap constraints)+ let transform = (\graph -> \gterm -> Flows.bind (Schemas.graphToTypeContext graph) (\tx -> + let gterm1 = (Rewriting.unshadowVariables (pushTypeAppsInward gterm))+ in + let gterm2 = (Rewriting.unshadowVariables (Logic.ifElse doExpand (pushTypeAppsInward (Reduction.etaExpandTermNew tx gterm1)) gterm1))+ in (Flows.pure (Rewriting.liftLambdaAboveLet gterm2)))) in - let els0 = (Graph.graphElements graph0)+ let litmap = (adaptLiteralTypesMap constraints) in - let env0 = (Graph.graphEnvironment graph0)+ let els0 = (Graph.graphElements graph0) in - let body0 = (Graph.graphBody graph0)+ let env0 = (Graph.graphEnvironment graph0) in - let prims0 = (Graph.graphPrimitives graph0)+ let body0 = (Graph.graphBody graph0) in - let schema0 = (Graph.graphSchema graph0)- in (Flows.bind (Optionals.maybe (Flows.pure Nothing) (\sg -> Flows.bind (Schemas.graphAsTypes sg) (\tmap0 -> Flows.bind (adaptGraphSchema constraints litmap tmap0) (\tmap1 -> - let emap = (Schemas.typesToElements tmap1)- in (Flows.pure (Just (Graph.Graph {- Graph.graphElements = emap,- Graph.graphEnvironment = (Graph.graphEnvironment sg),- Graph.graphTypes = (Graph.graphTypes sg),- Graph.graphBody = (Graph.graphBody sg),- Graph.graphPrimitives = (Graph.graphPrimitives sg),- Graph.graphSchema = (Graph.graphSchema sg)})))))) schema0) (\schema1 -> - let gterm0 = (Schemas.graphAsTerm graph0)- in - let gterm1 = (Logic.ifElse doExpand (Reduction.expandLambdas graph0 gterm0) gterm0)- in (Flows.bind (adaptTerm constraints litmap gterm1) (\gterm2 -> - let els1 = (Schemas.termAsGraph gterm2)- in (Flows.bind (Flows.mapElems (adaptPrimitive constraints litmap) prims0) (\prims1 -> Flows.pure (Graph.Graph {- Graph.graphElements = els1,- Graph.graphEnvironment = env0,- Graph.graphTypes = Maps.empty,- Graph.graphBody = Core.TermUnit,- Graph.graphPrimitives = prims1,- Graph.graphSchema = schema1})))))))+ let prims0 = (Graph.graphPrimitives graph0)+ in + let schema0 = (Graph.graphSchema graph0)+ in (Flows.bind (Maybes.maybe (Flows.pure Nothing) (\sg -> Flows.bind (Schemas.graphAsTypes sg) (\tmap0 -> Flows.bind (adaptGraphSchema constraints litmap tmap0) (\tmap1 -> + let emap = (Schemas.typesToElements tmap1)+ in (Flows.pure (Just (Graph.Graph {+ Graph.graphElements = emap,+ Graph.graphEnvironment = (Graph.graphEnvironment sg),+ Graph.graphTypes = (Graph.graphTypes sg),+ Graph.graphBody = (Graph.graphBody sg),+ Graph.graphPrimitives = (Graph.graphPrimitives sg),+ Graph.graphSchema = (Graph.graphSchema sg)})))))) schema0) (\schema1 -> + let gterm0 = (Schemas.graphAsTerm graph0)+ in (Flows.bind (Logic.ifElse doExpand (transform graph0 gterm0) (Flows.pure gterm0)) (\gterm1 -> Flows.bind (adaptTerm constraints litmap gterm1) (\gterm2 -> Flows.bind (Rewriting.rewriteTermM (adaptLambdaDomains constraints litmap) gterm2) (\gterm3 -> + let els1Raw = (Schemas.termAsGraph gterm3)+ in + let processBinding = (\el -> Flows.bind (Rewriting.rewriteTermM (adaptNestedTypes constraints litmap) (Core.bindingTerm el)) (\newTerm -> Flows.bind (Maybes.maybe (Flows.pure Nothing) (\ts -> Flows.bind (adaptTypeScheme constraints litmap ts) (\ts1 -> Flows.pure (Just ts1))) (Core.bindingType el)) (\adaptedType -> Flows.pure (Core.Binding {+ Core.bindingName = (Core.bindingName el),+ Core.bindingTerm = newTerm,+ Core.bindingType = adaptedType}))))+ in (Flows.bind (Flows.mapList processBinding els1Raw) (\els1 -> Flows.bind (Flows.mapElems (adaptPrimitive constraints litmap) prims0) (\prims1 -> Flows.pure (Graph.Graph {+ Graph.graphElements = els1,+ Graph.graphEnvironment = env0,+ Graph.graphTypes = Maps.empty,+ Graph.graphBody = Core.TermUnit,+ Graph.graphPrimitives = prims1,+ Graph.graphSchema = schema1})))))))))) -adaptGraphSchema :: (Ord t0) => (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> M.Map t0 Core.Type -> Compute.Flow t1 (M.Map t0 Core.Type))+-- | Adapt a schema graph to the given language constraints+adaptGraphSchema :: Ord t0 => (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> M.Map t0 Core.Type -> Compute.Flow t1 (M.Map t0 Core.Type)) adaptGraphSchema constraints litmap types0 = let mapPair = (\pair -> - let name = (fst pair)+ let name = (Pairs.first pair) in - let typ = (snd pair)+ let typ = (Pairs.second pair) in (Flows.bind (adaptType constraints litmap typ) (\typ1 -> Flows.pure (name, typ1)))) in (Flows.bind (Flows.mapList mapPair (Maps.toList types0)) (\pairs -> Flows.pure (Maps.fromList pairs))) @@ -91,17 +110,30 @@ let supported = (Sets.member it (Coders.languageConstraintsIntegerTypes constraints)) in let alt = (adaptIntegerType constraints)- in (Logic.ifElse supported (Just it) ((\x -> case x of- Core.IntegerTypeBigint -> Nothing- Core.IntegerTypeInt8 -> (alt Core.IntegerTypeUint16)- Core.IntegerTypeInt16 -> (alt Core.IntegerTypeUint32)- Core.IntegerTypeInt32 -> (alt Core.IntegerTypeUint64)- Core.IntegerTypeInt64 -> (alt Core.IntegerTypeBigint)- Core.IntegerTypeUint8 -> (alt Core.IntegerTypeInt16)- Core.IntegerTypeUint16 -> (alt Core.IntegerTypeInt32)- Core.IntegerTypeUint32 -> (alt Core.IntegerTypeInt64)- Core.IntegerTypeUint64 -> (alt Core.IntegerTypeBigint)) it))+ in + let forUnsupported = (\it -> (\x -> case x of+ Core.IntegerTypeBigint -> Nothing+ Core.IntegerTypeInt8 -> (alt Core.IntegerTypeUint16)+ Core.IntegerTypeInt16 -> (alt Core.IntegerTypeUint32)+ Core.IntegerTypeInt32 -> (alt Core.IntegerTypeUint64)+ Core.IntegerTypeInt64 -> (alt Core.IntegerTypeBigint)+ Core.IntegerTypeUint8 -> (alt Core.IntegerTypeInt16)+ Core.IntegerTypeUint16 -> (alt Core.IntegerTypeInt32)+ Core.IntegerTypeUint32 -> (alt Core.IntegerTypeInt64)+ Core.IntegerTypeUint64 -> (alt Core.IntegerTypeBigint)) it)+ in (Logic.ifElse supported (Just it) (forUnsupported it)) +-- | Rewrite callback for adapting lambda domain types in a term+adaptLambdaDomains :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> (t0 -> Compute.Flow t1 Core.Term) -> t0 -> Compute.Flow t1 Core.Term)+adaptLambdaDomains constraints litmap recurse term = (Flows.bind (recurse term) (\rewritten -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Flows.bind (Maybes.maybe (Flows.pure Nothing) (\dom -> Flows.bind (adaptType constraints litmap dom) (\dom1 -> Flows.pure (Just dom1))) (Core.lambdaDomain v2)) (\adaptedDomain -> Flows.pure (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = adaptedDomain,+ Core.lambdaBody = (Core.lambdaBody v2)})))))+ _ -> (Flows.pure (Core.TermFunction v1))) v1)+ _ -> (Flows.pure rewritten)) rewritten))+ -- | Convert a literal to a different type adaptLiteral :: (Core.LiteralType -> Core.Literal -> Core.Literal) adaptLiteral lt l = ((\x -> case x of@@ -116,22 +148,39 @@ -- | Attempt to adapt a literal type using the given language constraints adaptLiteralType :: (Coders.LanguageConstraints -> Core.LiteralType -> Maybe Core.LiteralType)-adaptLiteralType constraints lt = (Logic.ifElse (literalTypeSupported constraints lt) Nothing ((\x -> case x of- Core.LiteralTypeBinary -> (Just Core.LiteralTypeString)- Core.LiteralTypeBoolean -> (Optionals.map (\x -> Core.LiteralTypeInteger x) (adaptIntegerType constraints Core.IntegerTypeInt8))- Core.LiteralTypeFloat v1 -> (Optionals.map (\x -> Core.LiteralTypeFloat x) (adaptFloatType constraints v1))- Core.LiteralTypeInteger v1 -> (Optionals.map (\x -> Core.LiteralTypeInteger x) (adaptIntegerType constraints v1))- _ -> Nothing) lt))+adaptLiteralType constraints lt = + let forUnsupported = (\lt -> (\x -> case x of+ Core.LiteralTypeBinary -> (Just Core.LiteralTypeString)+ Core.LiteralTypeBoolean -> (Maybes.map (\x -> Core.LiteralTypeInteger x) (adaptIntegerType constraints Core.IntegerTypeInt8))+ Core.LiteralTypeFloat v1 -> (Maybes.map (\x -> Core.LiteralTypeFloat x) (adaptFloatType constraints v1))+ Core.LiteralTypeInteger v1 -> (Maybes.map (\x -> Core.LiteralTypeInteger x) (adaptIntegerType constraints v1))+ _ -> Nothing) lt)+ in (Logic.ifElse (literalTypeSupported constraints lt) Nothing (forUnsupported lt)) -- | Derive a map of adapted literal types for the given language constraints adaptLiteralTypesMap :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType) adaptLiteralTypesMap constraints = - let tryType = (\lt -> Optionals.maybe Nothing (\lt2 -> Just (lt, lt2)) (adaptLiteralType constraints lt))- in (Maps.fromList (Optionals.cat (Lists.map tryType Variants.literalTypes)))+ let tryType = (\lt -> Maybes.maybe Nothing (\lt2 -> Just (lt, lt2)) (adaptLiteralType constraints lt))+ in (Maps.fromList (Maybes.cat (Lists.map tryType Reflect.literalTypes))) -adaptLiteralValue :: (Ord t0) => (M.Map t0 Core.LiteralType -> t0 -> Core.Literal -> Core.Literal)-adaptLiteralValue litmap lt l = (Optionals.maybe (Core.LiteralString (Core_.literal l)) (\lt2 -> adaptLiteral lt2 l) (Maps.lookup lt litmap))+-- | Adapt a literal value using the given language constraints+adaptLiteralValue :: Ord t0 => (M.Map t0 Core.LiteralType -> t0 -> Core.Literal -> Core.Literal)+adaptLiteralValue litmap lt l = (Maybes.maybe (Core.LiteralString (Core_.literal l)) (\lt2 -> adaptLiteral lt2 l) (Maps.lookup lt litmap)) +-- | Rewrite callback for adapting nested let binding TypeSchemes in a term+adaptNestedTypes :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> (t0 -> Compute.Flow t1 Core.Term) -> t0 -> Compute.Flow t1 Core.Term)+adaptNestedTypes constraints litmap recurse term = (Flows.bind (recurse term) (\rewritten -> (\x -> case x of+ Core.TermLet v1 -> + let adaptB = (\b -> Flows.bind (Maybes.maybe (Flows.pure Nothing) (\ts -> Flows.bind (adaptTypeScheme constraints litmap ts) (\ts1 -> Flows.pure (Just ts1))) (Core.bindingType b)) (\adaptedBType -> Flows.pure (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Core.bindingTerm b),+ Core.bindingType = adaptedBType})))+ in (Flows.bind (Flows.mapList adaptB (Core.letBindings v1)) (\adaptedBindings -> Flows.pure (Core.TermLet (Core.Let {+ Core.letBindings = adaptedBindings,+ Core.letBody = (Core.letBody v1)}))))+ _ -> (Flows.pure rewritten)) rewritten))++-- | Adapt a primitive to the given language constraints, prior to inference adaptPrimitive :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> Graph.Primitive -> Compute.Flow t0 Graph.Primitive) adaptPrimitive constraints litmap prim0 = let ts0 = (Graph.primitiveType prim0)@@ -143,38 +192,46 @@ -- | Adapt a term using the given language constraints adaptTerm :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> Core.Term -> Compute.Flow Graph.Graph Core.Term) adaptTerm constraints litmap term0 = - let rewrite = (\recurse -> \term0 -> Flows.bind (recurse term0) (\term1 -> - let tryTerm = (\term -> - let supportedVariant = (Sets.member (Variants.termVariant term) (Coders.languageConstraintsTermVariants constraints))- in (Logic.ifElse supportedVariant ((\x -> case x of- Core.TermLiteral v1 -> - let lt = (Variants.literalType v1)- in (Flows.pure (Just (Logic.ifElse (literalTypeSupported constraints lt) term (Core.TermLiteral (adaptLiteralValue litmap lt v1)))))- _ -> (Flows.pure (Just term))) term) ( - let tryAlts = (\alts -> Logic.ifElse (Lists.null alts) (Flows.pure Nothing) (Flows.bind (tryTerm (Lists.head alts)) (\mterm -> Optionals.maybe (tryAlts (Lists.tail alts)) (\t -> Flows.pure (Just t)) mterm)))- in (Flows.bind (termAlternatives term1) (\alts -> tryAlts alts)))))- in (Flows.bind (tryTerm term1) (\mterm -> Optionals.maybe (Flows.fail (Strings.cat [- "no alternatives for term: ",- (Core_.term term1)])) (\term2 -> Flows.pure term2) mterm))))+ let rewrite = (\recurse -> \term0 -> + let forSupported = (\term -> (\x -> case x of+ Core.TermLiteral v1 -> + let lt = (Reflect.literalType v1)+ in (Flows.pure (Just (Logic.ifElse (literalTypeSupported constraints lt) term (Core.TermLiteral (adaptLiteralValue litmap lt v1)))))+ _ -> (Flows.pure (Just term))) term) + forUnsupported = (\term -> + let forNonNull = (\alts -> Flows.bind (tryTerm (Lists.head alts)) (\mterm -> Maybes.maybe (tryAlts (Lists.tail alts)) (\t -> Flows.pure (Just t)) mterm)) + tryAlts = (\alts -> Logic.ifElse (Lists.null alts) (Flows.pure Nothing) (forNonNull alts))+ in (Flows.bind (termAlternatives term) (\alts0 -> tryAlts alts0)))+ tryTerm = (\term -> + let supportedVariant = (Sets.member (Reflect.termVariant term) (Coders.languageConstraintsTermVariants constraints))+ in (Logic.ifElse supportedVariant (forSupported term) (forUnsupported term)))+ in (Flows.bind (recurse term0) (\term1 -> (\x -> case x of+ Core.TermTypeApplication v1 -> (Flows.bind (adaptType constraints litmap (Core.typeApplicationTermType v1)) (\atyp -> Flows.pure (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.typeApplicationTermBody v1),+ Core.typeApplicationTermType = atyp}))))+ Core.TermTypeLambda _ -> (Flows.pure term1)+ _ -> (Flows.bind (tryTerm term1) (\mterm -> Maybes.maybe (Flows.fail (Strings.cat2 "no alternatives for term: " (Core_.term term1))) (\term2 -> Flows.pure term2) mterm))) term1))) in (Rewriting.rewriteTermM rewrite term0) +-- | Adapt a type using the given language constraints adaptType :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> Core.Type -> Compute.Flow t0 Core.Type) adaptType constraints litmap type0 = - let rewrite = (\recurse -> \typ -> Flows.bind (recurse typ) (\type1 -> - let tryType = (\typ -> - let supportedVariant = (Sets.member (Variants.typeVariant typ) (Coders.languageConstraintsTypeVariants constraints))- in (Logic.ifElse supportedVariant ((\x -> case x of- Core.TypeLiteral v1 -> (Logic.ifElse (literalTypeSupported constraints v1) (Just typ) (Optionals.maybe (Just (Core.TypeLiteral Core.LiteralTypeString)) (\lt2 -> Just (Core.TypeLiteral lt2)) (Maps.lookup v1 litmap)))- _ -> (Just typ)) typ) ( - let tryAlts = (\alts -> Logic.ifElse (Lists.null alts) Nothing (Optionals.maybe (tryAlts (Lists.tail alts)) (\t -> Just t) (tryType (Lists.head alts))))- in - let alts = (typeAlternatives type1)- in (tryAlts alts))))- in (Optionals.maybe (Flows.fail (Strings.cat [- "no alternatives for type: ",- (Core_.type_ typ)])) (\type2 -> Flows.pure type2) (tryType type1))))- in (Rewriting.rewriteTypeM rewrite type0)+ let forSupported = (\typ -> (\x -> case x of+ Core.TypeLiteral v1 -> (Logic.ifElse (literalTypeSupported constraints v1) (Just typ) (Maybes.maybe (Just (Core.TypeLiteral Core.LiteralTypeString)) (\lt2 -> Just (Core.TypeLiteral lt2)) (Maps.lookup v1 litmap)))+ _ -> (Just typ)) typ) + forUnsupported = (\typ -> + let tryAlts = (\alts -> Logic.ifElse (Lists.null alts) Nothing (Maybes.maybe (tryAlts (Lists.tail alts)) (\t -> Just t) (tryType (Lists.head alts))))+ in + let alts0 = (typeAlternatives typ)+ in (tryAlts alts0))+ tryType = (\typ -> + let supportedVariant = (Sets.member (Reflect.typeVariant typ) (Coders.languageConstraintsTypeVariants constraints))+ in (Logic.ifElse supportedVariant (forSupported typ) (forUnsupported typ)))+ in + let rewrite = (\recurse -> \typ -> Flows.bind (recurse typ) (\type1 -> Maybes.maybe (Flows.fail (Strings.cat2 "no alternatives for type: " (Core_.type_ typ))) (\type2 -> Flows.pure type2) (tryType type1)))+ in (Rewriting.rewriteTypeM rewrite type0) +-- | Adapt a type scheme to the given language constraints, prior to inference adaptTypeScheme :: (Coders.LanguageConstraints -> M.Map Core.LiteralType Core.LiteralType -> Core.TypeScheme -> Compute.Flow t0 Core.TypeScheme) adaptTypeScheme constraints litmap ts0 = let vars0 = (Core.typeSchemeVariables ts0)@@ -182,46 +239,237 @@ let t0 = (Core.typeSchemeType ts0) in (Flows.bind (adaptType constraints litmap t0) (\t1 -> Flows.pure (Core.TypeScheme { Core.typeSchemeVariables = vars0,- Core.typeSchemeType = t1})))+ Core.typeSchemeType = t1,+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts0)}))) --- | Given a data graph along with language constraints and a designated list of element names, adapt the graph to the language constraints, perform inference, then return a corresponding term definition for each element name.-dataGraphToDefinitions :: (Coders.LanguageConstraints -> Bool -> Graph.Graph -> [[Core.Name]] -> Compute.Flow Graph.Graph (Graph.Graph, [[Module.TermDefinition]]))-dataGraphToDefinitions constraints doExpand graph nameLists = (Flows.bind (adaptDataGraph constraints doExpand graph) (\graph1 -> Flows.bind (Inference.inferGraphTypes graph1) (\graph2 -> - let toDef = (\el -> - let ts = (Optionals.fromJust (Core.bindingType el))- in Module.TermDefinition {- Module.termDefinitionName = (Core.bindingName el),- Module.termDefinitionTerm = (Core.bindingTerm el),- Module.termDefinitionType = (Schemas.typeSchemeToFType ts)})- in (Flows.pure (graph2, (Lists.map (\names -> Lists.map toDef (Lists.map (\n -> Optionals.fromJust (Maps.lookup n (Graph.graphElements graph2))) names)) nameLists))))))+-- | Given a data graph along with language constraints and a designated list of namespaces, adapt the graph to the language constraints, then return the processed graph along with term definitions grouped by namespace (in the order of the input namespaces). Inference is performed before adaptation if bindings lack type annotations. Hoisting must preserve type schemes; if any binding loses its type scheme after hoisting, the pipeline fails. Adaptation preserves type application/lambda wrappers and adapts embedded types. Post-adaptation inference is performed to ensure binding TypeSchemes are fully consistent. The doExpand flag controls eta expansion. The doHoistCaseStatements flag controls case statement hoisting (needed for Python). The doHoistPolymorphicLetBindings flag controls polymorphic let binding hoisting (needed for Java).+dataGraphToDefinitions :: (Coders.LanguageConstraints -> Bool -> Bool -> Bool -> Bool -> Graph.Graph -> [Module.Namespace] -> Compute.Flow Graph.Graph (Graph.Graph, [[Module.TermDefinition]]))+dataGraphToDefinitions constraints doInfer doExpand doHoistCaseStatements doHoistPolymorphicLetBindings graph0 namespaces = + let namespacesSet = (Sets.fromList namespaces)+ in + let isParentBinding = (\b -> Maybes.maybe False (\ns -> Sets.member ns namespacesSet) (Names.namespaceOf (Core.bindingName b)))+ in + let hoistCases = (\g -> + let graphDetyped = Graph.Graph {+ Graph.graphElements = (Lists.map (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Rewriting.stripTypeLambdas (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)}) (Graph.graphElements g)),+ Graph.graphEnvironment = (Graph.graphEnvironment g),+ Graph.graphTypes = (Graph.graphTypes g),+ Graph.graphBody = (Graph.graphBody g),+ Graph.graphPrimitives = (Graph.graphPrimitives g),+ Graph.graphSchema = (Graph.graphSchema g)}+ in + let gterm0 = (Schemas.graphAsTerm graphDetyped)+ in + let gterm1 = (Rewriting.unshadowVariables gterm0)+ in + let newElements = (Schemas.termAsGraph gterm1)+ in + let graphu0 = Graph.Graph {+ Graph.graphElements = newElements,+ Graph.graphEnvironment = (Graph.graphEnvironment graphDetyped),+ Graph.graphTypes = (Graph.graphTypes graphDetyped),+ Graph.graphBody = (Graph.graphBody graphDetyped),+ Graph.graphPrimitives = (Graph.graphPrimitives graphDetyped),+ Graph.graphSchema = (Graph.graphSchema graphDetyped)}+ in (Flows.bind (Hoisting.hoistCaseStatementsInGraph graphu0) (\graphh1 -> + let gterm2 = (Schemas.graphAsTerm graphh1)+ in + let gterm3 = (Rewriting.unshadowVariables gterm2)+ in + let newElements2 = (Schemas.termAsGraph gterm3)+ in (Flows.pure (Graph.Graph {+ Graph.graphElements = newElements2,+ Graph.graphEnvironment = (Graph.graphEnvironment graphh1),+ Graph.graphTypes = (Graph.graphTypes graphh1),+ Graph.graphBody = (Graph.graphBody graphh1),+ Graph.graphPrimitives = (Graph.graphPrimitives graphh1),+ Graph.graphSchema = (Graph.graphSchema graphh1)})))))+ in + let hoistPoly = (\graphBefore -> + let letBefore = (Schemas.graphAsLet graphBefore)+ in + let letAfter = (Hoisting.hoistPolymorphicLetBindings isParentBinding letBefore)+ in Graph.Graph {+ Graph.graphElements = (Core.letBindings letAfter),+ Graph.graphEnvironment = (Graph.graphEnvironment graphBefore),+ Graph.graphTypes = (Graph.graphTypes graphBefore),+ Graph.graphBody = (Graph.graphBody graphBefore),+ Graph.graphPrimitives = (Graph.graphPrimitives graphBefore),+ Graph.graphSchema = (Graph.graphSchema graphBefore)})+ in + let checkTyped = (\debugLabel -> \g -> + let untypedBindings = (Lists.map (\b -> Core.unName (Core.bindingName b)) (Lists.filter (\b -> Logic.not (Maybes.isJust (Core.bindingType b))) (Graph.graphElements g)))+ in (Logic.ifElse (Lists.null untypedBindings) (Flows.pure g) (Flows.fail (Strings.cat [+ "Found untyped bindings (",+ debugLabel,+ "): ",+ (Strings.intercalate ", " untypedBindings)]))))+ in + let normalizeGraph = (\g -> Graph.Graph {+ Graph.graphElements = (Lists.map (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (pushTypeAppsInward (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)}) (Graph.graphElements g)),+ Graph.graphEnvironment = (Graph.graphEnvironment g),+ Graph.graphTypes = (Graph.graphTypes g),+ Graph.graphBody = (Graph.graphBody g),+ Graph.graphPrimitives = (Graph.graphPrimitives g),+ Graph.graphSchema = (Graph.graphSchema g)})+ in (Flows.bind (Logic.ifElse doHoistCaseStatements (hoistCases graph0) (Flows.pure graph0)) (\graph1 -> Flows.bind (Logic.ifElse doInfer (Inference.inferGraphTypes graph1) (checkTyped "after case hoisting" graph1)) (\graph2 -> Flows.bind (Logic.ifElse doHoistPolymorphicLetBindings (checkTyped "after let hoisting" (hoistPoly graph2)) (Flows.pure graph2)) (\graph3 -> Flows.bind (Flows.bind (adaptDataGraph constraints doExpand graph3) (checkTyped "after adaptation")) (\graph4 -> + let graph5 = (normalizeGraph graph4)+ in + let toDef = (\el -> Maybes.map (\ts -> Module.TermDefinition {+ Module.termDefinitionName = (Core.bindingName el),+ Module.termDefinitionTerm = (Core.bindingTerm el),+ Module.termDefinitionType = ts}) (Core.bindingType el))+ in + let selectedElements = (Lists.filter (\el -> Maybes.maybe False (\ns -> Sets.member ns namespacesSet) (Names.namespaceOf (Core.bindingName el))) (Graph.graphElements graph5))+ in + let elementsByNamespace = (Lists.foldl (\acc -> \el -> Maybes.maybe acc (\ns -> + let existing = (Maybes.maybe [] Equality.identity (Maps.lookup ns acc))+ in (Maps.insert ns (Lists.concat2 existing [+ el]) acc)) (Names.namespaceOf (Core.bindingName el))) Maps.empty selectedElements)+ in + let defsGrouped = (Lists.map (\ns -> + let elsForNs = (Maybes.maybe [] Equality.identity (Maps.lookup ns elementsByNamespace))+ in (Maybes.cat (Lists.map toDef elsForNs))) namespaces)+ in (Flows.pure (graph5, defsGrouped))))))) -- | Check if a literal type is supported by the given language constraints literalTypeSupported :: (Coders.LanguageConstraints -> Core.LiteralType -> Bool)-literalTypeSupported constraints lt = (Logic.ifElse (Sets.member (Variants.literalTypeVariant lt) (Coders.languageConstraintsLiteralVariants constraints)) ((\x -> case x of- Core.LiteralTypeFloat v1 -> (Sets.member v1 (Coders.languageConstraintsFloatTypes constraints))- Core.LiteralTypeInteger v1 -> (Sets.member v1 (Coders.languageConstraintsIntegerTypes constraints))- _ -> True) lt) False)+literalTypeSupported constraints lt = + let forType = (\lt -> (\x -> case x of+ Core.LiteralTypeFloat v1 -> (Sets.member v1 (Coders.languageConstraintsFloatTypes constraints))+ Core.LiteralTypeInteger v1 -> (Sets.member v1 (Coders.languageConstraintsIntegerTypes constraints))+ _ -> True) lt)+ in (Logic.ifElse (Sets.member (Reflect.literalTypeVariant lt) (Coders.languageConstraintsLiteralVariants constraints)) (forType lt) False) +-- | Normalize a term by pushing TermTypeApplication inward past TermApplication and TermFunction (Lambda). This corrects structures produced by poly-let hoisting and eta expansion, where type applications from inference end up wrapping term applications or lambda abstractions instead of being directly on the polymorphic variable.+pushTypeAppsInward :: (Core.Term -> Core.Term)+pushTypeAppsInward term = + let push = (\body -> \typ -> (\x -> case x of+ Core.TermApplication v1 -> (go (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.applicationFunction v1),+ Core.typeApplicationTermType = typ})),+ Core.applicationArgument = (Core.applicationArgument v1)})))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (go (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = (Core.lambdaDomain v2),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.lambdaBody v2),+ Core.typeApplicationTermType = typ}))}))))+ _ -> (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction v1),+ Core.typeApplicationTermType = typ}))) v1)+ Core.TermLet v1 -> (go (Core.TermLet (Core.Let {+ Core.letBindings = (Core.letBindings v1),+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.letBody v1),+ Core.typeApplicationTermType = typ}))})))+ _ -> (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = body,+ Core.typeApplicationTermType = typ}))) body) + go = (\t -> + let forField = (\fld -> Core.Field {+ Core.fieldName = (Core.fieldName fld),+ Core.fieldTerm = (go (Core.fieldTerm fld))})+ in + let forElimination = (\elm -> (\x -> case x of+ Core.EliminationRecord v1 -> (Core.EliminationRecord v1)+ Core.EliminationUnion v1 -> (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map go (Core.caseStatementDefault v1)),+ Core.caseStatementCases = (Lists.map forField (Core.caseStatementCases v1))}))+ Core.EliminationWrap v1 -> (Core.EliminationWrap v1)) elm)+ in + let forFunction = (\fun -> (\x -> case x of+ Core.FunctionElimination v1 -> (Core.FunctionElimination (forElimination v1))+ Core.FunctionLambda v1 -> (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (go (Core.lambdaBody v1))}))+ Core.FunctionPrimitive v1 -> (Core.FunctionPrimitive v1)) fun)+ in + let forLet = (\lt -> + let mapBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (go (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in Core.Let {+ Core.letBindings = (Lists.map mapBinding (Core.letBindings lt)),+ Core.letBody = (go (Core.letBody lt))})+ in + let forMap = (\m -> + let forPair = (\p -> (go (Pairs.first p), (go (Pairs.second p))))+ in (Maps.fromList (Lists.map forPair (Maps.toList m))))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (go (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))+ Core.TermApplication v1 -> (Core.TermApplication (Core.Application {+ Core.applicationFunction = (go (Core.applicationFunction v1)),+ Core.applicationArgument = (go (Core.applicationArgument v1))}))+ Core.TermEither v1 -> (Core.TermEither (Eithers.either (\l -> Left (go l)) (\r -> Right (go r)) v1))+ Core.TermFunction v1 -> (Core.TermFunction (forFunction v1))+ Core.TermLet v1 -> (Core.TermLet (forLet v1))+ Core.TermList v1 -> (Core.TermList (Lists.map go v1))+ Core.TermLiteral v1 -> (Core.TermLiteral v1)+ Core.TermMap v1 -> (Core.TermMap (forMap v1))+ Core.TermMaybe v1 -> (Core.TermMaybe (Maybes.map go v1))+ Core.TermPair v1 -> (Core.TermPair (go (Pairs.first v1), (go (Pairs.second v1))))+ Core.TermRecord v1 -> (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = (Lists.map forField (Core.recordFields v1))}))+ Core.TermSet v1 -> (Core.TermSet (Sets.fromList (Lists.map go (Sets.toList v1))))+ Core.TermTypeApplication v1 -> + let body1 = (go (Core.typeApplicationTermBody v1))+ in (push body1 (Core.typeApplicationTermType v1))+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (go (Core.typeLambdaBody v1))}))+ Core.TermUnion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = (forField (Core.injectionField v1))}))+ Core.TermUnit -> Core.TermUnit+ Core.TermVariable v1 -> (Core.TermVariable v1)+ Core.TermWrap v1 -> (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = (go (Core.wrappedTermBody v1))}))) t))+ in (go term)+ -- | Given a schema graph along with language constraints and a designated list of element names, adapt the graph to the language constraints, then return a corresponding type definition for each element name. schemaGraphToDefinitions :: (Coders.LanguageConstraints -> Graph.Graph -> [[Core.Name]] -> Compute.Flow Graph.Graph (M.Map Core.Name Core.Type, [[Module.TypeDefinition]])) schemaGraphToDefinitions constraints graph nameLists = let litmap = (adaptLiteralTypesMap constraints) in (Flows.bind (Schemas.graphAsTypes graph) (\tmap0 -> Flows.bind (adaptGraphSchema constraints litmap tmap0) (\tmap1 -> let toDef = (\pair -> Module.TypeDefinition {- Module.typeDefinitionName = (fst pair),- Module.typeDefinitionType = (snd pair)})- in (Flows.pure (tmap1, (Lists.map (\names -> Lists.map toDef (Lists.map (\n -> (n, (Optionals.fromJust (Maps.lookup n tmap1)))) names)) nameLists))))))+ Module.typeDefinitionName = (Pairs.first pair),+ Module.typeDefinitionType = (Pairs.second pair)})+ in (Flows.pure (tmap1, (Lists.map (\names -> Lists.map toDef (Lists.map (\n -> (n, (Maybes.fromJust (Maps.lookup n tmap1)))) names)) nameLists)))))) -- | Find a list of alternatives for a given term, if any termAlternatives :: (Core.Term -> Compute.Flow Graph.Graph [Core.Term]) termAlternatives term = ((\x -> case x of Core.TermAnnotated v1 -> - let term2 = (Core.annotatedTermSubject v1)+ let term2 = (Core.annotatedTermBody v1) in (Flows.pure [ term2])- Core.TermOptional v1 -> (Flows.pure [- Core.TermList (Optionals.maybe [] (\term2 -> [+ Core.TermMaybe v1 -> (Flows.pure [+ Core.TermList (Maybes.maybe [] (\term2 -> [ term2]) v1)])+ Core.TermTypeLambda v1 -> + let term2 = (Core.typeLambdaBody v1)+ in (Flows.pure [+ term2])+ Core.TermTypeApplication v1 -> + let term2 = (Core.typeApplicationTermBody v1)+ in (Flows.pure [+ term2]) Core.TermUnion v1 -> let tname = (Core.injectionTypeName v1) in @@ -230,22 +478,20 @@ let fname = (Core.fieldName field) in let fterm = (Core.fieldTerm field)- in (Flows.bind (Schemas.requireUnionType tname) (\rt -> Flows.pure [- - let forFieldType = (\ft -> - let ftname = (Core.fieldTypeName ft)- in Core.Field {- Core.fieldName = fname,- Core.fieldTerm = (Core.TermOptional (Logic.ifElse (Equality.equal ftname fname) (Just fterm) Nothing))})- in - let fields = (Lists.map forFieldType (Core.rowTypeFields rt))- in (Core.TermRecord (Core.Record {- Core.recordTypeName = tname,- Core.recordFields = fields}))]))+ in + let forFieldType = (\ft -> + let ftname = (Core.fieldTypeName ft)+ in Core.Field {+ Core.fieldName = fname,+ Core.fieldTerm = (Core.TermMaybe (Logic.ifElse (Equality.equal ftname fname) (Just fterm) Nothing))})+ in (Flows.bind (Schemas.requireUnionType tname) (\rt -> Flows.pure [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = tname,+ Core.recordFields = (Lists.map forFieldType (Core.rowTypeFields rt))})])) Core.TermUnit -> (Flows.pure [ Core.TermLiteral (Core.LiteralBoolean True)]) Core.TermWrap v1 -> - let term2 = (Core.wrappedTermObject v1)+ let term2 = (Core.wrappedTermBody v1) in (Flows.pure [ term2]) _ -> (Flows.pure [])) term)@@ -254,19 +500,25 @@ typeAlternatives :: (Core.Type -> [Core.Type]) typeAlternatives type_ = ((\x -> case x of Core.TypeAnnotated v1 -> - let type2 = (Core.annotatedTypeSubject v1)+ let type2 = (Core.annotatedTypeBody v1) in [ type2]- Core.TypeOptional v1 -> [+ Core.TypeMaybe v1 -> [ Core.TypeList v1] Core.TypeUnion v1 -> let tname = (Core.rowTypeTypeName v1) in let fields = (Core.rowTypeFields v1)- in [- Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = tname,- Core.rowTypeFields = fields})]+ in + let toOptField = (\f -> Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName f),+ Core.fieldTypeType = (Core.TypeMaybe (Core.fieldTypeType f))})+ in + let optFields = (Lists.map toOptField fields)+ in [+ Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = tname,+ Core.rowTypeFields = optFields})] Core.TypeUnit -> [ Core.TypeLiteral Core.LiteralTypeBoolean] _ -> []) type_)
src/gen-main/haskell/Hydra/Adapt/Terms.hs view
@@ -1,639 +1,753 @@--- | Adapter framework for types and terms--module Hydra.Adapt.Terms where--import qualified Hydra.Adapt.Literals as Literals-import qualified Hydra.Adapt.Utils as Utils-import qualified Hydra.Coders as Coders-import qualified Hydra.Compute as Compute-import qualified Hydra.Core as Core-import qualified Hydra.Describe.Core as Core_-import qualified Hydra.Extract.Core as Core__-import qualified Hydra.Graph as Graph-import qualified Hydra.Lib.Equality as Equality-import qualified Hydra.Lib.Flows as Flows-import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals-import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import qualified Hydra.Monads as Monads-import qualified Hydra.Rewriting as Rewriting-import qualified Hydra.Schemas as Schemas-import qualified Hydra.Show.Core as Core___-import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Create an adapter for field types-fieldAdapter :: (Core.FieldType -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.FieldType Core.FieldType Core.Field Core.Field))-fieldAdapter ftyp = (Flows.bind (termAdapter (Core.fieldTypeType ftyp)) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = ftyp,- Compute.adapterTarget = Core.FieldType {- Core.fieldTypeName = (Core.fieldTypeName ftyp),- Core.fieldTypeType = (Compute.adapterTarget ad)},- Compute.adapterCoder = (Utils.bidirectional (\dir -> \field -> - let name = (Core.fieldName field) - term = (Core.fieldTerm field)- in (Flows.map (\newTerm -> Core.Field {- Core.fieldName = name,- Core.fieldTerm = newTerm}) (Utils.encodeDecode dir (Compute.adapterCoder ad) term))))})))---- | This function accounts for recursive type definitions-forTypeReference :: (Core.Name -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-forTypeReference name = (Monads.withTrace (Strings.cat2 "adapt named type " (Core.unName name)) ( - let lossy = False - placeholder = Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = (Core.TypeVariable name),- Compute.adapterTarget = (Core.TypeVariable name),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Flows.bind Monads.getState (\cx -> - let adapters = (Coders.adapterContextAdapters cx)- in (Optionals.maybe (Flows.fail (Strings.cat2 "no adapter for reference type " (Core.unName name))) (\ad -> Utils.encodeDecode dir (Compute.adapterCoder ad) term) (Maps.lookup name adapters)))))}- in (Flows.bind Monads.getState (\cx -> - let adapters = (Coders.adapterContextAdapters cx)- in (Optionals.maybe ( - let newAdapters = (Maps.insert name placeholder adapters) - newCx = Coders.AdapterContext {- Coders.adapterContextGraph = (Coders.adapterContextGraph cx),- Coders.adapterContextLanguage = (Coders.adapterContextLanguage cx),- Coders.adapterContextAdapters = newAdapters}- in (Flows.bind (Monads.putState newCx) (\_ -> Flows.bind (withGraphContext (Schemas.resolveType (Core.TypeVariable name))) (\mt -> Optionals.maybe (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = (Core.TypeVariable name),- Compute.adapterTarget = (Core.TypeVariable name),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Flows.pure term))})) (\t -> Flows.bind (termAdapter t) (\actual -> - let finalAdapters = (Maps.insert name actual adapters) - finalCx = Coders.AdapterContext {- Coders.adapterContextGraph = (Coders.adapterContextGraph cx),- Coders.adapterContextLanguage = (Coders.adapterContextLanguage cx),- Coders.adapterContextAdapters = finalAdapters}- in (Flows.bind (Monads.putState finalCx) (\_ -> Flows.pure actual)))) mt)))) Flows.pure (Maps.lookup name adapters))))))--functionProxyName :: Core.Name-functionProxyName = (Core.Name "hydra.core.FunctionProxy")--functionProxyType :: (t0 -> Core.Type)-functionProxyType _ = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = functionProxyName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "wrap"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "record"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "union"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "lambda"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "primitive"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "variable"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))---- | Convert function types to union types-functionToUnion :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-functionToUnion t = ((\x -> case x of- Core.TypeFunction v1 -> - let dom = (Core.functionTypeDomain v1) - cod = (Core.functionTypeCodomain v1)- unionType = (Flows.bind (termAdapter dom) (\domAd -> Flows.pure (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = functionProxyName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "wrap"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "record"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "union"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "lambda"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "primitive"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "variable"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))))- encode = (\ad -> \term -> - let strippedTerm = (Rewriting.deannotateTerm term)- in (Compute.coderEncode (Compute.adapterCoder ad) ((\x -> case x of- Core.TermFunction v2 -> ((\x -> case x of- Core.FunctionElimination v3 -> ((\x -> case x of- Core.EliminationWrap v4 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "wrap"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v4)))}}))- Core.EliminationRecord _ -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "record"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core___.term term)))}}))- Core.EliminationUnion _ -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "union"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core___.term term)))}}))) v3)- Core.FunctionLambda _ -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "lambda"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core___.term term)))}}))- Core.FunctionPrimitive v3 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "primitive"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v3)))}}))) v2)- Core.TermVariable v2 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = functionProxyName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "variable"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v2)))}}))) strippedTerm)))- decode = (\ad -> \term -> - let readFromString = (\term -> Flows.bind (Core__.string term) (\s -> Optionals.maybe (Flows.fail (Strings.cat2 "failed to parse term: " s)) Flows.pure (Core___.readTerm s))) - notFound = (\fname -> Flows.fail (Strings.cat2 "unexpected field: " (Core.unName fname)))- forCases = (\fterm -> withGraphContext (readFromString fterm))- forLambda = (\fterm -> withGraphContext (readFromString fterm))- forWrapped = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name s)))) (Core__.string fterm)))- forPrimitive = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermFunction (Core.FunctionPrimitive (Core.Name s))) (Core__.string fterm)))- forProjection = (\fterm -> withGraphContext (readFromString fterm))- forVariable = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermVariable (Core.Name s)) (Core__.string fterm)))- in (Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\injTerm -> Flows.bind (withGraphContext (Core__.injection functionProxyName injTerm)) (\field -> - let fname = (Core.fieldName field) - fterm = (Core.fieldTerm field)- in (Optionals.fromMaybe (notFound fname) (Maps.lookup fname (Maps.fromList [- (Core.Name "wrap", (forWrapped fterm)),- (Core.Name "record", (forProjection fterm)),- (Core.Name "union", (forCases fterm)),- (Core.Name "lambda", (forLambda fterm)),- (Core.Name "primitive", (forPrimitive fterm)),- (Core.Name "variable", (forVariable fterm))])))))))- in (Flows.bind unionType (\ut -> Flows.bind (termAdapter ut) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (encode ad),- Compute.coderDecode = (decode ad)}}))))) t)---- | Convert forall types to monotypes-lambdaToMonotype :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-lambdaToMonotype t = ((\x -> case x of- Core.TypeForall v1 -> - let body = (Core.forallTypeBody v1)- in (Flows.bind (termAdapter body) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = (Compute.adapterCoder ad)})))) t)---- | Convert optional types to list types-optionalToList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-optionalToList t = ((\x -> case x of- Core.TypeOptional v1 -> (Flows.bind (termAdapter v1) (\ad -> - let encode = (\term -> (\x -> case x of- Core.TermOptional v2 -> (Optionals.maybe (Flows.pure (Core.TermList [])) (\r -> Flows.bind (Compute.coderEncode (Compute.adapterCoder ad) r) (\encoded -> Flows.pure (Core.TermList [- encoded]))) v2)) term) - decode = (\term -> (\x -> case x of- Core.TermList v2 -> (Flows.map (\x -> Core.TermOptional x) (Logic.ifElse (Lists.null v2) (Flows.pure Nothing) (Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) (Lists.head v2)) (\decoded -> Flows.pure (Just decoded)))))) term)- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeList (Compute.adapterTarget ad)),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = encode,- Compute.coderDecode = decode}}))))) t)---- | Pass through application types-passApplication :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passApplication t = ((\x -> case x of- Core.TypeApplication v1 -> - let lhs = (Core.applicationTypeFunction v1) - rhs = (Core.applicationTypeArgument v1)- in (Flows.bind (termAdapter lhs) (\lhsAd -> Flows.bind (termAdapter rhs) (\rhsAd -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Logic.or (Compute.adapterIsLossy lhsAd) (Compute.adapterIsLossy rhsAd)),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Compute.adapterTarget lhsAd),- Core.applicationTypeArgument = (Compute.adapterTarget rhsAd)})),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder lhsAd) term))}))))) t)---- | Pass through function types with adaptation-passFunction :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passFunction t = ((\x -> case x of- Core.TypeFunction v1 -> - let dom = (Core.functionTypeDomain v1) - cod = (Core.functionTypeCodomain v1)- in (Flows.bind (termAdapter dom) (\domAd -> Flows.bind (termAdapter cod) (\codAd -> Flows.bind ((\x -> case x of- Core.TypeUnion v2 -> (Flows.bind (Flows.mapList (\f -> Flows.bind (fieldAdapter (Core.FieldType {- Core.fieldTypeName = (Core.fieldTypeName f),- Core.fieldTypeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.fieldTypeType f),- Core.functionTypeCodomain = cod}))})) (\ad -> Flows.pure (Core.fieldTypeName f, ad))) (Core.rowTypeFields v2)) (\pairs -> Flows.pure (Maps.fromList pairs)))- _ -> (Flows.pure Maps.empty)) (Rewriting.deannotateType dom)) (\caseAds -> Flows.bind ((\x -> case x of- Core.TypeOptional v2 -> (Flows.map Optionals.pure (termAdapter (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = v2,- Core.functionTypeCodomain = cod}))))- _ -> (Flows.pure Nothing)) (Rewriting.deannotateType dom)) (\optionAd -> - let lossy = (Logic.or (Compute.adapterIsLossy codAd) (Lists.foldl Logic.or False (Lists.map (\pair -> Compute.adapterIsLossy (snd pair)) (Maps.toList caseAds)))) - target = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Compute.adapterTarget domAd),- Core.functionTypeCodomain = (Compute.adapterTarget codAd)}))- getCoder = (\fname -> Optionals.maybe Utils.idCoder Compute.adapterCoder (Maps.lookup fname caseAds))- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = t,- Compute.adapterTarget = target,- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermFunction v2 -> (Flows.map (\x -> Core.TermFunction x) ((\x -> case x of- Core.FunctionElimination v3 -> (Flows.map (\x -> Core.FunctionElimination x) ((\x -> case x of- Core.EliminationUnion v4 -> - let n = (Core.caseStatementTypeName v4) - def = (Core.caseStatementDefault v4)- cases = (Core.caseStatementCases v4)- in (Flows.bind (Flows.mapList (\f -> Utils.encodeDecode dir (getCoder (Core.fieldName f)) f) cases) (\rcases -> Flows.bind (Optionals.maybe (Flows.pure Nothing) (\d -> Flows.map Optionals.pure (Utils.encodeDecode dir (Compute.adapterCoder codAd) d)) def) (\rdef -> Flows.pure (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = n,- Core.caseStatementDefault = rdef,- Core.caseStatementCases = rcases})))))) v3))- Core.FunctionLambda v3 -> - let var = (Core.lambdaParameter v3) - d = (Core.lambdaDomain v3)- body = (Core.lambdaBody v3)- in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder codAd) body) (\newBody -> Flows.pure (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = var,- Core.lambdaDomain = d,- Core.lambdaBody = newBody}))))- Core.FunctionPrimitive v3 -> (Flows.pure (Core.FunctionPrimitive v3))) v2))- _ -> (Flows.pure term)) (Rewriting.deannotateTerm term)))})))))))) t)---- | Pass through forall types-passForall :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passForall t = ((\x -> case x of- Core.TypeForall v1 -> - let v = (Core.forallTypeParameter v1) - body = (Core.forallTypeBody v1)- in (Flows.bind (termAdapter body) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = v,- Core.forallTypeBody = (Compute.adapterTarget ad)})),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder ad) term))})))) t)---- | Pass through literal types with literal adaptation-passLiteral :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passLiteral t = ((\x -> case x of- Core.TypeLiteral v1 -> (Flows.bind (Literals.literalAdapter v1) (\ad -> - let step = (Utils.bidirectional (\dir -> \term -> Flows.bind (withGraphContext (Core__.literal term)) (\l -> Flows.map (\x -> Core.TermLiteral x) (Utils.encodeDecode dir (Compute.adapterCoder ad) l))))- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = (Core.TypeLiteral (Compute.adapterSource ad)),- Compute.adapterTarget = (Core.TypeLiteral (Compute.adapterTarget ad)),- Compute.adapterCoder = step}))))) t)---- | Pass through list types-passList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passList t = ((\x -> case x of- Core.TypeList v1 -> (Flows.bind (termAdapter v1) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeList (Compute.adapterTarget ad)),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermList v2 -> (Flows.bind (Flows.mapList (Utils.encodeDecode dir (Compute.adapterCoder ad)) v2) (\newTerms -> Flows.pure (Core.TermList newTerms)))) term))})))) t)---- | Pass through map types-passMap :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passMap t = ((\x -> case x of- Core.TypeMap v1 -> - let kt = (Core.mapTypeKeys v1) - vt = (Core.mapTypeValues v1)- in (Flows.bind (termAdapter kt) (\kad -> Flows.bind (termAdapter vt) (\vad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Logic.or (Compute.adapterIsLossy kad) (Compute.adapterIsLossy vad)),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Compute.adapterTarget kad),- Core.mapTypeValues = (Compute.adapterTarget vad)})),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermMap v2 -> (Flows.bind (Flows.mapList (\pair -> - let k = (fst pair) - v = (snd pair)- in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder kad) k) (\newK -> Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder vad) v) (\newV -> Flows.pure (newK, newV))))) (Maps.toList v2)) (\newPairs -> Flows.pure (Core.TermMap (Maps.fromList newPairs))))) term))}))))) t)---- | Pass through optional types-passOptional :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passOptional t = ((\x -> case x of- Core.TypeOptional v1 -> - let mapTerm = (\coder -> \dir -> \term -> Flows.bind (withGraphContext (Core__.optional Flows.pure term)) (\opt -> Flows.bind (Flows.mapOptional (Utils.encodeDecode dir coder) opt) (\newOpt -> Flows.pure (Core.TermOptional newOpt))))- in (Flows.bind (termAdapter v1) (\adapter -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeOptional (Compute.adapterTarget adapter)),- Compute.adapterCoder = (Utils.bidirectional (mapTerm (Compute.adapterCoder adapter)))})))) t)---- | Pass through product types-passProduct :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passProduct t = ((\x -> case x of- Core.TypeProduct v1 -> (Flows.bind (Flows.mapList termAdapter v1) (\ads -> - let lossy = (Lists.foldl Logic.or False (Lists.map Compute.adapterIsLossy ads))- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeProduct (Lists.map Compute.adapterTarget ads)),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermProduct v2 -> (Flows.bind (Flows.sequence (Lists.zipWith (\term -> \ad -> Utils.encodeDecode dir (Compute.adapterCoder ad) term) v2 ads)) (\newTuple -> Flows.pure (Core.TermProduct newTuple)))) term))}))))) t)---- | Pass through record types-passRecord :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passRecord t = ((\x -> case x of- Core.TypeRecord v1 -> (Flows.bind (Flows.mapList fieldAdapter (Core.rowTypeFields v1)) (\adapters -> - let lossy = (Lists.foldl Logic.or False (Lists.map Compute.adapterIsLossy adapters)) - sfields_ = (Lists.map Compute.adapterTarget adapters)- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = (Core.rowTypeTypeName v1),- Core.rowTypeFields = sfields_})),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermRecord v2 -> - let dfields = (Core.recordFields v2)- in (Flows.bind (Flows.sequence (Lists.zipWith (\ad -> \f -> Utils.encodeDecode dir (Compute.adapterCoder ad) f) adapters dfields)) (\newFields -> Flows.pure (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.rowTypeTypeName v1),- Core.recordFields = newFields}))))) term))}))))) t)---- | Pass through set types-passSet :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passSet t = ((\x -> case x of- Core.TypeSet v1 -> (Flows.bind (termAdapter v1) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeSet (Compute.adapterTarget ad)),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermSet v2 -> (Flows.bind (Flows.mapList (Utils.encodeDecode dir (Compute.adapterCoder ad)) (Sets.toList v2)) (\newTerms -> Flows.pure (Core.TermSet (Sets.fromList newTerms))))) term))})))) t)---- | Pass through sum types-passSum :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passSum t = ((\x -> case x of- Core.TypeSum v1 -> (Flows.bind (Flows.mapList termAdapter v1) (\ads -> - let lossy = (Lists.foldl Logic.or False (Lists.map Compute.adapterIsLossy ads))- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeSum (Lists.map Compute.adapterTarget ads)),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> (\x -> case x of- Core.TermSum v2 -> - let i = (Core.sumIndex v2) - n = (Core.sumSize v2)- term = (Core.sumTerm v2)- in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder (Lists.at i ads)) term) (\newTerm -> Flows.pure (Core.TermSum (Core.Sum {- Core.sumIndex = i,- Core.sumSize = n,- Core.sumTerm = newTerm}))))) term))}))))) t)---- | Pass through union types-passUnion :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passUnion t = ((\x -> case x of- Core.TypeUnion v1 -> - let sfields = (Core.rowTypeFields v1) - tname = (Core.rowTypeTypeName v1)- getAdapter = (\adaptersMap -> \f -> Optionals.maybe (Flows.fail (Strings.cat2 "no such field: " (Core.unName (Core.fieldName f)))) Flows.pure (Maps.lookup (Core.fieldName f) adaptersMap))- in (Flows.bind (Flows.mapList (\f -> Flows.bind (fieldAdapter f) (\ad -> Flows.pure (Core.fieldTypeName f, ad))) sfields) (\adapters -> - let adaptersMap = (Maps.fromList adapters) - lossy = (Lists.foldl Logic.or False (Lists.map (\pair -> Compute.adapterIsLossy (snd pair)) adapters))- sfields_ = (Lists.map (\pair -> Compute.adapterTarget (snd pair)) adapters)- in (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = lossy,- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = tname,- Core.rowTypeFields = sfields_})),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Flows.pure term))}))))) t)--passUnit :: (t0 -> Compute.Flow t1 (Compute.Adapter t2 t3 Core.Type Core.Type Core.Term Core.Term))-passUnit _ = (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = Core.TypeUnit,- Compute.adapterTarget = Core.TypeUnit,- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (\_ -> Flows.pure Core.TermUnit),- Compute.coderDecode = (\_ -> Flows.pure Core.TermUnit)}}))---- | Pass through wrapped types-passWrapped :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-passWrapped t = ((\x -> case x of- Core.TypeWrap v1 -> - let tname = (Core.wrappedTypeTypeName v1) - ot = (Core.wrappedTypeObject v1)- mapTerm = (\coder -> \dir -> \term -> Flows.bind (withGraphContext (Core__.wrap tname term)) (\unwrapped -> Flows.bind (Utils.encodeDecode dir coder unwrapped) (\newTerm -> Flows.pure (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = tname,- Core.wrappedTermObject = newTerm})))))- in (Flows.bind (termAdapter ot) (\adapter -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),- Compute.adapterSource = t,- Compute.adapterTarget = (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = tname,- Core.wrappedTypeObject = (Compute.adapterTarget adapter)})),- Compute.adapterCoder = (Utils.bidirectional (mapTerm (Compute.adapterCoder adapter)))})))) t)---- | Convert set types to list types-setToList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-setToList t = ((\x -> case x of- Core.TypeSet v1 -> - let encode = (\ad -> \term -> (\x -> case x of- Core.TermSet v2 -> (Compute.coderEncode (Compute.adapterCoder ad) (Core.TermList (Sets.toList v2)))) term) - decode = (\ad -> \term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\listTerm -> (\x -> case x of- Core.TermList v2 -> (Flows.pure (Core.TermSet (Sets.fromList v2)))) listTerm))- in (Flows.bind (termAdapter (Core.TypeList v1)) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (encode ad),- Compute.coderDecode = (decode ad)}})))) t)---- | Simplify application types-simplifyApplication :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-simplifyApplication t = ((\x -> case x of- Core.TypeApplication v1 -> - let lhs = (Core.applicationTypeFunction v1)- in (Flows.bind (termAdapter lhs) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder ad) term))})))) t)---- | Create an adapter for any type-termAdapter :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-termAdapter typ = - let constraints = (\cx -> Coders.languageConstraints (Coders.adapterContextLanguage cx)) - supported = (\cx -> Utils.typeIsSupported (constraints cx))- variantIsSupported = (\cx -> \t -> Sets.member (Variants.typeVariant t) (Coders.languageConstraintsTypeVariants (constraints cx)))- supportedAtTopLevel = (\cx -> \t -> Logic.and (variantIsSupported cx t) (Coders.languageConstraintsTypes (constraints cx) t))- pass = (\t -> (\x -> case x of- Mantle.TypeVariantApplication -> [- passApplication]- Mantle.TypeVariantForall -> [- passForall]- Mantle.TypeVariantFunction -> [- passFunction]- Mantle.TypeVariantList -> [- passList]- Mantle.TypeVariantLiteral -> [- passLiteral]- Mantle.TypeVariantMap -> [- passMap]- Mantle.TypeVariantOptional -> [- passOptional,- optionalToList]- Mantle.TypeVariantProduct -> [- passProduct]- Mantle.TypeVariantRecord -> [- passRecord]- Mantle.TypeVariantSet -> [- passSet]- Mantle.TypeVariantSum -> [- passSum]- Mantle.TypeVariantUnion -> [- passUnion]- Mantle.TypeVariantUnit -> [- passUnit]- Mantle.TypeVariantWrap -> [- passWrapped]) (Variants.typeVariant (Rewriting.deannotateType t)))- trySubstitution = (\t -> (\x -> case x of- Mantle.TypeVariantApplication -> [- simplifyApplication]- Mantle.TypeVariantFunction -> [- functionToUnion]- Mantle.TypeVariantForall -> [- lambdaToMonotype]- Mantle.TypeVariantOptional -> [- optionalToList]- Mantle.TypeVariantSet -> [- setToList]- Mantle.TypeVariantUnion -> [- unionToRecord]- Mantle.TypeVariantUnit -> [- unitToRecord]- Mantle.TypeVariantWrap -> [- wrapToUnwrapped]) (Variants.typeVariant t))- alts = (\cx -> \t -> Flows.mapList (\c -> c t) (Logic.ifElse (supportedAtTopLevel cx t) (pass t) (trySubstitution t)))- in ((\x -> case x of- Core.TypeAnnotated v1 -> (Flows.bind (termAdapter (Core.annotatedTypeSubject v1)) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = (Compute.adapterSource ad),- Compute.adapterTarget = (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = (Compute.adapterTarget ad),- Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)})),- Compute.adapterCoder = (Compute.adapterCoder ad)})))- _ -> (Monads.withTrace (Strings.cat2 "adapter for " (Core_.type_ typ)) ((\x -> case x of- Core.TypeVariable v1 -> (forTypeReference v1)- _ -> (Flows.bind Monads.getState (\cx -> Utils.chooseAdapter (alts cx) (supported cx) Core___.type_ Core_.type_ typ))) typ))) typ)---- | Convert union types to record types-unionToRecord :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-unionToRecord t = ((\x -> case x of- Core.TypeUnion v1 -> - let nm = (Core.rowTypeTypeName v1) - sfields = (Core.rowTypeFields v1)- target = (Core.TypeRecord (unionTypeToRecordType v1))- toRecordField = (\term -> \fn -> \f -> - let fn_ = (Core.fieldTypeName f)- in Core.Field {- Core.fieldName = fn_,- Core.fieldTerm = (Core.TermOptional (Logic.ifElse (Equality.equal fn_ fn) (Just term) Nothing))})- fromRecordFields = (\term -> \term_ -> \t_ -> \fields -> - let matches = (Optionals.mapMaybe (\field -> - let fn = (Core.fieldName field) - fterm = (Core.fieldTerm field)- in ((\x -> case x of- Core.TermOptional v2 -> (Optionals.bind v2 (\t -> Just (Core.Field {- Core.fieldName = fn,- Core.fieldTerm = t})))) fterm)) fields)- in (Logic.ifElse (Lists.null matches) (Flows.fail (Strings.cat [- "cannot convert term back to union: ",- Core___.term term,- " where type = ",- Core___.type_ t,- " and target type = ",- (Core___.type_ t_)])) (Flows.pure (Lists.head matches))))- in (Flows.bind (termAdapter target) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = (Compute.adapterIsLossy ad),- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (\term_ -> Flows.bind (withGraphContext (Core__.injection (Core.rowTypeTypeName v1) term_)) (\field -> - let fn = (Core.fieldName field) - term = (Core.fieldTerm field)- in (Compute.coderEncode (Compute.adapterCoder ad) (Core.TermRecord (Core.Record {- Core.recordTypeName = nm,- Core.recordFields = (Lists.map (toRecordField term fn) sfields)}))))),- Compute.coderDecode = (\term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\recTerm -> (\x -> case x of- Core.TermRecord v2 -> - let fields = (Core.recordFields v2)- in (Flows.bind (fromRecordFields term (Core.TermRecord (Core.Record {- Core.recordTypeName = nm,- Core.recordFields = fields})) (Compute.adapterTarget ad) fields) (\resultField -> Flows.pure (Core.TermUnion (Core.Injection {- Core.injectionTypeName = nm,- Core.injectionField = resultField}))))) recTerm))}})))) t)---- | Convert a union row type to a record row type-unionTypeToRecordType :: (Core.RowType -> Core.RowType)-unionTypeToRecordType rt = - let makeOptional = (\f -> - let fn = (Core.fieldTypeName f) - ft = (Core.fieldTypeType f)- in Core.FieldType {- Core.fieldTypeName = fn,- Core.fieldTypeType = (Rewriting.mapBeneathTypeAnnotations (\x -> Core.TypeOptional x) ft)})- in Core.RowType {- Core.rowTypeTypeName = (Core.rowTypeTypeName rt),- Core.rowTypeFields = (Lists.map makeOptional (Core.rowTypeFields rt))}--unitToRecord :: (t0 -> Compute.Flow t1 (Compute.Adapter t2 t3 Core.Type Core.Type Core.Term Core.Term))-unitToRecord _ = (Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = Core.TypeUnit,- Compute.adapterTarget = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = (Core.Name "_Unit"),- Core.rowTypeFields = []})),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (\_ -> Flows.pure (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "_Unit"),- Core.recordFields = []}))),- Compute.coderDecode = (\_ -> Flows.pure Core.TermUnit)}}))---- | Convert wrapped types to unwrapped types-wrapToUnwrapped :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))-wrapToUnwrapped t = ((\x -> case x of- Core.TypeWrap v1 -> - let tname = (Core.wrappedTypeTypeName v1) - typ = (Core.wrappedTypeObject v1)- encode = (\ad -> \term -> Flows.bind (withGraphContext (Core__.wrap tname term)) (\unwrapped -> Compute.coderEncode (Compute.adapterCoder ad) unwrapped))- decode = (\ad -> \term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\decoded -> Flows.pure (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = tname,- Core.wrappedTermObject = decoded}))))- in (Flows.bind (termAdapter typ) (\ad -> Flows.pure (Compute.Adapter {- Compute.adapterIsLossy = False,- Compute.adapterSource = t,- Compute.adapterTarget = (Compute.adapterTarget ad),- Compute.adapterCoder = Compute.Coder {- Compute.coderEncode = (encode ad),- Compute.coderDecode = (decode ad)}})))) t)-+-- Note: this is an automatically generated file. Do not edit.++-- | Adapter framework for types and terms++module Hydra.Adapt.Terms where++import qualified Hydra.Adapt.Literals as Literals+import qualified Hydra.Adapt.Utils as Utils+import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Monads as Monads+import qualified Hydra.Reflect as Reflect+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Create an adapter for field types+fieldAdapter :: (Core.FieldType -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.FieldType Core.FieldType Core.Field Core.Field))+fieldAdapter ftyp = + let encdec = (\ad -> \dir -> \field -> + let name = (Core.fieldName field)+ in + let term = (Core.fieldTerm field)+ in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder ad) term) (\newTerm -> Flows.pure (Core.Field {+ Core.fieldName = name,+ Core.fieldTerm = newTerm}))))+ in (Flows.bind (termAdapter (Core.fieldTypeType ftyp)) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = ftyp,+ Compute.adapterTarget = Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName ftyp),+ Core.fieldTypeType = (Compute.adapterTarget ad)},+ Compute.adapterCoder = (Utils.bidirectional (encdec ad))})))++-- | This function accounts for recursive type definitions+forTypeReference :: (Core.Name -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+forTypeReference name = + let encdec = (\name -> \dir -> \term -> Flows.bind Monads.getState (\cx -> + let adapters = (Coders.adapterContextAdapters cx)+ in (Maybes.maybe (Flows.fail (Strings.cat2 "no adapter for reference type " (Core.unName name))) (\ad -> Utils.encodeDecode dir (Compute.adapterCoder ad) term) (Maps.lookup name adapters))))+ in + let forType = (\cx -> \adapters -> \t -> Flows.bind (termAdapter t) (\actual -> + let finalAdapters = (Maps.insert name actual adapters)+ in + let finalCx = Coders.AdapterContext {+ Coders.adapterContextGraph = (Coders.adapterContextGraph cx),+ Coders.adapterContextLanguage = (Coders.adapterContextLanguage cx),+ Coders.adapterContextAdapters = finalAdapters}+ in (Flows.bind (Monads.putState finalCx) (\ignored2 -> Flows.pure actual))))+ in + let forMissingAdapter = (\cx -> \lossy -> \adapters -> \placeholder -> + let newAdapters = (Maps.insert name placeholder adapters)+ in + let newCx = Coders.AdapterContext {+ Coders.adapterContextGraph = (Coders.adapterContextGraph cx),+ Coders.adapterContextLanguage = (Coders.adapterContextLanguage cx),+ Coders.adapterContextAdapters = newAdapters}+ in (Flows.bind (Monads.putState newCx) (\ignored -> Flows.bind (withGraphContext (Schemas.resolveType (Core.TypeVariable name))) (\mt -> Maybes.maybe (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = (Core.TypeVariable name),+ Compute.adapterTarget = (Core.TypeVariable name),+ Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Flows.pure term))})) (forType cx adapters) mt))))+ in + let flow = + let lossy = False+ in + let placeholder = Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = (Core.TypeVariable name),+ Compute.adapterTarget = (Core.TypeVariable name),+ Compute.adapterCoder = (Utils.bidirectional (encdec name))}+ in (Flows.bind Monads.getState (\cx -> + let adapters = (Coders.adapterContextAdapters cx)+ in (Maybes.maybe (forMissingAdapter cx lossy adapters placeholder) Flows.pure (Maps.lookup name adapters))))+ in (Monads.withTrace (Strings.cat2 "adapt named type " (Core.unName name)) flow)++functionProxyName :: Core.Name+functionProxyName = (Core.Name "hydra.core.FunctionProxy")++-- | Generate a function proxy type for a given domain type+functionProxyType :: (t0 -> Core.Type)+functionProxyType _ = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = functionProxyName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "wrap"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "record"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "union"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lambda"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "primitive"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "variable"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))++-- | Convert function types to union types+functionToUnion :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+functionToUnion t = + let encTerm = (\term -> \strippedTerm -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationWrap v3 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v3)))}}))+ Core.EliminationRecord _ -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core__.term term)))}}))+ Core.EliminationUnion _ -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core__.term term)))}}))) v2)+ Core.FunctionLambda _ -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core__.term term)))}}))+ Core.FunctionPrimitive v2 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v2)))}}))) v1)+ Core.TermVariable v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = functionProxyName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString (Core.unName v1)))}}))) strippedTerm)+ in + let encode = (\ad -> \term -> + let strippedTerm = (Rewriting.deannotateTerm term)+ in (Compute.coderEncode (Compute.adapterCoder ad) (encTerm term strippedTerm)))+ in + let readFromString = (\term -> Flows.bind (Core_.string term) (\s -> Maybes.maybe (Flows.fail (Strings.cat2 "failed to parse term: " s)) Flows.pure (Core__.readTerm s)))+ in + let decode = (\ad -> \term -> + let notFound = (\fname -> Flows.fail (Strings.cat2 "unexpected field: " (Core.unName fname)))+ in + let forCases = (\fterm -> withGraphContext (readFromString fterm))+ in + let forLambda = (\fterm -> withGraphContext (readFromString fterm))+ in + let forWrapped = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name s)))) (Core_.string fterm)))+ in + let forPrimitive = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermFunction (Core.FunctionPrimitive (Core.Name s))) (Core_.string fterm)))+ in + let forProjection = (\fterm -> withGraphContext (readFromString fterm))+ in + let forVariable = (\fterm -> withGraphContext (Flows.map (\s -> Core.TermVariable (Core.Name s)) (Core_.string fterm)))+ in (Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\injTerm -> Flows.bind (withGraphContext (Core_.injection functionProxyName injTerm)) (\field -> + let fname = (Core.fieldName field)+ in + let fterm = (Core.fieldTerm field)+ in (Maybes.fromMaybe (notFound fname) (Maps.lookup fname (Maps.fromList [+ (Core.Name "wrap", (forWrapped fterm)),+ (Core.Name "record", (forProjection fterm)),+ (Core.Name "union", (forCases fterm)),+ (Core.Name "lambda", (forLambda fterm)),+ (Core.Name "primitive", (forPrimitive fterm)),+ (Core.Name "variable", (forVariable fterm))])))))))+ in ((\x -> case x of+ Core.TypeFunction v1 -> + let dom = (Core.functionTypeDomain v1)+ in + let cod = (Core.functionTypeCodomain v1)+ in + let unionType = (Flows.bind (termAdapter dom) (\domAd -> Flows.pure (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = functionProxyName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "wrap"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "record"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "union"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lambda"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "primitive"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "variable"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))))+ in (Flows.bind unionType (\ut -> Flows.bind (termAdapter ut) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (encode ad),+ Compute.coderDecode = (decode ad)}}))))) t)++-- | Convert forall types to monotypes+lambdaToMonotype :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+lambdaToMonotype t = ((\x -> case x of+ Core.TypeForall v1 -> + let body = (Core.forallTypeBody v1)+ in (Flows.bind (termAdapter body) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = (Compute.adapterCoder ad)})))) t)++-- | Convert optional types to list types+maybeToList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+maybeToList t = + let encode = (\ad -> \term -> (\x -> case x of+ Core.TermMaybe v1 -> (Maybes.maybe (Flows.pure (Core.TermList [])) (\r -> Flows.bind (Compute.coderEncode (Compute.adapterCoder ad) r) (\encoded -> Flows.pure (Core.TermList [+ encoded]))) v1)) term)+ in + let decode = (\ad -> \term -> (\x -> case x of+ Core.TermList v1 -> (Flows.map (\x -> Core.TermMaybe x) (Logic.ifElse (Lists.null v1) (Flows.pure Nothing) (Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) (Lists.head v1)) (\decoded -> Flows.pure (Just decoded)))))) term)+ in ((\x -> case x of+ Core.TypeMaybe v1 -> (Flows.bind (termAdapter v1) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeList (Compute.adapterTarget ad)),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (encode ad),+ Compute.coderDecode = (decode ad)}})))) t)++-- | Pass through application types+passApplication :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passApplication t = + let forApplicationType = (\at -> + let lhs = (Core.applicationTypeFunction at)+ in + let rhs = (Core.applicationTypeArgument at)+ in (Flows.bind (termAdapter lhs) (\lhsAd -> Flows.bind (termAdapter rhs) (\rhsAd -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Logic.or (Compute.adapterIsLossy lhsAd) (Compute.adapterIsLossy rhsAd)),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Compute.adapterTarget lhsAd),+ Core.applicationTypeArgument = (Compute.adapterTarget rhsAd)})),+ Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder lhsAd) term))})))))+ in ((\x -> case x of+ Core.TypeApplication v1 -> (forApplicationType v1)) t)++-- | Pass through either types+passEither :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passEither t = + let forEitherType = (\et -> + let left = (Core.eitherTypeLeft et)+ in + let right = (Core.eitherTypeRight et)+ in (Flows.bind (termAdapter left) (\leftAd -> Flows.bind (termAdapter right) (\rightAd -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Logic.or (Compute.adapterIsLossy leftAd) (Compute.adapterIsLossy rightAd)),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Compute.adapterTarget leftAd),+ Core.eitherTypeRight = (Compute.adapterTarget rightAd)})),+ Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder leftAd) term))})))))+ in ((\x -> case x of+ Core.TypeEither v1 -> (forEitherType v1)) t)++-- | Pass through function types with adaptation+passFunction :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passFunction t = + let toCaseAds = (\dom -> \cod -> (\x -> case x of+ Core.TypeUnion v1 -> (Flows.bind (Flows.mapList (\f -> Flows.bind (fieldAdapter (Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName f),+ Core.fieldTypeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.fieldTypeType f),+ Core.functionTypeCodomain = cod}))})) (\ad -> Flows.pure (Core.fieldTypeName f, ad))) (Core.rowTypeFields v1)) (\pairs -> Flows.pure (Maps.fromList pairs)))+ _ -> (Flows.pure Maps.empty)) (Rewriting.deannotateType dom))+ in + let toOptionAd = (\dom -> \cod -> (\x -> case x of+ Core.TypeMaybe v1 -> (Flows.map Maybes.pure (termAdapter (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = v1,+ Core.functionTypeCodomain = cod}))))+ _ -> (Flows.pure Nothing)) (Rewriting.deannotateType dom))+ in + let getCoder = (\caseAds -> \fname -> Maybes.maybe Utils.idCoder Compute.adapterCoder (Maps.lookup fname caseAds))+ in + let forElimination = (\dir -> \codAd -> \caseAds -> \e -> (\x -> case x of+ Core.EliminationUnion v1 -> + let n = (Core.caseStatementTypeName v1)+ in + let def = (Core.caseStatementDefault v1)+ in + let cases = (Core.caseStatementCases v1)+ in (Flows.bind (Flows.mapList (\f -> Utils.encodeDecode dir (getCoder caseAds (Core.fieldName f)) f) cases) (\rcases -> Flows.bind (Maybes.maybe (Flows.pure Nothing) (\d -> Flows.map Maybes.pure (Utils.encodeDecode dir (Compute.adapterCoder codAd) d)) def) (\rdef -> Flows.pure (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = n,+ Core.caseStatementDefault = rdef,+ Core.caseStatementCases = rcases})))))) e)+ in + let forFunction = (\dir -> \codAd -> \caseAds -> \f -> (\x -> case x of+ Core.FunctionElimination v1 -> (Flows.map (\x -> Core.FunctionElimination x) (forElimination dir codAd caseAds v1))+ Core.FunctionLambda v1 -> + let var = (Core.lambdaParameter v1)+ in + let d = (Core.lambdaDomain v1)+ in + let body = (Core.lambdaBody v1)+ in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder codAd) body) (\newBody -> Flows.pure (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = var,+ Core.lambdaDomain = d,+ Core.lambdaBody = newBody}))))+ Core.FunctionPrimitive v1 -> (Flows.pure (Core.FunctionPrimitive v1))) f)+ in + let encdec = (\codAd -> \caseAds -> \dir -> \term -> (\x -> case x of+ Core.TermFunction v1 -> (Flows.map (\x -> Core.TermFunction x) (forFunction dir codAd caseAds v1))+ _ -> (Flows.pure term)) (Rewriting.deannotateTerm term))+ in + let forFunctionType = (\ft -> + let dom = (Core.functionTypeDomain ft)+ in + let cod = (Core.functionTypeCodomain ft)+ in (Flows.bind (termAdapter dom) (\domAd -> Flows.bind (termAdapter cod) (\codAd -> Flows.bind (toCaseAds dom cod) (\caseAds -> Flows.bind (toOptionAd dom cod) (\optionAd -> + let lossy = (Logic.or (Compute.adapterIsLossy codAd) (Lists.foldl Logic.or False (Lists.map (\pair -> Compute.adapterIsLossy (Pairs.second pair)) (Maps.toList caseAds))))+ in + let target = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Compute.adapterTarget domAd),+ Core.functionTypeCodomain = (Compute.adapterTarget codAd)}))+ in (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = t,+ Compute.adapterTarget = target,+ Compute.adapterCoder = (Utils.bidirectional (encdec codAd caseAds))}))))))))+ in ((\x -> case x of+ Core.TypeFunction v1 -> (forFunctionType v1)) t)++-- | Pass through forall types+passForall :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passForall t = + let forForallType = (\ft -> + let v = (Core.forallTypeParameter ft)+ in + let body = (Core.forallTypeBody ft)+ in (Flows.bind (termAdapter body) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = v,+ Core.forallTypeBody = (Compute.adapterTarget ad)})),+ Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder ad) term))}))))+ in ((\x -> case x of+ Core.TypeForall v1 -> (forForallType v1)) t)++-- | Pass through literal types with literal adaptation+passLiteral :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passLiteral t = + let encdec = (\ad -> \dir -> \term -> Flows.bind (withGraphContext (Core_.literal term)) (\l -> Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder ad) l) (\l2 -> Flows.pure (Core.TermLiteral l2))))+ in + let forLiteral = (\lt -> Flows.bind (Literals.literalAdapter lt) (\ad -> + let step = (Utils.bidirectional (encdec ad))+ in (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = (Core.TypeLiteral (Compute.adapterSource ad)),+ Compute.adapterTarget = (Core.TypeLiteral (Compute.adapterTarget ad)),+ Compute.adapterCoder = step}))))+ in ((\x -> case x of+ Core.TypeLiteral v1 -> (forLiteral v1)) t)++-- | Pass through list types+passList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passList t = + let encdec = (\ad -> \dir -> \term -> (\x -> case x of+ Core.TermList v1 -> (Flows.bind (Flows.mapList (Utils.encodeDecode dir (Compute.adapterCoder ad)) v1) (\newTerms -> Flows.pure (Core.TermList newTerms)))) term)+ in + let forListType = (\lt -> Flows.bind (termAdapter lt) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeList (Compute.adapterTarget ad)),+ Compute.adapterCoder = (Utils.bidirectional (encdec ad))})))+ in ((\x -> case x of+ Core.TypeList v1 -> (forListType v1)) t)++-- | Pass through map types+passMap :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passMap t = + let encdec = (\kad -> \vad -> \dir -> \term -> (\x -> case x of+ Core.TermMap v1 -> (Flows.bind (Flows.mapList (\pair -> + let k = (Pairs.first pair)+ in + let v = (Pairs.second pair)+ in (Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder kad) k) (\newK -> Flows.bind (Utils.encodeDecode dir (Compute.adapterCoder vad) v) (\newV -> Flows.pure (newK, newV))))) (Maps.toList v1)) (\newPairs -> Flows.pure (Core.TermMap (Maps.fromList newPairs))))) term)+ in + let forMapType = (\mt -> + let kt = (Core.mapTypeKeys mt)+ in + let vt = (Core.mapTypeValues mt)+ in (Flows.bind (termAdapter kt) (\kad -> Flows.bind (termAdapter vt) (\vad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Logic.or (Compute.adapterIsLossy kad) (Compute.adapterIsLossy vad)),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Compute.adapterTarget kad),+ Core.mapTypeValues = (Compute.adapterTarget vad)})),+ Compute.adapterCoder = (Utils.bidirectional (encdec kad vad))})))))+ in ((\x -> case x of+ Core.TypeMap v1 -> (forMapType v1)) t)++-- | Pass through optional types+passOptional :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passOptional t = + let mapTerm = (\coder -> \dir -> \term -> Flows.bind (withGraphContext (Core_.maybeTerm Flows.pure term)) (\opt -> Flows.bind (Flows.mapMaybe (Utils.encodeDecode dir coder) opt) (\newOpt -> Flows.pure (Core.TermMaybe newOpt))))+ in ((\x -> case x of+ Core.TypeMaybe v1 -> (Flows.bind (termAdapter v1) (\adapter -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeMaybe (Compute.adapterTarget adapter)),+ Compute.adapterCoder = (Utils.bidirectional (mapTerm (Compute.adapterCoder adapter)))})))) t)++-- | Pass through record types+passRecord :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passRecord t = + let encdec = (\rt -> \adapters -> \dir -> \term -> (\x -> case x of+ Core.TermRecord v1 -> + let dfields = (Core.recordFields v1)+ in (Flows.bind (Flows.sequence (Lists.zipWith (\ad -> \f -> Utils.encodeDecode dir (Compute.adapterCoder ad) f) adapters dfields)) (\newFields -> Flows.pure (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.rowTypeTypeName rt),+ Core.recordFields = newFields}))))) term)+ in + let forRecordType = (\rt -> Flows.bind (Flows.mapList fieldAdapter (Core.rowTypeFields rt)) (\adapters -> + let lossy = (Lists.foldl Logic.or False (Lists.map Compute.adapterIsLossy adapters))+ in + let sfields_ = (Lists.map Compute.adapterTarget adapters)+ in (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.rowTypeTypeName rt),+ Core.rowTypeFields = sfields_})),+ Compute.adapterCoder = (Utils.bidirectional (encdec rt adapters))}))))+ in ((\x -> case x of+ Core.TypeRecord v1 -> (forRecordType v1)) t)++-- | Pass through set types+passSet :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passSet t = + let encdec = (\ad -> \dir -> \term -> (\x -> case x of+ Core.TermSet v1 -> (Flows.bind (Flows.mapList (Utils.encodeDecode dir (Compute.adapterCoder ad)) (Sets.toList v1)) (\newTerms -> Flows.pure (Core.TermSet (Sets.fromList newTerms))))) term)+ in ((\x -> case x of+ Core.TypeSet v1 -> (Flows.bind (termAdapter v1) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeSet (Compute.adapterTarget ad)),+ Compute.adapterCoder = (Utils.bidirectional (encdec ad))})))) t)++-- | Pass through union types+passUnion :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passUnion t = ((\x -> case x of+ Core.TypeUnion v1 -> + let sfields = (Core.rowTypeFields v1)+ in + let tname = (Core.rowTypeTypeName v1)+ in + let getAdapter = (\adaptersMap -> \f -> Maybes.maybe (Flows.fail (Strings.cat2 "no such field: " (Core.unName (Core.fieldName f)))) Flows.pure (Maps.lookup (Core.fieldName f) adaptersMap))+ in (Flows.bind (Flows.mapList (\f -> Flows.bind (fieldAdapter f) (\ad -> Flows.pure (Core.fieldTypeName f, ad))) sfields) (\adapters -> + let adaptersMap = (Maps.fromList adapters)+ in + let lossy = (Lists.foldl Logic.or False (Lists.map (\pair -> Compute.adapterIsLossy (Pairs.second pair)) adapters))+ in + let sfields_ = (Lists.map (\pair -> Compute.adapterTarget (Pairs.second pair)) adapters)+ in (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = lossy,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = tname,+ Core.rowTypeFields = sfields_})),+ Compute.adapterCoder = (Utils.bidirectional (\dir -> \term -> Flows.pure term))}))))) t)++-- | Pass through unit types+passUnit :: (t0 -> Compute.Flow t1 (Compute.Adapter t2 t3 Core.Type Core.Type Core.Term Core.Term))+passUnit _ = (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = Core.TypeUnit,+ Compute.adapterTarget = Core.TypeUnit,+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (\_ -> Flows.pure Core.TermUnit),+ Compute.coderDecode = (\_ -> Flows.pure Core.TermUnit)}}))++-- | Pass through wrapped types+passWrapped :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+passWrapped t = ((\x -> case x of+ Core.TypeWrap v1 -> + let tname = (Core.wrappedTypeTypeName v1)+ in + let ot = (Core.wrappedTypeBody v1)+ in + let mapTerm = (\coder -> \dir -> \term -> Flows.bind (withGraphContext (Core_.wrap tname term)) (\unwrapped -> Flows.bind (Utils.encodeDecode dir coder unwrapped) (\newTerm -> Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = tname,+ Core.wrappedTermBody = newTerm})))))+ in (Flows.bind (termAdapter ot) (\adapter -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy adapter),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = tname,+ Core.wrappedTypeBody = (Compute.adapterTarget adapter)})),+ Compute.adapterCoder = (Utils.bidirectional (mapTerm (Compute.adapterCoder adapter)))})))) t)++-- | Convert set types to list types+setToList :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+setToList t = + let encode = (\ad -> \term -> (\x -> case x of+ Core.TermSet v1 -> (Compute.coderEncode (Compute.adapterCoder ad) (Core.TermList (Sets.toList v1)))) term)+ in + let forListTerm = (\t -> (\x -> case x of+ Core.TermList v1 -> (Flows.pure (Core.TermSet (Sets.fromList v1)))) t)+ in + let decode = (\ad -> \term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\listTerm -> forListTerm listTerm))+ in + let forSetType = (\st -> Flows.bind (termAdapter (Core.TypeList st)) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (encode ad),+ Compute.coderDecode = (decode ad)}})))+ in ((\x -> case x of+ Core.TypeSet v1 -> (forSetType v1)) t)++-- | Simplify application types+simplifyApplication :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+simplifyApplication t = + let encdec = (\ad -> \dir -> \term -> Utils.encodeDecode dir (Compute.adapterCoder ad) term)+ in + let forApplicationType = (\at -> + let lhs = (Core.applicationTypeFunction at)+ in (Flows.bind (termAdapter lhs) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = (Utils.bidirectional (encdec ad))}))))+ in ((\x -> case x of+ Core.TypeApplication v1 -> (forApplicationType v1)) t)++-- | Create an adapter for any type+termAdapter :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+termAdapter typ = + let constraints = (\cx -> Coders.languageConstraints (Coders.adapterContextLanguage cx))+ in + let supported = (\cx -> Utils.typeIsSupported (constraints cx))+ in + let variantIsSupported = (\cx -> \t -> Sets.member (Reflect.typeVariant t) (Coders.languageConstraintsTypeVariants (constraints cx)))+ in + let supportedAtTopLevel = (\cx -> \t -> Logic.and (variantIsSupported cx t) (Coders.languageConstraintsTypes (constraints cx) t))+ in + let pass = (\t -> (\x -> case x of+ Variants.TypeVariantAnnotated -> []+ Variants.TypeVariantApplication -> [+ passApplication]+ Variants.TypeVariantEither -> [+ passEither]+ Variants.TypeVariantForall -> [+ passForall]+ Variants.TypeVariantFunction -> [+ passFunction]+ Variants.TypeVariantList -> [+ passList]+ Variants.TypeVariantLiteral -> [+ passLiteral]+ Variants.TypeVariantMap -> [+ passMap]+ Variants.TypeVariantMaybe -> [+ passOptional,+ maybeToList]+ Variants.TypeVariantPair -> []+ Variants.TypeVariantRecord -> [+ passRecord]+ Variants.TypeVariantSet -> [+ passSet]+ Variants.TypeVariantUnion -> [+ passUnion]+ Variants.TypeVariantUnit -> [+ passUnit]+ Variants.TypeVariantVariable -> []+ Variants.TypeVariantWrap -> [+ passWrapped]) (Reflect.typeVariant (Rewriting.deannotateType t)))+ in + let trySubstitution = (\t -> (\x -> case x of+ Variants.TypeVariantAnnotated -> []+ Variants.TypeVariantApplication -> [+ simplifyApplication]+ Variants.TypeVariantEither -> []+ Variants.TypeVariantForall -> [+ lambdaToMonotype]+ Variants.TypeVariantFunction -> [+ functionToUnion]+ Variants.TypeVariantList -> []+ Variants.TypeVariantLiteral -> []+ Variants.TypeVariantMap -> []+ Variants.TypeVariantMaybe -> [+ maybeToList]+ Variants.TypeVariantPair -> []+ Variants.TypeVariantRecord -> []+ Variants.TypeVariantSet -> [+ setToList]+ Variants.TypeVariantUnion -> [+ unionToRecord]+ Variants.TypeVariantUnit -> [+ unitToRecord]+ Variants.TypeVariantVariable -> []+ Variants.TypeVariantWrap -> [+ wrapToUnwrapped]) (Reflect.typeVariant t))+ in + let alts = (\cx -> \t -> Flows.mapList (\c -> c t) (Logic.ifElse (supportedAtTopLevel cx t) (pass t) (trySubstitution t)))+ in + let dflt = ((\x -> case x of+ Core.TypeVariable v1 -> (forTypeReference v1)+ _ -> (Flows.bind Monads.getState (\cx -> Utils.chooseAdapter (alts cx) (supported cx) Core__.type_ Core__.type_ typ))) typ)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (Flows.bind (termAdapter (Core.annotatedTypeBody v1)) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = (Compute.adapterSource ad),+ Compute.adapterTarget = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Compute.adapterTarget ad),+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)})),+ Compute.adapterCoder = (Compute.adapterCoder ad)})))+ _ -> (Monads.withTrace (Strings.cat2 "adapter for " (Core__.type_ typ)) dflt)) typ)++-- | Convert union types to record types+unionToRecord :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+unionToRecord t = + let forField = (\field -> + let fn = (Core.fieldName field)+ in + let fterm = (Core.fieldTerm field)+ in ((\x -> case x of+ Core.TermMaybe v1 -> (Maybes.bind v1 (\t -> Just (Core.Field {+ Core.fieldName = fn,+ Core.fieldTerm = t})))) fterm))+ in + let fromRecordFields = (\term -> \term_ -> \t_ -> \fields -> + let matches = (Maybes.mapMaybe forField fields)+ in (Logic.ifElse (Lists.null matches) (Flows.fail (Strings.cat [+ "cannot convert term back to union: ",+ (Core__.term term),+ " where type = ",+ (Core__.type_ t),+ " and target type = ",+ (Core__.type_ t_)])) (Flows.pure (Lists.head matches))))+ in + let forRecTerm = (\nm -> \ad -> \term -> \recTerm -> (\x -> case x of+ Core.TermRecord v1 -> + let fields = (Core.recordFields v1)+ in (Flows.bind (fromRecordFields term (Core.TermRecord (Core.Record {+ Core.recordTypeName = nm,+ Core.recordFields = fields})) (Compute.adapterTarget ad) fields) (\resultField -> Flows.pure (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = nm,+ Core.injectionField = resultField}))))) recTerm)+ in ((\x -> case x of+ Core.TypeUnion v1 -> + let nm = (Core.rowTypeTypeName v1)+ in + let sfields = (Core.rowTypeFields v1)+ in + let target = (Core.TypeRecord (unionTypeToRecordType v1))+ in + let toRecordField = (\term -> \fn -> \f -> + let fn_ = (Core.fieldTypeName f)+ in Core.Field {+ Core.fieldName = fn_,+ Core.fieldTerm = (Core.TermMaybe (Logic.ifElse (Equality.equal fn_ fn) (Just term) Nothing))})+ in (Flows.bind (termAdapter target) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = (Compute.adapterIsLossy ad),+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (\term_ -> Flows.bind (withGraphContext (Core_.injection (Core.rowTypeTypeName v1) term_)) (\field -> + let fn = (Core.fieldName field)+ in + let term = (Core.fieldTerm field)+ in (Compute.coderEncode (Compute.adapterCoder ad) (Core.TermRecord (Core.Record {+ Core.recordTypeName = nm,+ Core.recordFields = (Lists.map (toRecordField term fn) sfields)}))))),+ Compute.coderDecode = (\term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\recTerm -> forRecTerm nm ad term recTerm))}})))) t)++-- | Convert a union row type to a record row type+unionTypeToRecordType :: (Core.RowType -> Core.RowType)+unionTypeToRecordType rt = + let makeOptional = (\f -> + let fn = (Core.fieldTypeName f)+ in + let ft = (Core.fieldTypeType f)+ in Core.FieldType {+ Core.fieldTypeName = fn,+ Core.fieldTypeType = (Rewriting.mapBeneathTypeAnnotations (\x -> Core.TypeMaybe x) ft)})+ in Core.RowType {+ Core.rowTypeTypeName = (Core.rowTypeTypeName rt),+ Core.rowTypeFields = (Lists.map makeOptional (Core.rowTypeFields rt))}++-- | Convert unit terms to records+unitToRecord :: (t0 -> Compute.Flow t1 (Compute.Adapter t2 t3 Core.Type Core.Type Core.Term Core.Term))+unitToRecord _ = (Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = Core.TypeUnit,+ Compute.adapterTarget = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "_Unit"),+ Core.rowTypeFields = []})),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (\_ -> Flows.pure (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "_Unit"),+ Core.recordFields = []}))),+ Compute.coderDecode = (\_ -> Flows.pure Core.TermUnit)}}))++-- | Convert wrapped types to unwrapped types+wrapToUnwrapped :: (Core.Type -> Compute.Flow Coders.AdapterContext (Compute.Adapter Coders.AdapterContext Coders.AdapterContext Core.Type Core.Type Core.Term Core.Term))+wrapToUnwrapped t = ((\x -> case x of+ Core.TypeWrap v1 -> + let tname = (Core.wrappedTypeTypeName v1)+ in + let typ = (Core.wrappedTypeBody v1)+ in + let encode = (\ad -> \term -> Flows.bind (withGraphContext (Core_.wrap tname term)) (\unwrapped -> Compute.coderEncode (Compute.adapterCoder ad) unwrapped))+ in + let decode = (\ad -> \term -> Flows.bind (Compute.coderDecode (Compute.adapterCoder ad) term) (\decoded -> Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = tname,+ Core.wrappedTermBody = decoded}))))+ in (Flows.bind (termAdapter typ) (\ad -> Flows.pure (Compute.Adapter {+ Compute.adapterIsLossy = False,+ Compute.adapterSource = t,+ Compute.adapterTarget = (Compute.adapterTarget ad),+ Compute.adapterCoder = Compute.Coder {+ Compute.coderEncode = (encode ad),+ Compute.coderDecode = (decode ad)}})))) t)++-- | Execute a flow with graph context withGraphContext :: (Compute.Flow Graph.Graph t0 -> Compute.Flow Coders.AdapterContext t0) withGraphContext f = (Flows.bind Monads.getState (\cx -> Monads.withState (Coders.adapterContextGraph cx) f))
src/gen-main/haskell/Hydra/Adapt/Utils.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Additional adapter utilities, above and beyond the generated ones. module Hydra.Adapt.Utils where@@ -10,26 +12,30 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Module as Module import qualified Hydra.Names as Names+import qualified Hydra.Reflect as Reflect import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core_+import qualified Hydra.Util as Util import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Create a bidirectional coder from a direction-aware function bidirectional :: ((Coders.CoderDirection -> t0 -> Compute.Flow t1 t0) -> Compute.Coder t1 t1 t0 t0) bidirectional f = Compute.Coder { Compute.coderEncode = (f Coders.CoderDirectionEncode), Compute.coderDecode = (f Coders.CoderDirectionDecode)} +-- | Choose an appropriate adapter for a type chooseAdapter :: ((t0 -> Compute.Flow t1 [Compute.Adapter t2 t3 t0 t0 t4 t4]) -> (t0 -> Bool) -> (t0 -> String) -> (t0 -> String) -> t0 -> Compute.Flow t1 (Compute.Adapter t2 t3 t0 t0 t4 t4)) chooseAdapter alts supported show describe typ = (Logic.ifElse (supported typ) (Flows.pure (Compute.Adapter { Compute.adapterIsLossy = False,@@ -39,30 +45,33 @@ let candidates = (Lists.filter (\adapter -> supported (Compute.adapterTarget adapter)) raw) in (Logic.ifElse (Lists.null candidates) (Flows.fail (Strings.cat [ "no adapters found for ",- describe typ,- Logic.ifElse (Lists.null raw) "" (Strings.cat [+ (describe typ),+ (Logic.ifElse (Lists.null raw) "" (Strings.cat [ " (discarded ",- Literals.showInt32 (Lists.length raw),+ (Literals.showInt32 (Lists.length raw)), " unsupported candidate types: ",- Core_.list show (Lists.map Compute.adapterTarget raw),- ")"]),+ (Core_.list show (Lists.map Compute.adapterTarget raw)),+ ")"])), ". Original type: ", (show typ)])) (Flows.pure (Lists.head candidates)))))) +-- | Compose two coders composeCoders :: (Compute.Coder t0 t1 t2 t3 -> Compute.Coder t0 t1 t3 t4 -> Compute.Coder t0 t1 t2 t4) composeCoders c1 c2 = Compute.Coder {- Compute.coderEncode = (\a -> Flows.bind (Compute.coderEncode c1 a) (Compute.coderEncode c2)),- Compute.coderDecode = (\c -> Flows.bind (Compute.coderDecode c2 c) (Compute.coderDecode c1))}+ Compute.coderEncode = (\a -> Flows.bind (Compute.coderEncode c1 a) (\b1 -> Compute.coderEncode c2 b1)),+ Compute.coderDecode = (\c -> Flows.bind (Compute.coderDecode c2 c) (\b2 -> Compute.coderDecode c1 b2))} +-- | Apply coder in the specified direction encodeDecode :: (Coders.CoderDirection -> Compute.Coder t0 t0 t1 t1 -> t1 -> Compute.Flow t0 t1)-encodeDecode dir coder = ((\x -> case x of- Coders.CoderDirectionEncode -> (Compute.coderEncode coder)- Coders.CoderDirectionDecode -> (Compute.coderDecode coder)) dir)+encodeDecode dir coder term = ((\x -> case x of+ Coders.CoderDirectionEncode -> (Compute.coderEncode coder term)+ Coders.CoderDirectionDecode -> (Compute.coderDecode coder term)) dir) -- | Check if float type is supported by language constraints floatTypeIsSupported :: (Coders.LanguageConstraints -> Core.FloatType -> Bool) floatTypeIsSupported constraints ft = (Sets.member ft (Coders.languageConstraintsFloatTypes constraints)) +-- | Identity adapter idAdapter :: (t0 -> Compute.Adapter t1 t2 t0 t0 t3 t3) idAdapter t = Compute.Adapter { Compute.adapterIsLossy = False,@@ -70,6 +79,7 @@ Compute.adapterTarget = t, Compute.adapterCoder = idCoder} +-- | Identity coder idCoder :: (Compute.Coder t0 t1 t2 t2) idCoder = Compute.Coder { Compute.coderEncode = Flows.pure,@@ -81,51 +91,64 @@ -- | Check if literal type is supported by language constraints literalTypeIsSupported :: (Coders.LanguageConstraints -> Core.LiteralType -> Bool)-literalTypeIsSupported constraints lt = (Logic.and (Sets.member (Variants.literalTypeVariant lt) (Coders.languageConstraintsLiteralVariants constraints)) ((\x -> case x of- Core.LiteralTypeFloat v1 -> (floatTypeIsSupported constraints v1)- Core.LiteralTypeInteger v1 -> (integerTypeIsSupported constraints v1)- _ -> True) lt))+literalTypeIsSupported constraints lt = + let isSupported = (\lt -> (\x -> case x of+ Core.LiteralTypeFloat v1 -> (floatTypeIsSupported constraints v1)+ Core.LiteralTypeInteger v1 -> (integerTypeIsSupported constraints v1)+ _ -> True) lt)+ in (Logic.and (Sets.member (Reflect.literalTypeVariant lt) (Coders.languageConstraintsLiteralVariants constraints)) (isSupported lt)) -- | Convert a name to file path, given case conventions for namespaces and local names, and assuming '/' as the file path separator-nameToFilePath :: (Mantle.CaseConvention -> Mantle.CaseConvention -> Module.FileExtension -> Core.Name -> String)+nameToFilePath :: (Util.CaseConvention -> Util.CaseConvention -> Module.FileExtension -> Core.Name -> String) nameToFilePath nsConv localConv ext name = - let qualName = (Names.qualifyName name) - ns = (Module.qualifiedNameNamespace qualName)- local = (Module.qualifiedNameLocal qualName)- nsToFilePath = (\ns -> Strings.intercalate "/" (Lists.map (\part -> Formatting.convertCase Mantle.CaseConventionCamel nsConv part) (Strings.splitOn "." (Module.unNamespace ns))))- prefix = (Optionals.maybe "" (\n -> Strings.cat2 (nsToFilePath n) "/") ns)- suffix = (Formatting.convertCase Mantle.CaseConventionPascal localConv local)- in (Strings.cat [- prefix,- suffix,- ".",- (Module.unFileExtension ext)])+ let qualName = (Names.qualifyName name)+ in + let ns = (Module.qualifiedNameNamespace qualName)+ in + let local = (Module.qualifiedNameLocal qualName)+ in + let nsToFilePath = (\ns -> Strings.intercalate "/" (Lists.map (\part -> Formatting.convertCase Util.CaseConventionCamel nsConv part) (Strings.splitOn "." (Module.unNamespace ns))))+ in + let prefix = (Maybes.maybe "" (\n -> Strings.cat2 (nsToFilePath n) "/") ns)+ in + let suffix = (Formatting.convertCase Util.CaseConventionPascal localConv local)+ in (Strings.cat [+ prefix,+ suffix,+ ".",+ (Module.unFileExtension ext)]) -- | Check if type is supported by language constraints typeIsSupported :: (Coders.LanguageConstraints -> Core.Type -> Bool) typeIsSupported constraints t = - let base = (Rewriting.deannotateType t) - isSupportedVariant = (\v -> Logic.or ((\x -> case x of- Mantle.TypeVariantVariable -> True- _ -> False) v) (Sets.member v (Coders.languageConstraintsTypeVariants constraints)))- in (Logic.and (Coders.languageConstraintsTypes constraints base) (Logic.and (isSupportedVariant (Variants.typeVariant base)) ((\x -> case x of- Core.TypeAnnotated v1 -> (typeIsSupported constraints (Core.annotatedTypeSubject v1))- Core.TypeApplication v1 -> (Logic.and (typeIsSupported constraints (Core.applicationTypeFunction v1)) (typeIsSupported constraints (Core.applicationTypeArgument v1)))- Core.TypeForall v1 -> (typeIsSupported constraints (Core.forallTypeBody v1))- Core.TypeFunction v1 -> (Logic.and (typeIsSupported constraints (Core.functionTypeDomain v1)) (typeIsSupported constraints (Core.functionTypeCodomain v1)))- Core.TypeList v1 -> (typeIsSupported constraints v1)- Core.TypeLiteral v1 -> (literalTypeIsSupported constraints v1)- Core.TypeMap v1 -> (Logic.and (typeIsSupported constraints (Core.mapTypeKeys v1)) (typeIsSupported constraints (Core.mapTypeValues v1)))- Core.TypeOptional v1 -> (typeIsSupported constraints v1)- Core.TypeProduct v1 -> (Lists.foldl Logic.and True (Lists.map (typeIsSupported constraints) v1))- Core.TypeRecord v1 -> (Lists.foldl Logic.and True (Lists.map (\field -> typeIsSupported constraints (Core.fieldTypeType field)) (Core.rowTypeFields v1)))- Core.TypeSet v1 -> (typeIsSupported constraints v1)- Core.TypeSum v1 -> (Lists.foldl Logic.and True (Lists.map (typeIsSupported constraints) v1))- Core.TypeUnion v1 -> (Lists.foldl Logic.and True (Lists.map (\field -> typeIsSupported constraints (Core.fieldTypeType field)) (Core.rowTypeFields v1)))- Core.TypeUnit -> True- Core.TypeWrap v1 -> (typeIsSupported constraints (Core.wrappedTypeObject v1))- Core.TypeVariable _ -> True) base)))+ let base = (Rewriting.deannotateType t)+ in + let isVariable = (\v -> (\x -> case x of+ Variants.TypeVariantVariable -> True+ _ -> False) v)+ in + let isSupportedVariant = (\v -> Logic.or (isVariable v) (Sets.member v (Coders.languageConstraintsTypeVariants constraints)))+ in + let isSupported = (\base -> (\x -> case x of+ Core.TypeAnnotated v1 -> (typeIsSupported constraints (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Logic.and (typeIsSupported constraints (Core.applicationTypeFunction v1)) (typeIsSupported constraints (Core.applicationTypeArgument v1)))+ Core.TypeEither v1 -> (Logic.and (typeIsSupported constraints (Core.eitherTypeLeft v1)) (typeIsSupported constraints (Core.eitherTypeRight v1)))+ Core.TypeForall v1 -> (typeIsSupported constraints (Core.forallTypeBody v1))+ Core.TypeFunction v1 -> (Logic.and (typeIsSupported constraints (Core.functionTypeDomain v1)) (typeIsSupported constraints (Core.functionTypeCodomain v1)))+ Core.TypeList v1 -> (typeIsSupported constraints v1)+ Core.TypeLiteral v1 -> (literalTypeIsSupported constraints v1)+ Core.TypeMap v1 -> (Logic.and (typeIsSupported constraints (Core.mapTypeKeys v1)) (typeIsSupported constraints (Core.mapTypeValues v1)))+ Core.TypeMaybe v1 -> (typeIsSupported constraints v1)+ Core.TypePair v1 -> (Logic.and (typeIsSupported constraints (Core.pairTypeFirst v1)) (typeIsSupported constraints (Core.pairTypeSecond v1)))+ Core.TypeRecord v1 -> (Lists.foldl Logic.and True (Lists.map (\field -> typeIsSupported constraints (Core.fieldTypeType field)) (Core.rowTypeFields v1)))+ Core.TypeSet v1 -> (typeIsSupported constraints v1)+ Core.TypeUnion v1 -> (Lists.foldl Logic.and True (Lists.map (\field -> typeIsSupported constraints (Core.fieldTypeType field)) (Core.rowTypeFields v1)))+ Core.TypeUnit -> True+ Core.TypeWrap v1 -> (typeIsSupported constraints (Core.wrappedTypeBody v1))+ Core.TypeVariable _ -> True) base)+ in (Logic.and (Coders.languageConstraintsTypes constraints base) (Logic.and (isSupportedVariant (Reflect.typeVariant base)) (isSupported base))) +-- | Create a unidirectional coder unidirectionalCoder :: ((t0 -> Compute.Flow t1 t2) -> Compute.Coder t1 t3 t0 t2) unidirectionalCoder m = Compute.Coder { Compute.coderEncode = m,
src/gen-main/haskell/Hydra/Annotations.hs view
@@ -1,12 +1,14 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for reading and writing type and term annotations module Hydra.Annotations where +import qualified Hydra.Classes as Classes import qualified Hydra.Compute as Compute import qualified Hydra.Constants as Constants import qualified Hydra.Core as Core import qualified Hydra.Decode.Core as Core_-import qualified Hydra.Decoding as Decoding import qualified Hydra.Encode.Core as Core__ import qualified Hydra.Extract.Core as Core___ import qualified Hydra.Graph as Graph@@ -14,80 +16,92 @@ import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Monads as Monads import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core____-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -aggregateAnnotations :: (Ord t2) => ((t0 -> Maybe t1) -> (t1 -> t0) -> (t1 -> M.Map t2 t3) -> t0 -> M.Map t2 t3)+-- | Aggregate annotations from nested structures+aggregateAnnotations :: Ord t2 => ((t0 -> Maybe t1) -> (t1 -> t0) -> (t1 -> M.Map t2 t3) -> t0 -> M.Map t2 t3) aggregateAnnotations getValue getX getAnns t = - let toPairs = (\rest -> \t -> Optionals.maybe rest (\yy -> toPairs (Lists.cons (Maps.toList (getAnns yy)) rest) (getX yy)) (getValue t))+ let toPairs = (\rest -> \t -> Maybes.maybe rest (\yy -> toPairs (Lists.cons (Maps.toList (getAnns yy)) rest) (getX yy)) (getValue t)) in (Maps.fromList (Lists.concat (toPairs [] t))) +-- | Debug if the debug ID matches debugIf :: (t0 -> String -> Compute.Flow t1 ()) debugIf debugId message = let checkAndFail = (\desc -> Logic.ifElse (Equality.equal desc (Just "debugId")) (Flows.fail message) (Flows.pure ())) in (Flows.bind getDebugId checkAndFail) +-- | Fail if the given flag is set failOnFlag :: (Core.Name -> String -> Compute.Flow t0 ()) failOnFlag flag msg = (Flows.bind (hasFlag flag) (\val -> Logic.ifElse val (Flows.fail msg) (Flows.pure ()))) +-- | Get the debug ID from flow state getDebugId :: (Compute.Flow t0 (Maybe String))-getDebugId = (Lexical.withEmptyGraph (Flows.bind (getAttr Constants.key_debugId) (\desc -> Flows.mapOptional Core___.string desc)))+getDebugId = (Lexical.withEmptyGraph (Flows.bind (getAttr Constants.key_debugId) (\desc -> Flows.mapMaybe Core___.string desc))) +-- | Get an attribute from the trace getAttr :: (Core.Name -> Compute.Flow t0 (Maybe Core.Term)) getAttr key = (Compute.Flow (\s0 -> \t0 -> Compute.FlowState { Compute.flowStateValue = (Just (Maps.lookup key (Compute.traceOther t0))), Compute.flowStateState = s0, Compute.flowStateTrace = t0})) +-- | Get an attribute with a default value getAttrWithDefault :: (Core.Name -> Core.Term -> Compute.Flow t0 Core.Term)-getAttrWithDefault key def = (Flows.map (\mval -> Optionals.fromMaybe def mval) (getAttr key))+getAttrWithDefault key def = (Flows.map (\mval -> Maybes.fromMaybe def mval) (getAttr key)) +-- | Get a counter value getCount :: (Core.Name -> Compute.Flow t0 Int) getCount key = (Lexical.withEmptyGraph (Flows.bind (getAttrWithDefault key (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))) Core___.int32)) -- | Get description from annotations map getDescription :: (M.Map Core.Name Core.Term -> Compute.Flow Graph.Graph (Maybe String))-getDescription anns = (Optionals.maybe (Flows.pure Nothing) (\term -> Flows.map Optionals.pure (Core___.string term)) (Maps.lookup (Core.Name "description") anns))+getDescription anns = (Maybes.maybe (Flows.pure Nothing) (\term -> Flows.map Maybes.pure (Core___.string term)) (Maps.lookup (Core.Name "description") anns)) -- | Get a term annotation getTermAnnotation :: (Core.Name -> Core.Term -> Maybe Core.Term) getTermAnnotation key term = (Maps.lookup key (termAnnotationInternal term)) --- | Get term description+-- | Get term description. Peels through TermTypeLambda and TermTypeApplication wrappers (added by inference for polymorphic bindings) to find the description annotation underneath. getTermDescription :: (Core.Term -> Compute.Flow Graph.Graph (Maybe String))-getTermDescription term = (getDescription (termAnnotationInternal term))+getTermDescription term = + let peel = (\t -> (\x -> case x of+ Core.TermTypeLambda v1 -> (peel (Core.typeLambdaBody v1))+ Core.TermTypeApplication v1 -> (peel (Core.typeApplicationTermBody v1))+ _ -> t) t)+ in (getDescription (termAnnotationInternal (peel term))) -- | Get type from annotations getType :: (M.Map Core.Name Core.Term -> Compute.Flow Graph.Graph (Maybe Core.Type))-getType anns = (Optionals.maybe (Flows.pure Nothing) (\dat -> Flows.map Optionals.pure (Core_.type_ dat)) (Maps.lookup Constants.key_type anns))+getType anns = (Flows.bind Monads.getState (\cx -> Maybes.maybe (Flows.pure Nothing) (\dat -> Flows.map Maybes.pure (Monads.withTrace "get type" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx dat)))) (Maps.lookup Constants.key_type anns))) -- | Get a type annotation getTypeAnnotation :: (Core.Name -> Core.Type -> Maybe Core.Term) getTypeAnnotation key typ = (Maps.lookup key (typeAnnotationInternal typ)) -- | Get type classes from term-getTypeClasses :: (Core.Term -> Compute.Flow Graph.Graph (M.Map Core.Name (S.Set Mantle.TypeClass)))-getTypeClasses term = +getTypeClasses :: (Core.Term -> Compute.Flow Graph.Graph (M.Map Core.Name (S.Set Classes.TypeClass)))+getTypeClasses term = (Flows.bind Monads.getState (\cx -> let decodeClass = (\term -> let byName = (Maps.fromList [- (Core.Name "equality", Mantle.TypeClassEquality),- (Core.Name "ordering", Mantle.TypeClassOrdering)])- in (Flows.bind (Core___.unitVariant (Core.Name "hydra.mantle.TypeClass") term) (\fn -> Optionals.maybe (Monads.unexpected "type class" (Core____.term term)) Flows.pure (Maps.lookup fn byName))))- in (Optionals.maybe (Flows.pure Maps.empty) (\term -> Core___.map Core_.name (Core___.setOf decodeClass) term) (getTermAnnotation Constants.key_classes term))+ (Core.Name "equality", Classes.TypeClassEquality),+ (Core.Name "ordering", Classes.TypeClassOrdering)])+ in (Flows.bind (Core___.unitVariant (Core.Name "hydra.classes.TypeClass") term) (\fn -> Maybes.maybe (Monads.unexpected "type class" (Core____.term term)) Flows.pure (Maps.lookup fn byName))))+ in (Maybes.maybe (Flows.pure Maps.empty) (\term -> Core___.map (\t -> Monads.eitherToFlow Util.unDecodingError (Core_.name cx t)) (Core___.setOf decodeClass) term) (getTermAnnotation Constants.key_classes term)))) -- | Get type description getTypeDescription :: (Core.Type -> Compute.Flow Graph.Graph (Maybe String))@@ -96,14 +110,17 @@ -- | For a typed term, decide whether a coder should encode it as a native type expression, or as a Hydra type expression. isNativeType :: (Core.Binding -> Bool) isNativeType el = - let isFlaggedAsFirstClassType = (Optionals.fromMaybe False (Optionals.bind (getTermAnnotation Constants.key_firstClassType (Core.bindingTerm el)) Decoding.boolean))- in (Optionals.maybe False (\ts -> Logic.and (Equality.equal ts (Core.TypeScheme {+ let isFlaggedAsFirstClassType = (Maybes.fromMaybe False (Maybes.map (\_ -> True) (getTermAnnotation Constants.key_firstClassType (Core.bindingTerm el))))+ in (Maybes.maybe False (\ts -> Logic.and (Equality.equal ts (Core.TypeScheme { Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.Type"))})) (Logic.not isFlaggedAsFirstClassType)) (Core.bindingType el))+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.typeSchemeConstraints = Nothing})) (Logic.not isFlaggedAsFirstClassType)) (Core.bindingType el)) +-- | Check if annotations contain description hasDescription :: (M.Map Core.Name t0 -> Bool)-hasDescription anns = (Optionals.isJust (Maps.lookup Constants.key_description anns))+hasDescription anns = (Maybes.isJust (Maps.lookup Constants.key_description anns)) +-- | Check if flag is set hasFlag :: (Core.Name -> Compute.Flow t0 Bool) hasFlag flag = (Lexical.withEmptyGraph (Flows.bind (getAttrWithDefault flag (Core.TermLiteral (Core.LiteralBoolean False))) (\term -> Core___.boolean term))) @@ -111,27 +128,31 @@ hasTypeDescription :: (Core.Type -> Bool) hasTypeDescription typ = (hasDescription (typeAnnotationInternal typ)) +-- | Return a zero-indexed counter for the given key: 0, 1, 2, ... nextCount :: (Core.Name -> Compute.Flow t0 Int) nextCount key = (Flows.bind (getCount key) (\count -> Flows.map (\_ -> count) (putCount key (Math.add count 1)))) -- | Normalize term annotations normalizeTermAnnotations :: (Core.Term -> Core.Term) normalizeTermAnnotations term = - let anns = (termAnnotationInternal term) - stripped = (Rewriting.deannotateTerm term)- in (Logic.ifElse (Maps.null anns) stripped (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = stripped,- Core.annotatedTermAnnotation = anns})))+ let anns = (termAnnotationInternal term)+ in + let stripped = (Rewriting.deannotateTerm term)+ in (Logic.ifElse (Maps.null anns) stripped (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = stripped,+ Core.annotatedTermAnnotation = anns}))) -- | Normalize type annotations normalizeTypeAnnotations :: (Core.Type -> Core.Type) normalizeTypeAnnotations typ = - let anns = (typeAnnotationInternal typ) - stripped = (Rewriting.deannotateType typ)- in (Logic.ifElse (Maps.null anns) stripped (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = stripped,- Core.annotatedTypeAnnotation = anns})))+ let anns = (typeAnnotationInternal typ)+ in + let stripped = (Rewriting.deannotateType typ)+ in (Logic.ifElse (Maps.null anns) stripped (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = stripped,+ Core.annotatedTypeAnnotation = anns}))) +-- | Set an attribute in the trace putAttr :: (Core.Name -> Core.Term -> Compute.Flow t0 ()) putAttr key val = (Compute.Flow (\s0 -> \t0 -> Compute.FlowState { Compute.flowStateValue = (Just ()),@@ -141,131 +162,116 @@ Compute.traceMessages = (Compute.traceMessages t0), Compute.traceOther = (Maps.insert key val (Compute.traceOther t0))}})) +-- | Set counter value putCount :: (Core.Name -> Int -> Compute.Flow t0 ()) putCount key count = (putAttr key (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 count)))) +-- | Reset counter to zero resetCount :: (Core.Name -> Compute.Flow t0 ()) resetCount key = (putAttr key (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))) -setAnnotation :: (Ord t0) => (t0 -> Maybe t1 -> M.Map t0 t1 -> M.Map t0 t1)+-- | Set annotation in map+setAnnotation :: Ord t0 => (t0 -> Maybe t1 -> M.Map t0 t1 -> M.Map t0 t1) setAnnotation key val m = (Maps.alter (\_ -> val) key m) -- | Set description in annotations setDescription :: (Maybe String -> M.Map Core.Name Core.Term -> M.Map Core.Name Core.Term)-setDescription d = (setAnnotation Constants.key_description (Optionals.map (\arg_ -> (\x -> Core.TermLiteral x) ((\x -> Core.LiteralString x) arg_)) d))+setDescription d = (setAnnotation Constants.key_description (Maybes.map (\arg_ -> (\x -> Core.TermLiteral x) ((\x -> Core.LiteralString x) arg_)) d)) -- | Set term annotation setTermAnnotation :: (Core.Name -> Maybe Core.Term -> Core.Term -> Core.Term) setTermAnnotation key val term = - let term_ = (Rewriting.deannotateTerm term) - anns = (setAnnotation key val (termAnnotationInternal term))- in (Logic.ifElse (Maps.null anns) term_ (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = term_,- Core.annotatedTermAnnotation = anns})))+ let term_ = (Rewriting.deannotateTerm term)+ in + let anns = (setAnnotation key val (termAnnotationInternal term))+ in (Logic.ifElse (Maps.null anns) term_ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = term_,+ Core.annotatedTermAnnotation = anns}))) -- | Set term description setTermDescription :: (Maybe String -> Core.Term -> Core.Term)-setTermDescription d = (setTermAnnotation Constants.key_description (Optionals.map (\s -> Core.TermLiteral (Core.LiteralString s)) d))+setTermDescription d = (setTermAnnotation Constants.key_description (Maybes.map (\s -> Core.TermLiteral (Core.LiteralString s)) d)) -- | Set type in annotations setType :: (Maybe Core.Type -> M.Map Core.Name Core.Term -> M.Map Core.Name Core.Term)-setType mt = (setAnnotation Constants.key_type (Optionals.map Core__.type_ mt))+setType mt = (setAnnotation Constants.key_type (Maybes.map Core__.type_ mt)) -- | Set type annotation setTypeAnnotation :: (Core.Name -> Maybe Core.Term -> Core.Type -> Core.Type) setTypeAnnotation key val typ = - let typ_ = (Rewriting.deannotateType typ) - anns = (setAnnotation key val (typeAnnotationInternal typ))- in (Logic.ifElse (Maps.null anns) typ_ (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = typ_,- Core.annotatedTypeAnnotation = anns})))+ let typ_ = (Rewriting.deannotateType typ)+ in + let anns = (setAnnotation key val (typeAnnotationInternal typ))+ in (Logic.ifElse (Maps.null anns) typ_ (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = typ_,+ Core.annotatedTypeAnnotation = anns}))) -- | Set type classes on term-setTypeClasses :: (M.Map Core.Name (S.Set Mantle.TypeClass) -> Core.Term -> Core.Term)-setTypeClasses m = +setTypeClasses :: (M.Map Core.Name (S.Set Classes.TypeClass) -> Core.Term -> Core.Term)+setTypeClasses m term = let encodeClass = (\tc -> (\x -> case x of- Mantle.TypeClassEquality -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.mantle.TypeClass"),+ Classes.TypeClassEquality -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "equality"), Core.fieldTerm = Core.TermUnit}}))- Mantle.TypeClassOrdering -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.mantle.TypeClass"),+ Classes.TypeClassOrdering -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "ordering"),- Core.fieldTerm = Core.TermUnit}}))) tc) - encodePair = (\nameClasses -> - let name = (fst nameClasses) - classes = (snd nameClasses)+ Core.fieldTerm = Core.TermUnit}}))) tc)+ in + let encodePair = (\nameClasses -> + let name = (Pairs.first nameClasses)+ in + let classes = (Pairs.second nameClasses) in (Core__.name name, (Core.TermSet (Sets.fromList (Lists.map encodeClass (Sets.toList classes))))))- encoded = (Logic.ifElse (Maps.null m) Nothing (Just (Core.TermMap (Maps.fromList (Lists.map encodePair (Maps.toList m))))))- in (setTermAnnotation Constants.key_classes encoded)+ in + let encoded = (Logic.ifElse (Maps.null m) Nothing (Just (Core.TermMap (Maps.fromList (Lists.map encodePair (Maps.toList m))))))+ in (setTermAnnotation Constants.key_classes encoded term) -- | Set type description setTypeDescription :: (Maybe String -> Core.Type -> Core.Type)-setTypeDescription d = (setTypeAnnotation Constants.key_description (Optionals.map (\arg_ -> (\x -> Core.TermLiteral x) ((\x -> Core.LiteralString x) arg_)) d))+setTypeDescription d = (setTypeAnnotation Constants.key_description (Maybes.map (\arg_ -> (\x -> Core.TermLiteral x) ((\x -> Core.LiteralString x) arg_)) d)) -- | Get internal term annotations termAnnotationInternal :: (Core.Term -> M.Map Core.Name Core.Term)-termAnnotationInternal = (aggregateAnnotations getAnn Core.annotatedTermSubject Core.annotatedTermAnnotation) - where - getAnn = (\t -> (\x -> case x of- Core.TermAnnotated v1 -> (Just v1)- _ -> Nothing) t)+termAnnotationInternal term = + let getAnn = (\t -> (\x -> case x of+ Core.TermAnnotated v1 -> (Just v1)+ _ -> Nothing) t)+ in (aggregateAnnotations getAnn (\at -> Core.annotatedTermBody at) (\at -> Core.annotatedTermAnnotation at) term) -- | Get internal type annotations typeAnnotationInternal :: (Core.Type -> M.Map Core.Name Core.Term)-typeAnnotationInternal = (aggregateAnnotations getAnn Core.annotatedTypeSubject Core.annotatedTypeAnnotation) - where - getAnn = (\t -> (\x -> case x of- Core.TypeAnnotated v1 -> (Just v1)- _ -> Nothing) t)+typeAnnotationInternal typ = + let getAnn = (\t -> (\x -> case x of+ Core.TypeAnnotated v1 -> (Just v1)+ _ -> Nothing) t)+ in (aggregateAnnotations getAnn (\at -> Core.annotatedTypeBody at) (\at -> Core.annotatedTypeAnnotation at) typ) -- | Create a type element with proper annotations typeElement :: (Core.Name -> Core.Type -> Core.Binding) typeElement name typ = - let schemaTerm = (Core.TermVariable (Core.Name "hydra.core.Type")) - dataTerm = (normalizeTermAnnotations (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (Core__.type_ typ),- Core.annotatedTermAnnotation = (Maps.fromList [- (Constants.key_type, schemaTerm)])})))- in Core.Binding {- Core.bindingName = name,- Core.bindingTerm = dataTerm,- Core.bindingType = (Just (Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = typ}))}+ let schemaTerm = (Core.TermVariable (Core.Name "hydra.core.Type"))+ in + let dataTerm = (normalizeTermAnnotations (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core__.type_ typ),+ Core.annotatedTermAnnotation = (Maps.fromList [+ (Constants.key_type, schemaTerm)])})))+ in Core.Binding {+ Core.bindingName = name,+ Core.bindingTerm = dataTerm,+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.typeSchemeConstraints = Nothing}))} +-- | Execute different flows based on flag whenFlag :: (Core.Name -> Compute.Flow t0 t1 -> Compute.Flow t0 t1 -> Compute.Flow t0 t1) whenFlag flag fthen felse = (Flows.bind (hasFlag flag) (\b -> Logic.ifElse b fthen felse)) --- | Unshadow variables in term-unshadowVariables :: (Core.Term -> Core.Term)-unshadowVariables term = - let freshName = (Flows.map (\n -> Core.Name (Strings.cat2 "s" (Literals.showInt32 n))) (nextCount (Core.Name "unshadow"))) - rewrite = (\recurse -> \term -> - let handleOther = (recurse term)- in (Flows.bind Monads.getState (\state -> - let reserved = (fst state) - subst = (snd state)- in ((\x -> case x of- Core.TermVariable v1 -> (Flows.pure (Core.TermVariable (Optionals.fromMaybe v1 (Maps.lookup v1 subst))))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> - let v = (Core.lambdaParameter v2) - d = (Core.lambdaDomain v2)- body = (Core.lambdaBody v2)- in (Logic.ifElse (Sets.member v reserved) (Flows.bind freshName (\v_ -> Flows.bind (Monads.putState (Sets.insert v_ reserved, (Maps.insert v v_ subst))) (\_ -> Flows.bind (recurse body) (\body_ -> Flows.bind (Monads.putState state) (\_ -> Flows.pure (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = v_,- Core.lambdaDomain = d,- Core.lambdaBody = body_})))))))) (Flows.bind (Monads.putState (Sets.insert v reserved, subst)) (\_ -> Flows.map (\body_ -> Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = v,- Core.lambdaDomain = d,- Core.lambdaBody = body_}))) (recurse body))))- _ -> handleOther) v1)- _ -> handleOther) term))))- in (Optionals.fromJust (Compute.flowStateValue (Compute.unFlow (Rewriting.rewriteTermM rewrite term) (Sets.empty, Maps.empty) Monads.emptyTrace)))-+-- | Provide an one-indexed, integer-valued 'depth' to a flow, where the depth is the number of nested calls. This is useful for generating variable names while avoiding conflicts between the variables of parents and children. E.g. a variable in an outer case/match statement might be "v1", whereas the variable of another case/match statement inside of the first one becomes "v2". See also nextCount. withDepth :: (Core.Name -> (Int -> Compute.Flow t0 t1) -> Compute.Flow t0 t1) withDepth key f = (Flows.bind (getCount key) (\count -> let inc = (Math.add count 1)
src/gen-main/haskell/Hydra/Arity.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Functions dealing with arguments and arity. module Hydra.Arity where@@ -6,12 +8,14 @@ import qualified Hydra.Graph as Graph import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Math as Math-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Find the arity (expected number of arguments) of a function functionArity :: (Core.Function -> Int) functionArity x = case x of Core.FunctionElimination _ -> 1@@ -22,24 +26,30 @@ primitiveArity :: (Graph.Primitive -> Int) primitiveArity arg_ = ((\arg_ -> typeArity (Core.typeSchemeType arg_)) (Graph.primitiveType arg_)) +-- | Find the arity (expected number of arguments) of a term termArity :: (Core.Term -> Int) termArity x = case x of Core.TermApplication v1 -> ((\arg_ -> (\xapp -> Math.sub xapp 1) (termArity arg_)) (Core.applicationFunction v1)) Core.TermFunction v1 -> (functionArity v1) _ -> 0 +-- | Find the arity (expected number of arguments) of a type typeArity :: (Core.Type -> Int) typeArity x = case x of- Core.TypeAnnotated v1 -> (typeArity (Core.annotatedTypeSubject v1))+ Core.TypeAnnotated v1 -> (typeArity (Core.annotatedTypeBody v1)) Core.TypeApplication v1 -> (typeArity (Core.applicationTypeFunction v1)) Core.TypeForall v1 -> (typeArity (Core.forallTypeBody v1)) Core.TypeFunction v1 -> (Math.add 1 (typeArity (Core.functionTypeCodomain v1))) _ -> 0 +-- | Find the arity (expected number of arguments) of a type scheme+typeSchemeArity :: (Core.TypeScheme -> Int)+typeSchemeArity arg_ = (typeArity (Core.typeSchemeType arg_))+ -- | Uncurry a type expression into a list of types, turning a function type a -> b into cons a (uncurryType b) uncurryType :: (Core.Type -> [Core.Type]) uncurryType t = ((\x -> case x of- Core.TypeAnnotated v1 -> (uncurryType (Core.annotatedTypeSubject v1))+ Core.TypeAnnotated v1 -> (uncurryType (Core.annotatedTypeBody v1)) Core.TypeApplication v1 -> (uncurryType (Core.applicationTypeFunction v1)) Core.TypeForall v1 -> (uncurryType (Core.forallTypeBody v1)) Core.TypeFunction v1 -> (Lists.cons (Core.functionTypeDomain v1) (uncurryType (Core.functionTypeCodomain v1)))
src/gen-main/haskell/Hydra/Ast.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model which provides a common syntax tree for Hydra serializers module Hydra.Ast where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -30,8 +33,11 @@ -- | Formatting option for code blocks data BlockStyle = BlockStyle {+ -- | An optional indentation string blockStyleIndent :: (Maybe String),+ -- | Whether to place a newline before the content blockStyleNewlineBeforeContent :: Bool,+ -- | Whether to place a newline after the content blockStyleNewlineAfterContent :: Bool} deriving (Eq, Ord, Read, Show) @@ -46,8 +52,11 @@ -- | An expression enclosed by brackets data BracketExpr = BracketExpr {+ -- | The bracket pair enclosing the expression bracketExprBrackets :: Brackets,+ -- | The expression within the brackets bracketExprEnclosed :: Expr,+ -- | The formatting style for the bracketed block bracketExprStyle :: BlockStyle} deriving (Eq, Ord, Read, Show) @@ -62,7 +71,9 @@ -- | Matching open and close bracket symbols data Brackets = Brackets {+ -- | The opening bracket symbol bracketsOpen :: Symbol,+ -- | The closing bracket symbol bracketsClose :: Symbol} deriving (Eq, Ord, Read, Show) @@ -74,9 +85,13 @@ -- | An abstract expression data Expr = + -- | A constant symbol ExprConst Symbol |+ -- | An indented expression ExprIndent IndentedExpression |+ -- | An operator expression ExprOp OpExpr |+ -- | A bracketed expression ExprBrackets BracketExpr deriving (Eq, Ord, Read, Show) @@ -93,7 +108,9 @@ -- | An expression indented in a certain style data IndentedExpression = IndentedExpression {+ -- | The indentation style indentedExpressionStyle :: IndentStyle,+ -- | The expression to be indented indentedExpressionExpr :: Expr} deriving (Eq, Ord, Read, Show) @@ -105,7 +122,9 @@ -- | Any of several indentation styles data IndentStyle = + -- | Indent all lines with the given string IndentStyleAllLines String |+ -- | Indent only lines after the first with the given string IndentStyleSubsequentLines String deriving (Eq, Ord, Read, Show) @@ -118,9 +137,13 @@ -- | An operator symbol data Op = Op {+ -- | The operator symbol opSymbol :: Symbol,+ -- | The padding around the operator opPadding :: Padding,+ -- | The precedence of the operator opPrecedence :: Precedence,+ -- | The associativity of the operator opAssociativity :: Associativity} deriving (Eq, Ord, Read, Show) @@ -137,8 +160,11 @@ -- | An operator expression data OpExpr = OpExpr {+ -- | The operator opExprOp :: Op,+ -- | The left-hand side operand opExprLhs :: Expr,+ -- | The right-hand side operand opExprRhs :: Expr} deriving (Eq, Ord, Read, Show) @@ -153,7 +179,9 @@ -- | Left and right padding for an operator data Padding = Padding {+ -- | Padding to the left of the operator paddingLeft :: Ws,+ -- | Padding to the right of the operator paddingRight :: Ws} deriving (Eq, Ord, Read, Show) @@ -181,10 +209,15 @@ -- | One of several classes of whitespace data Ws = + -- | No whitespace WsNone |+ -- | A single space WsSpace |+ -- | A line break WsBreak |+ -- | A line break followed by indentation WsBreakAndIndent String |+ -- | Two line breaks WsDoubleBreak deriving (Eq, Ord, Read, Show)
+ src/gen-main/haskell/Hydra/Checking.hs view
@@ -0,0 +1,513 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Type checking and type reconstruction (type-of) for the results of Hydra unification and inference++module Hydra.Checking where++import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute+import qualified Hydra.Constants as Constants+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Monads as Monads+import qualified Hydra.Reflect as Reflect+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Show.Meta as Meta+import qualified Hydra.Substitution as Substitution+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++allEqual :: Eq t0 => ([t0] -> Bool)+allEqual els = (Logic.ifElse (Lists.null els) True (Lists.foldl (\b -> \t -> Logic.and b (Equality.equal t (Lists.head els))) True (Lists.tail els)))++-- | Apply type arguments to a type, substituting forall-bound variables+applyTypeArgumentsToType :: (Typing.TypeContext -> [Core.Type] -> Core.Type -> Compute.Flow t0 Core.Type)+applyTypeArgumentsToType tx typeArgs t = + let nonnull = ((\x -> case x of+ Core.TypeForall v1 -> + let v = (Core.forallTypeParameter v1)+ in + let tbody = (Core.forallTypeBody v1)+ in (applyTypeArgumentsToType tx (Lists.tail typeArgs) (Substitution.substInType (Typing.TypeSubst (Maps.singleton v (Lists.head typeArgs))) tbody))+ _ -> (Flows.fail (Strings.cat [+ "not a forall type: ",+ (Core__.type_ t),+ ". Trying to apply ",+ (Literals.showInt32 (Lists.length typeArgs)),+ " type args: ",+ (Formatting.showList Core__.type_ typeArgs),+ ". Context has vars: {",+ (Strings.intercalate ", " (Lists.map Core.unName (Maps.keys (Typing.typeContextTypes tx)))),+ "}"]))) t)+ in (Logic.ifElse (Lists.null typeArgs) (Flows.bind (checkTypeVariables tx t) (\_ -> Flows.pure t)) nonnull)++-- | Check that a term has no unbound type variables+checkForUnboundTypeVariables :: (Typing.InferenceContext -> Core.Term -> Compute.Flow t0 ())+checkForUnboundTypeVariables cx term0 = + let svars = (Sets.fromList (Maps.keys (Typing.inferenceContextSchemaTypes cx)))+ in + let checkRecursive = (\vars -> \trace -> \lbinding -> \term -> + let recurse = (checkRecursive vars trace lbinding)+ in + let dflt = (Flows.bind (Flows.mapList recurse (Rewriting.subterms term)) (\_ -> Flows.pure ()))+ in + let check = (\typ -> + let freevars = (Rewriting.freeVariablesInType typ)+ in + let badvars = (Sets.difference (Sets.difference freevars vars) svars)+ in (Logic.ifElse (Sets.null badvars) (Flows.pure ()) (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "unbound type variables: {" (Strings.intercalate ", " (Lists.map Core.unName (Sets.toList badvars)))) "} in type ") (Core__.type_ typ)) " at path: ") (Strings.intercalate " >> " (Lists.reverse trace))) (Maybes.maybe "none" (\binding -> Strings.cat2 (Strings.cat2 (Strings.cat2 ". bound term = " (Core__.term (Core.bindingTerm binding))) ". bound type = ") (Maybes.maybe "none" Core__.typeScheme (Core.bindingType binding))) lbinding)))))+ in + let checkOptional = (\m -> Flows.bind (Flows.mapMaybe check m) (\_ -> Flows.pure ()))+ in + let checkOptionalList = (\ml -> Flows.bind (Flows.mapMaybe (\l -> Flows.mapList check l) ml) (\_ -> Flows.pure ()))+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination _ -> dflt+ Core.FunctionLambda v2 -> (Flows.bind (checkOptional (Core.lambdaDomain v2)) (\_ -> recurse (Core.lambdaBody v2)))+ _ -> dflt) v1)+ Core.TermLet v1 -> + let forBinding = (\b -> + let bterm = (Core.bindingTerm b)+ in + let newVars = (Maybes.maybe vars (\ts -> Sets.union vars (Sets.fromList (Core.typeSchemeVariables ts))) (Core.bindingType b))+ in + let newTrace = (Lists.cons (Core.unName (Core.bindingName b)) trace)+ in (checkRecursive newVars newTrace (Just b) bterm))+ in (Flows.bind (Flows.mapList forBinding (Core.letBindings v1)) (\_ -> recurse (Core.letBody v1)))+ Core.TermTypeApplication v1 -> (Flows.bind (check (Core.typeApplicationTermType v1)) (\_ -> recurse (Core.typeApplicationTermBody v1)))+ Core.TermTypeLambda v1 -> (Flows.bind (check (Core.TypeVariable (Core.typeLambdaParameter v1))) (\_ -> recurse (Core.typeLambdaBody v1)))+ _ -> dflt) term))+ in (checkRecursive Sets.empty [+ "top level"] Nothing term0)++-- | Check that a nominal type is applied to the correct number of type arguments+checkNominalApplication :: (Typing.TypeContext -> Core.Name -> [Core.Type] -> Compute.Flow t0 ())+checkNominalApplication tx tname typeArgs = (Flows.bind (Schemas.requireSchemaType (Typing.typeContextInferenceContext tx) tname) (\schemaType -> + let vars = (Core.typeSchemeVariables schemaType)+ in + let body = (Core.typeSchemeType schemaType)+ in + let varslen = (Lists.length vars)+ in + let argslen = (Lists.length typeArgs)+ in (Logic.ifElse (Equality.equal varslen argslen) (Flows.pure ()) (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "nominal type " (Core.unName tname)) " applied to the wrong number of type arguments: ") "(expected ") (Literals.showInt32 varslen)) " arguments, got ") (Literals.showInt32 argslen)) "): ") (Formatting.showList Core__.type_ typeArgs))))))++-- | Ensure all types in a list are equal and return the common type+checkSameType :: (Typing.TypeContext -> String -> [Core.Type] -> Compute.Flow t0 Core.Type)+checkSameType tx desc types = (Logic.ifElse (typesAllEffectivelyEqual tx types) (Flows.pure (Lists.head types)) (Flows.fail (Strings.cat [+ "unequal types ",+ (Formatting.showList Core__.type_ types),+ " in ",+ desc])))++-- | Check that a term has the expected type+checkType :: (Typing.TypeContext -> Core.Term -> Core.Type -> Compute.Flow t0 ())+checkType tx term typ = + let cx = (Typing.typeContextInferenceContext tx)+ in + let vars = (Typing.typeContextTypeVariables tx)+ in (Logic.ifElse Constants.debugInference (Flows.bind (typeOf tx [] term) (\t0 -> Logic.ifElse (typesEffectivelyEqual tx t0 typ) (Flows.pure ()) (Flows.fail (Strings.cat [+ "type checking failed: expected ",+ (Core__.type_ typ),+ " but found ",+ (Core__.type_ t0)])))) (Flows.pure ()))++-- | Sanity-check a type substitution arising from unification. Specifically, check that schema types have not been inappropriately unified with type variables inferred from terms.+checkTypeSubst :: (Typing.InferenceContext -> Typing.TypeSubst -> Compute.Flow t0 Typing.TypeSubst)+checkTypeSubst cx subst = + let s = (Typing.unTypeSubst subst)+ in + let vars = (Sets.fromList (Maps.keys s))+ in + let suspectVars = (Sets.intersection vars (Sets.fromList (Maps.keys (Typing.inferenceContextSchemaTypes cx))))+ in + let isNominal = (\ts -> (\x -> case x of+ Core.TypeRecord _ -> True+ Core.TypeUnion _ -> True+ Core.TypeWrap _ -> True+ _ -> False) (Rewriting.deannotateType (Core.typeSchemeType ts)))+ in + let badVars = (Sets.fromList (Lists.filter (\v -> Maybes.maybe False isNominal (Lexical.dereferenceSchemaType v (Typing.inferenceContextSchemaTypes cx))) (Sets.toList suspectVars)))+ in + let badPairs = (Lists.filter (\p -> Sets.member (Pairs.first p) badVars) (Maps.toList s))+ in + let printPair = (\p -> Strings.cat2 (Strings.cat2 (Core.unName (Pairs.first p)) " --> ") (Core__.type_ (Pairs.second p)))+ in (Logic.ifElse (Sets.null badVars) (Flows.pure subst) (Flows.fail (Strings.cat2 (Strings.cat2 "Schema type(s) incorrectly unified: {" (Strings.intercalate ", " (Lists.map printPair badPairs))) "}")))++-- | Check that all type variables in a type are bound. NOTE: This check is currently disabled to allow phantom type variables from polymorphic instantiation to pass through. The proper fix is to ensure `typeOf` doesn't create fresh variables for post-inference code.+checkTypeVariables :: (t0 -> t1 -> Compute.Flow t2 ())+checkTypeVariables _tx _typ = (Flows.pure ())++-- | Convert an inference context to a type environment by converting type schemes to System F types+toFContext :: (Typing.InferenceContext -> M.Map Core.Name Core.Type)+toFContext cx = (Maps.map Schemas.typeSchemeToFType (Typing.inferenceContextDataTypes cx))++-- | Check whether two lists of types are effectively equal, disregarding type aliases+typeListsEffectivelyEqual :: (Typing.TypeContext -> [Core.Type] -> [Core.Type] -> Bool)+typeListsEffectivelyEqual tx tlist1 tlist2 = (Logic.ifElse (Equality.equal (Lists.length tlist1) (Lists.length tlist2)) (Lists.foldl Logic.and True (Lists.zipWith (typesEffectivelyEqual tx) tlist1 tlist2)) False)++-- | Given a type context, reconstruct the type of a System F term+typeOf :: (Typing.TypeContext -> [Core.Type] -> Core.Term -> Compute.Flow t0 Core.Type)+typeOf tx typeArgs term = + let check = ((\x -> case x of+ Core.TermAnnotated v1 -> (typeOfAnnotatedTerm tx typeArgs v1)+ Core.TermApplication v1 -> (typeOfApplication tx typeArgs v1)+ Core.TermEither v1 -> (typeOfEither tx typeArgs v1)+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationRecord v3 -> (typeOfProjection tx typeArgs v3)+ Core.EliminationUnion v3 -> (typeOfCaseStatement tx typeArgs v3)+ Core.EliminationWrap v3 -> (typeOfUnwrap tx typeArgs v3)) v2)+ Core.FunctionLambda v2 -> (typeOfLambda tx typeArgs v2)+ Core.FunctionPrimitive v2 -> (typeOfPrimitive tx typeArgs v2)) v1)+ Core.TermLet v1 -> (typeOfLet tx typeArgs v1)+ Core.TermList v1 -> (typeOfList tx typeArgs v1)+ Core.TermLiteral v1 -> (typeOfLiteral tx typeArgs v1)+ Core.TermMap v1 -> (typeOfMap tx typeArgs v1)+ Core.TermMaybe v1 -> (typeOfMaybe tx typeArgs v1)+ Core.TermPair v1 -> (typeOfPair tx typeArgs v1)+ Core.TermRecord v1 -> (typeOfRecord tx typeArgs v1)+ Core.TermSet v1 -> (typeOfSet tx typeArgs v1)+ Core.TermTypeApplication v1 -> (typeOfTypeApplication tx typeArgs v1)+ Core.TermTypeLambda v1 -> (typeOfTypeLambda tx typeArgs v1)+ Core.TermUnion v1 -> (typeOfInjection tx typeArgs v1)+ Core.TermUnit -> (typeOfUnit tx typeArgs)+ Core.TermVariable v1 -> (typeOfVariable tx typeArgs v1)+ Core.TermWrap v1 -> (typeOfWrappedTerm tx typeArgs v1)+ _ -> (Flows.fail (Strings.cat [+ "unsupported term variant in typeOf: ",+ (Meta.termVariant (Reflect.termVariant term))]))) term)+ in (Monads.withTrace "typeOf" check)++-- | Reconstruct the type of an annotated term+typeOfAnnotatedTerm :: (Typing.TypeContext -> [Core.Type] -> Core.AnnotatedTerm -> Compute.Flow t0 Core.Type)+typeOfAnnotatedTerm tx typeArgs at = (typeOf tx typeArgs (Core.annotatedTermBody at))++-- | Reconstruct the type of an application term+typeOfApplication :: (Typing.TypeContext -> [Core.Type] -> Core.Application -> Compute.Flow t0 Core.Type)+typeOfApplication tx typeArgs app = + let fun = (Core.applicationFunction app)+ in + let arg = (Core.applicationArgument app)+ in + let tryType = (\tfun -> \targ -> (\x -> case x of+ Core.TypeForall v1 -> (tryType (Core.forallTypeBody v1) targ)+ Core.TypeFunction v1 -> + let dom = (Core.functionTypeDomain v1)+ in + let cod = (Core.functionTypeCodomain v1)+ in (Logic.ifElse (typesEffectivelyEqual tx dom targ) (Flows.pure cod) (Flows.fail (Strings.cat [+ "in application, expected ",+ (Core__.type_ dom),+ " but found ",+ (Core__.type_ targ)])))+ Core.TypeVariable _ -> (Flows.map (\x -> Core.TypeVariable x) Schemas.freshName)+ _ -> (Flows.fail (Strings.cat [+ "left hand side of application (",+ (Core__.term fun),+ ") is not function-typed (",+ (Core__.type_ tfun),+ ")",+ ". types: ",+ (Strings.intercalate ", " (Lists.map (\p -> Strings.cat [+ Core.unName (Pairs.first p),+ ": ",+ (Core__.type_ (Pairs.second p))]) (Maps.toList (Typing.typeContextTypes tx))))]))) tfun)+ in (Flows.bind (typeOf tx [] fun) (\tfun -> Flows.bind (typeOf tx [] arg) (\targ -> Flows.bind (tryType tfun targ) (\t -> applyTypeArgumentsToType tx typeArgs t))))++-- | Reconstruct the type of a case statement+typeOfCaseStatement :: (Typing.TypeContext -> [Core.Type] -> Core.CaseStatement -> Compute.Flow t0 Core.Type)+typeOfCaseStatement tx typeArgs cs = + let tname = (Core.caseStatementTypeName cs)+ in + let dflt = (Core.caseStatementDefault cs)+ in + let cases = (Core.caseStatementCases cs)+ in + let cterms = (Lists.map Core.fieldTerm cases)+ in (Flows.bind (Flows.mapMaybe (\e -> typeOf tx [] e) dflt) (\tdflt -> Flows.bind (Flows.mapList (\e -> typeOf tx [] e) cterms) (\tcterms -> Flows.bind (Flows.mapList (\t -> Flows.map Core.functionTypeCodomain (Core_.functionType t)) tcterms) (\fcods -> + let cods = (Maybes.cat (Lists.cons tdflt (Lists.map Maybes.pure fcods)))+ in (Flows.bind (checkSameType tx "case branches" cods) (\cod -> Flows.pure (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname typeArgs),+ Core.functionTypeCodomain = cod}))))))))++-- | Reconstruct the type of an either value+typeOfEither :: (Typing.TypeContext -> [Core.Type] -> Either Core.Term Core.Term -> Compute.Flow t0 Core.Type)+typeOfEither tx typeArgs et = + let checkLength = + let n = (Lists.length typeArgs)+ in (Logic.ifElse (Equality.equal n 2) (Flows.pure ()) (Flows.fail (Strings.cat2 "either type requires 2 type arguments, got " (Literals.showInt32 n))))+ in (Flows.bind checkLength (\_ -> Eithers.either (\leftTerm -> Flows.bind (typeOf tx [] leftTerm) (\leftType -> Flows.bind (checkTypeVariables tx leftType) (\_ -> Flows.pure (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = leftType,+ Core.eitherTypeRight = (Lists.at 1 typeArgs)}))))) (\rightTerm -> Flows.bind (typeOf tx [] rightTerm) (\rightType -> Flows.bind (checkTypeVariables tx rightType) (\_ -> Flows.pure (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Lists.at 0 typeArgs),+ Core.eitherTypeRight = rightType}))))) et))++-- | Reconstruct the type of a union injection+typeOfInjection :: (Typing.TypeContext -> [Core.Type] -> Core.Injection -> Compute.Flow t0 Core.Type)+typeOfInjection tx typeArgs injection = + let tname = (Core.injectionTypeName injection)+ in + let field = (Core.injectionField injection)+ in + let fname = (Core.fieldName field)+ in + let fterm = (Core.fieldTerm field)+ in (Flows.bind (Schemas.requireSchemaType (Typing.typeContextInferenceContext tx) tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let sbody = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.unionType tname sbody) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> Flows.pure (Schemas.nominalApplication tname typeArgs))))))++-- | Reconstruct the type of a lambda function+typeOfLambda :: (Typing.TypeContext -> [Core.Type] -> Core.Lambda -> Compute.Flow t0 Core.Type)+typeOfLambda tx typeArgs l = + let v = (Core.lambdaParameter l)+ in + let mdom = (Core.lambdaDomain l)+ in + let body = (Core.lambdaBody l)+ in (Flows.bind (Maybes.maybe (Flows.fail "untyped lambda") (\dom -> Flows.bind (checkTypeVariables tx dom) (\_ -> + let types2 = (Maps.insert v dom (Typing.typeContextTypes tx))+ in (Flows.bind (typeOf (Typing.TypeContext {+ Typing.typeContextTypes = types2,+ Typing.typeContextMetadata = (Typing.typeContextMetadata tx),+ Typing.typeContextTypeVariables = (Typing.typeContextTypeVariables tx),+ Typing.typeContextLambdaVariables = (Typing.typeContextLambdaVariables tx),+ Typing.typeContextLetVariables = (Typing.typeContextLetVariables tx),+ Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tx)}) [] body) (\cod -> Flows.bind (checkTypeVariables tx cod) (\_ -> Flows.pure (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = dom,+ Core.functionTypeCodomain = cod}))))))) mdom) (\tbody -> applyTypeArgumentsToType tx typeArgs tbody))++-- | Reconstruct the type of a let binding+typeOfLet :: (Typing.TypeContext -> [Core.Type] -> Core.Let -> Compute.Flow t0 Core.Type)+typeOfLet tx typeArgs letTerm = + let bs = (Core.letBindings letTerm)+ in + let body = (Core.letBody letTerm)+ in + let bnames = (Lists.map Core.bindingName bs)+ in + let bterms = (Lists.map Core.bindingTerm bs)+ in + let bindingType = (\b -> Maybes.maybe (Flows.fail (Strings.cat [+ "untyped let binding: ",+ (Core__.binding b)])) (\ts -> Flows.pure (Schemas.typeSchemeToFType ts)) (Core.bindingType b))+ in (Flows.bind (Flows.mapList bindingType bs) (\btypes -> + let tx2 = Typing.TypeContext {+ Typing.typeContextTypes = (Maps.union (Maps.fromList (Lists.zip bnames btypes)) (Typing.typeContextTypes tx)),+ Typing.typeContextMetadata = (Typing.typeContextMetadata tx),+ Typing.typeContextTypeVariables = (Typing.typeContextTypeVariables tx),+ Typing.typeContextLambdaVariables = (Typing.typeContextLambdaVariables tx),+ Typing.typeContextLetVariables = (Typing.typeContextLetVariables tx),+ Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tx)}+ in (Flows.bind (typeOf tx2 [] body) (\t -> applyTypeArgumentsToType tx typeArgs t))))++-- | Reconstruct the type of a list+typeOfList :: (Typing.TypeContext -> [Core.Type] -> [Core.Term] -> Compute.Flow t0 Core.Type)+typeOfList tx typeArgs els = (Logic.ifElse (Lists.null els) (Logic.ifElse (Equality.equal (Lists.length typeArgs) 1) (Flows.pure (Core.TypeList (Lists.head typeArgs))) (Flows.fail "list type applied to more or less than one argument")) (Flows.bind (Flows.mapList (typeOf tx []) els) (\eltypes -> Flows.bind (checkSameType tx "list elements" eltypes) (\unifiedType -> Flows.bind (checkTypeVariables tx unifiedType) (\_ -> Flows.pure (Core.TypeList unifiedType))))))++-- | Reconstruct the type of a literal+typeOfLiteral :: (Typing.TypeContext -> [Core.Type] -> Core.Literal -> Compute.Flow t0 Core.Type)+typeOfLiteral tx typeArgs lit = + let t = (Core.TypeLiteral (Reflect.literalType lit))+ in (applyTypeArgumentsToType tx typeArgs t)++-- | Reconstruct the type of a map+typeOfMap :: (Typing.TypeContext -> [Core.Type] -> M.Map Core.Term Core.Term -> Compute.Flow t0 Core.Type)+typeOfMap tx typeArgs m = + let nonnull = + let pairs = (Maps.toList m)+ in (Flows.bind (Flows.bind (Flows.mapList (typeOf tx []) (Lists.map Pairs.first pairs)) (checkSameType tx "map keys")) (\kt -> Flows.bind (Flows.bind (Flows.mapList (typeOf tx []) (Lists.map Pairs.second pairs)) (checkSameType tx "map values")) (\vt -> Flows.bind (checkTypeVariables tx kt) (\_ -> Flows.bind (checkTypeVariables tx vt) (\_ -> applyTypeArgumentsToType tx typeArgs (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = kt,+ Core.mapTypeValues = vt})))))))+ in (Logic.ifElse (Maps.null m) (Logic.ifElse (Equality.equal (Lists.length typeArgs) 2) (Flows.pure (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Lists.at 0 typeArgs),+ Core.mapTypeValues = (Lists.at 1 typeArgs)}))) (Flows.fail "map type applied to more or less than two arguments")) nonnull)++-- | Reconstruct the type of an optional value+typeOfMaybe :: (Typing.TypeContext -> [Core.Type] -> Maybe Core.Term -> Compute.Flow t0 Core.Type)+typeOfMaybe tx typeArgs mt = + let forNothing = + let n = (Lists.length typeArgs)+ in (Logic.ifElse (Equality.equal n 1) (Flows.pure (Core.TypeMaybe (Lists.head typeArgs))) (Flows.fail (Strings.cat2 (Strings.cat2 "optional type applied to " (Literals.showInt32 n)) " argument(s). Expected 1.")))+ in + let forJust = (\term -> Flows.bind (Flows.bind (typeOf tx [] term) (\termType -> Flows.bind (checkTypeVariables tx termType) (\_ -> Flows.pure (Core.TypeMaybe termType)))) (\t -> applyTypeArgumentsToType tx typeArgs t))+ in (Maybes.maybe forNothing forJust mt)++-- | Reconstruct the type of a pair+typeOfPair :: (Typing.TypeContext -> [Core.Type] -> (Core.Term, Core.Term) -> Compute.Flow t0 Core.Type)+typeOfPair tx typeArgs p = + let checkLength = + let n = (Lists.length typeArgs)+ in (Logic.ifElse (Equality.equal n 2) (Flows.pure ()) (Flows.fail (Strings.cat2 "pair type requires 2 type arguments, got " (Literals.showInt32 n))))+ in (Flows.bind checkLength (\_ -> + let pairFst = (Pairs.first p)+ in + let pairSnd = (Pairs.second p)+ in (Flows.bind (typeOf tx [] pairFst) (\firstType -> Flows.bind (checkTypeVariables tx firstType) (\_ -> Flows.bind (typeOf tx [] pairSnd) (\secondType -> Flows.bind (checkTypeVariables tx secondType) (\_ -> Flows.pure (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = firstType,+ Core.pairTypeSecond = secondType})))))))))++-- | Reconstruct the type of a primitive function+typeOfPrimitive :: (Typing.TypeContext -> [Core.Type] -> Core.Name -> Compute.Flow t0 Core.Type)+typeOfPrimitive tx typeArgs name = (Flows.bind (Maybes.maybe (Flows.fail (Strings.cat [+ "no such primitive: ",+ (Core.unName name)])) Schemas.instantiateTypeScheme (Maps.lookup name (Typing.inferenceContextPrimitiveTypes (Typing.typeContextInferenceContext tx)))) (\ts -> + let t = (Schemas.typeSchemeToFType ts)+ in (applyTypeArgumentsToType tx typeArgs t)))++-- | Reconstruct the type of a record projection+typeOfProjection :: (Typing.TypeContext -> [Core.Type] -> Core.Projection -> Compute.Flow t0 Core.Type)+typeOfProjection tx typeArgs p = + let tname = (Core.projectionTypeName p)+ in + let fname = (Core.projectionField p)+ in (Flows.bind (Schemas.requireSchemaType (Typing.typeContextInferenceContext tx) tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let sbody = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.recordType tname sbody) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> + let subst = (Typing.TypeSubst (Maps.fromList (Lists.zip svars typeArgs)))+ in + let sftyp = (Substitution.substInType subst ftyp)+ in (Flows.pure (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname typeArgs),+ Core.functionTypeCodomain = sftyp}))))))))++-- | Reconstruct the type of a record+typeOfRecord :: (Typing.TypeContext -> [Core.Type] -> Core.Record -> Compute.Flow t0 Core.Type)+typeOfRecord tx typeArgs record = + let tname = (Core.recordTypeName record)+ in + let fields = (Core.recordFields record)+ in (Flows.bind (Flows.mapList (typeOf tx []) (Lists.map Core.fieldTerm fields)) (\ftypes -> Flows.bind (Flows.mapList (checkTypeVariables tx) ftypes) (\_ -> Flows.pure (Schemas.nominalApplication tname typeArgs))))++-- | Reconstruct the type of a set+typeOfSet :: (Typing.TypeContext -> [Core.Type] -> S.Set Core.Term -> Compute.Flow t0 Core.Type)+typeOfSet tx typeArgs els = (Logic.ifElse (Sets.null els) (Logic.ifElse (Equality.equal (Lists.length typeArgs) 1) (Flows.pure (Core.TypeSet (Lists.head typeArgs))) (Flows.fail "set type applied to more or less than one argument")) (Flows.bind (Flows.mapList (typeOf tx []) (Sets.toList els)) (\eltypes -> Flows.bind (checkSameType tx "set elements" eltypes) (\unifiedType -> Flows.bind (checkTypeVariables tx unifiedType) (\_ -> Flows.pure (Core.TypeSet unifiedType))))))++-- | Reconstruct the type of a type application term+typeOfTypeApplication :: (Typing.TypeContext -> [Core.Type] -> Core.TypeApplicationTerm -> Compute.Flow t0 Core.Type)+typeOfTypeApplication tx typeArgs tyapp = + let body = (Core.typeApplicationTermBody tyapp)+ in + let t = (Core.typeApplicationTermType tyapp)+ in (typeOf tx (Lists.cons t typeArgs) body)++-- | Reconstruct the type of a type lambda (type abstraction) term+typeOfTypeLambda :: (Typing.TypeContext -> [Core.Type] -> Core.TypeLambda -> Compute.Flow t0 Core.Type)+typeOfTypeLambda tx typeArgs tl = + let v = (Core.typeLambdaParameter tl)+ in + let body = (Core.typeLambdaBody tl)+ in + let vars = (Typing.typeContextTypeVariables tx)+ in + let tx2 = Typing.TypeContext {+ Typing.typeContextTypes = (Typing.typeContextTypes tx),+ Typing.typeContextMetadata = (Typing.typeContextMetadata tx),+ Typing.typeContextTypeVariables = (Sets.insert v vars),+ Typing.typeContextLambdaVariables = (Typing.typeContextLambdaVariables tx),+ Typing.typeContextLetVariables = (Typing.typeContextLetVariables tx),+ Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tx)}+ in (Flows.bind (typeOf tx2 [] body) (\t1 -> Flows.bind (checkTypeVariables tx2 t1) (\_ -> applyTypeArgumentsToType tx typeArgs (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = v,+ Core.forallTypeBody = t1})))))++-- | Reconstruct the type of the unit term+typeOfUnit :: (Typing.TypeContext -> [Core.Type] -> Compute.Flow t0 Core.Type)+typeOfUnit tx typeArgs = (applyTypeArgumentsToType tx typeArgs Core.TypeUnit)++-- | Reconstruct the type of an unwrap operation+typeOfUnwrap :: (Typing.TypeContext -> [Core.Type] -> Core.Name -> Compute.Flow t0 Core.Type)+typeOfUnwrap tx typeArgs tname = (Flows.bind (Schemas.requireSchemaType (Typing.typeContextInferenceContext tx) tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let sbody = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.wrappedType tname sbody) (\wrapped -> + let subst = (Typing.TypeSubst (Maps.fromList (Lists.zip svars typeArgs)))+ in + let swrapped = (Substitution.substInType subst wrapped)+ in (Flows.pure (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname typeArgs),+ Core.functionTypeCodomain = swrapped})))))))++-- | Reconstruct the type of a variable+typeOfVariable :: (Typing.TypeContext -> [Core.Type] -> Core.Name -> Compute.Flow t0 Core.Type)+typeOfVariable tx typeArgs name = + let rawType = (Maps.lookup name (Typing.typeContextTypes tx))+ in + let failMsg = (Flows.fail (Strings.cat [+ "unbound variable: ",+ (Core.unName name),+ ". Variables: {",+ (Strings.intercalate ", " (Lists.map Core.unName (Maps.keys (Typing.typeContextTypes tx)))),+ "}"]))+ in (Flows.bind (Maybes.maybe failMsg (\t -> Logic.ifElse (Lists.null typeArgs) (Schemas.instantiateType t) (Flows.pure t)) rawType) (\t -> applyTypeArgumentsToType tx typeArgs t))++-- | Reconstruct the type of a wrapped term+typeOfWrappedTerm :: (Typing.TypeContext -> [Core.Type] -> Core.WrappedTerm -> Compute.Flow t0 Core.Type)+typeOfWrappedTerm tx typeArgs wt = + let tname = (Core.wrappedTermTypeName wt)+ in + let body = (Core.wrappedTermBody wt)+ in (Flows.bind (typeOf tx [] body) (\btype -> Flows.bind (checkTypeVariables tx btype) (\_ -> Flows.pure (Schemas.nominalApplication tname typeArgs))))++-- | Check if a type contains any type variable from the current scope+containsInScopeTypeVars :: (Typing.TypeContext -> Core.Type -> Bool)+containsInScopeTypeVars tx t = + let vars = (Typing.typeContextTypeVariables tx)+ in + let freeVars = (Rewriting.freeVariablesInTypeSimple t)+ in (Logic.not (Sets.null (Sets.intersection vars freeVars)))++-- | Normalize free type variables in a type to canonical names based on order of first occurrence. This allows comparing types that differ only in the naming of free type variables.+normalizeTypeFreeVars :: (Core.Type -> Core.Type)+normalizeTypeFreeVars typ = + let collectVars = (\acc -> \t -> (\x -> case x of+ Core.TypeVariable v1 -> (Logic.ifElse (Maps.member v1 acc) acc (Maps.insert v1 (Core.Name (Strings.cat2 "_tv" (Literals.showInt32 (Maps.size acc)))) acc))+ _ -> acc) t)+ in + let subst = (Rewriting.foldOverType Coders.TraversalOrderPre collectVars Maps.empty typ)+ in (Rewriting.substituteTypeVariables subst typ)++-- | Check whether a list of types are effectively equal, disregarding type aliases and free type variable naming. Also treats free type variables (not in schema) as wildcards, since inference has already verified consistency.+typesAllEffectivelyEqual :: (Typing.TypeContext -> [Core.Type] -> Bool)+typesAllEffectivelyEqual tx tlist = + let types = (Typing.inferenceContextSchemaTypes (Typing.typeContextInferenceContext tx))+ in + let containsFreeVar = (\t -> + let allVars = (Rewriting.freeVariablesInTypeSimple t)+ in + let schemaNames = (Sets.fromList (Maps.keys types))+ in (Logic.not (Sets.null (Sets.difference allVars schemaNames))))+ in + let anyContainsFreeVar = (Lists.foldl (\acc -> \t -> Logic.or acc (containsFreeVar t)) False tlist)+ in (Logic.ifElse anyContainsFreeVar True (Logic.ifElse (allEqual (Lists.map (\t -> normalizeTypeFreeVars t) tlist)) True (allEqual (Lists.map (\t -> normalizeTypeFreeVars (Rewriting.deannotateTypeRecursive (Rewriting.replaceTypedefs types t))) tlist))))++-- | Check whether two types are effectively equal, disregarding type aliases, forall quantifiers, and treating in-scope type variables as wildcards+typesEffectivelyEqual :: (Typing.TypeContext -> Core.Type -> Core.Type -> Bool)+typesEffectivelyEqual tx t1 t2 = (Logic.or (containsInScopeTypeVars tx t1) (Logic.or (containsInScopeTypeVars tx t2) (typesAllEffectivelyEqual tx [+ Schemas.fullyStripAndNormalizeType t1,+ (Schemas.fullyStripAndNormalizeType t2)])))
+ src/gen-main/haskell/Hydra/Classes.hs view
@@ -0,0 +1,25 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Type classes++module Hydra.Classes where++import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Any of a small number of built-in type classes+data TypeClass = + TypeClassEquality |+ TypeClassOrdering + deriving (Eq, Ord, Read, Show)++_TypeClass = (Core.Name "hydra.classes.TypeClass")++_TypeClass_equality = (Core.Name "equality")++_TypeClass_ordering = (Core.Name "ordering")
+ src/gen-main/haskell/Hydra/CodeGeneration.hs view
@@ -0,0 +1,296 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Pure code generation pipeline for bootstrapping Hydra across languages.++module Hydra.CodeGeneration where++import qualified Hydra.Adapt.Simple as Simple+import qualified Hydra.Annotations as Annotations+import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Decode.Module as Module+import qualified Hydra.Encode.Module as Module_+import qualified Hydra.Graph as Graph+import qualified Hydra.Inference as Inference+import qualified Hydra.Json.Decode as Decode+import qualified Hydra.Json.Encode as Encode+import qualified Hydra.Json.Model as Model+import qualified Hydra.Json.Writer as Writer+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Module as Module__+import qualified Hydra.Monads as Monads+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Convert a namespace to a file path (e.g., hydra.core -> hydra/core)+namespaceToPath :: (Module__.Namespace -> String)+namespaceToPath ns = (Strings.intercalate "/" (Strings.splitOn "." (Module__.unNamespace ns)))++-- | Strip TypeSchemes from term bindings in a module, preserving type binding TypeSchemes. JSON-loaded modules carry inferred TypeSchemes from the original compilation. After adaptation (e.g., bigfloat -> float64), these TypeSchemes become stale and can cause inference errors. Stripping them allows the inference engine to reconstruct correct TypeSchemes from scratch.+stripModuleTypeSchemes :: (Module__.Module -> Module__.Module)+stripModuleTypeSchemes m = + let stripIfTerm = (\b -> Logic.ifElse (Annotations.isNativeType b) b (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Core.bindingTerm b),+ Core.bindingType = Nothing}))+ in Module__.Module {+ Module__.moduleNamespace = (Module__.moduleNamespace m),+ Module__.moduleElements = (Lists.map stripIfTerm (Module__.moduleElements m)),+ Module__.moduleTermDependencies = (Module__.moduleTermDependencies m),+ Module__.moduleTypeDependencies = (Module__.moduleTypeDependencies m),+ Module__.moduleDescription = (Module__.moduleDescription m)}++-- | Compute transitive closure of module dependencies+transitiveDeps :: ((Module__.Module -> [Module__.Namespace]) -> M.Map Module__.Namespace Module__.Module -> [Module__.Module] -> S.Set Module__.Namespace)+transitiveDeps getDeps nsMap startMods = + let initialDeps = (Sets.fromList (Lists.concat (Lists.map (\m -> Lists.filter (\dep -> Logic.not (Equality.equal dep (Module__.moduleNamespace m))) (getDeps m)) startMods)))+ in + let go = (\pending -> \visited -> Logic.ifElse (Sets.null pending) visited ( + let newVisited = (Sets.union visited pending)+ in + let nextDeps = (Sets.fromList (Lists.concat (Lists.map (\nsv -> Maybes.maybe [] (\depMod -> getDeps depMod) (Maps.lookup nsv nsMap)) (Sets.toList pending))))+ in + let newPending = (Sets.difference nextDeps newVisited)+ in (go newPending newVisited)))+ in (go initialDeps Sets.empty)++-- | Compute transitive closure of term dependencies for a set of modules+moduleTermDepsTransitive :: (M.Map Module__.Namespace Module__.Module -> [Module__.Module] -> [Module__.Module])+moduleTermDepsTransitive nsMap modules = + let closure = (Sets.union (transitiveDeps (\m -> Module__.moduleTermDependencies m) nsMap modules) (Sets.fromList (Lists.map (\m -> Module__.moduleNamespace m) modules)))+ in (Maybes.cat (Lists.map (\n -> Maps.lookup n nsMap) (Sets.toList closure)))++-- | Compute transitive closure of type dependencies for a set of modules+moduleTypeDepsTransitive :: (M.Map Module__.Namespace Module__.Module -> [Module__.Module] -> [Module__.Module])+moduleTypeDepsTransitive nsMap modules = + let termMods = (moduleTermDepsTransitive nsMap modules)+ in + let typeNamespaces = (Sets.toList (transitiveDeps (\m -> Module__.moduleTypeDependencies m) nsMap termMods))+ in (Maybes.cat (Lists.map (\n -> Maps.lookup n nsMap) typeNamespaces))++-- | Build a graph from universe modules and working modules, using an explicit bootstrap graph+modulesToGraph :: (Graph.Graph -> [Module__.Module] -> [Module__.Module] -> Graph.Graph)+modulesToGraph bsGraph universeModules modules = + let universe = (Maps.fromList (Lists.map (\m -> (Module__.moduleNamespace m, m)) (Lists.concat2 universeModules modules)))+ in + let schemaModules = (moduleTypeDepsTransitive universe modules)+ in + let dataModules = (moduleTermDepsTransitive universe modules)+ in + let schemaElements = (Lists.filter (\e -> Annotations.isNativeType e) (Lists.concat (Lists.map (\m -> Module__.moduleElements m) (Lists.concat2 schemaModules modules))))+ in + let dataElements = (Lists.filter (\e -> Logic.not (Annotations.isNativeType e)) (Lists.concat (Lists.map (\m -> Module__.moduleElements m) dataModules)))+ in + let schemaGraph = (Lexical.elementsToGraph bsGraph Nothing schemaElements)+ in (Lexical.elementsToGraph bsGraph (Just schemaGraph) dataElements)++-- | Pure core of code generation: given a coder, language, flags, bootstrap graph, universe, and modules to generate, produce a list of (filePath, content) pairs.+generateSourceFiles :: Ord t0 => ((Module__.Module -> [Module__.Definition] -> Compute.Flow Graph.Graph (M.Map t0 t1)) -> Coders.Language -> Bool -> Bool -> Bool -> Bool -> Graph.Graph -> [Module__.Module] -> [Module__.Module] -> Compute.Flow Graph.Graph [(t0, t1)])+generateSourceFiles printDefinitions lang doInfer doExpand doHoistCaseStatements doHoistPolymorphicLetBindings bsGraph universeModules modsToGenerate = + let namespaceMap = (Maps.fromList (Lists.map (\m -> (Module__.moduleNamespace m, m)) (Lists.concat2 universeModules modsToGenerate)))+ in + let constraints = (Coders.languageConstraints lang)+ in + let isTypeModule = (\mod -> Logic.not (Lists.null (Lists.filter (\e -> Annotations.isNativeType e) (Module__.moduleElements mod))))+ in + let partitioned = (Lists.partition isTypeModule modsToGenerate)+ in + let typeModulesToGenerate = (Pairs.first partitioned)+ in + let termModulesToGenerate = (Pairs.second partitioned)+ in + let schemaMods = (moduleTypeDepsTransitive namespaceMap modsToGenerate)+ in + let schemaElements = (Lists.filter (\e -> Annotations.isNativeType e) (Lists.concat (Lists.map (\m -> Module__.moduleElements m) (Lists.concat2 schemaMods typeModulesToGenerate))))+ in + let dataMods = (moduleTermDepsTransitive namespaceMap modsToGenerate)+ in + let dataElements = (Lists.concat (Lists.map (\m -> Module__.moduleElements m) dataMods))+ in + let schemaGraph = (Lexical.elementsToGraph bsGraph Nothing schemaElements)+ in + let dataGraph = (Lexical.elementsToGraph bsGraph (Just schemaGraph) dataElements)+ in (Flows.bind (Logic.ifElse (Lists.null typeModulesToGenerate) (Flows.pure []) (Monads.withTrace "generate type modules" ( + let nameLists = (Lists.map (\m -> Lists.map (\e -> Core.bindingName e) (Lists.filter (\e -> Annotations.isNativeType e) (Module__.moduleElements m))) typeModulesToGenerate)+ in (Flows.bind (Simple.schemaGraphToDefinitions constraints schemaGraph nameLists) (\schemaResult -> + let defLists = (Pairs.second schemaResult)+ in (Monads.withState schemaGraph (Flows.map (\xs -> Lists.concat xs) (Flows.mapList (\p -> + let mod = (Pairs.first p)+ in + let defs = (Pairs.second p)+ in (Monads.withTrace (Strings.cat2 "type module " (Module__.unNamespace (Module__.moduleNamespace mod))) (Flows.map (\m -> Maps.toList m) (printDefinitions mod (Lists.map (\d -> Module__.DefinitionType d) defs))))) (Lists.zip typeModulesToGenerate defLists))))))))) (\schemaFiles -> Flows.bind (Logic.ifElse (Lists.null termModulesToGenerate) (Flows.pure []) (Monads.withTrace "generate term modules" ( + let namespaces = (Lists.map (\m -> Module__.moduleNamespace m) termModulesToGenerate)+ in (Flows.bind (Simple.dataGraphToDefinitions constraints doInfer doExpand doHoistCaseStatements doHoistPolymorphicLetBindings dataGraph namespaces) (\dataResult -> + let g1 = (Pairs.first dataResult)+ in + let defLists = (Pairs.second dataResult)+ in + let refreshModule = (\els -> \m -> Module__.Module {+ Module__.moduleNamespace = (Module__.moduleNamespace m),+ Module__.moduleElements = (Maybes.cat (Lists.map (\e -> Lists.find (\b -> Equality.equal (Core.bindingName b) (Core.bindingName e)) els) (Module__.moduleElements m))),+ Module__.moduleTermDependencies = (Module__.moduleTermDependencies m),+ Module__.moduleTypeDependencies = (Module__.moduleTypeDependencies m),+ Module__.moduleDescription = (Module__.moduleDescription m)})+ in + let refreshedMods = (Lists.map (\m -> refreshModule (Graph.graphElements g1) m) termModulesToGenerate)+ in (Monads.withState g1 (Flows.map (\xs -> Lists.concat xs) (Flows.mapList (\p -> + let mod = (Pairs.first p)+ in + let defs = (Pairs.second p)+ in (Monads.withTrace (Strings.cat2 "term module " (Module__.unNamespace (Module__.moduleNamespace mod))) (Flows.map (\m -> Maps.toList m) (printDefinitions mod (Lists.map (\d -> Module__.DefinitionTerm d) defs))))) (Lists.zip refreshedMods defLists))))))))) (\termFiles -> Flows.pure (Lists.concat2 schemaFiles termFiles))))++-- | Format a term binding for the lexicon+formatTermBinding :: (Core.Binding -> String)+formatTermBinding binding = + let name = (Core.unName (Core.bindingName binding))+ in + let typeStr = (Maybes.maybe "?" (\scheme -> Core__.typeScheme scheme) (Core.bindingType binding))+ in (Strings.cat2 (Strings.cat2 (Strings.cat2 " " name) " : ") typeStr)++-- | Format a primitive for the lexicon+formatPrimitive :: (Graph.Primitive -> String)+formatPrimitive prim = + let name = (Core.unName (Graph.primitiveName prim))+ in + let typeStr = (Core__.typeScheme (Graph.primitiveType prim))+ in (Strings.cat2 (Strings.cat2 (Strings.cat2 " " name) " : ") typeStr)++-- | Format a type binding for the lexicon+formatTypeBinding :: (Core.Binding -> Compute.Flow Graph.Graph String)+formatTypeBinding binding = (Flows.bind Monads.getState (\g -> Flows.bind (Monads.eitherToFlow Util.unDecodingError (Core_.type_ g (Core.bindingTerm binding))) (\typ -> Flows.pure (Strings.cat2 (Strings.cat2 (Strings.cat2 " " (Core.unName (Core.bindingName binding))) " = ") (Core__.type_ typ)))))++-- | Build a schema map (Name -> Type) from a graph's schema+buildSchemaMap :: (Graph.Graph -> M.Map Core.Name Core.Type)+buildSchemaMap g = (Maybes.maybe Maps.empty (\schemaGraph -> Maps.fromList (Maybes.cat (Lists.map (\binding -> + let result = (Core_.type_ schemaGraph (Core.bindingTerm binding))+ in (Eithers.either (\_err -> Nothing) (\typ -> Just (Core.bindingName binding, (Rewriting.deannotateType typ))) result)) (Graph.graphElements schemaGraph)))) (Graph.graphSchema g))++-- | Convert a generated Module into a Source module+moduleToSourceModule :: (Module__.Module -> Module__.Module)+moduleToSourceModule m = + let sourceNs = (Module__.Namespace (Strings.cat2 "hydra.sources." (Strings.intercalate "." (Lists.drop 1 (Strings.splitOn "." (Module__.unNamespace (Module__.moduleNamespace m)))))))+ in + let modTypeNs = (Module__.Namespace "hydra.module")+ in + let moduleBinding = Core.Binding {+ Core.bindingName = (Core.Name (Strings.cat2 (Module__.unNamespace sourceNs) ".module_")),+ Core.bindingTerm = (Module_.module_ m),+ Core.bindingType = Nothing}+ in Module__.Module {+ Module__.moduleNamespace = sourceNs,+ Module__.moduleElements = [+ moduleBinding],+ Module__.moduleTermDependencies = [+ modTypeNs],+ Module__.moduleTypeDependencies = [+ modTypeNs],+ Module__.moduleDescription = (Just (Strings.cat2 "Source module for " (Module__.unNamespace (Module__.moduleNamespace m))))}++-- | Generate the lexicon content from a graph+generateLexicon :: (Graph.Graph -> Compute.Flow Graph.Graph String)+generateLexicon graph = + let bindings = (Graph.graphElements graph)+ in + let primitives = (Maps.elems (Graph.graphPrimitives graph))+ in + let partitioned = (Lists.partition (\b -> Annotations.isNativeType b) bindings)+ in + let typeBindings = (Pairs.first partitioned)+ in + let termBindings = (Pairs.second partitioned)+ in + let sortedPrimitives = (Lists.sortOn (\p -> Graph.primitiveName p) primitives)+ in + let sortedTypes = (Lists.sortOn (\b -> Core.bindingName b) typeBindings)+ in + let sortedTerms = (Lists.sortOn (\b -> Core.bindingName b) termBindings)+ in (Flows.bind (Flows.mapList (\b -> formatTypeBinding b) sortedTypes) (\typeLines -> + let termLines = (Lists.map (\b -> formatTermBinding b) sortedTerms)+ in + let primitiveLines = (Lists.map (\p -> formatPrimitive p) sortedPrimitives)+ in (Flows.pure (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "Primitives:\n" (Strings.unlines primitiveLines)) "\nTypes:\n") (Strings.unlines typeLines)) "\nTerms:\n") (Strings.unlines termLines)))))++-- | Convert a Module to a JSON string+moduleToJson :: (Module__.Module -> Either String String)+moduleToJson m = + let term = (Module_.module_ m)+ in (Eithers.map (\json -> Writer.printJson json) (Encode.toJson term))++-- | Perform type inference on modules and reconstruct with inferred types+inferModules :: (Graph.Graph -> [Module__.Module] -> [Module__.Module] -> Compute.Flow t0 [Module__.Module])+inferModules bsGraph universeMods targetMods = + let g0 = (modulesToGraph bsGraph universeMods universeMods)+ in (Flows.bind (Inference.inferGraphTypes g0) (\g1 -> + let inferredElements = (Graph.graphElements g1)+ in + let isTypeModule = (\mod -> Lists.null (Lists.filter (\e -> Logic.not (Annotations.isNativeType e)) (Module__.moduleElements mod)))+ in + let refreshModule = (\m -> Logic.ifElse (isTypeModule m) m (Module__.Module {+ Module__.moduleNamespace = (Module__.moduleNamespace m),+ Module__.moduleElements = (Maybes.cat (Lists.map (\e -> Lists.find (\b -> Equality.equal (Core.bindingName b) (Core.bindingName e)) inferredElements) (Module__.moduleElements m))),+ Module__.moduleTermDependencies = (Module__.moduleTermDependencies m),+ Module__.moduleTypeDependencies = (Module__.moduleTypeDependencies m),+ Module__.moduleDescription = (Module__.moduleDescription m)}))+ in (Flows.pure (Lists.map refreshModule targetMods))))++-- | Generate encoder or decoder modules for a list of type modules+generateCoderModules :: ((t0 -> Compute.Flow Graph.Graph (Maybe t1)) -> Graph.Graph -> [Module__.Module] -> [t0] -> Compute.Flow t2 [t1])+generateCoderModules codec bsGraph universeModules typeModules = + let graph = (modulesToGraph bsGraph universeModules universeModules)+ in (Maybes.maybe (Flows.fail "No schema graph available") (\schemaGraph -> Monads.withState schemaGraph (Flows.map (\results -> Maybes.cat results) (Flows.mapList codec typeModules))) (Graph.graphSchema graph))++-- | Perform type inference and generate the lexicon for a set of modules+inferAndGenerateLexicon :: (Graph.Graph -> [Module__.Module] -> Compute.Flow t0 String)+inferAndGenerateLexicon bsGraph kernelModules = + let g0 = (modulesToGraph bsGraph kernelModules kernelModules)+ in (Flows.bind (Inference.inferGraphTypes g0) (\g1 -> Monads.withState g1 (generateLexicon g1)))++-- | Escape unescaped control characters inside JSON string literals+escapeControlCharsInJson :: ([Int] -> [Int])+escapeControlCharsInJson input = + let hexDigit = (\n -> Logic.ifElse (Equality.lt n 10) (Math.add 48 n) (Math.add 97 (Math.sub n 10)))+ in + let escapeToUnicode = (\b -> [+ 92,+ 117,+ 48,+ 48,+ (hexDigit (Math.div b 16)),+ (hexDigit (Math.mod b 16))])+ in + let go = (\inStr -> \esc -> \bytes -> Logic.ifElse (Lists.null bytes) [] ( + let b = (Lists.head bytes)+ in + let bs = (Lists.tail bytes)+ in (Logic.ifElse esc (Lists.cons b (go inStr False bs)) (Logic.ifElse (Logic.and (Equality.equal b 92) inStr) (Lists.cons b (go inStr True bs)) (Logic.ifElse (Equality.equal b 34) (Lists.cons b (go (Logic.not inStr) False bs)) (Logic.ifElse (Logic.and inStr (Equality.lt b 32)) (Lists.concat2 (escapeToUnicode b) (go inStr False bs)) (Lists.cons b (go inStr False bs))))))))+ in (go False False input)++-- | Decode a single module from a JSON value+decodeModuleFromJson :: (Graph.Graph -> [Module__.Module] -> Bool -> Model.Value -> Either String Module__.Module)+decodeModuleFromJson bsGraph universeModules doStripTypeSchemes jsonVal = + let graph = (modulesToGraph bsGraph universeModules universeModules)+ in + let schemaMap = (buildSchemaMap graph)+ in + let modType = (Core.TypeVariable (Core.Name "hydra.module.Module"))+ in (Eithers.either (\err -> Left err) (\term -> Eithers.either (\decErr -> Left (Util.unDecodingError decErr)) (\mod -> Right (Logic.ifElse doStripTypeSchemes (stripModuleTypeSchemes mod) mod)) (Module.module_ graph term)) (Decode.fromJson schemaMap modType jsonVal))
+ src/gen-main/haskell/Hydra/CoderUtils.hs view
@@ -0,0 +1,367 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Common utilities for language coders, providing shared patterns for term decomposition and analysis.++module Hydra.CoderUtils where++import qualified Hydra.Annotations as Annotations+import qualified Hydra.Arity as Arity+import qualified Hydra.Checking as Checking+import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Monads as Monads+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Normalize a comment string for consistent output across coders+normalizeComment :: (String -> String)+normalizeComment s = + let stripped = (Formatting.stripLeadingAndTrailingWhitespace s)+ in (Logic.ifElse (Strings.null stripped) "" ( + let lastIdx = (Math.sub (Strings.length stripped) 1)+ in + let lastChar = (Strings.charAt lastIdx stripped)+ in (Logic.ifElse (Equality.equal lastChar 46) stripped (Strings.cat2 stripped "."))))++-- | Gather applications from a term, returning (args, baseTerm)+gatherApplications :: (Core.Term -> ([Core.Term], Core.Term))+gatherApplications term = + let go = (\args -> \t -> (\x -> case x of+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in (go (Lists.cons rhs args) lhs)+ _ -> (args, t)) (Rewriting.deannotateTerm t))+ in (go [] term)++-- | Gather term arguments, stripping type-level constructs+gatherArgs :: (Core.Term -> [Core.Term] -> (Core.Term, [Core.Term]))+gatherArgs term args = ((\x -> case x of+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in (gatherArgs lhs (Lists.cons rhs args))+ Core.TermTypeLambda v1 -> + let body = (Core.typeLambdaBody v1)+ in (gatherArgs body args)+ Core.TermTypeApplication v1 -> + let body = (Core.typeApplicationTermBody v1)+ in (gatherArgs body args)+ _ -> (term, args)) (Rewriting.deannotateTerm term))++-- | Gather term and type arguments from a term+gatherArgsWithTypeApps :: (Core.Term -> [Core.Term] -> [Core.Type] -> (Core.Term, ([Core.Term], [Core.Type])))+gatherArgsWithTypeApps term args tyArgs = ((\x -> case x of+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in (gatherArgsWithTypeApps lhs (Lists.cons rhs args) tyArgs)+ Core.TermTypeLambda v1 -> + let body = (Core.typeLambdaBody v1)+ in (gatherArgsWithTypeApps body args tyArgs)+ Core.TermTypeApplication v1 -> + let body = (Core.typeApplicationTermBody v1)+ in + let typ = (Core.typeApplicationTermType v1)+ in (gatherArgsWithTypeApps body args (Lists.cons typ tyArgs))+ _ -> (term, (args, tyArgs))) (Rewriting.deannotateTerm term))++-- | Check if a term can be encoded as a simple assignment+isSimpleAssignment :: (Core.Term -> Bool)+isSimpleAssignment term = ((\x -> case x of+ Core.TermAnnotated v1 -> (isSimpleAssignment (Core.annotatedTermBody v1))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda _ -> False+ _ -> True) v1)+ Core.TermLet _ -> False+ Core.TermTypeLambda _ -> False+ Core.TermTypeApplication v1 -> (isSimpleAssignment (Core.typeApplicationTermBody v1))+ _ -> + let baseTerm = (Pairs.first (gatherArgs term []))+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationUnion _ -> False+ _ -> True) v2)+ _ -> True) v1)+ _ -> True) baseTerm)) term)++-- | Check if a term needs to be treated as a function rather than a simple value+isComplexTerm :: (Typing.TypeContext -> Core.Term -> Bool)+isComplexTerm tc t = ((\x -> case x of+ Core.TermLet _ -> True+ Core.TermTypeApplication _ -> True+ Core.TermTypeLambda _ -> True+ Core.TermVariable v1 -> (isComplexVariable tc v1)+ _ -> (Lists.foldl (\b -> \sub -> Logic.or b (isComplexTerm tc sub)) False (Rewriting.subterms t))) t)++-- | Check if a variable is bound to a complex term+isComplexVariable :: (Typing.TypeContext -> Core.Name -> Bool)+isComplexVariable tc name = + let metaLookup = (Maps.lookup name (Typing.typeContextMetadata tc))+ in (Logic.ifElse (Maybes.isJust metaLookup) True (Logic.ifElse (Sets.member name (Typing.typeContextLambdaVariables tc)) True ( + let typeLookup = (Maps.lookup name (Typing.typeContextTypes tc))+ in (Logic.not (Maybes.isJust typeLookup)))))++-- | Check if a binding needs to be treated as a function+isComplexBinding :: (Typing.TypeContext -> Core.Binding -> Bool)+isComplexBinding tc b = + let term = (Core.bindingTerm b)+ in + let mts = (Core.bindingType b)+ in (Maybes.cases mts (isComplexTerm tc term) (\ts -> + let isPolymorphic = (Logic.not (Lists.null (Core.typeSchemeVariables ts)))+ in + let isNonNullary = (Equality.gt (Arity.typeArity (Core.typeSchemeType ts)) 0)+ in + let isComplex = (isComplexTerm tc term)+ in (Logic.or (Logic.or isPolymorphic isNonNullary) isComplex)))++-- | Check if a term is trivially cheap (no thunking needed)+isTrivialTerm :: (Core.Term -> Bool)+isTrivialTerm t = ((\x -> case x of+ Core.TermLiteral _ -> True+ Core.TermVariable _ -> True+ Core.TermUnit -> True+ Core.TermApplication v1 -> + let fun = (Core.applicationFunction v1)+ in + let arg = (Core.applicationArgument v1)+ in ((\x -> case x of+ Core.TermFunction v2 -> ((\x -> case x of+ Core.FunctionElimination v3 -> ((\x -> case x of+ Core.EliminationRecord _ -> (isTrivialTerm arg)+ _ -> False) v3)+ _ -> False) v2)+ _ -> False) fun)+ Core.TermMaybe v1 -> (Maybes.maybe True (\inner -> isTrivialTerm inner) v1)+ Core.TermTypeApplication v1 -> (isTrivialTerm (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (isTrivialTerm (Core.typeLambdaBody v1))+ _ -> False) (Rewriting.deannotateTerm t))++-- | Check if a term body is self-tail-recursive with respect to a function name+isSelfTailRecursive :: (Core.Name -> Core.Term -> Bool)+isSelfTailRecursive funcName body = + let callsSelf = (Logic.not (Rewriting.isFreeVariableInTerm funcName body))+ in (Logic.ifElse callsSelf (isTailRecursiveInTailPosition funcName body) False)++-- | Check that all self-references are in tail position+isTailRecursiveInTailPosition :: (Core.Name -> Core.Term -> Bool)+isTailRecursiveInTailPosition funcName term = + let stripped = (Rewriting.deannotateAndDetypeTerm term)+ in ((\x -> case x of+ Core.TermApplication _ -> + let gathered = (gatherApplications stripped)+ in + let gatherArgs = (Pairs.first gathered)+ in + let gatherFun = (Pairs.second gathered)+ in + let strippedFun = (Rewriting.deannotateAndDetypeTerm gatherFun)+ in ((\x -> case x of+ Core.TermVariable v2 -> (Logic.ifElse (Equality.equal v2 funcName) ( + let argsNoFunc = (Lists.foldl (\ok -> \arg -> Logic.and ok (Rewriting.isFreeVariableInTerm funcName arg)) True gatherArgs)+ in + let argsNoLambda = (Lists.foldl (\ok -> \arg -> Logic.and ok (Logic.not (Rewriting.foldOverTerm Coders.TraversalOrderPre (\found -> \t -> Logic.or found ((\x -> case x of+ Core.TermFunction v3 -> ((\x -> case x of+ Core.FunctionLambda v4 -> + let ignore = (Core.lambdaBody v4)+ in True+ _ -> False) v3)+ _ -> False) t)) False arg))) True gatherArgs)+ in (Logic.and argsNoFunc argsNoLambda)) (Rewriting.isFreeVariableInTerm funcName term))+ Core.TermFunction v2 -> ((\x -> case x of+ Core.FunctionElimination v3 -> ((\x -> case x of+ Core.EliminationUnion v4 -> + let cases_ = (Core.caseStatementCases v4)+ in + let dflt = (Core.caseStatementDefault v4)+ in + let branchesOk = (Lists.foldl (\ok -> \field -> Logic.and ok (isTailRecursiveInTailPosition funcName (Core.fieldTerm field))) True cases_)+ in + let dfltOk = (Maybes.maybe True (\d -> isTailRecursiveInTailPosition funcName d) dflt)+ in + let argsOk = (Lists.foldl (\ok -> \arg -> Logic.and ok (Rewriting.isFreeVariableInTerm funcName arg)) True gatherArgs)+ in (Logic.and (Logic.and branchesOk dfltOk) argsOk)+ _ -> (Rewriting.isFreeVariableInTerm funcName term)) v3)+ _ -> (Rewriting.isFreeVariableInTerm funcName term)) v2)+ _ -> (Rewriting.isFreeVariableInTerm funcName term)) strippedFun)+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (isTailRecursiveInTailPosition funcName (Core.lambdaBody v2))+ _ -> (Rewriting.isFreeVariableInTerm funcName term)) v1)+ Core.TermLet v1 -> + let bindingsOk = (Lists.foldl (\ok -> \b -> Logic.and ok (Rewriting.isFreeVariableInTerm funcName (Core.bindingTerm b))) True (Core.letBindings v1))+ in (Logic.and bindingsOk (isTailRecursiveInTailPosition funcName (Core.letBody v1)))+ _ -> (Rewriting.isFreeVariableInTerm funcName term)) stripped)++-- | Extract comments/description from a Binding+commentsFromElement :: (Core.Binding -> Compute.Flow Graph.Graph (Maybe String))+commentsFromElement b = (Annotations.getTermDescription (Core.bindingTerm b))++-- | Extract comments/description from a FieldType+commentsFromFieldType :: (Core.FieldType -> Compute.Flow Graph.Graph (Maybe String))+commentsFromFieldType ft = (Annotations.getTypeDescription (Core.fieldTypeType ft))++-- | Infer the type of a term with tracing+tryTypeOf :: (String -> Typing.TypeContext -> Core.Term -> Compute.Flow t0 Core.Type)+tryTypeOf msg tc term = (Monads.withTrace msg (Checking.typeOf tc [] term))++-- | Produces metadata for a binding if it is complex+bindingMetadata :: (Typing.TypeContext -> Core.Binding -> Maybe Core.Term)+bindingMetadata tc b = (Logic.ifElse (isComplexBinding tc b) (Just (Core.TermLiteral (Core.LiteralBoolean True))) Nothing)++analyzeFunctionTermWith_finish :: ((t0 -> Typing.TypeContext) -> t0 -> [Core.Name] -> [Core.Name] -> [Core.Binding] -> [Core.Type] -> [Core.Type] -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermWith_finish getTC fEnv tparams args bindings doms tapps body = + let bodyWithTapps = (Lists.foldl (\trm -> \typ -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = trm,+ Core.typeApplicationTermType = typ})) body tapps)+ in (Flows.bind (Flows.withDefault Nothing (Flows.map Maybes.pure (tryTypeOf "analyzeFunctionTermWith" (getTC fEnv) bodyWithTapps))) (\mcod -> Flows.pure (Typing.FunctionStructure {+ Typing.functionStructureTypeParams = (Lists.reverse tparams),+ Typing.functionStructureParams = (Lists.reverse args),+ Typing.functionStructureBindings = bindings,+ Typing.functionStructureBody = bodyWithTapps,+ Typing.functionStructureDomains = (Lists.reverse doms),+ Typing.functionStructureCodomain = mcod,+ Typing.functionStructureEnvironment = fEnv})))++analyzeFunctionTermWith_gather :: ((Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> (t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> Bool -> t0 -> [Core.Name] -> [Core.Name] -> [Core.Binding] -> [Core.Type] -> [Core.Type] -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermWith_gather forBinding getTC setTC argMode gEnv tparams args bindings doms tapps t = ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Logic.ifElse argMode ( + let v = (Core.lambdaParameter v2)+ in + let dom = (Maybes.maybe (Core.TypeVariable (Core.Name "_")) (\x_ -> x_) (Core.lambdaDomain v2))+ in + let body = (Core.lambdaBody v2)+ in + let newEnv = (setTC (Schemas.extendTypeContextForLambda (getTC gEnv) v2) gEnv)+ in (analyzeFunctionTermWith_gather forBinding getTC setTC argMode newEnv tparams (Lists.cons v args) bindings (Lists.cons dom doms) tapps body)) (analyzeFunctionTermWith_finish getTC gEnv tparams args bindings doms tapps t))+ _ -> (analyzeFunctionTermWith_finish getTC gEnv tparams args bindings doms tapps t)) v1)+ Core.TermLet v1 -> + let newBindings = (Core.letBindings v1)+ in + let body = (Core.letBody v1)+ in + let newEnv = (setTC (Schemas.extendTypeContextForLet forBinding (getTC gEnv) v1) gEnv)+ in (analyzeFunctionTermWith_gather forBinding getTC setTC False newEnv tparams args (Lists.concat2 bindings newBindings) doms tapps body)+ Core.TermTypeApplication v1 -> + let taBody = (Core.typeApplicationTermBody v1)+ in + let typ = (Core.typeApplicationTermType v1)+ in (analyzeFunctionTermWith_gather forBinding getTC setTC argMode gEnv tparams args bindings doms (Lists.cons typ tapps) taBody)+ Core.TermTypeLambda v1 -> + let tvar = (Core.typeLambdaParameter v1)+ in + let tlBody = (Core.typeLambdaBody v1)+ in + let newEnv = (setTC (Schemas.extendTypeContextForTypeLambda (getTC gEnv) v1) gEnv)+ in (analyzeFunctionTermWith_gather forBinding getTC setTC argMode newEnv (Lists.cons tvar tparams) args bindings doms tapps tlBody)+ _ -> (analyzeFunctionTermWith_finish getTC gEnv tparams args bindings doms tapps t)) (Rewriting.deannotateTerm t))++-- | Analyze a function term with configurable binding metadata+analyzeFunctionTermWith :: ((Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> (t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> t0 -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermWith forBinding getTC setTC env term = (analyzeFunctionTermWith_gather forBinding getTC setTC True env [] [] [] [] [] term)++analyzeFunctionTermNoInferWith_finish :: (t0 -> [Core.Name] -> [Core.Name] -> [Core.Binding] -> [Core.Type] -> [Core.Type] -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermNoInferWith_finish fEnv tparams args bindings doms tapps body = + let bodyWithTapps = (Lists.foldl (\trm -> \typ -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = trm,+ Core.typeApplicationTermType = typ})) body tapps)+ in (Flows.pure (Typing.FunctionStructure {+ Typing.functionStructureTypeParams = (Lists.reverse tparams),+ Typing.functionStructureParams = (Lists.reverse args),+ Typing.functionStructureBindings = bindings,+ Typing.functionStructureBody = bodyWithTapps,+ Typing.functionStructureDomains = (Lists.reverse doms),+ Typing.functionStructureCodomain = Nothing,+ Typing.functionStructureEnvironment = fEnv}))++analyzeFunctionTermNoInferWith_gather :: ((Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> (t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> Bool -> t0 -> [Core.Name] -> [Core.Name] -> [Core.Binding] -> [Core.Type] -> [Core.Type] -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermNoInferWith_gather forBinding getTC setTC argMode gEnv tparams args bindings doms tapps t = ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Logic.ifElse argMode ( + let v = (Core.lambdaParameter v2)+ in + let dom = (Maybes.maybe (Core.TypeVariable (Core.Name "_")) (\x_ -> x_) (Core.lambdaDomain v2))+ in + let body = (Core.lambdaBody v2)+ in + let newEnv = (setTC (Schemas.extendTypeContextForLambda (getTC gEnv) v2) gEnv)+ in (analyzeFunctionTermNoInferWith_gather forBinding getTC setTC argMode newEnv tparams (Lists.cons v args) bindings (Lists.cons dom doms) tapps body)) (analyzeFunctionTermNoInferWith_finish gEnv tparams args bindings doms tapps t))+ _ -> (analyzeFunctionTermNoInferWith_finish gEnv tparams args bindings doms tapps t)) v1)+ Core.TermLet v1 -> + let newBindings = (Core.letBindings v1)+ in + let body = (Core.letBody v1)+ in + let newEnv = (setTC (Schemas.extendTypeContextForLet forBinding (getTC gEnv) v1) gEnv)+ in (analyzeFunctionTermNoInferWith_gather forBinding getTC setTC False newEnv tparams args (Lists.concat2 bindings newBindings) doms tapps body)+ Core.TermTypeApplication v1 -> + let taBody = (Core.typeApplicationTermBody v1)+ in + let typ = (Core.typeApplicationTermType v1)+ in (analyzeFunctionTermNoInferWith_gather forBinding getTC setTC argMode gEnv tparams args bindings doms (Lists.cons typ tapps) taBody)+ Core.TermTypeLambda v1 -> + let tvar = (Core.typeLambdaParameter v1)+ in + let tlBody = (Core.typeLambdaBody v1)+ in + let newEnv = (setTC (Schemas.extendTypeContextForTypeLambda (getTC gEnv) v1) gEnv)+ in (analyzeFunctionTermNoInferWith_gather forBinding getTC setTC argMode newEnv (Lists.cons tvar tparams) args bindings doms tapps tlBody)+ _ -> (analyzeFunctionTermNoInferWith_finish gEnv tparams args bindings doms tapps t)) (Rewriting.deannotateTerm t))++-- | Analyze a function term without type inference, with configurable binding metadata+analyzeFunctionTermNoInferWith :: ((Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> (t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> t0 -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermNoInferWith forBinding getTC setTC env term = (analyzeFunctionTermNoInferWith_gather forBinding getTC setTC True env [] [] [] [] [] term)++-- | Analyze a function term, collecting lambdas, type lambdas, lets, and type applications+analyzeFunctionTerm :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> t0 -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTerm getTC setTC env term = (analyzeFunctionTermWith bindingMetadata getTC setTC env term)++-- | Analyze a function term without recording binding metadata+analyzeFunctionTermInline :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> t0 -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermInline getTC setTC env term = (analyzeFunctionTermWith (\_ -> \_ -> Nothing) getTC setTC env term)++-- | Analyze a function term without type inference (performance optimization)+analyzeFunctionTermNoInfer :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t0) -> t0 -> Core.Term -> Compute.Flow t1 (Typing.FunctionStructure t0))+analyzeFunctionTermNoInfer getTC setTC env term = (analyzeFunctionTermNoInferWith bindingMetadata getTC setTC env term)++-- | Update the metadata portion of a coder state+updateCoderMetadata :: ((t0 -> t1) -> (t2 -> t3 -> t0) -> (t0 -> t2) -> (t1 -> t3) -> Compute.Flow t0 ())+updateCoderMetadata getMeta makeCoder getGraph f = (Flows.bind Monads.getState (\st -> Monads.putState (makeCoder (getGraph st) (f (getMeta st)))))++-- | Temporarily update the graph for a computation, then restore it+withUpdatedCoderGraph :: ((t0 -> t1) -> (t0 -> t2) -> (t1 -> t2 -> t0) -> (t1 -> t1) -> Compute.Flow t0 t3 -> Compute.Flow t0 t3)+withUpdatedCoderGraph getGraph getMeta makeCoder f flow = (Flows.bind Monads.getState (\st -> Flows.bind (Monads.putState (makeCoder (f (getGraph st)) (getMeta st))) (\_ -> Flows.bind flow (\r -> Flows.bind Monads.getState (\st2 -> Flows.bind (Monads.putState (makeCoder (getGraph st) (getMeta st2))) (\_ -> Flows.pure r))))))++-- | Temporarily extend the graph with additional bindings for a computation+withGraphBindings :: ((t0 -> Graph.Graph) -> (Graph.Graph -> t1 -> t0) -> (t0 -> t1) -> [Core.Binding] -> Compute.Flow t0 t2 -> Compute.Flow t0 t2)+withGraphBindings getGraph makeCoder getMeta bindings flow = (withUpdatedCoderGraph getGraph getMeta makeCoder (Lexical.extendGraphWithBindings bindings) flow)++-- | Run a Flow Graph computation within a Flow state computation+inCoderGraphContext :: ((t0 -> t1) -> (t0 -> t2) -> (t1 -> t2 -> t0) -> Compute.Flow t1 t3 -> Compute.Flow t0 t3)+inCoderGraphContext getGraph getMeta makeCoder graphFlow = (Flows.bind Monads.getState (\st -> Flows.bind (Monads.withState (getGraph st) (Flows.bind graphFlow (\ret -> Flows.bind Monads.getState (\g2 -> Flows.pure (ret, g2))))) (\result -> Flows.bind (Monads.putState (makeCoder (Pairs.second result) (getMeta st))) (\_ -> Flows.pure (Pairs.first result)))))
src/gen-main/haskell/Hydra/Coders.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Abstractions for paired transformations between languages module Hydra.Coders where@@ -5,8 +7,9 @@ import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -15,8 +18,11 @@ -- | An evaluation context together with a source language and a target language data AdapterContext = AdapterContext {+ -- | The underlying graph of elements and primitives adapterContextGraph :: Graph.Graph,+ -- | The language being encoded or decoded adapterContextLanguage :: Language,+ -- | A map of type names to adapters for those types adapterContextAdapters :: (M.Map Core.Name (Compute.Adapter AdapterContext AdapterContext Core.Type Core.Type Core.Term Core.Term))} _AdapterContext = (Core.Name "hydra.coders.AdapterContext")@@ -42,7 +48,9 @@ -- | A named language together with language-specific constraints data Language = Language {+ -- | The unique name of the language languageName :: LanguageName,+ -- | The constraints which characterize the language languageConstraints :: LanguageConstraints} _Language = (Core.Name "hydra.coders.Language")@@ -55,19 +63,19 @@ data LanguageConstraints = LanguageConstraints { -- | All supported elimination variants- languageConstraintsEliminationVariants :: (S.Set Mantle.EliminationVariant),+ languageConstraintsEliminationVariants :: (S.Set Variants.EliminationVariant), -- | All supported literal variants- languageConstraintsLiteralVariants :: (S.Set Mantle.LiteralVariant),+ languageConstraintsLiteralVariants :: (S.Set Variants.LiteralVariant), -- | All supported float types languageConstraintsFloatTypes :: (S.Set Core.FloatType), -- | All supported function variants- languageConstraintsFunctionVariants :: (S.Set Mantle.FunctionVariant),+ languageConstraintsFunctionVariants :: (S.Set Variants.FunctionVariant), -- | All supported integer types languageConstraintsIntegerTypes :: (S.Set Core.IntegerType), -- | All supported term variants- languageConstraintsTermVariants :: (S.Set Mantle.TermVariant),+ languageConstraintsTermVariants :: (S.Set Variants.TermVariant), -- | All supported type variants- languageConstraintsTypeVariants :: (S.Set Mantle.TypeVariant),+ languageConstraintsTypeVariants :: (S.Set Variants.TypeVariant), -- | A logical set of types, as a predicate which tests a type for inclusion languageConstraintsTypes :: (Core.Type -> Bool)}
src/gen-main/haskell/Hydra/Compute.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Abstractions for single- and bidirectional transformations module Hydra.Compute where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -12,9 +15,13 @@ -- | A two-level bidirectional encoder which adapts types to types and terms to terms data Adapter s1 s2 t1 t2 v1 v2 = Adapter {+ -- | Whether information may be lost in the course of this adaptation adapterIsLossy :: Bool,+ -- | The source type adapterSource :: t1,+ -- | The target type adapterTarget :: t2,+ -- | The coder for transforming instances of the source type to instances of the target type adapterCoder :: (Coder s1 s2 v1 v2)} _Adapter = (Core.Name "hydra.compute.Adapter")@@ -30,7 +37,9 @@ -- | A two-level encoder and decoder, operating both at a type level and an instance (data) level data Bicoder s1 s2 t1 t2 v1 v2 = Bicoder {+ -- | A function from source types to adapters bicoderEncode :: (t1 -> Adapter s1 s2 t1 t2 v1 v2),+ -- | A function from target types to adapters bicoderDecode :: (t2 -> Adapter s2 s1 t2 t1 v2 v1)} _Bicoder = (Core.Name "hydra.compute.Bicoder")@@ -42,7 +51,9 @@ -- | An encoder and decoder; a bidirectional flow between two types data Coder s1 s2 v1 v2 = Coder {+ -- | A function from source values to a flow of target values coderEncode :: (v1 -> Flow s1 v2),+ -- | A function from target values to a flow of source values coderDecode :: (v2 -> Flow s2 v1)} _Coder = (Core.Name "hydra.compute.Coder")@@ -61,8 +72,11 @@ -- | The result of evaluating a Flow data FlowState s v = FlowState {+ -- | The resulting value, or nothing in the case of failure flowStateValue :: (Maybe v),+ -- | The final state flowStateState :: s,+ -- | The trace (log) produced during evaluation flowStateTrace :: Trace} deriving (Eq, Ord, Read, Show) @@ -77,7 +91,9 @@ -- | A container for logging and error information data Trace = Trace {+ -- | A stack of context labels traceStack :: [String],+ -- | A log of warnings and/or info messages traceMessages :: [String], -- | A map of string keys to arbitrary terms as values, for application-specific use traceOther :: (M.Map Core.Name Core.Term)}
src/gen-main/haskell/Hydra/Constants.hs view
@@ -1,29 +1,42 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A module for tier-0 constants. module Hydra.Constants where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Disable type checking by default, for better performance+debugInference :: Bool+debugInference = True++-- | The name used for ignored variables ignoredVariable :: String ignoredVariable = "_" +-- | Annotation key for type classes key_classes :: Core.Name key_classes = (Core.Name "classes") +-- | Annotation key for debug identifiers key_debugId :: Core.Name key_debugId = (Core.Name "debugId") +-- | Annotation key for deprecated markers key_deprecated :: Core.Name key_deprecated = (Core.Name "deprecated") +-- | Annotation key for descriptions key_description :: Core.Name key_description = (Core.Name "description") +-- | Annotation key for exclusions key_exclude :: Core.Name key_exclude = (Core.Name "exclude") @@ -31,21 +44,29 @@ key_firstClassType :: Core.Name key_firstClassType = (Core.Name "firstClassType") +-- | Annotation key for maximum length constraints key_maxLength :: Core.Name key_maxLength = (Core.Name "maxLength") +-- | Annotation key for minimum length constraints key_minLength :: Core.Name key_minLength = (Core.Name "minLength") +-- | Annotation key for preserving field names during code generation key_preserveFieldName :: Core.Name key_preserveFieldName = (Core.Name "preserveFieldName") +-- | Annotation key for type information key_type :: Core.Name key_type = (Core.Name "type") +-- | A counter for generating fresh type variable names+key_freshTypeVariableCount :: Core.Name+key_freshTypeVariableCount = (Core.Name "freshTypeVariableCount")+ -- | The maximum value of a 32-bit integer maxInt32 :: Int-maxInt32 = 9223372036854775807+maxInt32 = 2147483647 -- | A placeholder name for row types as they are being constructed placeholderName :: Core.Name@@ -53,7 +74,8 @@ -- | A maximum depth for nested flows. Currently, this is set very high because deep flows are common in type inference over the Hydra kernel. maxTraceDepth :: Int-maxTraceDepth = 4000+maxTraceDepth = 5000 +-- | A standard warning message for auto-generated files warningAutoGeneratedFile :: String warningAutoGeneratedFile = "Note: this is an automatically generated file. Do not edit."
src/gen-main/haskell/Hydra/Constraints.hs view
@@ -1,10 +1,13 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for path- and pattern-based graph constraints, which may be considered as part of the schema of a graph module Hydra.Constraints where import qualified Hydra.Core as Core import qualified Hydra.Query as Query-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -13,7 +16,9 @@ -- | A declared equivalence between two abstract paths in a graph data PathEquation = PathEquation {+ -- | The left-hand side of the equation pathEquationLeft :: Query.Path,+ -- | The right-hand side of the equation pathEquationRight :: Query.Path} deriving (Eq, Ord, Read, Show) @@ -26,7 +31,9 @@ -- | A pattern which, if it matches in a given graph, implies that another pattern must also match. Query variables are shared between the two patterns. data PatternImplication = PatternImplication {+ -- | The pattern which, if it matches, triggers the constraint patternImplicationAntecedent :: Query.Pattern,+ -- | The pattern which must also match when the antecedent matches patternImplicationConsequent :: Query.Pattern} deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Core.hs view
@@ -1,8 +1,11 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Hydra's core data model, consisting of the fundamental hydra.core.Term type and all of its dependencies. module Hydra.Core where -import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -11,26 +14,30 @@ -- | A term together with an annotation data AnnotatedTerm = AnnotatedTerm {- annotatedTermSubject :: Term,+ -- | The term being annotated+ annotatedTermBody :: Term,+ -- | The annotation as a map from keys to values annotatedTermAnnotation :: (M.Map Name Term)} deriving (Eq, Ord, Read, Show) _AnnotatedTerm = (Name "hydra.core.AnnotatedTerm") -_AnnotatedTerm_subject = (Name "subject")+_AnnotatedTerm_body = (Name "body") _AnnotatedTerm_annotation = (Name "annotation") -- | A type together with an annotation data AnnotatedType = AnnotatedType {- annotatedTypeSubject :: Type,+ -- | The type being annotated+ annotatedTypeBody :: Type,+ -- | The annotation as a map from keys to values annotatedTypeAnnotation :: (M.Map Name Term)} deriving (Eq, Ord, Read, Show) _AnnotatedType = (Name "hydra.core.AnnotatedType") -_AnnotatedType_subject = (Name "subject")+_AnnotatedType_body = (Name "body") _AnnotatedType_annotation = (Name "annotation") @@ -64,11 +71,33 @@ _ApplicationType_argument = (Name "argument") +-- | A field with an optional type scheme, used to bind variables to terms in a 'let' expression+data Binding = + Binding {+ -- | The name of the bound variable+ bindingName :: Name,+ -- | The term to which the variable is bound+ bindingTerm :: Term,+ -- | The optional type of the bound term+ bindingType :: (Maybe TypeScheme)}+ deriving (Eq, Ord, Read, Show)++_Binding = (Name "hydra.core.Binding")++_Binding_name = (Name "name")++_Binding_term = (Name "term")++_Binding_type = (Name "type")+ -- | A union elimination; a case statement data CaseStatement = CaseStatement {+ -- | The name of the union type caseStatementTypeName :: Name,+ -- | An optional default case, used if none of the explicit cases match caseStatementDefault :: (Maybe Term),+ -- | A list of case alternatives, one per union field caseStatementCases :: [Field]} deriving (Eq, Ord, Read, Show) @@ -80,10 +109,38 @@ _CaseStatement_cases = (Name "cases") +-- | A type which provides a choice between a 'left' type and a 'right' type+data EitherType = + EitherType {+ -- | The 'left' alternative+ eitherTypeLeft :: Type,+ -- | The 'right' alternative+ eitherTypeRight :: Type}+ deriving (Eq, Ord, Read, Show)++_EitherType = (Name "hydra.core.EitherType")++_EitherType_left = (Name "left")++_EitherType_right = (Name "right")++-- | A type which pairs a 'first' type and a 'second' type+data PairType = + PairType {+ -- | The first component of the pair+ pairTypeFirst :: Type,+ -- | The second component of the pair+ pairTypeSecond :: Type}+ deriving (Eq, Ord, Read, Show)++_PairType = (Name "hydra.core.PairType")++_PairType_first = (Name "first")++_PairType_second = (Name "second")+ -- | A corresponding elimination for an introduction term data Elimination = - -- | Eliminates a tuple by projecting the component at a given 0-indexed offset- EliminationProduct TupleProjection | -- | Eliminates a record by projecting a given field EliminationRecord Projection | -- | Eliminates a union term by matching over the fields of the union. This is a case statement.@@ -94,8 +151,6 @@ _Elimination = (Name "hydra.core.Elimination") -_Elimination_product = (Name "product")- _Elimination_record = (Name "record") _Elimination_union = (Name "union")@@ -105,7 +160,9 @@ -- | A name/term pair data Field = Field {+ -- | The name of the field fieldName :: Name,+ -- | The term value of the field fieldTerm :: Term} deriving (Eq, Ord, Read, Show) @@ -118,7 +175,9 @@ -- | A name/type pair data FieldType = FieldType {+ -- | The name of the field fieldTypeName :: Name,+ -- | The type of the field fieldTypeType :: Type} deriving (Eq, Ord, Read, Show) @@ -130,8 +189,11 @@ -- | A floating-point type data FloatType = + -- | An arbitrary-precision floating-point type FloatTypeBigfloat |+ -- | A 32-bit floating-point type FloatTypeFloat32 |+ -- | A 64-bit floating-point type FloatTypeFloat64 deriving (Eq, Ord, Read, Show) @@ -197,7 +259,9 @@ -- | A function type, also known as an arrow type data FunctionType = FunctionType {+ -- | The domain (input) type of the function functionTypeDomain :: Type,+ -- | The codomain (output) type of the function functionTypeCodomain :: Type} deriving (Eq, Ord, Read, Show) @@ -210,7 +274,9 @@ -- | An instance of a union type; i.e. a string-indexed generalization of inl() or inr() data Injection = Injection {+ -- | The name of the union type injectionTypeName :: Name,+ -- | The field being injected, including its name and value injectionField :: Field} deriving (Eq, Ord, Read, Show) @@ -222,14 +288,23 @@ -- | An integer type data IntegerType = + -- | An arbitrary-precision integer type IntegerTypeBigint |+ -- | An 8-bit signed integer type IntegerTypeInt8 |+ -- | A 16-bit signed integer type IntegerTypeInt16 |+ -- | A 32-bit signed integer type IntegerTypeInt32 |+ -- | A 64-bit signed integer type IntegerTypeInt64 |+ -- | An 8-bit unsigned integer type IntegerTypeUint8 |+ -- | A 16-bit unsigned integer type IntegerTypeUint16 |+ -- | A 32-bit unsigned integer type IntegerTypeUint32 |+ -- | A 64-bit unsigned integer type IntegerTypeUint64 deriving (Eq, Ord, Read, Show) @@ -314,39 +389,25 @@ _Lambda_body = (Name "body") --- | A set of (possibly recursive) 'let' bindings together with an environment in which they are bound+-- | A set of (possibly recursive) 'let' bindings together with a body in which they are bound data Let = Let {+ -- | The list of variable bindings letBindings :: [Binding],- letEnvironment :: Term}+ -- | The body term in which the variables are bound+ letBody :: Term} deriving (Eq, Ord, Read, Show) _Let = (Name "hydra.core.Let") _Let_bindings = (Name "bindings") -_Let_environment = (Name "environment")---- | A field with an optional type scheme, used to bind variables to terms in a 'let' expression-data Binding = - Binding {- bindingName :: Name,- bindingTerm :: Term,- bindingType :: (Maybe TypeScheme)}- deriving (Eq, Ord, Read, Show)--_Binding = (Name "hydra.core.Binding")--_Binding_name = (Name "name")--_Binding_term = (Name "term")--_Binding_type = (Name "type")+_Let_body = (Name "body") -- | A term constant; an instance of a literal type data Literal = -- | A binary literal- LiteralBinary String |+ LiteralBinary B.ByteString | -- | A boolean literal LiteralBoolean Bool | -- | A floating-point literal@@ -398,7 +459,9 @@ -- | A map type data MapType = MapType {+ -- | The type of keys in the map mapTypeKeys :: Type,+ -- | The type of values in the map mapTypeValues :: Type} deriving (Eq, Ord, Read, Show) @@ -434,7 +497,9 @@ -- | A record, or labeled tuple; a map of field names to terms data Record = Record {+ -- | The name of the record type recordTypeName :: Name,+ -- | The fields of the record, as a list of name/term pairs recordFields :: [Field]} deriving (Eq, Ord, Read, Show) @@ -459,28 +524,14 @@ _RowType_fields = (Name "fields") --- | The unlabeled equivalent of an Injection term-data Sum = - Sum {- sumIndex :: Int,- sumSize :: Int,- sumTerm :: Term}- deriving (Eq, Ord, Read, Show)--_Sum = (Name "hydra.core.Sum")--_Sum_index = (Name "index")--_Sum_size = (Name "size")--_Sum_term = (Name "term")- -- | A data term data Term = -- | A term annotated with metadata TermAnnotated AnnotatedTerm | -- | A function application TermApplication Application |+ -- | An either value+ TermEither (Either Term Term) | -- | A function term TermFunction Function | -- | A 'let' term, which binds variables to terms@@ -492,17 +543,15 @@ -- | A map of keys to values TermMap (M.Map Term Term) | -- | An optional value- TermOptional (Maybe Term) |- -- | A tuple- TermProduct [Term] |+ TermMaybe (Maybe Term) |+ -- | A pair (2-tuple)+ TermPair (Term, Term) | -- | A record term TermRecord Record | -- | A set of values TermSet (S.Set Term) |- -- | A variant tuple- TermSum Sum | -- | A System F type application term- TermTypeApplication TypedTerm |+ TermTypeApplication TypeApplicationTerm | -- | A System F type abstraction term TermTypeLambda TypeLambda | -- | An injection; an instance of a union type@@ -521,6 +570,8 @@ _Term_application = (Name "application") +_Term_either = (Name "either")+ _Term_function = (Name "function") _Term_let = (Name "let")@@ -531,16 +582,14 @@ _Term_map = (Name "map") -_Term_optional = (Name "optional")+_Term_maybe = (Name "maybe") -_Term_product = (Name "product")+_Term_pair = (Name "pair") _Term_record = (Name "record") _Term_set = (Name "set") -_Term_sum = (Name "sum")- _Term_typeApplication = (Name "typeApplication") _Term_typeLambda = (Name "typeLambda")@@ -553,42 +602,39 @@ _Term_wrap = (Name "wrap") --- | A tuple elimination; a projection from an integer-indexed product-data TupleProjection = - TupleProjection {- -- | The arity of the tuple- tupleProjectionArity :: Int,- -- | The 0-indexed offset from the beginning of the tuple- tupleProjectionIndex :: Int,- -- | An optional domain for the projection; this is a list of component types- tupleProjectionDomain :: (Maybe [Type])}- deriving (Eq, Ord, Read, Show)--_TupleProjection = (Name "hydra.core.TupleProjection")--_TupleProjection_arity = (Name "arity")--_TupleProjection_index = (Name "index")--_TupleProjection_domain = (Name "domain")- -- | A data type data Type = + -- | An annotated type TypeAnnotated AnnotatedType |+ -- | A type application TypeApplication ApplicationType |+ -- | An either (sum) type+ TypeEither EitherType |+ -- | A universally quantified (polymorphic) type TypeForall ForallType |+ -- | A function type TypeFunction FunctionType |+ -- | A list type TypeList Type |+ -- | A literal type TypeLiteral LiteralType |+ -- | A map type TypeMap MapType |- TypeOptional Type |- TypeProduct [Type] |+ -- | An optional type+ TypeMaybe Type |+ -- | A pair (2-tuple) type+ TypePair PairType |+ -- | A record type TypeRecord RowType |+ -- | A set type TypeSet Type |- TypeSum [Type] |+ -- | A union type with field names TypeUnion RowType |+ -- | The unit type TypeUnit |+ -- | A type variable TypeVariable Name |+ -- | A wrapped type (newtype) TypeWrap WrappedType deriving (Eq, Ord, Read, Show) @@ -598,6 +644,8 @@ _Type_application = (Name "application") +_Type_either = (Name "either")+ _Type_forall = (Name "forall") _Type_function = (Name "function")@@ -608,16 +656,14 @@ _Type_map = (Name "map") -_Type_optional = (Name "optional")+_Type_maybe = (Name "maybe") -_Type_product = (Name "product")+_Type_pair = (Name "pair") _Type_record = (Name "record") _Type_set = (Name "set") -_Type_sum = (Name "sum")- _Type_union = (Name "union") _Type_unit = (Name "unit")@@ -626,6 +672,21 @@ _Type_wrap = (Name "wrap") +-- | A term applied to a type; a type application+data TypeApplicationTerm = + TypeApplicationTerm {+ -- | The term being applied to a type+ typeApplicationTermBody :: Term,+ -- | The type argument+ typeApplicationTermType :: Type}+ deriving (Eq, Ord, Read, Show)++_TypeApplicationTerm = (Name "hydra.core.TypeApplicationTerm")++_TypeApplicationTerm_body = (Name "body")++_TypeApplicationTerm_type = (Name "type")+ -- | A System F type abstraction term data TypeLambda = TypeLambda {@@ -641,24 +702,15 @@ _TypeLambda_body = (Name "body") --- | A term applied to a type; a type application-data TypedTerm = - TypedTerm {- typedTermTerm :: Term,- typedTermType :: Type}- deriving (Eq, Ord, Read, Show)--_TypedTerm = (Name "hydra.core.TypedTerm")--_TypedTerm_term = (Name "term")--_TypedTerm_type = (Name "type")- -- | A type expression together with free type variables occurring in the expression data TypeScheme = TypeScheme {+ -- | The free type variables typeSchemeVariables :: [Name],- typeSchemeType :: Type}+ -- | The type expression+ typeSchemeType :: Type,+ -- | Optional metadata for type variables, including typeclass constraints. The map keys are type variable names.+ typeSchemeConstraints :: (Maybe (M.Map Name TypeVariableMetadata))} deriving (Eq, Ord, Read, Show) _TypeScheme = (Name "hydra.core.TypeScheme")@@ -667,28 +719,45 @@ _TypeScheme_type = (Name "type") +_TypeScheme_constraints = (Name "constraints")++-- | Metadata associated with a type variable, including typeclass constraints+data TypeVariableMetadata = + TypeVariableMetadata {+ -- | The set of typeclass constraints on this type variable+ typeVariableMetadataClasses :: (S.Set Name)}+ deriving (Eq, Ord, Read, Show)++_TypeVariableMetadata = (Name "hydra.core.TypeVariableMetadata")++_TypeVariableMetadata_classes = (Name "classes")+ -- | A term wrapped in a type name data WrappedTerm = WrappedTerm {+ -- | The name of the wrapper type wrappedTermTypeName :: Name,- wrappedTermObject :: Term}+ -- | The wrapped term+ wrappedTermBody :: Term} deriving (Eq, Ord, Read, Show) _WrappedTerm = (Name "hydra.core.WrappedTerm") _WrappedTerm_typeName = (Name "typeName") -_WrappedTerm_object = (Name "object")+_WrappedTerm_body = (Name "body") -- | A type wrapped in a type name; a newtype data WrappedType = WrappedType {+ -- | The name of the wrapper (newtype) wrappedTypeTypeName :: Name,- wrappedTypeObject :: Type}+ -- | The wrapped type+ wrappedTypeBody :: Type} deriving (Eq, Ord, Read, Show) _WrappedType = (Name "hydra.core.WrappedType") _WrappedType_typeName = (Name "typeName") -_WrappedType_object = (Name "object")+_WrappedType_body = (Name "body")
+ src/gen-main/haskell/Hydra/Decode/Accessors.hs view
@@ -0,0 +1,130 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.accessors++module Hydra.Decode.Accessors where++import qualified Hydra.Accessors as Accessors+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++accessorEdge :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Accessors.AccessorEdge)+accessorEdge cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "source" accessorNode fieldMap cx) (\field_source -> Eithers.bind (Helpers.requireField "path" accessorPath fieldMap cx) (\field_path -> Eithers.bind (Helpers.requireField "target" accessorNode fieldMap cx) (\field_target -> Right (Accessors.AccessorEdge {+ Accessors.accessorEdgeSource = field_source,+ Accessors.accessorEdgePath = field_path,+ Accessors.accessorEdgeTarget = field_target})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.accessors.AccessorEdge"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++accessorGraph :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Accessors.AccessorGraph)+accessorGraph cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "nodes" (Helpers.decodeList accessorNode) fieldMap cx) (\field_nodes -> Eithers.bind (Helpers.requireField "edges" (Helpers.decodeList accessorEdge) fieldMap cx) (\field_edges -> Right (Accessors.AccessorGraph {+ Accessors.accessorGraphNodes = field_nodes,+ Accessors.accessorGraphEdges = field_edges}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.accessors.AccessorGraph"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++accessorNode :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Accessors.AccessorNode)+accessorNode cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Core_.name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "label" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_label -> Eithers.bind (Helpers.requireField "id" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_id -> Right (Accessors.AccessorNode {+ Accessors.accessorNodeName = field_name,+ Accessors.accessorNodeLabel = field_label,+ Accessors.accessorNodeId = field_id})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.accessors.AccessorNode"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++accessorPath :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Accessors.AccessorPath)+accessorPath cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Accessors.AccessorPath b) (Helpers.decodeList termAccessor cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.accessors.AccessorPath"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++termAccessor :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Accessors.TermAccessor)+termAccessor cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "annotatedBody", (\input -> Eithers.map (\t -> Accessors.TermAccessorAnnotatedBody) (Helpers.decodeUnit cx input))),+ (Core.Name "applicationFunction", (\input -> Eithers.map (\t -> Accessors.TermAccessorApplicationFunction) (Helpers.decodeUnit cx input))),+ (Core.Name "applicationArgument", (\input -> Eithers.map (\t -> Accessors.TermAccessorApplicationArgument) (Helpers.decodeUnit cx input))),+ (Core.Name "lambdaBody", (\input -> Eithers.map (\t -> Accessors.TermAccessorLambdaBody) (Helpers.decodeUnit cx input))),+ (Core.Name "unionCasesDefault", (\input -> Eithers.map (\t -> Accessors.TermAccessorUnionCasesDefault) (Helpers.decodeUnit cx input))),+ (Core.Name "unionCasesBranch", (\input -> Eithers.map (\t -> Accessors.TermAccessorUnionCasesBranch t) (Core_.name cx input))),+ (Core.Name "letBody", (\input -> Eithers.map (\t -> Accessors.TermAccessorLetBody) (Helpers.decodeUnit cx input))),+ (Core.Name "letBinding", (\input -> Eithers.map (\t -> Accessors.TermAccessorLetBinding t) (Core_.name cx input))),+ (Core.Name "listElement", (\input -> Eithers.map (\t -> Accessors.TermAccessorListElement t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "mapKey", (\input -> Eithers.map (\t -> Accessors.TermAccessorMapKey t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "mapValue", (\input -> Eithers.map (\t -> Accessors.TermAccessorMapValue t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "maybeTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorMaybeTerm) (Helpers.decodeUnit cx input))),+ (Core.Name "productTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorProductTerm t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "recordField", (\input -> Eithers.map (\t -> Accessors.TermAccessorRecordField t) (Core_.name cx input))),+ (Core.Name "setElement", (\input -> Eithers.map (\t -> Accessors.TermAccessorSetElement t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "sumTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorSumTerm) (Helpers.decodeUnit cx input))),+ (Core.Name "typeLambdaBody", (\input -> Eithers.map (\t -> Accessors.TermAccessorTypeLambdaBody) (Helpers.decodeUnit cx input))),+ (Core.Name "typeApplicationTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorTypeApplicationTerm) (Helpers.decodeUnit cx input))),+ (Core.Name "injectionTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorInjectionTerm) (Helpers.decodeUnit cx input))),+ (Core.Name "wrappedTerm", (\input -> Eithers.map (\t -> Accessors.TermAccessorWrappedTerm) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.accessors.TermAccessor"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Ast.hs view
@@ -0,0 +1,209 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.ast++module Hydra.Decode.Ast where++import qualified Hydra.Ast as Ast+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++associativity :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Associativity)+associativity cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "none", (\input -> Eithers.map (\t -> Ast.AssociativityNone) (Helpers.decodeUnit cx input))),+ (Core.Name "left", (\input -> Eithers.map (\t -> Ast.AssociativityLeft) (Helpers.decodeUnit cx input))),+ (Core.Name "right", (\input -> Eithers.map (\t -> Ast.AssociativityRight) (Helpers.decodeUnit cx input))),+ (Core.Name "both", (\input -> Eithers.map (\t -> Ast.AssociativityBoth) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.ast.Associativity"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++blockStyle :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.BlockStyle)+blockStyle cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "indent" (Helpers.decodeMaybe (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_indent -> Eithers.bind (Helpers.requireField "newlineBeforeContent" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_newlineBeforeContent -> Eithers.bind (Helpers.requireField "newlineAfterContent" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_newlineAfterContent -> Right (Ast.BlockStyle {+ Ast.blockStyleIndent = field_indent,+ Ast.blockStyleNewlineBeforeContent = field_newlineBeforeContent,+ Ast.blockStyleNewlineAfterContent = field_newlineAfterContent})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.BlockStyle"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++bracketExpr :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.BracketExpr)+bracketExpr cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "brackets" brackets fieldMap cx) (\field_brackets -> Eithers.bind (Helpers.requireField "enclosed" expr fieldMap cx) (\field_enclosed -> Eithers.bind (Helpers.requireField "style" blockStyle fieldMap cx) (\field_style -> Right (Ast.BracketExpr {+ Ast.bracketExprBrackets = field_brackets,+ Ast.bracketExprEnclosed = field_enclosed,+ Ast.bracketExprStyle = field_style})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.BracketExpr"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++brackets :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Brackets)+brackets cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "open" symbol fieldMap cx) (\field_open -> Eithers.bind (Helpers.requireField "close" symbol fieldMap cx) (\field_close -> Right (Ast.Brackets {+ Ast.bracketsOpen = field_open,+ Ast.bracketsClose = field_close}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.Brackets"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++expr :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Expr)+expr cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "const", (\input -> Eithers.map (\t -> Ast.ExprConst t) (symbol cx input))),+ (Core.Name "indent", (\input -> Eithers.map (\t -> Ast.ExprIndent t) (indentedExpression cx input))),+ (Core.Name "op", (\input -> Eithers.map (\t -> Ast.ExprOp t) (opExpr cx input))),+ (Core.Name "brackets", (\input -> Eithers.map (\t -> Ast.ExprBrackets t) (bracketExpr cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.ast.Expr"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++indentedExpression :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.IndentedExpression)+indentedExpression cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "style" indentStyle fieldMap cx) (\field_style -> Eithers.bind (Helpers.requireField "expr" expr fieldMap cx) (\field_expr -> Right (Ast.IndentedExpression {+ Ast.indentedExpressionStyle = field_style,+ Ast.indentedExpressionExpr = field_expr}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.IndentedExpression"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++indentStyle :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.IndentStyle)+indentStyle cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "allLines", (\input -> Eithers.map (\t -> Ast.IndentStyleAllLines t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "subsequentLines", (\input -> Eithers.map (\t -> Ast.IndentStyleSubsequentLines t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.ast.IndentStyle"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++op :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Op)+op cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "symbol" symbol fieldMap cx) (\field_symbol -> Eithers.bind (Helpers.requireField "padding" padding fieldMap cx) (\field_padding -> Eithers.bind (Helpers.requireField "precedence" precedence fieldMap cx) (\field_precedence -> Eithers.bind (Helpers.requireField "associativity" associativity fieldMap cx) (\field_associativity -> Right (Ast.Op {+ Ast.opSymbol = field_symbol,+ Ast.opPadding = field_padding,+ Ast.opPrecedence = field_precedence,+ Ast.opAssociativity = field_associativity}))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.Op"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++opExpr :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.OpExpr)+opExpr cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "op" op fieldMap cx) (\field_op -> Eithers.bind (Helpers.requireField "lhs" expr fieldMap cx) (\field_lhs -> Eithers.bind (Helpers.requireField "rhs" expr fieldMap cx) (\field_rhs -> Right (Ast.OpExpr {+ Ast.opExprOp = field_op,+ Ast.opExprLhs = field_lhs,+ Ast.opExprRhs = field_rhs})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.OpExpr"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++padding :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Padding)+padding cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "left" ws fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" ws fieldMap cx) (\field_right -> Right (Ast.Padding {+ Ast.paddingLeft = field_left,+ Ast.paddingRight = field_right}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.ast.Padding"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++precedence :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Precedence)+precedence cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Ast.Precedence b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.ast.Precedence"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++symbol :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Symbol)+symbol cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Ast.Symbol b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.ast.Symbol"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++ws :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Ast.Ws)+ws cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "none", (\input -> Eithers.map (\t -> Ast.WsNone) (Helpers.decodeUnit cx input))),+ (Core.Name "space", (\input -> Eithers.map (\t -> Ast.WsSpace) (Helpers.decodeUnit cx input))),+ (Core.Name "break", (\input -> Eithers.map (\t -> Ast.WsBreak) (Helpers.decodeUnit cx input))),+ (Core.Name "breakAndIndent", (\input -> Eithers.map (\t -> Ast.WsBreakAndIndent t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "doubleBreak", (\input -> Eithers.map (\t -> Ast.WsDoubleBreak) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.ast.Ws"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Classes.hs view
@@ -0,0 +1,39 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.classes++module Hydra.Decode.Classes where++import qualified Hydra.Classes as Classes+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++typeClass :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Classes.TypeClass)+typeClass cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "equality", (\input -> Eithers.map (\t -> Classes.TypeClassEquality) (Helpers.decodeUnit cx input))),+ (Core.Name "ordering", (\input -> Eithers.map (\t -> Classes.TypeClassOrdering) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.classes.TypeClass"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Coders.hs view
@@ -0,0 +1,65 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.coders++module Hydra.Decode.Coders where++import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++coderDirection :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Coders.CoderDirection)+coderDirection cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "encode", (\input -> Eithers.map (\t -> Coders.CoderDirectionEncode) (Helpers.decodeUnit cx input))),+ (Core.Name "decode", (\input -> Eithers.map (\t -> Coders.CoderDirectionDecode) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.coders.CoderDirection"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++languageName :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Coders.LanguageName)+languageName cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Coders.LanguageName b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.coders.LanguageName"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++traversalOrder :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Coders.TraversalOrder)+traversalOrder cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "pre", (\input -> Eithers.map (\t -> Coders.TraversalOrderPre) (Helpers.decodeUnit cx input))),+ (Core.Name "post", (\input -> Eithers.map (\t -> Coders.TraversalOrderPost) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.coders.TraversalOrder"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Compute.hs view
@@ -0,0 +1,48 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.compute++module Hydra.Decode.Compute where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++flowState :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> (Graph.Graph -> Core.Term -> Either Util.DecodingError t1) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Compute.FlowState t0 t1))+flowState s v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "value" (Helpers.decodeMaybe v) fieldMap cx) (\field_value -> Eithers.bind (Helpers.requireField "state" s fieldMap cx) (\field_state -> Eithers.bind (Helpers.requireField "trace" trace fieldMap cx) (\field_trace -> Right (Compute.FlowState {+ Compute.flowStateValue = field_value,+ Compute.flowStateState = field_state,+ Compute.flowStateTrace = field_trace})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.compute.FlowState"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++trace :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Compute.Trace)+trace cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "stack" (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_stack -> Eithers.bind (Helpers.requireField "messages" (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_messages -> Eithers.bind (Helpers.requireField "other" (Helpers.decodeMap Core_.name Core_.term) fieldMap cx) (\field_other -> Right (Compute.Trace {+ Compute.traceStack = field_stack,+ Compute.traceMessages = field_messages,+ Compute.traceOther = field_other})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.compute.Trace"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Constraints.hs view
@@ -0,0 +1,38 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.constraints++module Hydra.Decode.Constraints where++import qualified Hydra.Constraints as Constraints+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Query as Query+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++pathEquation :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Constraints.PathEquation)+pathEquation cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "left" Query.path fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" Query.path fieldMap cx) (\field_right -> Right (Constraints.PathEquation {+ Constraints.pathEquationLeft = field_left,+ Constraints.pathEquationRight = field_right}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.constraints.PathEquation"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++patternImplication :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Constraints.PatternImplication)+patternImplication cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "antecedent" Query.pattern fieldMap cx) (\field_antecedent -> Eithers.bind (Helpers.requireField "consequent" Query.pattern fieldMap cx) (\field_consequent -> Right (Constraints.PatternImplication {+ Constraints.patternImplicationAntecedent = field_antecedent,+ Constraints.patternImplicationConsequent = field_consequent}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.constraints.PatternImplication"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
src/gen-main/haskell/Hydra/Decode/Core.hs view
@@ -1,119 +1,566 @@--- | Decode hydra.core types from the hydra.core.Term type+-- Note: this is an automatically generated file. Do not edit. +-- | Term decoders for hydra.core+ module Hydra.Decode.Core where -import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core-import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers import qualified Hydra.Graph as Graph import qualified Hydra.Lexical as Lexical-import qualified Hydra.Lib.Flows as Flows-import qualified Hydra.Monads as Monads-import qualified Hydra.Rewriting as Rewriting-import qualified Hydra.Show.Core as Core__-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -applicationType :: (Core.Term -> Compute.Flow Graph.Graph Core.ApplicationType)-applicationType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "function") type_) (\function -> Flows.bind (Lexical.getField m (Core.Name "argument") type_) (\argument -> Flows.pure (Core.ApplicationType {- Core.applicationTypeFunction = function,- Core.applicationTypeArgument = argument})))))+annotatedTerm :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.AnnotatedTerm)+annotatedTerm cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Eithers.bind (Helpers.requireField "annotation" (Helpers.decodeMap name term) fieldMap cx) (\field_annotation -> Right (Core.AnnotatedTerm {+ Core.annotatedTermBody = field_body,+ Core.annotatedTermAnnotation = field_annotation}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.AnnotatedTerm"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -fieldType :: (Core.Term -> Compute.Flow Graph.Graph Core.FieldType)-fieldType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "name") name) (\name -> Flows.bind (Lexical.getField m (Core.Name "type") type_) (\typ -> Flows.pure (Core.FieldType {- Core.fieldTypeName = name,- Core.fieldTypeType = typ})))))+annotatedType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.AnnotatedType)+annotatedType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "body" type_ fieldMap cx) (\field_body -> Eithers.bind (Helpers.requireField "annotation" (Helpers.decodeMap name term) fieldMap cx) (\field_annotation -> Right (Core.AnnotatedType {+ Core.annotatedTypeBody = field_body,+ Core.annotatedTypeAnnotation = field_annotation}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.AnnotatedType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -fieldTypes :: (Core.Term -> Compute.Flow Graph.Graph [Core.FieldType])-fieldTypes term = - let stripped = (Rewriting.deannotateAndDetypeTerm term)- in ((\x -> case x of- Core.TermList v1 -> (Flows.mapList fieldType v1)- _ -> (Monads.unexpected "list" (Core__.term term))) stripped)+application :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Application)+application cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "function" term fieldMap cx) (\field_function -> Eithers.bind (Helpers.requireField "argument" term fieldMap cx) (\field_argument -> Right (Core.Application {+ Core.applicationFunction = field_function,+ Core.applicationArgument = field_argument}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Application"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -floatType :: (Core.Term -> Compute.Flow Graph.Graph Core.FloatType)-floatType = (Lexical.matchEnum (Core.Name "hydra.core.FloatType") [- (Core.Name "bigfloat", Core.FloatTypeBigfloat),- (Core.Name "float32", Core.FloatTypeFloat32),- (Core.Name "float64", Core.FloatTypeFloat64)])+applicationType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.ApplicationType)+applicationType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "function" type_ fieldMap cx) (\field_function -> Eithers.bind (Helpers.requireField "argument" type_ fieldMap cx) (\field_argument -> Right (Core.ApplicationType {+ Core.applicationTypeFunction = field_function,+ Core.applicationTypeArgument = field_argument}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.ApplicationType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -forallType :: (Core.Term -> Compute.Flow Graph.Graph Core.ForallType)-forallType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "parameter") name) (\parameter -> Flows.bind (Lexical.getField m (Core.Name "body") type_) (\body -> Flows.pure (Core.ForallType {- Core.forallTypeParameter = parameter,- Core.forallTypeBody = body})))))+binding :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Binding)+binding cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "term" term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "type" (Helpers.decodeMaybe typeScheme) fieldMap cx) (\field_type -> Right (Core.Binding {+ Core.bindingName = field_name,+ Core.bindingTerm = field_term,+ Core.bindingType = field_type})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Binding"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -functionType :: (Core.Term -> Compute.Flow Graph.Graph Core.FunctionType)-functionType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "domain") type_) (\domain -> Flows.bind (Lexical.getField m (Core.Name "codomain") type_) (\codomain -> Flows.pure (Core.FunctionType {- Core.functionTypeDomain = domain,- Core.functionTypeCodomain = codomain})))))+caseStatement :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.CaseStatement)+caseStatement cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "default" (Helpers.decodeMaybe term) fieldMap cx) (\field_default -> Eithers.bind (Helpers.requireField "cases" (Helpers.decodeList field) fieldMap cx) (\field_cases -> Right (Core.CaseStatement {+ Core.caseStatementTypeName = field_typeName,+ Core.caseStatementDefault = field_default,+ Core.caseStatementCases = field_cases})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.CaseStatement"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -integerType :: (Core.Term -> Compute.Flow Graph.Graph Core.IntegerType)-integerType = (Lexical.matchEnum (Core.Name "hydra.core.IntegerType") [- (Core.Name "bigint", Core.IntegerTypeBigint),- (Core.Name "int8", Core.IntegerTypeInt8),- (Core.Name "int16", Core.IntegerTypeInt16),- (Core.Name "int32", Core.IntegerTypeInt32),- (Core.Name "int64", Core.IntegerTypeInt64),- (Core.Name "uint8", Core.IntegerTypeUint8),- (Core.Name "uint16", Core.IntegerTypeUint16),- (Core.Name "uint32", Core.IntegerTypeUint32),- (Core.Name "uint64", Core.IntegerTypeUint64)])+eitherType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.EitherType)+eitherType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "left" type_ fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" type_ fieldMap cx) (\field_right -> Right (Core.EitherType {+ Core.eitherTypeLeft = field_left,+ Core.eitherTypeRight = field_right}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.EitherType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -literalType :: (Core.Term -> Compute.Flow Graph.Graph Core.LiteralType)-literalType = (Lexical.matchUnion (Core.Name "hydra.core.LiteralType") [- Lexical.matchUnitField (Core.Name "binary") Core.LiteralTypeBinary,- Lexical.matchUnitField (Core.Name "boolean") Core.LiteralTypeBoolean,- (Core.Name "float", (\ft -> Flows.map (\x -> Core.LiteralTypeFloat x) (floatType ft))),- (Core.Name "integer", (\it -> Flows.map (\x -> Core.LiteralTypeInteger x) (integerType it))),- (Lexical.matchUnitField (Core.Name "string") Core.LiteralTypeString)])+pairType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.PairType)+pairType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "first" type_ fieldMap cx) (\field_first -> Eithers.bind (Helpers.requireField "second" type_ fieldMap cx) (\field_second -> Right (Core.PairType {+ Core.pairTypeFirst = field_first,+ Core.pairTypeSecond = field_second}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.PairType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -mapType :: (Core.Term -> Compute.Flow Graph.Graph Core.MapType)-mapType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "keys") type_) (\keys -> Flows.bind (Lexical.getField m (Core.Name "values") type_) (\values -> Flows.pure (Core.MapType {- Core.mapTypeKeys = keys,- Core.mapTypeValues = values})))))+elimination :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Elimination)+elimination cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "record", (\input -> Eithers.map (\t -> Core.EliminationRecord t) (projection cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Core.EliminationUnion t) (caseStatement cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Core.EliminationWrap t) (name cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.Elimination"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -name :: (Core.Term -> Compute.Flow Graph.Graph Core.Name)-name term = (Flows.map (\x -> Core.Name x) (Flows.bind (Core_.wrap (Core.Name "hydra.core.Name") term) Core_.string))+field :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Field)+field cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "term" term fieldMap cx) (\field_term -> Right (Core.Field {+ Core.fieldName = field_name,+ Core.fieldTerm = field_term}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Field"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -rowType :: (Core.Term -> Compute.Flow Graph.Graph Core.RowType)-rowType = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "typeName") name) (\typeName -> Flows.bind (Lexical.getField m (Core.Name "fields") fieldTypes) (\fields -> Flows.pure (Core.RowType {- Core.rowTypeTypeName = typeName,- Core.rowTypeFields = fields})))))+fieldType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.FieldType)+fieldType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "type" type_ fieldMap cx) (\field_type -> Right (Core.FieldType {+ Core.fieldTypeName = field_name,+ Core.fieldTypeType = field_type}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.FieldType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -string :: (Core.Term -> Compute.Flow Graph.Graph String)-string term = (Core_.string (Rewriting.deannotateAndDetypeTerm term))+floatType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.FloatType)+floatType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "bigfloat", (\input -> Eithers.map (\t -> Core.FloatTypeBigfloat) (Helpers.decodeUnit cx input))),+ (Core.Name "float32", (\input -> Eithers.map (\t -> Core.FloatTypeFloat32) (Helpers.decodeUnit cx input))),+ (Core.Name "float64", (\input -> Eithers.map (\t -> Core.FloatTypeFloat64) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.FloatType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -type_ :: (Core.Term -> Compute.Flow Graph.Graph Core.Type)-type_ dat = ((\x -> case x of- Core.TermAnnotated v1 -> (Flows.map (\t -> Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = t,- Core.annotatedTypeAnnotation = (Core.annotatedTermAnnotation v1)})) (type_ (Core.annotatedTermSubject v1)))- _ -> (Lexical.matchUnion (Core.Name "hydra.core.Type") [- (Core.Name "application", (\at -> Flows.map (\x -> Core.TypeApplication x) (applicationType at))),- (Core.Name "forall", (\ft -> Flows.map (\x -> Core.TypeForall x) (forallType ft))),- (Core.Name "function", (\ft -> Flows.map (\x -> Core.TypeFunction x) (functionType ft))),- (Core.Name "list", (\et -> Flows.map (\x -> Core.TypeList x) (type_ et))),- (Core.Name "literal", (\lt -> Flows.map (\x -> Core.TypeLiteral x) (literalType lt))),- (Core.Name "map", (\mt -> Flows.map (\x -> Core.TypeMap x) (mapType mt))),- (Core.Name "optional", (\et -> Flows.map (\x -> Core.TypeOptional x) (type_ et))),- (Core.Name "product", (\types -> Flows.map (\x -> Core.TypeProduct x) (Core_.listOf type_ types))),- (Core.Name "record", (\rt -> Flows.map (\x -> Core.TypeRecord x) (rowType rt))),- (Core.Name "set", (\et -> Flows.map (\x -> Core.TypeSet x) (type_ et))),- (Core.Name "sum", (\types -> Flows.map (\x -> Core.TypeSum x) (Core_.listOf type_ types))),- (Core.Name "union", (\rt -> Flows.map (\x -> Core.TypeUnion x) (rowType rt))),- (Core.Name "unit", (\_ -> Flows.pure Core.TypeUnit)),- (Core.Name "variable", (\n -> Flows.map (\x -> Core.TypeVariable x) (name n))),- (Core.Name "wrap", (\wt -> Flows.map (\x -> Core.TypeWrap x) (wrappedType wt)))] dat)) dat)+floatValue :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.FloatValue)+floatValue cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "bigfloat", (\input -> Eithers.map (\t -> Core.FloatValueBigfloat t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralFloat v3 -> ((\x -> case x of+ Core.FloatValueBigfloat v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected bigfloat value"))) v3)+ _ -> (Left (Util.DecodingError "expected bigfloat literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "float32", (\input -> Eithers.map (\t -> Core.FloatValueFloat32 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralFloat v3 -> ((\x -> case x of+ Core.FloatValueFloat32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected float32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected float32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "float64", (\input -> Eithers.map (\t -> Core.FloatValueFloat64 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralFloat v3 -> ((\x -> case x of+ Core.FloatValueFloat64 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected float64 value"))) v3)+ _ -> (Left (Util.DecodingError "expected float64 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.FloatValue"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -typeScheme :: (Core.Term -> Compute.Flow Graph.Graph Core.TypeScheme)-typeScheme = (Lexical.matchRecord (\m -> Flows.bind (Lexical.getField m (Core.Name "variables") (Core_.listOf name)) (\vars -> Flows.bind (Lexical.getField m (Core.Name "type") type_) (\body -> Flows.pure (Core.TypeScheme {- Core.typeSchemeVariables = vars,- Core.typeSchemeType = body})))))+forallType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.ForallType)+forallType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "parameter" name fieldMap cx) (\field_parameter -> Eithers.bind (Helpers.requireField "body" type_ fieldMap cx) (\field_body -> Right (Core.ForallType {+ Core.forallTypeParameter = field_parameter,+ Core.forallTypeBody = field_body}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.ForallType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) -wrappedType :: (Core.Term -> Compute.Flow Graph.Graph Core.WrappedType)-wrappedType term = (Flows.bind (Core_.record (Core.Name "hydra.core.WrappedType") term) (\fields -> Flows.bind (Core_.field (Core.Name "typeName") name fields) (\name -> Flows.bind (Core_.field (Core.Name "object") type_ fields) (\obj -> Flows.pure (Core.WrappedType {- Core.wrappedTypeTypeName = name,- Core.wrappedTypeObject = obj})))))+function :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Function)+function cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "elimination", (\input -> Eithers.map (\t -> Core.FunctionElimination t) (elimination cx input))),+ (Core.Name "lambda", (\input -> Eithers.map (\t -> Core.FunctionLambda t) (lambda cx input))),+ (Core.Name "primitive", (\input -> Eithers.map (\t -> Core.FunctionPrimitive t) (name cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.Function"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++functionType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.FunctionType)+functionType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "domain" type_ fieldMap cx) (\field_domain -> Eithers.bind (Helpers.requireField "codomain" type_ fieldMap cx) (\field_codomain -> Right (Core.FunctionType {+ Core.functionTypeDomain = field_domain,+ Core.functionTypeCodomain = field_codomain}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.FunctionType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++injection :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Injection)+injection cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "field" field fieldMap cx) (\field_field -> Right (Core.Injection {+ Core.injectionTypeName = field_typeName,+ Core.injectionField = field_field}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Injection"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++integerType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.IntegerType)+integerType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "bigint", (\input -> Eithers.map (\t -> Core.IntegerTypeBigint) (Helpers.decodeUnit cx input))),+ (Core.Name "int8", (\input -> Eithers.map (\t -> Core.IntegerTypeInt8) (Helpers.decodeUnit cx input))),+ (Core.Name "int16", (\input -> Eithers.map (\t -> Core.IntegerTypeInt16) (Helpers.decodeUnit cx input))),+ (Core.Name "int32", (\input -> Eithers.map (\t -> Core.IntegerTypeInt32) (Helpers.decodeUnit cx input))),+ (Core.Name "int64", (\input -> Eithers.map (\t -> Core.IntegerTypeInt64) (Helpers.decodeUnit cx input))),+ (Core.Name "uint8", (\input -> Eithers.map (\t -> Core.IntegerTypeUint8) (Helpers.decodeUnit cx input))),+ (Core.Name "uint16", (\input -> Eithers.map (\t -> Core.IntegerTypeUint16) (Helpers.decodeUnit cx input))),+ (Core.Name "uint32", (\input -> Eithers.map (\t -> Core.IntegerTypeUint32) (Helpers.decodeUnit cx input))),+ (Core.Name "uint64", (\input -> Eithers.map (\t -> Core.IntegerTypeUint64) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.IntegerType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++integerValue :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.IntegerValue)+integerValue cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "bigint", (\input -> Eithers.map (\t -> Core.IntegerValueBigint t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueBigint v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected bigint value"))) v3)+ _ -> (Left (Util.DecodingError "expected bigint literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "int8", (\input -> Eithers.map (\t -> Core.IntegerValueInt8 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt8 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int8 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int8 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "int16", (\input -> Eithers.map (\t -> Core.IntegerValueInt16 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt16 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int16 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int16 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "int32", (\input -> Eithers.map (\t -> Core.IntegerValueInt32 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "int64", (\input -> Eithers.map (\t -> Core.IntegerValueInt64 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt64 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int64 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int64 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "uint8", (\input -> Eithers.map (\t -> Core.IntegerValueUint8 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueUint8 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected uint8 value"))) v3)+ _ -> (Left (Util.DecodingError "expected uint8 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "uint16", (\input -> Eithers.map (\t -> Core.IntegerValueUint16 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueUint16 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected uint16 value"))) v3)+ _ -> (Left (Util.DecodingError "expected uint16 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "uint32", (\input -> Eithers.map (\t -> Core.IntegerValueUint32 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueUint32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected uint32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected uint32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "uint64", (\input -> Eithers.map (\t -> Core.IntegerValueUint64 t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueUint64 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected uint64 value"))) v3)+ _ -> (Left (Util.DecodingError "expected uint64 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.IntegerValue"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++lambda :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Lambda)+lambda cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "parameter" name fieldMap cx) (\field_parameter -> Eithers.bind (Helpers.requireField "domain" (Helpers.decodeMaybe type_) fieldMap cx) (\field_domain -> Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Right (Core.Lambda {+ Core.lambdaParameter = field_parameter,+ Core.lambdaDomain = field_domain,+ Core.lambdaBody = field_body})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Lambda"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++let_ :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Let)+let_ cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "bindings" (Helpers.decodeList binding) fieldMap cx) (\field_bindings -> Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Right (Core.Let {+ Core.letBindings = field_bindings,+ Core.letBody = field_body}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Let"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++literal :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Literal)+literal cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "binary", (\input -> Eithers.map (\t -> Core.LiteralBinary t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBinary v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected binary literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "boolean", (\input -> Eithers.map (\t -> Core.LiteralBoolean t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "float", (\input -> Eithers.map (\t -> Core.LiteralFloat t) (floatValue cx input))),+ (Core.Name "integer", (\input -> Eithers.map (\t -> Core.LiteralInteger t) (integerValue cx input))),+ (Core.Name "string", (\input -> Eithers.map (\t -> Core.LiteralString t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.Literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++literalType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.LiteralType)+literalType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "binary", (\input -> Eithers.map (\t -> Core.LiteralTypeBinary) (Helpers.decodeUnit cx input))),+ (Core.Name "boolean", (\input -> Eithers.map (\t -> Core.LiteralTypeBoolean) (Helpers.decodeUnit cx input))),+ (Core.Name "float", (\input -> Eithers.map (\t -> Core.LiteralTypeFloat t) (floatType cx input))),+ (Core.Name "integer", (\input -> Eithers.map (\t -> Core.LiteralTypeInteger t) (integerType cx input))),+ (Core.Name "string", (\input -> Eithers.map (\t -> Core.LiteralTypeString) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.LiteralType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++mapType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.MapType)+mapType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "keys" type_ fieldMap cx) (\field_keys -> Eithers.bind (Helpers.requireField "values" type_ fieldMap cx) (\field_values -> Right (Core.MapType {+ Core.mapTypeKeys = field_keys,+ Core.mapTypeValues = field_values}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.MapType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++name :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Name)+name cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Core.Name b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.core.Name"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++projection :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Projection)+projection cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "field" name fieldMap cx) (\field_field -> Right (Core.Projection {+ Core.projectionTypeName = field_typeName,+ Core.projectionField = field_field}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Projection"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++record :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Record)+record cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "fields" (Helpers.decodeList field) fieldMap cx) (\field_fields -> Right (Core.Record {+ Core.recordTypeName = field_typeName,+ Core.recordFields = field_fields}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.Record"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++rowType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.RowType)+rowType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "fields" (Helpers.decodeList fieldType) fieldMap cx) (\field_fields -> Right (Core.RowType {+ Core.rowTypeTypeName = field_typeName,+ Core.rowTypeFields = field_fields}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.RowType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++term :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Term)+term cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "annotated", (\input -> Eithers.map (\t -> Core.TermAnnotated t) (annotatedTerm cx input))),+ (Core.Name "application", (\input -> Eithers.map (\t -> Core.TermApplication t) (application cx input))),+ (Core.Name "either", (\input -> Eithers.map (\t -> Core.TermEither t) (Helpers.decodeEither term term cx input))),+ (Core.Name "function", (\input -> Eithers.map (\t -> Core.TermFunction t) (function cx input))),+ (Core.Name "let", (\input -> Eithers.map (\t -> Core.TermLet t) (let_ cx input))),+ (Core.Name "list", (\input -> Eithers.map (\t -> Core.TermList t) (Helpers.decodeList term cx input))),+ (Core.Name "literal", (\input -> Eithers.map (\t -> Core.TermLiteral t) (literal cx input))),+ (Core.Name "map", (\input -> Eithers.map (\t -> Core.TermMap t) (Helpers.decodeMap term term cx input))),+ (Core.Name "maybe", (\input -> Eithers.map (\t -> Core.TermMaybe t) (Helpers.decodeMaybe term cx input))),+ (Core.Name "pair", (\input -> Eithers.map (\t -> Core.TermPair t) (Helpers.decodePair term term cx input))),+ (Core.Name "record", (\input -> Eithers.map (\t -> Core.TermRecord t) (record cx input))),+ (Core.Name "set", (\input -> Eithers.map (\t -> Core.TermSet t) (Helpers.decodeSet term cx input))),+ (Core.Name "typeApplication", (\input -> Eithers.map (\t -> Core.TermTypeApplication t) (typeApplicationTerm cx input))),+ (Core.Name "typeLambda", (\input -> Eithers.map (\t -> Core.TermTypeLambda t) (typeLambda cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Core.TermUnion t) (injection cx input))),+ (Core.Name "unit", (\input -> Eithers.map (\t -> Core.TermUnit) (Helpers.decodeUnit cx input))),+ (Core.Name "variable", (\input -> Eithers.map (\t -> Core.TermVariable t) (name cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Core.TermWrap t) (wrappedTerm cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.Term"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++type_ :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.Type)+type_ cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "annotated", (\input -> Eithers.map (\t -> Core.TypeAnnotated t) (annotatedType cx input))),+ (Core.Name "application", (\input -> Eithers.map (\t -> Core.TypeApplication t) (applicationType cx input))),+ (Core.Name "either", (\input -> Eithers.map (\t -> Core.TypeEither t) (eitherType cx input))),+ (Core.Name "forall", (\input -> Eithers.map (\t -> Core.TypeForall t) (forallType cx input))),+ (Core.Name "function", (\input -> Eithers.map (\t -> Core.TypeFunction t) (functionType cx input))),+ (Core.Name "list", (\input -> Eithers.map (\t -> Core.TypeList t) (type_ cx input))),+ (Core.Name "literal", (\input -> Eithers.map (\t -> Core.TypeLiteral t) (literalType cx input))),+ (Core.Name "map", (\input -> Eithers.map (\t -> Core.TypeMap t) (mapType cx input))),+ (Core.Name "maybe", (\input -> Eithers.map (\t -> Core.TypeMaybe t) (type_ cx input))),+ (Core.Name "pair", (\input -> Eithers.map (\t -> Core.TypePair t) (pairType cx input))),+ (Core.Name "record", (\input -> Eithers.map (\t -> Core.TypeRecord t) (rowType cx input))),+ (Core.Name "set", (\input -> Eithers.map (\t -> Core.TypeSet t) (type_ cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Core.TypeUnion t) (rowType cx input))),+ (Core.Name "unit", (\input -> Eithers.map (\t -> Core.TypeUnit) (Helpers.decodeUnit cx input))),+ (Core.Name "variable", (\input -> Eithers.map (\t -> Core.TypeVariable t) (name cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Core.TypeWrap t) (wrappedType cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.core.Type"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeApplicationTerm :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.TypeApplicationTerm)+typeApplicationTerm cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Eithers.bind (Helpers.requireField "type" type_ fieldMap cx) (\field_type -> Right (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = field_body,+ Core.typeApplicationTermType = field_type}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.TypeApplicationTerm"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeLambda :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.TypeLambda)+typeLambda cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "parameter" name fieldMap cx) (\field_parameter -> Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Right (Core.TypeLambda {+ Core.typeLambdaParameter = field_parameter,+ Core.typeLambdaBody = field_body}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.TypeLambda"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeScheme :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.TypeScheme)+typeScheme cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "variables" (Helpers.decodeList name) fieldMap cx) (\field_variables -> Eithers.bind (Helpers.requireField "type" type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "constraints" (Helpers.decodeMaybe (Helpers.decodeMap name typeVariableMetadata)) fieldMap cx) (\field_constraints -> Right (Core.TypeScheme {+ Core.typeSchemeVariables = field_variables,+ Core.typeSchemeType = field_type,+ Core.typeSchemeConstraints = field_constraints})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.TypeScheme"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeVariableMetadata :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.TypeVariableMetadata)+typeVariableMetadata cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "classes" (Helpers.decodeSet name) fieldMap cx) (\field_classes -> Right (Core.TypeVariableMetadata {+ Core.typeVariableMetadataClasses = field_classes})))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.TypeVariableMetadata"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++wrappedTerm :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.WrappedTerm)+wrappedTerm cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "body" term fieldMap cx) (\field_body -> Right (Core.WrappedTerm {+ Core.wrappedTermTypeName = field_typeName,+ Core.wrappedTermBody = field_body}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.WrappedTerm"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++wrappedType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Core.WrappedType)+wrappedType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeName" name fieldMap cx) (\field_typeName -> Eithers.bind (Helpers.requireField "body" type_ fieldMap cx) (\field_body -> Right (Core.WrappedType {+ Core.wrappedTypeTypeName = field_typeName,+ Core.wrappedTypeBody = field_body}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.core.WrappedType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Grammar.hs view
@@ -0,0 +1,107 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.grammar++module Hydra.Decode.Grammar where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Grammar as Grammar+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++constant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Constant)+constant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Grammar.Constant b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.grammar.Constant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++grammar :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Grammar)+grammar cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Grammar.Grammar b) (Helpers.decodeList production cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.grammar.Grammar"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++label :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Label)+label cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Grammar.Label b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.grammar.Label"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++labeledPattern :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.LabeledPattern)+labeledPattern cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "label" label fieldMap cx) (\field_label -> Eithers.bind (Helpers.requireField "pattern" pattern fieldMap cx) (\field_pattern -> Right (Grammar.LabeledPattern {+ Grammar.labeledPatternLabel = field_label,+ Grammar.labeledPatternPattern = field_pattern}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.grammar.LabeledPattern"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++pattern :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Pattern)+pattern cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "alternatives", (\input -> Eithers.map (\t -> Grammar.PatternAlternatives t) (Helpers.decodeList pattern cx input))),+ (Core.Name "constant", (\input -> Eithers.map (\t -> Grammar.PatternConstant t) (constant cx input))),+ (Core.Name "ignored", (\input -> Eithers.map (\t -> Grammar.PatternIgnored t) (pattern cx input))),+ (Core.Name "labeled", (\input -> Eithers.map (\t -> Grammar.PatternLabeled t) (labeledPattern cx input))),+ (Core.Name "nil", (\input -> Eithers.map (\t -> Grammar.PatternNil) (Helpers.decodeUnit cx input))),+ (Core.Name "nonterminal", (\input -> Eithers.map (\t -> Grammar.PatternNonterminal t) (symbol cx input))),+ (Core.Name "option", (\input -> Eithers.map (\t -> Grammar.PatternOption t) (pattern cx input))),+ (Core.Name "plus", (\input -> Eithers.map (\t -> Grammar.PatternPlus t) (pattern cx input))),+ (Core.Name "regex", (\input -> Eithers.map (\t -> Grammar.PatternRegex t) (regex cx input))),+ (Core.Name "sequence", (\input -> Eithers.map (\t -> Grammar.PatternSequence t) (Helpers.decodeList pattern cx input))),+ (Core.Name "star", (\input -> Eithers.map (\t -> Grammar.PatternStar t) (pattern cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.grammar.Pattern"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++production :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Production)+production cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "symbol" symbol fieldMap cx) (\field_symbol -> Eithers.bind (Helpers.requireField "pattern" pattern fieldMap cx) (\field_pattern -> Right (Grammar.Production {+ Grammar.productionSymbol = field_symbol,+ Grammar.productionPattern = field_pattern}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.grammar.Production"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++regex :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Regex)+regex cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Grammar.Regex b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.grammar.Regex"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++symbol :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Grammar.Symbol)+symbol cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Grammar.Symbol b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.grammar.Symbol"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Json.hs view
@@ -0,0 +1,61 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.json++module Hydra.Decode.Json where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++value :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Model.Value)+value cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "array", (\input -> Eithers.map (\t -> Model.ValueArray t) (Helpers.decodeList value cx input))),+ (Core.Name "boolean", (\input -> Eithers.map (\t -> Model.ValueBoolean t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "null", (\input -> Eithers.map (\t -> Model.ValueNull) (Helpers.decodeUnit cx input))),+ (Core.Name "number", (\input -> Eithers.map (\t -> Model.ValueNumber t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralFloat v3 -> ((\x -> case x of+ Core.FloatValueBigfloat v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected bigfloat value"))) v3)+ _ -> (Left (Util.DecodingError "expected bigfloat literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "object", (\input -> Eithers.map (\t -> Model.ValueObject t) (Helpers.decodeMap (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) value cx input))),+ (Core.Name "string", (\input -> Eithers.map (\t -> Model.ValueString t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.json.model.Value"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Json/Model.hs view
@@ -0,0 +1,61 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.json.model++module Hydra.Decode.Json.Model where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++value :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Model.Value)+value cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "array", (\input -> Eithers.map (\t -> Model.ValueArray t) (Helpers.decodeList value cx input))),+ (Core.Name "boolean", (\input -> Eithers.map (\t -> Model.ValueBoolean t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "null", (\input -> Eithers.map (\t -> Model.ValueNull) (Helpers.decodeUnit cx input))),+ (Core.Name "number", (\input -> Eithers.map (\t -> Model.ValueNumber t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralFloat v3 -> ((\x -> case x of+ Core.FloatValueBigfloat v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected bigfloat value"))) v3)+ _ -> (Left (Util.DecodingError "expected bigfloat literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "object", (\input -> Eithers.map (\t -> Model.ValueObject t) (Helpers.decodeMap (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) value cx input))),+ (Core.Name "string", (\input -> Eithers.map (\t -> Model.ValueString t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.json.model.Value"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Module.hs view
@@ -0,0 +1,115 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.module++module Hydra.Decode.Module where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Module as Module+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++definition :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.Definition)+definition cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "term", (\input -> Eithers.map (\t -> Module.DefinitionTerm t) (termDefinition cx input))),+ (Core.Name "type", (\input -> Eithers.map (\t -> Module.DefinitionType t) (typeDefinition cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.module.Definition"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++fileExtension :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.FileExtension)+fileExtension cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Module.FileExtension b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.module.FileExtension"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++module_ :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.Module)+module_ cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "namespace" namespace fieldMap cx) (\field_namespace -> Eithers.bind (Helpers.requireField "elements" (Helpers.decodeList Core_.binding) fieldMap cx) (\field_elements -> Eithers.bind (Helpers.requireField "termDependencies" (Helpers.decodeList namespace) fieldMap cx) (\field_termDependencies -> Eithers.bind (Helpers.requireField "typeDependencies" (Helpers.decodeList namespace) fieldMap cx) (\field_typeDependencies -> Eithers.bind (Helpers.requireField "description" (Helpers.decodeMaybe (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_description -> Right (Module.Module {+ Module.moduleNamespace = field_namespace,+ Module.moduleElements = field_elements,+ Module.moduleTermDependencies = field_termDependencies,+ Module.moduleTypeDependencies = field_typeDependencies,+ Module.moduleDescription = field_description})))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.module.Module"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++namespace :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.Namespace)+namespace cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Module.Namespace b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.module.Namespace"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++namespaces :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Module.Namespaces t0))+namespaces n cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "focus" (Helpers.decodePair namespace n) fieldMap cx) (\field_focus -> Eithers.bind (Helpers.requireField "mapping" (Helpers.decodeMap namespace n) fieldMap cx) (\field_mapping -> Right (Module.Namespaces {+ Module.namespacesFocus = field_focus,+ Module.namespacesMapping = field_mapping}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.module.Namespaces"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++qualifiedName :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.QualifiedName)+qualifiedName cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "namespace" (Helpers.decodeMaybe namespace) fieldMap cx) (\field_namespace -> Eithers.bind (Helpers.requireField "local" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_local -> Right (Module.QualifiedName {+ Module.qualifiedNameNamespace = field_namespace,+ Module.qualifiedNameLocal = field_local}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.module.QualifiedName"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++termDefinition :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.TermDefinition)+termDefinition cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Core_.name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "type" Core_.typeScheme fieldMap cx) (\field_type -> Right (Module.TermDefinition {+ Module.termDefinitionName = field_name,+ Module.termDefinitionTerm = field_term,+ Module.termDefinitionType = field_type})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.module.TermDefinition"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeDefinition :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Module.TypeDefinition)+typeDefinition cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Core_.name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Right (Module.TypeDefinition {+ Module.typeDefinitionName = field_name,+ Module.typeDefinitionType = field_type}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.module.TypeDefinition"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Parsing.hs view
@@ -0,0 +1,69 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.parsing++module Hydra.Decode.Parsing where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++parseError :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Parsing.ParseError)+parseError cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "message" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_message -> Eithers.bind (Helpers.requireField "remainder" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_remainder -> Right (Parsing.ParseError {+ Parsing.parseErrorMessage = field_message,+ Parsing.parseErrorRemainder = field_remainder}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.parsing.ParseError"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++parseResult :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Parsing.ParseResult t0))+parseResult a cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "success", (\input -> Eithers.map (\t -> Parsing.ParseResultSuccess t) (parseSuccess a cx input))),+ (Core.Name "failure", (\input -> Eithers.map (\t -> Parsing.ParseResultFailure t) (parseError cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.parsing.ParseResult"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++parseSuccess :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Parsing.ParseSuccess t0))+parseSuccess a cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "value" a fieldMap cx) (\field_value -> Eithers.bind (Helpers.requireField "remainder" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_remainder -> Right (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = field_value,+ Parsing.parseSuccessRemainder = field_remainder}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.parsing.ParseSuccess"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Phantoms.hs view
@@ -0,0 +1,34 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.phantoms++module Hydra.Decode.Phantoms where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Phantoms as Phantoms+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++tBinding :: (t0 -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Phantoms.TBinding t1))+tBinding a cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Core_.name fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "term" (tTerm a) fieldMap cx) (\field_term -> Right (Phantoms.TBinding {+ Phantoms.tBindingName = field_name,+ Phantoms.tBindingTerm = field_term}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.phantoms.TBinding"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++tTerm :: (t0 -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Phantoms.TTerm t1))+tTerm a cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Phantoms.TTerm b) (Core_.term cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.phantoms.TTerm"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Query.hs view
@@ -0,0 +1,229 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.query++module Hydra.Decode.Query where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Query as Query+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++comparisonConstraint :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.ComparisonConstraint)+comparisonConstraint cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "equal", (\input -> Eithers.map (\t -> Query.ComparisonConstraintEqual) (Helpers.decodeUnit cx input))),+ (Core.Name "notEqual", (\input -> Eithers.map (\t -> Query.ComparisonConstraintNotEqual) (Helpers.decodeUnit cx input))),+ (Core.Name "lessThan", (\input -> Eithers.map (\t -> Query.ComparisonConstraintLessThan) (Helpers.decodeUnit cx input))),+ (Core.Name "greaterThan", (\input -> Eithers.map (\t -> Query.ComparisonConstraintGreaterThan) (Helpers.decodeUnit cx input))),+ (Core.Name "lessThanOrEqual", (\input -> Eithers.map (\t -> Query.ComparisonConstraintLessThanOrEqual) (Helpers.decodeUnit cx input))),+ (Core.Name "greaterThanOrEqual", (\input -> Eithers.map (\t -> Query.ComparisonConstraintGreaterThanOrEqual) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.ComparisonConstraint"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++edge :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Edge)+edge cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "type" Core_.name fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "out" (Helpers.decodeMaybe Core_.name) fieldMap cx) (\field_out -> Eithers.bind (Helpers.requireField "in" (Helpers.decodeMaybe Core_.name) fieldMap cx) (\field_in -> Right (Query.Edge {+ Query.edgeType = field_type,+ Query.edgeOut = field_out,+ Query.edgeIn = field_in})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.Edge"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++graphPattern :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.GraphPattern)+graphPattern cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "graph" Core_.name fieldMap cx) (\field_graph -> Eithers.bind (Helpers.requireField "patterns" (Helpers.decodeList pattern) fieldMap cx) (\field_patterns -> Right (Query.GraphPattern {+ Query.graphPatternGraph = field_graph,+ Query.graphPatternPatterns = field_patterns}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.GraphPattern"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++node :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Node)+node cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "term", (\input -> Eithers.map (\t -> Query.NodeTerm t) (Core_.term cx input))),+ (Core.Name "variable", (\input -> Eithers.map (\t -> Query.NodeVariable t) (variable cx input))),+ (Core.Name "wildcard", (\input -> Eithers.map (\t -> Query.NodeWildcard) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.Node"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++path :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Path)+path cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "step", (\input -> Eithers.map (\t -> Query.PathStep t) (step cx input))),+ (Core.Name "regex", (\input -> Eithers.map (\t -> Query.PathRegex t) (regexSequence cx input))),+ (Core.Name "inverse", (\input -> Eithers.map (\t -> Query.PathInverse t) (path cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.Path"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++pattern :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Pattern)+pattern cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "triple", (\input -> Eithers.map (\t -> Query.PatternTriple t) (triplePattern cx input))),+ (Core.Name "negation", (\input -> Eithers.map (\t -> Query.PatternNegation t) (pattern cx input))),+ (Core.Name "conjunction", (\input -> Eithers.map (\t -> Query.PatternConjunction t) (Helpers.decodeList pattern cx input))),+ (Core.Name "disjunction", (\input -> Eithers.map (\t -> Query.PatternDisjunction t) (Helpers.decodeList pattern cx input))),+ (Core.Name "graph", (\input -> Eithers.map (\t -> Query.PatternGraph t) (graphPattern cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.Pattern"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++query :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Query)+query cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "variables" (Helpers.decodeList variable) fieldMap cx) (\field_variables -> Eithers.bind (Helpers.requireField "patterns" (Helpers.decodeList pattern) fieldMap cx) (\field_patterns -> Right (Query.Query {+ Query.queryVariables = field_variables,+ Query.queryPatterns = field_patterns}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.Query"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++range :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Range)+range cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "min" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_min -> Eithers.bind (Helpers.requireField "max" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_max -> Right (Query.Range {+ Query.rangeMin = field_min,+ Query.rangeMax = field_max}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.Range"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++regexQuantifier :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.RegexQuantifier)+regexQuantifier cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "one", (\input -> Eithers.map (\t -> Query.RegexQuantifierOne) (Helpers.decodeUnit cx input))),+ (Core.Name "zeroOrOne", (\input -> Eithers.map (\t -> Query.RegexQuantifierZeroOrOne) (Helpers.decodeUnit cx input))),+ (Core.Name "zeroOrMore", (\input -> Eithers.map (\t -> Query.RegexQuantifierZeroOrMore) (Helpers.decodeUnit cx input))),+ (Core.Name "oneOrMore", (\input -> Eithers.map (\t -> Query.RegexQuantifierOneOrMore) (Helpers.decodeUnit cx input))),+ (Core.Name "exactly", (\input -> Eithers.map (\t -> Query.RegexQuantifierExactly t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "atLeast", (\input -> Eithers.map (\t -> Query.RegexQuantifierAtLeast t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "range", (\input -> Eithers.map (\t -> Query.RegexQuantifierRange t) (range cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.RegexQuantifier"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++regexSequence :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.RegexSequence)+regexSequence cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "path" path fieldMap cx) (\field_path -> Eithers.bind (Helpers.requireField "quantifier" regexQuantifier fieldMap cx) (\field_quantifier -> Right (Query.RegexSequence {+ Query.regexSequencePath = field_path,+ Query.regexSequenceQuantifier = field_quantifier}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.RegexSequence"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++step :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Step)+step cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "edge", (\input -> Eithers.map (\t -> Query.StepEdge t) (edge cx input))),+ (Core.Name "project", (\input -> Eithers.map (\t -> Query.StepProject t) (Core_.projection cx input))),+ (Core.Name "compare", (\input -> Eithers.map (\t -> Query.StepCompare t) (comparisonConstraint cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.query.Step"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++triplePattern :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.TriplePattern)+triplePattern cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "subject" node fieldMap cx) (\field_subject -> Eithers.bind (Helpers.requireField "predicate" path fieldMap cx) (\field_predicate -> Eithers.bind (Helpers.requireField "object" node fieldMap cx) (\field_object -> Right (Query.TriplePattern {+ Query.triplePatternSubject = field_subject,+ Query.triplePatternPredicate = field_predicate,+ Query.triplePatternObject = field_object})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.query.TriplePattern"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++variable :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Query.Variable)+variable cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Query.Variable b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.query.Variable"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Relational.hs view
@@ -0,0 +1,86 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.relational++module Hydra.Decode.Relational where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Relational as Relational+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++columnName :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Relational.ColumnName)+columnName cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.ColumnName b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.ColumnName"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++columnSchema :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Relational.ColumnSchema t0))+columnSchema t cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" columnName fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "domain" t fieldMap cx) (\field_domain -> Right (Relational.ColumnSchema {+ Relational.columnSchemaName = field_name,+ Relational.columnSchemaDomain = field_domain}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.relational.ColumnSchema"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++foreignKey :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Relational.ForeignKey)+foreignKey cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "foreignRelation" relationName fieldMap cx) (\field_foreignRelation -> Eithers.bind (Helpers.requireField "keys" (Helpers.decodeMap columnName columnName) fieldMap cx) (\field_keys -> Right (Relational.ForeignKey {+ Relational.foreignKeyForeignRelation = field_foreignRelation,+ Relational.foreignKeyKeys = field_keys}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.relational.ForeignKey"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++primaryKey :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Relational.PrimaryKey)+primaryKey cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.PrimaryKey b) (Helpers.decodeList columnName cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.PrimaryKey"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++relation :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Relational.Relation t0))+relation v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.Relation b) (Helpers.decodeList (row v) cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.Relation"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++relationName :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Relational.RelationName)+relationName cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.RelationName b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.RelationName"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++relationSchema :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Relational.RelationSchema t0))+relationSchema t cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" relationName fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "columns" (Helpers.decodeList (columnSchema t)) fieldMap cx) (\field_columns -> Eithers.bind (Helpers.requireField "primaryKeys" (Helpers.decodeList primaryKey) fieldMap cx) (\field_primaryKeys -> Eithers.bind (Helpers.requireField "foreignKeys" (Helpers.decodeList foreignKey) fieldMap cx) (\field_foreignKeys -> Right (Relational.RelationSchema {+ Relational.relationSchemaName = field_name,+ Relational.relationSchemaColumns = field_columns,+ Relational.relationSchemaPrimaryKeys = field_primaryKeys,+ Relational.relationSchemaForeignKeys = field_foreignKeys}))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.relational.RelationSchema"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++relationship :: Ord t0 => ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Relational.Relationship t0))+relationship v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.Relationship b) (Helpers.decodeSet (Helpers.decodeMap columnName v) cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.Relationship"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++row :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Relational.Row t0))+row v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Relational.Row b) (Helpers.decodeList v cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.relational.Row"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Tabular.hs view
@@ -0,0 +1,62 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.tabular++module Hydra.Decode.Tabular where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Decode.Relational as Relational+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Tabular as Tabular+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++columnType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Tabular.ColumnType)+columnType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Relational.columnName fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Right (Tabular.ColumnType {+ Tabular.columnTypeName = field_name,+ Tabular.columnTypeType = field_type}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.tabular.ColumnType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++dataRow :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Tabular.DataRow t0))+dataRow v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Tabular.DataRow b) (Helpers.decodeList (Helpers.decodeMaybe v) cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.tabular.DataRow"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++headerRow :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Tabular.HeaderRow)+headerRow cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Tabular.HeaderRow b) (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.tabular.HeaderRow"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++table :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Tabular.Table t0))+table v cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "header" (Helpers.decodeMaybe headerRow) fieldMap cx) (\field_header -> Eithers.bind (Helpers.requireField "data" (Helpers.decodeList (dataRow v)) fieldMap cx) (\field_data -> Right (Tabular.Table {+ Tabular.tableHeader = field_header,+ Tabular.tableData = field_data}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.tabular.Table"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++tableType :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Tabular.TableType)+tableType cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" Relational.relationName fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "columns" (Helpers.decodeList columnType) fieldMap cx) (\field_columns -> Right (Tabular.TableType {+ Tabular.tableTypeName = field_name,+ Tabular.tableTypeColumns = field_columns}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.tabular.TableType"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Testing.hs view
@@ -0,0 +1,669 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.testing++module Hydra.Decode.Testing where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Ast as Ast+import qualified Hydra.Decode.Coders as Coders+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Decode.Json.Model as Model+import qualified Hydra.Decode.Parsing as Parsing+import qualified Hydra.Decode.Typing as Typing+import qualified Hydra.Decode.Util as Util+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model_+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Testing as Testing+import qualified Hydra.Util as Util_+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++alphaConversionTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.AlphaConversionTestCase)+alphaConversionTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "oldVariable" Core_.name fieldMap cx) (\field_oldVariable -> Eithers.bind (Helpers.requireField "newVariable" Core_.name fieldMap cx) (\field_newVariable -> Eithers.bind (Helpers.requireField "result" Core_.term fieldMap cx) (\field_result -> Right (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = field_term,+ Testing.alphaConversionTestCaseOldVariable = field_oldVariable,+ Testing.alphaConversionTestCaseNewVariable = field_newVariable,+ Testing.alphaConversionTestCaseResult = field_result}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.AlphaConversionTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++evaluationStyle :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.EvaluationStyle)+evaluationStyle cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "eager", (\input -> Eithers.map (\t -> Testing.EvaluationStyleEager) (Helpers.decodeUnit cx input))),+ (Core.Name "lazy", (\input -> Eithers.map (\t -> Testing.EvaluationStyleLazy) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.EvaluationStyle"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++caseConversionTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.CaseConversionTestCase)+caseConversionTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "fromConvention" Util.caseConvention fieldMap cx) (\field_fromConvention -> Eithers.bind (Helpers.requireField "toConvention" Util.caseConvention fieldMap cx) (\field_toConvention -> Eithers.bind (Helpers.requireField "fromString" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_fromString -> Eithers.bind (Helpers.requireField "toString" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_toString -> Right (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = field_fromConvention,+ Testing.caseConversionTestCaseToConvention = field_toConvention,+ Testing.caseConversionTestCaseFromString = field_fromString,+ Testing.caseConversionTestCaseToString = field_toString}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.CaseConversionTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++delegatedEvaluationTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.DelegatedEvaluationTestCase)+delegatedEvaluationTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.DelegatedEvaluationTestCase {+ Testing.delegatedEvaluationTestCaseInput = field_input,+ Testing.delegatedEvaluationTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.DelegatedEvaluationTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++etaExpansionTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.EtaExpansionTestCase)+etaExpansionTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = field_input,+ Testing.etaExpansionTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.EtaExpansionTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++deannotateTermTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.DeannotateTermTestCase)+deannotateTermTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = field_input,+ Testing.deannotateTermTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.DeannotateTermTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++deannotateTypeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.DeannotateTypeTestCase)+deannotateTypeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.type_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.type_ fieldMap cx) (\field_output -> Right (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = field_input,+ Testing.deannotateTypeTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.DeannotateTypeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++flattenLetTermsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.FlattenLetTermsTestCase)+flattenLetTermsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = field_input,+ Testing.flattenLetTermsTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.FlattenLetTermsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++foldOperation :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.FoldOperation)+foldOperation cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "sumInt32Literals", (\input -> Eithers.map (\t -> Testing.FoldOperationSumInt32Literals) (Helpers.decodeUnit cx input))),+ (Core.Name "collectListLengths", (\input -> Eithers.map (\t -> Testing.FoldOperationCollectListLengths) (Helpers.decodeUnit cx input))),+ (Core.Name "collectLabels", (\input -> Eithers.map (\t -> Testing.FoldOperationCollectLabels) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.FoldOperation"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++foldOverTermTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.FoldOverTermTestCase)+foldOverTermTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "traversalOrder" Coders.traversalOrder fieldMap cx) (\field_traversalOrder -> Eithers.bind (Helpers.requireField "operation" foldOperation fieldMap cx) (\field_operation -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = field_input,+ Testing.foldOverTermTestCaseTraversalOrder = field_traversalOrder,+ Testing.foldOverTermTestCaseOperation = field_operation,+ Testing.foldOverTermTestCaseOutput = field_output}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.FoldOverTermTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++freeVariablesTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.FreeVariablesTestCase)+freeVariablesTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" (Helpers.decodeSet Core_.name) fieldMap cx) (\field_output -> Right (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = field_input,+ Testing.freeVariablesTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.FreeVariablesTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++hoistPredicate :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.HoistPredicate)+hoistPredicate cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "caseStatements", (\input -> Eithers.map (\t -> Testing.HoistPredicateCaseStatements) (Helpers.decodeUnit cx input))),+ (Core.Name "applications", (\input -> Eithers.map (\t -> Testing.HoistPredicateApplications) (Helpers.decodeUnit cx input))),+ (Core.Name "lists", (\input -> Eithers.map (\t -> Testing.HoistPredicateLists) (Helpers.decodeUnit cx input))),+ (Core.Name "nothing", (\input -> Eithers.map (\t -> Testing.HoistPredicateNothing) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.HoistPredicate"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++hoistLetBindingsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.HoistLetBindingsTestCase)+hoistLetBindingsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.let_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.let_ fieldMap cx) (\field_output -> Right (Testing.HoistLetBindingsTestCase {+ Testing.hoistLetBindingsTestCaseInput = field_input,+ Testing.hoistLetBindingsTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.HoistLetBindingsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++hoistPolymorphicLetBindingsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.HoistPolymorphicLetBindingsTestCase)+hoistPolymorphicLetBindingsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.let_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.let_ fieldMap cx) (\field_output -> Right (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = field_input,+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.HoistPolymorphicLetBindingsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++hoistSubtermsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.HoistSubtermsTestCase)+hoistSubtermsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "predicate" hoistPredicate fieldMap cx) (\field_predicate -> Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = field_predicate,+ Testing.hoistSubtermsTestCaseInput = field_input,+ Testing.hoistSubtermsTestCaseOutput = field_output})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.HoistSubtermsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++hoistCaseStatementsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.HoistCaseStatementsTestCase)+hoistCaseStatementsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = field_input,+ Testing.hoistCaseStatementsTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.HoistCaseStatementsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++termRewriter :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TermRewriter)+termRewriter cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "replaceFooWithBar", (\input -> Eithers.map (\t -> Testing.TermRewriterReplaceFooWithBar) (Helpers.decodeUnit cx input))),+ (Core.Name "replaceInt32WithInt64", (\input -> Eithers.map (\t -> Testing.TermRewriterReplaceInt32WithInt64) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.TermRewriter"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++rewriteTermTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.RewriteTermTestCase)+rewriteTermTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "rewriter" termRewriter fieldMap cx) (\field_rewriter -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = field_input,+ Testing.rewriteTermTestCaseRewriter = field_rewriter,+ Testing.rewriteTermTestCaseOutput = field_output})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.RewriteTermTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeRewriter :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TypeRewriter)+typeRewriter cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "replaceStringWithInt32", (\input -> Eithers.map (\t -> Testing.TypeRewriterReplaceStringWithInt32) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.TypeRewriter"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++rewriteTypeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.RewriteTypeTestCase)+rewriteTypeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.type_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "rewriter" typeRewriter fieldMap cx) (\field_rewriter -> Eithers.bind (Helpers.requireField "output" Core_.type_ fieldMap cx) (\field_output -> Right (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = field_input,+ Testing.rewriteTypeTestCaseRewriter = field_rewriter,+ Testing.rewriteTypeTestCaseOutput = field_output})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.RewriteTypeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++evaluationTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.EvaluationTestCase)+evaluationTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "evaluationStyle" evaluationStyle fieldMap cx) (\field_evaluationStyle -> Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = field_evaluationStyle,+ Testing.evaluationTestCaseInput = field_input,+ Testing.evaluationTestCaseOutput = field_output})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.EvaluationTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++inferenceFailureTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.InferenceFailureTestCase)+inferenceFailureTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Right (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = field_input})))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.InferenceFailureTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++inferenceTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.InferenceTestCase)+inferenceTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.typeScheme fieldMap cx) (\field_output -> Right (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = field_input,+ Testing.inferenceTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.InferenceTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++jsonCoderTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.JsonCoderTestCase)+jsonCoderTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "json" Model.value fieldMap cx) (\field_json -> Right (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = field_type,+ Testing.jsonCoderTestCaseTerm = field_term,+ Testing.jsonCoderTestCaseJson = field_json})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.JsonCoderTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++jsonDecodeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.JsonDecodeTestCase)+jsonDecodeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "json" Model.value fieldMap cx) (\field_json -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeEither (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) Core_.term) fieldMap cx) (\field_expected -> Right (Testing.JsonDecodeTestCase {+ Testing.jsonDecodeTestCaseType = field_type,+ Testing.jsonDecodeTestCaseJson = field_json,+ Testing.jsonDecodeTestCaseExpected = field_expected})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.JsonDecodeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++jsonEncodeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.JsonEncodeTestCase)+jsonEncodeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeEither (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) Model.value) fieldMap cx) (\field_expected -> Right (Testing.JsonEncodeTestCase {+ Testing.jsonEncodeTestCaseTerm = field_term,+ Testing.jsonEncodeTestCaseExpected = field_expected}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.JsonEncodeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++jsonParserTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError (Testing.ParserTestCase Model_.Value))+jsonParserTestCase = (parserTestCase Model.value)++jsonRoundtripTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.JsonRoundtripTestCase)+jsonRoundtripTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Right (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = field_type,+ Testing.jsonRoundtripTestCaseTerm = field_term}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.JsonRoundtripTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++liftLambdaAboveLetTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.LiftLambdaAboveLetTestCase)+liftLambdaAboveLetTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = field_input,+ Testing.liftLambdaAboveLetTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.LiftLambdaAboveLetTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++jsonWriterTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError (Testing.WriterTestCase Model_.Value))+jsonWriterTestCase = (writerTestCase Model.value)++parserTestCase :: ((Graph.Graph -> Core.Term -> Either Util_.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util_.DecodingError (Testing.ParserTestCase t0))+parserTestCase a cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" (Parsing.parseResult a) fieldMap cx) (\field_output -> Right (Testing.ParserTestCase {+ Testing.parserTestCaseInput = field_input,+ Testing.parserTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.ParserTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++tag :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.Tag)+tag cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Testing.Tag b) ((\raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util_.DecodingError "expected wrapped type hydra.testing.Tag"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++testCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TestCase)+testCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "alphaConversion", (\input -> Eithers.map (\t -> Testing.TestCaseAlphaConversion t) (alphaConversionTestCase cx input))),+ (Core.Name "caseConversion", (\input -> Eithers.map (\t -> Testing.TestCaseCaseConversion t) (caseConversionTestCase cx input))),+ (Core.Name "deannotateTerm", (\input -> Eithers.map (\t -> Testing.TestCaseDeannotateTerm t) (deannotateTermTestCase cx input))),+ (Core.Name "deannotateType", (\input -> Eithers.map (\t -> Testing.TestCaseDeannotateType t) (deannotateTypeTestCase cx input))),+ (Core.Name "delegatedEvaluation", (\input -> Eithers.map (\t -> Testing.TestCaseDelegatedEvaluation t) (delegatedEvaluationTestCase cx input))),+ (Core.Name "etaExpansion", (\input -> Eithers.map (\t -> Testing.TestCaseEtaExpansion t) (etaExpansionTestCase cx input))),+ (Core.Name "flattenLetTerms", (\input -> Eithers.map (\t -> Testing.TestCaseFlattenLetTerms t) (flattenLetTermsTestCase cx input))),+ (Core.Name "freeVariables", (\input -> Eithers.map (\t -> Testing.TestCaseFreeVariables t) (freeVariablesTestCase cx input))),+ (Core.Name "evaluation", (\input -> Eithers.map (\t -> Testing.TestCaseEvaluation t) (evaluationTestCase cx input))),+ (Core.Name "inference", (\input -> Eithers.map (\t -> Testing.TestCaseInference t) (inferenceTestCase cx input))),+ (Core.Name "inferenceFailure", (\input -> Eithers.map (\t -> Testing.TestCaseInferenceFailure t) (inferenceFailureTestCase cx input))),+ (Core.Name "jsonCoder", (\input -> Eithers.map (\t -> Testing.TestCaseJsonCoder t) (jsonCoderTestCase cx input))),+ (Core.Name "jsonDecode", (\input -> Eithers.map (\t -> Testing.TestCaseJsonDecode t) (jsonDecodeTestCase cx input))),+ (Core.Name "jsonEncode", (\input -> Eithers.map (\t -> Testing.TestCaseJsonEncode t) (jsonEncodeTestCase cx input))),+ (Core.Name "jsonParser", (\input -> Eithers.map (\t -> Testing.TestCaseJsonParser t) (jsonParserTestCase cx input))),+ (Core.Name "jsonRoundtrip", (\input -> Eithers.map (\t -> Testing.TestCaseJsonRoundtrip t) (jsonRoundtripTestCase cx input))),+ (Core.Name "jsonWriter", (\input -> Eithers.map (\t -> Testing.TestCaseJsonWriter t) (jsonWriterTestCase cx input))),+ (Core.Name "liftLambdaAboveLet", (\input -> Eithers.map (\t -> Testing.TestCaseLiftLambdaAboveLet t) (liftLambdaAboveLetTestCase cx input))),+ (Core.Name "serialization", (\input -> Eithers.map (\t -> Testing.TestCaseSerialization t) (serializationTestCase cx input))),+ (Core.Name "simplifyTerm", (\input -> Eithers.map (\t -> Testing.TestCaseSimplifyTerm t) (simplifyTermTestCase cx input))),+ (Core.Name "topologicalSort", (\input -> Eithers.map (\t -> Testing.TestCaseTopologicalSort t) (topologicalSortTestCase cx input))),+ (Core.Name "topologicalSortBindings", (\input -> Eithers.map (\t -> Testing.TestCaseTopologicalSortBindings t) (topologicalSortBindingsTestCase cx input))),+ (Core.Name "topologicalSortSCC", (\input -> Eithers.map (\t -> Testing.TestCaseTopologicalSortSCC t) (topologicalSortSCCTestCase cx input))),+ (Core.Name "typeChecking", (\input -> Eithers.map (\t -> Testing.TestCaseTypeChecking t) (typeCheckingTestCase cx input))),+ (Core.Name "typeCheckingFailure", (\input -> Eithers.map (\t -> Testing.TestCaseTypeCheckingFailure t) (typeCheckingFailureTestCase cx input))),+ (Core.Name "typeReduction", (\input -> Eithers.map (\t -> Testing.TestCaseTypeReduction t) (typeReductionTestCase cx input))),+ (Core.Name "normalizeTypeVariables", (\input -> Eithers.map (\t -> Testing.TestCaseNormalizeTypeVariables t) (normalizeTypeVariablesTestCase cx input))),+ (Core.Name "foldOverTerm", (\input -> Eithers.map (\t -> Testing.TestCaseFoldOverTerm t) (foldOverTermTestCase cx input))),+ (Core.Name "rewriteTerm", (\input -> Eithers.map (\t -> Testing.TestCaseRewriteTerm t) (rewriteTermTestCase cx input))),+ (Core.Name "rewriteType", (\input -> Eithers.map (\t -> Testing.TestCaseRewriteType t) (rewriteTypeTestCase cx input))),+ (Core.Name "hoistSubterms", (\input -> Eithers.map (\t -> Testing.TestCaseHoistSubterms t) (hoistSubtermsTestCase cx input))),+ (Core.Name "hoistCaseStatements", (\input -> Eithers.map (\t -> Testing.TestCaseHoistCaseStatements t) (hoistCaseStatementsTestCase cx input))),+ (Core.Name "hoistLetBindings", (\input -> Eithers.map (\t -> Testing.TestCaseHoistLetBindings t) (hoistLetBindingsTestCase cx input))),+ (Core.Name "hoistPolymorphicLetBindings", (\input -> Eithers.map (\t -> Testing.TestCaseHoistPolymorphicLetBindings t) (hoistPolymorphicLetBindingsTestCase cx input))),+ (Core.Name "substInType", (\input -> Eithers.map (\t -> Testing.TestCaseSubstInType t) (substInTypeTestCase cx input))),+ (Core.Name "variableOccursInType", (\input -> Eithers.map (\t -> Testing.TestCaseVariableOccursInType t) (variableOccursInTypeTestCase cx input))),+ (Core.Name "unifyTypes", (\input -> Eithers.map (\t -> Testing.TestCaseUnifyTypes t) (unifyTypesTestCase cx input))),+ (Core.Name "joinTypes", (\input -> Eithers.map (\t -> Testing.TestCaseJoinTypes t) (joinTypesTestCase cx input))),+ (Core.Name "unshadowVariables", (\input -> Eithers.map (\t -> Testing.TestCaseUnshadowVariables t) (unshadowVariablesTestCase cx input)))])+ in (Maybes.maybe (Left (Util_.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util_.DecodingError "expected union of type hydra.testing.TestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++testCaseWithMetadata :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TestCaseWithMetadata)+testCaseWithMetadata cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "case" testCase fieldMap cx) (\field_case -> Eithers.bind (Helpers.requireField "description" (Helpers.decodeMaybe (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_description -> Eithers.bind (Helpers.requireField "tags" (Helpers.decodeList tag) fieldMap cx) (\field_tags -> Right (Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = field_name,+ Testing.testCaseWithMetadataCase = field_case,+ Testing.testCaseWithMetadataDescription = field_description,+ Testing.testCaseWithMetadataTags = field_tags}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TestCaseWithMetadata"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++testGroup :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TestGroup)+testGroup cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "description" (Helpers.decodeMaybe (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_description -> Eithers.bind (Helpers.requireField "subgroups" (Helpers.decodeList testGroup) fieldMap cx) (\field_subgroups -> Eithers.bind (Helpers.requireField "cases" (Helpers.decodeList testCaseWithMetadata) fieldMap cx) (\field_cases -> Right (Testing.TestGroup {+ Testing.testGroupName = field_name,+ Testing.testGroupDescription = field_description,+ Testing.testGroupSubgroups = field_subgroups,+ Testing.testGroupCases = field_cases}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TestGroup"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeCheckingTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TypeCheckingTestCase)+typeCheckingTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "outputTerm" Core_.term fieldMap cx) (\field_outputTerm -> Eithers.bind (Helpers.requireField "outputType" Core_.type_ fieldMap cx) (\field_outputType -> Right (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = field_input,+ Testing.typeCheckingTestCaseOutputTerm = field_outputTerm,+ Testing.typeCheckingTestCaseOutputType = field_outputType})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TypeCheckingTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeCheckingFailureTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TypeCheckingFailureTestCase)+typeCheckingFailureTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Right (Testing.TypeCheckingFailureTestCase {+ Testing.typeCheckingFailureTestCaseInput = field_input})))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TypeCheckingFailureTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++topologicalSortBindingsTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TopologicalSortBindingsTestCase)+topologicalSortBindingsTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "bindings" (Helpers.decodeList (Helpers.decodePair Core_.name Core_.term)) fieldMap cx) (\field_bindings -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeList (Helpers.decodeList (Helpers.decodePair Core_.name Core_.term))) fieldMap cx) (\field_expected -> Right (Testing.TopologicalSortBindingsTestCase {+ Testing.topologicalSortBindingsTestCaseBindings = field_bindings,+ Testing.topologicalSortBindingsTestCaseExpected = field_expected}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TopologicalSortBindingsTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++topologicalSortTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TopologicalSortTestCase)+topologicalSortTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "adjacencyList" (Helpers.decodeList (Helpers.decodePair (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))))) fieldMap cx) (\field_adjacencyList -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeEither (Helpers.decodeList (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)))) (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)))) fieldMap cx) (\field_expected -> Right (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = field_adjacencyList,+ Testing.topologicalSortTestCaseExpected = field_expected}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TopologicalSortTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++topologicalSortSCCTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TopologicalSortSCCTestCase)+topologicalSortSCCTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "adjacencyList" (Helpers.decodeList (Helpers.decodePair (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))))) fieldMap cx) (\field_adjacencyList -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeList (Helpers.decodeList (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util_.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util_.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)))) fieldMap cx) (\field_expected -> Right (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = field_adjacencyList,+ Testing.topologicalSortSCCTestCaseExpected = field_expected}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TopologicalSortSCCTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++serializationTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.SerializationTestCase)+serializationTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Ast.expr fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_output -> Right (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = field_input,+ Testing.serializationTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.SerializationTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++simplifyTermTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.SimplifyTermTestCase)+simplifyTermTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.SimplifyTermTestCase {+ Testing.simplifyTermTestCaseInput = field_input,+ Testing.simplifyTermTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.SimplifyTermTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++normalizeTypeVariablesTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.NormalizeTypeVariablesTestCase)+normalizeTypeVariablesTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = field_input,+ Testing.normalizeTypeVariablesTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.NormalizeTypeVariablesTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeReductionTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.TypeReductionTestCase)+typeReductionTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.type_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.type_ fieldMap cx) (\field_output -> Right (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = field_input,+ Testing.typeReductionTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.TypeReductionTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++writerTestCase :: ((Graph.Graph -> Core.Term -> Either Util_.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util_.DecodingError (Testing.WriterTestCase t0))+writerTestCase a cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" a fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_output -> Right (Testing.WriterTestCase {+ Testing.writerTestCaseInput = field_input,+ Testing.writerTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.WriterTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++substInTypeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.SubstInTypeTestCase)+substInTypeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "substitution" (Helpers.decodeList (Helpers.decodePair Core_.name Core_.type_)) fieldMap cx) (\field_substitution -> Eithers.bind (Helpers.requireField "input" Core_.type_ fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.type_ fieldMap cx) (\field_output -> Right (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = field_substitution,+ Testing.substInTypeTestCaseInput = field_input,+ Testing.substInTypeTestCaseOutput = field_output})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.SubstInTypeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++variableOccursInTypeTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.VariableOccursInTypeTestCase)+variableOccursInTypeTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "variable" Core_.name fieldMap cx) (\field_variable -> Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "expected" (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_expected -> Right (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = field_variable,+ Testing.variableOccursInTypeTestCaseType = field_type,+ Testing.variableOccursInTypeTestCaseExpected = field_expected})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.VariableOccursInTypeTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++unshadowVariablesTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.UnshadowVariablesTestCase)+unshadowVariablesTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "input" Core_.term fieldMap cx) (\field_input -> Eithers.bind (Helpers.requireField "output" Core_.term fieldMap cx) (\field_output -> Right (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = field_input,+ Testing.unshadowVariablesTestCaseOutput = field_output}))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.UnshadowVariablesTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++unifyTypesTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.UnifyTypesTestCase)+unifyTypesTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "schemaTypes" (Helpers.decodeList Core_.name) fieldMap cx) (\field_schemaTypes -> Eithers.bind (Helpers.requireField "left" Core_.type_ fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" Core_.type_ fieldMap cx) (\field_right -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeEither (\cx -> \raw -> Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util_.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util_.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) Typing.typeSubst) fieldMap cx) (\field_expected -> Right (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = field_schemaTypes,+ Testing.unifyTypesTestCaseLeft = field_left,+ Testing.unifyTypesTestCaseRight = field_right,+ Testing.unifyTypesTestCaseExpected = field_expected}))))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.UnifyTypesTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++joinTypesTestCase :: (Graph.Graph -> Core.Term -> Either Util_.DecodingError Testing.JoinTypesTestCase)+joinTypesTestCase cx raw = (Eithers.either (\err -> Left (Util_.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "left" Core_.type_ fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" Core_.type_ fieldMap cx) (\field_right -> Eithers.bind (Helpers.requireField "expected" (Helpers.decodeEither Helpers.decodeUnit (Helpers.decodeList Typing.typeConstraint)) fieldMap cx) (\field_expected -> Right (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = field_left,+ Testing.joinTypesTestCaseRight = field_right,+ Testing.joinTypesTestCaseExpected = field_expected})))))+ _ -> (Left (Util_.DecodingError "expected record of type hydra.testing.JoinTypesTestCase"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Topology.hs view
@@ -0,0 +1,62 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.topology++module Hydra.Decode.Topology where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Topology as Topology+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++graph :: (Graph.Graph -> Core.Term -> Either Util.DecodingError (M.Map Int [Int]))+graph = (Helpers.decodeMap vertex (Helpers.decodeList vertex))++tarjanState :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Topology.TarjanState)+tarjanState cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "counter" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_counter -> Eithers.bind (Helpers.requireField "indices" (Helpers.decodeMap vertex (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_indices -> Eithers.bind (Helpers.requireField "lowLinks" (Helpers.decodeMap vertex (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))) fieldMap cx) (\field_lowLinks -> Eithers.bind (Helpers.requireField "stack" (Helpers.decodeList vertex) fieldMap cx) (\field_stack -> Eithers.bind (Helpers.requireField "onStack" (Helpers.decodeSet vertex) fieldMap cx) (\field_onStack -> Eithers.bind (Helpers.requireField "sccs" (Helpers.decodeList (Helpers.decodeList vertex)) fieldMap cx) (\field_sccs -> Right (Topology.TarjanState {+ Topology.tarjanStateCounter = field_counter,+ Topology.tarjanStateIndices = field_indices,+ Topology.tarjanStateLowLinks = field_lowLinks,+ Topology.tarjanStateStack = field_stack,+ Topology.tarjanStateOnStack = field_onStack,+ Topology.tarjanStateSccs = field_sccs}))))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.topology.TarjanState"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++vertex :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Int)+vertex cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v1 -> ((\x -> case x of+ Core.LiteralInteger v2 -> ((\x -> case x of+ Core.IntegerValueInt32 v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v2)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v1)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Typing.hs view
@@ -0,0 +1,98 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.typing++module Hydra.Decode.Typing where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++functionStructure :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Typing.FunctionStructure t0))+functionStructure env cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "typeParams" (Helpers.decodeList Core_.name) fieldMap cx) (\field_typeParams -> Eithers.bind (Helpers.requireField "params" (Helpers.decodeList Core_.name) fieldMap cx) (\field_params -> Eithers.bind (Helpers.requireField "bindings" (Helpers.decodeList Core_.binding) fieldMap cx) (\field_bindings -> Eithers.bind (Helpers.requireField "body" Core_.term fieldMap cx) (\field_body -> Eithers.bind (Helpers.requireField "domains" (Helpers.decodeList Core_.type_) fieldMap cx) (\field_domains -> Eithers.bind (Helpers.requireField "codomain" (Helpers.decodeMaybe Core_.type_) fieldMap cx) (\field_codomain -> Eithers.bind (Helpers.requireField "environment" env fieldMap cx) (\field_environment -> Right (Typing.FunctionStructure {+ Typing.functionStructureTypeParams = field_typeParams,+ Typing.functionStructureParams = field_params,+ Typing.functionStructureBindings = field_bindings,+ Typing.functionStructureBody = field_body,+ Typing.functionStructureDomains = field_domains,+ Typing.functionStructureCodomain = field_codomain,+ Typing.functionStructureEnvironment = field_environment})))))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.typing.FunctionStructure"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++inferenceContext :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.InferenceContext)+inferenceContext cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "schemaTypes" (Helpers.decodeMap Core_.name Core_.typeScheme) fieldMap cx) (\field_schemaTypes -> Eithers.bind (Helpers.requireField "primitiveTypes" (Helpers.decodeMap Core_.name Core_.typeScheme) fieldMap cx) (\field_primitiveTypes -> Eithers.bind (Helpers.requireField "dataTypes" (Helpers.decodeMap Core_.name Core_.typeScheme) fieldMap cx) (\field_dataTypes -> Eithers.bind (Helpers.requireField "classConstraints" (Helpers.decodeMap Core_.name Core_.typeVariableMetadata) fieldMap cx) (\field_classConstraints -> Eithers.bind (Helpers.requireField "debug" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralBoolean v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected boolean literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_debug -> Right (Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = field_schemaTypes,+ Typing.inferenceContextPrimitiveTypes = field_primitiveTypes,+ Typing.inferenceContextDataTypes = field_dataTypes,+ Typing.inferenceContextClassConstraints = field_classConstraints,+ Typing.inferenceContextDebug = field_debug})))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.typing.InferenceContext"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++inferenceResult :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.InferenceResult)+inferenceResult cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "term" Core_.term fieldMap cx) (\field_term -> Eithers.bind (Helpers.requireField "type" Core_.type_ fieldMap cx) (\field_type -> Eithers.bind (Helpers.requireField "subst" typeSubst fieldMap cx) (\field_subst -> Eithers.bind (Helpers.requireField "classConstraints" (Helpers.decodeMap Core_.name Core_.typeVariableMetadata) fieldMap cx) (\field_classConstraints -> Right (Typing.InferenceResult {+ Typing.inferenceResultTerm = field_term,+ Typing.inferenceResultType = field_type,+ Typing.inferenceResultSubst = field_subst,+ Typing.inferenceResultClassConstraints = field_classConstraints}))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.typing.InferenceResult"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++termSubst :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.TermSubst)+termSubst cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Typing.TermSubst b) (Helpers.decodeMap Core_.name Core_.term cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.typing.TermSubst"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeConstraint :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.TypeConstraint)+typeConstraint cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "left" Core_.type_ fieldMap cx) (\field_left -> Eithers.bind (Helpers.requireField "right" Core_.type_ fieldMap cx) (\field_right -> Eithers.bind (Helpers.requireField "comment" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_comment -> Right (Typing.TypeConstraint {+ Typing.typeConstraintLeft = field_left,+ Typing.typeConstraintRight = field_right,+ Typing.typeConstraintComment = field_comment})))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.typing.TypeConstraint"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeContext :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.TypeContext)+typeContext cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "types" (Helpers.decodeMap Core_.name Core_.type_) fieldMap cx) (\field_types -> Eithers.bind (Helpers.requireField "metadata" (Helpers.decodeMap Core_.name Core_.term) fieldMap cx) (\field_metadata -> Eithers.bind (Helpers.requireField "typeVariables" (Helpers.decodeSet Core_.name) fieldMap cx) (\field_typeVariables -> Eithers.bind (Helpers.requireField "lambdaVariables" (Helpers.decodeSet Core_.name) fieldMap cx) (\field_lambdaVariables -> Eithers.bind (Helpers.requireField "letVariables" (Helpers.decodeSet Core_.name) fieldMap cx) (\field_letVariables -> Eithers.bind (Helpers.requireField "inferenceContext" inferenceContext fieldMap cx) (\field_inferenceContext -> Right (Typing.TypeContext {+ Typing.typeContextTypes = field_types,+ Typing.typeContextMetadata = field_metadata,+ Typing.typeContextTypeVariables = field_typeVariables,+ Typing.typeContextLambdaVariables = field_lambdaVariables,+ Typing.typeContextLetVariables = field_letVariables,+ Typing.typeContextInferenceContext = field_inferenceContext}))))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.typing.TypeContext"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeSubst :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Typing.TypeSubst)+typeSubst cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Typing.TypeSubst b) (Helpers.decodeMap Core_.name Core_.type_ cx (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.typing.TypeSubst"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Util.hs view
@@ -0,0 +1,90 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.util++module Hydra.Decode.Util where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++caseConvention :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Util.CaseConvention)+caseConvention cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "camel", (\input -> Eithers.map (\t -> Util.CaseConventionCamel) (Helpers.decodeUnit cx input))),+ (Core.Name "pascal", (\input -> Eithers.map (\t -> Util.CaseConventionPascal) (Helpers.decodeUnit cx input))),+ (Core.Name "lowerSnake", (\input -> Eithers.map (\t -> Util.CaseConventionLowerSnake) (Helpers.decodeUnit cx input))),+ (Core.Name "upperSnake", (\input -> Eithers.map (\t -> Util.CaseConventionUpperSnake) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.util.CaseConvention"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++comparison :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Util.Comparison)+comparison cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "lessThan", (\input -> Eithers.map (\t -> Util.ComparisonLessThan) (Helpers.decodeUnit cx input))),+ (Core.Name "equalTo", (\input -> Eithers.map (\t -> Util.ComparisonEqualTo) (Helpers.decodeUnit cx input))),+ (Core.Name "greaterThan", (\input -> Eithers.map (\t -> Util.ComparisonGreaterThan) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.util.Comparison"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++decodingError :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Util.DecodingError)+decodingError cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (Eithers.map (\b -> Util.DecodingError b) ((\raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) (Core.wrappedTermBody v1)))+ _ -> (Left (Util.DecodingError "expected wrapped type hydra.util.DecodingError"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++precision :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Util.Precision)+precision cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "arbitrary", (\input -> Eithers.map (\t -> Util.PrecisionArbitrary) (Helpers.decodeUnit cx input))),+ (Core.Name "bits", (\input -> Eithers.map (\t -> Util.PrecisionBits t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralInteger v3 -> ((\x -> case x of+ Core.IntegerValueInt32 v4 -> (Right v4)+ _ -> (Left (Util.DecodingError "expected int32 value"))) v3)+ _ -> (Left (Util.DecodingError "expected int32 literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input))))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.util.Precision"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Variants.hs view
@@ -0,0 +1,142 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.variants++module Hydra.Decode.Variants where++import qualified Hydra.Core as Core+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++eliminationVariant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Variants.EliminationVariant)+eliminationVariant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "record", (\input -> Eithers.map (\t -> Variants.EliminationVariantRecord) (Helpers.decodeUnit cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Variants.EliminationVariantUnion) (Helpers.decodeUnit cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Variants.EliminationVariantWrap) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.variants.EliminationVariant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++functionVariant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Variants.FunctionVariant)+functionVariant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "elimination", (\input -> Eithers.map (\t -> Variants.FunctionVariantElimination) (Helpers.decodeUnit cx input))),+ (Core.Name "lambda", (\input -> Eithers.map (\t -> Variants.FunctionVariantLambda) (Helpers.decodeUnit cx input))),+ (Core.Name "primitive", (\input -> Eithers.map (\t -> Variants.FunctionVariantPrimitive) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.variants.FunctionVariant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++literalVariant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Variants.LiteralVariant)+literalVariant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "binary", (\input -> Eithers.map (\t -> Variants.LiteralVariantBinary) (Helpers.decodeUnit cx input))),+ (Core.Name "boolean", (\input -> Eithers.map (\t -> Variants.LiteralVariantBoolean) (Helpers.decodeUnit cx input))),+ (Core.Name "float", (\input -> Eithers.map (\t -> Variants.LiteralVariantFloat) (Helpers.decodeUnit cx input))),+ (Core.Name "integer", (\input -> Eithers.map (\t -> Variants.LiteralVariantInteger) (Helpers.decodeUnit cx input))),+ (Core.Name "string", (\input -> Eithers.map (\t -> Variants.LiteralVariantString) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.variants.LiteralVariant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++termVariant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Variants.TermVariant)+termVariant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "annotated", (\input -> Eithers.map (\t -> Variants.TermVariantAnnotated) (Helpers.decodeUnit cx input))),+ (Core.Name "application", (\input -> Eithers.map (\t -> Variants.TermVariantApplication) (Helpers.decodeUnit cx input))),+ (Core.Name "either", (\input -> Eithers.map (\t -> Variants.TermVariantEither) (Helpers.decodeUnit cx input))),+ (Core.Name "function", (\input -> Eithers.map (\t -> Variants.TermVariantFunction) (Helpers.decodeUnit cx input))),+ (Core.Name "let", (\input -> Eithers.map (\t -> Variants.TermVariantLet) (Helpers.decodeUnit cx input))),+ (Core.Name "list", (\input -> Eithers.map (\t -> Variants.TermVariantList) (Helpers.decodeUnit cx input))),+ (Core.Name "literal", (\input -> Eithers.map (\t -> Variants.TermVariantLiteral) (Helpers.decodeUnit cx input))),+ (Core.Name "map", (\input -> Eithers.map (\t -> Variants.TermVariantMap) (Helpers.decodeUnit cx input))),+ (Core.Name "maybe", (\input -> Eithers.map (\t -> Variants.TermVariantMaybe) (Helpers.decodeUnit cx input))),+ (Core.Name "pair", (\input -> Eithers.map (\t -> Variants.TermVariantPair) (Helpers.decodeUnit cx input))),+ (Core.Name "record", (\input -> Eithers.map (\t -> Variants.TermVariantRecord) (Helpers.decodeUnit cx input))),+ (Core.Name "set", (\input -> Eithers.map (\t -> Variants.TermVariantSet) (Helpers.decodeUnit cx input))),+ (Core.Name "typeApplication", (\input -> Eithers.map (\t -> Variants.TermVariantTypeApplication) (Helpers.decodeUnit cx input))),+ (Core.Name "typeLambda", (\input -> Eithers.map (\t -> Variants.TermVariantTypeLambda) (Helpers.decodeUnit cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Variants.TermVariantUnion) (Helpers.decodeUnit cx input))),+ (Core.Name "unit", (\input -> Eithers.map (\t -> Variants.TermVariantUnit) (Helpers.decodeUnit cx input))),+ (Core.Name "variable", (\input -> Eithers.map (\t -> Variants.TermVariantVariable) (Helpers.decodeUnit cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Variants.TermVariantWrap) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.variants.TermVariant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++typeVariant :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Variants.TypeVariant)+typeVariant cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "annotated", (\input -> Eithers.map (\t -> Variants.TypeVariantAnnotated) (Helpers.decodeUnit cx input))),+ (Core.Name "application", (\input -> Eithers.map (\t -> Variants.TypeVariantApplication) (Helpers.decodeUnit cx input))),+ (Core.Name "either", (\input -> Eithers.map (\t -> Variants.TypeVariantEither) (Helpers.decodeUnit cx input))),+ (Core.Name "forall", (\input -> Eithers.map (\t -> Variants.TypeVariantForall) (Helpers.decodeUnit cx input))),+ (Core.Name "function", (\input -> Eithers.map (\t -> Variants.TypeVariantFunction) (Helpers.decodeUnit cx input))),+ (Core.Name "list", (\input -> Eithers.map (\t -> Variants.TypeVariantList) (Helpers.decodeUnit cx input))),+ (Core.Name "literal", (\input -> Eithers.map (\t -> Variants.TypeVariantLiteral) (Helpers.decodeUnit cx input))),+ (Core.Name "map", (\input -> Eithers.map (\t -> Variants.TypeVariantMap) (Helpers.decodeUnit cx input))),+ (Core.Name "maybe", (\input -> Eithers.map (\t -> Variants.TypeVariantMaybe) (Helpers.decodeUnit cx input))),+ (Core.Name "pair", (\input -> Eithers.map (\t -> Variants.TypeVariantPair) (Helpers.decodeUnit cx input))),+ (Core.Name "record", (\input -> Eithers.map (\t -> Variants.TypeVariantRecord) (Helpers.decodeUnit cx input))),+ (Core.Name "set", (\input -> Eithers.map (\t -> Variants.TypeVariantSet) (Helpers.decodeUnit cx input))),+ (Core.Name "union", (\input -> Eithers.map (\t -> Variants.TypeVariantUnion) (Helpers.decodeUnit cx input))),+ (Core.Name "unit", (\input -> Eithers.map (\t -> Variants.TypeVariantUnit) (Helpers.decodeUnit cx input))),+ (Core.Name "variable", (\input -> Eithers.map (\t -> Variants.TypeVariantVariable) (Helpers.decodeUnit cx input))),+ (Core.Name "wrap", (\input -> Eithers.map (\t -> Variants.TypeVariantWrap) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.variants.TypeVariant"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
+ src/gen-main/haskell/Hydra/Decode/Workflow.hs view
@@ -0,0 +1,78 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term decoders for hydra.workflow++module Hydra.Decode.Workflow where++import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Decode.Module as Module+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import qualified Hydra.Workflow as Workflow+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++hydraSchemaSpec :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Workflow.HydraSchemaSpec)+hydraSchemaSpec cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "modules" (Helpers.decodeList Module.module_) fieldMap cx) (\field_modules -> Eithers.bind (Helpers.requireField "typeName" Core_.name fieldMap cx) (\field_typeName -> Right (Workflow.HydraSchemaSpec {+ Workflow.hydraSchemaSpecModules = field_modules,+ Workflow.hydraSchemaSpecTypeName = field_typeName}))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.workflow.HydraSchemaSpec"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++schemaSpec :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Workflow.SchemaSpec)+schemaSpec cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermUnion v1 -> + let tname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fname = (Core.fieldName field)+ fterm = (Core.fieldTerm field)+ variantMap = (Maps.fromList [+ (Core.Name "hydra", (\input -> Eithers.map (\t -> Workflow.SchemaSpecHydra t) (hydraSchemaSpec cx input))),+ (Core.Name "file", (\input -> Eithers.map (\t -> Workflow.SchemaSpecFile t) (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx input)))),+ (Core.Name "provided", (\input -> Eithers.map (\t -> Workflow.SchemaSpecProvided) (Helpers.decodeUnit cx input)))])+ in (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "no such field ",+ (Core.unName fname),+ " in union type ",+ (Core.unName tname)]))) (\f -> f fterm) (Maps.lookup fname variantMap))+ _ -> (Left (Util.DecodingError "expected union of type hydra.workflow.SchemaSpec"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))++transformWorkflow :: (Graph.Graph -> Core.Term -> Either Util.DecodingError Workflow.TransformWorkflow)+transformWorkflow cx raw = (Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermRecord v1 -> + let fieldMap = (Helpers.toFieldMap v1)+ in (Eithers.bind (Helpers.requireField "name" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_name -> Eithers.bind (Helpers.requireField "schemaSpec" schemaSpec fieldMap cx) (\field_schemaSpec -> Eithers.bind (Helpers.requireField "srcDir" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_srcDir -> Eithers.bind (Helpers.requireField "destDir" (\cx -> \raw -> Eithers.either (\err -> Left (Util.DecodingError err)) (\stripped -> (\x -> case x of+ Core.TermLiteral v2 -> ((\x -> case x of+ Core.LiteralString v3 -> (Right v3)+ _ -> (Left (Util.DecodingError "expected string literal"))) v2)+ _ -> (Left (Util.DecodingError "expected literal"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw)) fieldMap cx) (\field_destDir -> Right (Workflow.TransformWorkflow {+ Workflow.transformWorkflowName = field_name,+ Workflow.transformWorkflowSchemaSpec = field_schemaSpec,+ Workflow.transformWorkflowSrcDir = field_srcDir,+ Workflow.transformWorkflowDestDir = field_destDir}))))))+ _ -> (Left (Util.DecodingError "expected record of type hydra.workflow.TransformWorkflow"))) stripped) (Lexical.stripAndDereferenceTermEither cx raw))
src/gen-main/haskell/Hydra/Decoding.hs view
@@ -1,257 +1,1535 @@--- | A module for decoding terms to native objects--module Hydra.Decoding where--import qualified Hydra.Core as Core-import qualified Hydra.Lib.Equality as Equality-import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Optionals as Optionals-import qualified Hydra.Rewriting as Rewriting-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S--bigfloat :: (Core.Term -> Maybe Double)-bigfloat = (Optionals.compose (Optionals.compose literal floatLiteral) bigfloatValue)--bigfloatValue :: (Core.FloatValue -> Maybe Double)-bigfloatValue x = case x of- Core.FloatValueBigfloat v1 -> (Optionals.pure v1)- _ -> Nothing--bigint :: (Core.Term -> Maybe Integer)-bigint = (Optionals.compose (Optionals.compose literal integerLiteral) bigintValue)--bigintValue :: (Core.IntegerValue -> Maybe Integer)-bigintValue x = case x of- Core.IntegerValueBigint v1 -> (Optionals.pure v1)- _ -> Nothing--binary :: (Core.Term -> Maybe String)-binary = (Optionals.compose literal binaryLiteral)--binaryLiteral :: (Core.Literal -> Maybe String)-binaryLiteral x = case x of- Core.LiteralBinary v1 -> (Optionals.pure v1)- _ -> Nothing--boolean :: (Core.Term -> Maybe Bool)-boolean = (Optionals.compose literal booleanLiteral)--booleanLiteral :: (Core.Literal -> Maybe Bool)-booleanLiteral x = case x of- Core.LiteralBoolean v1 -> (Optionals.pure v1)- _ -> Nothing--caseField :: (Core.Name -> Core.Name -> Core.Term -> Maybe Core.Term)-caseField tname fname = (Optionals.compose (cases tname) (field fname))--cases :: (Core.Name -> Core.Term -> Maybe [Core.Field])-cases = (nominal Core.caseStatementTypeName Core.caseStatementCases (Optionals.compose (Optionals.compose matchFunction matchElimination) matchUnion)) - where - matchFunction = (\arg_ -> (\x -> case x of- Core.TermFunction v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))- matchElimination = (\x -> case x of- Core.FunctionElimination v1 -> (Optionals.pure v1)- _ -> Nothing)- matchUnion = (\x -> case x of- Core.EliminationUnion v1 -> (Optionals.pure v1)- _ -> Nothing)--field :: (Core.Name -> [Core.Field] -> Maybe Core.Term)-field fname fields = - let matches = (Lists.filter (\f -> Equality.equal (Core.fieldName f) fname) fields)- in (Logic.ifElse (Equality.equal 1 (Lists.length matches)) (Just (Core.fieldTerm (Lists.head matches))) Nothing)--float32 :: (Core.Term -> Maybe Float)-float32 = (Optionals.compose (Optionals.compose literal floatLiteral) float32Value)--float32Value :: (Core.FloatValue -> Maybe Float)-float32Value x = case x of- Core.FloatValueFloat32 v1 -> (Optionals.pure v1)- _ -> Nothing--float64 :: (Core.Term -> Maybe Double)-float64 = (Optionals.compose (Optionals.compose literal floatLiteral) float64Value)--float64Value :: (Core.FloatValue -> Maybe Double)-float64Value x = case x of- Core.FloatValueFloat64 v1 -> (Optionals.pure v1)- _ -> Nothing--floatLiteral :: (Core.Literal -> Maybe Core.FloatValue)-floatLiteral x = case x of- Core.LiteralFloat v1 -> (Optionals.pure v1)- _ -> Nothing--int16 :: (Core.Term -> Maybe I.Int16)-int16 = (Optionals.compose (Optionals.compose literal integerLiteral) int16Value)--int16Value :: (Core.IntegerValue -> Maybe I.Int16)-int16Value x = case x of- Core.IntegerValueInt16 v1 -> (Optionals.pure v1)- _ -> Nothing--int32 :: (Core.Term -> Maybe Int)-int32 = (Optionals.compose (Optionals.compose literal integerLiteral) int32Value)--int32Value :: (Core.IntegerValue -> Maybe Int)-int32Value x = case x of- Core.IntegerValueInt32 v1 -> (Optionals.pure v1)- _ -> Nothing--int64 :: (Core.Term -> Maybe I.Int64)-int64 = (Optionals.compose (Optionals.compose literal integerLiteral) int64Value)--int64Value :: (Core.IntegerValue -> Maybe I.Int64)-int64Value x = case x of- Core.IntegerValueInt64 v1 -> (Optionals.pure v1)- _ -> Nothing--int8 :: (Core.Term -> Maybe I.Int8)-int8 = (Optionals.compose (Optionals.compose literal integerLiteral) int8Value)--int8Value :: (Core.IntegerValue -> Maybe I.Int8)-int8Value x = case x of- Core.IntegerValueInt8 v1 -> (Optionals.pure v1)- _ -> Nothing--integerLiteral :: (Core.Literal -> Maybe Core.IntegerValue)-integerLiteral x = case x of- Core.LiteralInteger v1 -> (Optionals.pure v1)- _ -> Nothing--lambda :: (Core.Term -> Maybe Core.Lambda)-lambda = (Optionals.compose matchFunction matchLambda) - where - matchFunction = (\arg_ -> (\x -> case x of- Core.TermFunction v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))- matchLambda = (\x -> case x of- Core.FunctionLambda v1 -> (Optionals.pure v1)- _ -> Nothing)--letBinding :: (Core.Name -> Core.Term -> Maybe Core.Binding)-letBinding fname term = (Optionals.bind (Optionals.map Core.letBindings (letTerm term)) (letBindingWithKey fname))--letBindingWithKey :: (Core.Name -> [Core.Binding] -> Maybe Core.Binding)-letBindingWithKey fname bindings = - let matches = (Lists.filter (\b -> Equality.equal (Core.bindingName b) fname) bindings)- in (Logic.ifElse (Equality.equal 1 (Lists.length matches)) (Just (Lists.head matches)) Nothing)--letTerm :: (Core.Term -> Maybe Core.Let)-letTerm arg_ = ((\x -> case x of- Core.TermLet v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--list :: (Core.Term -> Maybe [Core.Term])-list arg_ = ((\x -> case x of- Core.TermList v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--literal :: (Core.Term -> Maybe Core.Literal)-literal arg_ = ((\x -> case x of- Core.TermLiteral v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--map :: (Core.Term -> Maybe (M.Map Core.Term Core.Term))-map arg_ = ((\x -> case x of- Core.TermMap v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--name :: (Core.Term -> Maybe Core.Name)-name term = (Optionals.map (\s -> Core.Name s) (Optionals.bind (wrap (Core.Name "hydra.core.Name") term) string))--nominal :: ((t0 -> Core.Name) -> (t0 -> t1) -> (t2 -> Maybe t0) -> Core.Name -> t2 -> Maybe t1)-nominal getName getB getA expected = - let namesEqual = (\n1 -> \n2 -> Equality.equal (Core.unName n1) (Core.unName n2))- in (Optionals.compose getA (\a -> Logic.ifElse (namesEqual (getName a) expected) (Just (getB a)) Nothing))--optional :: (Core.Term -> Maybe (Maybe Core.Term))-optional arg_ = ((\x -> case x of- Core.TermOptional v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--pair :: (Core.Term -> Maybe (Core.Term, Core.Term))-pair = (Optionals.compose matchProduct (\l -> Logic.ifElse (Equality.equal 2 (Lists.length l)) (Just (Lists.at 0 l, (Lists.at 1 l))) Nothing)) - where - matchProduct = (\arg_ -> (\x -> case x of- Core.TermProduct v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--record :: (Core.Name -> Core.Term -> Maybe [Core.Field])-record = (nominal Core.recordTypeName Core.recordFields (\arg_ -> (\x -> case x of- Core.TermRecord v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_)))--set :: (Core.Term -> Maybe (S.Set Core.Term))-set arg_ = ((\x -> case x of- Core.TermSet v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--string :: (Core.Term -> Maybe String)-string = (Optionals.compose literal stringLiteral)--stringLiteral :: (Core.Literal -> Maybe String)-stringLiteral x = case x of- Core.LiteralString v1 -> (Optionals.pure v1)- _ -> Nothing--uint16 :: (Core.Term -> Maybe Int)-uint16 = (Optionals.compose (Optionals.compose literal integerLiteral) uint16Value)--uint16Value :: (Core.IntegerValue -> Maybe Int)-uint16Value x = case x of- Core.IntegerValueUint16 v1 -> (Optionals.pure v1)- _ -> Nothing--uint32 :: (Core.Term -> Maybe I.Int64)-uint32 = (Optionals.compose (Optionals.compose literal integerLiteral) uint32Value)--uint32Value :: (Core.IntegerValue -> Maybe I.Int64)-uint32Value x = case x of- Core.IntegerValueUint32 v1 -> (Optionals.pure v1)- _ -> Nothing--uint64 :: (Core.Term -> Maybe Integer)-uint64 = (Optionals.compose (Optionals.compose literal integerLiteral) uint64Value)--uint64Value :: (Core.IntegerValue -> Maybe Integer)-uint64Value x = case x of- Core.IntegerValueUint64 v1 -> (Optionals.pure v1)- _ -> Nothing--uint8 :: (Core.Term -> Maybe I.Int16)-uint8 = (Optionals.compose (Optionals.compose literal integerLiteral) uint8Value)--uint8Value :: (Core.IntegerValue -> Maybe I.Int16)-uint8Value x = case x of- Core.IntegerValueUint8 v1 -> (Optionals.pure v1)- _ -> Nothing--unit :: (Core.Term -> Maybe ())-unit term = ((\x -> case x of- Core.TermUnit -> (Just ())- _ -> Nothing) term)--unitVariant :: (Core.Name -> Core.Term -> Maybe Core.Name)-unitVariant tname term = (Optionals.map Core.fieldName (variant tname term))--variable :: (Core.Term -> Maybe Core.Name)-variable arg_ = ((\x -> case x of- Core.TermVariable v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_))--variant :: (Core.Name -> Core.Term -> Maybe Core.Field)-variant = (nominal Core.injectionTypeName Core.injectionField (\arg_ -> (\x -> case x of- Core.TermUnion v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_)))--wrap :: (Core.Name -> Core.Term -> Maybe Core.Term)-wrap = (nominal Core.wrappedTermTypeName Core.wrappedTermObject (\arg_ -> (\x -> case x of- Core.TermWrap v1 -> (Optionals.pure v1)- _ -> Nothing) (Rewriting.deannotateTerm arg_)))+-- Note: this is an automatically generated file. Do not edit.++-- | Functions for generating term decoders from type modules++module Hydra.Decoding where++import qualified Hydra.Annotations as Annotations+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Extract.Helpers as Helpers+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Module as Module+import qualified Hydra.Monads as Monads+import qualified Hydra.Names as Names+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Collect forall type variable names from a type+collectForallVariables :: (Core.Type -> [Core.Name])+collectForallVariables typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (collectForallVariables (Core.annotatedTypeBody v1))+ Core.TypeForall v1 -> (Lists.cons (Core.forallTypeParameter v1) (collectForallVariables (Core.forallTypeBody v1)))+ _ -> []) typ)++-- | Collect type variables needing Ord constraints (from Set element types)+collectOrdConstrainedVariables :: (Core.Type -> [Core.Name])+collectOrdConstrainedVariables typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (collectOrdConstrainedVariables (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Lists.concat2 (collectOrdConstrainedVariables (Core.applicationTypeFunction v1)) (collectOrdConstrainedVariables (Core.applicationTypeArgument v1)))+ Core.TypeEither v1 -> (Lists.concat2 (collectOrdConstrainedVariables (Core.eitherTypeLeft v1)) (collectOrdConstrainedVariables (Core.eitherTypeRight v1)))+ Core.TypeForall v1 -> (collectOrdConstrainedVariables (Core.forallTypeBody v1))+ Core.TypeList v1 -> (collectOrdConstrainedVariables v1)+ Core.TypeMap v1 -> (Lists.concat2 (collectOrdConstrainedVariables (Core.mapTypeKeys v1)) (collectOrdConstrainedVariables (Core.mapTypeValues v1)))+ Core.TypeMaybe v1 -> (collectOrdConstrainedVariables v1)+ Core.TypePair v1 -> (Lists.concat2 (collectOrdConstrainedVariables (Core.pairTypeFirst v1)) (collectOrdConstrainedVariables (Core.pairTypeSecond v1)))+ Core.TypeRecord v1 -> (Lists.concat (Lists.map (\ft -> collectOrdConstrainedVariables (Core.fieldTypeType ft)) (Core.rowTypeFields v1)))+ Core.TypeSet v1 -> (Lists.concat2 (collectTypeVariablesFromType v1) (collectOrdConstrainedVariables v1))+ Core.TypeUnion v1 -> (Lists.concat (Lists.map (\ft -> collectOrdConstrainedVariables (Core.fieldTypeType ft)) (Core.rowTypeFields v1)))+ Core.TypeWrap v1 -> (collectOrdConstrainedVariables (Core.wrappedTypeBody v1))+ _ -> []) typ)++-- | Collect type variable names from a type (forall parameters only)+collectTypeVariables :: (Core.Type -> [Core.Name])+collectTypeVariables typ = (collectForallVariables typ)++-- | Collect all type variable names from a type expression+collectTypeVariablesFromType :: (Core.Type -> [Core.Name])+collectTypeVariablesFromType typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (collectTypeVariablesFromType (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Lists.concat2 (collectTypeVariablesFromType (Core.applicationTypeFunction v1)) (collectTypeVariablesFromType (Core.applicationTypeArgument v1)))+ Core.TypeEither v1 -> (Lists.concat2 (collectTypeVariablesFromType (Core.eitherTypeLeft v1)) (collectTypeVariablesFromType (Core.eitherTypeRight v1)))+ Core.TypeForall v1 -> (collectTypeVariablesFromType (Core.forallTypeBody v1))+ Core.TypeList v1 -> (collectTypeVariablesFromType v1)+ Core.TypeMap v1 -> (Lists.concat2 (collectTypeVariablesFromType (Core.mapTypeKeys v1)) (collectTypeVariablesFromType (Core.mapTypeValues v1)))+ Core.TypeMaybe v1 -> (collectTypeVariablesFromType v1)+ Core.TypePair v1 -> (Lists.concat2 (collectTypeVariablesFromType (Core.pairTypeFirst v1)) (collectTypeVariablesFromType (Core.pairTypeSecond v1)))+ Core.TypeRecord v1 -> (Lists.concat (Lists.map (\ft -> collectTypeVariablesFromType (Core.fieldTypeType ft)) (Core.rowTypeFields v1)))+ Core.TypeSet v1 -> (collectTypeVariablesFromType v1)+ Core.TypeUnion v1 -> (Lists.concat (Lists.map (\ft -> collectTypeVariablesFromType (Core.fieldTypeType ft)) (Core.rowTypeFields v1)))+ Core.TypeVariable v1 -> [+ v1]+ Core.TypeWrap v1 -> (collectTypeVariablesFromType (Core.wrappedTypeBody v1))+ _ -> []) typ)++-- | Transform a type binding into a decoder binding+decodeBinding :: (Core.Binding -> Compute.Flow Graph.Graph Core.Binding)+decodeBinding b = (Flows.bind Monads.getState (\cx -> Flows.bind (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm b))) (\typ -> Flows.pure (Core.Binding {+ Core.bindingName = (decodeBindingName (Core.bindingName b)),+ Core.bindingTerm = (decodeType typ),+ Core.bindingType = (Just (decoderTypeScheme typ))}))))++-- | Generate a binding name for a decoder function from a type name+decodeBindingName :: (Core.Name -> Core.Name)+decodeBindingName n = (Logic.ifElse (Logic.not (Lists.null (Lists.tail (Strings.splitOn "." (Core.unName n))))) (Core.Name (Strings.intercalate "." (Lists.concat2 [+ "hydra",+ "decode"] (Lists.concat2 (Lists.tail (Lists.init (Strings.splitOn "." (Core.unName n)))) [+ Formatting.decapitalize (Names.localNameOf n)])))) (Core.Name (Formatting.decapitalize (Names.localNameOf n))))++-- | Generate a decoder for an Either type+decodeEitherType :: (Core.EitherType -> Core.Term)+decodeEitherType et = + let leftDecoder = (decodeType (Core.eitherTypeLeft et))+ in + let rightDecoder = (decodeType (Core.eitherTypeRight et))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = leftDecoder})),+ Core.applicationArgument = rightDecoder}))++-- | Generate a decoder for a polymorphic (forall) type+decodeForallType :: (Core.ForallType -> Core.Term)+decodeForallType ft = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (decodeBindingName (Core.forallTypeParameter ft)),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (decodeType (Core.forallTypeBody ft))})))++-- | Generate a decoder for a list type+decodeListType :: (Core.Type -> Core.Term)+decodeListType elemType = + let elemDecoder = (decodeType elemType)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = elemDecoder}))++-- | Generate a decoder for a literal type+decodeLiteralType :: (Core.LiteralType -> Core.Term)+decodeLiteralType lt = ((\x -> case x of+ Core.LiteralTypeBinary -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected binary literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.LiteralTypeBoolean -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.LiteralTypeFloat v1 -> ((\x -> case x of+ Core.FloatTypeBigfloat -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "bigfloat",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "bigfloat",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.FloatTypeFloat32 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "float32",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "float32",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.FloatTypeFloat64 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "float64",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "float64",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))) v1)+ Core.LiteralTypeInteger v1 -> ((\x -> case x of+ Core.IntegerTypeBigint -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "bigint",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "bigint",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeInt8 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int8",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int8",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeInt16 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int16",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int16",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeInt32 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int32",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int32",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeInt64 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int64",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "int64",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeUint8 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint8",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint8",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeUint16 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint16",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint16",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeUint32 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint32",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint32",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))+ Core.IntegerTypeUint64 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint64",+ " literal"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected ",+ "uint64",+ " value"])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))) v1)+ Core.LiteralTypeString -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))) lt)++-- | Generate a decoder for a map type+decodeMapType :: (Core.MapType -> Core.Term)+decodeMapType mt = + let keyDecoder = (decodeType (Core.mapTypeKeys mt))+ in + let valDecoder = (decodeType (Core.mapTypeValues mt))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = keyDecoder})),+ Core.applicationArgument = valDecoder}))++-- | Generate a decoder for an optional type+decodeMaybeType :: (Core.Type -> Core.Term)+decodeMaybeType elemType = + let elemDecoder = (decodeType elemType)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = elemDecoder}))++-- | Transform a type module into a decoder module+decodeModule :: (Module.Module -> Compute.Flow Graph.Graph (Maybe Module.Module))+decodeModule mod = (Flows.bind (filterTypeBindings (Module.moduleElements mod)) (\typeBindings -> Logic.ifElse (Lists.null typeBindings) (Flows.pure Nothing) (Flows.bind (Flows.mapList decodeBinding typeBindings) (\decodedBindings -> + let decodedTypeDeps = (Lists.map decodeNamespace (Module.moduleTypeDependencies mod))+ in + let decodedTermDeps = (Lists.map decodeNamespace (Module.moduleTermDependencies mod))+ in + let allDecodedDeps = (Lists.nub (Lists.concat2 decodedTypeDeps decodedTermDeps))+ in (Flows.pure (Just (Module.Module {+ Module.moduleNamespace = (decodeNamespace (Module.moduleNamespace mod)),+ Module.moduleElements = decodedBindings,+ Module.moduleTermDependencies = (Lists.concat2 [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting")] allDecodedDeps),+ Module.moduleTypeDependencies = [+ Module.moduleNamespace mod,+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just (Strings.cat [+ "Term decoders for ",+ (Module.unNamespace (Module.moduleNamespace mod))]))})))))))++-- | Generate a decoder module namespace from a source module namespace+decodeNamespace :: (Module.Namespace -> Module.Namespace)+decodeNamespace ns = (Module.Namespace (Strings.cat [+ "hydra.decode.",+ (Strings.intercalate "." (Lists.tail (Strings.splitOn "." (Module.unNamespace ns))))]))++-- | Generate a decoder for a pair type+decodePairType :: (Core.PairType -> Core.Term)+decodePairType pt = + let firstDecoder = (decodeType (Core.pairTypeFirst pt))+ in + let secondDecoder = (decodeType (Core.pairTypeSecond pt))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = firstDecoder})),+ Core.applicationArgument = secondDecoder}))++-- | Generate a decoder for a record type+decodeRecordType :: (Core.RowType -> Core.Term)+decodeRecordType rt = + let typeName = (Core.rowTypeTypeName rt)+ in + let fieldTypes = (Core.rowTypeFields rt)+ in + let decodeFieldTerm = (\ft -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString (Core.unName (Core.fieldTypeName ft))))})),+ Core.applicationArgument = (decodeType (Core.fieldTypeType ft))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))+ in + let localVarName = (\ft -> Core.Name (Strings.cat [+ "field_",+ (Core.unName (Core.fieldTypeName ft))]))+ in + let toFieldLambda = (\ft -> \body -> Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (localVarName ft),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = body})))+ in + let decodeBody = (Lists.foldl (\acc -> \ft -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (decodeFieldTerm ft)})),+ Core.applicationArgument = (toFieldLambda ft acc)})) (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = typeName,+ Core.recordFields = (Lists.map (\ft -> Core.Field {+ Core.fieldName = (Core.fieldTypeName ft),+ Core.fieldTerm = (Core.TermVariable (localVarName ft))}) fieldTypes)})))) (Lists.reverse fieldTypes))+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected record of type ",+ (Core.unName typeName)])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = decodeBody}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))++-- | Generate a decoder for a set type+decodeSetType :: (Core.Type -> Core.Term)+decodeSetType elemType = + let elemDecoder = (decodeType elemType)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = elemDecoder}))++-- | Generate a decoder term for a Type+decodeType :: (Core.Type -> Core.Term)+decodeType typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (decodeType (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Core.TermApplication (Core.Application {+ Core.applicationFunction = (decodeType (Core.applicationTypeFunction v1)),+ Core.applicationArgument = (decodeType (Core.applicationTypeArgument v1))}))+ Core.TypeEither v1 -> (decodeEitherType v1)+ Core.TypeForall v1 -> (decodeForallType v1)+ Core.TypeList v1 -> (decodeListType v1)+ Core.TypeLiteral v1 -> (decodeLiteralType v1)+ Core.TypeMap v1 -> (decodeMapType v1)+ Core.TypeMaybe v1 -> (decodeMaybeType v1)+ Core.TypePair v1 -> (decodePairType v1)+ Core.TypeRecord v1 -> (decodeRecordType v1)+ Core.TypeSet v1 -> (decodeSetType v1)+ Core.TypeUnion v1 -> (decodeUnionType v1)+ Core.TypeUnit -> decodeUnitType+ Core.TypeWrap v1 -> (decodeWrappedType v1)+ Core.TypeVariable v1 -> (Core.TermVariable (decodeBindingName v1))+ _ -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unsupported type variant"))}))))})))})))) typ)++-- | Generate a decoder for the unit type+decodeUnitType :: Core.Term+decodeUnitType = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit"))++-- | Generate a decoder for a union type+decodeUnionType :: (Core.RowType -> Core.Term)+decodeUnionType rt = + let typeName = (Core.rowTypeTypeName rt)+ in + let toVariantPair = (\ft -> Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Core.unName (Core.fieldTypeName ft))))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = typeName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.fieldTypeName ft),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (decodeType (Core.fieldTypeType ft)),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected union of type ",+ (Core.unName typeName)])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList (Lists.map toVariantPair (Core.rowTypeFields rt)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))++-- | Generate a decoder for a wrapped type+decodeWrappedType :: (Core.WrappedType -> Core.Term)+decodeWrappedType wt = + let bodyDecoder = (decodeType (Core.wrappedTypeBody wt))+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Strings.cat [+ "expected wrapped type ",+ (Core.unName (Core.wrappedTypeTypeName wt))])))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTypeTypeName wt),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = bodyDecoder,+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))++-- | Get full result type for decoder+decoderFullResultType :: (Core.Type -> Core.Type)+decoderFullResultType typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (decoderFullResultType (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (decoderFullResultType (Core.applicationTypeFunction v1)),+ Core.applicationTypeArgument = (Core.applicationTypeArgument v1)}))+ Core.TypeEither v1 -> (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (decoderFullResultType (Core.eitherTypeLeft v1)),+ Core.eitherTypeRight = (decoderFullResultType (Core.eitherTypeRight v1))}))+ Core.TypeForall v1 -> (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (decoderFullResultType (Core.forallTypeBody v1)),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.forallTypeParameter v1))}))+ Core.TypeList v1 -> (Core.TypeList (decoderFullResultType v1))+ Core.TypeLiteral _ -> (Core.TypeVariable (Core.Name "hydra.core.Literal"))+ Core.TypeMap v1 -> (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (decoderFullResultType (Core.mapTypeKeys v1)),+ Core.mapTypeValues = (decoderFullResultType (Core.mapTypeValues v1))}))+ Core.TypeMaybe v1 -> (Core.TypeMaybe (decoderFullResultType v1))+ Core.TypePair v1 -> (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (decoderFullResultType (Core.pairTypeFirst v1)),+ Core.pairTypeSecond = (decoderFullResultType (Core.pairTypeSecond v1))}))+ Core.TypeRecord v1 -> (Core.TypeVariable (Core.rowTypeTypeName v1))+ Core.TypeSet v1 -> (Core.TypeSet (decoderFullResultType v1))+ Core.TypeUnion v1 -> (Core.TypeVariable (Core.rowTypeTypeName v1))+ Core.TypeUnit -> Core.TypeUnit+ Core.TypeVariable v1 -> (Core.TypeVariable v1)+ Core.TypeWrap v1 -> (Core.TypeVariable (Core.wrappedTypeTypeName v1))+ _ -> (Core.TypeVariable (Core.Name "hydra.core.Term"))) typ)++-- | Compute the result type name for a decoder+decoderResultType :: (Core.Type -> Core.Name)+decoderResultType typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (decoderResultType (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (decoderResultType (Core.applicationTypeFunction v1))+ Core.TypeForall v1 -> (decoderResultType (Core.forallTypeBody v1))+ Core.TypeLiteral _ -> (Core.Name "hydra.core.Literal")+ Core.TypeRecord v1 -> (Core.rowTypeTypeName v1)+ Core.TypeUnion v1 -> (Core.rowTypeTypeName v1)+ Core.TypeWrap v1 -> (Core.wrappedTypeTypeName v1)+ _ -> (Core.Name "hydra.core.Term")) typ)++-- | Build decoder function type+decoderType :: (Core.Type -> Core.Type)+decoderType typ = + let resultType = (decoderFullResultType typ)+ in + let baseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = resultType}))}))}))+ in (prependForallDecoders baseType typ)++-- | Build type scheme for a decoder function+decoderTypeScheme :: (Core.Type -> Core.TypeScheme)+decoderTypeScheme typ = + let typeVars = (collectTypeVariables typ)+ in + let allOrdVars = (collectOrdConstrainedVariables typ)+ in + let ordVars = (Lists.filter (\v -> Lists.elem v typeVars) allOrdVars)+ in + let constraints = (Logic.ifElse (Lists.null ordVars) Nothing (Just (Maps.fromList (Lists.map (\v -> (v, Core.TypeVariableMetadata {+ Core.typeVariableMetadataClasses = (Sets.singleton (Core.Name "ordering"))})) ordVars))))+ in Core.TypeScheme {+ Core.typeSchemeVariables = typeVars,+ Core.typeSchemeType = (decoderType typ),+ Core.typeSchemeConstraints = constraints}++-- | Filter bindings to only decodable type definitions+filterTypeBindings :: ([Core.Binding] -> Compute.Flow Graph.Graph [Core.Binding])+filterTypeBindings bindings = (Flows.map Maybes.cat (Flows.mapList isDecodableBinding (Lists.filter Annotations.isNativeType bindings)))++-- | Check if a binding is decodable (serializable type)+isDecodableBinding :: (Core.Binding -> Compute.Flow Graph.Graph (Maybe Core.Binding))+isDecodableBinding b = (Flows.map (\serializable -> Logic.ifElse serializable (Just b) Nothing) (Schemas.isSerializableByName (Core.bindingName b)))++-- | Prepend decoder types for forall parameters to base type+prependForallDecoders :: (Core.Type -> Core.Type -> Core.Type)+prependForallDecoders baseType typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (prependForallDecoders baseType (Core.annotatedTypeBody v1))+ Core.TypeForall v1 -> (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.forallTypeParameter v1))}))}))})),+ Core.functionTypeCodomain = (prependForallDecoders baseType (Core.forallTypeBody v1))}))+ _ -> baseType) typ)
− src/gen-main/haskell/Hydra/Describe/Core.hs
@@ -1,79 +0,0 @@--- | Natural-language descriptions for hydra.core types--module Hydra.Describe.Core where--import qualified Hydra.Core as Core-import qualified Hydra.Describe.Mantle as Mantle-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Display a floating-point type as a string-floatType :: (Core.FloatType -> String)-floatType t = (Strings.cat [- (\arg_ -> Mantle.precision (Variants.floatTypePrecision arg_)) t,- " floating-point number"])---- | Display an integer type as a string-integerType :: (Core.IntegerType -> String)-integerType t = (Strings.cat [- (\arg_ -> Mantle.precision (Variants.integerTypePrecision arg_)) t,- " integer"])---- | Display a literal type as a string-literalType :: (Core.LiteralType -> String)-literalType x = case x of- Core.LiteralTypeBinary -> "binary string"- Core.LiteralTypeBoolean -> "boolean value"- Core.LiteralTypeFloat v1 -> (floatType v1)- Core.LiteralTypeInteger v1 -> (integerType v1)- Core.LiteralTypeString -> "character string"---- | Display a type as a string-type_ :: (Core.Type -> String)-type_ x = case x of- Core.TypeAnnotated v1 -> (Strings.cat [- "annotated ",- (type_ (Core.annotatedTypeSubject v1))])- Core.TypeApplication v1 -> (Strings.cat [- type_ (Core.applicationTypeFunction v1),- " applied to ",- (type_ (Core.applicationTypeArgument v1))])- Core.TypeLiteral v1 -> (literalType v1)- Core.TypeFunction v1 -> (Strings.cat [- Strings.cat [- Strings.cat [- "function from ",- (type_ (Core.functionTypeDomain v1))],- " to "],- (type_ (Core.functionTypeCodomain v1))])- Core.TypeForall v1 -> (Strings.cat2 "polymorphic " (type_ (Core.forallTypeBody v1)))- Core.TypeList v1 -> (Strings.cat [- "list of ",- (type_ v1)])- Core.TypeMap v1 -> (Strings.cat [- Strings.cat [- Strings.cat [- "map from ",- (type_ (Core.mapTypeKeys v1))],- " to "],- (type_ (Core.mapTypeValues v1))])- Core.TypeOptional v1 -> (Strings.cat [- "optional ",- (type_ v1)])- Core.TypeProduct _ -> "tuple"- Core.TypeRecord _ -> "record"- Core.TypeSet v1 -> (Strings.cat [- "set of ",- (type_ v1)])- Core.TypeSum _ -> "variant tuple"- Core.TypeUnion _ -> "union"- Core.TypeUnit -> "unit"- Core.TypeVariable _ -> "instance of a named type"- Core.TypeWrap v1 -> (Strings.cat [- "wrapper for ",- (type_ (Core.wrappedTypeObject v1))])
− src/gen-main/haskell/Hydra/Describe/Mantle.hs
@@ -1,20 +0,0 @@--- | Natural-language descriptions for hydra.mantle types--module Hydra.Describe.Mantle where--import qualified Hydra.Lib.Literals as Literals-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Display numeric precision as a string-precision :: (Mantle.Precision -> String)-precision x = case x of- Mantle.PrecisionArbitrary -> "arbitrary-precision"- Mantle.PrecisionBits v1 -> (Strings.cat [- Literals.showInt32 v1,- "-bit"])
+ src/gen-main/haskell/Hydra/Encode/Accessors.hs view
@@ -0,0 +1,163 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.accessors++module Hydra.Encode.Accessors where++import qualified Hydra.Accessors as Accessors+import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Lib.Lists as Lists+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++accessorEdge :: (Accessors.AccessorEdge -> Core.Term)+accessorEdge x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorEdge"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "source"),+ Core.fieldTerm = (accessorNode (Accessors.accessorEdgeSource x))},+ Core.Field {+ Core.fieldName = (Core.Name "path"),+ Core.fieldTerm = (accessorPath (Accessors.accessorEdgePath x))},+ Core.Field {+ Core.fieldName = (Core.Name "target"),+ Core.fieldTerm = (accessorNode (Accessors.accessorEdgeTarget x))}]}))++accessorGraph :: (Accessors.AccessorGraph -> Core.Term)+accessorGraph x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorGraph"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "nodes"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map accessorNode xs)) (Accessors.accessorGraphNodes x))},+ Core.Field {+ Core.fieldName = (Core.Name "edges"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map accessorEdge xs)) (Accessors.accessorGraphEdges x))}]}))++accessorNode :: (Accessors.AccessorNode -> Core.Term)+accessorNode x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorNode"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core_.name (Accessors.accessorNodeName x))},+ Core.Field {+ Core.fieldName = (Core.Name "label"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Accessors.accessorNodeLabel x))},+ Core.Field {+ Core.fieldName = (Core.Name "id"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Accessors.accessorNodeId x))}]}))++accessorPath :: (Accessors.AccessorPath -> Core.Term)+accessorPath x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.accessors.AccessorPath"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map termAccessor xs)) (Accessors.unAccessorPath x))}))++termAccessor :: (Accessors.TermAccessor -> Core.Term)+termAccessor x = case x of+ Accessors.TermAccessorAnnotatedBody -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotatedBody"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorApplicationFunction -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applicationFunction"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorApplicationArgument -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applicationArgument"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorLambdaBody -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambdaBody"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorUnionCasesDefault -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unionCasesDefault"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorUnionCasesBranch v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unionCasesBranch"),+ Core.fieldTerm = (Core_.name v1)}}))+ Accessors.TermAccessorLetBody -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "letBody"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorLetBinding v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "letBinding"),+ Core.fieldTerm = (Core_.name v1)}}))+ Accessors.TermAccessorListElement v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "listElement"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Accessors.TermAccessorMapKey v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "mapKey"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Accessors.TermAccessorMapValue v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "mapValue"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Accessors.TermAccessorMaybeTerm -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybeTerm"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorProductTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "productTerm"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Accessors.TermAccessorRecordField v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "recordField"),+ Core.fieldTerm = (Core_.name v1)}}))+ Accessors.TermAccessorSetElement v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "setElement"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Accessors.TermAccessorSumTerm -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sumTerm"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorTypeLambdaBody -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeLambdaBody"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorTypeApplicationTerm -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeApplicationTerm"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorInjectionTerm -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "injectionTerm"),+ Core.fieldTerm = Core.TermUnit}}))+ Accessors.TermAccessorWrappedTerm -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrappedTerm"),+ Core.fieldTerm = Core.TermUnit}}))
+ src/gen-main/haskell/Hydra/Encode/Ast.hs view
@@ -0,0 +1,204 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.ast++module Hydra.Encode.Ast where++import qualified Hydra.Ast as Ast+import qualified Hydra.Core as Core+import qualified Hydra.Lib.Maybes as Maybes+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++associativity :: (Ast.Associativity -> Core.Term)+associativity x = case x of+ Ast.AssociativityNone -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.AssociativityLeft -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.AssociativityRight -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.AssociativityBoth -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "both"),+ Core.fieldTerm = Core.TermUnit}}))++blockStyle :: (Ast.BlockStyle -> Core.Term)+blockStyle x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.BlockStyle"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "indent"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map (\x -> Core.TermLiteral (Core.LiteralString x)) opt)) (Ast.blockStyleIndent x))},+ Core.Field {+ Core.fieldName = (Core.Name "newlineBeforeContent"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralBoolean x)) (Ast.blockStyleNewlineBeforeContent x))},+ Core.Field {+ Core.fieldName = (Core.Name "newlineAfterContent"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralBoolean x)) (Ast.blockStyleNewlineAfterContent x))}]}))++bracketExpr :: (Ast.BracketExpr -> Core.Term)+bracketExpr x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.BracketExpr"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "brackets"),+ Core.fieldTerm = (brackets (Ast.bracketExprBrackets x))},+ Core.Field {+ Core.fieldName = (Core.Name "enclosed"),+ Core.fieldTerm = (expr (Ast.bracketExprEnclosed x))},+ Core.Field {+ Core.fieldName = (Core.Name "style"),+ Core.fieldTerm = (blockStyle (Ast.bracketExprStyle x))}]}))++brackets :: (Ast.Brackets -> Core.Term)+brackets x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Brackets"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "open"),+ Core.fieldTerm = (symbol (Ast.bracketsOpen x))},+ Core.Field {+ Core.fieldName = (Core.Name "close"),+ Core.fieldTerm = (symbol (Ast.bracketsClose x))}]}))++expr :: (Ast.Expr -> Core.Term)+expr x = case x of+ Ast.ExprConst v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "const"),+ Core.fieldTerm = (symbol v1)}}))+ Ast.ExprIndent v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "indent"),+ Core.fieldTerm = (indentedExpression v1)}}))+ Ast.ExprOp v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "op"),+ Core.fieldTerm = (opExpr v1)}}))+ Ast.ExprBrackets v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "brackets"),+ Core.fieldTerm = (bracketExpr v1)}}))++indentedExpression :: (Ast.IndentedExpression -> Core.Term)+indentedExpression x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.IndentedExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "style"),+ Core.fieldTerm = (indentStyle (Ast.indentedExpressionStyle x))},+ Core.Field {+ Core.fieldName = (Core.Name "expr"),+ Core.fieldTerm = (expr (Ast.indentedExpressionExpr x))}]}))++indentStyle :: (Ast.IndentStyle -> Core.Term)+indentStyle x = case x of+ Ast.IndentStyleAllLines v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.IndentStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "allLines"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))+ Ast.IndentStyleSubsequentLines v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.IndentStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "subsequentLines"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))++op :: (Ast.Op -> Core.Term)+op x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Op"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "symbol"),+ Core.fieldTerm = (symbol (Ast.opSymbol x))},+ Core.Field {+ Core.fieldName = (Core.Name "padding"),+ Core.fieldTerm = (padding (Ast.opPadding x))},+ Core.Field {+ Core.fieldName = (Core.Name "precedence"),+ Core.fieldTerm = (precedence (Ast.opPrecedence x))},+ Core.Field {+ Core.fieldName = (Core.Name "associativity"),+ Core.fieldTerm = (associativity (Ast.opAssociativity x))}]}))++opExpr :: (Ast.OpExpr -> Core.Term)+opExpr x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.OpExpr"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "op"),+ Core.fieldTerm = (op (Ast.opExprOp x))},+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (expr (Ast.opExprLhs x))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (expr (Ast.opExprRhs x))}]}))++padding :: (Ast.Padding -> Core.Term)+padding x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Padding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (ws (Ast.paddingLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (ws (Ast.paddingRight x))}]}))++precedence :: (Ast.Precedence -> Core.Term)+precedence x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.ast.Precedence"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (Ast.unPrecedence x))}))++symbol :: (Ast.Symbol -> Core.Term)+symbol x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.ast.Symbol"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Ast.unSymbol x))}))++ws :: (Ast.Ws -> Core.Term)+ws x = case x of+ Ast.WsNone -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.WsSpace -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "space"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.WsBreak -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "break"),+ Core.fieldTerm = Core.TermUnit}}))+ Ast.WsBreakAndIndent v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "breakAndIndent"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))+ Ast.WsDoubleBreak -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "doubleBreak"),+ Core.fieldTerm = Core.TermUnit}}))
+ src/gen-main/haskell/Hydra/Encode/Classes.hs view
@@ -0,0 +1,27 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.classes++module Hydra.Encode.Classes where++import qualified Hydra.Classes as Classes+import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++typeClass :: (Classes.TypeClass -> Core.Term)+typeClass x = case x of+ Classes.TypeClassEquality -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equality"),+ Core.fieldTerm = Core.TermUnit}}))+ Classes.TypeClassOrdering -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ordering"),+ Core.fieldTerm = Core.TermUnit}}))
+ src/gen-main/haskell/Hydra/Encode/Coders.hs view
@@ -0,0 +1,45 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.coders++module Hydra.Encode.Coders where++import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++coderDirection :: (Coders.CoderDirection -> Core.Term)+coderDirection x = case x of+ Coders.CoderDirectionEncode -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = Core.TermUnit}}))+ Coders.CoderDirectionDecode -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = Core.TermUnit}}))++languageName :: (Coders.LanguageName -> Core.Term)+languageName x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.coders.LanguageName"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Coders.unLanguageName x))}))++traversalOrder :: (Coders.TraversalOrder -> Core.Term)+traversalOrder x = case x of+ Coders.TraversalOrderPre -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.TraversalOrder"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pre"),+ Core.fieldTerm = Core.TermUnit}}))+ Coders.TraversalOrderPost -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.TraversalOrder"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "post"),+ Core.fieldTerm = Core.TermUnit}}))
+ src/gen-main/haskell/Hydra/Encode/Compute.hs view
@@ -0,0 +1,46 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.compute++module Hydra.Encode.Compute where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++flowState :: ((t0 -> Core.Term) -> (t1 -> Core.Term) -> Compute.FlowState t0 t1 -> Core.Term)+flowState s v x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map v opt)) (Compute.flowStateValue x))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (s (Compute.flowStateState x))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (trace (Compute.flowStateTrace x))}]}))++trace :: (Compute.Trace -> Core.Term)+trace x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralString x)) xs)) (Compute.traceStack x))},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralString x)) xs)) (Compute.traceMessages x))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.term m)) (Compute.traceOther x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Constraints.hs view
@@ -0,0 +1,37 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.constraints++module Hydra.Encode.Constraints where++import qualified Hydra.Constraints as Constraints+import qualified Hydra.Core as Core+import qualified Hydra.Encode.Query as Query+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++pathEquation :: (Constraints.PathEquation -> Core.Term)+pathEquation x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.constraints.PathEquation"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Query.path (Constraints.pathEquationLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Query.path (Constraints.pathEquationRight x))}]}))++patternImplication :: (Constraints.PatternImplication -> Core.Term)+patternImplication x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.constraints.PatternImplication"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "antecedent"),+ Core.fieldTerm = (Query.pattern (Constraints.patternImplicationAntecedent x))},+ Core.Field {+ Core.fieldName = (Core.Name "consequent"),+ Core.fieldTerm = (Query.pattern (Constraints.patternImplicationConsequent x))}]}))
src/gen-main/haskell/Hydra/Encode/Core.hs view
@@ -1,73 +1,119 @@--- | Mapping of hydra.core constructs in a host language like Haskell or Java to their native Hydra counterparts as terms. This includes an implementation of LambdaGraph's epsilon encoding (types to terms).+-- Note: this is an automatically generated file. Do not edit. +-- | Term encoders for hydra.core+ module Hydra.Encode.Core where import qualified Hydra.Core as Core-import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Rewriting as Rewriting-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S annotatedTerm :: (Core.AnnotatedTerm -> Core.Term)-annotatedTerm a = (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (term (Core.annotatedTermSubject a)),- Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation a)}))+annotatedTerm x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (term (Core.annotatedTermBody x))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap name term m)) (Core.annotatedTermAnnotation x))}]})) annotatedType :: (Core.AnnotatedType -> Core.Term)-annotatedType at = (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (type_ (Core.annotatedTypeSubject at)),- Core.annotatedTermAnnotation = (Core.annotatedTypeAnnotation at)}))+annotatedType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (type_ (Core.annotatedTypeBody x))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap name term m)) (Core.annotatedTypeAnnotation x))}]})) application :: (Core.Application -> Core.Term)-application app = (Core.TermRecord (Core.Record {+application x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Application"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "function"),- Core.fieldTerm = (term (Core.applicationFunction app))},+ Core.fieldTerm = (term (Core.applicationFunction x))}, Core.Field { Core.fieldName = (Core.Name "argument"),- Core.fieldTerm = (term (Core.applicationArgument app))}]}))+ Core.fieldTerm = (term (Core.applicationArgument x))}]})) applicationType :: (Core.ApplicationType -> Core.Term)-applicationType at = (Core.TermRecord (Core.Record {+applicationType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.ApplicationType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "function"),- Core.fieldTerm = (type_ (Core.applicationTypeFunction at))},+ Core.fieldTerm = (type_ (Core.applicationTypeFunction x))}, Core.Field { Core.fieldName = (Core.Name "argument"),- Core.fieldTerm = (type_ (Core.applicationTypeArgument at))}]}))+ Core.fieldTerm = (type_ (Core.applicationTypeArgument x))}]})) +binding :: (Core.Binding -> Core.Term)+binding x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Binding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (name (Core.bindingName x))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (term (Core.bindingTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map typeScheme opt)) (Core.bindingType x))}]}))+ caseStatement :: (Core.CaseStatement -> Core.Term)-caseStatement cs = (Core.TermRecord (Core.Record {+caseStatement x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.CaseStatement"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.caseStatementTypeName cs))},+ Core.fieldTerm = (name (Core.caseStatementTypeName x))}, Core.Field { Core.fieldName = (Core.Name "default"),- Core.fieldTerm = (Core.TermOptional (Optionals.map term (Core.caseStatementDefault cs)))},+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map term opt)) (Core.caseStatementDefault x))}, Core.Field { Core.fieldName = (Core.Name "cases"),- Core.fieldTerm = (Core.TermList (Lists.map field (Core.caseStatementCases cs)))}]}))+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map field xs)) (Core.caseStatementCases x))}]})) +eitherType :: (Core.EitherType -> Core.Term)+eitherType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.EitherType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (type_ (Core.eitherTypeLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (type_ (Core.eitherTypeRight x))}]}))++pairType :: (Core.PairType -> Core.Term)+pairType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.PairType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (type_ (Core.pairTypeFirst x))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (type_ (Core.pairTypeSecond x))}]}))+ elimination :: (Core.Elimination -> Core.Term) elimination x = case x of- Core.EliminationProduct v1 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.core.Elimination"),- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "product"),- Core.fieldTerm = (tupleProjection v1)}})) Core.EliminationRecord v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Elimination"), Core.injectionField = Core.Field {@@ -85,28 +131,26 @@ Core.fieldTerm = (name v1)}})) field :: (Core.Field -> Core.Term)-field f = (Core.TermRecord (Core.Record {+field x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Field"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "name"),- Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),- Core.wrappedTermObject = (Core.TermLiteral (Core.LiteralString (Core.unName (Core.fieldName f))))}))},+ Core.fieldTerm = (name (Core.fieldName x))}, Core.Field { Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (term (Core.fieldTerm f))}]}))+ Core.fieldTerm = (term (Core.fieldTerm x))}]})) fieldType :: (Core.FieldType -> Core.Term)-fieldType ft = (Core.TermRecord (Core.Record {+fieldType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.FieldType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "name"),- Core.fieldTerm = (name (Core.fieldTypeName ft))},+ Core.fieldTerm = (name (Core.fieldTypeName x))}, Core.Field { Core.fieldName = (Core.Name "type"),- Core.fieldTerm = (type_ (Core.fieldTypeType ft))}]}))+ Core.fieldTerm = (type_ (Core.fieldTypeType x))}]})) floatType :: (Core.FloatType -> Core.Term) floatType x = case x of@@ -144,6 +188,17 @@ Core.fieldName = (Core.Name "float64"), Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 v1)))}})) +forallType :: (Core.ForallType -> Core.Term)+forallType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.ForallType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (name (Core.forallTypeParameter x))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (type_ (Core.forallTypeBody x))}]}))+ function :: (Core.Function -> Core.Term) function x = case x of Core.FunctionElimination v1 -> (Core.TermUnion (Core.Injection {@@ -163,26 +218,26 @@ Core.fieldTerm = (name v1)}})) functionType :: (Core.FunctionType -> Core.Term)-functionType ft = (Core.TermRecord (Core.Record {+functionType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.FunctionType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "domain"),- Core.fieldTerm = (type_ (Core.functionTypeDomain ft))},+ Core.fieldTerm = (type_ (Core.functionTypeDomain x))}, Core.Field { Core.fieldName = (Core.Name "codomain"),- Core.fieldTerm = (type_ (Core.functionTypeCodomain ft))}]}))+ Core.fieldTerm = (type_ (Core.functionTypeCodomain x))}]})) injection :: (Core.Injection -> Core.Term)-injection i = (Core.TermRecord (Core.Record {+injection x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Injection"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.injectionTypeName i))},+ Core.fieldTerm = (name (Core.injectionTypeName x))}, Core.Field { Core.fieldName = (Core.Name "field"),- Core.fieldTerm = (field (Core.injectionField i))}]}))+ Core.fieldTerm = (field (Core.injectionField x))}]})) integerType :: (Core.IntegerType -> Core.Term) integerType x = case x of@@ -281,54 +336,29 @@ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 v1)))}})) lambda :: (Core.Lambda -> Core.Term)-lambda l = (Core.TermRecord (Core.Record {+lambda x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Lambda"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "parameter"),- Core.fieldTerm = (name (Core.lambdaParameter l))},+ Core.fieldTerm = (name (Core.lambdaParameter x))}, Core.Field { Core.fieldName = (Core.Name "domain"),- Core.fieldTerm = (Core.TermOptional (Optionals.map type_ (Core.lambdaDomain l)))},- Core.Field {- Core.fieldName = (Core.Name "body"),- Core.fieldTerm = (term (Core.lambdaBody l))}]}))--forallType :: (Core.ForallType -> Core.Term)-forallType lt = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "hydra.core.ForallType"),- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "parameter"),- Core.fieldTerm = (name (Core.forallTypeParameter lt))},+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map type_ opt)) (Core.lambdaDomain x))}, Core.Field { Core.fieldName = (Core.Name "body"),- Core.fieldTerm = (type_ (Core.forallTypeBody lt))}]}))+ Core.fieldTerm = (term (Core.lambdaBody x))}]})) let_ :: (Core.Let -> Core.Term)-let_ l = (Core.TermRecord (Core.Record {+let_ x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Let"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "bindings"),- Core.fieldTerm = (Core.TermList (Lists.map binding (Core.letBindings l)))},- Core.Field {- Core.fieldName = (Core.Name "environment"),- Core.fieldTerm = (term (Core.letEnvironment l))}]}))--binding :: (Core.Binding -> Core.Term)-binding b = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "hydra.core.Binding"),- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "name"),- Core.fieldTerm = (name (Core.bindingName b))},- Core.Field {- Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (term (Core.bindingTerm b))},+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map binding xs)) (Core.letBindings x))}, Core.Field {- Core.fieldName = (Core.Name "type"),- Core.fieldTerm = (Core.TermOptional (Optionals.map typeScheme (Core.bindingType b)))}]}))+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (term (Core.letBody x))}]})) literal :: (Core.Literal -> Core.Term) literal x = case x of@@ -387,67 +417,53 @@ Core.fieldTerm = Core.TermUnit}})) mapType :: (Core.MapType -> Core.Term)-mapType mt = (Core.TermRecord (Core.Record {+mapType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.MapType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "keys"),- Core.fieldTerm = (type_ (Core.mapTypeKeys mt))},+ Core.fieldTerm = (type_ (Core.mapTypeKeys x))}, Core.Field { Core.fieldName = (Core.Name "values"),- Core.fieldTerm = (type_ (Core.mapTypeValues mt))}]}))+ Core.fieldTerm = (type_ (Core.mapTypeValues x))}]})) name :: (Core.Name -> Core.Term)-name fn = (Core.TermWrap (Core.WrappedTerm {+name x = (Core.TermWrap (Core.WrappedTerm { Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),- Core.wrappedTermObject = (Core.TermLiteral (Core.LiteralString (Core.unName fn)))}))+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Core.unName x))})) projection :: (Core.Projection -> Core.Term)-projection p = (Core.TermRecord (Core.Record {+projection x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Projection"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.projectionTypeName p))},+ Core.fieldTerm = (name (Core.projectionTypeName x))}, Core.Field { Core.fieldName = (Core.Name "field"),- Core.fieldTerm = (name (Core.projectionField p))}]}))+ Core.fieldTerm = (name (Core.projectionField x))}]})) record :: (Core.Record -> Core.Term)-record r = (Core.TermRecord (Core.Record {+record x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.Record"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.recordTypeName r))},+ Core.fieldTerm = (name (Core.recordTypeName x))}, Core.Field { Core.fieldName = (Core.Name "fields"),- Core.fieldTerm = (Core.TermList (Lists.map field (Core.recordFields r)))}]}))+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map field xs)) (Core.recordFields x))}]})) rowType :: (Core.RowType -> Core.Term)-rowType rt = (Core.TermRecord (Core.Record {+rowType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.RowType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.rowTypeTypeName rt))},+ Core.fieldTerm = (name (Core.rowTypeTypeName x))}, Core.Field { Core.fieldName = (Core.Name "fields"),- Core.fieldTerm = (Core.TermList (Lists.map fieldType (Core.rowTypeFields rt)))}]}))--sum :: (Core.Sum -> Core.Term)-sum s = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "hydra.core.Sum"),- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "index"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.sumIndex s))))},- Core.Field {- Core.fieldName = (Core.Name "size"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.sumSize s))))},- Core.Field {- Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (term (Core.sumTerm s))}]}))+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map fieldType xs)) (Core.rowTypeFields x))}]})) term :: (Core.Term -> Core.Term) term x = case x of@@ -461,6 +477,11 @@ Core.injectionField = Core.Field { Core.fieldName = (Core.Name "application"), Core.fieldTerm = (application v1)}}))+ Core.TermEither v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermEither (Eithers.bimap term term v1))}})) Core.TermFunction v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {@@ -471,31 +492,31 @@ Core.injectionField = Core.Field { Core.fieldName = (Core.Name "let"), Core.fieldTerm = (let_ v1)}}))- Core.TermLiteral v1 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.core.Term"),- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "literal"),- Core.fieldTerm = (literal v1)}})) Core.TermList v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "list"), Core.fieldTerm = (Core.TermList (Lists.map term v1))}}))+ Core.TermLiteral v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (literal v1)}})) Core.TermMap v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "map"), Core.fieldTerm = (Core.TermMap (Maps.bimap term term v1))}}))- Core.TermOptional v1 -> (Core.TermUnion (Core.Injection {+ Core.TermMaybe v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "optional"),- Core.fieldTerm = (Core.TermOptional (Optionals.map term v1))}}))- Core.TermProduct v1 -> (Core.TermUnion (Core.Injection {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermMaybe (Maybes.map term v1))}}))+ Core.TermPair v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "product"),- Core.fieldTerm = (Core.TermList (Lists.map term v1))}}))+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermPair (Pairs.bimap term term v1))}})) Core.TermRecord v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {@@ -506,21 +527,16 @@ Core.injectionField = Core.Field { Core.fieldName = (Core.Name "set"), Core.fieldTerm = (Core.TermSet (Sets.map term v1))}}))- Core.TermSum v1 -> (Core.TermUnion (Core.Injection {+ Core.TermTypeApplication v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "sum"),- Core.fieldTerm = (sum v1)}}))+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = (typeApplicationTerm v1)}})) Core.TermTypeLambda v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "typeLambda"), Core.fieldTerm = (typeLambda v1)}}))- Core.TermTypeApplication v1 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.core.Term"),- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "typeApplication"),- Core.fieldTerm = (typedTerm v1)}})) Core.TermUnion v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Term"), Core.injectionField = Core.Field {@@ -542,42 +558,33 @@ Core.fieldName = (Core.Name "wrap"), Core.fieldTerm = (wrappedTerm v1)}})) -tupleProjection :: (Core.TupleProjection -> Core.Term)-tupleProjection tp = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "hydra.core.TupleProjection"),- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "arity"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.tupleProjectionArity tp))))},- Core.Field {- Core.fieldName = (Core.Name "index"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.tupleProjectionIndex tp))))},- Core.Field {- Core.fieldName = (Core.Name "domain"),- Core.fieldTerm = (Core.TermOptional (Optionals.map encodeTypes (Core.tupleProjectionDomain tp)))}]})) - where - encodeTypes = (\types -> Core.TermList (Lists.map type_ types))- type_ :: (Core.Type -> Core.Term) type_ x = case x of- Core.TypeAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (type_ (Core.annotatedTypeSubject v1)),- Core.annotatedTermAnnotation = (Core.annotatedTypeAnnotation v1)}))+ Core.TypeAnnotated v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (annotatedType v1)}})) Core.TypeApplication v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "application"), Core.fieldTerm = (applicationType v1)}}))- Core.TypeFunction v1 -> (Core.TermUnion (Core.Injection {+ Core.TypeEither v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "function"),- Core.fieldTerm = (functionType v1)}}))+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (eitherType v1)}})) Core.TypeForall v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field { Core.fieldName = (Core.Name "forall"), Core.fieldTerm = (forallType v1)}}))+ Core.TypeFunction v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (functionType v1)}})) Core.TypeList v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {@@ -593,16 +600,16 @@ Core.injectionField = Core.Field { Core.fieldName = (Core.Name "map"), Core.fieldTerm = (mapType v1)}}))- Core.TypeOptional v1 -> (Core.TermUnion (Core.Injection {+ Core.TypeMaybe v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "optional"),+ Core.fieldName = (Core.Name "maybe"), Core.fieldTerm = (type_ v1)}}))- Core.TypeProduct v1 -> (Core.TermUnion (Core.Injection {+ Core.TypePair v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "product"),- Core.fieldTerm = (Core.TermList (Lists.map type_ v1))}}))+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (pairType v1)}})) Core.TypeRecord v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {@@ -613,11 +620,6 @@ Core.injectionField = Core.Field { Core.fieldName = (Core.Name "set"), Core.fieldTerm = (type_ v1)}}))- Core.TypeSum v1 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.Name "hydra.core.Type"),- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "sum"),- Core.fieldTerm = (Core.TermList (Lists.map type_ v1))}})) Core.TypeUnion v1 -> (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name "hydra.core.Type"), Core.injectionField = Core.Field {@@ -639,82 +641,68 @@ Core.fieldName = (Core.Name "wrap"), Core.fieldTerm = (wrappedType v1)}})) +typeApplicationTerm :: (Core.TypeApplicationTerm -> Core.Term)+typeApplicationTerm x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeApplicationTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (term (Core.typeApplicationTermBody x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (type_ (Core.typeApplicationTermType x))}]}))+ typeLambda :: (Core.TypeLambda -> Core.Term)-typeLambda l = (Core.TermRecord (Core.Record {+typeLambda x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.TypeLambda"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "parameter"),- Core.fieldTerm = (name (Core.typeLambdaParameter l))},+ Core.fieldTerm = (name (Core.typeLambdaParameter x))}, Core.Field { Core.fieldName = (Core.Name "body"),- Core.fieldTerm = (term (Core.typeLambdaBody l))}]}))+ Core.fieldTerm = (term (Core.typeLambdaBody x))}]})) typeScheme :: (Core.TypeScheme -> Core.Term)-typeScheme ts = (Core.TermRecord (Core.Record {+typeScheme x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.TypeScheme"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "variables"),- Core.fieldTerm = (Core.TermList (Lists.map name (Core.typeSchemeVariables ts)))},+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map name xs)) (Core.typeSchemeVariables x))}, Core.Field { Core.fieldName = (Core.Name "type"),- Core.fieldTerm = (type_ (Core.typeSchemeType ts))}]}))+ Core.fieldTerm = (type_ (Core.typeSchemeType x))},+ Core.Field {+ Core.fieldName = (Core.Name "constraints"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map (\m -> Core.TermMap (Maps.bimap name typeVariableMetadata m)) opt)) (Core.typeSchemeConstraints x))}]})) -typedTerm :: (Core.TypedTerm -> Core.Term)-typedTerm tt = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name "hydra.core.TypedTerm"),+typeVariableMetadata :: (Core.TypeVariableMetadata -> Core.Term)+typeVariableMetadata x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeVariableMetadata"), Core.recordFields = [ Core.Field {- Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (term (Core.typedTermTerm tt))},- Core.Field {- Core.fieldName = (Core.Name "type"),- Core.fieldTerm = (type_ (Core.typedTermType tt))}]}))+ Core.fieldName = (Core.Name "classes"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map name s)) (Core.typeVariableMetadataClasses x))}]})) wrappedTerm :: (Core.WrappedTerm -> Core.Term)-wrappedTerm n = (Core.TermRecord (Core.Record {+wrappedTerm x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.wrappedTermTypeName n))},+ Core.fieldTerm = (name (Core.wrappedTermTypeName x))}, Core.Field {- Core.fieldName = (Core.Name "object"),- Core.fieldTerm = (term (Core.wrappedTermObject n))}]}))+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (term (Core.wrappedTermBody x))}]})) wrappedType :: (Core.WrappedType -> Core.Term)-wrappedType nt = (Core.TermRecord (Core.Record {+wrappedType x = (Core.TermRecord (Core.Record { Core.recordTypeName = (Core.Name "hydra.core.WrappedType"), Core.recordFields = [ Core.Field { Core.fieldName = (Core.Name "typeName"),- Core.fieldTerm = (name (Core.wrappedTypeTypeName nt))},+ Core.fieldTerm = (name (Core.wrappedTypeTypeName x))}, Core.Field {- Core.fieldName = (Core.Name "object"),- Core.fieldTerm = (type_ (Core.wrappedTypeObject nt))}]}))---- | Determines whether a given term is an encoded type-isEncodedType :: (Core.Term -> Bool)-isEncodedType t = ((\x -> case x of- Core.TermApplication v1 -> (isEncodedType (Core.applicationFunction v1))- Core.TermUnion v1 -> (Equality.equal "hydra.core.Type" (Core.unName (Core.injectionTypeName v1)))- _ -> False) (Rewriting.deannotateTerm t))--isType :: (Core.Type -> Bool)-isType t = ((\x -> case x of- Core.TypeApplication v1 -> (isType (Core.applicationTypeFunction v1))- Core.TypeForall v1 -> (isType (Core.forallTypeBody v1))- Core.TypeUnion v1 -> (Equality.equal "hydra.core.Type" (Core.unName (Core.rowTypeTypeName v1)))- Core.TypeVariable v1 -> (Equality.equal v1 (Core.Name "hydra.core.Type"))- _ -> False) (Rewriting.deannotateType t))--isUnitTerm :: (Core.Term -> Bool)-isUnitTerm x = case x of- Core.TermUnit -> True- _ -> False--isUnitType :: (Core.Type -> Bool)-isUnitType x = case x of- Core.TypeUnit -> True- _ -> False+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (type_ (Core.wrappedTypeBody x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Grammar.hs view
@@ -0,0 +1,120 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.grammar++module Hydra.Encode.Grammar where++import qualified Hydra.Core as Core+import qualified Hydra.Grammar as Grammar+import qualified Hydra.Lib.Lists as Lists+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++constant :: (Grammar.Constant -> Core.Term)+constant x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Constant"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Grammar.unConstant x))}))++grammar :: (Grammar.Grammar -> Core.Term)+grammar x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Grammar"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map production xs)) (Grammar.unGrammar x))}))++label :: (Grammar.Label -> Core.Term)+label x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Label"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Grammar.unLabel x))}))++labeledPattern :: (Grammar.LabeledPattern -> Core.Term)+labeledPattern x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.grammar.LabeledPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "label"),+ Core.fieldTerm = (label (Grammar.labeledPatternLabel x))},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (pattern (Grammar.labeledPatternPattern x))}]}))++pattern :: (Grammar.Pattern -> Core.Term)+pattern x = case x of+ Grammar.PatternAlternatives v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Core.TermList (Lists.map pattern v1))}}))+ Grammar.PatternConstant v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "constant"),+ Core.fieldTerm = (constant v1)}}))+ Grammar.PatternIgnored v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ignored"),+ Core.fieldTerm = (pattern v1)}}))+ Grammar.PatternLabeled v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "labeled"),+ Core.fieldTerm = (labeledPattern v1)}}))+ Grammar.PatternNil -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nil"),+ Core.fieldTerm = Core.TermUnit}}))+ Grammar.PatternNonterminal v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nonterminal"),+ Core.fieldTerm = (symbol v1)}}))+ Grammar.PatternOption v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "option"),+ Core.fieldTerm = (pattern v1)}}))+ Grammar.PatternPlus v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "plus"),+ Core.fieldTerm = (pattern v1)}}))+ Grammar.PatternRegex v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (regex v1)}}))+ Grammar.PatternSequence v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sequence"),+ Core.fieldTerm = (Core.TermList (Lists.map pattern v1))}}))+ Grammar.PatternStar v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "star"),+ Core.fieldTerm = (pattern v1)}}))++production :: (Grammar.Production -> Core.Term)+production x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.grammar.Production"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "symbol"),+ Core.fieldTerm = (symbol (Grammar.productionSymbol x))},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (pattern (Grammar.productionPattern x))}]}))++regex :: (Grammar.Regex -> Core.Term)+regex x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Regex"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Grammar.unRegex x))}))++symbol :: (Grammar.Symbol -> Core.Term)+symbol x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Symbol"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Grammar.unSymbol x))}))
+ src/gen-main/haskell/Hydra/Encode/Json.hs view
@@ -0,0 +1,49 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.json++module Hydra.Encode.Json where++import qualified Hydra.Core as Core+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++value :: (Model.Value -> Core.Term)+value x = case x of+ Model.ValueArray v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "array"),+ Core.fieldTerm = (Core.TermList (Lists.map value v1))}}))+ Model.ValueBoolean v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean v1))}}))+ Model.ValueNull -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "null"),+ Core.fieldTerm = Core.TermUnit}}))+ Model.ValueNumber v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "number"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat v1)))}}))+ Model.ValueObject v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (Core.TermMap (Maps.bimap (\x -> Core.TermLiteral (Core.LiteralString x)) value v1))}}))+ Model.ValueString v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))
+ src/gen-main/haskell/Hydra/Encode/Json/Model.hs view
@@ -0,0 +1,49 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.json.model++module Hydra.Encode.Json.Model where++import qualified Hydra.Core as Core+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++value :: (Model.Value -> Core.Term)+value x = case x of+ Model.ValueArray v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "array"),+ Core.fieldTerm = (Core.TermList (Lists.map value v1))}}))+ Model.ValueBoolean v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean v1))}}))+ Model.ValueNull -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "null"),+ Core.fieldTerm = Core.TermUnit}}))+ Model.ValueNumber v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "number"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat v1)))}}))+ Model.ValueObject v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (Core.TermMap (Maps.bimap (\x -> Core.TermLiteral (Core.LiteralString x)) value v1))}}))+ Model.ValueString v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))
+ src/gen-main/haskell/Hydra/Encode/Module.hs view
@@ -0,0 +1,109 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.module++module Hydra.Encode.Module where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++definition :: (Module.Definition -> Core.Term)+definition x = case x of+ Module.DefinitionTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.module.Definition"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (termDefinition v1)}}))+ Module.DefinitionType v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.module.Definition"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (typeDefinition v1)}}))++fileExtension :: (Module.FileExtension -> Core.Term)+fileExtension x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.module.FileExtension"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Module.unFileExtension x))}))++module_ :: (Module.Module -> Core.Term)+module_ x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "namespace"),+ Core.fieldTerm = (namespace (Module.moduleNamespace x))},+ Core.Field {+ Core.fieldName = (Core.Name "elements"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.binding xs)) (Module.moduleElements x))},+ Core.Field {+ Core.fieldName = (Core.Name "termDependencies"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map namespace xs)) (Module.moduleTermDependencies x))},+ Core.Field {+ Core.fieldName = (Core.Name "typeDependencies"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map namespace xs)) (Module.moduleTypeDependencies x))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map (\x -> Core.TermLiteral (Core.LiteralString x)) opt)) (Module.moduleDescription x))}]}))++namespace :: (Module.Namespace -> Core.Term)+namespace x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.module.Namespace"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Module.unNamespace x))}))++namespaces :: ((t0 -> Core.Term) -> Module.Namespaces t0 -> Core.Term)+namespaces n x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.Namespaces"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "focus"),+ Core.fieldTerm = ((\p -> Core.TermPair (Pairs.bimap namespace n p)) (Module.namespacesFocus x))},+ Core.Field {+ Core.fieldName = (Core.Name "mapping"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap namespace n m)) (Module.namespacesMapping x))}]}))++qualifiedName :: (Module.QualifiedName -> Core.Term)+qualifiedName x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.QualifiedName"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "namespace"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map namespace opt)) (Module.qualifiedNameNamespace x))},+ Core.Field {+ Core.fieldName = (Core.Name "local"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Module.qualifiedNameLocal x))}]}))++termDefinition :: (Module.TermDefinition -> Core.Term)+termDefinition x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core_.name (Module.termDefinitionName x))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Module.termDefinitionTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.typeScheme (Module.termDefinitionType x))}]}))++typeDefinition :: (Module.TypeDefinition -> Core.Term)+typeDefinition x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.TypeDefinition"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core_.name (Module.typeDefinitionName x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Module.typeDefinitionType x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Parsing.hs view
@@ -0,0 +1,49 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.parsing++module Hydra.Encode.Parsing where++import qualified Hydra.Core as Core+import qualified Hydra.Parsing as Parsing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++parseError :: (Parsing.ParseError -> Core.Term)+parseError x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.parsing.ParseError"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "message"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Parsing.parseErrorMessage x))},+ Core.Field {+ Core.fieldName = (Core.Name "remainder"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Parsing.parseErrorRemainder x))}]}))++parseResult :: ((t0 -> Core.Term) -> Parsing.ParseResult t0 -> Core.Term)+parseResult a x = case x of+ Parsing.ParseResultSuccess v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.parsing.ParseResult"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (parseSuccess a v1)}}))+ Parsing.ParseResultFailure v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.parsing.ParseResult"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "failure"),+ Core.fieldTerm = (parseError v1)}}))++parseSuccess :: ((t0 -> Core.Term) -> Parsing.ParseSuccess t0 -> Core.Term)+parseSuccess a x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.parsing.ParseSuccess"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (a (Parsing.parseSuccessValue x))},+ Core.Field {+ Core.fieldName = (Core.Name "remainder"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Parsing.parseSuccessRemainder x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Phantoms.hs view
@@ -0,0 +1,31 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.phantoms++module Hydra.Encode.Phantoms where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Phantoms as Phantoms+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++tBinding :: (t0 -> Phantoms.TBinding t1 -> Core.Term)+tBinding a x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.phantoms.TBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core_.name (Phantoms.tBindingName x))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (tTerm a (Phantoms.tBindingTerm x))}]}))++tTerm :: (t0 -> Phantoms.TTerm t1 -> Core.Term)+tTerm a x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.phantoms.TTerm"),+ Core.wrappedTermBody = (Core_.term (Phantoms.unTTerm x))}))
+ src/gen-main/haskell/Hydra/Encode/Query.hs view
@@ -0,0 +1,247 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.query++module Hydra.Encode.Query where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Query as Query+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++comparisonConstraint :: (Query.ComparisonConstraint -> Core.Term)+comparisonConstraint x = case x of+ Query.ComparisonConstraintEqual -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equal"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.ComparisonConstraintNotEqual -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "notEqual"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.ComparisonConstraintLessThan -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.ComparisonConstraintGreaterThan -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.ComparisonConstraintLessThanOrEqual -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThanOrEqual"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.ComparisonConstraintGreaterThanOrEqual -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThanOrEqual"),+ Core.fieldTerm = Core.TermUnit}}))++edge :: (Query.Edge -> Core.Term)+edge x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Edge"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.name (Query.edgeType x))},+ Core.Field {+ Core.fieldName = (Core.Name "out"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map Core_.name opt)) (Query.edgeOut x))},+ Core.Field {+ Core.fieldName = (Core.Name "in"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map Core_.name opt)) (Query.edgeIn x))}]}))++graphPattern :: (Query.GraphPattern -> Core.Term)+graphPattern x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.GraphPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "graph"),+ Core.fieldTerm = (Core_.name (Query.graphPatternGraph x))},+ Core.Field {+ Core.fieldName = (Core.Name "patterns"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map pattern xs)) (Query.graphPatternPatterns x))}]}))++node :: (Query.Node -> Core.Term)+node x = case x of+ Query.NodeTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term v1)}}))+ Query.NodeVariable v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (variable v1)}}))+ Query.NodeWildcard -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wildcard"),+ Core.fieldTerm = Core.TermUnit}}))++path :: (Query.Path -> Core.Term)+path x = case x of+ Query.PathStep v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "step"),+ Core.fieldTerm = (step v1)}}))+ Query.PathRegex v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (regexSequence v1)}}))+ Query.PathInverse v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inverse"),+ Core.fieldTerm = (path v1)}}))++pattern :: (Query.Pattern -> Core.Term)+pattern x = case x of+ Query.PatternTriple v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "triple"),+ Core.fieldTerm = (triplePattern v1)}}))+ Query.PatternNegation v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "negation"),+ Core.fieldTerm = (pattern v1)}}))+ Query.PatternConjunction v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "conjunction"),+ Core.fieldTerm = (Core.TermList (Lists.map pattern v1))}}))+ Query.PatternDisjunction v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "disjunction"),+ Core.fieldTerm = (Core.TermList (Lists.map pattern v1))}}))+ Query.PatternGraph v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "graph"),+ Core.fieldTerm = (graphPattern v1)}}))++query :: (Query.Query -> Core.Term)+query x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Query"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "variables"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map variable xs)) (Query.queryVariables x))},+ Core.Field {+ Core.fieldName = (Core.Name "patterns"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map pattern xs)) (Query.queryPatterns x))}]}))++range :: (Query.Range -> Core.Term)+range x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Range"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "min"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (Query.rangeMin x))},+ Core.Field {+ Core.fieldName = (Core.Name "max"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (Query.rangeMax x))}]}))++regexQuantifier :: (Query.RegexQuantifier -> Core.Term)+regexQuantifier x = case x of+ Query.RegexQuantifierOne -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "one"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.RegexQuantifierZeroOrOne -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "zeroOrOne"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.RegexQuantifierZeroOrMore -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "zeroOrMore"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.RegexQuantifierOneOrMore -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "oneOrMore"),+ Core.fieldTerm = Core.TermUnit}}))+ Query.RegexQuantifierExactly v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "exactly"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Query.RegexQuantifierAtLeast v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "atLeast"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))+ Query.RegexQuantifierRange v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "range"),+ Core.fieldTerm = (range v1)}}))++regexSequence :: (Query.RegexSequence -> Core.Term)+regexSequence x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.RegexSequence"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "path"),+ Core.fieldTerm = (path (Query.regexSequencePath x))},+ Core.Field {+ Core.fieldName = (Core.Name "quantifier"),+ Core.fieldTerm = (regexQuantifier (Query.regexSequenceQuantifier x))}]}))++step :: (Query.Step -> Core.Term)+step x = case x of+ Query.StepEdge v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "edge"),+ Core.fieldTerm = (edge v1)}}))+ Query.StepProject v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "project"),+ Core.fieldTerm = (Core_.projection v1)}}))+ Query.StepCompare v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "compare"),+ Core.fieldTerm = (comparisonConstraint v1)}}))++triplePattern :: (Query.TriplePattern -> Core.Term)+triplePattern x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.TriplePattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "subject"),+ Core.fieldTerm = (node (Query.triplePatternSubject x))},+ Core.Field {+ Core.fieldName = (Core.Name "predicate"),+ Core.fieldTerm = (path (Query.triplePatternPredicate x))},+ Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (node (Query.triplePatternObject x))}]}))++variable :: (Query.Variable -> Core.Term)+variable x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.query.Variable"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Query.unVariable x))}))
+ src/gen-main/haskell/Hydra/Encode/Relational.hs view
@@ -0,0 +1,86 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.relational++module Hydra.Encode.Relational where++import qualified Hydra.Core as Core+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Relational as Relational+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++columnName :: (Relational.ColumnName -> Core.Term)+columnName x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.ColumnName"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Relational.unColumnName x))}))++columnSchema :: ((t0 -> Core.Term) -> Relational.ColumnSchema t0 -> Core.Term)+columnSchema t x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.ColumnSchema"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (columnName (Relational.columnSchemaName x))},+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (t (Relational.columnSchemaDomain x))}]}))++foreignKey :: (Relational.ForeignKey -> Core.Term)+foreignKey x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.ForeignKey"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "foreignRelation"),+ Core.fieldTerm = (relationName (Relational.foreignKeyForeignRelation x))},+ Core.Field {+ Core.fieldName = (Core.Name "keys"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap columnName columnName m)) (Relational.foreignKeyKeys x))}]}))++primaryKey :: (Relational.PrimaryKey -> Core.Term)+primaryKey x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.PrimaryKey"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map columnName xs)) (Relational.unPrimaryKey x))}))++relation :: ((t0 -> Core.Term) -> Relational.Relation t0 -> Core.Term)+relation v x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Relation"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map (row v) xs)) (Relational.unRelation x))}))++relationName :: (Relational.RelationName -> Core.Term)+relationName x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.RelationName"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Relational.unRelationName x))}))++relationSchema :: ((t0 -> Core.Term) -> Relational.RelationSchema t0 -> Core.Term)+relationSchema t x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (relationName (Relational.relationSchemaName x))},+ Core.Field {+ Core.fieldName = (Core.Name "columns"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (columnSchema t) xs)) (Relational.relationSchemaColumns x))},+ Core.Field {+ Core.fieldName = (Core.Name "primaryKeys"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map primaryKey xs)) (Relational.relationSchemaPrimaryKeys x))},+ Core.Field {+ Core.fieldName = (Core.Name "foreignKeys"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map foreignKey xs)) (Relational.relationSchemaForeignKeys x))}]}))++relationship :: ((t0 -> Core.Term) -> Relational.Relationship t0 -> Core.Term)+relationship v x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Relationship"),+ Core.wrappedTermBody = ((\s -> Core.TermSet (Sets.map (\m -> Core.TermMap (Maps.bimap columnName v m)) s)) (Relational.unRelationship x))}))++row :: ((t0 -> Core.Term) -> Relational.Row t0 -> Core.Term)+row v x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Row"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map v xs)) (Relational.unRow x))}))
+ src/gen-main/haskell/Hydra/Encode/Tabular.hs view
@@ -0,0 +1,61 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.tabular++module Hydra.Encode.Tabular where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Encode.Relational as Relational+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Tabular as Tabular+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++columnType :: (Tabular.ColumnType -> Core.Term)+columnType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.ColumnType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Relational.columnName (Tabular.columnTypeName x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Tabular.columnTypeType x))}]}))++dataRow :: ((t0 -> Core.Term) -> Tabular.DataRow t0 -> Core.Term)+dataRow v x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.tabular.DataRow"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map (\opt -> Core.TermMaybe (Maybes.map v opt)) xs)) (Tabular.unDataRow x))}))++headerRow :: (Tabular.HeaderRow -> Core.Term)+headerRow x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.tabular.HeaderRow"),+ Core.wrappedTermBody = ((\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralString x)) xs)) (Tabular.unHeaderRow x))}))++table :: ((t0 -> Core.Term) -> Tabular.Table t0 -> Core.Term)+table v x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.Table"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "header"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map headerRow opt)) (Tabular.tableHeader x))},+ Core.Field {+ Core.fieldName = (Core.Name "data"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (dataRow v) xs)) (Tabular.tableData x))}]}))++tableType :: (Tabular.TableType -> Core.Term)+tableType x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.TableType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Relational.relationName (Tabular.tableTypeName x))},+ Core.Field {+ Core.fieldName = (Core.Name "columns"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map columnType xs)) (Tabular.tableTypeColumns x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Testing.hs view
@@ -0,0 +1,822 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.testing++module Hydra.Encode.Testing where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Ast as Ast+import qualified Hydra.Encode.Coders as Coders+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Encode.Json.Model as Model+import qualified Hydra.Encode.Parsing as Parsing+import qualified Hydra.Encode.Typing as Typing+import qualified Hydra.Encode.Util as Util+import qualified Hydra.Json.Model as Model_+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++alphaConversionTestCase :: (Testing.AlphaConversionTestCase -> Core.Term)+alphaConversionTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Testing.alphaConversionTestCaseTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "oldVariable"),+ Core.fieldTerm = (Core_.name (Testing.alphaConversionTestCaseOldVariable x))},+ Core.Field {+ Core.fieldName = (Core.Name "newVariable"),+ Core.fieldTerm = (Core_.name (Testing.alphaConversionTestCaseNewVariable x))},+ Core.Field {+ Core.fieldName = (Core.Name "result"),+ Core.fieldTerm = (Core_.term (Testing.alphaConversionTestCaseResult x))}]}))++evaluationStyle :: (Testing.EvaluationStyle -> Core.Term)+evaluationStyle x = case x of+ Testing.EvaluationStyleEager -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.EvaluationStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "eager"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.EvaluationStyleLazy -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.EvaluationStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lazy"),+ Core.fieldTerm = Core.TermUnit}}))++caseConversionTestCase :: (Testing.CaseConversionTestCase -> Core.Term)+caseConversionTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "fromConvention"),+ Core.fieldTerm = (Util.caseConvention (Testing.caseConversionTestCaseFromConvention x))},+ Core.Field {+ Core.fieldName = (Core.Name "toConvention"),+ Core.fieldTerm = (Util.caseConvention (Testing.caseConversionTestCaseToConvention x))},+ Core.Field {+ Core.fieldName = (Core.Name "fromString"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.caseConversionTestCaseFromString x))},+ Core.Field {+ Core.fieldName = (Core.Name "toString"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.caseConversionTestCaseToString x))}]}))++delegatedEvaluationTestCase :: (Testing.DelegatedEvaluationTestCase -> Core.Term)+delegatedEvaluationTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DelegatedEvaluationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.delegatedEvaluationTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.delegatedEvaluationTestCaseOutput x))}]}))++etaExpansionTestCase :: (Testing.EtaExpansionTestCase -> Core.Term)+etaExpansionTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.EtaExpansionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.etaExpansionTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.etaExpansionTestCaseOutput x))}]}))++deannotateTermTestCase :: (Testing.DeannotateTermTestCase -> Core.Term)+deannotateTermTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DeannotateTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.deannotateTermTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.deannotateTermTestCaseOutput x))}]}))++deannotateTypeTestCase :: (Testing.DeannotateTypeTestCase -> Core.Term)+deannotateTypeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DeannotateTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.type_ (Testing.deannotateTypeTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.type_ (Testing.deannotateTypeTestCaseOutput x))}]}))++flattenLetTermsTestCase :: (Testing.FlattenLetTermsTestCase -> Core.Term)+flattenLetTermsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FlattenLetTermsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.flattenLetTermsTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.flattenLetTermsTestCaseOutput x))}]}))++foldOperation :: (Testing.FoldOperation -> Core.Term)+foldOperation x = case x of+ Testing.FoldOperationSumInt32Literals -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sumInt32Literals"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.FoldOperationCollectListLengths -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "collectListLengths"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.FoldOperationCollectLabels -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "collectLabels"),+ Core.fieldTerm = Core.TermUnit}}))++foldOverTermTestCase :: (Testing.FoldOverTermTestCase -> Core.Term)+foldOverTermTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.foldOverTermTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "traversalOrder"),+ Core.fieldTerm = (Coders.traversalOrder (Testing.foldOverTermTestCaseTraversalOrder x))},+ Core.Field {+ Core.fieldName = (Core.Name "operation"),+ Core.fieldTerm = (foldOperation (Testing.foldOverTermTestCaseOperation x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.foldOverTermTestCaseOutput x))}]}))++freeVariablesTestCase :: (Testing.FreeVariablesTestCase -> Core.Term)+freeVariablesTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FreeVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.freeVariablesTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map Core_.name s)) (Testing.freeVariablesTestCaseOutput x))}]}))++hoistPredicate :: (Testing.HoistPredicate -> Core.Term)+hoistPredicate x = case x of+ Testing.HoistPredicateCaseStatements -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "caseStatements"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.HoistPredicateApplications -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applications"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.HoistPredicateLists -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lists"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.HoistPredicateNothing -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = Core.TermUnit}}))++hoistLetBindingsTestCase :: (Testing.HoistLetBindingsTestCase -> Core.Term)+hoistLetBindingsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistLetBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.let_ (Testing.hoistLetBindingsTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.let_ (Testing.hoistLetBindingsTestCaseOutput x))}]}))++hoistPolymorphicLetBindingsTestCase :: (Testing.HoistPolymorphicLetBindingsTestCase -> Core.Term)+hoistPolymorphicLetBindingsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.let_ (Testing.hoistPolymorphicLetBindingsTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.let_ (Testing.hoistPolymorphicLetBindingsTestCaseOutput x))}]}))++hoistSubtermsTestCase :: (Testing.HoistSubtermsTestCase -> Core.Term)+hoistSubtermsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistSubtermsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "predicate"),+ Core.fieldTerm = (hoistPredicate (Testing.hoistSubtermsTestCasePredicate x))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.hoistSubtermsTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.hoistSubtermsTestCaseOutput x))}]}))++hoistCaseStatementsTestCase :: (Testing.HoistCaseStatementsTestCase -> Core.Term)+hoistCaseStatementsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistCaseStatementsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.hoistCaseStatementsTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.hoistCaseStatementsTestCaseOutput x))}]}))++termRewriter :: (Testing.TermRewriter -> Core.Term)+termRewriter x = case x of+ Testing.TermRewriterReplaceFooWithBar -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TermRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceFooWithBar"),+ Core.fieldTerm = Core.TermUnit}}))+ Testing.TermRewriterReplaceInt32WithInt64 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TermRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceInt32WithInt64"),+ Core.fieldTerm = Core.TermUnit}}))++rewriteTermTestCase :: (Testing.RewriteTermTestCase -> Core.Term)+rewriteTermTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.RewriteTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.rewriteTermTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriter"),+ Core.fieldTerm = (termRewriter (Testing.rewriteTermTestCaseRewriter x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.rewriteTermTestCaseOutput x))}]}))++typeRewriter :: (Testing.TypeRewriter -> Core.Term)+typeRewriter x = case x of+ Testing.TypeRewriterReplaceStringWithInt32 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TypeRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceStringWithInt32"),+ Core.fieldTerm = Core.TermUnit}}))++rewriteTypeTestCase :: (Testing.RewriteTypeTestCase -> Core.Term)+rewriteTypeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.RewriteTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.type_ (Testing.rewriteTypeTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriter"),+ Core.fieldTerm = (typeRewriter (Testing.rewriteTypeTestCaseRewriter x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.type_ (Testing.rewriteTypeTestCaseOutput x))}]}))++evaluationTestCase :: (Testing.EvaluationTestCase -> Core.Term)+evaluationTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.EvaluationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "evaluationStyle"),+ Core.fieldTerm = (evaluationStyle (Testing.evaluationTestCaseEvaluationStyle x))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.evaluationTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.evaluationTestCaseOutput x))}]}))++inferenceFailureTestCase :: (Testing.InferenceFailureTestCase -> Core.Term)+inferenceFailureTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.InferenceFailureTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.inferenceFailureTestCaseInput x))}]}))++inferenceTestCase :: (Testing.InferenceTestCase -> Core.Term)+inferenceTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.InferenceTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.inferenceTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.typeScheme (Testing.inferenceTestCaseOutput x))}]}))++jsonCoderTestCase :: (Testing.JsonCoderTestCase -> Core.Term)+jsonCoderTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonCoderTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Testing.jsonCoderTestCaseType x))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Testing.jsonCoderTestCaseTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "json"),+ Core.fieldTerm = (Model.value (Testing.jsonCoderTestCaseJson x))}]}))++jsonDecodeTestCase :: (Testing.JsonDecodeTestCase -> Core.Term)+jsonDecodeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonDecodeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Testing.jsonDecodeTestCaseType x))},+ Core.Field {+ Core.fieldName = (Core.Name "json"),+ Core.fieldTerm = (Model.value (Testing.jsonDecodeTestCaseJson x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\e -> Core.TermEither (Eithers.bimap (\x -> Core.TermLiteral (Core.LiteralString x)) Core_.term e)) (Testing.jsonDecodeTestCaseExpected x))}]}))++jsonEncodeTestCase :: (Testing.JsonEncodeTestCase -> Core.Term)+jsonEncodeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonEncodeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Testing.jsonEncodeTestCaseTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\e -> Core.TermEither (Eithers.bimap (\x -> Core.TermLiteral (Core.LiteralString x)) Model.value e)) (Testing.jsonEncodeTestCaseExpected x))}]}))++jsonParserTestCase :: (Testing.ParserTestCase Model_.Value -> Core.Term)+jsonParserTestCase = (parserTestCase Model.value)++jsonRoundtripTestCase :: (Testing.JsonRoundtripTestCase -> Core.Term)+jsonRoundtripTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonRoundtripTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Testing.jsonRoundtripTestCaseType x))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Testing.jsonRoundtripTestCaseTerm x))}]}))++liftLambdaAboveLetTestCase :: (Testing.LiftLambdaAboveLetTestCase -> Core.Term)+liftLambdaAboveLetTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.liftLambdaAboveLetTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.liftLambdaAboveLetTestCaseOutput x))}]}))++jsonWriterTestCase :: (Testing.WriterTestCase Model_.Value -> Core.Term)+jsonWriterTestCase = (writerTestCase Model.value)++parserTestCase :: ((t0 -> Core.Term) -> Testing.ParserTestCase t0 -> Core.Term)+parserTestCase a x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.ParserTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.parserTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Parsing.parseResult a (Testing.parserTestCaseOutput x))}]}))++tag :: (Testing.Tag -> Core.Term)+tag x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.testing.Tag"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.unTag x))}))++testCase :: (Testing.TestCase -> Core.Term)+testCase x = case x of+ Testing.TestCaseAlphaConversion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "alphaConversion"),+ Core.fieldTerm = (alphaConversionTestCase v1)}}))+ Testing.TestCaseCaseConversion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "caseConversion"),+ Core.fieldTerm = (caseConversionTestCase v1)}}))+ Testing.TestCaseDeannotateTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "deannotateTerm"),+ Core.fieldTerm = (deannotateTermTestCase v1)}}))+ Testing.TestCaseDeannotateType v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "deannotateType"),+ Core.fieldTerm = (deannotateTypeTestCase v1)}}))+ Testing.TestCaseDelegatedEvaluation v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "delegatedEvaluation"),+ Core.fieldTerm = (delegatedEvaluationTestCase v1)}}))+ Testing.TestCaseEtaExpansion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "etaExpansion"),+ Core.fieldTerm = (etaExpansionTestCase v1)}}))+ Testing.TestCaseFlattenLetTerms v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "flattenLetTerms"),+ Core.fieldTerm = (flattenLetTermsTestCase v1)}}))+ Testing.TestCaseFreeVariables v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "freeVariables"),+ Core.fieldTerm = (freeVariablesTestCase v1)}}))+ Testing.TestCaseEvaluation v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "evaluation"),+ Core.fieldTerm = (evaluationTestCase v1)}}))+ Testing.TestCaseInference v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inference"),+ Core.fieldTerm = (inferenceTestCase v1)}}))+ Testing.TestCaseInferenceFailure v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inferenceFailure"),+ Core.fieldTerm = (inferenceFailureTestCase v1)}}))+ Testing.TestCaseJsonCoder v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonCoder"),+ Core.fieldTerm = (jsonCoderTestCase v1)}}))+ Testing.TestCaseJsonDecode v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonDecode"),+ Core.fieldTerm = (jsonDecodeTestCase v1)}}))+ Testing.TestCaseJsonEncode v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonEncode"),+ Core.fieldTerm = (jsonEncodeTestCase v1)}}))+ Testing.TestCaseJsonParser v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonParser"),+ Core.fieldTerm = (jsonParserTestCase v1)}}))+ Testing.TestCaseJsonRoundtrip v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonRoundtrip"),+ Core.fieldTerm = (jsonRoundtripTestCase v1)}}))+ Testing.TestCaseJsonWriter v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonWriter"),+ Core.fieldTerm = (jsonWriterTestCase v1)}}))+ Testing.TestCaseLiftLambdaAboveLet v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "liftLambdaAboveLet"),+ Core.fieldTerm = (liftLambdaAboveLetTestCase v1)}}))+ Testing.TestCaseSerialization v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "serialization"),+ Core.fieldTerm = (serializationTestCase v1)}}))+ Testing.TestCaseSimplifyTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "simplifyTerm"),+ Core.fieldTerm = (simplifyTermTestCase v1)}}))+ Testing.TestCaseTopologicalSort v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSort"),+ Core.fieldTerm = (topologicalSortTestCase v1)}}))+ Testing.TestCaseTopologicalSortBindings v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSortBindings"),+ Core.fieldTerm = (topologicalSortBindingsTestCase v1)}}))+ Testing.TestCaseTopologicalSortSCC v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSortSCC"),+ Core.fieldTerm = (topologicalSortSCCTestCase v1)}}))+ Testing.TestCaseTypeChecking v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeChecking"),+ Core.fieldTerm = (typeCheckingTestCase v1)}}))+ Testing.TestCaseTypeCheckingFailure v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeCheckingFailure"),+ Core.fieldTerm = (typeCheckingFailureTestCase v1)}}))+ Testing.TestCaseTypeReduction v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeReduction"),+ Core.fieldTerm = (typeReductionTestCase v1)}}))+ Testing.TestCaseNormalizeTypeVariables v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "normalizeTypeVariables"),+ Core.fieldTerm = (normalizeTypeVariablesTestCase v1)}}))+ Testing.TestCaseFoldOverTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "foldOverTerm"),+ Core.fieldTerm = (foldOverTermTestCase v1)}}))+ Testing.TestCaseRewriteTerm v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "rewriteTerm"),+ Core.fieldTerm = (rewriteTermTestCase v1)}}))+ Testing.TestCaseRewriteType v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "rewriteType"),+ Core.fieldTerm = (rewriteTypeTestCase v1)}}))+ Testing.TestCaseHoistSubterms v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistSubterms"),+ Core.fieldTerm = (hoistSubtermsTestCase v1)}}))+ Testing.TestCaseHoistCaseStatements v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistCaseStatements"),+ Core.fieldTerm = (hoistCaseStatementsTestCase v1)}}))+ Testing.TestCaseHoistLetBindings v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistLetBindings"),+ Core.fieldTerm = (hoistLetBindingsTestCase v1)}}))+ Testing.TestCaseHoistPolymorphicLetBindings v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistPolymorphicLetBindings"),+ Core.fieldTerm = (hoistPolymorphicLetBindingsTestCase v1)}}))+ Testing.TestCaseSubstInType v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "substInType"),+ Core.fieldTerm = (substInTypeTestCase v1)}}))+ Testing.TestCaseVariableOccursInType v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variableOccursInType"),+ Core.fieldTerm = (variableOccursInTypeTestCase v1)}}))+ Testing.TestCaseUnifyTypes v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unifyTypes"),+ Core.fieldTerm = (unifyTypesTestCase v1)}}))+ Testing.TestCaseJoinTypes v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "joinTypes"),+ Core.fieldTerm = (joinTypesTestCase v1)}}))+ Testing.TestCaseUnshadowVariables v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unshadowVariables"),+ Core.fieldTerm = (unshadowVariablesTestCase v1)}}))++testCaseWithMetadata :: (Testing.TestCaseWithMetadata -> Core.Term)+testCaseWithMetadata x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.testCaseWithMetadataName x))},+ Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (testCase (Testing.testCaseWithMetadataCase x))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map (\x -> Core.TermLiteral (Core.LiteralString x)) opt)) (Testing.testCaseWithMetadataDescription x))},+ Core.Field {+ Core.fieldName = (Core.Name "tags"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map tag xs)) (Testing.testCaseWithMetadataTags x))}]}))++testGroup :: (Testing.TestGroup -> Core.Term)+testGroup x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.testGroupName x))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map (\x -> Core.TermLiteral (Core.LiteralString x)) opt)) (Testing.testGroupDescription x))},+ Core.Field {+ Core.fieldName = (Core.Name "subgroups"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map testGroup xs)) (Testing.testGroupSubgroups x))},+ Core.Field {+ Core.fieldName = (Core.Name "cases"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map testCaseWithMetadata xs)) (Testing.testGroupCases x))}]}))++typeCheckingTestCase :: (Testing.TypeCheckingTestCase -> Core.Term)+typeCheckingTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeCheckingTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.typeCheckingTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "outputTerm"),+ Core.fieldTerm = (Core_.term (Testing.typeCheckingTestCaseOutputTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "outputType"),+ Core.fieldTerm = (Core_.type_ (Testing.typeCheckingTestCaseOutputType x))}]}))++typeCheckingFailureTestCase :: (Testing.TypeCheckingFailureTestCase -> Core.Term)+typeCheckingFailureTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeCheckingFailureTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.typeCheckingFailureTestCaseInput x))}]}))++topologicalSortBindingsTestCase :: (Testing.TopologicalSortBindingsTestCase -> Core.Term)+topologicalSortBindingsTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\p -> Core.TermPair (Pairs.bimap Core_.name Core_.term p)) xs)) (Testing.topologicalSortBindingsTestCaseBindings x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\xs -> Core.TermList (Lists.map (\p -> Core.TermPair (Pairs.bimap Core_.name Core_.term p)) xs)) xs)) (Testing.topologicalSortBindingsTestCaseExpected x))}]}))++topologicalSortTestCase :: (Testing.TopologicalSortTestCase -> Core.Term)+topologicalSortTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "adjacencyList"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\p -> Core.TermPair (Pairs.bimap (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) xs)) p)) xs)) (Testing.topologicalSortTestCaseAdjacencyList x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\e -> Core.TermEither (Eithers.bimap (\xs -> Core.TermList (Lists.map (\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) xs)) xs)) (\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) xs)) e)) (Testing.topologicalSortTestCaseExpected x))}]}))++topologicalSortSCCTestCase :: (Testing.TopologicalSortSCCTestCase -> Core.Term)+topologicalSortSCCTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortSCCTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "adjacencyList"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\p -> Core.TermPair (Pairs.bimap (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) xs)) p)) xs)) (Testing.topologicalSortSCCTestCaseAdjacencyList x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\xs -> Core.TermList (Lists.map (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) xs)) xs)) (Testing.topologicalSortSCCTestCaseExpected x))}]}))++serializationTestCase :: (Testing.SerializationTestCase -> Core.Term)+serializationTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SerializationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Ast.expr (Testing.serializationTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.serializationTestCaseOutput x))}]}))++simplifyTermTestCase :: (Testing.SimplifyTermTestCase -> Core.Term)+simplifyTermTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SimplifyTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.simplifyTermTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.simplifyTermTestCaseOutput x))}]}))++normalizeTypeVariablesTestCase :: (Testing.NormalizeTypeVariablesTestCase -> Core.Term)+normalizeTypeVariablesTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.normalizeTypeVariablesTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.normalizeTypeVariablesTestCaseOutput x))}]}))++typeReductionTestCase :: (Testing.TypeReductionTestCase -> Core.Term)+typeReductionTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeReductionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.type_ (Testing.typeReductionTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.type_ (Testing.typeReductionTestCaseOutput x))}]}))++writerTestCase :: ((t0 -> Core.Term) -> Testing.WriterTestCase t0 -> Core.Term)+writerTestCase a x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.WriterTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (a (Testing.writerTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Testing.writerTestCaseOutput x))}]}))++substInTypeTestCase :: (Testing.SubstInTypeTestCase -> Core.Term)+substInTypeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SubstInTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "substitution"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\p -> Core.TermPair (Pairs.bimap Core_.name Core_.type_ p)) xs)) (Testing.substInTypeTestCaseSubstitution x))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.type_ (Testing.substInTypeTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.type_ (Testing.substInTypeTestCaseOutput x))}]}))++variableOccursInTypeTestCase :: (Testing.VariableOccursInTypeTestCase -> Core.Term)+variableOccursInTypeTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.VariableOccursInTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core_.name (Testing.variableOccursInTypeTestCaseVariable x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Testing.variableOccursInTypeTestCaseType x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralBoolean x)) (Testing.variableOccursInTypeTestCaseExpected x))}]}))++unshadowVariablesTestCase :: (Testing.UnshadowVariablesTestCase -> Core.Term)+unshadowVariablesTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.UnshadowVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core_.term (Testing.unshadowVariablesTestCaseInput x))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core_.term (Testing.unshadowVariablesTestCaseOutput x))}]}))++unifyTypesTestCase :: (Testing.UnifyTypesTestCase -> Core.Term)+unifyTypesTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "schemaTypes"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.name xs)) (Testing.unifyTypesTestCaseSchemaTypes x))},+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core_.type_ (Testing.unifyTypesTestCaseLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core_.type_ (Testing.unifyTypesTestCaseRight x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\e -> Core.TermEither (Eithers.bimap (\x -> Core.TermLiteral (Core.LiteralString x)) Typing.typeSubst e)) (Testing.unifyTypesTestCaseExpected x))}]}))++joinTypesTestCase :: (Testing.JoinTypesTestCase -> Core.Term)+joinTypesTestCase x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JoinTypesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core_.type_ (Testing.joinTypesTestCaseLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core_.type_ (Testing.joinTypesTestCaseRight x))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = ((\e -> Core.TermEither (Eithers.bimap (\_ -> Core.TermUnit) (\xs -> Core.TermList (Lists.map Typing.typeConstraint xs)) e)) (Testing.joinTypesTestCaseExpected x))}]}))
+ src/gen-main/haskell/Hydra/Encode/Topology.hs view
@@ -0,0 +1,46 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.topology++module Hydra.Encode.Topology where++import qualified Hydra.Core as Core+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Topology as Topology+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++graph :: (M.Map Int [Int] -> Core.Term)+graph m = (Core.TermMap (Maps.bimap vertex (\xs -> Core.TermList (Lists.map vertex xs)) m))++tarjanState :: (Topology.TarjanState -> Core.Term)+tarjanState x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "counter"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) (Topology.tarjanStateCounter x))},+ Core.Field {+ Core.fieldName = (Core.Name "indices"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap vertex (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) m)) (Topology.tarjanStateIndices x))},+ Core.Field {+ Core.fieldName = (Core.Name "lowLinks"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap vertex (\x -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x))) m)) (Topology.tarjanStateLowLinks x))},+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map vertex xs)) (Topology.tarjanStateStack x))},+ Core.Field {+ Core.fieldName = (Core.Name "onStack"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map vertex s)) (Topology.tarjanStateOnStack x))},+ Core.Field {+ Core.fieldName = (Core.Name "sccs"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map (\xs -> Core.TermList (Lists.map vertex xs)) xs)) (Topology.tarjanStateSccs x))}]}))++vertex :: (Int -> Core.Term)+vertex x = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 x)))
+ src/gen-main/haskell/Hydra/Encode/Typing.hs view
@@ -0,0 +1,129 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.typing++module Hydra.Encode.Typing where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++functionStructure :: ((t0 -> Core.Term) -> Typing.FunctionStructure t0 -> Core.Term)+functionStructure env x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeParams"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.name xs)) (Typing.functionStructureTypeParams x))},+ Core.Field {+ Core.fieldName = (Core.Name "params"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.name xs)) (Typing.functionStructureParams x))},+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.binding xs)) (Typing.functionStructureBindings x))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core_.term (Typing.functionStructureBody x))},+ Core.Field {+ Core.fieldName = (Core.Name "domains"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Core_.type_ xs)) (Typing.functionStructureDomains x))},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = ((\opt -> Core.TermMaybe (Maybes.map Core_.type_ opt)) (Typing.functionStructureCodomain x))},+ Core.Field {+ Core.fieldName = (Core.Name "environment"),+ Core.fieldTerm = (env (Typing.functionStructureEnvironment x))}]}))++inferenceContext :: (Typing.InferenceContext -> Core.Term)+inferenceContext x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "schemaTypes"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.typeScheme m)) (Typing.inferenceContextSchemaTypes x))},+ Core.Field {+ Core.fieldName = (Core.Name "primitiveTypes"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.typeScheme m)) (Typing.inferenceContextPrimitiveTypes x))},+ Core.Field {+ Core.fieldName = (Core.Name "dataTypes"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.typeScheme m)) (Typing.inferenceContextDataTypes x))},+ Core.Field {+ Core.fieldName = (Core.Name "classConstraints"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.typeVariableMetadata m)) (Typing.inferenceContextClassConstraints x))},+ Core.Field {+ Core.fieldName = (Core.Name "debug"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralBoolean x)) (Typing.inferenceContextDebug x))}]}))++inferenceResult :: (Typing.InferenceResult -> Core.Term)+inferenceResult x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core_.term (Typing.inferenceResultTerm x))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Typing.inferenceResultType x))},+ Core.Field {+ Core.fieldName = (Core.Name "subst"),+ Core.fieldTerm = (typeSubst (Typing.inferenceResultSubst x))},+ Core.Field {+ Core.fieldName = (Core.Name "classConstraints"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.typeVariableMetadata m)) (Typing.inferenceResultClassConstraints x))}]}))++termSubst :: (Typing.TermSubst -> Core.Term)+termSubst x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.typing.TermSubst"),+ Core.wrappedTermBody = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.term m)) (Typing.unTermSubst x))}))++typeConstraint :: (Typing.TypeConstraint -> Core.Term)+typeConstraint x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.TypeConstraint"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core_.type_ (Typing.typeConstraintLeft x))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core_.type_ (Typing.typeConstraintRight x))},+ Core.Field {+ Core.fieldName = (Core.Name "comment"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Typing.typeConstraintComment x))}]}))++typeContext :: (Typing.TypeContext -> Core.Term)+typeContext x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "types"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.type_ m)) (Typing.typeContextTypes x))},+ Core.Field {+ Core.fieldName = (Core.Name "metadata"),+ Core.fieldTerm = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.term m)) (Typing.typeContextMetadata x))},+ Core.Field {+ Core.fieldName = (Core.Name "typeVariables"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map Core_.name s)) (Typing.typeContextTypeVariables x))},+ Core.Field {+ Core.fieldName = (Core.Name "lambdaVariables"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map Core_.name s)) (Typing.typeContextLambdaVariables x))},+ Core.Field {+ Core.fieldName = (Core.Name "letVariables"),+ Core.fieldTerm = ((\s -> Core.TermSet (Sets.map Core_.name s)) (Typing.typeContextLetVariables x))},+ Core.Field {+ Core.fieldName = (Core.Name "inferenceContext"),+ Core.fieldTerm = (inferenceContext (Typing.typeContextInferenceContext x))}]}))++typeSubst :: (Typing.TypeSubst -> Core.Term)+typeSubst x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.typing.TypeSubst"),+ Core.wrappedTermBody = ((\m -> Core.TermMap (Maps.bimap Core_.name Core_.type_ m)) (Typing.unTypeSubst x))}))
+ src/gen-main/haskell/Hydra/Encode/Util.hs view
@@ -0,0 +1,73 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.util++module Hydra.Encode.Util where++import qualified Hydra.Core as Core+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++caseConvention :: (Util.CaseConvention -> Core.Term)+caseConvention x = case x of+ Util.CaseConventionCamel -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "camel"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.CaseConventionPascal -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pascal"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.CaseConventionLowerSnake -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lowerSnake"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.CaseConventionUpperSnake -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "upperSnake"),+ Core.fieldTerm = Core.TermUnit}}))++comparison :: (Util.Comparison -> Core.Term)+comparison x = case x of+ Util.ComparisonLessThan -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.ComparisonEqualTo -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.ComparisonGreaterThan -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))++decodingError :: (Util.DecodingError -> Core.Term)+decodingError x = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Util.unDecodingError x))}))++precision :: (Util.Precision -> Core.Term)+precision x = case x of+ Util.PrecisionArbitrary -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Precision"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "arbitrary"),+ Core.fieldTerm = Core.TermUnit}}))+ Util.PrecisionBits v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Precision"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bits"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 v1)))}}))
+ src/gen-main/haskell/Hydra/Encode/Variants.hs view
@@ -0,0 +1,254 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.variants++module Hydra.Encode.Variants where++import qualified Hydra.Core as Core+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++eliminationVariant :: (Variants.EliminationVariant -> Core.Term)+eliminationVariant x = case x of+ Variants.EliminationVariantRecord -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.EliminationVariantUnion -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.EliminationVariantWrap -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = Core.TermUnit}}))++functionVariant :: (Variants.FunctionVariant -> Core.Term)+functionVariant x = case x of+ Variants.FunctionVariantElimination -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "elimination"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.FunctionVariantLambda -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.FunctionVariantPrimitive -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = Core.TermUnit}}))++literalVariant :: (Variants.LiteralVariant -> Core.Term)+literalVariant x = case x of+ Variants.LiteralVariantBinary -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.LiteralVariantBoolean -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.LiteralVariantFloat -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.LiteralVariantInteger -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.LiteralVariantString -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = Core.TermUnit}}))++termVariant :: (Variants.TermVariant -> Core.Term)+termVariant x = case x of+ Variants.TermVariantAnnotated -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantApplication -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantEither -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantFunction -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantLet -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantList -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantLiteral -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantMap -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantMaybe -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantPair -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantRecord -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantSet -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantTypeApplication -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantTypeLambda -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeLambda"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantUnion -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantUnit -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantVariable -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TermVariantWrap -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = Core.TermUnit}}))++typeVariant :: (Variants.TypeVariant -> Core.Term)+typeVariant x = case x of+ Variants.TypeVariantAnnotated -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantApplication -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantEither -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantForall -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantFunction -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantList -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantLiteral -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantMap -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantMaybe -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantPair -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantRecord -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantSet -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantUnion -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantUnit -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantVariable -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = Core.TermUnit}}))+ Variants.TypeVariantWrap -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = Core.TermUnit}}))
+ src/gen-main/haskell/Hydra/Encode/Workflow.hs view
@@ -0,0 +1,63 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term encoders for hydra.workflow++module Hydra.Encode.Workflow where++import qualified Hydra.Core as Core+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Encode.Module as Module+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Workflow as Workflow+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++hydraSchemaSpec :: (Workflow.HydraSchemaSpec -> Core.Term)+hydraSchemaSpec x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.workflow.HydraSchemaSpec"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modules"),+ Core.fieldTerm = ((\xs -> Core.TermList (Lists.map Module.module_ xs)) (Workflow.hydraSchemaSpecModules x))},+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core_.name (Workflow.hydraSchemaSpecTypeName x))}]}))++schemaSpec :: (Workflow.SchemaSpec -> Core.Term)+schemaSpec x = case x of+ Workflow.SchemaSpecHydra v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hydra"),+ Core.fieldTerm = (hydraSchemaSpec v1)}}))+ Workflow.SchemaSpecFile v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "file"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString v1))}}))+ Workflow.SchemaSpecProvided -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "provided"),+ Core.fieldTerm = Core.TermUnit}}))++transformWorkflow :: (Workflow.TransformWorkflow -> Core.Term)+transformWorkflow x = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Workflow.transformWorkflowName x))},+ Core.Field {+ Core.fieldName = (Core.Name "schemaSpec"),+ Core.fieldTerm = (schemaSpec (Workflow.transformWorkflowSchemaSpec x))},+ Core.Field {+ Core.fieldName = (Core.Name "srcDir"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Workflow.transformWorkflowSrcDir x))},+ Core.Field {+ Core.fieldName = (Core.Name "destDir"),+ Core.fieldTerm = ((\x -> Core.TermLiteral (Core.LiteralString x)) (Workflow.transformWorkflowDestDir x))}]}))
+ src/gen-main/haskell/Hydra/Encoding.hs view
@@ -0,0 +1,413 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Functions for generating term encoders from type modules++module Hydra.Encoding where++import qualified Hydra.Annotations as Annotations+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Decode.Core as Core_+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Module as Module+import qualified Hydra.Monads as Monads+import qualified Hydra.Names as Names+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Transform a type binding into an encoder binding+encodeBinding :: (Core.Binding -> Compute.Flow Graph.Graph Core.Binding)+encodeBinding b = (Flows.bind Monads.getState (\cx -> Flows.bind (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm b))) (\typ -> Flows.pure (Core.Binding {+ Core.bindingName = (encodeBindingName (Core.bindingName b)),+ Core.bindingTerm = (encodeType typ),+ Core.bindingType = Nothing}))))++-- | Generate a binding name for an encoder function from a type name+encodeBindingName :: (Core.Name -> Core.Name)+encodeBindingName n = (Logic.ifElse (Logic.not (Lists.null (Lists.tail (Strings.splitOn "." (Core.unName n))))) (Core.Name (Strings.intercalate "." (Lists.concat2 [+ "hydra",+ "encode"] (Lists.concat2 (Lists.tail (Lists.init (Strings.splitOn "." (Core.unName n)))) [+ Formatting.decapitalize (Names.localNameOf n)])))) (Core.Name (Formatting.decapitalize (Names.localNameOf n))))++-- | Generate the encoder for a field's value+encodeFieldValue :: (Core.Name -> Core.Name -> Core.Type -> Core.Term)+encodeFieldValue typeName fieldName fieldType = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (encodeInjection typeName fieldName (Core.TermApplication (Core.Application {+ Core.applicationFunction = (encodeType fieldType),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})))}}))})))++-- | Encode a float value based on its float type+encodeFloatValue :: (Core.FloatType -> Core.Term -> Core.Term)+encodeFloatValue floatType valTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = ((\x -> case x of+ Core.FloatTypeBigfloat -> (Core.Name "bigfloat")+ Core.FloatTypeFloat32 -> (Core.Name "float32")+ Core.FloatTypeFloat64 -> (Core.Name "float64")) floatType),+ Core.fieldTerm = valTerm}}))++-- | Encode an Injection as a term+encodeInjection :: (Core.Name -> Core.Name -> Core.Term -> Core.Term)+encodeInjection typeName fieldName fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (encodeName typeName)},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = ((\fname -> \fterm -> Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (encodeName fname)},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = fterm}]})) fieldName fieldTerm)}]}))++-- | Encode an integer value based on its integer type+encodeIntegerValue :: (Core.IntegerType -> Core.Term -> Core.Term)+encodeIntegerValue intType valTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = ((\x -> case x of+ Core.IntegerTypeBigint -> (Core.Name "bigint")+ Core.IntegerTypeInt8 -> (Core.Name "int8")+ Core.IntegerTypeInt16 -> (Core.Name "int16")+ Core.IntegerTypeInt32 -> (Core.Name "int32")+ Core.IntegerTypeInt64 -> (Core.Name "int64")+ Core.IntegerTypeUint8 -> (Core.Name "uint8")+ Core.IntegerTypeUint16 -> (Core.Name "uint16")+ Core.IntegerTypeUint32 -> (Core.Name "uint32")+ Core.IntegerTypeUint64 -> (Core.Name "uint64")) intType),+ Core.fieldTerm = valTerm}}))++-- | Generate an encoder for a list type+encodeListType :: (Core.Type -> Core.Term)+encodeListType elemType = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (encodeType elemType)})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))++-- | Generate an encoder for a literal type+encodeLiteralType :: (Core.LiteralType -> Core.Term)+encodeLiteralType x = case x of+ Core.LiteralTypeBinary -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))+ Core.LiteralTypeBoolean -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))+ Core.LiteralTypeString -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))+ Core.LiteralTypeInteger v1 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (encodeIntegerValue v1 (Core.TermVariable (Core.Name "x")))}}))}}))})))+ Core.LiteralTypeFloat v1 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (encodeFloatValue v1 (Core.TermVariable (Core.Name "x")))}}))}}))})))+ _ -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))++-- | Generate an encoder for an Either type+encodeEitherType :: (Core.EitherType -> Core.Term)+encodeEitherType et = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (encodeType (Core.eitherTypeLeft et))})),+ Core.applicationArgument = (encodeType (Core.eitherTypeRight et))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))})))++-- | Generate an encoder for a polymorphic (forall) type+encodeForallType :: (Core.ForallType -> Core.Term)+encodeForallType ft = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (encodeBindingName (Core.forallTypeParameter ft)),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (encodeType (Core.forallTypeBody ft))})))++-- | Generate an encoder for a map type+encodeMapType :: (Core.MapType -> Core.Term)+encodeMapType mt = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (encodeType (Core.mapTypeKeys mt))})),+ Core.applicationArgument = (encodeType (Core.mapTypeValues mt))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))})))++-- | Generate an encoder for an optional type+encodeOptionalType :: (Core.Type -> Core.Term)+encodeOptionalType elemType = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (encodeType elemType)})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))})))++-- | Generate an encoder for a pair type+encodePairType :: (Core.PairType -> Core.Term)+encodePairType pt = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (encodeType (Core.pairTypeFirst pt))})),+ Core.applicationArgument = (encodeType (Core.pairTypeSecond pt))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))++-- | Transform a type module into an encoder module+encodeModule :: (Module.Module -> Compute.Flow Graph.Graph (Maybe Module.Module))+encodeModule mod = (Flows.bind (filterTypeBindings (Module.moduleElements mod)) (\typeBindings -> Logic.ifElse (Lists.null typeBindings) (Flows.pure Nothing) (Flows.bind (Flows.mapList encodeBinding typeBindings) (\encodedBindings -> Flows.pure (Just (Module.Module {+ Module.moduleNamespace = (encodeNamespace (Module.moduleNamespace mod)),+ Module.moduleElements = encodedBindings,+ Module.moduleTermDependencies = (Lists.map encodeNamespace (Module.moduleTypeDependencies mod)),+ Module.moduleTypeDependencies = [+ Module.moduleNamespace mod],+ Module.moduleDescription = (Just (Strings.cat [+ "Term encoders for ",+ (Module.unNamespace (Module.moduleNamespace mod))]))}))))))++-- | Encode a Name as a term+encodeName :: (Core.Name -> Core.Term)+encodeName n = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString (Core.unName n)))}))++-- | Generate an encoder module namespace from a source module namespace+encodeNamespace :: (Module.Namespace -> Module.Namespace)+encodeNamespace ns = (Module.Namespace (Strings.cat [+ "hydra.encode.",+ (Strings.intercalate "." (Lists.tail (Strings.splitOn "." (Module.unNamespace ns))))]))++-- | Generate an encoder for a record type+encodeRecordType :: (Core.RowType -> Core.Term)+encodeRecordType rt = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (encodeName (Core.rowTypeTypeName rt))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList (Lists.map ((\recType -> \ft -> Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (encodeName (Core.fieldTypeName ft))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (encodeType (Core.fieldTypeType ft)),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.rowTypeTypeName recType),+ Core.projectionField = (Core.fieldTypeName ft)})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})) rt) (Core.rowTypeFields rt)))}]}))}}))})))++-- | Generate an encoder for a set type+encodeSetType :: (Core.Type -> Core.Term)+encodeSetType elemType = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (encodeType elemType)})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))})))++-- | Generate an encoder term for a Type+encodeType :: (Core.Type -> Core.Term)+encodeType x = case x of+ Core.TypeAnnotated v1 -> (encodeType (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> (Core.TermApplication (Core.Application {+ Core.applicationFunction = (encodeType (Core.applicationTypeFunction v1)),+ Core.applicationArgument = (encodeType (Core.applicationTypeArgument v1))}))+ Core.TypeEither v1 -> (encodeEitherType v1)+ Core.TypeForall v1 -> (encodeForallType v1)+ Core.TypeFunction _ -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))+ Core.TypeList v1 -> (encodeListType v1)+ Core.TypeLiteral v1 -> (encodeLiteralType v1)+ Core.TypeMap v1 -> (encodeMapType v1)+ Core.TypeMaybe v1 -> (encodeOptionalType v1)+ Core.TypePair v1 -> (encodePairType v1)+ Core.TypeRecord v1 -> (encodeRecordType v1)+ Core.TypeSet v1 -> (encodeSetType v1)+ Core.TypeUnion v1 -> (encodeUnionType v1)+ Core.TypeWrap v1 -> (encodeWrappedType v1)+ Core.TypeUnit -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))})))+ Core.TypeVariable v1 -> (Core.TermVariable (encodeBindingName v1))+ _ -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))++-- | Generate an encoder for a union type+encodeUnionType :: (Core.RowType -> Core.Term)+encodeUnionType rt = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.rowTypeTypeName rt),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = (Lists.map (\ft -> Core.Field {+ Core.fieldName = (Core.fieldTypeName ft),+ Core.fieldTerm = (encodeFieldValue (Core.rowTypeTypeName rt) (Core.fieldTypeName ft) (Core.fieldTypeType ft))}) (Core.rowTypeFields rt))}))))++-- | Generate an encoder for a wrapped type+encodeWrappedType :: (Core.WrappedType -> Core.Term)+encodeWrappedType wt = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (encodeName (Core.wrappedTypeTypeName wt))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (encodeType (Core.wrappedTypeBody wt)),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.wrappedTypeTypeName wt)))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))++-- | Filter bindings to only encodable type definitions+filterTypeBindings :: ([Core.Binding] -> Compute.Flow Graph.Graph [Core.Binding])+filterTypeBindings bindings = (Flows.map Maybes.cat (Flows.mapList isEncodableBinding (Lists.filter Annotations.isNativeType bindings)))++-- | Check if a binding is encodable (serializable type)+isEncodableBinding :: (Core.Binding -> Compute.Flow Graph.Graph (Maybe Core.Binding))+isEncodableBinding b = (Flows.map (\serializable -> Logic.ifElse serializable (Just b) Nothing) (Schemas.isSerializableByName (Core.bindingName b)))++-- | Check whether a type is the unit type+isUnitType :: (Core.Type -> Bool)+isUnitType x = case x of+ Core.TypeUnit -> True+ _ -> False
+ src/gen-main/haskell/Hydra/Eval/Lib/Eithers.hs view
@@ -0,0 +1,112 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Either functions for the Hydra interpreter.++module Hydra.Eval.Lib.Eithers where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Monads as Monads+import qualified Hydra.Show.Core as Core__+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly bind for Either terms.+bind :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bind eitherTerm funTerm = ((\x -> case x of+ Core.TermEither v1 -> (Flows.pure (Eithers.either (\val -> Core.TermEither (Left val)) (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val})) v1))+ _ -> (Monads.unexpected "either value" (Core__.term eitherTerm))) eitherTerm)++-- | Interpreter-friendly bimap for Either terms.+bimap :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bimap leftFun rightFun eitherTerm = ((\x -> case x of+ Core.TermEither v1 -> (Flows.pure (Eithers.either (\val -> Core.TermEither (Left (Core.TermApplication (Core.Application {+ Core.applicationFunction = leftFun,+ Core.applicationArgument = val})))) (\val -> Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = rightFun,+ Core.applicationArgument = val})))) v1))+ _ -> (Monads.unexpected "either value" (Core__.term eitherTerm))) eitherTerm)++-- | Interpreter-friendly case analysis for Either terms.+either :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+either leftFun rightFun eitherTerm = ((\x -> case x of+ Core.TermEither v1 -> (Flows.pure (Eithers.either (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = leftFun,+ Core.applicationArgument = val})) (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = rightFun,+ Core.applicationArgument = val})) v1))+ _ -> (Monads.unexpected "either value" (Core__.term eitherTerm))) eitherTerm)++-- | Interpreter-friendly map for Either terms.+map :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+map rightFun eitherTerm = ((\x -> case x of+ Core.TermEither v1 -> (Flows.pure (Eithers.either (\val -> Core.TermEither (Left val)) (\val -> Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = rightFun,+ Core.applicationArgument = val})))) v1))+ _ -> (Monads.unexpected "either value" (Core__.term eitherTerm))) eitherTerm)++-- | Interpreter-friendly mapList for Either (traverse).+mapList :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+mapList funTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Lists.foldl (\acc -> \el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "err"))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "accErr"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "accErr"))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ys"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "ys"))}))))})))})),+ Core.applicationArgument = acc}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el}))})) (Core.TermEither (Right (Core.TermList []))) (Lists.reverse elements))))++-- | Interpreter-friendly mapMaybe for Either (traverse over Maybe).+mapMaybe :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+mapMaybe funTerm maybeTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Maybes.maybe (Core.TermEither (Right (Core.TermMaybe Nothing))) (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "err"))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermMaybe (Just (Core.TermVariable (Core.Name "y"))))))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val}))})) v1))+ _ -> (Monads.unexpected "maybe value" (Core__.term maybeTerm))) maybeTerm)
+ src/gen-main/haskell/Hydra/Eval/Lib/Flows.hs view
@@ -0,0 +1,377 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Flow functions for the Hydra interpreter.++module Hydra.Eval.Lib.Flows where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Monads as Monads+import qualified Hydra.Show.Core as Core__+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly applicative apply for Flow.+apply :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+apply flowFun flowArg = (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.bind"))),+ Core.applicationArgument = flowFun})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.bind"))),+ Core.applicationArgument = flowArg})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))})))})))++-- | Interpreter-friendly monadic bind for Flow.+bind :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bind flowTerm funTerm = ((\x -> case x of+ Core.TermWrap v1 -> + let innerFun = (Core.wrappedTermBody v1)+ in (Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.compute.Flow"),+ Core.wrappedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe Nothing)},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "state")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "trace")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}]}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "state")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "trace")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "value")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}))})))})))})))+ _ -> (Monads.unexpected "flow term" (Core__.term flowTerm))) flowTerm)++-- | Interpreter-friendly foldl for Flow.+foldl :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+foldl funTerm initTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Lists.foldl (\acc -> \el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.bind"))),+ Core.applicationArgument = acc})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "accVal"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = (Core.TermVariable (Core.Name "accVal"))})),+ Core.applicationArgument = el}))})))})) (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.pure"))),+ Core.applicationArgument = initTerm})) elements)))++-- | Interpreter-friendly functor map for Flow.+map :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+map funTerm flowTerm = ((\x -> case x of+ Core.TermWrap v1 -> + let innerFun = (Core.wrappedTermBody v1)+ in (Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.compute.Flow"),+ Core.wrappedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "value")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "state")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "trace")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}]}))})))})))})))+ _ -> (Monads.unexpected "flow term" (Core__.term flowTerm))) flowTerm)++-- | Interpreter-friendly mapElems for Map with Flow.+mapElems :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+mapElems funTerm mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.sequence"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v'"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (k, (Core.TermVariable (Core.Name "v'"))))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = v}))}))) pairs))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "newPairs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "newPairs"))}))}))})))})))+ _ -> (Monads.unexpected "map value" (Core__.term mapTerm))) mapTerm)++-- | Interpreter-friendly mapKeys for Map with Flow.+mapKeys :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+mapKeys funTerm mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.sequence"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k'"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "k'"), v))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = k}))}))) pairs))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "newPairs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "newPairs"))}))}))})))})))+ _ -> (Monads.unexpected "map value" (Core__.term mapTerm))) mapTerm)++-- | Interpreter-friendly mapList for List with Flow.+mapList :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+mapList funTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.sequence"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el})) elements))}))))++-- | Interpreter-friendly mapMaybe for Maybe with Flow.+mapMaybe :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+mapMaybe funTerm maybeTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.isNothing"))),+ Core.applicationArgument = (Core.TermMaybe v1)}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.pure"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.fromJust"))),+ Core.applicationArgument = (Core.TermMaybe v1)}))}))}))})))})),+ Core.applicationArgument = Core.TermUnit})))+ _ -> (Monads.unexpected "optional value" (Core__.term maybeTerm))) maybeTerm)++-- | Interpreter-friendly mapSet for Set with Flow.+mapSet :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+mapSet funTerm setTerm = (Flows.bind (Core_.set setTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.sequence"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el})) (Sets.toList elements)))}))}))))++-- | Interpreter-friendly withDefault for Flow.+withDefault :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+withDefault fallbackTerm flowTerm = ((\x -> case x of+ Core.TermWrap v1 -> + let innerFun = (Core.wrappedTermBody v1)+ in (Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.compute.Flow"),+ Core.wrappedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just fallbackTerm))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "s"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}]}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "value")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = innerFun,+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))}))})))})))})))+ _ -> (Monads.unexpected "flow term" (Core__.term flowTerm))) flowTerm)
+ src/gen-main/haskell/Hydra/Eval/Lib/Lists.hs view
@@ -0,0 +1,218 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of List functions for the Hydra interpreter.++module Hydra.Eval.Lib.Lists where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Pairs as Pairs+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly applicative apply for List terms.+apply :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+apply funsTerm argsTerm = (Flows.bind (Core_.list funsTerm) (\funs -> Flows.bind (Core_.list argsTerm) (\arguments -> + let applyOne = (\f -> Lists.map (\arg -> Core.TermApplication (Core.Application {+ Core.applicationFunction = f,+ Core.applicationArgument = arg})) arguments)+ in (Flows.pure (Core.TermList (Lists.concat (Lists.map applyOne funs)))))))++-- | Interpreter-friendly monadic bind for List terms.+bind :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+bind listTerm funTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el})) elements))}))))++-- | Interpreter-friendly dropWhile for List terms.+dropWhile :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+dropWhile predTerm listTerm = (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = predTerm})),+ Core.applicationArgument = listTerm}))})))++-- | Interpreter-friendly filter for List terms.+filter :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+filter predTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = predTerm,+ Core.applicationArgument = el}))})),+ Core.applicationArgument = (Core.TermList (Lists.pure el))})),+ Core.applicationArgument = (Core.TermList [])})) elements))}))))++-- | Interpreter-friendly find for List terms.+find :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+find predTerm listTerm = (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = predTerm})),+ Core.applicationArgument = listTerm}))})))++-- | Interpreter-friendly left fold for List terms.+foldl :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+foldl funTerm initTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Lists.foldl (\acc -> \el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = acc})),+ Core.applicationArgument = el})) initTerm elements)))++-- | Interpreter-friendly map for List terms.+map :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+map funTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Core.TermList (Lists.reverse (Lists.foldl (\acc -> \el -> Lists.cons (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el})) acc) [] elements)))))++-- | Interpreter-friendly partition for List terms.+partition :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+partition predTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> + let initialState = (Core.TermPair (Core.TermList [], (Core.TermList [])))+ in + let finalState = (Lists.foldl (\acc -> \el -> + let yeses = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = acc}))+ in + let nos = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = acc}))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = predTerm,+ Core.applicationArgument = el}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = yeses})),+ Core.applicationArgument = (Core.TermList [+ el])}), nos))})),+ Core.applicationArgument = (Core.TermPair (yeses, (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = nos})),+ Core.applicationArgument = (Core.TermList [+ el])}))))}))) initialState elements)+ in (Flows.pure finalState)))++-- | Interpreter-friendly sortOn for List terms.+sortOn :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+sortOn projTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Lists.foldl (\sorted -> \x -> + let splitResult = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = projTerm,+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = projTerm,+ Core.applicationArgument = x}))}))})))})),+ Core.applicationArgument = sorted}))+ in + let before = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = splitResult}))+ in + let after = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = splitResult}))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = before})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = x})),+ Core.applicationArgument = after}))}))) (Core.TermList []) elements)))++-- | Interpreter-friendly span for List terms.+span :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+span predTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> + let initialState = (Core.TermPair (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermList [])), (Core.TermList [])))+ in + let finalState = (Lists.foldl (\acc -> \el -> + let takingLeft = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = acc}))+ in + let right = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = acc}))+ in + let taking = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = takingLeft}))+ in + let left = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = takingLeft}))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = taking})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = predTerm,+ Core.applicationArgument = el}))}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = left})),+ Core.applicationArgument = (Core.TermList [+ el])}))), right))})),+ Core.applicationArgument = (Core.TermPair (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean False), left), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = right})),+ Core.applicationArgument = (Core.TermList [+ el])}))))}))) initialState elements)+ in (Flows.pure (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = finalState}))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = finalState})))))))++-- | Interpreter-friendly zipWith for List terms.+zipWith :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+zipWith funTerm listTerm1 listTerm2 = (Flows.bind (Core_.list listTerm1) (\elements1 -> Flows.bind (Core_.list listTerm2) (\elements2 -> Flows.pure (Core.TermList (Lists.map (\p -> + let a = (Pairs.first p)+ in + let b = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = a})),+ Core.applicationArgument = b}))) (Lists.zip elements1 elements2))))))
+ src/gen-main/haskell/Hydra/Eval/Lib/Maps.hs view
@@ -0,0 +1,143 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Map functions for the Hydra interpreter.++module Hydra.Eval.Lib.Maps where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Monads as Monads+import qualified Hydra.Show.Core as Core_+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly alter for Map terms.+alter :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+alter funTerm keyTerm mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let currentVal = (Maps.lookup keyTerm v1)+ in + let newVal = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = (Core.TermMaybe currentVal)}))+ in (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.delete"))),+ Core.applicationArgument = keyTerm})),+ Core.applicationArgument = mapTerm}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "newV"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = keyTerm})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "newV"))})),+ Core.applicationArgument = mapTerm}))})))})),+ Core.applicationArgument = newVal})))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)++-- | Interpreter-friendly bimap for Map terms.+bimap :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bimap keyFun valFun mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermMap (Maps.fromList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = keyFun,+ Core.applicationArgument = k}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = valFun,+ Core.applicationArgument = v})))) pairs))))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)++-- | Interpreter-friendly filter for Map terms.+filter :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+filter valPred mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\p -> + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = valPred,+ Core.applicationArgument = v}))})),+ Core.applicationArgument = (Core.TermList (Lists.pure (Core.TermPair (Pairs.first p, v))))})),+ Core.applicationArgument = (Core.TermList [])}))) pairs))}))})))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)++-- | Interpreter-friendly filterWithKey for Map terms.+filterWithKey :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+filterWithKey pred mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = pred,+ Core.applicationArgument = k})),+ Core.applicationArgument = v}))})),+ Core.applicationArgument = (Core.TermList (Lists.pure (Core.TermPair (k, v))))})),+ Core.applicationArgument = (Core.TermList [])}))) pairs))}))})))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)++-- | Interpreter-friendly map for Map terms.+map :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+map valFun mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermMap (Maps.fromList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (k, (Core.TermApplication (Core.Application {+ Core.applicationFunction = valFun,+ Core.applicationArgument = v})))) pairs))))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)++-- | Interpreter-friendly mapKeys for Map terms.+mapKeys :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+mapKeys keyFun mapTerm = ((\x -> case x of+ Core.TermMap v1 -> + let pairs = (Maps.toList v1)+ in (Flows.pure (Core.TermMap (Maps.fromList (Lists.map (\p -> + let k = (Pairs.first p)+ in + let v = (Pairs.second p)+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = keyFun,+ Core.applicationArgument = k}), v)) pairs))))+ _ -> (Monads.unexpected "map value" (Core_.term mapTerm))) mapTerm)
+ src/gen-main/haskell/Hydra/Eval/Lib/Maybes.hs view
@@ -0,0 +1,81 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Maybe functions for the Hydra interpreter.++module Hydra.Eval.Lib.Maybes where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Monads as Monads+import qualified Hydra.Show.Core as Core__+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly applicative apply for Maybe terms.+apply :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+apply funOptTerm argOptTerm = ((\x -> case x of+ Core.TermMaybe v1 -> ((\x -> case x of+ Core.TermMaybe v2 -> (Flows.pure (Core.TermMaybe (Maybes.bind v1 (\f -> Maybes.map (\x -> Core.TermApplication (Core.Application {+ Core.applicationFunction = f,+ Core.applicationArgument = x})) v2))))+ _ -> (Monads.unexpected "optional value" (Core__.term argOptTerm))) argOptTerm)+ _ -> (Monads.unexpected "optional function" (Core__.term funOptTerm))) funOptTerm)++-- | Interpreter-friendly monadic bind for Maybe terms.+bind :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bind optTerm funTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Maybes.maybe (Core.TermMaybe Nothing) (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val})) v1))+ _ -> (Monads.unexpected "optional value" (Core__.term optTerm))) optTerm)++-- | Interpreter-friendly case analysis for Maybe terms (cases argument order).+cases :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+cases optTerm defaultTerm funTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Maybes.maybe defaultTerm (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val})) v1))+ _ -> (Monads.unexpected "optional value" (Core__.term optTerm))) optTerm)++-- | Interpreter-friendly Kleisli composition for Maybe.+compose :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+compose funF funG xTerm = (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = funF,+ Core.applicationArgument = xTerm}))})),+ Core.applicationArgument = funG})))++-- | Interpreter-friendly map for Maybe terms.+map :: (Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+map funTerm optTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Core.TermMaybe (Maybes.map (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val})) v1)))+ _ -> (Monads.unexpected "optional value" (Core__.term optTerm))) optTerm)++-- | Interpreter-friendly mapMaybe for List terms.+mapMaybe :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+mapMaybe funTerm listTerm = (Flows.bind (Core_.list listTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cat"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = el})) elements))}))))++-- | Interpreter-friendly case analysis for Maybe terms.+maybe :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+maybe defaultTerm funTerm optTerm = ((\x -> case x of+ Core.TermMaybe v1 -> (Flows.pure (Maybes.maybe defaultTerm (\val -> Core.TermApplication (Core.Application {+ Core.applicationFunction = funTerm,+ Core.applicationArgument = val})) v1))+ _ -> (Monads.unexpected "optional value" (Core__.term optTerm))) optTerm)
+ src/gen-main/haskell/Hydra/Eval/Lib/Pairs.hs view
@@ -0,0 +1,32 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Pair functions for the Hydra interpreter.++module Hydra.Eval.Lib.Pairs where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Monads as Monads+import qualified Hydra.Show.Core as Core_+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly bimap for Pair terms.+bimap :: (Core.Term -> Core.Term -> Core.Term -> Compute.Flow t0 Core.Term)+bimap firstFun secondFun pairTerm = ((\x -> case x of+ Core.TermPair v1 -> + let fst = (Pairs.first v1)+ in + let snd = (Pairs.second v1)+ in (Flows.pure (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = firstFun,+ Core.applicationArgument = fst}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = secondFun,+ Core.applicationArgument = snd})))))+ _ -> (Monads.unexpected "pair value" (Core_.term pairTerm))) pairTerm)
+ src/gen-main/haskell/Hydra/Eval/Lib/Sets.hs view
@@ -0,0 +1,27 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Evaluation-level implementations of Set functions for the Hydra interpreter.++module Hydra.Eval.Lib.Sets where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Sets as Sets+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Interpreter-friendly map for Set terms.+map :: (Core.Term -> Core.Term -> Compute.Flow Graph.Graph Core.Term)+map fun setTerm = (Flows.bind (Core_.set setTerm) (\elements -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList (Lists.map (\el -> Core.TermApplication (Core.Application {+ Core.applicationFunction = fun,+ Core.applicationArgument = el})) (Sets.toList elements)))}))))
src/gen-main/haskell/Hydra/Ext/Haskell/Ast.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A Haskell syntax model, loosely based on Language.Haskell.Tools.AST module Hydra.Ext.Haskell.Ast where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -12,8 +15,11 @@ -- | A pattern-matching alternative data Alternative = Alternative {+ -- | The pattern to match alternativePattern :: Pattern,+ -- | The right-hand side of the alternative alternativeRhs :: CaseRhs,+ -- | Optional local bindings alternativeBinds :: (Maybe LocalBindings)} deriving (Eq, Ord, Read, Show) @@ -27,7 +33,9 @@ -- | A type assertion data Assertion = + -- | A class assertion AssertionClass ClassAssertion |+ -- | A tuple of assertions AssertionTuple [Assertion] deriving (Eq, Ord, Read, Show) @@ -37,9 +45,12 @@ _Assertion_tuple = (Core.Name "tuple") +-- | A class assertion data ClassAssertion = ClassAssertion {+ -- | The name of the class classAssertionName :: Name,+ -- | The types to which the class is applied classAssertionTypes :: [Type]} deriving (Eq, Ord, Read, Show) @@ -59,7 +70,9 @@ -- | A data constructor data Constructor = + -- | An ordinary (positional) constructor ConstructorOrdinary OrdinaryConstructor |+ -- | A record constructor ConstructorRecord RecordConstructor deriving (Eq, Ord, Read, Show) @@ -72,7 +85,9 @@ -- | An ordinary (positional) data constructor data OrdinaryConstructor = OrdinaryConstructor {+ -- | The name of the constructor ordinaryConstructorName :: Name,+ -- | The types of the positional fields ordinaryConstructorFields :: [Type]} deriving (Eq, Ord, Read, Show) @@ -85,7 +100,9 @@ -- | A record-style data constructor data RecordConstructor = RecordConstructor {+ -- | The name of the constructor recordConstructorName :: Name,+ -- | The named fields of the record recordConstructorFields :: [FieldWithComments]} deriving (Eq, Ord, Read, Show) @@ -98,7 +115,9 @@ -- | A data constructor together with any comments data ConstructorWithComments = ConstructorWithComments {+ -- | The constructor constructorWithCommentsBody :: Constructor,+ -- | Optional comments constructorWithCommentsComments :: (Maybe String)} deriving (Eq, Ord, Read, Show) @@ -111,10 +130,15 @@ -- | A data type declaration data DataDeclaration = DataDeclaration {+ -- | The 'data' or 'newtype' keyword dataDeclarationKeyword :: DataOrNewtype,+ -- | Type class constraints dataDeclarationContext :: [Assertion],+ -- | The declaration head dataDeclarationHead :: DeclarationHead,+ -- | The data constructors dataDeclarationConstructors :: [ConstructorWithComments],+ -- | Derived type class instances dataDeclarationDeriving :: [Deriving]} deriving (Eq, Ord, Read, Show) @@ -145,7 +169,9 @@ -- | A data declaration together with any comments data DeclarationWithComments = DeclarationWithComments {+ -- | The declaration declarationWithCommentsBody :: Declaration,+ -- | Optional comments declarationWithCommentsComments :: (Maybe String)} deriving (Eq, Ord, Read, Show) @@ -157,9 +183,13 @@ -- | A data or value declaration data Declaration = + -- | A data type declaration DeclarationData DataDeclaration |+ -- | A type synonym declaration DeclarationType TypeDeclaration |+ -- | A value binding DeclarationValueBinding ValueBinding |+ -- | A typed binding DeclarationTypedBinding TypedBinding deriving (Eq, Ord, Read, Show) @@ -175,8 +205,11 @@ -- | The left-hand side of a declaration data DeclarationHead = + -- | An application-style declaration head DeclarationHeadApplication ApplicationDeclarationHead |+ -- | A parenthesized declaration head DeclarationHeadParens DeclarationHead |+ -- | A simple name DeclarationHeadSimple Name deriving (Eq, Ord, Read, Show) @@ -191,7 +224,9 @@ -- | An application-style declaration head data ApplicationDeclarationHead = ApplicationDeclarationHead {+ -- | The function being applied applicationDeclarationHeadFunction :: DeclarationHead,+ -- | The type variable operand applicationDeclarationHeadOperand :: Variable} deriving (Eq, Ord, Read, Show) @@ -211,7 +246,9 @@ -- | An export statement data Export = + -- | An exported declaration ExportDeclaration ImportExportSpec |+ -- | An exported module ExportModule ModuleName deriving (Eq, Ord, Read, Show) @@ -223,23 +260,41 @@ -- | A data expression data Expression = + -- | A function application ExpressionApplication ApplicationExpression |+ -- | A case expression ExpressionCase CaseExpression |+ -- | A record constructor expression ExpressionConstructRecord ConstructRecordExpression |+ -- | A 'do' expression ExpressionDo [Statement] |+ -- | An 'if' expression ExpressionIf IfExpression |+ -- | An infix application ExpressionInfixApplication InfixApplicationExpression |+ -- | A literal value ExpressionLiteral Literal |+ -- | A lambda expression ExpressionLambda LambdaExpression |+ -- | A left section expression ExpressionLeftSection SectionExpression |+ -- | A 'let' expression ExpressionLet LetExpression |+ -- | A list expression ExpressionList [Expression] |+ -- | A parenthesized expression ExpressionParens Expression |+ -- | A prefix application ExpressionPrefixApplication PrefixApplicationExpression |+ -- | A right section expression ExpressionRightSection SectionExpression |+ -- | A tuple expression ExpressionTuple [Expression] |+ -- | A type signature expression ExpressionTypeSignature TypeSignatureExpression |+ -- | A record update expression ExpressionUpdateRecord UpdateRecordExpression |+ -- | A variable reference ExpressionVariable Name deriving (Eq, Ord, Read, Show) @@ -284,7 +339,9 @@ -- | An application expression data ApplicationExpression = ApplicationExpression {+ -- | The function being applied applicationExpressionFunction :: Expression,+ -- | The argument applicationExpressionArgument :: Expression} deriving (Eq, Ord, Read, Show) @@ -297,7 +354,9 @@ -- | A case expression data CaseExpression = CaseExpression {+ -- | The expression being matched caseExpressionCase :: Expression,+ -- | The pattern-matching alternatives caseExpressionAlternatives :: [Alternative]} deriving (Eq, Ord, Read, Show) @@ -310,7 +369,9 @@ -- | A record constructor expression data ConstructRecordExpression = ConstructRecordExpression {+ -- | The constructor name constructRecordExpressionName :: Name,+ -- | The field assignments constructRecordExpressionFields :: [FieldUpdate]} deriving (Eq, Ord, Read, Show) @@ -323,8 +384,11 @@ -- | An 'if' expression data IfExpression = IfExpression {+ -- | The condition expression ifExpressionCondition :: Expression,+ -- | The 'then' branch ifExpressionThen :: Expression,+ -- | The 'else' branch ifExpressionElse :: Expression} deriving (Eq, Ord, Read, Show) @@ -339,8 +403,11 @@ -- | An infix application expression data InfixApplicationExpression = InfixApplicationExpression {+ -- | The left-hand operand infixApplicationExpressionLhs :: Expression,+ -- | The infix operator infixApplicationExpressionOperator :: Operator,+ -- | The right-hand operand infixApplicationExpressionRhs :: Expression} deriving (Eq, Ord, Read, Show) @@ -355,7 +422,9 @@ -- | A lambda expression data LambdaExpression = LambdaExpression {+ -- | The patterns binding parameters lambdaExpressionBindings :: [Pattern],+ -- | The body of the lambda lambdaExpressionInner :: Expression} deriving (Eq, Ord, Read, Show) @@ -368,7 +437,9 @@ -- | A 'let' expression data LetExpression = LetExpression {+ -- | The local bindings letExpressionBindings :: [LocalBinding],+ -- | The body of the let expression letExpressionInner :: Expression} deriving (Eq, Ord, Read, Show) @@ -381,7 +452,9 @@ -- | A prefix expression data PrefixApplicationExpression = PrefixApplicationExpression {+ -- | The prefix operator prefixApplicationExpressionOperator :: Operator,+ -- | The operand prefixApplicationExpressionRhs :: Expression} deriving (Eq, Ord, Read, Show) @@ -394,7 +467,9 @@ -- | A section expression data SectionExpression = SectionExpression {+ -- | The operator sectionExpressionOperator :: Operator,+ -- | The operand sectionExpressionExpression :: Expression} deriving (Eq, Ord, Read, Show) @@ -407,7 +482,9 @@ -- | A type signature expression data TypeSignatureExpression = TypeSignatureExpression {+ -- | The expression being typed typeSignatureExpressionInner :: Expression,+ -- | The type signature typeSignatureExpressionType :: Type} deriving (Eq, Ord, Read, Show) @@ -420,7 +497,9 @@ -- | An update record expression data UpdateRecordExpression = UpdateRecordExpression {+ -- | The record being updated updateRecordExpressionInner :: Expression,+ -- | The field updates updateRecordExpressionFields :: [FieldUpdate]} deriving (Eq, Ord, Read, Show) @@ -433,7 +512,9 @@ -- | A field (name/type pair) data Field = Field {+ -- | The field name fieldName :: Name,+ -- | The field type fieldType :: Type} deriving (Eq, Ord, Read, Show) @@ -446,7 +527,9 @@ -- | A field together with any comments data FieldWithComments = FieldWithComments {+ -- | The field fieldWithCommentsField :: Field,+ -- | Optional comments fieldWithCommentsComments :: (Maybe String)} deriving (Eq, Ord, Read, Show) @@ -459,7 +542,9 @@ -- | A field name and value data FieldUpdate = FieldUpdate {+ -- | The field name fieldUpdateName :: Name,+ -- | The field value fieldUpdateValue :: Expression} deriving (Eq, Ord, Read, Show) @@ -472,9 +557,13 @@ -- | An import statement data Import = Import {+ -- | Whether the import is qualified importQualified :: Bool,+ -- | The module being imported importModule :: ModuleName,+ -- | Optional alias for the module importAs :: (Maybe ModuleName),+ -- | Optional import specification importSpec :: (Maybe SpecImport)} deriving (Eq, Ord, Read, Show) @@ -490,7 +579,9 @@ -- | An import specification data SpecImport = + -- | A list of imports to include SpecImportList [ImportExportSpec] |+ -- | A list of imports to exclude SpecImportHiding [ImportExportSpec] deriving (Eq, Ord, Read, Show) @@ -515,8 +606,11 @@ -- | An import or export specification data ImportExportSpec = ImportExportSpec {+ -- | Optional import modifier importExportSpecModifier :: (Maybe ImportModifier),+ -- | The name being imported or exported importExportSpecName :: Name,+ -- | Optional subspecification importExportSpecSubspec :: (Maybe SubspecImportExportSpec)} deriving (Eq, Ord, Read, Show) @@ -528,8 +622,11 @@ _ImportExportSpec_subspec = (Core.Name "subspec") +-- | A subspecification within an import/export data SubspecImportExportSpec = + -- | Import/export all SubspecImportExportSpecAll |+ -- | Import/export specific names SubspecImportExportSpecList [Name] deriving (Eq, Ord, Read, Show) @@ -541,11 +638,17 @@ -- | A literal value data Literal = + -- | A character literal LiteralChar Int |+ -- | A double-precision floating point literal LiteralDouble Double |+ -- | A single-precision floating point literal LiteralFloat Float |+ -- | A 32-bit integer literal LiteralInt Int |+ -- | An arbitrary-precision integer literal LiteralInteger Integer |+ -- | A string literal LiteralString String deriving (Eq, Ord, Read, Show) @@ -563,8 +666,11 @@ _Literal_string = (Core.Name "string") +-- | A local binding data LocalBinding = + -- | A type signature LocalBindingSignature TypeSignature |+ -- | A value binding LocalBindingValue ValueBinding deriving (Eq, Ord, Read, Show) @@ -574,6 +680,7 @@ _LocalBinding_value = (Core.Name "value") +-- | A collection of local bindings newtype LocalBindings = LocalBindings { unLocalBindings :: [LocalBinding]}@@ -581,10 +688,14 @@ _LocalBindings = (Core.Name "hydra.ext.haskell.ast.LocalBindings") +-- | A Haskell module data Module = Module {+ -- | Optional module head moduleHead :: (Maybe ModuleHead),+ -- | Import statements moduleImports :: [Import],+ -- | Module declarations moduleDeclarations :: [DeclarationWithComments]} deriving (Eq, Ord, Read, Show) @@ -596,10 +707,14 @@ _Module_declarations = (Core.Name "declarations") +-- | A module head data ModuleHead = ModuleHead {+ -- | Optional module-level comments moduleHeadComments :: (Maybe String),+ -- | The module name moduleHeadName :: ModuleName,+ -- | Export list moduleHeadExports :: [Export]} deriving (Eq, Ord, Read, Show) @@ -611,6 +726,7 @@ _ModuleHead_exports = (Core.Name "exports") +-- | A module name newtype ModuleName = ModuleName { unModuleName :: String}@@ -618,9 +734,13 @@ _ModuleName = (Core.Name "hydra.ext.haskell.ast.ModuleName") +-- | A name data Name = + -- | An implicit name NameImplicit QualifiedName |+ -- | A normal name NameNormal QualifiedName |+ -- | A parenthesized name NameParens QualifiedName deriving (Eq, Ord, Read, Show) @@ -632,6 +752,7 @@ _Name_parens = (Core.Name "parens") +-- | A component of a qualified name newtype NamePart = NamePart { unNamePart :: String}@@ -639,8 +760,11 @@ _NamePart = (Core.Name "hydra.ext.haskell.ast.NamePart") +-- | An operator data Operator = + -- | A function used as an infix operator OperatorBacktick QualifiedName |+ -- | A normal infix operator OperatorNormal QualifiedName deriving (Eq, Ord, Read, Show) @@ -650,16 +774,27 @@ _Operator_normal = (Core.Name "normal") +-- | A pattern data Pattern = + -- | An application pattern PatternApplication ApplicationPattern |+ -- | An 'as' pattern PatternAs AsPattern |+ -- | A list pattern PatternList [Pattern] |+ -- | A literal pattern PatternLiteral Literal |+ -- | A name pattern PatternName Name |+ -- | A parenthesized pattern PatternParens Pattern |+ -- | A record pattern PatternRecord RecordPattern |+ -- | A tuple pattern PatternTuple [Pattern] |+ -- | A typed pattern PatternTyped TypedPattern |+ -- | A wildcard pattern PatternWildcard deriving (Eq, Ord, Read, Show) @@ -685,9 +820,12 @@ _Pattern_wildcard = (Core.Name "wildcard") +-- | An application pattern data ApplicationPattern = ApplicationPattern {+ -- | The constructor name applicationPatternName :: Name,+ -- | The pattern arguments applicationPatternArgs :: [Pattern]} deriving (Eq, Ord, Read, Show) @@ -697,9 +835,12 @@ _ApplicationPattern_args = (Core.Name "args") +-- | An 'as' pattern data AsPattern = AsPattern {+ -- | The bound name asPatternName :: Name,+ -- | The inner pattern asPatternInner :: Pattern} deriving (Eq, Ord, Read, Show) @@ -709,9 +850,12 @@ _AsPattern_inner = (Core.Name "inner") +-- | A record pattern data RecordPattern = RecordPattern {+ -- | The constructor name recordPatternName :: Name,+ -- | The field patterns recordPatternFields :: [PatternField]} deriving (Eq, Ord, Read, Show) @@ -721,9 +865,12 @@ _RecordPattern_fields = (Core.Name "fields") +-- | A typed pattern data TypedPattern = TypedPattern {+ -- | The inner pattern typedPatternInner :: Pattern,+ -- | The type annotation typedPatternType :: Type} deriving (Eq, Ord, Read, Show) @@ -733,9 +880,12 @@ _TypedPattern_type = (Core.Name "type") +-- | A pattern field data PatternField = PatternField {+ -- | The field name patternFieldName :: Name,+ -- | The field pattern patternFieldPattern :: Pattern} deriving (Eq, Ord, Read, Show) @@ -745,9 +895,12 @@ _PatternField_pattern = (Core.Name "pattern") +-- | A qualified name data QualifiedName = QualifiedName {+ -- | The qualifier parts qualifiedNameQualifiers :: [NamePart],+ -- | The unqualified name part qualifiedNameUnqualified :: NamePart} deriving (Eq, Ord, Read, Show) @@ -757,6 +910,7 @@ _QualifiedName_unqualified = (Core.Name "unqualified") +-- | A right-hand side of a binding newtype RightHandSide = RightHandSide { unRightHandSide :: Expression}@@ -764,6 +918,7 @@ _RightHandSide = (Core.Name "hydra.ext.haskell.ast.RightHandSide") +-- | A do-notation statement newtype Statement = Statement { unStatement :: Expression}@@ -771,14 +926,23 @@ _Statement = (Core.Name "hydra.ext.haskell.ast.Statement") +-- | A type expression data Type = + -- | An application type TypeApplication ApplicationType |+ -- | A context type TypeCtx ContextType |+ -- | A function type TypeFunction FunctionType |+ -- | An infix type TypeInfix InfixType |+ -- | A list type TypeList Type |+ -- | A parenthesized type TypeParens Type |+ -- | A tuple type TypeTuple [Type] |+ -- | A type variable or type name TypeVariable Name deriving (Eq, Ord, Read, Show) @@ -800,9 +964,12 @@ _Type_variable = (Core.Name "variable") +-- | An application type data ApplicationType = ApplicationType {+ -- | The type being applied applicationTypeContext :: Type,+ -- | The type argument applicationTypeArgument :: Type} deriving (Eq, Ord, Read, Show) @@ -812,9 +979,12 @@ _ApplicationType_argument = (Core.Name "argument") +-- | A type with a context (type class constraints) data ContextType = ContextType {+ -- | The type class context contextTypeCtx :: Assertion,+ -- | The constrained type contextTypeType :: Type} deriving (Eq, Ord, Read, Show) @@ -824,9 +994,12 @@ _ContextType_type = (Core.Name "type") +-- | A function type data FunctionType = FunctionType {+ -- | The domain type functionTypeDomain :: Type,+ -- | The codomain type functionTypeCodomain :: Type} deriving (Eq, Ord, Read, Show) @@ -836,10 +1009,14 @@ _FunctionType_codomain = (Core.Name "codomain") +-- | An infix type application data InfixType = InfixType {+ -- | The left-hand type infixTypeLhs :: Type,+ -- | The type operator infixTypeOperator :: Operator,+ -- | The right-hand operator infixTypeRhs :: Operator} deriving (Eq, Ord, Read, Show) @@ -851,9 +1028,12 @@ _InfixType_rhs = (Core.Name "rhs") +-- | A type synonym declaration data TypeDeclaration = TypeDeclaration {+ -- | The declaration head typeDeclarationName :: DeclarationHead,+ -- | The type being defined typeDeclarationType :: Type} deriving (Eq, Ord, Read, Show) @@ -863,9 +1043,12 @@ _TypeDeclaration_type = (Core.Name "type") +-- | A type signature data TypeSignature = TypeSignature {+ -- | The name being typed typeSignatureName :: Name,+ -- | The type typeSignatureType :: Type} deriving (Eq, Ord, Read, Show) @@ -875,9 +1058,12 @@ _TypeSignature_type = (Core.Name "type") +-- | A binding with its type signature data TypedBinding = TypedBinding {+ -- | The type signature typedBindingTypeSignature :: TypeSignature,+ -- | The value binding typedBindingValueBinding :: ValueBinding} deriving (Eq, Ord, Read, Show) @@ -887,7 +1073,9 @@ _TypedBinding_valueBinding = (Core.Name "valueBinding") +-- | A value binding data ValueBinding = + -- | A simple value binding ValueBindingSimple SimpleValueBinding deriving (Eq, Ord, Read, Show) @@ -895,10 +1083,14 @@ _ValueBinding_simple = (Core.Name "simple") +-- | A simple value binding data SimpleValueBinding = SimpleValueBinding {+ -- | The pattern being bound simpleValueBindingPattern :: Pattern,+ -- | The right-hand side simpleValueBindingRhs :: RightHandSide,+ -- | Optional local bindings (where clause) simpleValueBindingLocalBindings :: (Maybe LocalBindings)} deriving (Eq, Ord, Read, Show) @@ -910,6 +1102,7 @@ _SimpleValueBinding_localBindings = (Core.Name "localBindings") +-- | A type variable newtype Variable = Variable { unVariable :: Name}
src/gen-main/haskell/Hydra/Ext/Haskell/Coder.hs view
@@ -1,16 +1,17 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Functions for encoding Hydra modules as Haskell modules module Hydra.Ext.Haskell.Coder where import qualified Hydra.Adapt.Modules as Modules import qualified Hydra.Annotations as Annotations+import qualified Hydra.Classes as Classes import qualified Hydra.Coders as Coders import qualified Hydra.Compute as Compute import qualified Hydra.Constants as Constants import qualified Hydra.Core as Core-import qualified Hydra.Decode.Core as Core_-import qualified Hydra.Decoding as Decoding-import qualified Hydra.Encode.Core as Core__+import qualified Hydra.Encode.Core as Core_ import qualified Hydra.Ext.Haskell.Ast as Ast import qualified Hydra.Ext.Haskell.Language as Language import qualified Hydra.Ext.Haskell.Serde as Serde@@ -18,67 +19,77 @@ import qualified Hydra.Formatting as Formatting import qualified Hydra.Graph as Graph import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Module as Module import qualified Hydra.Monads as Monads import qualified Hydra.Names as Names import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Schemas as Schemas import qualified Hydra.Serialization as Serialization-import qualified Hydra.Show.Core as Core___-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Whether to include type definitions in generated Haskell modules includeTypeDefinitions :: Bool includeTypeDefinitions = False +-- | Whether to use the Hydra core import in generated modules useCoreImport :: Bool useCoreImport = True +-- | The key used to track Haskell variable depth in annotations keyHaskellVar :: Core.Name keyHaskellVar = (Core.Name "haskellVar") +-- | Adapt a Hydra type to Haskell's type system and encode it adaptTypeToHaskellAndEncode :: (Module.Namespaces Ast.ModuleName -> Core.Type -> Compute.Flow Graph.Graph Ast.Type) adaptTypeToHaskellAndEncode namespaces = (Modules.adaptTypeToLanguageAndEncode Language.haskellLanguage (encodeType namespaces)) +-- | Generate a constant name for a field (e.g., '_TypeName_fieldName') constantForFieldName :: (Core.Name -> Core.Name -> String) constantForFieldName tname fname = (Strings.cat [ "_",- Names.localNameOf tname,+ (Names.localNameOf tname), "_", (Core.unName fname)]) +-- | Generate a constant name for a type (e.g., '_TypeName') constantForTypeName :: (Core.Name -> String) constantForTypeName tname = (Strings.cat2 "_" (Names.localNameOf tname)) -constructModule :: (Module.Namespaces Ast.ModuleName -> Module.Module -> M.Map Core.Type (Compute.Coder Graph.Graph t0 Core.Term Ast.Expression) -> [(Core.Binding, Core.TypedTerm)] -> Compute.Flow Graph.Graph Ast.Module)-constructModule namespaces mod coders pairs = +-- | Construct a Haskell module from a Hydra module and its definitions+constructModule :: (Module.Namespaces Ast.ModuleName -> Module.Module -> [Module.Definition] -> Compute.Flow Graph.Graph Ast.Module)+constructModule namespaces mod defs = let h = (\namespace -> Module.unNamespace namespace) - createDeclarations = (\g -> \pair -> - let el = (fst pair) - tt = (snd pair)- term = (Core.typedTermTerm tt)- typ = (Core.typedTermType tt)- in (Logic.ifElse (Annotations.isNativeType el) (toTypeDeclarations namespaces el term) (Flows.bind (toDataDeclaration coders namespaces pair) (\d -> Flows.pure [- d]))))+ createDeclarations = (\g -> \def -> (\x -> case x of+ Module.DefinitionType v1 -> + let name = (Module.typeDefinitionName v1) + typ = (Module.typeDefinitionType v1)+ in (toTypeDeclarationsFrom namespaces name typ)+ Module.DefinitionTerm v1 -> (Flows.bind (toDataDeclaration namespaces v1) (\d -> Flows.pure [+ d]))) def) importName = (\name -> Ast.ModuleName (Strings.intercalate "." (Lists.map Formatting.capitalize (Strings.splitOn "." name)))) imports = (Lists.concat2 domainImports standardImports) domainImports = let toImport = (\pair -> - let namespace = (fst pair) - alias = (snd pair)+ let namespace = (Pairs.first pair) + alias = (Pairs.second pair) name = (h namespace) in Ast.Import { Ast.importQualified = True,@@ -88,31 +99,35 @@ in (Lists.map toImport (Maps.toList (Module.namespacesMapping namespaces))) standardImports = let toImport = (\triple -> - let name = (fst (fst triple)) - malias = (snd (fst triple))- hidden = (snd triple)+ let name = (Pairs.first (Pairs.first triple)) + malias = (Pairs.second (Pairs.first triple))+ hidden = (Pairs.second triple) spec = (Logic.ifElse (Lists.null hidden) Nothing (Just (Ast.SpecImportHiding (Lists.map (\n -> Ast.ImportExportSpec { Ast.importExportSpecModifier = Nothing, Ast.importExportSpecName = (Utils.simpleName n), Ast.importExportSpecSubspec = Nothing}) hidden)))) in Ast.Import {- Ast.importQualified = (Optionals.isJust malias),+ Ast.importQualified = (Maybes.isJust malias), Ast.importModule = (Ast.ModuleName name),- Ast.importAs = (Optionals.map (\x -> Ast.ModuleName x) malias),+ Ast.importAs = (Maybes.map (\x -> Ast.ModuleName x) malias), Ast.importSpec = spec})- in (Lists.map toImport [+ in (Lists.map toImport (Lists.concat2 [ (("Prelude", Nothing), [ "Enum", "Ordering",+ "decodeFloat",+ "encodeFloat", "fail", "map", "pure", "sum"]),+ (("Data.ByteString", (Just "B")), []), (("Data.Int", (Just "I")), []), (("Data.List", (Just "L")), []), (("Data.Map", (Just "M")), []),- (("Data.Set", (Just "S")), [])])- in (Flows.bind Monads.getState (\g -> Flows.bind (Flows.mapList (createDeclarations g) pairs) (\declLists -> + (("Data.Set", (Just "S")), [])] (Logic.ifElse (Schemas.moduleContainsBinaryLiterals mod) [+ (("Hydra.Lib.Literals", (Just "Literals")), [])] [])))+ in (Flows.bind Monads.getState (\g -> Flows.bind (Flows.mapList (createDeclarations g) defs) (\declLists -> let decls = (Lists.concat declLists) mc = (Module.moduleDescription mod) in (Flows.pure (Ast.Module {@@ -123,14 +138,11 @@ Ast.moduleImports = imports, Ast.moduleDeclarations = decls}))))) +-- | Encode a Hydra function as a Haskell expression encodeFunction :: (Module.Namespaces Ast.ModuleName -> Core.Function -> Compute.Flow Graph.Graph Ast.Expression) encodeFunction namespaces fun = ((\x -> case x of Core.FunctionElimination v1 -> ((\x -> case x of- Core.EliminationWrap v2 -> (Flows.pure (Ast.ExpressionVariable (Utils.elementReference namespaces (Names.qname (Optionals.fromJust (Names.namespaceOf v2)) (Utils.newtypeAccessorName v2)))))- Core.EliminationProduct v2 -> - let arity = (Core.tupleProjectionArity v2) - idx = (Core.tupleProjectionIndex v2)- in (Logic.ifElse (Equality.equal arity 2) (Flows.pure (Utils.hsvar (Logic.ifElse (Equality.equal idx 0) "fst" "snd"))) (Flows.fail "Eliminations for tuples of arity > 2 are not supported yet in the Haskell coder"))+ Core.EliminationWrap v2 -> (Flows.pure (Ast.ExpressionVariable (Utils.elementReference namespaces (Names.qname (Maybes.fromJust (Names.namespaceOf v2)) (Utils.newtypeAccessorName v2))))) Core.EliminationRecord v2 -> let dn = (Core.projectionTypeName v2) fname = (Core.projectionField v2)@@ -140,9 +152,9 @@ def = (Core.caseStatementDefault v2) fields = (Core.caseStatementCases v2) caseExpr = (Flows.bind (Lexical.withSchemaContext (Schemas.requireUnionType dn)) (\rt -> - let fieldMap = (Maps.fromList (Lists.map toFieldMapEntry (Core.rowTypeFields rt))) - toFieldMapEntry = (\f -> (Core.fieldTypeName f, f))- in (Flows.bind (Flows.mapList (toAlt fieldMap) fields) (\ecases -> Flows.bind (Optionals.cases def (Flows.pure []) (\d -> Flows.bind (Flows.map (\x -> Ast.CaseRhs x) (encodeTerm namespaces d)) (\cs -> + let toFieldMapEntry = (\f -> (Core.fieldTypeName f, f)) + fieldMap = (Maps.fromList (Lists.map toFieldMapEntry (Core.rowTypeFields rt)))+ in (Flows.bind (Flows.mapList (toAlt fieldMap) fields) (\ecases -> Flows.bind (Maybes.cases def (Flows.pure []) (\d -> Flows.bind (Flows.map (\x -> Ast.CaseRhs x) (encodeTerm namespaces d)) (\cs -> let lhs = (Ast.PatternName (Utils.rawName Constants.ignoredVariable)) alt = Ast.Alternative { Ast.alternativePattern = lhs,@@ -162,24 +174,25 @@ Core.applicationArgument = (Core.TermVariable (Core.Name v0))})) rhsTerm = (Rewriting.simplifyTerm raw) v1 = (Logic.ifElse (Rewriting.isFreeVariableInTerm (Core.Name v0) rhsTerm) Constants.ignoredVariable v0)- hname = (Utils.unionFieldReference namespaces dn fn)- in (Flows.bind (Optionals.cases (Maps.lookup fn fieldMap) (Flows.fail (Strings.cat [- "field ",- Literals.showString (Core.unName fn),- " not found in ",- (Literals.showString (Core.unName dn))])) (\fieldType -> - let ft = (Core.fieldTypeType fieldType) - noArgs = (Flows.pure [])- singleArg = (Flows.pure [- Ast.PatternName (Utils.rawName v1)])- in ((\x -> case x of- Core.TypeUnit -> noArgs- _ -> singleArg) (Rewriting.deannotateType ft)))) (\args -> - let lhs = (Utils.applicationPattern hname args)- in (Flows.bind (Flows.map (\x -> Ast.CaseRhs x) (encodeTerm namespaces rhsTerm)) (\rhs -> Flows.pure (Ast.Alternative {- Ast.alternativePattern = lhs,- Ast.alternativeRhs = rhs,- Ast.alternativeBinds = Nothing}))))))))+ in (Flows.bind Monads.getState (\g_ufr -> + let hname = (Utils.unionFieldReference g_ufr namespaces dn fn)+ in (Flows.bind (Maybes.cases (Maps.lookup fn fieldMap) (Flows.fail (Strings.cat [+ "field ",+ (Literals.showString (Core.unName fn)),+ " not found in ",+ (Literals.showString (Core.unName dn))])) (\fieldType -> + let ft = (Core.fieldTypeType fieldType) + noArgs = (Flows.pure [])+ singleArg = (Flows.pure [+ Ast.PatternName (Utils.rawName v1)])+ in ((\x -> case x of+ Core.TypeUnit -> noArgs+ _ -> singleArg) (Rewriting.deannotateType ft)))) (\args -> + let lhs = (Utils.applicationPattern hname args)+ in (Flows.bind (Flows.map (\x -> Ast.CaseRhs x) (encodeTerm namespaces rhsTerm)) (\rhs -> Flows.pure (Ast.Alternative {+ Ast.alternativePattern = lhs,+ Ast.alternativeRhs = rhs,+ Ast.alternativeBinds = Nothing})))))))))) in (Flows.map (Utils.hslambda (Utils.rawName "x")) caseExpr)) v1) Core.FunctionLambda v1 -> let v = (Core.lambdaParameter v1) @@ -187,8 +200,10 @@ in (Flows.bind (encodeTerm namespaces body) (\hbody -> Flows.pure (Utils.hslambda (Utils.elementReference namespaces v) hbody))) Core.FunctionPrimitive v1 -> (Flows.pure (Ast.ExpressionVariable (Utils.elementReference namespaces v1)))) fun) +-- | Encode a Hydra literal as a Haskell expression encodeLiteral :: (Core.Literal -> Compute.Flow t0 Ast.Expression) encodeLiteral l = ((\x -> case x of+ Core.LiteralBinary v1 -> (Flows.pure (Utils.hsapp (Utils.hsvar "Literals.stringToBinary") (Utils.hslit (Ast.LiteralString (Literals.binaryToString v1))))) Core.LiteralBoolean v1 -> (Flows.pure (Utils.hsvar (Logic.ifElse v1 "True" "False"))) Core.LiteralFloat v1 -> ((\x -> case x of Core.FloatValueFloat32 v2 -> (Flows.pure (Utils.hslit (Ast.LiteralFloat v2)))@@ -205,85 +220,95 @@ Core.IntegerValueUint32 v2 -> (Flows.pure (Utils.hslit (Ast.LiteralInteger (Literals.uint32ToBigint v2)))) Core.IntegerValueUint64 v2 -> (Flows.pure (Utils.hslit (Ast.LiteralInteger (Literals.uint64ToBigint v2))))) v1) Core.LiteralString v1 -> (Flows.pure (Utils.hslit (Ast.LiteralString v1)))- _ -> (Flows.fail (Strings.cat2 "literal value " (Core___.literal l)))) l)+ _ -> (Flows.fail (Strings.cat2 "literal value " (Core__.literal l)))) l) +-- | Encode a Hydra term as a Haskell expression encodeTerm :: (Module.Namespaces Ast.ModuleName -> Core.Term -> Compute.Flow Graph.Graph Ast.Expression) encodeTerm namespaces term = let encode = (encodeTerm namespaces)- in ((\x -> case x of- Core.TermApplication v1 -> - let fun = (Core.applicationFunction v1) - arg = (Core.applicationArgument v1)- in (Flows.bind (encode fun) (\hfun -> Flows.bind (encode arg) (\harg -> Flows.pure (Utils.hsapp hfun harg))))- Core.TermFunction v1 -> (encodeFunction namespaces v1)- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)- encodeBinding = (\binding -> - let name = (Core.bindingName binding) - term_ = (Core.bindingTerm binding)- hname = (Utils.simpleName (Core.unName name))- in (Flows.bind (encode term_) (\hexpr -> Flows.pure (Ast.LocalBindingValue (Utils.simpleValueBinding hname hexpr Nothing)))))- in (Flows.bind (Flows.mapList encodeBinding bindings) (\hbindings -> Flows.bind (encode env) (\hinner -> Flows.pure (Ast.ExpressionLet (Ast.LetExpression {- Ast.letExpressionBindings = hbindings,- Ast.letExpressionInner = hinner})))))- Core.TermList v1 -> (Flows.bind (Flows.mapList encode v1) (\helems -> Flows.pure (Ast.ExpressionList helems)))- Core.TermLiteral v1 -> (encodeLiteral v1)- Core.TermMap v1 -> - let lhs = (Utils.hsvar "M.fromList") - encodePair = (\pair -> - let k = (fst pair) - v = (snd pair)- hk = (encode k)- hv = (encode v)- in (Flows.map (\x -> Ast.ExpressionTuple x) (Flows.sequence [- hk,- hv])))- in (Flows.bind (Flows.map (\x -> Ast.ExpressionList x) (Flows.mapList encodePair (Maps.toList v1))) (\rhs -> Flows.pure (Utils.hsapp lhs rhs)))- Core.TermOptional v1 -> (Optionals.cases v1 (Flows.pure (Utils.hsvar "Nothing")) (\t -> Flows.bind (encode t) (\ht -> Flows.pure (Utils.hsapp (Utils.hsvar "Just") ht))))- Core.TermProduct v1 -> (Flows.bind (Flows.mapList encode v1) (\hterms -> Flows.pure (Ast.ExpressionTuple hterms)))- Core.TermRecord v1 -> - let sname = (Core.recordTypeName v1) - fields = (Core.recordFields v1)- toFieldUpdate = (\field -> - let fn = (Core.fieldName field) - ft = (Core.fieldTerm field)- fieldRef = (Utils.recordFieldReference namespaces sname fn)- in (Flows.bind (encode ft) (\hft -> Flows.pure (Ast.FieldUpdate {- Ast.fieldUpdateName = fieldRef,- Ast.fieldUpdateValue = hft}))))- typeName = (Utils.elementReference namespaces sname)- in (Flows.bind (Flows.mapList toFieldUpdate fields) (\updates -> Flows.pure (Ast.ExpressionConstructRecord (Ast.ConstructRecordExpression {- Ast.constructRecordExpressionName = typeName,- Ast.constructRecordExpressionFields = updates}))))- Core.TermSet v1 -> - let lhs = (Utils.hsvar "S.fromList")- in (Flows.bind (encodeTerm namespaces (Core.TermList (Sets.toList v1))) (\rhs -> Flows.pure (Utils.hsapp lhs rhs)))- Core.TermTypeLambda v1 -> - let term1 = (Core.typeLambdaBody v1)- in (encode term1)- Core.TermTypeApplication v1 -> - let term1 = (Core.typedTermTerm v1)- in (encode term1)- Core.TermUnion v1 -> - let sname = (Core.injectionTypeName v1) - field = (Core.injectionField v1)- fn = (Core.fieldName field)- ft = (Core.fieldTerm field)- lhs = (Ast.ExpressionVariable (Utils.unionFieldReference namespaces sname fn))- dflt = (Flows.map (Utils.hsapp lhs) (encode ft))+ in + let nonemptyMap = (\m -> + let lhs = (Utils.hsvar "M.fromList") + encodePair = (\pair -> + let k = (Pairs.first pair) + v = (Pairs.second pair)+ hk = (encode k)+ hv = (encode v)+ in (Flows.map (\x -> Ast.ExpressionTuple x) (Flows.sequence [+ hk,+ hv])))+ in (Flows.bind (Flows.map (\x -> Ast.ExpressionList x) (Flows.mapList encodePair (Maps.toList m))) (\rhs -> Flows.pure (Utils.hsapp lhs rhs))))+ in + let nonemptySet = (\s -> + let lhs = (Utils.hsvar "S.fromList")+ in (Flows.bind (encodeTerm namespaces (Core.TermList (Sets.toList s))) (\rhs -> Flows.pure (Utils.hsapp lhs rhs)))) in ((\x -> case x of- Core.TermUnit -> (Flows.pure lhs)- _ -> dflt) (Rewriting.deannotateTerm ft))- Core.TermUnit -> (Flows.pure (Ast.ExpressionTuple []))- Core.TermVariable v1 -> (Flows.pure (Ast.ExpressionVariable (Utils.elementReference namespaces v1)))- Core.TermWrap v1 -> - let tname = (Core.wrappedTermTypeName v1) - term_ = (Core.wrappedTermObject v1)- lhs = (Ast.ExpressionVariable (Utils.elementReference namespaces tname))- in (Flows.bind (encode term_) (\rhs -> Flows.pure (Utils.hsapp lhs rhs)))- _ -> (Flows.fail (Strings.cat2 "unexpected term: " (Core___.term term)))) (Rewriting.deannotateTerm term))+ Core.TermApplication v1 -> + let fun = (Core.applicationFunction v1) + arg = (Core.applicationArgument v1)+ in (Flows.bind (encode fun) (\hfun -> Flows.bind (encode arg) (\harg -> Flows.pure (Utils.hsapp hfun harg))))+ Core.TermEither v1 -> (Eithers.either (\l -> Flows.bind (encode l) (\hl -> Flows.pure (Utils.hsapp (Utils.hsvar "Left") hl))) (\r -> Flows.bind (encode r) (\hr -> Flows.pure (Utils.hsapp (Utils.hsvar "Right") hr))) v1)+ Core.TermFunction v1 -> (encodeFunction namespaces v1)+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1) + env = (Core.letBody v1)+ encodeBinding = (\binding -> + let name = (Core.bindingName binding) + term_ = (Core.bindingTerm binding)+ hname = (Utils.simpleName (Core.unName name))+ in (Flows.bind (encode term_) (\hexpr -> Flows.pure (Ast.LocalBindingValue (Utils.simpleValueBinding hname hexpr Nothing)))))+ in (Flows.bind (Flows.mapList encodeBinding bindings) (\hbindings -> Flows.bind (encode env) (\hinner -> Flows.pure (Ast.ExpressionLet (Ast.LetExpression {+ Ast.letExpressionBindings = hbindings,+ Ast.letExpressionInner = hinner})))))+ Core.TermList v1 -> (Flows.bind (Flows.mapList encode v1) (\helems -> Flows.pure (Ast.ExpressionList helems)))+ Core.TermLiteral v1 -> (encodeLiteral v1)+ Core.TermMap v1 -> (Logic.ifElse (Maps.null v1) (Flows.pure (Utils.hsvar "M.empty")) (nonemptyMap v1))+ Core.TermMaybe v1 -> (Maybes.cases v1 (Flows.pure (Utils.hsvar "Nothing")) (\t -> Flows.bind (encode t) (\ht -> Flows.pure (Utils.hsapp (Utils.hsvar "Just") ht))))+ Core.TermPair v1 -> (Flows.bind (encode (Pairs.first v1)) (\f -> Flows.bind (encode (Pairs.second v1)) (\s -> Flows.pure (Ast.ExpressionTuple [+ f,+ s]))))+ Core.TermRecord v1 -> + let sname = (Core.recordTypeName v1) + fields = (Core.recordFields v1)+ toFieldUpdate = (\field -> + let fn = (Core.fieldName field) + ft = (Core.fieldTerm field)+ fieldRef = (Utils.recordFieldReference namespaces sname fn)+ in (Flows.bind (encode ft) (\hft -> Flows.pure (Ast.FieldUpdate {+ Ast.fieldUpdateName = fieldRef,+ Ast.fieldUpdateValue = hft}))))+ typeName = (Utils.elementReference namespaces sname)+ in (Flows.bind (Flows.mapList toFieldUpdate fields) (\updates -> Flows.pure (Ast.ExpressionConstructRecord (Ast.ConstructRecordExpression {+ Ast.constructRecordExpressionName = typeName,+ Ast.constructRecordExpressionFields = updates}))))+ Core.TermSet v1 -> (Logic.ifElse (Sets.null v1) (Flows.pure (Utils.hsvar "S.empty")) (nonemptySet v1))+ Core.TermTypeLambda v1 -> + let term1 = (Core.typeLambdaBody v1)+ in (encode term1)+ Core.TermTypeApplication v1 -> + let term1 = (Core.typeApplicationTermBody v1)+ in (encode term1)+ Core.TermUnion v1 -> + let sname = (Core.injectionTypeName v1) + field = (Core.injectionField v1)+ fn = (Core.fieldName field)+ ft = (Core.fieldTerm field)+ in (Flows.bind Monads.getState (\g_ufr2 -> + let lhs = (Ast.ExpressionVariable (Utils.unionFieldReference g_ufr2 namespaces sname fn)) + dflt = (Flows.map (Utils.hsapp lhs) (encode ft))+ in (Flows.bind (Schemas.requireUnionField sname fn) (\ftyp -> (\x -> case x of+ Core.TypeUnit -> (Flows.pure lhs)+ _ -> dflt) (Rewriting.deannotateType ftyp)))))+ Core.TermUnit -> (Flows.pure (Ast.ExpressionTuple []))+ Core.TermVariable v1 -> (Flows.pure (Ast.ExpressionVariable (Utils.elementReference namespaces v1)))+ Core.TermWrap v1 -> + let tname = (Core.wrappedTermTypeName v1) + term_ = (Core.wrappedTermBody v1)+ lhs = (Ast.ExpressionVariable (Utils.elementReference namespaces tname))+ in (Flows.bind (encode term_) (\rhs -> Flows.pure (Utils.hsapp lhs rhs)))+ _ -> (Flows.fail (Strings.cat2 "unexpected term: " (Core__.term term)))) (Rewriting.deannotateTerm term)) +-- | Encode a Hydra type as a Haskell type encodeType :: (Module.Namespaces Ast.ModuleName -> Core.Type -> Compute.Flow t0 Ast.Type) encodeType namespaces typ = let encode = (encodeType namespaces) @@ -296,6 +321,13 @@ in (Flows.bind (encode lhs) (\hlhs -> Flows.bind (encode rhs) (\hrhs -> Flows.pure (Utils.toTypeApplication [ hlhs, hrhs]))))+ Core.TypeEither v1 -> + let left = (Core.eitherTypeLeft v1) + right = (Core.eitherTypeRight v1)+ in (Flows.map Utils.toTypeApplication (Flows.sequence [+ Flows.pure (Ast.TypeVariable (Utils.rawName "Either")),+ (encode left),+ (encode right)])) Core.TypeFunction v1 -> let dom = (Core.functionTypeDomain v1) cod = (Core.functionTypeCodomain v1)@@ -308,6 +340,7 @@ in (encode body) Core.TypeList v1 -> (Flows.bind (encode v1) (\hlt -> Flows.pure (Ast.TypeList hlt))) Core.TypeLiteral v1 -> ((\x -> case x of+ Core.LiteralTypeBinary -> (Flows.pure (Ast.TypeVariable (Utils.rawName "B.ByteString"))) Core.LiteralTypeBoolean -> (Flows.pure (Ast.TypeVariable (Utils.rawName "Bool"))) Core.LiteralTypeFloat v2 -> ((\x -> case x of Core.FloatTypeFloat32 -> (Flows.pure (Ast.TypeVariable (Utils.rawName "Float")))@@ -319,20 +352,22 @@ Core.IntegerTypeInt16 -> (Flows.pure (Ast.TypeVariable (Utils.rawName "I.Int16"))) Core.IntegerTypeInt32 -> (Flows.pure (Ast.TypeVariable (Utils.rawName "Int"))) Core.IntegerTypeInt64 -> (Flows.pure (Ast.TypeVariable (Utils.rawName "I.Int64")))- _ -> (Flows.fail (Strings.cat2 "unexpected integer type: " (Core___.integerType v2)))) v2)+ _ -> (Flows.fail (Strings.cat2 "unexpected integer type: " (Core__.integerType v2)))) v2) Core.LiteralTypeString -> (Flows.pure (Ast.TypeVariable (Utils.rawName "String")))- _ -> (Flows.fail (Strings.cat2 "unexpected literal type: " (Core___.literalType v1)))) v1)+ _ -> (Flows.fail (Strings.cat2 "unexpected literal type: " (Core__.literalType v1)))) v1) Core.TypeMap v1 -> let kt = (Core.mapTypeKeys v1) vt = (Core.mapTypeValues v1) in (Flows.map Utils.toTypeApplication (Flows.sequence [ Flows.pure (Ast.TypeVariable (Utils.rawName "M.Map")),- encode kt,+ (encode kt), (encode vt)]))- Core.TypeOptional v1 -> (Flows.map Utils.toTypeApplication (Flows.sequence [+ Core.TypeMaybe v1 -> (Flows.map Utils.toTypeApplication (Flows.sequence [ Flows.pure (Ast.TypeVariable (Utils.rawName "Maybe")), (encode v1)]))- Core.TypeProduct v1 -> (Flows.bind (Flows.mapList encode v1) (\htypes -> Flows.pure (Ast.TypeTuple htypes)))+ Core.TypePair v1 -> (Flows.bind (encode (Core.pairTypeFirst v1)) (\f -> Flows.bind (encode (Core.pairTypeSecond v1)) (\s -> Flows.pure (Ast.TypeTuple [+ f,+ s])))) Core.TypeRecord v1 -> (ref (Core.rowTypeTypeName v1)) Core.TypeSet v1 -> (Flows.map Utils.toTypeApplication (Flows.sequence [ Flows.pure (Ast.TypeVariable (Utils.rawName "S.Set")),@@ -345,18 +380,19 @@ Core.TypeWrap v1 -> let name = (Core.wrappedTypeTypeName v1) in (ref name)- _ -> (Flows.fail (Strings.cat2 "unexpected type: " (Core___.type_ typ)))) (Rewriting.deannotateType typ)))+ _ -> (Flows.fail (Strings.cat2 "unexpected type: " (Core__.type_ typ)))) (Rewriting.deannotateType typ))) -encodeTypeWithClassAssertions :: (Module.Namespaces Ast.ModuleName -> M.Map Core.Name (S.Set Mantle.TypeClass) -> Core.Type -> Compute.Flow Graph.Graph Ast.Type)+-- | Encode a Hydra type as a Haskell type with typeclass assertions+encodeTypeWithClassAssertions :: (Module.Namespaces Ast.ModuleName -> M.Map Core.Name (S.Set Classes.TypeClass) -> Core.Type -> Compute.Flow Graph.Graph Ast.Type) encodeTypeWithClassAssertions namespaces explicitClasses typ = let classes = (Maps.union explicitClasses (getImplicitTypeClasses typ)) implicitClasses = (getImplicitTypeClasses typ) encodeAssertion = (\pair -> - let name = (fst pair) - cls = (snd pair)+ let name = (Pairs.first pair) + cls = (Pairs.second pair) hname = (Utils.rawName ((\x -> case x of- Mantle.TypeClassEquality -> "Eq"- Mantle.TypeClassOrdering -> "Ord") cls))+ Classes.TypeClassEquality -> "Eq"+ Classes.TypeClassOrdering -> "Ord") cls)) htype = (Ast.TypeVariable (Utils.rawName (Core.unName name))) in (Ast.AssertionClass (Ast.ClassAssertion { Ast.classAssertionName = hname,@@ -364,17 +400,18 @@ htype]}))) assertPairs = (Lists.concat (Lists.map toPairs (Maps.toList classes))) toPairs = (\mapEntry -> - let name = (fst mapEntry) - clsSet = (snd mapEntry)+ let name = (Pairs.first mapEntry) + clsSet = (Pairs.second mapEntry) toPair = (\c -> (name, c)) in (Lists.map toPair (Sets.toList clsSet))) in (Monads.withTrace "encode with assertions" (Flows.bind (adaptTypeToHaskellAndEncode namespaces typ) (\htyp -> Logic.ifElse (Lists.null assertPairs) (Flows.pure htyp) ( let encoded = (Lists.map encodeAssertion assertPairs) - hassert = (Logic.ifElse (Equality.gt (Lists.length encoded) 1) (Lists.head encoded) (Ast.AssertionTuple encoded))+ hassert = (Logic.ifElse (Equality.equal (Lists.length encoded) 1) (Lists.head encoded) (Ast.AssertionTuple encoded)) in (Flows.pure (Ast.TypeCtx (Ast.ContextType { Ast.contextTypeCtx = hassert, Ast.contextTypeType = htyp}))))))) +-- | Find type variables that require an Ord constraint (used in maps or sets) findOrdVariables :: (Core.Type -> S.Set Core.Name) findOrdVariables typ = let fold = (\names -> \typ_ -> (\x -> case x of@@ -385,7 +422,7 @@ _ -> names) typ_) isTypeVariable = (\v -> let nameStr = (Core.unName v) - hasNoNamespace = (Optionals.isNothing (Names.namespaceOf v))+ hasNoNamespace = (Maybes.isNothing (Names.namespaceOf v)) startsWithT = (Equality.equal (Strings.charAt 0 nameStr) 116) in (Logic.and hasNoNamespace startsWithT)) tryType = (\names -> \t -> (\x -> case x of@@ -393,27 +430,31 @@ _ -> names) (Rewriting.deannotateType t)) in (Rewriting.foldOverType Coders.TraversalOrderPre fold Sets.empty typ) -getImplicitTypeClasses :: (Core.Type -> M.Map Core.Name (S.Set Mantle.TypeClass))+-- | Get implicit typeclass constraints for type variables that need Ord+getImplicitTypeClasses :: (Core.Type -> M.Map Core.Name (S.Set Classes.TypeClass)) getImplicitTypeClasses typ = let toPair = (\name -> (name, (Sets.fromList [- Mantle.TypeClassOrdering])))+ Classes.TypeClassOrdering]))) in (Maps.fromList (Lists.map toPair (Sets.toList (findOrdVariables typ)))) -moduleToHaskellModule :: (Module.Module -> Compute.Flow Graph.Graph Ast.Module)-moduleToHaskellModule mod = (Flows.bind (Utils.namespacesForModule mod) (\namespaces -> Modules.transformModule Language.haskellLanguage (encodeTerm namespaces) (constructModule namespaces) mod))+-- | Convert a Hydra module and definitions to a Haskell module AST+moduleToHaskellModule :: (Module.Module -> [Module.Definition] -> Compute.Flow Graph.Graph Ast.Module)+moduleToHaskellModule mod defs = (Flows.bind (Utils.namespacesForModule mod) (\namespaces -> constructModule namespaces mod defs)) -moduleToHaskell :: (Module.Module -> Compute.Flow Graph.Graph (M.Map String String))-moduleToHaskell mod = (Flows.bind (moduleToHaskellModule mod) (\hsmod -> +-- | Convert a Hydra module to Haskell source code as a filepath-to-content map+moduleToHaskell :: (Module.Module -> [Module.Definition] -> Compute.Flow Graph.Graph (M.Map String String))+moduleToHaskell mod defs = (Flows.bind (moduleToHaskellModule mod defs) (\hsmod -> let s = (Serialization.printExpr (Serialization.parenthesize (Serde.moduleToExpr hsmod))) - filepath = (Names.namespaceToFilePath Mantle.CaseConventionPascal (Module.FileExtension "hs") (Module.moduleNamespace mod))+ filepath = (Names.namespaceToFilePath Util.CaseConventionPascal (Module.FileExtension "hs") (Module.moduleNamespace mod)) in (Flows.pure (Maps.singleton filepath s)))) +-- | Generate Haskell declarations for type and field name constants nameDecls :: (t0 -> Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Type -> [Ast.DeclarationWithComments]) nameDecls g namespaces name typ = let nm = (Core.unName name) toDecl = (\n -> \pair -> - let k = (fst pair) - v = (snd pair)+ let k = (Pairs.first pair) + v = (Pairs.second pair) decl = (Ast.DeclarationValueBinding (Ast.ValueBindingSimple (Ast.SimpleValueBinding { Ast.simpleValueBindingPattern = (Utils.applicationPattern (Utils.simpleName k) []), Ast.simpleValueBindingRhs = (Ast.RightHandSide (Ast.ExpressionApplication (Ast.ApplicationExpression {@@ -430,14 +471,13 @@ in (constantForFieldName name fname, (Core.unName fname))) in (Logic.ifElse useCoreImport (Lists.cons (toDecl (Core.Name "hydra.core.Name") nameDecl) (Lists.map (toDecl (Core.Name "hydra.core.Name")) fieldDecls)) []) -toDataDeclaration :: (M.Map Core.Type (Compute.Coder Graph.Graph t0 Core.Term Ast.Expression) -> Module.Namespaces Ast.ModuleName -> (Core.Binding, Core.TypedTerm) -> Compute.Flow Graph.Graph Ast.DeclarationWithComments)-toDataDeclaration coders namespaces pair = - let el = (fst pair) - tt = (snd pair)- term = (Core.typedTermTerm tt)- typ = (Core.typedTermType tt)- coder = (Optionals.fromJust (Maps.lookup typ coders))- hname = (Utils.simpleName (Names.localNameOf (Core.bindingName el)))+-- | Convert a Hydra term definition to a Haskell declaration with comments+toDataDeclaration :: (Module.Namespaces Ast.ModuleName -> Module.TermDefinition -> Compute.Flow Graph.Graph Ast.DeclarationWithComments)+toDataDeclaration namespaces def = + let name = (Module.termDefinitionName def) + term = (Module.termDefinitionTerm def)+ typ = (Module.termDefinitionType def)+ hname = (Utils.simpleName (Names.localNameOf name)) rewriteValueBinding = (\vb -> (\x -> case x of Ast.ValueBindingSimple v1 -> let pattern_ = (Ast.simpleValueBindingPattern v1) @@ -460,35 +500,39 @@ Ast.simpleValueBindingLocalBindings = bindings}))) _ -> vb) rhsExpr) _ -> vb) pattern_)) vb)- toDecl = (\comments -> \hname_ -> \term_ -> \coder_ -> \bindings -> (\x -> case x of+ toDecl = (\comments -> \hname_ -> \term_ -> \bindings -> (\x -> case x of Core.TermLet v1 -> let lbindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)+ env = (Core.letBody v1) toBinding = (\hname_ -> \hterm_ -> Ast.LocalBindingValue (Utils.simpleValueBinding hname_ hterm_ Nothing))- ts = (Lists.map (\binding -> Core.typeSchemeType (Optionals.fromJust (Core.bindingType binding))) lbindings)- in (Flows.bind (Flows.mapList (\t -> Modules.constructCoder Language.haskellLanguage (encodeTerm namespaces) t) ts) (\coders_ -> - let hnames = (Lists.map (\binding -> Utils.simpleName (Core.unName (Core.bindingName binding))) lbindings) - terms = (Lists.map Core.bindingTerm lbindings)- in (Flows.bind (Flows.sequence (Lists.zipWith (\e -> \t -> Compute.coderEncode e t) coders_ terms)) (\hterms -> - let hbindings = (Lists.zipWith toBinding hnames hterms)- in (toDecl comments hname_ env coder_ (Just (Ast.LocalBindings hbindings)))))))- _ -> (Flows.bind (Compute.coderEncode coder_ term_) (\hterm -> - let vb = (Utils.simpleValueBinding hname_ hterm bindings)- in (Flows.bind (Annotations.getTypeClasses (Rewriting.removeTypesFromTerm (Core.bindingTerm el))) (\explicitClasses -> Flows.bind (encodeTypeWithClassAssertions namespaces explicitClasses typ) (\htype -> - let decl = (Ast.DeclarationTypedBinding (Ast.TypedBinding {- Ast.typedBindingTypeSignature = Ast.TypeSignature {- Ast.typeSignatureName = hname_,- Ast.typeSignatureType = htype},- Ast.typedBindingValueBinding = (rewriteValueBinding vb)}))- in (Flows.pure (Ast.DeclarationWithComments {- Ast.declarationWithCommentsBody = decl,- Ast.declarationWithCommentsComments = comments})))))))) (Rewriting.deannotateTerm term_))- in (Flows.bind (Annotations.getTermDescription term) (\comments -> toDecl comments hname term coder Nothing))+ hnames = (Lists.map (\binding -> Utils.simpleName (Core.unName (Core.bindingName binding))) lbindings)+ terms = (Lists.map Core.bindingTerm lbindings)+ in (Flows.bind (Flows.mapList (encodeTerm namespaces) terms) (\hterms -> + let hbindings = (Lists.zipWith toBinding hnames hterms) + prevBindings = (Maybes.maybe [] (\lb -> Ast.unLocalBindings lb) bindings)+ allBindings = (Lists.concat2 prevBindings hbindings)+ in (toDecl comments hname_ env (Just (Ast.LocalBindings allBindings)))))+ _ -> (Flows.bind (encodeTerm namespaces term_) (\hterm -> + let vb = (Utils.simpleValueBinding hname_ hterm bindings) + schemeConstraints = (Core.typeSchemeConstraints typ)+ schemeClasses = (typeSchemeConstraintsToClassMap schemeConstraints)+ in (Flows.bind (Annotations.getTypeClasses (Rewriting.removeTypesFromTerm term)) (\explicitClasses -> + let combinedClasses = (Maps.union schemeClasses explicitClasses)+ in (Flows.bind (encodeTypeWithClassAssertions namespaces combinedClasses (Core.typeSchemeType typ)) (\htype -> + let decl = (Ast.DeclarationTypedBinding (Ast.TypedBinding {+ Ast.typedBindingTypeSignature = Ast.TypeSignature {+ Ast.typeSignatureName = hname_,+ Ast.typeSignatureType = htype},+ Ast.typedBindingValueBinding = (rewriteValueBinding vb)}))+ in (Flows.pure (Ast.DeclarationWithComments {+ Ast.declarationWithCommentsBody = decl,+ Ast.declarationWithCommentsComments = comments}))))))))) (Rewriting.deannotateTerm term_))+ in (Flows.bind (Annotations.getTermDescription term) (\comments -> toDecl comments hname term Nothing)) -toTypeDeclarations :: (Module.Namespaces Ast.ModuleName -> Core.Binding -> Core.Term -> Compute.Flow Graph.Graph [Ast.DeclarationWithComments])-toTypeDeclarations namespaces el term = - let elementName = (Core.bindingName el) - lname = (Names.localNameOf elementName)+-- | Convert a Hydra type definition to Haskell declarations+toTypeDeclarationsFrom :: (Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Type -> Compute.Flow Graph.Graph [Ast.DeclarationWithComments])+toTypeDeclarationsFrom namespaces elementName typ = + let lname = (Names.localNameOf elementName) hname = (Utils.simpleName lname) declHead = (\name -> \vars_ -> Logic.ifElse (Lists.null vars_) (Ast.DeclarationHeadSimple name) ( let h = (Lists.head vars_) @@ -497,15 +541,15 @@ in (Ast.DeclarationHeadApplication (Ast.ApplicationDeclarationHead { Ast.applicationDeclarationHeadFunction = (declHead name rest), Ast.applicationDeclarationHeadOperand = hvar}))))- newtypeCons = (\el_ -> \typ_ -> - let hname = (Utils.simpleName (Utils.newtypeAccessorName (Core.bindingName el_)))+ newtypeCons = (\tname -> \typ_ -> + let hname = (Utils.simpleName (Utils.newtypeAccessorName tname)) in (Flows.bind (adaptTypeToHaskellAndEncode namespaces typ_) (\htype -> let hfield = Ast.FieldWithComments { Ast.fieldWithCommentsField = Ast.Field { Ast.fieldName = hname, Ast.fieldType = htype}, Ast.fieldWithCommentsComments = Nothing} - constructorName = (Utils.simpleName (Names.localNameOf (Core.bindingName el_)))+ constructorName = (Utils.simpleName (Names.localNameOf tname)) in (Flows.pure (Ast.ConstructorWithComments { Ast.constructorWithCommentsBody = (Ast.ConstructorRecord (Ast.RecordConstructor { Ast.recordConstructorName = constructorName,@@ -532,9 +576,9 @@ ftype = (Core.fieldTypeType fieldType) deconflict = (\name -> let tname = (Names.unqualifyName (Module.QualifiedName {- Module.qualifiedNameNamespace = (Just (fst (Module.namespacesFocus namespaces))),+ Module.qualifiedNameNamespace = (Just (Pairs.first (Module.namespacesFocus namespaces))), Module.qualifiedNameLocal = name}))- in (Logic.ifElse (Optionals.isJust (Maps.lookup tname (Graph.graphElements g_))) (deconflict (Strings.cat2 name "_")) name))+ in (Logic.ifElse (Maybes.isJust (Lists.find (\b -> Equality.equal (Core.bindingName b) tname) (Graph.graphElements g_))) (deconflict (Strings.cat2 name "_")) name)) in (Flows.bind (Annotations.getTypeDescription ftype) (\comments -> let nm = (deconflict (Strings.cat2 (Formatting.capitalize lname_) (Formatting.capitalize (Core.unName fname)))) in (Flows.bind (Logic.ifElse (Equality.equal (Rewriting.deannotateType ftype) Core.TypeUnit) (Flows.pure []) (Flows.bind (adaptTypeToHaskellAndEncode namespaces ftype) (\htype -> Flows.pure [@@ -543,15 +587,15 @@ Ast.ordinaryConstructorName = (Utils.simpleName nm), Ast.ordinaryConstructorFields = typeList})), Ast.constructorWithCommentsComments = comments}))))))- in (Monads.withTrace (Strings.cat2 "type element " (Core.unName elementName)) (Flows.bind Monads.getState (\g -> Flows.bind (Core_.type_ term) (\t -> Flows.bind (Schemas.isSerializable el) (\isSer -> + in (Monads.withTrace (Strings.cat2 "type definition " (Core.unName elementName)) (Flows.bind Monads.getState (\g -> Flows.bind (Schemas.isSerializableByName elementName) (\isSer -> let deriv = (Ast.Deriving (Logic.ifElse isSer (Lists.map Utils.rawName [ "Eq", "Ord", "Read", "Show"]) [])) - unpackResult = (Utils.unpackForallType g t)- vars = (fst unpackResult)- t_ = (snd unpackResult)+ unpackResult = (Utils.unpackForallType g typ)+ vars = (Pairs.first unpackResult)+ t_ = (Pairs.second unpackResult) hd = (declHead hname (Lists.reverse vars)) in (Flows.bind ((\x -> case x of Core.TypeRecord v1 -> (Flows.bind (recordCons lname (Core.rowTypeFields v1)) (\cons -> Flows.pure (Ast.DeclarationData (Ast.DataDeclaration {@@ -570,9 +614,8 @@ Ast.dataDeclarationDeriving = [ deriv]})))) Core.TypeWrap v1 -> - let tname = (Core.wrappedTypeTypeName v1) - wt = (Core.wrappedTypeObject v1)- in (Flows.bind (newtypeCons el wt) (\cons -> Flows.pure (Ast.DeclarationData (Ast.DataDeclaration {+ let wt = (Core.wrappedTypeBody v1)+ in (Flows.bind (newtypeCons elementName wt) (\cons -> Flows.pure (Ast.DeclarationData (Ast.DataDeclaration { Ast.dataDeclarationKeyword = Ast.DataOrNewtypeNewtype, Ast.dataDeclarationContext = [], Ast.dataDeclarationHead = hd,@@ -580,43 +623,54 @@ cons], Ast.dataDeclarationDeriving = [ deriv]}))))- _ -> (Flows.bind (adaptTypeToHaskellAndEncode namespaces t) (\htype -> Flows.pure (Ast.DeclarationType (Ast.TypeDeclaration {+ _ -> (Flows.bind (adaptTypeToHaskellAndEncode namespaces typ) (\htype -> Flows.pure (Ast.DeclarationType (Ast.TypeDeclaration { Ast.typeDeclarationName = hd,- Ast.typeDeclarationType = htype}))))) (Rewriting.deannotateType t_)) (\decl -> Flows.bind (Annotations.getTermDescription term) (\comments -> Flows.bind (Logic.ifElse includeTypeDefinitions (Flows.bind (typeDecl namespaces elementName t) (\decl_ -> Flows.pure [+ Ast.typeDeclarationType = htype}))))) (Rewriting.deannotateType t_)) (\decl -> Flows.bind (Annotations.getTypeDescription typ) (\comments -> Flows.bind (Logic.ifElse includeTypeDefinitions (Flows.bind (typeDecl namespaces elementName typ) (\decl_ -> Flows.pure [ decl_])) (Flows.pure [])) (\tdecls -> let mainDecl = Ast.DeclarationWithComments { Ast.declarationWithCommentsBody = decl, Ast.declarationWithCommentsComments = comments} - nameDecls_ = (nameDecls g namespaces elementName t)+ nameDecls_ = (nameDecls g namespaces elementName typ) in (Flows.pure (Lists.concat [ [ mainDecl], nameDecls_,- tdecls])))))))))))+ tdecls])))))))))) +-- | Generate a Haskell declaration for a type definition constant typeDecl :: (Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Type -> Compute.Flow Graph.Graph Ast.DeclarationWithComments) typeDecl namespaces name typ = let typeName = (\ns -> \name_ -> Names.qname ns (typeNameLocal name_)) typeNameLocal = (\name_ -> Strings.cat [ "_",- Names.localNameOf name_,+ (Names.localNameOf name_), "_type_"])- rawTerm = (Core__.type_ typ)+ rawTerm = (Core_.type_ typ) rewrite = (\recurse -> \term -> - let variantResult = (Decoding.variant (Core.Name "hydra.core.Type") term) + let variantResult = ((\x -> case x of+ Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.injectionTypeName v1) (Core.Name "hydra.core.Type")) (Just (Core.injectionField v1)) Nothing)+ _ -> Nothing) (Rewriting.deannotateTerm term)) + decodeString = (\term -> (\x -> case x of+ Core.TermLiteral v1 -> ((\x -> case x of+ Core.LiteralString v2 -> (Just v2)+ _ -> Nothing) v1)+ _ -> Nothing) (Rewriting.deannotateTerm term))+ decodeName = (\term -> (\x -> case x of+ Core.TermWrap v1 -> (Logic.ifElse (Equality.equal (Core.wrappedTermTypeName v1) (Core.Name "hydra.core.Name")) (Maybes.map (\x -> Core.Name x) (decodeString (Core.wrappedTermBody v1))) Nothing)+ _ -> Nothing) (Rewriting.deannotateTerm term)) forType = (\field -> let fname = (Core.fieldName field) fterm = (Core.fieldTerm field)- in (Logic.ifElse (Equality.equal fname (Core.Name "record")) Nothing (Logic.ifElse (Equality.equal fname (Core.Name "variable")) (Optionals.bind (Decoding.name fterm) forVariableType) Nothing)))- forVariableType = (\name_ -> - let qname = (Names.qualifyName name_) + in (Logic.ifElse (Equality.equal fname (Core.Name "record")) Nothing (Logic.ifElse (Equality.equal fname (Core.Name "variable")) (Maybes.bind (decodeName fterm) forVariableType) Nothing)))+ forVariableType = (\vname -> + let qname = (Names.qualifyName vname) mns = (Module.qualifiedNameNamespace qname) local = (Module.qualifiedNameLocal qname)- in (Optionals.map (\ns -> Core.TermVariable (Names.qname ns (Strings.cat [+ in (Maybes.map (\ns -> Core.TermVariable (Names.qname ns (Strings.cat [ "_", local, "_type_"]))) mns))- in (Optionals.fromMaybe (recurse term) (Optionals.bind variantResult forType)))+ in (Maybes.fromMaybe (recurse term) (Maybes.bind variantResult forType))) finalTerm = (Rewriting.rewriteTerm rewrite rawTerm) in (Flows.bind (Modules.constructCoder Language.haskellLanguage (encodeTerm namespaces) (Core.TypeVariable (Core.Name "hydra.core.Type"))) (\coder -> Flows.bind (Compute.coderEncode coder finalTerm) (\expr -> let rhs = (Ast.RightHandSide expr) @@ -629,3 +683,13 @@ in (Flows.pure (Ast.DeclarationWithComments { Ast.declarationWithCommentsBody = decl, Ast.declarationWithCommentsComments = Nothing})))))++-- | Convert type scheme constraints to a map of type variables to typeclasses+typeSchemeConstraintsToClassMap :: Ord t0 => (Maybe (M.Map t0 Core.TypeVariableMetadata) -> M.Map t0 (S.Set Classes.TypeClass))+typeSchemeConstraintsToClassMap maybeConstraints = + let nameToTypeClass = (\className -> + let classNameStr = (Core.unName className) + isEq = (Equality.equal classNameStr (Core.unName (Core.Name "equality")))+ isOrd = (Equality.equal classNameStr (Core.unName (Core.Name "ordering")))+ in (Logic.ifElse isEq (Just Classes.TypeClassEquality) (Logic.ifElse isOrd (Just Classes.TypeClassOrdering) Nothing)))+ in (Maybes.maybe Maps.empty (\constraints -> Maps.map (\meta -> Sets.fromList (Maybes.cat (Lists.map nameToTypeClass (Sets.toList (Core.typeVariableMetadataClasses meta))))) constraints) maybeConstraints)
src/gen-main/haskell/Hydra/Ext/Haskell/Language.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Language constraints and reserved words for Haskell module Hydra.Ext.Haskell.Language where@@ -6,8 +8,9 @@ import qualified Hydra.Core as Core import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -28,22 +31,22 @@ Coders.languageConstraintsTypes = typePredicate}} where eliminationVariants = (Sets.fromList [- Mantle.EliminationVariantProduct,- Mantle.EliminationVariantRecord,- Mantle.EliminationVariantUnion,- Mantle.EliminationVariantWrap])+ Variants.EliminationVariantRecord,+ Variants.EliminationVariantUnion,+ Variants.EliminationVariantWrap]) literalVariants = (Sets.fromList [- Mantle.LiteralVariantBoolean,- Mantle.LiteralVariantFloat,- Mantle.LiteralVariantInteger,- Mantle.LiteralVariantString])+ Variants.LiteralVariantBinary,+ Variants.LiteralVariantBoolean,+ Variants.LiteralVariantFloat,+ Variants.LiteralVariantInteger,+ Variants.LiteralVariantString]) floatTypes = (Sets.fromList [ Core.FloatTypeFloat32, Core.FloatTypeFloat64]) functionVariants = (Sets.fromList [- Mantle.FunctionVariantElimination,- Mantle.FunctionVariantLambda,- Mantle.FunctionVariantPrimitive])+ Variants.FunctionVariantElimination,+ Variants.FunctionVariantLambda,+ Variants.FunctionVariantPrimitive]) integerTypes = (Sets.fromList [ Core.IntegerTypeBigint, Core.IntegerTypeInt8,@@ -51,36 +54,39 @@ Core.IntegerTypeInt32, Core.IntegerTypeInt64]) termVariants = (Sets.fromList [- Mantle.TermVariantApplication,- Mantle.TermVariantFunction,- Mantle.TermVariantLet,- Mantle.TermVariantList,- Mantle.TermVariantLiteral,- Mantle.TermVariantMap,- Mantle.TermVariantOptional,- Mantle.TermVariantProduct,- Mantle.TermVariantRecord,- Mantle.TermVariantSet,- Mantle.TermVariantUnion,- Mantle.TermVariantUnit,- Mantle.TermVariantVariable,- Mantle.TermVariantWrap])+ Variants.TermVariantAnnotated,+ Variants.TermVariantApplication,+ Variants.TermVariantEither,+ Variants.TermVariantFunction,+ Variants.TermVariantLet,+ Variants.TermVariantList,+ Variants.TermVariantLiteral,+ Variants.TermVariantMap,+ Variants.TermVariantMaybe,+ Variants.TermVariantPair,+ Variants.TermVariantRecord,+ Variants.TermVariantSet,+ Variants.TermVariantUnion,+ Variants.TermVariantUnit,+ Variants.TermVariantVariable,+ Variants.TermVariantWrap]) typeVariants = (Sets.fromList [- Mantle.TypeVariantAnnotated,- Mantle.TypeVariantApplication,- Mantle.TypeVariantFunction,- Mantle.TypeVariantForall,- Mantle.TypeVariantList,- Mantle.TypeVariantLiteral,- Mantle.TypeVariantMap,- Mantle.TypeVariantOptional,- Mantle.TypeVariantProduct,- Mantle.TypeVariantRecord,- Mantle.TypeVariantSet,- Mantle.TypeVariantUnion,- Mantle.TypeVariantUnit,- Mantle.TypeVariantVariable,- Mantle.TypeVariantWrap])+ Variants.TypeVariantAnnotated,+ Variants.TypeVariantApplication,+ Variants.TypeVariantEither,+ Variants.TypeVariantFunction,+ Variants.TypeVariantForall,+ Variants.TypeVariantList,+ Variants.TypeVariantLiteral,+ Variants.TypeVariantMap,+ Variants.TypeVariantMaybe,+ Variants.TypeVariantPair,+ Variants.TypeVariantRecord,+ Variants.TypeVariantSet,+ Variants.TypeVariantUnion,+ Variants.TypeVariantUnit,+ Variants.TypeVariantVariable,+ Variants.TypeVariantWrap]) typePredicate = (\_ -> True) -- | Created on 2025-02-28 using GHCi 9.6.6
src/gen-main/haskell/Hydra/Ext/Haskell/Operators.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | AST operators for Haskell module Hydra.Ext.Haskell.Operators where@@ -5,19 +7,22 @@ import qualified Hydra.Ast as Ast import qualified Hydra.Lib.Math as Math import qualified Hydra.Serialization as Serialization-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Logical AND operator (&&) andOp :: Ast.Op andOp = (Serialization.op "&&" 3 Ast.AssociativityRight) +-- | Applicative apply operator (<*>) apOp :: Ast.Op apOp = (Serialization.op "<*>" 4 Ast.AssociativityLeft) --- | No source+-- | Function application operator (whitespace) appOp :: Ast.Op appOp = Ast.Op { Ast.opSymbol = (Ast.Symbol ""),@@ -27,103 +32,126 @@ Ast.opPrecedence = (Ast.Precedence 0), Ast.opAssociativity = Ast.AssociativityLeft} +-- | Low-precedence function application ($) applyOp :: Ast.Op applyOp = (Serialization.op "$" 0 Ast.AssociativityRight) +-- | Function type arrow (->) arrowOp :: Ast.Op-arrowOp = (Serialization.op "->" (Math.neg 1) Ast.AssociativityRight)+arrowOp = (Serialization.op "->" (Math.negate 1) Ast.AssociativityRight) --- | No source+-- | Type class constraint arrow (=>) assertOp :: Ast.Op assertOp = (Serialization.op "=>" 0 Ast.AssociativityNone) +-- | Monadic bind operator (>>=) bindOp :: Ast.Op bindOp = (Serialization.op ">>=" 1 Ast.AssociativityLeft) --- | No source+-- | Case alternative arrow (->) caseOp :: Ast.Op caseOp = (Serialization.op "->" 0 Ast.AssociativityNone) +-- | Function composition (.) composeOp :: Ast.Op composeOp = (Serialization.op "." 9 Ast.AssociativityLeft) +-- | List concatenation (++) concatOp :: Ast.Op concatOp = (Serialization.op "++" 5 Ast.AssociativityRight) +-- | List cons (:) consOp :: Ast.Op consOp = (Serialization.op ":" 5 Ast.AssociativityRight) --- | No source+-- | Definition operator (=) defineOp :: Ast.Op defineOp = (Serialization.op "=" 0 Ast.AssociativityNone) +-- | Semigroup append (<>) diamondOp :: Ast.Op diamondOp = (Serialization.op "<>" 6 Ast.AssociativityRight) +-- | Integer division (`div`) divOp :: Ast.Op divOp = (Serialization.op "`div`" 7 Ast.AssociativityLeft) +-- | Fractional division (/) divideOp :: Ast.Op divideOp = (Serialization.op "/" 7 Ast.AssociativityLeft) +-- | List membership (`elem`) elemOp :: Ast.Op elemOp = (Serialization.op "`elem`" 4 Ast.AssociativityNone) +-- | Equality comparison (==) equalOp :: Ast.Op equalOp = (Serialization.op "==" 4 Ast.AssociativityNone) +-- | Functor map (<$>) fmapOp :: Ast.Op fmapOp = (Serialization.op "<$>" 4 Ast.AssociativityLeft) +-- | Greater than (>) gtOp :: Ast.Op gtOp = (Serialization.op ">" 4 Ast.AssociativityNone) +-- | Greater than or equal (>=) gteOp :: Ast.Op gteOp = (Serialization.op ">=" 4 Ast.AssociativityNone) +-- | List indexing (!!) indexOp :: Ast.Op indexOp = (Serialization.op "!!" 9 Ast.AssociativityLeft) --- | No source+-- | Lambda body arrow (->) lambdaOp :: Ast.Op-lambdaOp = (Serialization.op "->" (Math.neg 1) Ast.AssociativityRight)+lambdaOp = (Serialization.op "->" (Math.negate 1) Ast.AssociativityRight) +-- | Less than (<) ltOp :: Ast.Op ltOp = (Serialization.op "<" 4 Ast.AssociativityNone) +-- | Less than or equal (<=) lteOp :: Ast.Op lteOp = (Serialization.op ">=" 4 Ast.AssociativityNone) --- | Originally: associativityLeft+-- | Subtraction (-). Originally: associativityLeft minusOp :: Ast.Op minusOp = (Serialization.op "-" 6 Ast.AssociativityBoth) +-- | Modulo (`mod`) modOp :: Ast.Op modOp = (Serialization.op "`mod`" 7 Ast.AssociativityLeft) --- | Originally: associativityLeft+-- | Multiplication (*). Originally: associativityLeft multOp :: Ast.Op multOp = (Serialization.op "*" 7 Ast.AssociativityBoth) +-- | Not equal (/=) neqOp :: Ast.Op neqOp = (Serialization.op "/=" 4 Ast.AssociativityNone) +-- | List non-membership (`notElem`) notElemOp :: Ast.Op notElemOp = (Serialization.op "`notElem`" 4 Ast.AssociativityNone) +-- | Logical OR (||) orOp :: Ast.Op orOp = (Serialization.op "||" 2 Ast.AssociativityRight) --- | Originally: associativityLeft+-- | Addition (+). Originally: associativityLeft plusOp :: Ast.Op plusOp = (Serialization.op "+" 6 Ast.AssociativityBoth) +-- | Integer quotient (`quot`) quotOp :: Ast.Op quotOp = (Serialization.op "`quot`" 7 Ast.AssociativityLeft) +-- | Integer remainder (`rem`) remOp :: Ast.Op remOp = (Serialization.op "`rem`" 7 Ast.AssociativityLeft) --- | No source+-- | Type annotation (::) typeOp :: Ast.Op typeOp = (Serialization.op "::" 0 Ast.AssociativityNone)
src/gen-main/haskell/Hydra/Ext/Haskell/Serde.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Haskell operator precendence and associativity are drawn from: -- | https://self-learning-java-tutorial.blogspot.com/2016/04/haskell-operator-precedence.html -- | Other operators were investigated using GHCi, e.g. ":info (->)"@@ -7,38 +9,45 @@ module Hydra.Ext.Haskell.Serde where import qualified Hydra.Ast as Ast+import qualified Hydra.Constants as Constants import qualified Hydra.Ext.Haskell.Ast as Ast_ import qualified Hydra.Ext.Haskell.Operators as Operators import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Serialization as Serialization-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Convert a pattern-matching alternative to an AST expression alternativeToExpr :: (Ast_.Alternative -> Ast.Expr) alternativeToExpr alt = (Serialization.ifx Operators.caseOp (patternToExpr (Ast_.alternativePattern alt)) (caseRhsToExpr (Ast_.alternativeRhs alt))) +-- | Convert a function application expression to an AST expression applicationExpressionToExpr :: (Ast_.ApplicationExpression -> Ast.Expr) applicationExpressionToExpr app = (Serialization.ifx Operators.appOp (expressionToExpr (Ast_.applicationExpressionFunction app)) (expressionToExpr (Ast_.applicationExpressionArgument app))) +-- | Convert an application pattern to an AST expression applicationPatternToExpr :: (Ast_.ApplicationPattern -> Ast.Expr) applicationPatternToExpr appPat = let name = (Ast_.applicationPatternName appPat) pats = (Ast_.applicationPatternArgs appPat) in (Serialization.spaceSep (Lists.cons (nameToExpr name) (Lists.map patternToExpr pats))) +-- | Convert a type class assertion to an AST expression assertionToExpr :: (Ast_.Assertion -> Ast.Expr) assertionToExpr sert = ((\x -> case x of Ast_.AssertionClass v1 -> (classAssertionToExpr v1) Ast_.AssertionTuple v1 -> (Serialization.parenList False (Lists.map assertionToExpr v1))) sert) +-- | Convert a case expression to an AST expression caseExpressionToExpr :: (Ast_.CaseExpression -> Ast.Expr) caseExpressionToExpr caseExpr = let cs = (Ast_.caseExpressionCase caseExpr) @@ -56,55 +65,57 @@ rhs = (Serialization.newlineSep (Lists.map alternativeToExpr alts)) in (Serialization.ifx ofOp lhs rhs) +-- | Convert a case right-hand side to an AST expression caseRhsToExpr :: (Ast_.CaseRhs -> Ast.Expr) caseRhsToExpr rhs = (expressionToExpr (Ast_.unCaseRhs rhs)) +-- | Convert a class assertion to an AST expression classAssertionToExpr :: (Ast_.ClassAssertion -> Ast.Expr) classAssertionToExpr clsAsrt = let name = (Ast_.classAssertionName clsAsrt) types = (Ast_.classAssertionTypes clsAsrt)- in (Serialization.spaceSep [- nameToExpr name,- (Serialization.commaSep Serialization.halfBlockStyle (Lists.map typeToExpr types))])+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.commaSep Serialization.halfBlockStyle (Lists.map typeToExpr types)])) +-- | Convert a data constructor to an AST expression constructorToExpr :: (Ast_.Constructor -> Ast.Expr) constructorToExpr cons = ((\x -> case x of Ast_.ConstructorOrdinary v1 -> let name = (Ast_.ordinaryConstructorName v1) types = (Ast_.ordinaryConstructorFields v1)- in (Serialization.spaceSep [- nameToExpr name,- (Serialization.spaceSep (Lists.map typeToExpr types))])+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.spaceSep (Lists.map typeToExpr types)])) Ast_.ConstructorRecord v1 -> let name = (Ast_.recordConstructorName v1) fields = (Ast_.recordConstructorFields v1)- in (Serialization.spaceSep [- nameToExpr name,- (Serialization.curlyBracesList Nothing Serialization.halfBlockStyle (Lists.map fieldWithCommentsToExpr fields))])) cons)+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.curlyBracesList Nothing Serialization.halfBlockStyle (Lists.map fieldWithCommentsToExpr fields)]))) cons) +-- | Convert a data constructor with comments to an AST expression constructorWithCommentsToExpr :: (Ast_.ConstructorWithComments -> Ast.Expr) constructorWithCommentsToExpr consWithComments = let body = (Ast_.constructorWithCommentsBody consWithComments) mc = (Ast_.constructorWithCommentsComments consWithComments)- in (Optionals.maybe (constructorToExpr body) (\c -> Serialization.newlineSep [- Serialization.cst (toHaskellComments c),- (constructorToExpr body)]) mc)+ in (Maybes.maybe (constructorToExpr body) (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ constructorToExpr body])) mc) +-- | Convert a data/newtype keyword to an AST expression dataOrNewtypeToExpr :: (Ast_.DataOrNewtype -> Ast.Expr) dataOrNewtypeToExpr kw = ((\x -> case x of Ast_.DataOrNewtypeData -> (Serialization.cst "data") Ast_.DataOrNewtypeNewtype -> (Serialization.cst "newtype")) kw) +-- | Convert a declaration head to an AST expression declarationHeadToExpr :: (Ast_.DeclarationHead -> Ast.Expr) declarationHeadToExpr hd = ((\x -> case x of Ast_.DeclarationHeadApplication v1 -> let fun = (Ast_.applicationDeclarationHeadFunction v1) op = (Ast_.applicationDeclarationHeadOperand v1)- in (Serialization.spaceSep [- declarationHeadToExpr fun,- (variableToExpr op)])+ in (Serialization.spaceSep (Lists.cons (declarationHeadToExpr fun) [+ variableToExpr op])) Ast_.DeclarationHeadSimple v1 -> (nameToExpr v1)) hd) +-- | Convert a declaration to an AST expression declarationToExpr :: (Ast_.Declaration -> Ast.Expr) declarationToExpr decl = ((\x -> case x of Ast_.DeclarationData v1 -> @@ -115,42 +126,36 @@ derivCat = (Lists.concat (Lists.map Ast_.unDeriving deriv)) constructors = (Serialization.orSep Serialization.halfBlockStyle (Lists.map constructorWithCommentsToExpr cons)) derivingClause = (Logic.ifElse (Lists.null derivCat) [] [- Serialization.spaceSep [- Serialization.cst "deriving",- (Serialization.parenList False (Lists.map nameToExpr derivCat))]])+ Serialization.spaceSep (Lists.cons (Serialization.cst "deriving") [+ Serialization.parenList False (Lists.map nameToExpr derivCat)])]) mainParts = [- Serialization.spaceSep [- dataOrNewtypeToExpr kw,- declarationHeadToExpr hd,- (Serialization.cst "=")],+ Serialization.spaceSep (Lists.cons (dataOrNewtypeToExpr kw) (Lists.cons (declarationHeadToExpr hd) [+ Serialization.cst "="])), constructors] in (Serialization.indentBlock (Lists.concat2 mainParts derivingClause)) Ast_.DeclarationType v1 -> let hd = (Ast_.typeDeclarationName v1) typ = (Ast_.typeDeclarationType v1)- in (Serialization.spaceSep [- Serialization.cst "type",- declarationHeadToExpr hd,- Serialization.cst "=",- (typeToExpr typ)])+ in (Serialization.spaceSep (Lists.cons (Serialization.cst "type") (Lists.cons (declarationHeadToExpr hd) (Lists.cons (Serialization.cst "=") [+ typeToExpr typ])))) Ast_.DeclarationValueBinding v1 -> (valueBindingToExpr v1) Ast_.DeclarationTypedBinding v1 -> let typeSig = (Ast_.typedBindingTypeSignature v1) vb = (Ast_.typedBindingValueBinding v1) name = (Ast_.typeSignatureName typeSig) htype = (Ast_.typeSignatureType typeSig)- in (Serialization.newlineSep [- Serialization.ifx Operators.typeOp (nameToExpr name) (typeToExpr htype),- (valueBindingToExpr vb)])) decl)+ in (Serialization.newlineSep (Lists.cons (Serialization.ifx Operators.typeOp (nameToExpr name) (typeToExpr htype)) [+ valueBindingToExpr vb]))) decl) +-- | Convert a declaration with comments to an AST expression declarationWithCommentsToExpr :: (Ast_.DeclarationWithComments -> Ast.Expr) declarationWithCommentsToExpr declWithComments = let body = (Ast_.declarationWithCommentsBody declWithComments) mc = (Ast_.declarationWithCommentsComments declWithComments)- in (Optionals.maybe (declarationToExpr body) (\c -> Serialization.newlineSep [- Serialization.cst (toHaskellComments c),- (declarationToExpr body)]) mc)+ in (Maybes.maybe (declarationToExpr body) (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ declarationToExpr body])) mc) +-- | Convert a Haskell expression to an AST expression expressionToExpr :: (Ast_.Expression -> Ast.Expr) expressionToExpr expr = ((\x -> case x of Ast_.ExpressionApplication v1 -> (applicationExpressionToExpr v1)@@ -164,19 +169,16 @@ let bindings = (Ast_.letExpressionBindings v1) inner = (Ast_.letExpressionInner v1) encodeBinding = (\binding -> Serialization.indentSubsequentLines " " (localBindingToExpr binding))- in (Serialization.indentBlock [- Serialization.cst "",- Serialization.spaceSep [- Serialization.cst "let",- (Serialization.customIndentBlock " " (Lists.map encodeBinding bindings))],- (Serialization.spaceSep [- Serialization.cst "in",- (expressionToExpr inner)])])+ in (Serialization.indentBlock (Lists.cons (Serialization.cst "") (Lists.cons (Serialization.spaceSep (Lists.cons (Serialization.cst "let") [+ Serialization.customIndentBlock " " (Lists.map encodeBinding bindings)])) [+ Serialization.spaceSep (Lists.cons (Serialization.cst "in") [+ expressionToExpr inner])]))) Ast_.ExpressionList v1 -> (Serialization.bracketList Serialization.halfBlockStyle (Lists.map expressionToExpr v1)) Ast_.ExpressionParens v1 -> (Serialization.parenthesize (expressionToExpr v1)) Ast_.ExpressionTuple v1 -> (Serialization.parenList False (Lists.map expressionToExpr v1)) Ast_.ExpressionVariable v1 -> (nameToExpr v1)) expr) +-- | Convert a record construction expression to an AST expression constructRecordExpressionToExpr :: (Ast_.ConstructRecordExpression -> Ast.Expr) constructRecordExpressionToExpr constructRecord = let name = (Ast_.constructRecordExpressionName constructRecord) @@ -186,27 +188,26 @@ val = (Ast_.fieldUpdateValue update) in (Serialization.ifx Operators.defineOp (nameToExpr fn) (expressionToExpr val))) body = (Serialization.commaSep Serialization.halfBlockStyle (Lists.map fromUpdate updates))- in (Serialization.spaceSep [- nameToExpr name,- (Serialization.brackets Serialization.curlyBraces Serialization.halfBlockStyle body)])+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) [+ Serialization.brackets Serialization.curlyBraces Serialization.halfBlockStyle body])) +-- | Convert a field declaration to an AST expression fieldToExpr :: (Ast_.Field -> Ast.Expr) fieldToExpr field = let name = (Ast_.fieldName field) typ = (Ast_.fieldType field)- in (Serialization.spaceSep [- nameToExpr name,- Serialization.cst "::",- (typeToExpr typ)])+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) (Lists.cons (Serialization.cst "::") [+ typeToExpr typ]))) +-- | Convert a field with comments to an AST expression fieldWithCommentsToExpr :: (Ast_.FieldWithComments -> Ast.Expr) fieldWithCommentsToExpr fieldWithComments = let field = (Ast_.fieldWithCommentsField fieldWithComments) mc = (Ast_.fieldWithCommentsComments fieldWithComments)- in (Optionals.maybe (fieldToExpr field) (\c -> Serialization.newlineSep [- Serialization.cst (toHaskellComments c),- (fieldToExpr field)]) mc)+ in (Maybes.maybe (fieldToExpr field) (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) [+ fieldToExpr field])) mc) +-- | Convert an if-then-else expression to an AST expression ifExpressionToExpr :: (Ast_.IfExpression -> Ast.Expr) ifExpressionToExpr ifExpr = let eif = (Ast_.ifExpressionCondition ifExpr) @@ -219,20 +220,18 @@ Ast.paddingRight = (Ast.WsBreakAndIndent " ")}, Ast.opPrecedence = (Ast.Precedence 0), Ast.opAssociativity = Ast.AssociativityNone}- body = (Serialization.newlineSep [- Serialization.spaceSep [- Serialization.cst "then",- (expressionToExpr ethen)],- (Serialization.spaceSep [- Serialization.cst "else",- (expressionToExpr eelse)])])- in (Serialization.ifx ifOp (Serialization.spaceSep [- Serialization.cst "if",- (expressionToExpr eif)]) body)+ body = (Serialization.newlineSep (Lists.cons (Serialization.spaceSep (Lists.cons (Serialization.cst "then") [+ expressionToExpr ethen])) [+ Serialization.spaceSep (Lists.cons (Serialization.cst "else") [+ expressionToExpr eelse])]))+ in (Serialization.ifx ifOp (Serialization.spaceSep (Lists.cons (Serialization.cst "if") [+ expressionToExpr eif])) body) +-- | Convert an import/export specification to an AST expression importExportSpecToExpr :: (Ast_.ImportExportSpec -> Ast.Expr) importExportSpecToExpr spec = (nameToExpr (Ast_.importExportSpecName spec)) +-- | Convert an import statement to an AST expression importToExpr :: (Ast_.Import -> Ast.Expr) importToExpr import_ = let qual = (Ast_.importQualified import_) @@ -241,17 +240,17 @@ mspec = (Ast_.importSpec import_) name = (Ast_.unModuleName modName) hidingSec = (\spec -> (\x -> case x of- Ast_.SpecImportHiding v1 -> (Serialization.spaceSep [- Serialization.cst "hiding ",- (Serialization.parens (Serialization.commaSep Serialization.inlineStyle (Lists.map importExportSpecToExpr v1)))])) spec)- parts = (Optionals.cat [+ Ast_.SpecImportHiding v1 -> (Serialization.spaceSep (Lists.cons (Serialization.cst "hiding ") [+ Serialization.parens (Serialization.commaSep Serialization.inlineStyle (Lists.map importExportSpecToExpr v1))]))) spec)+ parts = (Maybes.cat [ Just (Serialization.cst "import"),- Logic.ifElse qual (Just (Serialization.cst "qualified")) Nothing,- Just (Serialization.cst name),- Optionals.map (\m -> Serialization.cst (Strings.cat2 "as " (Ast_.unModuleName m))) mod,- (Optionals.map hidingSec mspec)])+ (Logic.ifElse qual (Just (Serialization.cst "qualified")) Nothing),+ (Just (Serialization.cst name)),+ (Maybes.map (\m -> Serialization.cst (Strings.cat2 "as " (Ast_.unModuleName m))) mod),+ (Maybes.map hidingSec mspec)]) in (Serialization.spaceSep parts) +-- | Convert a lambda expression to an AST expression lambdaExpressionToExpr :: (Ast_.LambdaExpression -> Ast.Expr) lambdaExpressionToExpr lambdaExpr = let bindings = (Ast_.lambdaExpressionBindings lambdaExpr) @@ -260,58 +259,68 @@ body = (expressionToExpr inner) in (Serialization.ifx Operators.lambdaOp (Serialization.prefix "\\" head) body) +-- | Convert a literal value to an AST expression literalToExpr :: (Ast_.Literal -> Ast.Expr)-literalToExpr lit = (Serialization.cst ((\x -> case x of- Ast_.LiteralChar v1 -> (Literals.showString (Literals.showUint16 v1))- Ast_.LiteralDouble v1 -> (Logic.ifElse (Equality.lt v1 0.0) (Strings.cat2 "(0" (Strings.cat2 (Literals.showFloat64 v1) ")")) (Literals.showFloat64 v1))- Ast_.LiteralFloat v1 -> (Logic.ifElse (Equality.lt v1 0.0) (Strings.cat2 "(0" (Strings.cat2 (Literals.showFloat32 v1) ")")) (Literals.showFloat32 v1))- Ast_.LiteralInt v1 -> (Logic.ifElse (Equality.lt v1 0) (Strings.cat2 "(0" (Strings.cat2 (Literals.showInt32 v1) ")")) (Literals.showInt32 v1))- Ast_.LiteralInteger v1 -> (Literals.showBigint v1)- Ast_.LiteralString v1 -> (Literals.showString v1)) lit))+literalToExpr lit = + let parensIfNeg = (\b -> \e -> Logic.ifElse b (Strings.cat [+ "(",+ e,+ ")"]) e)+ in (Serialization.cst ((\x -> case x of+ Ast_.LiteralChar v1 -> (Literals.showString (Literals.showUint16 v1))+ Ast_.LiteralDouble v1 -> (parensIfNeg (Equality.lt v1 0.0) (Literals.showFloat64 v1))+ Ast_.LiteralFloat v1 -> (parensIfNeg (Equality.lt v1 0.0) (Literals.showFloat32 v1))+ Ast_.LiteralInt v1 -> (parensIfNeg (Equality.lt v1 0) (Literals.showInt32 v1))+ Ast_.LiteralInteger v1 -> (parensIfNeg (Equality.lt v1 0) (Literals.showBigint v1))+ Ast_.LiteralString v1 -> (Literals.showString v1)) lit)) +-- | Convert a local binding to an AST expression localBindingToExpr :: (Ast_.LocalBinding -> Ast.Expr) localBindingToExpr binding = ((\x -> case x of Ast_.LocalBindingSignature v1 -> (typeSignatureToExpr v1) Ast_.LocalBindingValue v1 -> (valueBindingToExpr v1)) binding) +-- | Convert a module head to an AST expression moduleHeadToExpr :: (Ast_.ModuleHead -> Ast.Expr) moduleHeadToExpr moduleHead = let mc = (Ast_.moduleHeadComments moduleHead) modName = (Ast_.moduleHeadName moduleHead) mname = (Ast_.unModuleName modName)- head = (Serialization.spaceSep [- Serialization.cst "module",- Serialization.cst mname,- (Serialization.cst "where")])- in (Optionals.maybe head (\c -> Serialization.newlineSep [- Serialization.cst (toHaskellComments c),- Serialization.cst "",- head]) mc)+ head = (Serialization.spaceSep (Lists.cons (Serialization.cst "module") (Lists.cons (Serialization.cst mname) [+ Serialization.cst "where"])))+ in (Maybes.maybe head (\c -> Serialization.newlineSep (Lists.cons (Serialization.cst (toHaskellComments c)) (Lists.cons (Serialization.cst "") [+ head]))) mc) +-- | Convert a Haskell module to an AST expression moduleToExpr :: (Ast_.Module -> Ast.Expr) moduleToExpr module_ = let mh = (Ast_.moduleHead module_) imports = (Ast_.moduleImports module_) decls = (Ast_.moduleDeclarations module_)- headerLine = (Optionals.maybe [] (\h -> [+ warning = [+ Serialization.cst (toSimpleComments Constants.warningAutoGeneratedFile)]+ headerLine = (Maybes.maybe [] (\h -> [ moduleHeadToExpr h]) mh) declLines = (Lists.map declarationWithCommentsToExpr decls) importLines = (Logic.ifElse (Lists.null imports) [] [ Serialization.newlineSep (Lists.map importToExpr imports)]) in (Serialization.doubleNewlineSep (Lists.concat [+ warning, headerLine, importLines, declLines])) +-- | Convert a Haskell name to an AST expression nameToExpr :: (Ast_.Name -> Ast.Expr) nameToExpr name = (Serialization.cst ((\x -> case x of Ast_.NameImplicit v1 -> (Strings.cat2 "?" (writeQualifiedName v1)) Ast_.NameNormal v1 -> (writeQualifiedName v1) Ast_.NameParens v1 -> (Strings.cat [ "(",- writeQualifiedName v1,+ (writeQualifiedName v1), ")"])) name)) +-- | Convert a pattern to an AST expression patternToExpr :: (Ast_.Pattern -> Ast.Expr) patternToExpr pat = ((\x -> case x of Ast_.PatternApplication v1 -> (applicationPatternToExpr v1)@@ -322,21 +331,23 @@ Ast_.PatternTuple v1 -> (Serialization.parenList False (Lists.map patternToExpr v1)) Ast_.PatternWildcard -> (Serialization.cst "_")) pat) +-- | Convert a right-hand side to an AST expression rightHandSideToExpr :: (Ast_.RightHandSide -> Ast.Expr) rightHandSideToExpr rhs = (expressionToExpr (Ast_.unRightHandSide rhs)) +-- | Convert a statement to an AST expression statementToExpr :: (Ast_.Statement -> Ast.Expr) statementToExpr stmt = (expressionToExpr (Ast_.unStatement stmt)) +-- | Convert a type signature to an AST expression typeSignatureToExpr :: (Ast_.TypeSignature -> Ast.Expr) typeSignatureToExpr typeSig = let name = (Ast_.typeSignatureName typeSig) typ = (Ast_.typeSignatureType typeSig)- in (Serialization.spaceSep [- nameToExpr name,- Serialization.cst "::",- (typeToExpr typ)])+ in (Serialization.spaceSep (Lists.cons (nameToExpr name) (Lists.cons (Serialization.cst "::") [+ typeToExpr typ]))) +-- | Convert a Haskell type to an AST expression typeToExpr :: (Ast_.Type -> Ast.Expr) typeToExpr htype = ((\x -> case x of Ast_.TypeApplication v1 -> @@ -356,6 +367,7 @@ Ast_.TypeTuple v1 -> (Serialization.parenList False (Lists.map typeToExpr v1)) Ast_.TypeVariable v1 -> (nameToExpr v1)) htype) +-- | Convert a value binding to an AST expression valueBindingToExpr :: (Ast_.ValueBinding -> Ast.Expr) valueBindingToExpr vb = ((\x -> case x of Ast_.ValueBindingSimple v1 -> @@ -363,18 +375,24 @@ rhs = (Ast_.simpleValueBindingRhs v1) local = (Ast_.simpleValueBindingLocalBindings v1) body = (Serialization.ifx Operators.defineOp (patternToExpr pat) (rightHandSideToExpr rhs))- in (Optionals.maybe body (\localBindings -> + in (Maybes.maybe body (\localBindings -> let bindings = (Ast_.unLocalBindings localBindings)- in (Serialization.indentBlock [- body,- (Serialization.indentBlock (Lists.cons (Serialization.cst "where") (Lists.map localBindingToExpr bindings)))])) local)) vb)+ in (Serialization.indentBlock (Lists.cons body [+ Serialization.indentBlock (Lists.cons (Serialization.cst "where") (Lists.map localBindingToExpr bindings))]))) local)) vb) +-- | Convert a type variable to an AST expression variableToExpr :: (Ast_.Variable -> Ast.Expr) variableToExpr variable = (nameToExpr (Ast_.unVariable variable)) +-- | Convert a string to Haddock documentation comments toHaskellComments :: (String -> String) toHaskellComments c = (Strings.intercalate "\n" (Lists.map (\s -> Strings.cat2 "-- | " s) (Strings.lines c))) +-- | Convert a string to simple line comments+toSimpleComments :: (String -> String)+toSimpleComments c = (Strings.intercalate "\n" (Lists.map (\s -> Strings.cat2 "-- " s) (Strings.lines c)))++-- | Write a qualified name as a string writeQualifiedName :: (Ast_.QualifiedName -> String) writeQualifiedName qname = let qualifiers = (Ast_.qualifiedNameQualifiers qname)
src/gen-main/haskell/Hydra/Ext/Haskell/Utils.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for working with Haskell syntax trees module Hydra.Ext.Haskell.Utils where@@ -13,93 +15,114 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Module as Module import qualified Hydra.Names as Names import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Schemas as Schemas-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Create an application pattern from a name and argument patterns applicationPattern :: (Ast.Name -> [Ast.Pattern] -> Ast.Pattern) applicationPattern name args = (Ast.PatternApplication (Ast.ApplicationPattern { Ast.applicationPatternName = name, Ast.applicationPatternArgs = args})) +-- | Generate a Haskell name reference for a Hydra element elementReference :: (Module.Namespaces Ast.ModuleName -> Core.Name -> Ast.Name) elementReference namespaces name = let namespacePair = (Module.namespacesFocus namespaces) - gname = (fst namespacePair)- gmod = (Ast.unModuleName (snd namespacePair))+ gname = (Pairs.first namespacePair)+ gmod = (Ast.unModuleName (Pairs.second namespacePair)) namespacesMap = (Module.namespacesMapping namespaces) qname = (Names.qualifyName name) local = (Module.qualifiedNameLocal qname) escLocal = (sanitizeHaskellName local) mns = (Module.qualifiedNameNamespace qname)- in (Optionals.cases (Module.qualifiedNameNamespace qname) (simpleName local) (\ns -> Optionals.cases (Maps.lookup ns namespacesMap) (simpleName local) (\mn -> + in (Maybes.cases (Module.qualifiedNameNamespace qname) (simpleName local) (\ns -> Maybes.cases (Maps.lookup ns namespacesMap) (simpleName local) (\mn -> let aliasStr = (Ast.unModuleName mn) in (Logic.ifElse (Equality.equal ns gname) (simpleName escLocal) (rawName (Strings.cat [ aliasStr, ".", (sanitizeHaskellName local)])))))) +-- | Create a Haskell function application expression hsapp :: (Ast.Expression -> Ast.Expression -> Ast.Expression) hsapp l r = (Ast.ExpressionApplication (Ast.ApplicationExpression { Ast.applicationExpressionFunction = l, Ast.applicationExpressionArgument = r})) +-- | Create a Haskell lambda expression hslambda :: (Ast.Name -> Ast.Expression -> Ast.Expression) hslambda name rhs = (Ast.ExpressionLambda (Ast.LambdaExpression { Ast.lambdaExpressionBindings = [ Ast.PatternName name], Ast.lambdaExpressionInner = rhs})) +-- | Create a Haskell literal expression hslit :: (Ast.Literal -> Ast.Expression) hslit lit = (Ast.ExpressionLiteral lit) +-- | Create a Haskell variable expression from a string hsvar :: (String -> Ast.Expression) hsvar s = (Ast.ExpressionVariable (rawName s)) +-- | Compute the Haskell module namespaces for a Hydra module namespacesForModule :: (Module.Module -> Compute.Flow Graph.Graph (Module.Namespaces Ast.ModuleName)) namespacesForModule mod = (Flows.bind (Schemas.moduleDependencyNamespaces True True True True mod) (\nss -> - let ns = (Module.moduleNamespace mod) - focusPair = (toPair ns)- nssAsList = (Sets.toList nss)- nssPairs = (Lists.map toPair nssAsList)- emptyState = (Maps.empty, Sets.empty)- finalState = (Lists.foldl addPair emptyState nssPairs)- resultMap = (fst finalState)- toModuleName = (\namespace -> - let namespaceStr = (Module.unNamespace namespace) - parts = (Strings.splitOn "." namespaceStr)- lastPart = (Lists.last parts)- capitalized = (Formatting.capitalize lastPart)- in (Ast.ModuleName capitalized))- toPair = (\name -> (name, (toModuleName name)))- addPair = (\state -> \namePair -> - let currentMap = (fst state) - currentSet = (snd state)- name = (fst namePair)- alias = (snd namePair)- aliasStr = (Ast.unModuleName alias)- in (Logic.ifElse (Sets.member alias currentSet) (addPair state (name, (Ast.ModuleName (Strings.cat2 aliasStr "_")))) (Maps.insert name alias currentMap, (Sets.insert alias currentSet))))- in (Flows.pure (Module.Namespaces {- Module.namespacesFocus = focusPair,- Module.namespacesMapping = resultMap}))))+ let ns = (Module.moduleNamespace mod)+ in + let toModuleName = (\namespace -> + let namespaceStr = (Module.unNamespace namespace) + parts = (Strings.splitOn "." namespaceStr)+ lastPart = (Lists.last parts)+ capitalized = (Formatting.capitalize lastPart)+ in (Ast.ModuleName capitalized))+ in + let toPair = (\name -> (name, (toModuleName name)))+ in + let addPair = (\state -> \namePair -> + let currentMap = (Pairs.first state) + currentSet = (Pairs.second state)+ name = (Pairs.first namePair)+ alias = (Pairs.second namePair)+ aliasStr = (Ast.unModuleName alias)+ in (Logic.ifElse (Sets.member alias currentSet) (addPair state (name, (Ast.ModuleName (Strings.cat2 aliasStr "_")))) (Maps.insert name alias currentMap, (Sets.insert alias currentSet))))+ in + let focusPair = (toPair ns)+ in + let nssAsList = (Sets.toList nss)+ in + let nssPairs = (Lists.map toPair nssAsList)+ in + let emptyState = (Maps.empty, Sets.empty)+ in + let finalState = (Lists.foldl addPair emptyState nssPairs)+ in + let resultMap = (Pairs.first finalState)+ in (Flows.pure (Module.Namespaces {+ Module.namespacesFocus = focusPair,+ Module.namespacesMapping = resultMap})))) +-- | Generate an accessor name for a newtype wrapper (e.g., 'unFoo' for Foo) newtypeAccessorName :: (Core.Name -> String) newtypeAccessorName name = (Strings.cat2 "un" (Names.localNameOf name)) +-- | Create a raw Haskell name from a string without sanitization rawName :: (String -> Ast.Name) rawName n = (Ast.NameNormal (Ast.QualifiedName { Ast.qualifiedNameQualifiers = [], Ast.qualifiedNameUnqualified = (Ast.NamePart n)})) +-- | Generate a Haskell name for a record field accessor recordFieldReference :: (Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Name -> Ast.Name) recordFieldReference namespaces sname fname = let fnameStr = (Core.unName fname) @@ -115,12 +138,15 @@ unqualName = (Names.unqualifyName qualName) in (elementReference namespaces unqualName) +-- | Sanitize a string to be a valid Haskell identifier, escaping reserved words sanitizeHaskellName :: (String -> String) sanitizeHaskellName = (Formatting.sanitizeWithUnderscores Language.reservedWords) +-- | Create a sanitized Haskell name from a string simpleName :: (String -> Ast.Name) simpleName arg_ = (rawName (sanitizeHaskellName arg_)) +-- | Create a simple value binding (e.g., 'foo = expr' or 'foo = expr where ...') simpleValueBinding :: (Ast.Name -> Ast.Expression -> Maybe Ast.LocalBindings -> Ast.ValueBinding) simpleValueBinding hname rhs bindings = let pat = (Ast.PatternApplication (Ast.ApplicationPattern {@@ -132,6 +158,7 @@ Ast.simpleValueBindingRhs = rightHandSide, Ast.simpleValueBindingLocalBindings = bindings})) +-- | Convert a list of types into a nested type application toTypeApplication :: ([Ast.Type] -> Ast.Type) toTypeApplication types = let app = (\l -> Logic.ifElse (Equality.gt (Lists.length l) 1) (Ast.TypeApplication (Ast.ApplicationType {@@ -139,34 +166,42 @@ Ast.applicationTypeArgument = (Lists.head l)})) (Lists.head l)) in (app (Lists.reverse types)) +-- | Extract the local type name from a fully qualified record type name typeNameForRecord :: (Core.Name -> String) typeNameForRecord sname = let snameStr = (Core.unName sname) parts = (Strings.splitOn "." snameStr) in (Lists.last parts) -unionFieldReference :: (Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Name -> Ast.Name)-unionFieldReference namespaces sname fname = +-- | Generate a Haskell name for a union variant constructor, with disambiguation+unionFieldReference :: (Graph.Graph -> Module.Namespaces Ast.ModuleName -> Core.Name -> Core.Name -> Ast.Name)+unionFieldReference g namespaces sname fname = let fnameStr = (Core.unName fname) qname = (Names.qualifyName sname) ns = (Module.qualifiedNameNamespace qname) typeNameStr = (typeNameForRecord sname) capitalizedTypeName = (Formatting.capitalize typeNameStr) capitalizedFieldName = (Formatting.capitalize fnameStr)- nm = (Strings.cat2 capitalizedTypeName capitalizedFieldName)+ deconflict = (\name -> + let tname = (Names.unqualifyName (Module.QualifiedName {+ Module.qualifiedNameNamespace = ns,+ Module.qualifiedNameLocal = name}))+ in (Logic.ifElse (Maybes.isJust (Lists.find (\b -> Equality.equal (Core.bindingName b) tname) (Graph.graphElements g))) (deconflict (Strings.cat2 name "_")) name))+ nm = (deconflict (Strings.cat2 capitalizedTypeName capitalizedFieldName)) qualName = Module.QualifiedName { Module.qualifiedNameNamespace = ns, Module.qualifiedNameLocal = nm} unqualName = (Names.unqualifyName qualName) in (elementReference namespaces unqualName) +-- | Unpack nested forall types into a list of type variables and the inner type unpackForallType :: (t0 -> Core.Type -> ([Core.Name], Core.Type)) unpackForallType cx t = ((\x -> case x of Core.TypeForall v1 -> let v = (Core.forallTypeParameter v1) tbody = (Core.forallTypeBody v1) recursiveResult = (unpackForallType cx tbody)- vars = (fst recursiveResult)- finalType = (snd recursiveResult)+ vars = (Pairs.first recursiveResult)+ finalType = (Pairs.second recursiveResult) in (Lists.cons v vars, finalType) _ -> ([], t)) (Rewriting.deannotateType t))
src/gen-main/haskell/Hydra/Ext/Org/Json/Coder.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | JSON encoding and decoding for Hydra terms module Hydra.Ext.Org.Json.Coder where@@ -10,293 +12,378 @@ import qualified Hydra.Ext.Org.Json.Language as Language import qualified Hydra.Extract.Core as Core__ import qualified Hydra.Graph as Graph-import qualified Hydra.Json as Json+import qualified Hydra.Json.Model as Model import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Literals as Literals_ import qualified Hydra.Monads as Monads import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core___-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -jsonCoder :: (Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph t0 Core.Term Json.Value))+-- | Create a JSON coder for a given type+jsonCoder :: (Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph t0 Core.Term Model.Value)) jsonCoder typ = (Flows.bind (Modules.languageAdapter Language.jsonLanguage typ) (\adapter -> Flows.bind (termCoder (Compute.adapterTarget adapter)) (\coder -> Flows.pure (Utils.composeCoders (Compute.adapterCoder adapter) coder)))) -literalJsonCoder :: (Core.LiteralType -> Compute.Flow t0 (Compute.Coder t1 t2 Core.Literal Json.Value))-literalJsonCoder lt = (Flows.pure ((\x -> case x of- Core.LiteralTypeBoolean -> Compute.Coder {- Compute.coderEncode = (\lit -> Flows.bind (Core__.booleanLiteral lit) (\b -> Flows.pure (Json.ValueBoolean b))),- Compute.coderDecode = (\s -> (\x -> case x of- Json.ValueBoolean v2 -> (Flows.pure (Core.LiteralBoolean v2))- _ -> (Monads.unexpected "boolean" (showValue s))) s)}- Core.LiteralTypeFloat _ -> Compute.Coder {- Compute.coderEncode = (\lit -> Flows.bind (Core__.floatLiteral lit) (\f -> Flows.bind (Core__.bigfloatValue f) (\bf -> Flows.pure (Json.ValueNumber bf)))),- Compute.coderDecode = (\s -> (\x -> case x of- Json.ValueNumber v2 -> (Flows.pure (Core.LiteralFloat (Core.FloatValueBigfloat v2)))- _ -> (Monads.unexpected "number" (showValue s))) s)}- Core.LiteralTypeInteger _ -> Compute.Coder {- Compute.coderEncode = (\lit -> Flows.bind (Core__.integerLiteral lit) (\i -> Flows.bind (Core__.bigintValue i) (\bi -> Flows.pure (Json.ValueNumber (Literals.bigintToBigfloat bi))))),- Compute.coderDecode = (\s -> (\x -> case x of- Json.ValueNumber v2 -> - let bi = (Literals.bigfloatToBigint v2)- in (Flows.pure (Core.LiteralInteger (Core.IntegerValueBigint bi)))- _ -> (Monads.unexpected "number" (showValue s))) s)}- Core.LiteralTypeString -> Compute.Coder {- Compute.coderEncode = (\lit -> Flows.bind (Core__.stringLiteral lit) (\s -> Flows.pure (Json.ValueString s))),- Compute.coderDecode = (\s -> (\x -> case x of- Json.ValueString v2 -> (Flows.pure (Core.LiteralString v2))- _ -> (Monads.unexpected "string" (showValue s))) s)}) lt))+-- | Create a JSON coder for literal types+literalJsonCoder :: (Core.LiteralType -> Compute.Flow t0 (Compute.Coder t1 t2 Core.Literal Model.Value))+literalJsonCoder lt = + let decodeBool = (\s -> (\x -> case x of+ Model.ValueBoolean v1 -> (Flows.pure (Core.LiteralBoolean v1))+ _ -> (Monads.unexpected "boolean" (showValue s))) s)+ in + let decodeFloat = (\s -> (\x -> case x of+ Model.ValueNumber v1 -> (Flows.pure (Core.LiteralFloat (Core.FloatValueBigfloat v1)))+ _ -> (Monads.unexpected "number" (showValue s))) s)+ in + let decodeInteger = (\s -> (\x -> case x of+ Model.ValueNumber v1 -> + let bi = (Literals.bigfloatToBigint v1)+ in (Flows.pure (Core.LiteralInteger (Core.IntegerValueBigint bi)))+ _ -> (Monads.unexpected "number" (showValue s))) s)+ in + let decodeString = (\s -> (\x -> case x of+ Model.ValueString v1 -> (Flows.pure (Core.LiteralString v1))+ _ -> (Monads.unexpected "string" (showValue s))) s)+ in + let encoded = ((\x -> case x of+ Core.LiteralTypeBoolean -> Compute.Coder {+ Compute.coderEncode = (\lit -> Flows.bind (Core__.booleanLiteral lit) (\b -> Flows.pure (Model.ValueBoolean b))),+ Compute.coderDecode = decodeBool}+ Core.LiteralTypeFloat _ -> Compute.Coder {+ Compute.coderEncode = (\lit -> Flows.bind (Core__.floatLiteral lit) (\f -> Flows.bind (Core__.bigfloatValue f) (\bf -> Flows.pure (Model.ValueNumber bf)))),+ Compute.coderDecode = decodeFloat}+ Core.LiteralTypeInteger _ -> Compute.Coder {+ Compute.coderEncode = (\lit -> Flows.bind (Core__.integerLiteral lit) (\i -> Flows.bind (Core__.bigintValue i) (\bi -> Flows.pure (Model.ValueNumber (Literals.bigintToBigfloat bi))))),+ Compute.coderDecode = decodeInteger}+ Core.LiteralTypeString -> Compute.Coder {+ Compute.coderEncode = (\lit -> Flows.bind (Core__.stringLiteral lit) (\s -> Flows.pure (Model.ValueString s))),+ Compute.coderDecode = decodeString}) lt)+ in (Flows.pure encoded) -recordCoder :: (Core.RowType -> Compute.Flow t0 (Compute.Coder Graph.Graph t1 Core.Term Json.Value))+-- | Create a JSON coder for record types+recordCoder :: (Core.RowType -> Compute.Flow t0 (Compute.Coder Graph.Graph t1 Core.Term Model.Value)) recordCoder rt = - let fields = (Core.rowTypeFields rt) - getCoder = (\f -> Flows.bind (termCoder (Core.fieldTypeType f)) (\coder -> Flows.pure (f, coder)))- in (Flows.bind (Flows.mapList getCoder fields) (\coders -> Flows.pure (Compute.Coder {- Compute.coderEncode = (encodeRecord coders),- Compute.coderDecode = (decodeRecord rt coders)})))+ let fields = (Core.rowTypeFields rt)+ in + let getCoder = (\f -> Flows.bind (termCoder (Core.fieldTypeType f)) (\coder -> Flows.pure (f, coder)))+ in (Flows.bind (Flows.mapList getCoder fields) (\coders -> Flows.pure (Compute.Coder {+ Compute.coderEncode = (encodeRecord coders),+ Compute.coderDecode = (decodeRecord rt coders)}))) -encodeRecord :: ([(Core.FieldType, (Compute.Coder Graph.Graph t0 Core.Term Json.Value))] -> Core.Term -> Compute.Flow Graph.Graph Json.Value)+-- | Encode a record term to JSON+encodeRecord :: ([(Core.FieldType, (Compute.Coder Graph.Graph t0 Core.Term Model.Value))] -> Core.Term -> Compute.Flow Graph.Graph Model.Value) encodeRecord coders term = let stripped = (Rewriting.deannotateTerm term)- in (Flows.bind (Core__.termRecord stripped) (\record -> - let fields = (Core.recordFields record) - encodeField = (\coderAndField -> - let coder = (fst coderAndField) - field = (snd coderAndField)- ft = (fst coder)- coder_ = (snd coder)- fname = (Core.fieldName field)- fvalue = (Core.fieldTerm field)- in ((\x -> case x of- Core.TypeOptional _ -> ((\x -> case x of- Core.TermOptional v2 -> (Optionals.maybe (Flows.pure Nothing) (\v -> Flows.bind (Compute.coderEncode coder_ v) (\encoded -> Flows.pure (Just (Core.unName fname, encoded)))) v2)- _ -> (Flows.bind (Compute.coderEncode coder_ fvalue) (\encoded -> Flows.pure (Just (Core.unName fname, encoded))))) fvalue)- _ -> (Flows.bind (Compute.coderEncode coder_ fvalue) (\encoded -> Flows.pure (Just (Core.unName fname, encoded))))) (Core.fieldTypeType ft)))- in (Flows.bind (Flows.mapList encodeField (Lists.zip coders fields)) (\maybeFields -> Flows.pure (Json.ValueObject (Maps.fromList (Optionals.cat maybeFields)))))))+ in + let matchMaybeTerm = (\fvalue -> \coder_ -> \fname -> \dflt -> (\x -> case x of+ Core.TermMaybe v1 -> (Maybes.maybe (Flows.pure Nothing) (\v -> Flows.bind (Compute.coderEncode coder_ v) (\encoded -> Flows.pure (Just (Core.unName fname, encoded)))) v1)+ _ -> dflt) fvalue)+ in + let matchTypeForMaybe = (\ft -> \forMaybe -> \dflt -> (\x -> case x of+ Core.TypeMaybe v1 -> (forMaybe v1)+ _ -> dflt) (Core.fieldTypeType ft))+ in + let encodeField = (\coderAndField -> + let coder = (Pairs.first coderAndField)+ in + let field = (Pairs.second coderAndField)+ in + let ft = (Pairs.first coder)+ in + let coder_ = (Pairs.second coder)+ in + let fname = (Core.fieldName field)+ in + let fvalue = (Core.fieldTerm field)+ in + let forMaybe = (\ot -> + let dflt = (Flows.bind (Compute.coderEncode coder_ fvalue) (\encoded -> Flows.pure (Just (Core.unName fname, encoded))))+ in (matchMaybeTerm fvalue coder_ fname dflt))+ in + let dflt = (Flows.bind (Compute.coderEncode coder_ fvalue) (\encoded -> Flows.pure (Just (Core.unName fname, encoded))))+ in (matchTypeForMaybe ft forMaybe dflt))+ in (Flows.bind (Core__.termRecord stripped) (\record -> + let fields = (Core.recordFields record)+ in (Flows.bind (Flows.mapList encodeField (Lists.zip coders fields)) (\maybeFields -> Flows.pure (Model.ValueObject (Maps.fromList (Maybes.cat maybeFields))))))) -decodeRecord :: (Core.RowType -> [(Core.FieldType, (Compute.Coder t0 t1 Core.Term Json.Value))] -> Json.Value -> Compute.Flow t1 Core.Term)-decodeRecord rt coders n = ((\x -> case x of- Json.ValueObject v1 -> - let decodeField = (\coder -> - let ft = (fst coder) - coder_ = (snd coder)- fname = (Core.fieldTypeName ft)- defaultValue = Json.ValueNull- jsonValue = (Optionals.fromMaybe defaultValue (Maps.lookup (Core.unName fname) v1))- in (Flows.bind (Compute.coderDecode coder_ jsonValue) (\v -> Flows.pure (Core.Field {- Core.fieldName = fname,- Core.fieldTerm = v}))))- in (Flows.bind (Flows.mapList decodeField coders) (\fields -> Flows.pure (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.rowTypeTypeName rt),- Core.recordFields = fields}))))- _ -> (Monads.unexpected "object" (showValue n))) n)+-- | Decode a JSON value to a record term+decodeRecord :: (Core.RowType -> [(Core.FieldType, (Compute.Coder t0 t1 Core.Term Model.Value))] -> Model.Value -> Compute.Flow t1 Core.Term)+decodeRecord rt coders n = + let decodeObjectBody = (\m -> + let decodeField = (\coder -> + let ft = (Pairs.first coder)+ in + let coder_ = (Pairs.second coder)+ in + let fname = (Core.fieldTypeName ft)+ in + let defaultValue = Model.ValueNull+ in + let jsonValue = (Maybes.fromMaybe defaultValue (Maps.lookup (Core.unName fname) m))+ in (Flows.bind (Compute.coderDecode coder_ jsonValue) (\v -> Flows.pure (Core.Field {+ Core.fieldName = fname,+ Core.fieldTerm = v}))))+ in (Flows.bind (Flows.mapList decodeField coders) (\fields -> Flows.pure (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.rowTypeTypeName rt),+ Core.recordFields = fields})))))+ in + let result = ((\x -> case x of+ Model.ValueObject v1 -> (decodeObjectBody v1)+ _ -> (Monads.unexpected "object" (showValue n))) n)+ in result -termCoder :: (Core.Type -> Compute.Flow t0 (Compute.Coder Graph.Graph t1 Core.Term Json.Value))+-- | Create a JSON coder for term types+termCoder :: (Core.Type -> Compute.Flow t0 (Compute.Coder Graph.Graph t1 Core.Term Model.Value)) termCoder typ = let stripped = (Rewriting.deannotateType typ)- in ((\x -> case x of- Core.TypeLiteral v1 -> (Flows.bind (literalJsonCoder v1) (\ac -> Flows.pure (Compute.Coder {- Compute.coderEncode = (\term -> (\x -> case x of- Core.TermLiteral v2 -> (Compute.coderEncode ac v2)- _ -> (Monads.unexpected "literal term" (Core___.term term))) term),- Compute.coderDecode = (\n -> Flows.bind (Compute.coderDecode ac n) (\lit -> Flows.pure (Core.TermLiteral lit)))})))- Core.TypeList v1 -> (Flows.bind (termCoder v1) (\lc -> Flows.pure (Compute.Coder {- Compute.coderEncode = (\term -> (\x -> case x of- Core.TermList v2 -> (Flows.bind (Flows.mapList (Compute.coderEncode lc) v2) (\encodedEls -> Flows.pure (Json.ValueArray encodedEls)))- _ -> (Monads.unexpected "list term" (Core___.term term))) term),- Compute.coderDecode = (\n -> (\x -> case x of- Json.ValueArray v2 -> (Flows.bind (Flows.mapList (Compute.coderDecode lc) v2) (\decodedNodes -> Flows.pure (Core.TermList decodedNodes)))- _ -> (Monads.unexpected "sequence" (showValue n))) n)})))- Core.TypeMap v1 -> - let kt = (Core.mapTypeKeys v1) - vt = (Core.mapTypeValues v1)- in (Flows.bind (termCoder kt) (\kc -> Flows.bind (termCoder vt) (\vc -> Flows.bind Monads.getState (\cx -> - let isStringKey = (Equality.equal (Rewriting.deannotateType kt) (Core.TypeLiteral Core.LiteralTypeString)) - toString = (\v -> Logic.ifElse isStringKey ((\x -> case x of- Core.TermLiteral v2 -> ((\x -> case x of- Core.LiteralString v3 -> v3- _ -> (Core___.term v)) v2)- _ -> (Core___.term v)) (Rewriting.deannotateTerm v)) (Core___.term v))- fromString = (\s -> Logic.ifElse isStringKey (Core.TermLiteral (Core.LiteralString s)) (readStringStub s))- encodeEntry = (\kv -> - let k = (fst kv) - v = (snd kv)- in (Flows.bind (Compute.coderEncode vc v) (\encodedV -> Flows.pure (toString k, encodedV))))- decodeEntry = (\kv -> - let k = (fst kv) - v = (snd kv)- in (Flows.bind (Compute.coderDecode vc v) (\decodedV -> Flows.pure (fromString k, decodedV))))- in (Flows.pure (Compute.Coder {- Compute.coderEncode = (\term -> (\x -> case x of- Core.TermMap v2 -> (Flows.bind (Flows.mapList encodeEntry (Maps.toList v2)) (\entries -> Flows.pure (Json.ValueObject (Maps.fromList entries))))- _ -> (Monads.unexpected "map term" (Core___.term term))) term),- Compute.coderDecode = (\n -> (\x -> case x of- Json.ValueObject v2 -> (Flows.bind (Flows.mapList decodeEntry (Maps.toList v2)) (\entries -> Flows.pure (Core.TermMap (Maps.fromList entries))))- _ -> (Monads.unexpected "mapping" (showValue n))) n)}))))))- Core.TypeOptional v1 -> (Flows.bind (termCoder v1) (\oc -> Flows.pure (Compute.Coder {- Compute.coderEncode = (\t -> - let stripped = (Rewriting.deannotateTerm t)- in ((\x -> case x of- Core.TermOptional v2 -> (Optionals.maybe (Flows.pure Json.ValueNull) (Compute.coderEncode oc) v2)- _ -> (Monads.unexpected "optional term" (Core___.term t))) stripped)),- Compute.coderDecode = (\n -> (\x -> case x of- Json.ValueNull -> (Flows.pure (Core.TermOptional Nothing))- _ -> (Flows.bind (Compute.coderDecode oc n) (\decoded -> Flows.pure (Core.TermOptional (Just decoded))))) n)})))- Core.TypeRecord v1 -> (recordCoder v1)- Core.TypeUnit -> (Flows.pure unitCoder)- Core.TypeVariable v1 -> (Flows.pure (Compute.Coder {- Compute.coderEncode = (\term -> Flows.pure (Json.ValueString (Strings.cat [- "variable '",- Core.unName v1,- "' for: ",- (Core___.term term)]))),- Compute.coderDecode = (\term -> Flows.fail (Strings.cat [- "type variable ",- Core.unName v1,- " does not support decoding"]))}))- _ -> (Flows.fail (Strings.cat [- "unsupported type in JSON: ",- (Core___.type_ typ)]))) stripped)+ in + let encodeLiteral = (\ac -> \term -> (\x -> case x of+ Core.TermLiteral v1 -> (Compute.coderEncode ac v1)+ _ -> (Monads.unexpected "literal term" (Core___.term term))) term)+ in + let encodeList = (\lc -> \term -> (\x -> case x of+ Core.TermList v1 -> (Flows.bind (Flows.mapList (Compute.coderEncode lc) v1) (\encodedEls -> Flows.pure (Model.ValueArray encodedEls)))+ _ -> (Monads.unexpected "list term" (Core___.term term))) term)+ in + let decodeList = (\lc -> \n -> (\x -> case x of+ Model.ValueArray v1 -> (Flows.bind (Flows.mapList (Compute.coderDecode lc) v1) (\decodedNodes -> Flows.pure (Core.TermList decodedNodes)))+ _ -> (Monads.unexpected "sequence" (showValue n))) n)+ in + let matchLiteralString = (\v -> \lit -> (\x -> case x of+ Core.LiteralString v1 -> v1+ _ -> (Core___.term v)) lit)+ in + let matchTermLiteral = (\v -> (\x -> case x of+ Core.TermLiteral v1 -> (matchLiteralString v v1)+ _ -> (Core___.term v)) (Rewriting.deannotateTerm v))+ in + let encodeMap = (\encodeEntry -> \term -> (\x -> case x of+ Core.TermMap v1 -> (Flows.bind (Flows.mapList encodeEntry (Maps.toList v1)) (\entries -> Flows.pure (Model.ValueObject (Maps.fromList entries))))+ _ -> (Monads.unexpected "map term" (Core___.term term))) term)+ in + let decodeMap = (\decodeEntry -> \n -> (\x -> case x of+ Model.ValueObject v1 -> (Flows.bind (Flows.mapList decodeEntry (Maps.toList v1)) (\entries -> Flows.pure (Core.TermMap (Maps.fromList entries))))+ _ -> (Monads.unexpected "mapping" (showValue n))) n)+ in + let encodeMaybe = (\maybeElementCoder -> \maybeTerm -> + let strippedMaybeTerm = (Rewriting.deannotateTerm maybeTerm)+ in ((\x -> case x of+ Core.TermMaybe v1 -> (Logic.ifElse (Maybes.isNothing v1) (Flows.pure Model.ValueNull) (Flows.bind (Compute.coderEncode maybeElementCoder (Maybes.fromJust v1)) (\encodedInner -> Flows.pure encodedInner)))+ _ -> (Monads.unexpected "optional term" (Core___.term maybeTerm))) strippedMaybeTerm))+ in + let decodeMaybe = (\maybeElementCoder -> \jsonVal -> (\x -> case x of+ Model.ValueNull -> (Flows.pure (Core.TermMaybe Nothing))+ _ -> (Flows.bind (Compute.coderDecode maybeElementCoder jsonVal) (\decodedInner -> Flows.pure (Core.TermMaybe (Just decodedInner))))) jsonVal)+ in + let result = ((\x -> case x of+ Core.TypeLiteral v1 -> (Flows.bind (literalJsonCoder v1) (\ac -> Flows.pure (Compute.Coder {+ Compute.coderEncode = (encodeLiteral ac),+ Compute.coderDecode = (\n -> Flows.bind (Compute.coderDecode ac n) (\lit -> Flows.pure (Core.TermLiteral lit)))})))+ Core.TypeList v1 -> (Flows.bind (termCoder v1) (\lc -> Flows.pure (Compute.Coder {+ Compute.coderEncode = (encodeList lc),+ Compute.coderDecode = (decodeList lc)})))+ Core.TypeMap v1 -> + let kt = (Core.mapTypeKeys v1)+ in + let vt = (Core.mapTypeValues v1)+ in (Flows.bind (termCoder kt) (\kc -> Flows.bind (termCoder vt) (\vc -> Flows.bind Monads.getState (\cx -> + let isStringKey = (Equality.equal (Rewriting.deannotateType kt) (Core.TypeLiteral Core.LiteralTypeString))+ in + let toString = (\v -> Logic.ifElse isStringKey (matchTermLiteral v) (Core___.term v))+ in + let fromString = (\s -> Logic.ifElse isStringKey (Core.TermLiteral (Core.LiteralString s)) (readStringStub s))+ in + let encodeEntry = (\kv -> + let k = (Pairs.first kv)+ in + let v = (Pairs.second kv)+ in (Flows.bind (Compute.coderEncode vc v) (\encodedV -> Flows.pure (toString k, encodedV))))+ in + let decodeEntry = (\kv -> + let k = (Pairs.first kv)+ in + let v = (Pairs.second kv)+ in (Flows.bind (Compute.coderDecode vc v) (\decodedV -> Flows.pure (fromString k, decodedV))))+ in (Flows.pure (Compute.Coder {+ Compute.coderEncode = (encodeMap encodeEntry),+ Compute.coderDecode = (decodeMap decodeEntry)}))))))+ Core.TypeMaybe v1 -> (Flows.bind (termCoder v1) (\maybeElementCoder -> Flows.pure (Compute.Coder {+ Compute.coderEncode = (encodeMaybe maybeElementCoder),+ Compute.coderDecode = (decodeMaybe maybeElementCoder)})))+ Core.TypeRecord v1 -> (recordCoder v1)+ Core.TypeUnit -> (Flows.pure unitCoder)+ Core.TypeVariable v1 -> (Flows.pure (Compute.Coder {+ Compute.coderEncode = (\term -> Flows.pure (Model.ValueString (Strings.cat [+ "variable '",+ (Core.unName v1),+ "' for: ",+ (Core___.term term)]))),+ Compute.coderDecode = (\term -> Flows.fail (Strings.cat [+ "type variable ",+ (Core.unName v1),+ " does not support decoding"]))}))+ _ -> (Flows.fail (Strings.cat [+ "unsupported type in JSON: ",+ (Core___.type_ typ)]))) stripped)+ in result -unitCoder :: (Compute.Coder t0 t1 Core.Term Json.Value)-unitCoder = Compute.Coder {- Compute.coderEncode = (\term -> (\x -> case x of- Core.TermUnit -> (Flows.pure Json.ValueNull)- _ -> (Monads.unexpected "unit" (Core___.term term))) (Rewriting.deannotateTerm term)),- Compute.coderDecode = (\n -> (\x -> case x of- Json.ValueNull -> (Flows.pure Core.TermUnit)- _ -> (Monads.unexpected "null" (showValue n))) n)}+-- | JSON coder for unit values+unitCoder :: (Compute.Coder t0 t1 Core.Term Model.Value)+unitCoder = + let encodeUnit = (\term -> (\x -> case x of+ Core.TermUnit -> (Flows.pure Model.ValueNull)+ _ -> (Monads.unexpected "unit" (Core___.term term))) (Rewriting.deannotateTerm term))+ in + let decodeUnit = (\n -> (\x -> case x of+ Model.ValueNull -> (Flows.pure Core.TermUnit)+ _ -> (Monads.unexpected "null" (showValue n))) n)+ in Compute.Coder {+ Compute.coderEncode = encodeUnit,+ Compute.coderDecode = decodeUnit} -untypedTermToJson :: (Core.Term -> Compute.Flow t0 Json.Value)+-- | A simplistic, unidirectional encoding for terms as JSON values. Not type-aware; best used for human consumption.+untypedTermToJson :: (Core.Term -> Compute.Flow t0 Model.Value) untypedTermToJson term = - let unexp = (\msg -> Flows.pure (Json.ValueString (Strings.cat2 "FAIL: " msg))) - asRecord = (\fields -> untypedTermToJson (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name ""),- Core.recordFields = fields})))- asVariant = (\name -> \term -> untypedTermToJson (Core.TermUnion (Core.Injection {+ let unexp = (\msg -> Flows.pure (Model.ValueString (Strings.cat2 "FAIL: " msg)))+ in + let asRecord = (\fields -> untypedTermToJson (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name ""),+ Core.recordFields = fields})))+ in + let asVariant = (\name -> \term -> untypedTermToJson (Core.TermUnion (Core.Injection { Core.injectionTypeName = (Core.Name ""), Core.injectionField = Core.Field { Core.fieldName = (Core.Name name), Core.fieldTerm = term}})))- fieldToKeyval = (\f -> - let forTerm = (\t -> (\x -> case x of- Core.TermOptional v1 -> (Optionals.maybe (Flows.pure Nothing) forTerm v1)- _ -> (Flows.map Optionals.pure (untypedTermToJson t))) t)- in (Flows.bind (forTerm (Core.fieldTerm f)) (\mjson -> Flows.pure (Optionals.map (\j -> (Core.unName (Core.fieldName f), j)) mjson))))- in ((\x -> case x of- Core.TermAnnotated v1 -> - let term1 = (Core.annotatedTermSubject v1) - ann = (Core.annotatedTermAnnotation v1)- encodePair = (\kv -> - let k = (Core.unName (fst kv)) - v = (snd kv)- in (Flows.bind (untypedTermToJson v) (\json -> Flows.pure (k, json))))- in (Flows.bind (untypedTermToJson term1) (\json -> Flows.bind (Flows.mapList encodePair (Maps.toList ann)) (\pairs -> Flows.pure (Json.ValueObject (Maps.fromList [- ("term", json),- ("annotations", (Json.ValueObject (Maps.fromList pairs)))])))))- Core.TermApplication v1 -> (asRecord [- Core.Field {- Core.fieldName = (Core.Name "function"),- Core.fieldTerm = (Core.applicationFunction v1)},- Core.Field {- Core.fieldName = (Core.Name "argument"),- Core.fieldTerm = (Core.applicationArgument v1)}])- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationRecord v3 -> (asVariant "project" (Core.TermVariable (Core.projectionField v3)))- _ -> (unexp (Strings.cat [- "unexpected elimination variant: ",- (Core___.elimination v2)]))) v2)- Core.FunctionLambda v2 -> (asRecord [- Core.Field {- Core.fieldName = (Core.Name "parameter"),- Core.fieldTerm = (Core.TermVariable (Core.lambdaParameter v2))},- Core.Field {- Core.fieldName = (Core.Name "domain"),- Core.fieldTerm = (Core.TermOptional (Optionals.map Core_.type_ (Core.lambdaDomain v2)))},- Core.Field {- Core.fieldName = (Core.Name "body"),- Core.fieldTerm = (Core.lambdaBody v2)}])- Core.FunctionPrimitive v2 -> (Flows.pure (Json.ValueString (Core.unName v2)))) v1)- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)- fromBinding = (\b -> Core.Field {- Core.fieldName = (Core.bindingName b),- Core.fieldTerm = (Core.bindingTerm b)})- in (asRecord [- Core.Field {- Core.fieldName = (Core.Name "bindings"),- Core.fieldTerm = (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.Name ""),- Core.recordFields = (Lists.map fromBinding bindings)}))},- Core.Field {- Core.fieldName = (Core.Name "environment"),- Core.fieldTerm = env}])- Core.TermList v1 -> (Flows.bind (Flows.mapList untypedTermToJson v1) (\jsonTerms -> Flows.pure (Json.ValueArray jsonTerms)))- Core.TermLiteral v1 -> (Flows.pure ((\x -> case x of- Core.LiteralBinary v2 -> (Json.ValueString (Literals.binaryToString v2))- Core.LiteralBoolean v2 -> (Json.ValueBoolean v2)- Core.LiteralFloat v2 -> (Json.ValueNumber (Literals_.floatValueToBigfloat v2))- Core.LiteralInteger v2 -> - let bf = (Literals_.integerValueToBigint v2) - f = (Literals.bigintToBigfloat bf)- in (Json.ValueNumber f)- Core.LiteralString v2 -> (Json.ValueString v2)) v1))- Core.TermOptional v1 -> (Optionals.maybe (Flows.pure Json.ValueNull) untypedTermToJson v1)- Core.TermProduct v1 -> (untypedTermToJson (Core.TermList v1))- Core.TermRecord v1 -> - let fields = (Core.recordFields v1)- in (Flows.bind (Flows.mapList fieldToKeyval fields) (\keyvals -> Flows.pure (Json.ValueObject (Maps.fromList (Optionals.cat keyvals)))))- Core.TermSet v1 -> (untypedTermToJson (Core.TermList (Sets.toList v1)))- Core.TermSum v1 -> (asRecord [- Core.Field {- Core.fieldName = (Core.Name "index"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.sumIndex v1))))},- Core.Field {- Core.fieldName = (Core.Name "size"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Core.sumSize v1))))},- Core.Field {- Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (Core.sumTerm v1)}])- Core.TermTypeLambda v1 -> (asRecord [- Core.Field {- Core.fieldName = (Core.Name "parameter"),- Core.fieldTerm = (Core.TermVariable (Core.typeLambdaParameter v1))},- Core.Field {- Core.fieldName = (Core.Name "body"),- Core.fieldTerm = (Core.typeLambdaBody v1)}])- Core.TermTypeApplication v1 -> (asRecord [- Core.Field {- Core.fieldName = (Core.Name "term"),- Core.fieldTerm = (Core.typedTermTerm v1)},- Core.Field {- Core.fieldName = (Core.Name "type"),- Core.fieldTerm = (Core_.type_ (Core.typedTermType v1))}])- Core.TermUnion v1 -> - let field = (Core.injectionField v1)- in (Logic.ifElse (Equality.equal (Core.fieldTerm field) Core.TermUnit) (Flows.pure (Json.ValueString (Core.unName (Core.fieldName field)))) (Flows.bind (fieldToKeyval field) (\mkeyval -> Flows.pure (Json.ValueObject (Maps.fromList (Optionals.maybe [] (\keyval -> [- keyval]) mkeyval))))))- Core.TermVariable v1 -> (Flows.pure (Json.ValueString (Core.unName v1)))- Core.TermWrap v1 -> (untypedTermToJson (Core.wrappedTermObject v1))- _ -> (unexp (Strings.cat [- "unsupported term variant: ",- (Core___.term term)]))) term)+ in + let matchTermMaybe = (\forTerm -> \t -> (\x -> case x of+ Core.TermMaybe v1 -> (Maybes.maybe (Flows.pure Nothing) forTerm v1)+ _ -> (Flows.map Maybes.pure (untypedTermToJson t))) t)+ in + let matchElimination = (\unexp -> \asVariant -> \elm -> (\x -> case x of+ Core.EliminationRecord v1 -> (asVariant "project" (Core.TermVariable (Core.projectionField v1)))+ _ -> (unexp (Strings.cat [+ "unexpected elimination variant: ",+ (Core___.elimination elm)]))) elm)+ in + let matchFunction = (\unexp -> \asRecord -> \asVariant -> \f -> (\x -> case x of+ Core.FunctionElimination v1 -> (matchElimination unexp asVariant v1)+ Core.FunctionLambda v1 -> (asRecord [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (Core.TermVariable (Core.lambdaParameter v1))},+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Core.TermMaybe (Maybes.map Core_.type_ (Core.lambdaDomain v1)))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.lambdaBody v1)}])+ Core.FunctionPrimitive v1 -> (Flows.pure (Model.ValueString (Core.unName v1)))) f)+ in + let matchLiteral = (\lit -> (\x -> case x of+ Core.LiteralBinary v1 -> (Model.ValueString (Literals.binaryToString v1))+ Core.LiteralBoolean v1 -> (Model.ValueBoolean v1)+ Core.LiteralFloat v1 -> (Model.ValueNumber (Literals_.floatValueToBigfloat v1))+ Core.LiteralInteger v1 -> + let bf = (Literals_.integerValueToBigint v1)+ in + let f = (Literals.bigintToBigfloat bf)+ in (Model.ValueNumber f)+ Core.LiteralString v1 -> (Model.ValueString v1)) lit)+ in + let fieldToKeyval = (\f -> + let forTerm = (\t -> matchTermMaybe forTerm t)+ in (Flows.bind (forTerm (Core.fieldTerm f)) (\mjson -> Flows.pure (Maybes.map (\j -> (Core.unName (Core.fieldName f), j)) mjson))))+ in + let result = ((\x -> case x of+ Core.TermAnnotated v1 -> + let term1 = (Core.annotatedTermBody v1)+ in + let ann = (Core.annotatedTermAnnotation v1)+ in + let encodePair = (\kv -> + let k = (Core.unName (Pairs.first kv))+ in + let v = (Pairs.second kv)+ in (Flows.bind (untypedTermToJson v) (\json -> Flows.pure (k, json))))+ in (Flows.bind (untypedTermToJson term1) (\json -> Flows.bind (Flows.mapList encodePair (Maps.toList ann)) (\pairs -> Flows.pure (Model.ValueObject (Maps.fromList [+ ("term", json),+ ("annotations", (Model.ValueObject (Maps.fromList pairs)))])))))+ Core.TermApplication v1 -> (asRecord [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.applicationFunction v1)},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Core.applicationArgument v1)}])+ Core.TermFunction v1 -> (matchFunction unexp asRecord asVariant v1)+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1)+ in + let env = (Core.letBody v1)+ in + let fromBinding = (\b -> Core.Field {+ Core.fieldName = (Core.bindingName b),+ Core.fieldTerm = (Core.bindingTerm b)})+ in (asRecord [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name ""),+ Core.recordFields = (Lists.map fromBinding bindings)}))},+ Core.Field {+ Core.fieldName = (Core.Name "environment"),+ Core.fieldTerm = env}])+ Core.TermList v1 -> (Flows.bind (Flows.mapList untypedTermToJson v1) (\jsonTerms -> Flows.pure (Model.ValueArray jsonTerms)))+ Core.TermLiteral v1 -> (Flows.pure (matchLiteral v1))+ Core.TermMaybe v1 -> (Maybes.maybe (Flows.pure Model.ValueNull) untypedTermToJson v1)+ Core.TermRecord v1 -> + let fields = (Core.recordFields v1)+ in (Flows.bind (Flows.mapList fieldToKeyval fields) (\keyvals -> Flows.pure (Model.ValueObject (Maps.fromList (Maybes.cat keyvals)))))+ Core.TermSet v1 -> (untypedTermToJson (Core.TermList (Sets.toList v1)))+ Core.TermTypeLambda v1 -> (asRecord [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (Core.TermVariable (Core.typeLambdaParameter v1))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.typeLambdaBody v1)}])+ Core.TermTypeApplication v1 -> (asRecord [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.typeApplicationTermBody v1)},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core_.type_ (Core.typeApplicationTermType v1))}])+ Core.TermUnion v1 -> + let field = (Core.injectionField v1)+ in (Logic.ifElse (Equality.equal (Core.fieldTerm field) Core.TermUnit) (Flows.pure (Model.ValueString (Core.unName (Core.fieldName field)))) (Flows.bind (fieldToKeyval field) (\mkeyval -> Flows.pure (Model.ValueObject (Maps.fromList (Maybes.maybe [] (\keyval -> [+ keyval]) mkeyval))))))+ Core.TermVariable v1 -> (Flows.pure (Model.ValueString (Core.unName v1)))+ Core.TermWrap v1 -> (untypedTermToJson (Core.wrappedTermBody v1))+ _ -> (unexp (Strings.cat [+ "unsupported term variant: ",+ (Core___.term term)]))) term)+ in result -- | Placeholder for reading a string into a term (to be implemented) readStringStub :: (String -> Core.Term) readStringStub s = (Core.TermLiteral (Core.LiteralString (Strings.cat2 "TODO: read " s))) +-- | Show a JSON value as a string (placeholder implementation) showValue :: (t0 -> String) showValue value = "TODO: implement showValue"
src/gen-main/haskell/Hydra/Ext/Org/Json/Decoding.hs view
@@ -1,41 +1,50 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Decoding functions for JSON data module Hydra.Ext.Org.Json.Decoding where import qualified Hydra.Compute as Compute-import qualified Hydra.Json as Json+import qualified Hydra.Json.Model as Model import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Strings as Strings-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -decodeArray :: ((Json.Value -> Compute.Flow t0 t1) -> Json.Value -> Compute.Flow t0 [t1])+-- | Decode a JSON array using a decoder for elements+decodeArray :: ((Model.Value -> Compute.Flow t0 t1) -> Model.Value -> Compute.Flow t0 [t1]) decodeArray decodeElem x = case x of- Json.ValueArray v1 -> (Flows.mapList decodeElem v1)+ Model.ValueArray v1 -> (Flows.mapList decodeElem v1) _ -> (Flows.fail "expected an array") -decodeBoolean :: (Json.Value -> Compute.Flow t0 Bool)+-- | Decode a JSON boolean value+decodeBoolean :: (Model.Value -> Compute.Flow t0 Bool) decodeBoolean x = case x of- Json.ValueBoolean v1 -> (Flows.pure v1)+ Model.ValueBoolean v1 -> (Flows.pure v1) _ -> (Flows.fail "expected a boolean") +-- | Decode a required field from a JSON object decodeField :: ((t0 -> Compute.Flow t1 t2) -> String -> M.Map String t0 -> Compute.Flow t1 t2)-decodeField decodeValue name m = (Flows.bind (decodeOptionalField decodeValue name m) (Optionals.maybe (Flows.fail (Strings.cat2 "missing field: " name)) (\f -> Flows.pure f)))+decodeField decodeValue name m = (Flows.bind (decodeOptionalField decodeValue name m) (Maybes.maybe (Flows.fail (Strings.cat2 "missing field: " name)) (\f -> Flows.pure f))) -decodeObject :: (Json.Value -> Compute.Flow t0 (M.Map String Json.Value))+-- | Decode a JSON object value+decodeObject :: (Model.Value -> Compute.Flow t0 (M.Map String Model.Value)) decodeObject x = case x of- Json.ValueObject v1 -> (Flows.pure v1)+ Model.ValueObject v1 -> (Flows.pure v1) _ -> (Flows.fail "expected an object") -decodeOptionalField :: (Ord t3) => ((t0 -> Compute.Flow t1 t2) -> t3 -> M.Map t3 t0 -> Compute.Flow t1 (Maybe t2))-decodeOptionalField decodeValue name m = (Optionals.maybe (Flows.pure Nothing) (\v -> Flows.map (\x -> Just x) (decodeValue v)) (Maps.lookup name m))+-- | Decode an optional field from a JSON object+decodeOptionalField :: Ord t3 => ((t0 -> Compute.Flow t1 t2) -> t3 -> M.Map t3 t0 -> Compute.Flow t1 (Maybe t2))+decodeOptionalField decodeValue name m = (Maybes.maybe (Flows.pure Nothing) (\v -> Flows.map (\x -> Just x) (decodeValue v)) (Maps.lookup name m)) -decodeString :: (Json.Value -> Compute.Flow t0 String)+-- | Decode a JSON string value+decodeString :: (Model.Value -> Compute.Flow t0 String) decodeString x = case x of- Json.ValueString v1 -> (Flows.pure v1)+ Model.ValueString v1 -> (Flows.pure v1) _ -> (Flows.fail "expected a string")
src/gen-main/haskell/Hydra/Ext/Org/Json/Language.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Language constraints for JSON module Hydra.Ext.Org.Json.Language where@@ -5,9 +7,10 @@ import qualified Hydra.Coders as Coders import qualified Hydra.Core as Core import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Mantle as Mantle import qualified Hydra.Rewriting as Rewriting-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -29,29 +32,29 @@ where eliminationVariants = Sets.empty literalVariants = (Sets.fromList [- Mantle.LiteralVariantBoolean,- Mantle.LiteralVariantFloat,- Mantle.LiteralVariantInteger,- Mantle.LiteralVariantString])+ Variants.LiteralVariantBoolean,+ Variants.LiteralVariantFloat,+ Variants.LiteralVariantInteger,+ Variants.LiteralVariantString]) floatTypes = (Sets.fromList [ Core.FloatTypeBigfloat]) functionVariants = Sets.empty integerTypes = (Sets.fromList [ Core.IntegerTypeBigint]) termVariants = (Sets.fromList [- Mantle.TermVariantList,- Mantle.TermVariantLiteral,- Mantle.TermVariantMap,- Mantle.TermVariantOptional,- Mantle.TermVariantRecord])+ Variants.TermVariantList,+ Variants.TermVariantLiteral,+ Variants.TermVariantMap,+ Variants.TermVariantMaybe,+ Variants.TermVariantRecord]) typeVariants = (Sets.fromList [- Mantle.TypeVariantList,- Mantle.TypeVariantLiteral,- Mantle.TypeVariantMap,- Mantle.TypeVariantOptional,- Mantle.TypeVariantRecord])+ Variants.TypeVariantList,+ Variants.TypeVariantLiteral,+ Variants.TypeVariantMap,+ Variants.TypeVariantMaybe,+ Variants.TypeVariantRecord]) typePredicate = (\typ -> (\x -> case x of- Core.TypeOptional v1 -> ((\x -> case x of- Core.TypeOptional _ -> False+ Core.TypeMaybe v1 -> ((\x -> case x of+ Core.TypeMaybe _ -> False _ -> True) v1) _ -> True) (Rewriting.deannotateType typ))
src/gen-main/haskell/Hydra/Ext/Org/Yaml/Model.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A basic YAML representation model. Based on: -- | https://yaml.org/spec/1.2/spec.html -- | The Serialization and Presentation properties of YAML,@@ -7,7 +9,8 @@ module Hydra.Ext.Org.Yaml.Model where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -15,8 +18,11 @@ -- | A YAML node (value) data Node = + -- | A mapping from nodes to nodes NodeMapping (M.Map Node Node) |+ -- | A scalar value NodeScalar Scalar |+ -- | A sequence of nodes NodeSequence [Node] deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Extract/Core.hs view
@@ -1,23 +1,28 @@--- | A DSL for decoding and validating Hydra terms at runtime. This module provides functions to extract typed values from Hydra terms with appropriate error handling.+-- Note: this is an automatically generated file. Do not edit. +-- | Extraction and validation for hydra.core types+ module Hydra.Extract.Core where import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Monads as Monads import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core_-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -27,6 +32,7 @@ bigfloat :: (Core.Term -> Compute.Flow Graph.Graph Double) bigfloat t = (Flows.bind (literal t) (\l -> Flows.bind (floatLiteral l) (\f -> bigfloatValue f))) +-- | Extract a bigfloat value from a FloatValue bigfloatValue :: (Core.FloatValue -> Compute.Flow t0 Double) bigfloatValue v = ((\x -> case x of Core.FloatValueBigfloat v1 -> (Flows.pure v1)@@ -36,24 +42,27 @@ bigint :: (Core.Term -> Compute.Flow Graph.Graph Integer) bigint t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> bigintValue i))) +-- | Extract a bigint value from an IntegerValue bigintValue :: (Core.IntegerValue -> Compute.Flow t0 Integer) bigintValue v = ((\x -> case x of Core.IntegerValueBigint v1 -> (Flows.pure v1) _ -> (Monads.unexpected "bigint" (Core_.integer v))) v) -- | Extract a binary data value from a term-binary :: (Core.Term -> Compute.Flow Graph.Graph String)-binary t = (Flows.bind (literal t) binaryLiteral)+binary :: (Core.Term -> Compute.Flow Graph.Graph B.ByteString)+binary t = (Flows.bind (literal t) (\l -> binaryLiteral l)) -binaryLiteral :: (Core.Literal -> Compute.Flow t0 String)+-- | Extract a binary literal from a Literal value+binaryLiteral :: (Core.Literal -> Compute.Flow t0 B.ByteString) binaryLiteral v = ((\x -> case x of Core.LiteralBinary v1 -> (Flows.pure v1) _ -> (Monads.unexpected "binary" (Core_.literal v))) v) -- | Extract a boolean value from a term boolean :: (Core.Term -> Compute.Flow Graph.Graph Bool)-boolean t = (Flows.bind (literal t) booleanLiteral)+boolean t = (Flows.bind (literal t) (\l -> booleanLiteral l)) +-- | Extract a boolean literal from a Literal value booleanLiteral :: (Core.Literal -> Compute.Flow t0 Bool) booleanLiteral v = ((\x -> case x of Core.LiteralBoolean v1 -> (Flows.pure v1)@@ -69,31 +78,27 @@ -- | Extract case statement from a term cases :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph Core.CaseStatement)-cases name term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationUnion v3 -> (Logic.ifElse (Equality.equal (Core.unName (Core.caseStatementTypeName v3)) (Core.unName name)) (Flows.pure v3) (Monads.unexpected (Strings.cat [- "case statement for type ",- (Core.unName name)]) (Core_.term term)))- _ -> (Monads.unexpected "case statement" (Core_.term term))) v2)- _ -> (Monads.unexpected "case statement" (Core_.term term))) v1)- _ -> (Monads.unexpected "case statement" (Core_.term term))) term))+cases name term0 = + let extract = (\term -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationUnion v3 -> (Logic.ifElse (Equality.equal (Core.unName (Core.caseStatementTypeName v3)) (Core.unName name)) (Flows.pure v3) (Monads.unexpected (Strings.cat2 "case statement for type " (Core.unName name)) (Core_.term term)))+ _ -> (Monads.unexpected "case statement" (Core_.term term))) v2)+ _ -> (Monads.unexpected "case statement" (Core_.term term))) v1)+ _ -> (Monads.unexpected "case statement" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) +-- | Extract a field value from a list of fields field :: (Core.Name -> (Core.Term -> Compute.Flow Graph.Graph t0) -> [Core.Field] -> Compute.Flow Graph.Graph t0) field fname mapping fields = let matchingFields = (Lists.filter (\f -> Equality.equal (Core.unName (Core.fieldName f)) (Core.unName fname)) fields)- in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat [- Strings.cat [- "field ",- (Core.unName fname)],- " not found"])) (Logic.ifElse (Equality.equal (Lists.length matchingFields) 1) (Flows.bind (Lexical.stripAndDereferenceTerm (Core.fieldTerm (Lists.head matchingFields))) mapping) (Flows.fail (Strings.cat [- "multiple fields named ",- (Core.unName fname)]))))+ in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat2 (Strings.cat2 "field " (Core.unName fname)) " not found")) (Logic.ifElse (Equality.equal (Lists.length matchingFields) 1) (Flows.bind (Lexical.stripAndDereferenceTerm (Core.fieldTerm (Lists.head matchingFields))) (\stripped -> mapping stripped)) (Flows.fail (Strings.cat2 "multiple fields named " (Core.unName fname))))) -- | Extract a 32-bit floating-point value from a term float32 :: (Core.Term -> Compute.Flow Graph.Graph Float) float32 t = (Flows.bind (literal t) (\l -> Flows.bind (floatLiteral l) (\f -> float32Value f))) +-- | Extract a float32 value from a FloatValue float32Value :: (Core.FloatValue -> Compute.Flow t0 Float) float32Value v = ((\x -> case x of Core.FloatValueFloat32 v1 -> (Flows.pure v1)@@ -103,11 +108,13 @@ float64 :: (Core.Term -> Compute.Flow Graph.Graph Double) float64 t = (Flows.bind (literal t) (\l -> Flows.bind (floatLiteral l) (\f -> float64Value f))) +-- | Extract a float64 value from a FloatValue float64Value :: (Core.FloatValue -> Compute.Flow t0 Double) float64Value v = ((\x -> case x of Core.FloatValueFloat64 v1 -> (Flows.pure v1) _ -> (Monads.unexpected "float64" (Core_.float v))) v) +-- | Extract a floating-point literal from a Literal value floatLiteral :: (Core.Literal -> Compute.Flow t0 Core.FloatValue) floatLiteral lit = ((\x -> case x of Core.LiteralFloat v1 -> (Flows.pure v1)@@ -115,8 +122,25 @@ -- | Extract a float value from a term floatValue :: (Core.Term -> Compute.Flow Graph.Graph Core.FloatValue)-floatValue t = (Flows.bind (literal t) floatLiteral)+floatValue t = (Flows.bind (literal t) (\l -> floatLiteral l)) +-- | Extract an either value from a term, applying functions to the left and right values+eitherTerm :: ((Core.Term -> Compute.Flow Graph.Graph t0) -> (Core.Term -> Compute.Flow Graph.Graph t1) -> Core.Term -> Compute.Flow Graph.Graph (Either t0 t1))+eitherTerm leftFun rightFun term0 = + let extract = (\term -> (\x -> case x of+ Core.TermEither v1 -> (Eithers.either (\l -> Flows.map (\x -> Left x) (leftFun l)) (\r -> Flows.map (\x -> Right x) (rightFun r)) v1)+ _ -> (Monads.unexpected "either value" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term))++-- | Extract the left and right types from an either type+eitherType :: (Core.Type -> Compute.Flow t0 Core.EitherType)+eitherType typ = + let stripped = (Rewriting.deannotateType typ)+ in ((\x -> case x of+ Core.TypeEither v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "either type" (Core_.type_ typ))) stripped)++-- | Extract a function type from a type functionType :: (Core.Type -> Compute.Flow t0 Core.FunctionType) functionType typ = let stripped = (Rewriting.deannotateType typ)@@ -126,16 +150,17 @@ -- | Extract a field from a union term injection :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph Core.Field)-injection expected term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.injectionTypeName v1)) (Core.unName expected)) (Flows.pure (Core.injectionField v1)) (Monads.unexpected (Strings.cat [- "injection of type ",- (Core.unName expected)]) (Core.unName (Core.injectionTypeName v1))))- _ -> (Monads.unexpected "injection" (Core_.term term))) term))+injection expected term0 = + let extract = (\term -> (\x -> case x of+ Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.injectionTypeName v1)) (Core.unName expected)) (Flows.pure (Core.injectionField v1)) (Monads.unexpected (Strings.cat2 "injection of type " (Core.unName expected)) (Core.unName (Core.injectionTypeName v1))))+ _ -> (Monads.unexpected "injection" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -- | Extract a 16-bit signed integer value from a term int16 :: (Core.Term -> Compute.Flow Graph.Graph I.Int16) int16 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> int16Value i))) +-- | Extract an int16 value from an IntegerValue int16Value :: (Core.IntegerValue -> Compute.Flow t0 I.Int16) int16Value v = ((\x -> case x of Core.IntegerValueInt16 v1 -> (Flows.pure v1)@@ -145,6 +170,7 @@ int32 :: (Core.Term -> Compute.Flow Graph.Graph Int) int32 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> int32Value i))) +-- | Extract an int32 value from an IntegerValue int32Value :: (Core.IntegerValue -> Compute.Flow t0 Int) int32Value v = ((\x -> case x of Core.IntegerValueInt32 v1 -> (Flows.pure v1)@@ -154,6 +180,7 @@ int64 :: (Core.Term -> Compute.Flow Graph.Graph I.Int64) int64 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> int64Value i))) +-- | Extract an int64 value from an IntegerValue int64Value :: (Core.IntegerValue -> Compute.Flow t0 I.Int64) int64Value v = ((\x -> case x of Core.IntegerValueInt64 v1 -> (Flows.pure v1)@@ -163,11 +190,13 @@ int8 :: (Core.Term -> Compute.Flow Graph.Graph I.Int8) int8 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> int8Value i))) +-- | Extract an int8 value from an IntegerValue int8Value :: (Core.IntegerValue -> Compute.Flow t0 I.Int8) int8Value v = ((\x -> case x of Core.IntegerValueInt8 v1 -> (Flows.pure v1) _ -> (Monads.unexpected "int8" (Core_.integer v))) v) +-- | Extract an integer literal from a Literal value integerLiteral :: (Core.Literal -> Compute.Flow t0 Core.IntegerValue) integerLiteral lit = ((\x -> case x of Core.LiteralInteger v1 -> (Flows.pure v1)@@ -175,7 +204,7 @@ -- | Extract an integer value from a term integerValue :: (Core.Term -> Compute.Flow Graph.Graph Core.IntegerValue)-integerValue t = (Flows.bind (literal t) integerLiteral)+integerValue t = (Flows.bind (literal t) (\l -> integerLiteral l)) -- | Extract the body of a lambda term lambdaBody :: (Core.Term -> Compute.Flow Graph.Graph Core.Term)@@ -183,43 +212,47 @@ -- | Extract a lambda from a term lambda :: (Core.Term -> Compute.Flow Graph.Graph Core.Lambda)-lambda term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Flows.pure v2)- _ -> (Monads.unexpected "lambda" (Core_.term term))) v1)- _ -> (Monads.unexpected "lambda" (Core_.term term))) term))+lambda term0 = + let extract = (\term -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Flows.pure v2)+ _ -> (Monads.unexpected "lambda" (Core_.term term))) v1)+ _ -> (Monads.unexpected "lambda" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -- | Extract a binding with the given name from a let term letBinding :: (String -> Core.Term -> Compute.Flow Graph.Graph Core.Term) letBinding n term = let name = (Core.Name n)- in (Flows.bind (letTerm term) (\letExpr -> + in (Flows.bind (let_ term) (\letExpr -> let matchingBindings = (Lists.filter (\b -> Equality.equal (Core.unName (Core.bindingName b)) (Core.unName name)) (Core.letBindings letExpr))- in (Logic.ifElse (Lists.null matchingBindings) (Flows.fail (Strings.cat [- "no such binding: ",- n])) (Logic.ifElse (Equality.equal (Lists.length matchingBindings) 1) (Flows.pure (Core.bindingTerm (Lists.head matchingBindings))) (Flows.fail (Strings.cat [- "multiple bindings named ",- n]))))))+ in (Logic.ifElse (Lists.null matchingBindings) (Flows.fail (Strings.cat2 "no such binding: " n)) (Logic.ifElse (Equality.equal (Lists.length matchingBindings) 1) (Flows.pure (Core.bindingTerm (Lists.head matchingBindings))) (Flows.fail (Strings.cat2 "multiple bindings named " n)))))) -- | Extract a let expression from a term-letTerm :: (Core.Term -> Compute.Flow Graph.Graph Core.Let)-letTerm term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermLet v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "let term" (Core_.term term))) term))+let_ :: (Core.Term -> Compute.Flow Graph.Graph Core.Let)+let_ term0 = + let extract = (\term -> (\x -> case x of+ Core.TermLet v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "let term" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -- | Extract a list of terms from a term list :: (Core.Term -> Compute.Flow Graph.Graph [Core.Term])-list term = (Flows.bind (Lexical.stripAndDereferenceTerm term) (\stripped -> (\x -> case x of- Core.TermList v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "list" (Core_.term stripped))) stripped))+list term = + let extract = (\stripped -> (\x -> case x of+ Core.TermList v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "list" (Core_.term stripped))) stripped)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term) (\stripped -> extract stripped)) -- | Extract the first element of a list term listHead :: (Core.Term -> Compute.Flow Graph.Graph Core.Term) listHead term = (Flows.bind (list term) (\l -> Logic.ifElse (Lists.null l) (Flows.fail "empty list") (Flows.pure (Lists.head l)))) +-- | Extract a list of values from a term, mapping a function over each element listOf :: ((Core.Term -> Compute.Flow Graph.Graph t0) -> Core.Term -> Compute.Flow Graph.Graph [t0]) listOf f term = (Flows.bind (list term) (\els -> Flows.mapList f els)) +-- | Extract the element type from a list type listType :: (Core.Type -> Compute.Flow t0 Core.Type) listType typ = let stripped = (Rewriting.deannotateType typ)@@ -229,20 +262,27 @@ -- | Extract a literal value from a term literal :: (Core.Term -> Compute.Flow Graph.Graph Core.Literal)-literal term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermLiteral v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "literal" (Core_.term term))) term))+literal term0 = + let extract = (\term -> (\x -> case x of+ Core.TermLiteral v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "literal" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -map :: (Ord t0) => ((Core.Term -> Compute.Flow Graph.Graph t0) -> (Core.Term -> Compute.Flow Graph.Graph t1) -> Core.Term -> Compute.Flow Graph.Graph (M.Map t0 t1))+-- | Extract a map of key-value pairs from a term, mapping functions over each key and value+map :: Ord t0 => ((Core.Term -> Compute.Flow Graph.Graph t0) -> (Core.Term -> Compute.Flow Graph.Graph t1) -> Core.Term -> Compute.Flow Graph.Graph (M.Map t0 t1)) map fk fv term0 = let pair = (\kvPair -> - let kterm = (fst kvPair) - vterm = (snd kvPair)- in (Flows.bind (fk kterm) (\kval -> Flows.bind (fv vterm) (\vval -> Flows.pure (kval, vval)))))- in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermMap v1 -> (Flows.map Maps.fromList (Flows.mapList pair (Maps.toList v1)))- _ -> (Monads.unexpected "map" (Core_.term term))) term))+ let kterm = (Pairs.first kvPair)+ in + let vterm = (Pairs.second kvPair)+ in (Flows.bind (fk kterm) (\kval -> Flows.bind (fv vterm) (\vval -> Flows.pure (kval, vval)))))+ in + let extract = (\term -> (\x -> case x of+ Core.TermMap v1 -> (Flows.map Maps.fromList (Flows.mapList pair (Maps.toList v1)))+ _ -> (Monads.unexpected "map" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) +-- | Extract the key and value types from a map type mapType :: (Core.Type -> Compute.Flow t0 Core.MapType) mapType typ = let stripped = (Rewriting.deannotateType typ)@@ -250,62 +290,62 @@ Core.TypeMap v1 -> (Flows.pure v1) _ -> (Monads.unexpected "map type" (Core_.type_ typ))) stripped) +-- | Ensure a function has the expected number of arguments nArgs :: (Core.Name -> Int -> [t0] -> Compute.Flow t1 ()) nArgs name n args = (Logic.ifElse (Equality.equal (Lists.length args) n) (Flows.pure ()) (Monads.unexpected (Strings.cat [ Literals.showInt32 n, " arguments to primitive ", (Literals.showString (Core.unName name))]) (Literals.showInt32 (Lists.length args)))) -optional :: ((Core.Term -> Compute.Flow Graph.Graph t0) -> Core.Term -> Compute.Flow Graph.Graph (Maybe t0))-optional f term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermOptional v1 -> (Optionals.maybe (Flows.pure Nothing) (\t -> Flows.map Optionals.pure (f t)) v1)- _ -> (Monads.unexpected "optional value" (Core_.term term))) term))+-- | Extract an optional value from a term, applying a function to the value if present+maybeTerm :: ((Core.Term -> Compute.Flow Graph.Graph t0) -> Core.Term -> Compute.Flow Graph.Graph (Maybe t0))+maybeTerm f term0 = + let extract = (\term -> (\x -> case x of+ Core.TermMaybe v1 -> (Maybes.maybe (Flows.pure Nothing) (\t -> Flows.map Maybes.pure (f t)) v1)+ _ -> (Monads.unexpected "maybe value" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -optionalType :: (Core.Type -> Compute.Flow t0 Core.Type)-optionalType typ = +-- | Extract the base type from an optional type+maybeType :: (Core.Type -> Compute.Flow t0 Core.Type)+maybeType typ = let stripped = (Rewriting.deannotateType typ) in ((\x -> case x of- Core.TypeOptional v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "optional type" (Core_.type_ typ))) stripped)+ Core.TypeMaybe v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "maybe type" (Core_.type_ typ))) stripped) +-- | Extract a pair of values from a term, applying functions to each component pair :: ((Core.Term -> Compute.Flow Graph.Graph t0) -> (Core.Term -> Compute.Flow Graph.Graph t1) -> Core.Term -> Compute.Flow Graph.Graph (t0, t1))-pair kf vf term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermProduct v1 -> (Logic.ifElse (Equality.equal (Lists.length v1) 2) (Flows.bind (kf (Lists.head v1)) (\kVal -> Flows.bind (vf (Lists.head (Lists.tail v1))) (\vVal -> Flows.pure (kVal, vVal)))) (Monads.unexpected "pair" (Core_.term term)))- _ -> (Monads.unexpected "product" (Core_.term term))) term))--productType :: (Core.Type -> Compute.Flow t0 [Core.Type])-productType typ = - let stripped = (Rewriting.deannotateType typ)- in ((\x -> case x of- Core.TypeProduct v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "product type" (Core_.type_ typ))) stripped)+pair kf vf term0 = + let extract = (\term -> (\x -> case x of+ Core.TermPair v1 -> (Flows.bind (kf (Pairs.first v1)) (\kVal -> Flows.bind (vf (Pairs.second v1)) (\vVal -> Flows.pure (kVal, vVal))))+ _ -> (Monads.unexpected "pair" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -- | Extract a record's fields from a term record :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph [Core.Field])-record expected term0 = (Flows.bind (termRecord term0) (\record -> Logic.ifElse (Equality.equal (Core.recordTypeName record) expected) (Flows.pure (Core.recordFields record)) (Monads.unexpected (Strings.cat [- "record of type ",- (Core.unName expected)]) (Core.unName (Core.recordTypeName record)))))+record expected term0 = (Flows.bind (termRecord term0) (\record -> Logic.ifElse (Equality.equal (Core.recordTypeName record) expected) (Flows.pure (Core.recordFields record)) (Monads.unexpected (Strings.cat2 "record of type " (Core.unName expected)) (Core.unName (Core.recordTypeName record))))) +-- | Extract the field types from a record type recordType :: (Core.Name -> Core.Type -> Compute.Flow t0 [Core.FieldType]) recordType ename typ = let stripped = (Rewriting.deannotateType typ) in ((\x -> case x of- Core.TypeRecord v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.rowTypeTypeName v1)) (Core.unName ename)) (Flows.pure (Core.rowTypeFields v1)) (Monads.unexpected (Strings.cat [- "record of type ",- (Core.unName ename)]) (Strings.cat [- "record of type ",- (Core.unName (Core.rowTypeTypeName v1))])))+ Core.TypeRecord v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.rowTypeTypeName v1)) (Core.unName ename)) (Flows.pure (Core.rowTypeFields v1)) (Monads.unexpected (Strings.cat2 "record of type " (Core.unName ename)) (Strings.cat2 "record of type " (Core.unName (Core.rowTypeTypeName v1))))) _ -> (Monads.unexpected "record type" (Core_.type_ typ))) stripped) -- | Extract a set of terms from a term set :: (Core.Term -> Compute.Flow Graph.Graph (S.Set Core.Term))-set term = (Flows.bind (Lexical.stripAndDereferenceTerm term) (\stripped -> (\x -> case x of- Core.TermSet v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "set" (Core_.term stripped))) stripped))+set term = + let extract = (\stripped -> (\x -> case x of+ Core.TermSet v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "set" (Core_.term stripped))) stripped)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term) (\stripped -> extract stripped)) -setOf :: (Ord t0) => ((Core.Term -> Compute.Flow Graph.Graph t0) -> Core.Term -> Compute.Flow Graph.Graph (S.Set t0))+-- | Extract a set of values from a term, mapping a function over each element+setOf :: Ord t0 => ((Core.Term -> Compute.Flow Graph.Graph t0) -> Core.Term -> Compute.Flow Graph.Graph (S.Set t0)) setOf f term = (Flows.bind (set term) (\els -> Flows.mapSet f els)) +-- | Extract the element type from a set type setType :: (Core.Type -> Compute.Flow t0 Core.Type) setType typ = let stripped = (Rewriting.deannotateType typ)@@ -315,30 +355,27 @@ -- | Extract a string value from a term string :: (Core.Term -> Compute.Flow Graph.Graph String)-string t = (Flows.bind (literal t) stringLiteral)+string t = (Flows.bind (literal t) (\l -> stringLiteral l)) +-- | Extract a string literal from a Literal value stringLiteral :: (Core.Literal -> Compute.Flow t0 String) stringLiteral v = ((\x -> case x of Core.LiteralString v1 -> (Flows.pure v1) _ -> (Monads.unexpected "string" (Core_.literal v))) v) -sumType :: (Core.Type -> Compute.Flow t0 [Core.Type])-sumType typ = - let stripped = (Rewriting.deannotateType typ)- in ((\x -> case x of- Core.TypeSum v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "sum type" (Core_.type_ typ))) stripped)- -- | Extract a record from a term termRecord :: (Core.Term -> Compute.Flow Graph.Graph Core.Record)-termRecord term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermRecord v1 -> (Flows.pure v1)- _ -> (Monads.unexpected "record" (Core_.term term))) term))+termRecord term0 = + let extract = (\term -> (\x -> case x of+ Core.TermRecord v1 -> (Flows.pure v1)+ _ -> (Monads.unexpected "record" (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) -- | Extract a 16-bit unsigned integer value from a term uint16 :: (Core.Term -> Compute.Flow Graph.Graph Int) uint16 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> uint16Value i))) +-- | Extract a uint16 value from an IntegerValue uint16Value :: (Core.IntegerValue -> Compute.Flow t0 Int) uint16Value v = ((\x -> case x of Core.IntegerValueUint16 v1 -> (Flows.pure v1)@@ -348,6 +385,7 @@ uint32 :: (Core.Term -> Compute.Flow Graph.Graph I.Int64) uint32 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> uint32Value i))) +-- | Extract a uint32 value from an IntegerValue uint32Value :: (Core.IntegerValue -> Compute.Flow t0 I.Int64) uint32Value v = ((\x -> case x of Core.IntegerValueUint32 v1 -> (Flows.pure v1)@@ -357,6 +395,7 @@ uint64 :: (Core.Term -> Compute.Flow Graph.Graph Integer) uint64 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> uint64Value i))) +-- | Extract a uint64 value from an IntegerValue uint64Value :: (Core.IntegerValue -> Compute.Flow t0 Integer) uint64Value v = ((\x -> case x of Core.IntegerValueUint64 v1 -> (Flows.pure v1)@@ -366,22 +405,21 @@ uint8 :: (Core.Term -> Compute.Flow Graph.Graph I.Int16) uint8 t = (Flows.bind (literal t) (\l -> Flows.bind (integerLiteral l) (\i -> uint8Value i))) +-- | Extract a uint8 value from an IntegerValue uint8Value :: (Core.IntegerValue -> Compute.Flow t0 I.Int16) uint8Value v = ((\x -> case x of Core.IntegerValueUint8 v1 -> (Flows.pure v1) _ -> (Monads.unexpected "uint8" (Core_.integer v))) v) +-- | Extract the field types from a union type unionType :: (Core.Name -> Core.Type -> Compute.Flow t0 [Core.FieldType]) unionType ename typ = let stripped = (Rewriting.deannotateType typ) in ((\x -> case x of- Core.TypeUnion v1 -> (Logic.ifElse (Equality.equal (Core.rowTypeTypeName v1) ename) (Flows.pure (Core.rowTypeFields v1)) (Monads.unexpected (Strings.cat [- "union of type ",- (Core.unName ename)]) (Strings.cat [- "union of type ",- (Core.unName (Core.rowTypeTypeName v1))])))+ Core.TypeUnion v1 -> (Logic.ifElse (Equality.equal (Core.rowTypeTypeName v1) ename) (Flows.pure (Core.rowTypeFields v1)) (Monads.unexpected (Strings.cat2 "union of type " (Core.unName ename)) (Strings.cat2 "union of type " (Core.unName (Core.rowTypeTypeName v1))))) _ -> (Monads.unexpected "union type" (Core_.type_ typ))) stripped) +-- | Extract a unit value from a term unit :: (Core.Term -> Compute.Flow t0 ()) unit term = ((\x -> case x of Core.TermUnit -> (Flows.pure ())@@ -389,31 +427,20 @@ -- | Extract a unit variant (a variant with an empty record value) from a union term unitVariant :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph Core.Name)-unitVariant tname term = (Flows.bind (variant tname term) (\field -> Flows.bind (unit (Core.fieldTerm field)) (\ignored -> Flows.pure (Core.fieldName field))))---- | Extract a field from a union term (alias for injection)-variant :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph Core.Field)-variant = injection+unitVariant tname term = (Flows.bind (injection tname term) (\field -> Flows.bind (unit (Core.fieldTerm field)) (\ignored -> Flows.pure (Core.fieldName field)))) -- | Extract the wrapped value from a wrapped term wrap :: (Core.Name -> Core.Term -> Compute.Flow Graph.Graph Core.Term)-wrap expected term0 = (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> (\x -> case x of- Core.TermWrap v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTermTypeName v1)) (Core.unName expected)) (Flows.pure (Core.wrappedTermObject v1)) (Monads.unexpected (Strings.cat [- "wrapper of type ",- (Core.unName expected)]) (Core.unName (Core.wrappedTermTypeName v1))))- _ -> (Monads.unexpected (Strings.cat [- Strings.cat [- "wrap(",- (Core.unName expected)],- ")"]) (Core_.term term))) term))+wrap expected term0 = + let extract = (\term -> (\x -> case x of+ Core.TermWrap v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTermTypeName v1)) (Core.unName expected)) (Flows.pure (Core.wrappedTermBody v1)) (Monads.unexpected (Strings.cat2 "wrapper of type " (Core.unName expected)) (Core.unName (Core.wrappedTermTypeName v1))))+ _ -> (Monads.unexpected (Strings.cat2 (Strings.cat2 "wrap(" (Core.unName expected)) ")") (Core_.term term))) term)+ in (Flows.bind (Lexical.stripAndDereferenceTerm term0) (\term -> extract term)) +-- | Extract the wrapped type from a wrapper type wrappedType :: (Core.Name -> Core.Type -> Compute.Flow t0 Core.Type) wrappedType ename typ = let stripped = (Rewriting.deannotateType typ) in ((\x -> case x of- Core.TypeWrap v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTypeTypeName v1)) (Core.unName ename)) (Flows.pure (Core.wrappedTypeObject v1)) (Monads.unexpected (Strings.cat [- "wrapped type ",- (Core.unName ename)]) (Strings.cat [- "wrapped type ",- (Core.unName (Core.wrappedTypeTypeName v1))])))+ Core.TypeWrap v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTypeTypeName v1)) (Core.unName ename)) (Flows.pure (Core.wrappedTypeBody v1)) (Monads.unexpected (Strings.cat2 "wrapped type " (Core.unName ename)) (Strings.cat2 "wrapped type " (Core.unName (Core.wrappedTypeTypeName v1))))) _ -> (Monads.unexpected "wrapped type" (Core_.type_ typ))) stripped)
+ src/gen-main/haskell/Hydra/Extract/Helpers.hs view
@@ -0,0 +1,82 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Helper functions for decoding terms to domain types++module Hydra.Extract.Helpers where++import qualified Hydra.Core as Core+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Decode an Either value using the provided left and right decoders+decodeEither :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> (Graph.Graph -> Core.Term -> Either Util.DecodingError t1) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Either t0 t1))+decodeEither leftDecoder rightDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermEither v1 -> (Eithers.either (\lv -> Eithers.map (\x -> Left x) (leftDecoder g lv)) (\rv -> Eithers.map (\x -> Right x) (rightDecoder g rv)) v1)+ _ -> (Left (Util.DecodingError "expected either value"))) stripped))++-- | Decode a list of elements using the provided element decoder+decodeList :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError [t0])+decodeList elemDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermList v1 -> (Eithers.mapList (elemDecoder g) v1)+ _ -> (Left (Util.DecodingError "expected list"))) stripped))++-- | Decode a Map using the provided key and value decoders+decodeMap :: Ord t0 => ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> (Graph.Graph -> Core.Term -> Either Util.DecodingError t1) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (M.Map t0 t1))+decodeMap keyDecoder valDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermMap v1 -> (Eithers.map Maps.fromList (Eithers.mapList (\kv -> Eithers.bind (keyDecoder g (Pairs.first kv)) (\k -> Eithers.map (\v -> (k, v)) (valDecoder g (Pairs.second kv)))) (Maps.toList v1)))+ _ -> (Left (Util.DecodingError "expected map"))) stripped))++-- | Decode a Maybe value using the provided element decoder+decodeMaybe :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (Maybe t0))+decodeMaybe elemDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermMaybe v1 -> (Eithers.mapMaybe (elemDecoder g) v1)+ _ -> (Left (Util.DecodingError "expected optional value"))) stripped))++-- | Decode a Pair using the provided first and second decoders+decodePair :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> (Graph.Graph -> Core.Term -> Either Util.DecodingError t1) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (t0, t1))+decodePair firstDecoder secondDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermPair v1 -> (Eithers.bind (firstDecoder g (Pairs.first v1)) (\f -> Eithers.map (\s -> (f, s)) (secondDecoder g (Pairs.second v1))))+ _ -> (Left (Util.DecodingError "expected pair"))) stripped))++-- | Decode a Set using the provided element decoder+decodeSet :: Ord t0 => ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError (S.Set t0))+decodeSet elemDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermSet v1 -> (Eithers.map Sets.fromList (Eithers.mapList (elemDecoder g) (Sets.toList v1)))+ _ -> (Left (Util.DecodingError "expected set"))) stripped))++-- | Decode a unit value+decodeUnit :: (Graph.Graph -> Core.Term -> Either Util.DecodingError ())+decodeUnit g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermUnit -> (Right ())+ _ -> (Left (Util.DecodingError "expected a unit value"))) stripped))++-- | Decode a wrapped value using the provided body decoder+decodeWrapped :: ((Graph.Graph -> Core.Term -> Either Util.DecodingError t0) -> Graph.Graph -> Core.Term -> Either Util.DecodingError t0)+decodeWrapped bodyDecoder g term = (Eithers.bind (Eithers.bimap (\x -> Util.DecodingError x) (\x -> x) (Lexical.stripAndDereferenceTermEither g term)) (\stripped -> (\x -> case x of+ Core.TermWrap v1 -> (bodyDecoder g (Core.wrappedTermBody v1))+ _ -> (Left (Util.DecodingError "expected wrapped value"))) stripped))++-- | Require a field from a record's field map and decode it+requireField :: (String -> (t0 -> t1 -> Either Util.DecodingError t2) -> M.Map Core.Name t1 -> t0 -> Either Util.DecodingError t2)+requireField fieldName decoder fieldMap g = (Maybes.maybe (Left (Util.DecodingError (Strings.cat [+ "missing field ",+ fieldName,+ " in record"]))) (\fieldTerm -> decoder g fieldTerm) (Maps.lookup (Core.Name fieldName) fieldMap))++-- | Convert a Record's fields to a Map from Name to Term+toFieldMap :: (Core.Record -> M.Map Core.Name Core.Term)+toFieldMap record = (Maps.fromList (Lists.map (\f -> (Core.fieldName f, (Core.fieldTerm f))) (Core.recordFields record)))
src/gen-main/haskell/Hydra/Extract/Json.hs view
@@ -1,63 +1,78 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for extracting values from JSON objects module Hydra.Extract.Json where import qualified Hydra.Compute as Compute-import qualified Hydra.Json as Json+import qualified Hydra.Json.Model as Model import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Monads as Monads-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -expectArray :: (Json.Value -> Compute.Flow t0 [Json.Value])+-- | Extract an array from a JSON value, failing if the value is not an array+expectArray :: (Model.Value -> Compute.Flow t0 [Model.Value]) expectArray value = ((\x -> case x of- Json.ValueArray v1 -> (Flows.pure v1)+ Model.ValueArray v1 -> (Flows.pure v1) _ -> (Monads.unexpected "JSON array" (showValue value))) value) -expectNumber :: (Json.Value -> Compute.Flow t0 Double)+-- | Extract a number from a JSON value, failing if the value is not a number+expectNumber :: (Model.Value -> Compute.Flow t0 Double) expectNumber value = ((\x -> case x of- Json.ValueNumber v1 -> (Flows.pure v1)+ Model.ValueNumber v1 -> (Flows.pure v1) _ -> (Monads.unexpected "JSON number" (showValue value))) value) -expectObject :: (Json.Value -> Compute.Flow t0 (M.Map String Json.Value))+-- | Extract an object from a JSON value, failing if the value is not an object+expectObject :: (Model.Value -> Compute.Flow t0 (M.Map String Model.Value)) expectObject value = ((\x -> case x of- Json.ValueObject v1 -> (Flows.pure v1)+ Model.ValueObject v1 -> (Flows.pure v1) _ -> (Monads.unexpected "JSON object" (showValue value))) value) -expectString :: (Json.Value -> Compute.Flow t0 String)+-- | Extract a string from a JSON value, failing if the value is not a string+expectString :: (Model.Value -> Compute.Flow t0 String) expectString value = ((\x -> case x of- Json.ValueString v1 -> (Flows.pure v1)+ Model.ValueString v1 -> (Flows.pure v1) _ -> (Monads.unexpected "JSON string" (showValue value))) value) -opt :: (Ord t0) => (t0 -> M.Map t0 t1 -> Maybe t1)+-- | Look up an optional field in a JSON object+opt :: Ord t0 => (t0 -> M.Map t0 t1 -> Maybe t1) opt fname m = (Maps.lookup fname m) -optArray :: (Ord t0) => (t0 -> M.Map t0 Json.Value -> Compute.Flow t1 (Maybe [Json.Value]))-optArray fname m = (Optionals.maybe (Flows.pure Nothing) (\a -> Flows.map Optionals.pure (expectArray a)) (opt fname m))+-- | Look up an optional array field in a JSON object+optArray :: Ord t0 => (t0 -> M.Map t0 Model.Value -> Compute.Flow t1 (Maybe [Model.Value]))+optArray fname m = (Maybes.maybe (Flows.pure Nothing) (\a -> Flows.map Maybes.pure (expectArray a)) (opt fname m)) -optString :: (Ord t0) => (t0 -> M.Map t0 Json.Value -> Compute.Flow t1 (Maybe String))-optString fname m = (Optionals.maybe (Flows.pure Nothing) (\s -> Flows.map Optionals.pure (expectString s)) (opt fname m))+-- | Look up an optional string field in a JSON object+optString :: Ord t0 => (t0 -> M.Map t0 Model.Value -> Compute.Flow t1 (Maybe String))+optString fname m = (Maybes.maybe (Flows.pure Nothing) (\s -> Flows.map Maybes.pure (expectString s)) (opt fname m)) -require :: (Ord t0) => (t0 -> M.Map t0 t1 -> Compute.Flow t2 t1)-require fname m = (Optionals.maybe (Flows.fail (Strings.cat [+-- | Look up a required field in a JSON object, failing if not found+require :: Ord t0 => (t0 -> M.Map t0 t1 -> Compute.Flow t2 t1)+require fname m = (Maybes.maybe (Flows.fail (Strings.cat [ "required attribute ",- showValue fname,+ (showValue fname), " not found"])) (\value -> Flows.pure value) (Maps.lookup fname m)) -requireArray :: (Ord t0) => (t0 -> M.Map t0 Json.Value -> Compute.Flow t1 [Json.Value])+-- | Look up a required array field in a JSON object+requireArray :: Ord t0 => (t0 -> M.Map t0 Model.Value -> Compute.Flow t1 [Model.Value]) requireArray fname m = (Flows.bind (require fname m) expectArray) -requireNumber :: (Ord t0) => (t0 -> M.Map t0 Json.Value -> Compute.Flow t1 Double)+-- | Look up a required number field in a JSON object+requireNumber :: Ord t0 => (t0 -> M.Map t0 Model.Value -> Compute.Flow t1 Double) requireNumber fname m = (Flows.bind (require fname m) expectNumber) -requireString :: (Ord t0) => (t0 -> M.Map t0 Json.Value -> Compute.Flow t1 String)+-- | Look up a required string field in a JSON object+requireString :: Ord t0 => (t0 -> M.Map t0 Model.Value -> Compute.Flow t1 String) requireString fname m = (Flows.bind (require fname m) expectString) +-- | Show a JSON value as a string (placeholder implementation) showValue :: (t0 -> String) showValue value = "TODO: implement showValue"
− src/gen-main/haskell/Hydra/Extract/Mantle.hs
@@ -1,22 +0,0 @@--- | A DSL for decoding and validating Hydra terms at runtime. This module provides functions to extract typed values from Hydra terms with appropriate error handling.--module Hydra.Extract.Mantle where--import qualified Hydra.Compute as Compute-import qualified Hydra.Core as Core-import qualified Hydra.Extract.Core as Core_-import qualified Hydra.Graph as Graph-import qualified Hydra.Lib.Equality as Equality-import qualified Hydra.Lib.Flows as Flows-import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Mantle as Mantle-import qualified Hydra.Monads as Monads-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Extract a comparison from a term-comparison :: (Core.Term -> Compute.Flow Graph.Graph Mantle.Comparison)-comparison term = (Flows.bind (Core_.unitVariant (Core.Name "hydra.mantle.Comparison") term) (\fname -> Logic.ifElse (Equality.equal (Core.unName fname) "equalTo") (Flows.pure Mantle.ComparisonEqualTo) (Logic.ifElse (Equality.equal (Core.unName fname) "lessThan") (Flows.pure Mantle.ComparisonLessThan) (Logic.ifElse (Equality.equal (Core.unName fname) "greaterThan") (Flows.pure Mantle.ComparisonGreaterThan) (Monads.unexpected "comparison" (Core.unName fname))))))
+ src/gen-main/haskell/Hydra/Extract/Util.hs view
@@ -0,0 +1,25 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Extraction and validation for hydra.util types++module Hydra.Extract.Util where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Monads as Monads+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Extract a comparison from a term+comparison :: (Core.Term -> Compute.Flow Graph.Graph Util.Comparison)+comparison term = (Flows.bind (Core_.unitVariant (Core.Name "hydra.util.Comparison") term) (\fname -> Logic.ifElse (Equality.equal (Core.unName fname) "equalTo") (Flows.pure Util.ComparisonEqualTo) (Logic.ifElse (Equality.equal (Core.unName fname) "lessThan") (Flows.pure Util.ComparisonLessThan) (Logic.ifElse (Equality.equal (Core.unName fname) "greaterThan") (Flows.pure Util.ComparisonGreaterThan) (Monads.unexpected "comparison" (Core.unName fname))))))
src/gen-main/haskell/Hydra/Formatting.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | String formatting types and functions. module Hydra.Formatting where@@ -7,11 +9,13 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -22,7 +26,7 @@ capitalize = (mapFirstLetter Strings.toUpper) -- | Convert a string from one case convention to another-convertCase :: (Mantle.CaseConvention -> Mantle.CaseConvention -> String -> String)+convertCase :: (Util.CaseConvention -> Util.CaseConvention -> String -> String) convertCase from to original = let parts = let byCaps = @@ -32,52 +36,45 @@ []] (Lists.reverse (Strings.toList (decapitalize original))))) byUnderscores = (Strings.splitOn "_" original) in ((\x -> case x of- Mantle.CaseConventionCamel -> byCaps- Mantle.CaseConventionPascal -> byCaps- Mantle.CaseConventionLowerSnake -> byUnderscores- Mantle.CaseConventionUpperSnake -> byUnderscores) from)+ Util.CaseConventionCamel -> byCaps+ Util.CaseConventionPascal -> byCaps+ Util.CaseConventionLowerSnake -> byUnderscores+ Util.CaseConventionUpperSnake -> byUnderscores) from) in ((\x -> case x of- Mantle.CaseConventionCamel -> (decapitalize (Strings.cat (Lists.map (\arg_ -> capitalize (Strings.toLower arg_)) parts)))- Mantle.CaseConventionPascal -> (Strings.cat (Lists.map (\arg_ -> capitalize (Strings.toLower arg_)) parts))- Mantle.CaseConventionLowerSnake -> (Strings.intercalate "_" (Lists.map Strings.toLower parts))- Mantle.CaseConventionUpperSnake -> (Strings.intercalate "_" (Lists.map Strings.toUpper parts))) to)+ Util.CaseConventionCamel -> (decapitalize (Strings.cat (Lists.map (\arg_ -> capitalize (Strings.toLower arg_)) parts)))+ Util.CaseConventionPascal -> (Strings.cat (Lists.map (\arg_ -> capitalize (Strings.toLower arg_)) parts))+ Util.CaseConventionLowerSnake -> (Strings.intercalate "_" (Lists.map Strings.toLower parts))+ Util.CaseConventionUpperSnake -> (Strings.intercalate "_" (Lists.map Strings.toUpper parts))) to) -- | Convert a string from camel case to lower snake case convertCaseCamelToLowerSnake :: (String -> String)-convertCaseCamelToLowerSnake = (convertCase Mantle.CaseConventionCamel Mantle.CaseConventionLowerSnake)+convertCaseCamelToLowerSnake = (convertCase Util.CaseConventionCamel Util.CaseConventionLowerSnake) -- | Convert a string from camel case to upper snake case convertCaseCamelToUpperSnake :: (String -> String)-convertCaseCamelToUpperSnake = (convertCase Mantle.CaseConventionCamel Mantle.CaseConventionUpperSnake)+convertCaseCamelToUpperSnake = (convertCase Util.CaseConventionCamel Util.CaseConventionUpperSnake) -- | Convert a string from pascal case to upper snake case convertCasePascalToUpperSnake :: (String -> String)-convertCasePascalToUpperSnake = (convertCase Mantle.CaseConventionPascal Mantle.CaseConventionUpperSnake)+convertCasePascalToUpperSnake = (convertCase Util.CaseConventionPascal Util.CaseConventionUpperSnake) -- | Decapitalize the first letter of a string decapitalize :: (String -> String) decapitalize = (mapFirstLetter Strings.toLower) +-- | Escape reserved words by appending an underscore escapeWithUnderscore :: (S.Set String -> String -> String)-escapeWithUnderscore reserved s = (Logic.ifElse (Sets.member s reserved) (Strings.cat [- s,- "_"]) s)+escapeWithUnderscore reserved s = (Logic.ifElse (Sets.member s reserved) (Strings.cat2 s "_") s) +-- | Indent each line of a string with four spaces indentLines :: (String -> String) indentLines s = - let indent = (\l -> Strings.cat [- " ",- l])+ let indent = (\l -> Strings.cat2 " " l) in (Strings.unlines (Lists.map indent (Strings.lines s))) +-- | Format a string as a Java-style block comment javaStyleComment :: (String -> String)-javaStyleComment s = (Strings.cat [- Strings.cat [- Strings.cat [- "/**\n",- " * "],- s],- "\n */"])+javaStyleComment s = (Strings.cat2 (Strings.cat2 (Strings.cat2 "/**\n" " * ") s) "\n */") -- | A helper which maps the first letter of a string to another string mapFirstLetter :: ((String -> String) -> String -> String)@@ -87,31 +84,36 @@ let firstLetter = (mapping (Strings.fromList (Lists.pure (Lists.head list)))) in (Logic.ifElse (Strings.null s) s (Strings.cat2 firstLetter (Strings.fromList (Lists.tail list)))) +-- | Replace sequences of non-alphanumeric characters with single underscores nonAlnumToUnderscores :: (String -> String) nonAlnumToUnderscores input = let isAlnum = (\c -> Logic.or (Logic.and (Equality.gte c 65) (Equality.lte c 90)) (Logic.or (Logic.and (Equality.gte c 97) (Equality.lte c 122)) (Logic.and (Equality.gte c 48) (Equality.lte c 57)))) in let replace = (\p -> \c -> - let s = (fst p)+ let s = (Pairs.first p) in - let b = (snd p)+ let b = (Pairs.second p) in (Logic.ifElse (isAlnum c) (Lists.cons c s, False) (Logic.ifElse b (s, True) (Lists.cons 95 s, True)))) in let result = (Lists.foldl replace ([], False) (Strings.toList input))- in (Strings.fromList (Lists.reverse (fst result)))+ in (Strings.fromList (Lists.reverse (Pairs.first result))) +-- | Sanitize a string by replacing non-alphanumeric characters and escaping reserved words sanitizeWithUnderscores :: (S.Set String -> String -> String) sanitizeWithUnderscores reserved s = (escapeWithUnderscore reserved (nonAlnumToUnderscores s)) +-- | Format a list of elements as a bracketed, comma-separated string showList :: ((t0 -> String) -> [t0] -> String) showList f els = (Strings.cat [ "[",- Strings.intercalate ", " (Lists.map f els),+ (Strings.intercalate ", " (Lists.map f els)), "]"]) +-- | Remove leading and trailing whitespace from a string stripLeadingAndTrailingWhitespace :: (String -> String) stripLeadingAndTrailingWhitespace s = (Strings.fromList (Lists.dropWhile Chars.isSpace (Lists.reverse (Lists.dropWhile Chars.isSpace (Lists.reverse (Strings.toList s)))))) +-- | Replace special characters with their alphanumeric aliases withCharacterAliases :: (String -> String) withCharacterAliases original = let aliases = (Maps.fromList [@@ -148,7 +150,7 @@ (124, "verbar"), (125, "rcub"), (126, "tilde")]) - alias = (\c -> Optionals.fromMaybe (Lists.pure c) (Optionals.map Strings.toList (Maps.lookup c aliases)))+ alias = (\c -> Maybes.fromMaybe (Lists.pure c) (Maybes.map Strings.toList (Maps.lookup c aliases))) in (Strings.fromList (Lists.filter Chars.isAlphaNum (Lists.concat (Lists.map alias (Strings.toList original))))) -- | A simple soft line wrap which is suitable for code comments@@ -157,8 +159,8 @@ let helper = (\prev -> \rem -> let trunc = (Lists.take maxlen rem) spanResult = (Lists.span (\c -> Logic.and (Logic.not (Equality.equal c 32)) (Logic.not (Equality.equal c 9))) (Lists.reverse trunc))- prefix = (Lists.reverse (snd spanResult))- suffix = (Lists.reverse (fst spanResult))+ prefix = (Lists.reverse (Pairs.second spanResult))+ suffix = (Lists.reverse (Pairs.first spanResult)) in (Logic.ifElse (Equality.lte (Lists.length rem) maxlen) (Lists.reverse (Lists.cons rem prev)) (Logic.ifElse (Lists.null prefix) (helper (Lists.cons trunc prev) (Lists.drop maxlen rem)) (helper (Lists.cons (Lists.init prefix) prev) (Lists.concat2 suffix (Lists.drop maxlen rem)))))) in (Strings.fromList (Lists.intercalate [ 10] (helper [] (Strings.toList input))))
src/gen-main/haskell/Hydra/Grammar.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A common API for BNF-based grammars, specifying context-free languages module Hydra.Grammar where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -36,7 +39,9 @@ -- | A pattern together with a name (label) data LabeledPattern = LabeledPattern {+ -- | The label for the pattern labeledPatternLabel :: Label,+ -- | The pattern being labeled labeledPatternPattern :: Pattern} deriving (Eq, Ord, Read, Show) @@ -48,16 +53,27 @@ -- | A pattern which matches valid expressions in the language data Pattern = + -- | A choice between alternative patterns PatternAlternatives [Pattern] |+ -- | A constant (terminal) pattern PatternConstant Constant |+ -- | A pattern to be ignored (not captured) PatternIgnored Pattern |+ -- | A labeled pattern PatternLabeled LabeledPattern |+ -- | An empty pattern PatternNil |+ -- | A nonterminal symbol reference PatternNonterminal Symbol |+ -- | An optional pattern (zero or one occurrence) PatternOption Pattern |+ -- | One or more occurrences of a pattern PatternPlus Pattern |+ -- | A regular expression pattern PatternRegex Regex |+ -- | A sequence of patterns PatternSequence [Pattern] |+ -- | Zero or more occurrences of a pattern PatternStar Pattern deriving (Eq, Ord, Read, Show) @@ -88,7 +104,9 @@ -- | A BNF production data Production = Production {+ -- | The nonterminal symbol being defined productionSymbol :: Symbol,+ -- | The pattern which defines the symbol productionPattern :: Pattern} deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Grammars.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A utility for converting a BNF grammar to a Hydra module. module Hydra.Grammars where@@ -13,11 +15,13 @@ import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Module as Module import qualified Hydra.Names as Names-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -34,32 +38,42 @@ findNames :: ([Grammar.Pattern] -> [String]) findNames pats = let nextName = (\acc -> \pat -> - let names = (fst acc) - nameMap = (snd acc)- rn = (rawName pat)- nameAndIndex = (Optionals.maybe (rn, 1) (\i -> (Strings.cat2 rn (Literals.showInt32 (Math.add i 1)), (Math.add i 1))) (Maps.lookup rn nameMap))- nn = (fst nameAndIndex)- ni = (snd nameAndIndex)- in (Lists.cons nn names, (Maps.insert rn ni nameMap)))- in (Lists.reverse (fst (Lists.foldl nextName ([], Maps.empty) pats)))+ let names = (Pairs.first acc)+ in + let nameMap = (Pairs.second acc)+ in + let rn = (rawName pat)+ in + let nameAndIndex = (Maybes.maybe (rn, 1) (\i -> (Strings.cat2 rn (Literals.showInt32 (Math.add i 1)), (Math.add i 1))) (Maps.lookup rn nameMap))+ in + let nn = (Pairs.first nameAndIndex)+ in + let ni = (Pairs.second nameAndIndex)+ in (Lists.cons nn names, (Maps.insert rn ni nameMap)))+ in (Lists.reverse (Pairs.first (Lists.foldl nextName ([], Maps.empty) pats))) -- | Convert a BNF grammar to a Hydra module grammarToModule :: (Module.Namespace -> Grammar.Grammar -> Maybe String -> Module.Module) grammarToModule ns grammar desc = - let prodPairs = (Lists.map (\prod -> (Grammar.unSymbol (Grammar.productionSymbol prod), (Grammar.productionPattern prod))) (Grammar.unGrammar grammar)) - capitalizedNames = (Lists.map (\pair -> Formatting.capitalize (fst pair)) prodPairs)- patterns = (Lists.map (\pair -> snd pair) prodPairs)- elementPairs = (Lists.concat (Lists.zipWith (makeElements False ns) capitalizedNames patterns))- elements = (Lists.map (\pair -> - let lname = (fst pair) - typ = (wrapType (snd pair))- in (Annotations.typeElement (toName ns lname) typ)) elementPairs)- in Module.Module {- Module.moduleNamespace = ns,- Module.moduleElements = elements,- Module.moduleTermDependencies = [],- Module.moduleTypeDependencies = [],- Module.moduleDescription = desc}+ let prodPairs = (Lists.map (\prod -> (Grammar.unSymbol (Grammar.productionSymbol prod), (Grammar.productionPattern prod))) (Grammar.unGrammar grammar))+ in + let capitalizedNames = (Lists.map (\pair -> Formatting.capitalize (Pairs.first pair)) prodPairs)+ in + let patterns = (Lists.map (\pair -> Pairs.second pair) prodPairs)+ in + let elementPairs = (Lists.concat (Lists.zipWith (makeElements False ns) capitalizedNames patterns))+ in + let elements = (Lists.map (\pair -> + let lname = (Pairs.first pair)+ in + let typ = (wrapType (Pairs.second pair))+ in (Annotations.typeElement (toName ns lname) typ)) elementPairs)+ in Module.Module {+ Module.moduleNamespace = ns,+ Module.moduleElements = elements,+ Module.moduleTermDependencies = [],+ Module.moduleTypeDependencies = [],+ Module.moduleDescription = desc} -- | Check if pattern is complex isComplex :: (Grammar.Pattern -> Bool)@@ -73,49 +87,59 @@ isNontrivial :: (Bool -> [Grammar.Pattern] -> Bool) isNontrivial isRecord pats = let minPats = (simplify isRecord pats)- in (Logic.ifElse (Equality.equal (Lists.length minPats) 1) ((\x -> case x of- Grammar.PatternLabeled _ -> True- _ -> False) (Lists.head minPats)) True)+ in + let isLabeled = (\p -> (\x -> case x of+ Grammar.PatternLabeled _ -> True+ _ -> False) p)+ in (Logic.ifElse (Equality.equal (Lists.length minPats) 1) (isLabeled (Lists.head minPats)) True) -- | Create elements from pattern makeElements :: (Bool -> Module.Namespace -> String -> Grammar.Pattern -> [(String, Core.Type)]) makeElements omitTrivial ns lname pat = let trivial = (Logic.ifElse omitTrivial [] [- (lname, Core.TypeUnit)]) - forRecordOrUnion = (\isRecord -> \construct -> \pats -> - let minPats = (simplify isRecord pats) - fieldNames = (findNames minPats)- toField = (\n -> \p -> descend n (\pairs -> (Core.FieldType {- Core.fieldTypeName = (Core.Name n),- Core.fieldTypeType = (snd (Lists.head pairs))}, (Lists.tail pairs))) p)- fieldPairs = (Lists.zipWith toField fieldNames minPats)- fields = (Lists.map fst fieldPairs)- els = (Lists.concat (Lists.map snd fieldPairs))- in (Logic.ifElse (isNontrivial isRecord pats) (Lists.cons (lname, (construct fields)) els) (forPat (Lists.head minPats))))- mod = (\n -> \f -> \p -> descend n (\pairs -> Lists.cons (lname, (f (snd (Lists.head pairs)))) (Lists.tail pairs)) p)- descend = (\n -> \f -> \p -> - let cpairs = (makeElements False ns (childName lname n) p)- in (f (Logic.ifElse (isComplex p) (Lists.cons (lname, (Core.TypeVariable (toName ns (fst (Lists.head cpairs))))) cpairs) (Logic.ifElse (Lists.null cpairs) [- (lname, Core.TypeUnit)] (Lists.cons (lname, (snd (Lists.head cpairs))) (Lists.tail cpairs))))))- forPat = (\pat -> (\x -> case x of- Grammar.PatternAlternatives v1 -> (forRecordOrUnion False (\fields -> Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = Constants.placeholderName,- Core.rowTypeFields = fields})) v1)- Grammar.PatternConstant _ -> trivial- Grammar.PatternIgnored _ -> []- Grammar.PatternLabeled v1 -> (forPat (Grammar.labeledPatternPattern v1))- Grammar.PatternNil -> trivial- Grammar.PatternNonterminal v1 -> [- (lname, (Core.TypeVariable (toName ns (Grammar.unSymbol v1))))]- Grammar.PatternOption v1 -> (mod "Option" (\x -> Core.TypeOptional x) v1)- Grammar.PatternPlus v1 -> (mod "Elmt" (\x -> Core.TypeList x) v1)- Grammar.PatternRegex _ -> [- (lname, (Core.TypeLiteral Core.LiteralTypeString))]- Grammar.PatternSequence v1 -> (forRecordOrUnion True (\fields -> Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = Constants.placeholderName,- Core.rowTypeFields = fields})) v1)- Grammar.PatternStar v1 -> (mod "Elmt" (\x -> Core.TypeList x) v1)) pat)- in (forPat pat)+ (lname, Core.TypeUnit)])+ in + let descend = (\n -> \f -> \p -> + let cpairs = (makeElements False ns (childName lname n) p)+ in (f (Logic.ifElse (isComplex p) (Lists.cons (lname, (Core.TypeVariable (toName ns (Pairs.first (Lists.head cpairs))))) cpairs) (Logic.ifElse (Lists.null cpairs) [+ (lname, Core.TypeUnit)] (Lists.cons (lname, (Pairs.second (Lists.head cpairs))) (Lists.tail cpairs))))))+ in + let mod = (\n -> \f -> \p -> descend n (\pairs -> Lists.cons (lname, (f (Pairs.second (Lists.head pairs)))) (Lists.tail pairs)) p)+ in + let forPat = (\pat -> (\x -> case x of+ Grammar.PatternAlternatives v1 -> (forRecordOrUnion False (\fields -> Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = Constants.placeholderName,+ Core.rowTypeFields = fields})) v1)+ Grammar.PatternConstant _ -> trivial+ Grammar.PatternIgnored _ -> []+ Grammar.PatternLabeled v1 -> (forPat (Grammar.labeledPatternPattern v1))+ Grammar.PatternNil -> trivial+ Grammar.PatternNonterminal v1 -> [+ (lname, (Core.TypeVariable (toName ns (Grammar.unSymbol v1))))]+ Grammar.PatternOption v1 -> (mod "Option" (\x -> Core.TypeMaybe x) v1)+ Grammar.PatternPlus v1 -> (mod "Elmt" (\x -> Core.TypeList x) v1)+ Grammar.PatternRegex _ -> [+ (lname, (Core.TypeLiteral Core.LiteralTypeString))]+ Grammar.PatternSequence v1 -> (forRecordOrUnion True (\fields -> Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = Constants.placeholderName,+ Core.rowTypeFields = fields})) v1)+ Grammar.PatternStar v1 -> (mod "Elmt" (\x -> Core.TypeList x) v1)) pat) + forRecordOrUnion = (\isRecord -> \construct -> \pats -> + let minPats = (simplify isRecord pats)+ in + let fieldNames = (findNames minPats)+ in + let toField = (\n -> \p -> descend n (\pairs -> (Core.FieldType {+ Core.fieldTypeName = (Core.Name n),+ Core.fieldTypeType = (Pairs.second (Lists.head pairs))}, (Lists.tail pairs))) p)+ in + let fieldPairs = (Lists.zipWith toField fieldNames minPats)+ in + let fields = (Lists.map Pairs.first fieldPairs)+ in + let els = (Lists.concat (Lists.map Pairs.second fieldPairs))+ in (Logic.ifElse (isNontrivial isRecord pats) (Lists.cons (lname, (construct fields)) els) (forPat (Lists.head minPats))))+ in (forPat pat) -- | Get raw name from pattern rawName :: (Grammar.Pattern -> String)@@ -154,4 +178,4 @@ Core.TypeWrap _ -> t _ -> (Core.TypeWrap (Core.WrappedType { Core.wrappedTypeTypeName = (Core.Name "Placeholder"),- Core.wrappedTypeObject = t}))) t)+ Core.wrappedTypeBody = t}))) t)
src/gen-main/haskell/Hydra/Graph.hs view
@@ -1,10 +1,13 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | The extension to graphs of Hydra's core type system (hydra.core) module Hydra.Graph where import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -14,7 +17,7 @@ data Graph = Graph { -- | All of the elements in the graph- graphElements :: (M.Map Core.Name Core.Binding),+ graphElements :: [Core.Binding], -- | The lambda environment of this graph context; it indicates whether a variable is bound by a lambda (Nothing) or a let (Just term) graphEnvironment :: (M.Map Core.Name (Maybe Core.Term)), -- | The typing environment of the graph@@ -61,7 +64,9 @@ -- | A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms data TermCoder a = TermCoder {+ -- | The Hydra type of encoded terms termCoderType :: Core.Type,+ -- | A coder between Hydra terms and instances of the given type termCoderCoder :: (Compute.Coder Graph Graph Core.Term a)} _TermCoder = (Core.Name "hydra.graph.TermCoder")
+ src/gen-main/haskell/Hydra/Hoisting.hs view
@@ -0,0 +1,639 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Functions for deep term rewriting operations involving hoisting subterms or bindings into enclosing let terms.++module Hydra.Hoisting where++import qualified Hydra.Accessors as Accessors+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Sorting as Sorting+import qualified Hydra.Substitution as Substitution+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Augment bindings with new free variables introduced by substitution, wrapping with lambdas after any type lambdas.+augmentBindingsWithNewFreeVars :: (Typing.TypeContext -> S.Set Core.Name -> [Core.Binding] -> ([Core.Binding], Typing.TermSubst))+augmentBindingsWithNewFreeVars cx boundVars bindings = + let types = (Typing.typeContextTypes cx)+ in + let wrapAfterTypeLambdas = (\vars -> \term -> (\x -> case x of+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (wrapAfterTypeLambdas vars (Core.typeLambdaBody v1))}))+ _ -> (Lists.foldl (\t -> \p -> Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Pairs.first p),+ Core.lambdaDomain = (Pairs.second p),+ Core.lambdaBody = t}))) term (Lists.reverse vars))) term)+ in + let augment = (\b -> + let freeVars = (Sets.toList (Sets.intersection boundVars (Rewriting.freeVariablesInTerm (Core.bindingTerm b))))+ in + let varTypePairs = (Lists.map (\v -> (v, (Maps.lookup v types))) freeVars)+ in + let varTypes = (Maybes.cat (Lists.map Pairs.second varTypePairs))+ in (Logic.ifElse (Logic.or (Lists.null freeVars) (Logic.not (Equality.equal (Lists.length varTypes) (Lists.length varTypePairs)))) (b, Nothing) (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (wrapAfterTypeLambdas varTypePairs (Core.bindingTerm b)),+ Core.bindingType = (Maybes.map (\ts -> Core.TypeScheme {+ Core.typeSchemeVariables = (Core.typeSchemeVariables ts),+ Core.typeSchemeType = (Lists.foldl (\acc -> \t -> Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = t,+ Core.functionTypeCodomain = acc})) (Core.typeSchemeType ts) (Lists.reverse varTypes)),+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts)}) (Core.bindingType b))}, (Just (Core.bindingName b, (Lists.foldl (\t -> \v -> Core.TermApplication (Core.Application {+ Core.applicationFunction = t,+ Core.applicationArgument = (Core.TermVariable v)})) (Core.TermVariable (Core.bindingName b)) freeVars))))))+ in + let results = (Lists.map augment bindings)+ in (Lists.map Pairs.first results, (Typing.TermSubst (Maps.fromList (Maybes.cat (Lists.map Pairs.second results)))))++-- | Check if a binding has a polymorphic type (non-empty list of type scheme variables)+bindingIsPolymorphic :: (Core.Binding -> Bool)+bindingIsPolymorphic binding = (Maybes.maybe False (\ts -> Logic.not (Lists.null (Core.typeSchemeVariables ts))) (Core.bindingType binding))++-- | Check if a binding's type uses any type variables from the given TypeContext. Returns True if the free type variables in the binding's type intersect with the type variables in scope (typeContextTypeVariables).+bindingUsesContextTypeVars :: (Typing.TypeContext -> Core.Binding -> Bool)+bindingUsesContextTypeVars cx binding = (Maybes.maybe False (\ts -> + let freeInType = (Rewriting.freeVariablesInType (Core.typeSchemeType ts))+ in + let contextTypeVars = (Typing.typeContextTypeVariables cx)+ in (Logic.not (Sets.null (Sets.intersection freeInType contextTypeVars)))) (Core.bindingType binding))++-- | Count the number of occurrences of a variable name in a term. Assumes no variable shadowing.+countVarOccurrences :: (Core.Name -> Core.Term -> Int)+countVarOccurrences name term = + let childCount = (Lists.foldl (\acc -> \t -> Math.add acc (countVarOccurrences name t)) 0 (Rewriting.subterms term))+ in ((\x -> case x of+ Core.TermVariable v1 -> (Logic.ifElse (Equality.equal v1 name) (Math.add 1 childCount) childCount)+ _ -> childCount) term)++-- | Transform a let-term by pulling ALL let bindings to the top level. This is useful for targets like Java that don't support nested let expressions at all. If a hoisted binding captures lambda-bound variables from an enclosing scope, the binding is wrapped in lambdas for those variables, and references are replaced with applications. Note: Assumes no variable shadowing; use hydra.rewriting.unshadowVariables first.+hoistAllLetBindings :: (Core.Let -> Core.Let)+hoistAllLetBindings let0 = + let emptyIx = Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = Maps.empty,+ Typing.inferenceContextPrimitiveTypes = Maps.empty,+ Typing.inferenceContextDataTypes = Maps.empty,+ Typing.inferenceContextClassConstraints = Maps.empty,+ Typing.inferenceContextDebug = False}+ in + let emptyCx = Typing.TypeContext {+ Typing.typeContextTypes = Maps.empty,+ Typing.typeContextMetadata = Maps.empty,+ Typing.typeContextTypeVariables = Sets.empty,+ Typing.typeContextLambdaVariables = Sets.empty,+ Typing.typeContextLetVariables = Sets.empty,+ Typing.typeContextInferenceContext = emptyIx}+ in (hoistLetBindingsWithPredicate (\_ -> True) shouldHoistAll emptyCx let0)++-- | Hoist case statements into local let bindings. This is useful for targets such as Python which only support case statements (match) at the top level. Case statements are hoisted only when they appear at non-top-level positions. Top level = root, or reachable through annotations, let body/binding, lambda bodies, or ONE application LHS. Once through an application LHS, lambda bodies no longer count as pass-through.+hoistCaseStatements :: (Typing.TypeContext -> Core.Term -> Core.Term)+hoistCaseStatements = (hoistSubterms shouldHoistCaseStatement)++-- | Hoist case statements into local let bindings for all elements in a graph. This version operates prior to inference and uses an empty type context. It hoists case statements and their applied arguments into let bindings.+hoistCaseStatementsInGraph :: (Graph.Graph -> Compute.Flow t0 Graph.Graph)+hoistCaseStatementsInGraph graph = + let emptyIx = Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = Maps.empty,+ Typing.inferenceContextPrimitiveTypes = Maps.empty,+ Typing.inferenceContextDataTypes = Maps.empty,+ Typing.inferenceContextClassConstraints = Maps.empty,+ Typing.inferenceContextDebug = False}+ in + let emptyTx = Typing.TypeContext {+ Typing.typeContextTypes = Maps.empty,+ Typing.typeContextMetadata = Maps.empty,+ Typing.typeContextTypeVariables = Sets.empty,+ Typing.typeContextLambdaVariables = Sets.empty,+ Typing.typeContextLetVariables = Sets.empty,+ Typing.typeContextInferenceContext = emptyIx}+ in + let gterm0 = (Schemas.graphAsTerm graph)+ in + let gterm1 = (hoistCaseStatements emptyTx gterm0)+ in + let newElements = (Schemas.termAsGraph gterm1)+ in (Flows.pure (Graph.Graph {+ Graph.graphElements = newElements,+ Graph.graphEnvironment = (Graph.graphEnvironment graph),+ Graph.graphTypes = (Graph.graphTypes graph),+ Graph.graphBody = (Graph.graphBody graph),+ Graph.graphPrimitives = (Graph.graphPrimitives graph),+ Graph.graphSchema = (Graph.graphSchema graph)}))++-- | Transform a let-term by pulling polymorphic let bindings to the top level, using TypeContext. A binding is hoisted if: (1) It is polymorphic (has non-empty typeSchemeVariables), OR (2) Its type uses type variables from the TypeContext (i.e., from enclosing type lambdas). Bindings which are already at the top level are not hoisted. If a hoisted binding captures lambda-bound or let-bound variables from an enclosing scope, the binding is wrapped in lambdas for those variables, and references are replaced with applications. If a hoisted binding uses type variables from the context, those type variables are added to the binding's type scheme. Note: we assume that there is no variable shadowing; use hydra.rewriting.unshadowVariables first.+hoistLetBindingsWithContext :: ((Core.Binding -> Bool) -> Typing.TypeContext -> Core.Let -> Core.Let)+hoistLetBindingsWithContext isParentBinding cx let0 = (hoistLetBindingsWithPredicate isParentBinding shouldHoistPolymorphic cx let0)++-- | Transform a let-term by pulling let bindings to the top level. The isParentBinding predicate applies to top-level bindings and determines whether their subterm bindings are eligible for hoisting. The shouldHoistBinding predicate takes the TypeContext and a subterm binding, and returns True if the binding should be hoisted. This is useful for targets like Java that cannot have polymorphic definitions in arbitrary positions. The TypeContext provides information about type variables and lambda variables in scope. If a hoisted binding captures let-bound or lambda-bound variables from an enclosing scope, the binding is wrapped in lambdas for those variables, and references are replaced with applications. If a hoisted binding captures type variables from an enclosing type lambda scope, those type variables are added to the binding's type scheme, and references are replaced with type applications. Note: we assume that there is no variable shadowing; use hydra.rewriting.unshadowVariables first.+hoistLetBindingsWithPredicate :: ((Core.Binding -> Bool) -> (Typing.TypeContext -> Core.Binding -> Bool) -> Typing.TypeContext -> Core.Let -> Core.Let)+hoistLetBindingsWithPredicate isParentBinding shouldHoistBinding cx0 let0 = + let hoistOne = (\prefix -> \cx -> \pair -> \bindingWithCapturedVars -> + let bindingAndReplacementPairs = (Pairs.first pair)+ in + let alreadyUsedNames = (Pairs.second pair)+ in + let b = (Pairs.first bindingWithCapturedVars)+ in + let capturedTermVars = (Pairs.second bindingWithCapturedVars)+ in + let types = (Typing.typeContextTypes cx)+ in + let capturedTermVarTypePairs = (Lists.map (\v -> (v, (Maps.lookup v types))) capturedTermVars)+ in + let capturedTermVarTypes = (Lists.map (\typ -> Rewriting.deannotateTypeParameters typ) (Maybes.cat (Lists.map Pairs.second capturedTermVarTypePairs)))+ in + let freeInBindingType = (Maybes.maybe Sets.empty (\ts -> Rewriting.freeVariablesInType (Core.typeSchemeType ts)) (Core.bindingType b))+ in + let freeInCapturedVarTypes = (Sets.unions (Lists.map (\t -> Rewriting.freeVariablesInType t) capturedTermVarTypes))+ in + let capturedTypeVars = (Sets.toList (Sets.intersection (Typing.typeContextTypeVariables cx) (Sets.union freeInBindingType freeInCapturedVarTypes)))+ in + let globalBindingName = (Lexical.chooseUniqueName alreadyUsedNames (Core.Name (Strings.cat2 prefix (Core.unName (Core.bindingName b)))))+ in + let newUsedNames = (Sets.insert globalBindingName alreadyUsedNames)+ in + let newTypeScheme = (Logic.ifElse (Equality.equal (Lists.length capturedTermVarTypes) (Lists.length capturedTermVarTypePairs)) (Maybes.map (\ts -> Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.nub (Lists.concat2 capturedTypeVars (Core.typeSchemeVariables ts))),+ Core.typeSchemeType = (Lists.foldl (\t -> \a -> Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = a,+ Core.functionTypeCodomain = t})) (Core.typeSchemeType ts) (Lists.reverse capturedTermVarTypes)),+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts)}) (Core.bindingType b)) Nothing)+ in + let strippedTerm = (Rewriting.stripTypeLambdas (Core.bindingTerm b))+ in + let termWithLambdas = (Lists.foldl (\t -> \p -> Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Pairs.first p),+ Core.lambdaDomain = (Maybes.map (\dom -> Rewriting.deannotateTypeParameters dom) (Pairs.second p)),+ Core.lambdaBody = t}))) strippedTerm (Lists.reverse capturedTermVarTypePairs))+ in + let termWithTypeLambdas = (Lists.foldl (\t -> \v -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = v,+ Core.typeLambdaBody = t})) termWithLambdas (Lists.reverse (Maybes.maybe [] Core.typeSchemeVariables newTypeScheme)))+ in + let withTypeApps = (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.TypeVariable v)})) (Core.TermVariable globalBindingName) capturedTypeVars)+ in + let replacement = (Lists.foldl (\t -> \v -> Core.TermApplication (Core.Application {+ Core.applicationFunction = t,+ Core.applicationArgument = (Core.TermVariable v)})) withTypeApps capturedTermVars)+ in + let newBindingAndReplacement = (Core.Binding {+ Core.bindingName = globalBindingName,+ Core.bindingTerm = termWithTypeLambdas,+ Core.bindingType = newTypeScheme}, replacement)+ in + let newPairs = (Lists.cons newBindingAndReplacement bindingAndReplacementPairs)+ in (newPairs, newUsedNames))+ in + let rewrite = (\prefix -> \recurse -> \cx -> \bindingsAndNames -> \term -> + let previouslyFinishedBindings = (Pairs.first bindingsAndNames)+ in + let emptyBindingsAndNames = ([], (Pairs.second bindingsAndNames))+ in + let result = (recurse emptyBindingsAndNames term)+ in + let newBindingsAndNames = (Pairs.first result)+ in + let bindingsSoFar = (Pairs.first newBindingsAndNames)+ in + let alreadyUsedNames = (Pairs.second newBindingsAndNames)+ in + let newTerm = (Pairs.second result)+ in ((\x -> case x of+ Core.TermLet v1 -> + let body = (Core.letBody v1)+ in + let partitionPair = (Lists.partition (shouldHoistBinding cx) (Core.letBindings v1))+ in + let hoistUs = (Pairs.first partitionPair)+ in + let keepUs = (Pairs.second partitionPair)+ in + let hoistedBindingNames = (Lists.map Core.bindingName hoistUs)+ in + let polyLetVariables = (Sets.fromList (Lists.filter (\v -> Maybes.maybe False Schemas.fTypeIsPolymorphic (Maps.lookup v (Typing.typeContextTypes cx))) (Sets.toList (Typing.typeContextLetVariables cx))))+ in + let boundTermVariables = (Sets.union (Typing.typeContextLambdaVariables cx) (Typing.typeContextLetVariables cx))+ in + let freeVariablesInEachBinding = (Lists.map (\b -> Sets.toList (Sets.intersection boundTermVariables (Rewriting.freeVariablesInTerm (Core.bindingTerm b)))) hoistUs)+ in + let bindingDependencies = (Lists.map (\vars -> Lists.partition (\v -> Sets.member v (Sets.fromList hoistedBindingNames)) vars) freeVariablesInEachBinding)+ in + let bindingEdges = (Lists.zip hoistedBindingNames (Lists.map Pairs.first bindingDependencies))+ in + let bindingImmediateCapturedVars = (Lists.zip hoistedBindingNames (Lists.map Pairs.second bindingDependencies))+ in + let capturedVarsMap = (Maps.fromList (Sorting.propagateTags bindingEdges bindingImmediateCapturedVars))+ in + let bindingsWithCapturedVars = (Lists.map (\b -> (b, (Maybes.maybe [] (\vars -> Sets.toList (Sets.difference vars polyLetVariables)) (Maps.lookup (Core.bindingName b) capturedVarsMap)))) hoistUs)+ in + let hoistPairsAndNames = (Lists.foldl (hoistOne prefix cx) ([], alreadyUsedNames) bindingsWithCapturedVars)+ in + let hoistPairs = (Lists.reverse (Pairs.first hoistPairsAndNames))+ in + let hoistedBindings = (Lists.map Pairs.first hoistPairs)+ in + let replacements = (Lists.map Pairs.second hoistPairs)+ in + let finalUsedNames = (Pairs.second hoistPairsAndNames)+ in + let hoistNameReplacementPairs = (Lists.zip (Lists.map Core.bindingName hoistUs) replacements)+ in + let hoistBindingMap = (Maps.fromList (Lists.map (\b -> (Core.bindingName b, b)) hoistUs))+ in + let isCacheable = (\name -> + let multiRef = (Equality.gte (countVarOccurrences name body) 2)+ in + let isPoly = (Maybes.maybe False (\b -> bindingIsPolymorphic b) (Maps.lookup name hoistBindingMap))+ in (Logic.and multiRef (Logic.not isPoly)))+ in + let singleRefPairs = (Lists.filter (\p -> Logic.not (isCacheable (Pairs.first p))) hoistNameReplacementPairs)+ in + let multiRefPairs = (Lists.filter (\p -> isCacheable (Pairs.first p)) hoistNameReplacementPairs)+ in + let fullSubst = (Typing.TermSubst (Maps.fromList hoistNameReplacementPairs))+ in + let bodyOnlySubst = (Typing.TermSubst (Maps.fromList singleRefPairs))+ in + let bodySubst = (Substitution.substituteInTerm bodyOnlySubst body)+ in + let cacheBindings = (Lists.map (\p -> + let origType = (Maybes.maybe Nothing (\b -> Core.bindingType b) (Maps.lookup (Pairs.first p) hoistBindingMap))+ in Core.Binding {+ Core.bindingName = (Pairs.first p),+ Core.bindingTerm = (Pairs.second p),+ Core.bindingType = origType}) multiRefPairs)+ in + let bodyWithCache = (Logic.ifElse (Lists.null cacheBindings) bodySubst (Core.TermLet (Core.Let {+ Core.letBindings = cacheBindings,+ Core.letBody = bodySubst})))+ in + let keepUsSubst = (Lists.map (Substitution.substituteInBinding fullSubst) keepUs)+ in + let hoistedBindingsSubst = (Lists.map (Substitution.substituteInBinding fullSubst) hoistedBindings)+ in + let bindingsSoFarSubst = (Lists.map (Substitution.substituteInBinding fullSubst) bindingsSoFar)+ in + let augmentResult = (augmentBindingsWithNewFreeVars cx (Sets.difference boundTermVariables polyLetVariables) bindingsSoFarSubst)+ in + let bindingsSoFarAugmented = (Pairs.first augmentResult)+ in + let augmentSubst = (Pairs.second augmentResult)+ in + let hoistedBindingsFinal = (Lists.map (Substitution.substituteInBinding augmentSubst) hoistedBindingsSubst)+ in + let bindingsSoFarFinal = (Lists.map (Substitution.substituteInBinding augmentSubst) bindingsSoFarAugmented)+ in + let bodyFinal = (Substitution.substituteInTerm augmentSubst bodyWithCache)+ in + let keepUsFinal = (Lists.map (Substitution.substituteInBinding augmentSubst) keepUsSubst)+ in + let finalTerm = (Logic.ifElse (Lists.null keepUsFinal) bodyFinal (Core.TermLet (Core.Let {+ Core.letBindings = keepUsFinal,+ Core.letBody = bodyFinal})))+ in ((Lists.concat [+ previouslyFinishedBindings,+ hoistedBindingsFinal,+ bindingsSoFarFinal], finalUsedNames), finalTerm)+ _ -> ((Lists.concat2 previouslyFinishedBindings bindingsSoFar, alreadyUsedNames), newTerm)) newTerm))+ in + let cx1 = (Schemas.extendTypeContextForLet (\c -> \b -> Nothing) cx0 let0)+ in + let forActiveBinding = (\b -> + let prefix = (Strings.cat2 (Core.unName (Core.bindingName b)) "_")+ in + let init = ([], (Sets.singleton (Core.bindingName b)))+ in + let resultPair = (rewriteAndFoldTermWithTypeContext (rewrite prefix) cx1 init (Core.bindingTerm b))+ in + let resultBindings = (Pairs.first (Pairs.first resultPair))+ in + let resultTerm = (Pairs.second resultPair)+ in (Lists.cons (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = resultTerm,+ Core.bindingType = (Core.bindingType b)}) resultBindings))+ in + let forBinding = (\b -> Logic.ifElse (isParentBinding b) (forActiveBinding b) [+ b])+ in Core.Let {+ Core.letBindings = (Lists.concat (Lists.map forBinding (Core.letBindings let0))),+ Core.letBody = (Core.letBody let0)}++-- | Transform a let-term by pulling all polymorphic let bindings to the top level. This is useful to ensure that polymorphic bindings are not nested within other terms, which is unsupported by certain targets such as Java. Polymorphic bindings are those with a non-empty list of type scheme variables. If a hoisted binding captures lambda-bound variables from an enclosing scope, the binding is wrapped in lambdas for those variables, and references are replaced with applications. Note: Assumes no variable shadowing; use hydra.rewriting.unshadowVariables first.+hoistPolymorphicLetBindings :: ((Core.Binding -> Bool) -> Core.Let -> Core.Let)+hoistPolymorphicLetBindings isParentBinding let0 = + let emptyIx = Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = Maps.empty,+ Typing.inferenceContextPrimitiveTypes = Maps.empty,+ Typing.inferenceContextDataTypes = Maps.empty,+ Typing.inferenceContextClassConstraints = Maps.empty,+ Typing.inferenceContextDebug = False}+ in + let emptyCx = Typing.TypeContext {+ Typing.typeContextTypes = Maps.empty,+ Typing.typeContextMetadata = Maps.empty,+ Typing.typeContextTypeVariables = Sets.empty,+ Typing.typeContextLambdaVariables = Sets.empty,+ Typing.typeContextLetVariables = Sets.empty,+ Typing.typeContextInferenceContext = emptyIx}+ in (hoistLetBindingsWithPredicate isParentBinding shouldHoistPolymorphic emptyCx let0)++-- | Hoist subterms into local let bindings based on a path-aware predicate. The predicate receives a pair of (path, term) where path is the list of TermAccessors from the root to the current term, and returns True if the term should be hoisted. For each let term found, the immediate subterms (binding values and body) are processed: matching subterms within each immediate subterm are collected and hoisted into a local let that wraps that immediate subterm. If a hoisted term contains free variables that are lambda-bound at an enclosing scope, the hoisted binding is wrapped in lambdas for those variables, and the reference is replaced with an application of those variables.+hoistSubterms :: ((([Accessors.TermAccessor], Core.Term) -> Bool) -> Typing.TypeContext -> Core.Term -> Core.Term)+hoistSubterms shouldHoist cx0 term0 = + let processImmediateSubterm = (\cx -> \counter -> \namePrefix -> \pathPrefix -> \subterm -> + let baselineLambdaVars = (Typing.typeContextLambdaVariables cx)+ in + let collectAndReplace = (\recurse -> \path -> \cxInner -> \acc -> \term -> + let currentCounter = (Pairs.first acc)+ in + let collectedBindings = (Pairs.second acc)+ in ((\x -> case x of+ Core.TermLet _ -> (acc, term)+ Core.TermTypeLambda _ -> (acc, term)+ _ -> + let result = (recurse acc term)+ in + let newAcc = (Pairs.first result)+ in + let processedTerm = (Pairs.second result)+ in + let newCounter = (Pairs.first newAcc)+ in + let newBindings = (Pairs.second newAcc)+ in + let fullPath = (Lists.concat2 pathPrefix path)+ in (Logic.ifElse (shouldHoist (fullPath, processedTerm)) ( + let bindingName = (Core.Name (Strings.cat [+ "_hoist_",+ namePrefix,+ "_",+ (Literals.showInt32 newCounter)]))+ in + let allLambdaVars = (Typing.typeContextLambdaVariables cxInner)+ in + let newLambdaVars = (Sets.difference allLambdaVars baselineLambdaVars)+ in + let freeVars = (Rewriting.freeVariablesInTerm processedTerm)+ in + let capturedVars = (Sets.toList (Sets.intersection newLambdaVars freeVars))+ in + let typeMap = (Typing.typeContextTypes cxInner)+ in + let wrappedTerm = (Lists.foldl (\body -> \varName -> Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = varName,+ Core.lambdaDomain = (Maps.lookup varName typeMap),+ Core.lambdaBody = body}))) processedTerm (Lists.reverse capturedVars))+ in + let reference = (Lists.foldl (\fn -> \varName -> Core.TermApplication (Core.Application {+ Core.applicationFunction = fn,+ Core.applicationArgument = (Core.TermVariable varName)})) (Core.TermVariable bindingName) capturedVars)+ in + let newBinding = Core.Binding {+ Core.bindingName = bindingName,+ Core.bindingTerm = wrappedTerm,+ Core.bindingType = Nothing}+ in ((Math.add newCounter 1, (Lists.cons newBinding newBindings)), reference)) (newAcc, processedTerm))) term))+ in + let result = (rewriteAndFoldTermWithTypeContextAndPath collectAndReplace cx (counter, []) subterm)+ in + let finalAcc = (Pairs.first result)+ in + let transformedSubterm = (Pairs.second result)+ in + let finalCounter = (Pairs.first finalAcc)+ in + let bindings = (Pairs.second finalAcc)+ in (Logic.ifElse (Lists.null bindings) (finalCounter, transformedSubterm) ( + let localLet = (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.reverse bindings),+ Core.letBody = transformedSubterm}))+ in (finalCounter, localLet))))+ in + let processLetTerm = (\cx -> \counter -> \path -> \lt -> + let bindings = (Core.letBindings lt)+ in + let body = (Core.letBody lt)+ in + let processBinding = (\acc -> \binding -> + let namePrefix = (Strings.intercalate "_" (Strings.splitOn "." (Core.unName (Core.bindingName binding))))+ in + let bindingPathPrefix = (Lists.concat2 path [+ Accessors.TermAccessorLetBinding (Core.bindingName binding)])+ in + let result = (processImmediateSubterm cx 1 namePrefix bindingPathPrefix (Core.bindingTerm binding))+ in + let newValue = (Pairs.second result)+ in + let newBinding = Core.Binding {+ Core.bindingName = (Core.bindingName binding),+ Core.bindingTerm = newValue,+ Core.bindingType = (Core.bindingType binding)}+ in (Lists.cons newBinding acc))+ in + let newBindingsReversed = (Lists.foldl processBinding [] bindings)+ in + let newBindings = (Lists.reverse newBindingsReversed)+ in + let bodyPathPrefix = (Lists.concat2 path [+ Accessors.TermAccessorLetBody])+ in + let bodyResult = (processImmediateSubterm cx 1 "_body" bodyPathPrefix body)+ in + let newBody = (Pairs.second bodyResult)+ in (counter, (Core.TermLet (Core.Let {+ Core.letBindings = newBindings,+ Core.letBody = newBody}))))+ in + let rewrite = (\recurse -> \path -> \cx -> \counter -> \term -> (\x -> case x of+ Core.TermLet _ -> + let recursed = (recurse counter term)+ in + let newCounter = (Pairs.first recursed)+ in + let recursedTerm = (Pairs.second recursed)+ in ((\x -> case x of+ Core.TermLet v2 -> (processLetTerm cx newCounter path v2)+ _ -> (newCounter, recursedTerm)) recursedTerm)+ _ -> (recurse counter term)) term)+ in (Pairs.second (rewriteAndFoldTermWithTypeContextAndPath rewrite cx0 1 term0))++isApplicationFunction :: (Accessors.TermAccessor -> Bool)+isApplicationFunction acc = ((\x -> case x of+ Accessors.TermAccessorApplicationFunction -> True+ _ -> False) acc)++-- | Check if a function is a union elimination+isEliminationUnion :: (Core.Function -> Bool)+isEliminationUnion f = ((\x -> case x of+ Core.FunctionElimination v1 -> ((\x -> case x of+ Core.EliminationUnion _ -> True+ _ -> False) v1)+ _ -> False) f)++isLambdaBody :: (Accessors.TermAccessor -> Bool)+isLambdaBody acc = ((\x -> case x of+ Accessors.TermAccessorLambdaBody -> True+ _ -> False) acc)++-- | Check if a term is a union elimination (case statement)+isUnionElimination :: (Core.Term -> Bool)+isUnionElimination term = ((\x -> case x of+ Core.TermFunction v1 -> (isEliminationUnion v1)+ _ -> False) term)++-- | Check if a term is an application of a union elimination (case statement applied to an argument)+isUnionEliminationApplication :: (Core.Term -> Bool)+isUnionEliminationApplication term = ((\x -> case x of+ Core.TermApplication v1 -> (isUnionElimination (Rewriting.deannotateAndDetypeTerm (Core.applicationFunction v1)))+ _ -> False) term)++-- | Normalize a path for hoisting by treating immediately-applied lambdas as let bindings. Replaces [applicationFunction, lambdaBody, ...] with [letBody, ...].+normalizePathForHoisting :: ([Accessors.TermAccessor] -> [Accessors.TermAccessor])+normalizePathForHoisting path = + let go = (\remaining -> Logic.ifElse (Logic.or (Lists.null remaining) (Lists.null (Lists.tail remaining))) remaining ( + let first = (Lists.head remaining)+ in + let second = (Lists.head (Lists.tail remaining))+ in + let rest = (Lists.tail (Lists.tail remaining))+ in (Logic.ifElse (Logic.and (isApplicationFunction first) (isLambdaBody second)) (Lists.cons Accessors.TermAccessorLetBody (go rest)) (Lists.cons first (go (Lists.tail remaining))))))+ in (go path)++-- | Rewrite a term while folding to produce a value, with TypeContext updated as we descend into subterms. Combines the features of rewriteAndFoldTerm and rewriteTermWithTypeContext. The user function f receives a recurse function that handles subterm traversal and TypeContext management.+rewriteAndFoldTermWithTypeContext :: (((t0 -> Core.Term -> (t0, Core.Term)) -> Typing.TypeContext -> t0 -> Core.Term -> (t0, Core.Term)) -> Typing.TypeContext -> t0 -> Core.Term -> (t0, Core.Term))+rewriteAndFoldTermWithTypeContext f cx0 val0 term0 = + let wrapper = (\lowLevelRecurse -> \valAndCx -> \term -> + let val = (Pairs.first valAndCx)+ in + let cx = (Pairs.second valAndCx)+ in + let cx1 = ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Schemas.extendTypeContextForLambda cx v2)+ _ -> cx) v1)+ Core.TermLet v1 -> (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) cx v1)+ Core.TermTypeLambda v1 -> (Schemas.extendTypeContextForTypeLambda cx v1)+ _ -> cx) term)+ in + let recurseForUser = (\newVal -> \subterm -> + let result = (lowLevelRecurse (newVal, cx1) subterm)+ in (Pairs.first (Pairs.first result), (Pairs.second result)))+ in + let fResult = (f recurseForUser cx1 val term)+ in ((Pairs.first fResult, cx), (Pairs.second fResult)))+ in + let result = (Rewriting.rewriteAndFoldTerm wrapper (val0, cx0) term0)+ in (Pairs.first (Pairs.first result), (Pairs.second result))++-- | Rewrite a term while folding to produce a value, with both TypeContext and accessor path tracked. The path is a list of TermAccessors representing the position from the root to the current term. Combines the features of rewriteAndFoldTermWithPath and TypeContext tracking. The TypeContext is automatically updated when descending into lambdas, lets, and type lambdas.+rewriteAndFoldTermWithTypeContextAndPath :: (((t0 -> Core.Term -> (t0, Core.Term)) -> [Accessors.TermAccessor] -> Typing.TypeContext -> t0 -> Core.Term -> (t0, Core.Term)) -> Typing.TypeContext -> t0 -> Core.Term -> (t0, Core.Term))+rewriteAndFoldTermWithTypeContextAndPath f cx0 val0 term0 = + let wrapper = (\recurse -> \path -> \cxAndVal -> \term -> + let cx = (Pairs.first cxAndVal)+ in + let val = (Pairs.second cxAndVal)+ in + let cx1 = ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Schemas.extendTypeContextForLambda cx v2)+ _ -> cx) v1)+ Core.TermLet v1 -> (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) cx v1)+ Core.TermTypeLambda v1 -> (Schemas.extendTypeContextForTypeLambda cx v1)+ _ -> cx) term)+ in + let recurseForUser = (\valIn -> \termIn -> + let result = (recurse path (cx1, valIn) termIn)+ in (Pairs.second (Pairs.first result), (Pairs.second result)))+ in + let fResult = (f recurseForUser path cx1 val term)+ in ((cx, (Pairs.first fResult)), (Pairs.second fResult)))+ in + let result = (Rewriting.rewriteAndFoldTermWithPath wrapper (cx0, val0) term0)+ in (Pairs.second (Pairs.first result), (Pairs.second result))++-- | Rewrite a term with the help of a type context which is updated as we descend into subterms+rewriteTermWithTypeContext :: (((Core.Term -> t0) -> Typing.TypeContext -> Core.Term -> t0) -> Typing.TypeContext -> Core.Term -> t0)+rewriteTermWithTypeContext f cx0 term0 = + let f2 = (\recurse -> \cx -> \term -> + let recurse1 = (\term -> recurse cx term)+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> + let cx1 = (Schemas.extendTypeContextForLambda cx v2)+ in + let recurse2 = (\term -> recurse cx1 term)+ in (f recurse2 cx1 term)+ _ -> (f recurse1 cx term)) v1)+ Core.TermLet v1 -> + let cx1 = (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) cx v1)+ in + let recurse2 = (\term -> recurse cx1 term)+ in (f recurse2 cx1 term)+ Core.TermTypeLambda v1 -> + let cx1 = (Schemas.extendTypeContextForTypeLambda cx v1)+ in + let recurse2 = (\term -> recurse cx1 term)+ in (f recurse2 cx1 term)+ _ -> (f recurse1 cx term)) term))+ in + let rewrite = (\cx -> \term -> f2 rewrite cx term)+ in (rewrite cx0 term0)++-- | Predicate that always returns True, for hoisting all bindings unconditionally.+shouldHoistAll :: (t0 -> t1 -> Bool)+shouldHoistAll _ _ = True++-- | Predicate for case statement hoisting. Returns True if term is a union elimination (bare case function) or a case statement application (union elimination applied to an argument) AND not at top level. Top level = reachable through annotations, let body/binding, lambda bodies, or ONE app LHS. Once through an app LHS, lambda bodies no longer pass through.+shouldHoistCaseStatement :: (([Accessors.TermAccessor], Core.Term) -> Bool)+shouldHoistCaseStatement pathAndTerm = + let path = (Pairs.first pathAndTerm)+ in + let term = (Pairs.second pathAndTerm)+ in (Logic.ifElse (Logic.not (Logic.or (isUnionElimination term) (isUnionEliminationApplication term))) False ( + let finalState = (Lists.foldl (\st -> \acc -> updateHoistState acc st) (True, False) path)+ in (Logic.not (Pairs.first finalState))))++-- | Predicate for hoisting polymorphic bindings. Returns True if the binding is polymorphic (has type scheme variables) or if its type uses any type variables from the TypeContext.+shouldHoistPolymorphic :: (Typing.TypeContext -> Core.Binding -> Bool)+shouldHoistPolymorphic cx binding = (Logic.or (bindingIsPolymorphic binding) (bindingUsesContextTypeVars cx binding))++-- | Update hoisting state when traversing an accessor. State is (atTopLevel, usedAppLHS). Returns updated state.+updateHoistState :: (Accessors.TermAccessor -> (Bool, Bool) -> (Bool, Bool))+updateHoistState accessor state = + let atTop = (Pairs.first state)+ in + let usedApp = (Pairs.second state)+ in (Logic.ifElse (Logic.not atTop) (False, usedApp) ((\x -> case x of+ Accessors.TermAccessorAnnotatedBody -> (True, usedApp)+ Accessors.TermAccessorLetBody -> (True, usedApp)+ Accessors.TermAccessorLetBinding _ -> (True, usedApp)+ Accessors.TermAccessorLambdaBody -> (Logic.ifElse usedApp (False, True) (True, False))+ Accessors.TermAccessorUnionCasesBranch _ -> (Logic.ifElse usedApp (False, True) (True, False))+ Accessors.TermAccessorUnionCasesDefault -> (Logic.ifElse usedApp (False, True) (True, False))+ Accessors.TermAccessorApplicationFunction -> (Logic.ifElse usedApp (False, True) (True, True))+ Accessors.TermAccessorApplicationArgument -> (False, usedApp)+ _ -> (False, usedApp)) accessor))
src/gen-main/haskell/Hydra/Inference.hs view
@@ -1,1179 +1,1085 @@--- | Type inference following Algorithm W, extended for nominal terms and types--module Hydra.Inference where--import qualified Hydra.Annotations as Annotations-import qualified Hydra.Compute as Compute-import qualified Hydra.Core as Core-import qualified Hydra.Extract.Core as Core_-import qualified Hydra.Formatting as Formatting-import qualified Hydra.Graph as Graph-import qualified Hydra.Lexical as Lexical-import qualified Hydra.Lib.Equality as Equality-import qualified Hydra.Lib.Flows as Flows-import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Literals as Literals-import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals-import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import qualified Hydra.Monads as Monads-import qualified Hydra.Rewriting as Rewriting-import qualified Hydra.Schemas as Schemas-import qualified Hydra.Show.Core as Core__-import qualified Hydra.Show.Mantle as Mantle_-import qualified Hydra.Show.Typing as Typing-import qualified Hydra.Sorting as Sorting-import qualified Hydra.Substitution as Substitution-import qualified Hydra.Typing as Typing_-import qualified Hydra.Unification as Unification-import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S--bindConstraints :: (Typing_.InferenceContext -> (Typing_.TypeSubst -> Compute.Flow t0 t1) -> [Typing_.TypeConstraint] -> Compute.Flow t0 t1)-bindConstraints cx f constraints = (Flows.bind (Unification.unifyTypeConstraints (Typing_.inferenceContextSchemaTypes cx) constraints) f)--checkSameType :: (String -> [Core.Type] -> Compute.Flow t0 Core.Type)-checkSameType desc types = - let h = (Lists.head types)- in - let allEqual = (Lists.foldl (\b -> \t -> Logic.and b (Equality.equal t h)) True types)- in (Logic.ifElse allEqual (Flows.pure h) (Flows.fail (Strings.cat [- "unequal types ",- Formatting.showList Core__.type_ types,- " in ",- desc])))--checkType :: (S.Set Core.Name -> Typing_.InferenceContext -> Core.Type -> Core.Term -> Compute.Flow t0 ())-checkType k g t e = (Logic.ifElse debugInference (Flows.bind (typeOfInternal g k (toFContext g) [] e) (\t0 -> Logic.ifElse (Equality.equal t0 t) (Flows.pure ()) (Flows.fail (Strings.cat [- "type checking failed: expected ",- Core__.type_ t,- " but found ",- (Core__.type_ t0)])))) (Flows.pure ()))--checkTypeVariables :: (Typing_.InferenceContext -> S.Set Core.Name -> Core.Type -> Compute.Flow t0 ())-checkTypeVariables cx tyvars typ = (Monads.withTrace (Strings.cat [- "checking variables of: ",- (Core__.type_ typ)]) ((\x -> case x of- Core.TypeForall v1 -> (checkTypeVariables cx (Sets.insert (Core.forallTypeParameter v1) tyvars) (Core.forallTypeBody v1))- Core.TypeVariable v1 -> (Logic.ifElse (Sets.member v1 tyvars) (Flows.pure ()) (Logic.ifElse (Maps.member v1 (Typing_.inferenceContextSchemaTypes cx)) (Flows.pure ()) (Flows.fail (Strings.cat [- "unbound type variable \"",- Core.unName v1,- "\" in ",- (Core__.type_ typ)]))))- _ -> (Flows.bind (Flows.mapList (checkTypeVariables cx tyvars) (Rewriting.subtypes typ)) (\result -> Flows.pure ()))) typ))---- | Disable type checking by default, for better performance-debugInference :: Bool-debugInference = True---- | An empty inference context-emptyInferenceContext :: Typing_.InferenceContext-emptyInferenceContext = Typing_.InferenceContext {- Typing_.inferenceContextSchemaTypes = (M.fromList []),- Typing_.inferenceContextPrimitiveTypes = (M.fromList []),- Typing_.inferenceContextDataTypes = (M.fromList []),- Typing_.inferenceContextDebug = False}---- | Add (term variable, type scheme) pairs to the typing environment-extendContext :: ([(Core.Name, Core.TypeScheme)] -> Typing_.InferenceContext -> Typing_.InferenceContext)-extendContext pairs cx = Typing_.InferenceContext {- Typing_.inferenceContextSchemaTypes = (Typing_.inferenceContextSchemaTypes cx),- Typing_.inferenceContextPrimitiveTypes = (Typing_.inferenceContextPrimitiveTypes cx),- Typing_.inferenceContextDataTypes = (Maps.union (Maps.fromList pairs) (Typing_.inferenceContextDataTypes cx)),- Typing_.inferenceContextDebug = (Typing_.inferenceContextDebug cx)}--forInferredTerm :: (Typing_.InferenceContext -> Core.Term -> String -> (Typing_.InferenceResult -> t0) -> Compute.Flow t1 t0)-forInferredTerm cx term desc f = (Flows.map f (inferTypeOfTerm cx term desc))---- | Get all free variables in an inference context-freeVariablesInContext :: (Typing_.InferenceContext -> S.Set Core.Name)-freeVariablesInContext cx = (Lists.foldl Sets.union Sets.empty (Lists.map Rewriting.freeVariablesInTypeSchemeSimple (Maps.elems (Typing_.inferenceContextDataTypes cx))))--freshName :: (Compute.Flow t0 Core.Name)-freshName = (Flows.map normalTypeVariable (Annotations.nextCount key_vcount))--freshNames :: (Int -> Compute.Flow t0 [Core.Name])-freshNames n = (Flows.sequence (Lists.replicate n freshName))--freshVariableType :: (Compute.Flow t0 Core.Type)-freshVariableType = (Flows.map (\x -> Core.TypeVariable x) freshName)---- | Generalize a type to a type scheme-generalize :: (Typing_.InferenceContext -> Core.Type -> Core.TypeScheme)-generalize cx typ = - let vars = (Lists.nub (Lists.filter (isUnbound cx) (Rewriting.freeVariablesInTypeOrdered typ)))- in Core.TypeScheme {- Core.typeSchemeVariables = vars,- Core.typeSchemeType = typ}--graphToInferenceContext :: (Graph.Graph -> Compute.Flow t0 Typing_.InferenceContext)-graphToInferenceContext g0 = - let schema = (Optionals.fromMaybe g0 (Graph.graphSchema g0))- in - let primTypes = (Maps.fromList (Lists.map (\p -> (Graph.primitiveName p, (Graph.primitiveType p))) (Maps.elems (Graph.graphPrimitives g0))))- in - let varTypes = Maps.empty- in (Flows.bind (Schemas.schemaGraphToTypingEnvironment schema) (\schemaTypes -> Flows.pure (Typing_.InferenceContext {- Typing_.inferenceContextSchemaTypes = schemaTypes,- Typing_.inferenceContextPrimitiveTypes = primTypes,- Typing_.inferenceContextDataTypes = varTypes,- Typing_.inferenceContextDebug = False})))--inferGraphTypes :: (Graph.Graph -> Compute.Flow t0 Graph.Graph)-inferGraphTypes g0 = - let fromLetTerm = (\l -> - let bindings = (Core.letBindings l)- in - let env = (Core.letEnvironment l)- in - let fromBinding = (\b -> (Core.bindingName b, b))- in Graph.Graph {- Graph.graphElements = (Maps.fromList (Lists.map fromBinding bindings)),- Graph.graphEnvironment = Maps.empty,- Graph.graphTypes = Maps.empty,- Graph.graphBody = env,- Graph.graphPrimitives = (Graph.graphPrimitives g0),- Graph.graphSchema = (Graph.graphSchema g0)})- in - let toLetTerm = (\g -> - let toBinding = (\el -> Core.Binding {- Core.bindingName = (Core.bindingName el),- Core.bindingTerm = (Core.bindingTerm el),- Core.bindingType = Nothing})- in (Core.TermLet (Core.Let {- Core.letBindings = (Lists.map toBinding (Maps.elems (Graph.graphElements g))),- Core.letEnvironment = (Graph.graphBody g)})))- in (Monads.withTrace "graph inference" (Flows.bind (graphToInferenceContext g0) (\cx -> Flows.bind (inferTypeOfTerm cx (toLetTerm g0) "graph term") (\result -> - let term = (Typing_.inferenceResultTerm result)- in - let ts = (Typing_.inferenceResultType result)- in ((\x -> case x of- Core.TermLet v1 -> (Flows.pure (fromLetTerm v1))- Core.TermVariable _ -> (Flows.fail "Expected inferred graph as let term")) (Rewriting.normalizeTypeVariablesInTerm term))))))---- | Infer the type of a term in graph context-inferInGraphContext :: (Core.Term -> Compute.Flow Graph.Graph Typing_.InferenceResult)-inferInGraphContext term = (Flows.bind Monads.getState (\g -> Flows.bind (graphToInferenceContext g) (\cx -> inferTypeOfTerm cx term "single term")))--inferMany :: (Typing_.InferenceContext -> [(Core.Term, String)] -> Compute.Flow t0 ([Core.Term], ([Core.Type], Typing_.TypeSubst)))-inferMany cx pairs = (Logic.ifElse (Lists.null pairs) (Flows.pure ([], ([], Substitution.idTypeSubst))) ( - let e = (fst (Lists.head pairs))- in - let desc = (snd (Lists.head pairs))- in - let tl = (Lists.tail pairs)- in (Flows.bind (inferTypeOfTerm cx e desc) (\result1 -> - let e1 = (Typing_.inferenceResultTerm result1)- in - let t1 = (Typing_.inferenceResultType result1)- in - let s1 = (Typing_.inferenceResultSubst result1)- in (Flows.bind (inferMany (Substitution.substInContext s1 cx) tl) (\result2 -> - let e2 = (fst result2)- in - let t2 = (fst (snd result2))- in - let s2 = (snd (snd result2))- in (Flows.pure (Lists.cons (Substitution.substTypesInTerm s2 e1) e2, (Lists.cons (Substitution.substInType s2 t1) t2, (Substitution.composeTypeSubst s1 s2))))))))))--inferTypeOfAnnotatedTerm :: (Typing_.InferenceContext -> Core.AnnotatedTerm -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfAnnotatedTerm cx at = - let term = (Core.annotatedTermSubject at)- in - let ann = (Core.annotatedTermAnnotation at)- in (Flows.bind (inferTypeOfTerm cx term "annotated term") (\result -> - let iterm = (Typing_.inferenceResultTerm result)- in - let itype = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = iterm,- Core.annotatedTermAnnotation = ann})),- Typing_.inferenceResultType = itype,- Typing_.inferenceResultSubst = isubst}))))--inferTypeOfApplication :: (Typing_.InferenceContext -> Core.Application -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfApplication cx app = - let e0 = (Core.applicationFunction app)- in - let e1 = (Core.applicationArgument app)- in (Flows.bind (inferTypeOfTerm cx e0 "lhs") (\lhsResult -> - let a = (Typing_.inferenceResultTerm lhsResult)- in - let t0 = (Typing_.inferenceResultType lhsResult)- in - let s0 = (Typing_.inferenceResultSubst lhsResult)- in (Flows.bind (inferTypeOfTerm (Substitution.substInContext s0 cx) e1 "rhs") (\rhsResult -> - let b = (Typing_.inferenceResultTerm rhsResult)- in - let t1 = (Typing_.inferenceResultType rhsResult)- in - let s1 = (Typing_.inferenceResultSubst rhsResult)- in (Flows.bind freshName (\v -> Flows.bind (Unification.unifyTypes (Typing_.inferenceContextSchemaTypes cx) (Substitution.substInType s1 t0) (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = t1,- Core.functionTypeCodomain = (Core.TypeVariable v)})) "application lhs") (\s2 -> - let rExpr = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Substitution.substTypesInTerm (Substitution.composeTypeSubst s1 s2) a),- Core.applicationArgument = (Substitution.substTypesInTerm s2 b)}))- in - let rType = (Substitution.substInType s2 (Core.TypeVariable v))- in - let rSubst = (Substitution.composeTypeSubstList [- s0,- s1,- s2])- in (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = rExpr,- Typing_.inferenceResultType = rType,- Typing_.inferenceResultSubst = rSubst})))))))))--inferTypeOfCaseStatement :: (Typing_.InferenceContext -> Core.CaseStatement -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfCaseStatement cx caseStmt = - let tname = (Core.caseStatementTypeName caseStmt)- in - let dflt = (Core.caseStatementDefault caseStmt)- in - let cases = (Core.caseStatementCases caseStmt)- in - let fnames = (Lists.map Core.fieldName cases)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Flows.mapOptional (\t -> inferTypeOfTerm cx t (Strings.cat [- "case ",- Core.unName tname,- ".<default>"])) dflt) (\dfltResult -> Flows.bind (inferMany cx (Lists.map (\f -> (Core.fieldTerm f, (Strings.cat [- "case ",- Core.unName tname,- ".",- (Core.unName (Core.fieldName f))]))) cases)) (\caseResults -> - let iterms = (fst caseResults)- in - let itypes = (fst (snd caseResults))- in - let isubst = (snd (snd caseResults))- in (Flows.bind freshName (\codv -> - let cod = (Core.TypeVariable codv)- in - let caseMap = (Maps.fromList (Lists.map (\ft -> (Core.fieldTypeName ft, (Core.fieldTypeType ft))) sfields))- in - let dfltConstraints = (Monads.optionalToList (Optionals.map (\r -> Typing_.TypeConstraint {- Typing_.typeConstraintLeft = cod,- Typing_.typeConstraintRight = (Typing_.inferenceResultType r),- Typing_.typeConstraintComment = "match default"}) dfltResult))- in - let caseConstraints = (Optionals.cat (Lists.zipWith (\fname -> \itype -> Optionals.map (\ftype -> Typing_.TypeConstraint {- Typing_.typeConstraintLeft = itype,- Typing_.typeConstraintRight = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = ftype,- Core.functionTypeCodomain = cod})),- Typing_.typeConstraintComment = "case type"}) (Maps.lookup fname caseMap)) fnames itypes))- in (mapConstraints cx (\subst -> yield (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = tname,- Core.caseStatementDefault = (Optionals.map Typing_.inferenceResultTerm dfltResult),- Core.caseStatementCases = (Lists.zipWith (\n -> \t -> Core.Field {- Core.fieldName = n,- Core.fieldTerm = t}) fnames iterms)})))) svars) (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),- Core.functionTypeCodomain = cod})) (Substitution.composeTypeSubstList (Lists.concat [- Monads.optionalToList (Optionals.map Typing_.inferenceResultSubst dfltResult),- [- isubst,- subst]]))) (Lists.concat [- dfltConstraints,- caseConstraints]))))))))))--inferTypeOfCollection :: (Typing_.InferenceContext -> (Core.Type -> Core.Type) -> ([Core.Term] -> Core.Term) -> String -> [Core.Term] -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfCollection cx typCons trmCons desc els = (Flows.bind freshName (\var -> Logic.ifElse (Lists.null els) (Flows.pure (yield (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (trmCons []),- Core.typedTermType = (Core.TypeVariable var)})) (typCons (Core.TypeVariable var)) Substitution.idTypeSubst)) (Flows.bind (inferMany cx (Lists.zip els (Lists.map (\i -> Strings.cat [- "#",- (Literals.showInt32 i)]) (Math.range 1 (Math.add (Lists.length els) 1))))) (\results -> - let terms = (fst results)- in - let types = (fst (snd results))- in - let subst1 = (snd (snd results))- in - let constraints = (Lists.map (\t -> Typing_.TypeConstraint {- Typing_.typeConstraintLeft = (Core.TypeVariable var),- Typing_.typeConstraintRight = t,- Typing_.typeConstraintComment = desc}) types)- in (mapConstraints cx (\subst2 -> - let iterm = (trmCons terms)- in - let itype = (typCons (Core.TypeVariable var))- in - let isubst = (Substitution.composeTypeSubst subst1 subst2)- in (yield iterm itype isubst)) constraints)))))--inferTypeOf :: (Typing_.InferenceContext -> Core.Term -> Compute.Flow t0 (Core.Term, Core.TypeScheme))-inferTypeOf cx term = - let letTerm = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "ignoredVariableName"),- Core.bindingTerm = term,- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLiteral (Core.LiteralString "ignoredEnvironment"))}))- in - let unifyAndSubst = (\result -> - let subst = (Typing_.inferenceResultSubst result)- in (Flows.bind (Lexical.withEmptyGraph (Core_.letTerm (Rewriting.normalizeTypeVariablesInTerm (Typing_.inferenceResultTerm result)))) (\letResult -> - let bindings = (Core.letBindings letResult)- in (Logic.ifElse (Equality.equal 1 (Lists.length bindings)) ( - let binding = (Lists.head bindings)- in - let term1 = (Core.bindingTerm binding)- in - let mts = (Core.bindingType binding)- in (Optionals.maybe (Flows.fail "Expected a type scheme") (\ts -> Flows.pure (term1, ts)) mts)) (Flows.fail (Strings.cat [- "Expected a single binding with a type scheme, but got: ",- Literals.showInt32 (Lists.length bindings),- " bindings"]))))))- in (Flows.bind (inferTypeOfTerm cx letTerm "infer type of term") (\result -> unifyAndSubst result))--inferTypeOfElimination :: (Typing_.InferenceContext -> Core.Elimination -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfElimination cx elm = ((\x -> case x of- Core.EliminationProduct v1 -> (inferTypeOfTupleProjection cx v1)- Core.EliminationRecord v1 -> (inferTypeOfProjection cx v1)- Core.EliminationUnion v1 -> (inferTypeOfCaseStatement cx v1)- Core.EliminationWrap v1 -> (inferTypeOfUnwrap cx v1)) elm)--inferTypeOfFunction :: (Typing_.InferenceContext -> Core.Function -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfFunction cx f = ((\x -> case x of- Core.FunctionElimination v1 -> (inferTypeOfElimination cx v1)- Core.FunctionLambda v1 -> (inferTypeOfLambda cx v1)- Core.FunctionPrimitive v1 -> (inferTypeOfPrimitive cx v1)) f)--inferTypeOfInjection :: (Typing_.InferenceContext -> Core.Injection -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfInjection cx injection = - let tname = (Core.injectionTypeName injection)- in - let field = (Core.injectionField injection)- in - let fname = (Core.fieldName field)- in - let term = (Core.fieldTerm field)- in (Flows.bind (inferTypeOfTerm cx term "injected term") (\result -> Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in - let iterm = (Typing_.inferenceResultTerm result)- in - let ityp = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> mapConstraints cx (\subst -> yield (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermUnion (Core.Injection {- Core.injectionTypeName = tname,- Core.injectionField = Core.Field {- Core.fieldName = fname,- Core.fieldTerm = iterm}})) svars) (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)) (Substitution.composeTypeSubst isubst subst)) [- Typing_.TypeConstraint {- Typing_.typeConstraintLeft = ftyp,- Typing_.typeConstraintRight = ityp,- Typing_.typeConstraintComment = "schema type of injected field"}]))))))--inferTypeOfLambda :: (Typing_.InferenceContext -> Core.Lambda -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfLambda cx lambda = - let var = (Core.lambdaParameter lambda)- in - let body = (Core.lambdaBody lambda)- in (Flows.bind freshName (\vdom -> - let dom = (Core.TypeVariable vdom)- in - let cx2 = (extendContext [- (var, Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = dom})] cx)- in (Flows.bind (inferTypeOfTerm cx2 body "lambda body") (\result -> - let iterm = (Typing_.inferenceResultTerm result)- in - let icod = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in - let rdom = (Substitution.substInType isubst dom)- in - let rterm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = var,- Core.lambdaDomain = (Just rdom),- Core.lambdaBody = iterm})))- in - let rtype = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = rdom,- Core.functionTypeCodomain = icod}))- in - let vars = (Sets.unions [- Rewriting.freeVariablesInType rdom,- Rewriting.freeVariablesInType icod,- (freeVariablesInContext (Substitution.substInContext isubst cx2))])- in - let cx3 = (Substitution.substInContext isubst cx)- in (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = rterm,- Typing_.inferenceResultType = rtype,- Typing_.inferenceResultSubst = isubst}))))))--inferTypeOfLetNormalized :: (Typing_.InferenceContext -> Core.Let -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfLetNormalized cx0 letTerm = - let bins0 = (Core.letBindings letTerm)- in - let env0 = (Core.letEnvironment letTerm)- in - let bnames = (Lists.map Core.bindingName bins0)- in (Flows.bind (freshNames (Lists.length bins0)) (\bvars -> - let tbins0 = (Lists.map (\x -> Core.TypeVariable x) bvars)- in - let cx1 = (extendContext (Lists.zip bnames (Lists.map (\t -> Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = t}) tbins0)) cx0)- in (Flows.bind (inferTypesOfTemporaryBindings cx1 bins0) (\inferredResult -> - let bterms1 = (fst inferredResult)- in - let tbins1 = (fst (snd inferredResult))- in - let s1 = (snd (snd inferredResult))- in (Flows.bind (Unification.unifyTypeLists (Typing_.inferenceContextSchemaTypes cx0) (Lists.map (Substitution.substInType s1) tbins0) tbins1 "temporary type bindings") (\s2 -> - let g2 = (Substitution.substInContext (Substitution.composeTypeSubst s1 s2) cx0)- in - let tsbins1 = (Lists.zip bnames (Lists.map (\t -> generalize g2 (Substitution.substInType s2 t)) tbins1))- in (Flows.bind (inferTypeOfTerm (extendContext tsbins1 g2) env0 "let environment") (\envResult -> - let env1 = (Typing_.inferenceResultTerm envResult)- in - let tenv = (Typing_.inferenceResultType envResult)- in - let senv = (Typing_.inferenceResultSubst envResult)- in - let st1 = (Typing_.TermSubst (Maps.fromList (Lists.map (\pair -> - let name = (fst pair)- in - let ts = (snd pair)- in (name, (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermVariable name) (Lists.reverse (Core.typeSchemeVariables ts))))) tsbins1)))- in - let createBinding = (\bindingPair -> - let nameTsPair = (fst bindingPair)- in - let term = (snd bindingPair)- in - let name = (fst nameTsPair)- in - let ts = (snd nameTsPair)- in - let typeAbstractedTerm = (Lists.foldl (\b -> \v -> Core.TermTypeLambda (Core.TypeLambda {- Core.typeLambdaParameter = v,- Core.typeLambdaBody = b})) (Substitution.substituteInTerm st1 term) (Lists.reverse (Core.typeSchemeVariables ts)))- in Core.Binding {- Core.bindingName = name,- Core.bindingTerm = (Substitution.substTypesInTerm (Substitution.composeTypeSubst senv s2) typeAbstractedTerm),- Core.bindingType = (Just (Substitution.substInTypeScheme senv ts))})- in - let bins1 = (Lists.map createBinding (Lists.zip tsbins1 bterms1))- in - let ret = Typing_.InferenceResult {- Typing_.inferenceResultTerm = (Core.TermLet (Core.Let {- Core.letBindings = bins1,- Core.letEnvironment = env1})),- Typing_.inferenceResultType = tenv,- Typing_.inferenceResultSubst = (Substitution.composeTypeSubstList [- s1,- s2,- senv])}- in (Flows.pure ret)))))))))--inferTypeOfLet :: (Typing_.InferenceContext -> Core.Let -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfLet cx let0 = - let bindings0 = (Core.letBindings let0)- in - let env0 = (Core.letEnvironment let0)- in - let names = (Lists.map Core.bindingName bindings0)- in - let nameSet = (Sets.fromList names)- in - let toPair = (\binding -> - let name = (Core.bindingName binding)- in - let term = (Core.bindingTerm binding)- in (name, (Lists.filter (\n -> Sets.member n nameSet) (Sets.toList (Rewriting.freeVariablesInTerm term)))))- in - let adjList = (Lists.map toPair bindings0)- in - let groups = (Sorting.topologicalSortComponents adjList)- in - let bindingMap = (Maps.fromList (Lists.zip names bindings0))- in - let createLet = (\e -> \group -> Core.TermLet (Core.Let {- Core.letBindings = (Optionals.cat (Lists.map (\n -> Maps.lookup n bindingMap) group)),- Core.letEnvironment = e}))- in - let rewrittenLet = (Lists.foldl createLet env0 (Lists.reverse groups))- in - let restoreLet = (\iterm -> - let helper = (\level -> \bins -> \term -> Logic.ifElse (Equality.equal level 0) (bins, term) ((\x -> case x of- Core.TermLet v1 -> - let bs = (Core.letBindings v1)- in - let e = (Core.letEnvironment v1)- in (helper (Math.sub level 1) (Lists.concat [- bs,- bins]) e)) term))- in - let result = (helper (Lists.length groups) [] iterm)- in - let bindingList = (fst result)- in - let e = (snd result)- in - let bindingMap2 = (Maps.fromList (Lists.map (\b -> (Core.bindingName b, b)) bindingList))- in (Core.TermLet (Core.Let {- Core.letBindings = (Optionals.cat (Lists.map (\n -> Maps.lookup n bindingMap2) names)),- Core.letEnvironment = e})))- in - let rewriteResult = (\result -> - let iterm = (Typing_.inferenceResultTerm result)- in - let itype = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in Typing_.InferenceResult {- Typing_.inferenceResultTerm = (restoreLet iterm),- Typing_.inferenceResultType = itype,- Typing_.inferenceResultSubst = isubst})- in (Flows.map rewriteResult ((\x -> case x of- Core.TermLet v1 -> (inferTypeOfLetNormalized cx v1)- _ -> (inferTypeOfTerm cx rewrittenLet "empty let term")) rewrittenLet))--inferTypeOfList :: (Typing_.InferenceContext -> [Core.Term] -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfList cx = (inferTypeOfCollection cx (\x -> Core.TypeList x) (\x -> Core.TermList x) "list element")--inferTypeOfLiteral :: (t0 -> Core.Literal -> Compute.Flow t1 Typing_.InferenceResult)-inferTypeOfLiteral _ lit = (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = (Core.TermLiteral lit),- Typing_.inferenceResultType = (Core.TypeLiteral (Variants.literalType lit)),- Typing_.inferenceResultSubst = Substitution.idTypeSubst}))--inferTypeOfMap :: (Typing_.InferenceContext -> M.Map Core.Term Core.Term -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfMap cx m = (Flows.bind freshName (\kvar -> Flows.bind freshName (\vvar -> Logic.ifElse (Maps.null m) (Flows.pure (yield (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (Core.TermMap Maps.empty),- Core.typedTermType = (Core.TypeVariable vvar)})),- Core.typedTermType = (Core.TypeVariable kvar)})) (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeVariable kvar),- Core.mapTypeValues = (Core.TypeVariable vvar)})) Substitution.idTypeSubst)) (Flows.bind (inferMany cx (Lists.map (\k -> (k, "map key")) (Maps.keys m))) (\kresults -> - let kterms = (fst kresults)- in - let ktypes = (fst (snd kresults))- in - let ksubst = (snd (snd kresults))- in (Flows.bind (inferMany cx (Lists.map (\v -> (v, "map value")) (Maps.elems m))) (\vresults -> - let vterms = (fst vresults)- in - let vtypes = (fst (snd vresults))- in - let vsubst = (snd (snd vresults))- in - let kcons = (Lists.map (\t -> Typing_.TypeConstraint {- Typing_.typeConstraintLeft = (Core.TypeVariable kvar),- Typing_.typeConstraintRight = t,- Typing_.typeConstraintComment = "map key"}) ktypes)- in - let vcons = (Lists.map (\t -> Typing_.TypeConstraint {- Typing_.typeConstraintLeft = (Core.TypeVariable vvar),- Typing_.typeConstraintRight = t,- Typing_.typeConstraintComment = "map value"}) vtypes)- in (mapConstraints cx (\subst -> yield (Core.TermMap (Maps.fromList (Lists.zip kterms vterms))) (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeVariable kvar),- Core.mapTypeValues = (Core.TypeVariable vvar)})) (Substitution.composeTypeSubstList [- ksubst,- vsubst,- subst])) (Lists.concat [- kcons,- vcons])))))))))--inferTypeOfOptional :: (Typing_.InferenceContext -> Maybe Core.Term -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfOptional cx m = - let trmCons = (\terms -> Logic.ifElse (Lists.null terms) (Core.TermOptional Nothing) (Core.TermOptional (Just (Lists.head terms))))- in (inferTypeOfCollection cx (\x -> Core.TypeOptional x) trmCons "optional element" (Optionals.maybe [] Lists.singleton m))--inferTypeOfPrimitive :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfPrimitive cx name = (Optionals.maybe (Flows.fail (Strings.cat2 "No such primitive: " (Core.unName name))) (\scheme -> Flows.bind (instantiateTypeScheme scheme) (\ts -> - let vars = (Core.typeSchemeVariables ts)- in - let itype = (Core.typeSchemeType ts)- in - let iterm = (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermFunction (Core.FunctionPrimitive name)) vars)- in (yieldChecked cx vars iterm itype Substitution.idTypeSubst))) (Maps.lookup name (Typing_.inferenceContextPrimitiveTypes cx)))--inferTypeOfProduct :: (Typing_.InferenceContext -> [Core.Term] -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfProduct cx els = (Flows.map (\results -> - let iterms = (fst results)- in - let itypes = (fst (snd results))- in - let isubst = (snd (snd results))- in (yield (Core.TermProduct iterms) (Core.TypeProduct itypes) isubst)) (inferMany cx (Lists.map (\e -> (e, "tuple element")) els)))--inferTypeOfProjection :: (Typing_.InferenceContext -> Core.Projection -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfProjection cx proj = - let tname = (Core.projectionTypeName proj)- in - let fname = (Core.projectionField proj)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.recordType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> Flows.pure (yield (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {- Core.projectionTypeName = tname,- Core.projectionField = fname})))) svars) (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),- Core.functionTypeCodomain = ftyp})) Substitution.idTypeSubst))))))--inferTypeOfRecord :: (Typing_.InferenceContext -> Core.Record -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfRecord cx record = - let tname = (Core.recordTypeName record)- in - let fields = (Core.recordFields record)- in - let fnames = (Lists.map Core.fieldName fields)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> Flows.bind (inferMany cx (Lists.map (\f -> (Core.fieldTerm f, (Strings.cat2 "field " (Core.unName (Core.fieldName f))))) fields)) (\results -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in - let iterms = (fst results)- in - let itypes = (fst (snd results))- in - let isubst = (snd (snd results))- in - let ityp = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = tname,- Core.rowTypeFields = (Lists.zipWith (\n -> \t -> Core.FieldType {- Core.fieldTypeName = n,- Core.fieldTypeType = t}) fnames itypes)}))- in (mapConstraints cx (\subst -> yield (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermRecord (Core.Record {- Core.recordTypeName = tname,- Core.recordFields = (Lists.zipWith (\n -> \t -> Core.Field {- Core.fieldName = n,- Core.fieldTerm = t}) fnames iterms)})) svars) (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)) (Substitution.composeTypeSubst isubst subst)) [- Typing_.TypeConstraint {- Typing_.typeConstraintLeft = stype,- Typing_.typeConstraintRight = ityp,- Typing_.typeConstraintComment = "schema type of record"}]))))--inferTypeOfSet :: (Typing_.InferenceContext -> S.Set Core.Term -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfSet cx s = (inferTypeOfCollection cx (\x -> Core.TypeSet x) (\terms -> Core.TermSet (Sets.fromList terms)) "set element" (Sets.toList s))--inferTypeOfSum :: (Typing_.InferenceContext -> Core.Sum -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfSum cx sum = - let i = (Core.sumIndex sum)- in - let s = (Core.sumSize sum)- in - let term = (Core.sumTerm sum)- in (Flows.bind (inferTypeOfTerm cx term "sum term") (\result -> - let iterm = (Typing_.inferenceResultTerm result)- in - let ityp = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in - let varOrTerm = (\t -> \j -> Logic.ifElse (Equality.equal i j) (Flows.pure (Mantle.EitherLeft t)) (Flows.map (\x -> Mantle.EitherRight x) freshName))- in (Flows.bind (Flows.mapList (varOrTerm ityp) (Math.range 0 (Math.sub s 1))) (\vars -> - let toType = (\e -> (\x -> case x of- Mantle.EitherLeft v1 -> v1- Mantle.EitherRight v1 -> (Core.TypeVariable v1)) e)- in (Flows.pure (yield (Core.TermSum (Core.Sum {- Core.sumIndex = i,- Core.sumSize = s,- Core.sumTerm = iterm})) (Core.TypeSum (Lists.map toType vars)) isubst))))))--inferTypeOfTerm :: (Typing_.InferenceContext -> Core.Term -> String -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfTerm cx term desc = (Monads.withTrace desc ((\x -> case x of- Core.TermAnnotated v1 -> (inferTypeOfAnnotatedTerm cx v1)- Core.TermApplication v1 -> (inferTypeOfApplication cx v1)- Core.TermFunction v1 -> (inferTypeOfFunction cx v1)- Core.TermLet v1 -> (inferTypeOfLet cx v1)- Core.TermList v1 -> (inferTypeOfList cx v1)- Core.TermLiteral v1 -> (inferTypeOfLiteral cx v1)- Core.TermMap v1 -> (inferTypeOfMap cx v1)- Core.TermOptional v1 -> (inferTypeOfOptional cx v1)- Core.TermProduct v1 -> (inferTypeOfProduct cx v1)- Core.TermRecord v1 -> (inferTypeOfRecord cx v1)- Core.TermSet v1 -> (inferTypeOfSet cx v1)- Core.TermSum v1 -> (inferTypeOfSum cx v1)- Core.TermTypeLambda v1 -> (inferTypeOfTypeLambda cx v1)- Core.TermTypeApplication v1 -> (inferTypeOfTypeApplication cx v1)- Core.TermUnion v1 -> (inferTypeOfInjection cx v1)- Core.TermUnit -> (Flows.pure inferTypeOfUnit)- Core.TermVariable v1 -> (inferTypeOfVariable cx v1)- Core.TermWrap v1 -> (inferTypeOfWrappedTerm cx v1)) term))--inferTypeOfTupleProjection :: (t0 -> Core.TupleProjection -> Compute.Flow t1 Typing_.InferenceResult)-inferTypeOfTupleProjection cx tp = - let arity = (Core.tupleProjectionArity tp)- in - let idx = (Core.tupleProjectionIndex tp)- in (Flows.bind (freshNames arity) (\vars -> - let types = (Lists.map (\x -> Core.TypeVariable x) vars)- in - let cod = (Lists.at idx types)- in (Flows.pure (yield (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = arity,- Core.tupleProjectionIndex = idx,- Core.tupleProjectionDomain = (Just types)})))) (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeProduct types),- Core.functionTypeCodomain = cod})) Substitution.idTypeSubst))))--inferTypeOfTypeLambda :: (Typing_.InferenceContext -> Core.TypeLambda -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfTypeLambda cx ta = (inferTypeOfTerm cx (Core.typeLambdaBody ta) "type abstraction")--inferTypeOfTypeApplication :: (Typing_.InferenceContext -> Core.TypedTerm -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfTypeApplication cx tt = (inferTypeOfTerm cx (Core.typedTermTerm tt) "type application term")--inferTypeOfUnwrap :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfUnwrap cx tname = (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.wrappedType tname stype) (\wtyp -> Flows.pure (yield (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.TypeVariable v)})) (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap tname))) svars) (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),- Core.functionTypeCodomain = wtyp})) Substitution.idTypeSubst)))))--inferTypeOfVariable :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfVariable cx name = (Optionals.maybe (Flows.fail (Strings.cat2 "Variable not bound to type: " (Core.unName name))) (\scheme -> Flows.bind (instantiateTypeScheme scheme) (\ts -> - let vars = (Core.typeSchemeVariables ts)- in - let itype = (Core.typeSchemeType ts)- in - let iterm = (Lists.foldl (\t -> \ty -> Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = ty})) (Core.TermVariable name) (Lists.map (\x -> Core.TypeVariable x) vars))- in (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = iterm,- Typing_.inferenceResultType = itype,- Typing_.inferenceResultSubst = Substitution.idTypeSubst})))) (Maps.lookup name (Typing_.inferenceContextDataTypes cx)))--inferTypeOfWrappedTerm :: (Typing_.InferenceContext -> Core.WrappedTerm -> Compute.Flow t0 Typing_.InferenceResult)-inferTypeOfWrappedTerm cx wt = - let tname = (Core.wrappedTermTypeName wt)- in - let term = (Core.wrappedTermObject wt)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> Flows.bind (inferTypeOfTerm cx term "wrapped term") (\result -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in - let iterm = (Typing_.inferenceResultTerm result)- in - let ityp = (Typing_.inferenceResultType result)- in - let isubst = (Typing_.inferenceResultSubst result)- in (Flows.bind (freshNames (Lists.length svars)) (\freshVars -> - let subst = (Typing_.TypeSubst (Maps.fromList (Lists.zip svars (Lists.map (\x -> Core.TypeVariable x) freshVars))))- in - let stypInst = (Substitution.substInType subst stype)- in - let nominalInst = (nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) freshVars))- in - let expected = (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = tname,- Core.wrappedTypeObject = ityp}))- in - let freeVars = (Sets.toList (Sets.unions [- Rewriting.freeVariablesInType ityp,- Rewriting.freeVariablesInTerm iterm,- (Sets.fromList freshVars)]))- in (bindConstraints cx (\subst2 -> yieldChecked cx freeVars (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = tname,- Core.wrappedTermObject = iterm})) nominalInst (Substitution.composeTypeSubst isubst subst2)) [- Typing_.TypeConstraint {- Typing_.typeConstraintLeft = stypInst,- Typing_.typeConstraintRight = expected,- Typing_.typeConstraintComment = "schema type of wrapper"}]))))))--inferTypesOfTemporaryBindings :: (Typing_.InferenceContext -> [Core.Binding] -> Compute.Flow t0 ([Core.Term], ([Core.Type], Typing_.TypeSubst)))-inferTypesOfTemporaryBindings cx bins = (Logic.ifElse (Lists.null bins) (Flows.pure ([], ([], Substitution.idTypeSubst))) ( - let binding = (Lists.head bins)- in - let k = (Core.bindingName binding)- in - let v = (Core.bindingTerm binding)- in - let tl = (Lists.tail bins)- in (Flows.bind (inferTypeOfTerm cx v (Strings.cat [- "temporary let binding '",- Core.unName k,- "'"])) (\result1 -> - let j = (Typing_.inferenceResultTerm result1)- in - let u_prime = (Typing_.inferenceResultType result1)- in - let u = (Typing_.inferenceResultSubst result1)- in (Flows.bind (inferTypesOfTemporaryBindings (Substitution.substInContext u cx) tl) (\result2 -> - let h = (fst result2)- in - let r_prime = (fst (snd result2))- in - let r = (snd (snd result2))- in (Flows.pure (Lists.cons (Substitution.substTypesInTerm r j) h, (Lists.cons (Substitution.substInType r u_prime) r_prime, (Substitution.composeTypeSubst u r))))))))))--initialTypeContext :: (Graph.Graph -> Compute.Flow t0 Typing_.TypeContext)-initialTypeContext g = - let toPair = (\pair -> - let name = (fst pair)- in - let el = (snd pair)- in (Optionals.maybe (Flows.fail (Strings.cat [- "untyped element: ",- (Core.unName name)])) (\ts -> Flows.pure (name, (Schemas.typeSchemeToFType ts))) (Core.bindingType el)))- in (Flows.bind (graphToInferenceContext g) (\ix -> Flows.bind (Flows.map Maps.fromList (Flows.mapList toPair (Maps.toList (Graph.graphElements g)))) (\types -> Flows.pure (Typing_.TypeContext {- Typing_.typeContextTypes = types,- Typing_.typeContextVariables = Sets.empty,- Typing_.typeContextInferenceContext = ix}))))--instantiateTypeScheme :: (Core.TypeScheme -> Compute.Flow t0 Core.TypeScheme)-instantiateTypeScheme scheme = - let oldVars = (Core.typeSchemeVariables scheme)- in (Flows.bind (freshNames (Lists.length oldVars)) (\newVars -> - let subst = (Typing_.TypeSubst (Maps.fromList (Lists.zip oldVars (Lists.map (\x -> Core.TypeVariable x) newVars))))- in (Flows.pure (Core.TypeScheme {- Core.typeSchemeVariables = newVars,- Core.typeSchemeType = (Substitution.substInType subst (Core.typeSchemeType scheme))}))))---- | Check if a variable is unbound in context-isUnbound :: (Typing_.InferenceContext -> Core.Name -> Bool)-isUnbound cx v = (Logic.and (Logic.not (Sets.member v (freeVariablesInContext cx))) (Logic.not (Maps.member v (Typing_.inferenceContextSchemaTypes cx))))---- | Key for inference type variable count-key_vcount :: Core.Name-key_vcount = (Core.Name "inferenceTypeVariableCount")--mapConstraints :: (Typing_.InferenceContext -> (Typing_.TypeSubst -> t0) -> [Typing_.TypeConstraint] -> Compute.Flow t1 t0)-mapConstraints cx f constraints = (Flows.map f (Unification.unifyTypeConstraints (Typing_.inferenceContextSchemaTypes cx) constraints))---- | Apply type arguments to a nominal type-nominalApplication :: (Core.Name -> [Core.Type] -> Core.Type)-nominalApplication tname args = (Lists.foldl (\t -> \a -> Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = t,- Core.applicationTypeArgument = a})) (Core.TypeVariable tname) args)---- | Type variable naming convention follows Haskell: t0, t1, etc.-normalTypeVariable :: (Int -> Core.Name)-normalTypeVariable i = (Core.Name (Strings.cat2 "t" (Literals.showInt32 i)))--requireSchemaType :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Core.TypeScheme)-requireSchemaType cx tname = (Optionals.maybe (Flows.fail (Strings.cat2 "No such schema type: " (Core.unName tname))) (\ts -> instantiateTypeScheme (Rewriting.deannotateTypeSchemeRecursive ts)) (Maps.lookup tname (Typing_.inferenceContextSchemaTypes cx)))---- | Show an inference result for debugging-showInferenceResult :: (Typing_.InferenceResult -> String)-showInferenceResult result = - let term = (Typing_.inferenceResultTerm result)- in - let typ = (Typing_.inferenceResultType result)- in - let subst = (Typing_.inferenceResultSubst result)- in (Strings.cat [- "{term=",- Core__.term term,- ", type=",- Core__.type_ typ,- ", subst=",- Typing.typeSubst subst,- "}"])---- | Convert inference context to type context-toFContext :: (Typing_.InferenceContext -> M.Map Core.Name Core.Type)-toFContext cx = (Maps.map Schemas.typeSchemeToFType (Typing_.inferenceContextDataTypes cx))--typeOf :: (Typing_.TypeContext -> Core.Term -> Compute.Flow t0 Core.Type)-typeOf tcontext term = (typeOfInternal (Typing_.typeContextInferenceContext tcontext) (Typing_.typeContextVariables tcontext) (Typing_.typeContextTypes tcontext) [] term)--typeOfInternal :: (Typing_.InferenceContext -> S.Set Core.Name -> M.Map Core.Name Core.Type -> [Core.Type] -> Core.Term -> Compute.Flow t0 Core.Type)-typeOfInternal cx vars types apptypes term = - let checkApplied = (\e -> Logic.ifElse (Lists.null apptypes) e ( - let app = (\t -> \apptypes -> Logic.ifElse (Lists.null apptypes) (Flows.pure t) ((\x -> case x of- Core.TypeForall v1 -> - let v = (Core.forallTypeParameter v1)- in - let t2 = (Core.forallTypeBody v1)- in (app (Substitution.substInType (Typing_.TypeSubst (Maps.singleton v (Lists.head apptypes))) t2) (Lists.tail apptypes))- _ -> (Flows.fail (Strings.cat [- "not a forall type: ",- Core__.type_ t,- " in ",- (Core__.term term)]))) t))- in (Flows.bind (typeOfInternal cx vars types [] term) (\t1 -> Flows.bind (checkTypeVariables cx vars t1) (\_ -> app t1 apptypes)))))- in (Monads.withTrace (Strings.cat [- "checking type of: ",- Core__.term term,- " (vars: ",- Formatting.showList Core.unName (Sets.toList vars),- ", types: ",- Formatting.showList Core.unName (Maps.keys types),- ")"]) ((\x -> case x of- Core.TermAnnotated v1 -> (checkApplied ( - let term1 = (Core.annotatedTermSubject v1)- in (typeOfInternal cx vars types apptypes term1)))- Core.TermApplication v1 -> (checkApplied ( - let a = (Core.applicationFunction v1)- in - let b = (Core.applicationArgument v1)- in (Flows.bind (typeOfInternal cx vars types [] a) (\t1 -> Flows.bind (typeOfInternal cx vars types [] b) (\t2 -> Flows.bind (checkTypeVariables cx vars t1) (\_ -> Flows.bind (checkTypeVariables cx vars t2) (\_ -> (\x -> case x of- Core.TypeFunction v2 -> - let p = (Core.functionTypeDomain v2)- in - let q = (Core.functionTypeCodomain v2)- in (Logic.ifElse (Equality.equal p t2) (Flows.pure q) (Flows.fail (Strings.cat [- "expected ",- Core__.type_ p,- " in ",- Core__.term term,- " but found ",- (Core__.type_ t2)])))- _ -> (Flows.fail (Strings.cat [- "left hand side of application ",- Core__.term term,- " is not a function type: ",- (Core__.type_ t1)]))) t1)))))))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationProduct v3 -> (checkApplied ( - let index = (Core.tupleProjectionIndex v3)- in - let arity = (Core.tupleProjectionArity v3)- in - let mtypes = (Core.tupleProjectionDomain v3)- in (Optionals.maybe (Flows.fail (Strings.cat [- "untyped tuple projection: ",- (Core__.term term)])) (\types -> Flows.bind (Flows.mapList (checkTypeVariables cx vars) types) (\_ -> Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeProduct types),- Core.functionTypeCodomain = (Lists.at index types)})))) mtypes)))- Core.EliminationRecord v3 -> - let tname = (Core.projectionTypeName v3)- in - let fname = (Core.projectionField v3)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.recordType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> - let subst = (Typing_.TypeSubst (Maps.fromList (Lists.zip svars apptypes)))- in - let sftyp = (Substitution.substInType subst ftyp)- in (Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication tname apptypes),- Core.functionTypeCodomain = sftyp}))))))))- Core.EliminationUnion v3 -> - let tname = (Core.caseStatementTypeName v3)- in - let dflt = (Core.caseStatementDefault v3)- in - let cases = (Core.caseStatementCases v3)- in - let cterms = (Lists.map Core.fieldTerm cases)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Flows.mapOptional (\e -> typeOfInternal cx vars types [] e) dflt) (\tdflt -> Flows.bind (Flows.mapList (\e -> typeOfInternal cx vars types [] e) cterms) (\tcterms -> Flows.bind (Flows.mapList (\t -> Flows.map Core.functionTypeCodomain (Core_.functionType t)) tcterms) (\cods -> - let ts = (Optionals.cat (Lists.cons tdflt (Lists.map Optionals.pure cods)))- in (Flows.bind (checkSameType "case branches" ts) (\cod -> - let subst = (Typing_.TypeSubst (Maps.fromList (Lists.zip svars apptypes)))- in - let scod = (Substitution.substInType subst cod)- in (Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication tname apptypes),- Core.functionTypeCodomain = scod}))))))))))))- Core.EliminationWrap v3 -> (Flows.bind (requireSchemaType cx v3) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.wrappedType v3 stype) (\wrapped -> - let subst = (Typing_.TypeSubst (Maps.fromList (Lists.zip svars apptypes)))- in - let swrapped = (Substitution.substInType subst wrapped)- in (Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (nominalApplication v3 apptypes),- Core.functionTypeCodomain = swrapped})))))))) v2)- Core.FunctionLambda v2 -> (checkApplied ( - let x = (Core.lambdaParameter v2)- in - let mt = (Core.lambdaDomain v2)- in - let e = (Core.lambdaBody v2)- in (Optionals.maybe (Flows.fail (Strings.cat [- "untyped lambda: ",- (Core__.term term)])) (\t -> Flows.bind (checkTypeVariables cx vars t) (\_ -> Flows.bind (typeOfInternal cx vars (Maps.insert x t types) [] e) (\t1 -> Flows.bind (checkTypeVariables cx vars t1) (\_ -> Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = t,- Core.functionTypeCodomain = t1})))))) mt)))- Core.FunctionPrimitive v2 -> (checkApplied ( - let ts = (Optionals.maybe (Flows.fail (Strings.cat [- "no such primitive: ",- (Core.unName v2)])) Flows.pure (Maps.lookup v2 (Typing_.inferenceContextPrimitiveTypes cx)))- in (Flows.map Schemas.typeSchemeToFType ts)))) v1)- Core.TermLet v1 -> (checkApplied ( - let bs = (Core.letBindings v1)- in - let env = (Core.letEnvironment v1)- in - let bnames = (Lists.map Core.bindingName bs)- in - let bterms = (Lists.map Core.bindingTerm bs)- in - let btypeOf = (\b -> Optionals.maybe (Flows.fail (Strings.cat [- "untyped let binding in ",- (Core__.term term)])) (\ts -> Flows.pure (Schemas.typeSchemeToFType ts)) (Core.bindingType b))- in (Flows.bind (Flows.mapList btypeOf bs) (\btypes -> - let types2 = (Maps.union (Maps.fromList (Lists.zip bnames btypes)) types)- in (Flows.bind (Flows.mapList (typeOfInternal cx vars types2 []) bterms) (\typeofs -> Flows.bind (Flows.mapList (checkTypeVariables cx vars) btypes) (\_ -> Flows.bind (Flows.mapList (checkTypeVariables cx vars) typeofs) (\_ -> Logic.ifElse (Equality.equal typeofs btypes) (typeOfInternal cx vars types2 [] env) (Flows.fail (Strings.cat [- "binding types disagree: ",- Formatting.showList Core__.type_ btypes,- " and ",- Formatting.showList Core__.type_ typeofs,- " from terms: ",- (Formatting.showList Core__.term bterms)]))))))))))- Core.TermList v1 -> (Logic.ifElse (Lists.null v1) (Logic.ifElse (Equality.equal (Lists.length apptypes) 1) (Flows.pure (Core.TypeList (Lists.head apptypes))) (Flows.fail "list type applied to more or less than one argument")) (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) v1) (\eltypes -> Flows.bind (checkSameType "list elements" eltypes) (\unifiedType -> Flows.bind (checkTypeVariables cx vars unifiedType) (\_ -> Flows.pure (Core.TypeList unifiedType))))))- Core.TermLiteral v1 -> (checkApplied (Flows.pure (Core.TypeLiteral (Variants.literalType v1))))- Core.TermMap v1 -> (Logic.ifElse (Maps.null v1) (Logic.ifElse (Equality.equal (Lists.length apptypes) 2) (Flows.pure (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Lists.at 1 apptypes),- Core.mapTypeValues = (Lists.at 0 apptypes)}))) (Flows.fail "map type applied to more or less than two arguments")) (checkApplied ( - let pairs = (Maps.toList v1)- in (Flows.bind (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) (Lists.map fst pairs)) (checkSameType "map keys")) (\kt -> Flows.bind (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) (Lists.map snd pairs)) (checkSameType "map values")) (\vt -> Flows.bind (checkTypeVariables cx vars kt) (\_ -> Flows.bind (checkTypeVariables cx vars vt) (\_ -> Flows.pure (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = kt,- Core.mapTypeValues = vt}))))))))))- Core.TermOptional v1 -> (Optionals.maybe (Logic.ifElse (Equality.equal (Lists.length apptypes) 1) (Flows.pure (Core.TypeOptional (Lists.head apptypes))) (Flows.fail "optional type applied to more or less than one argument")) (\term -> checkApplied (Flows.bind (typeOfInternal cx vars types [] term) (\termType -> Flows.bind (checkTypeVariables cx vars termType) (\_ -> Flows.pure (Core.TypeOptional termType))))) v1)- Core.TermProduct v1 -> (checkApplied (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) v1) (\etypes -> Flows.bind (Flows.mapList (checkTypeVariables cx vars) etypes) (\_ -> Flows.pure (Core.TypeProduct etypes)))))- Core.TermRecord v1 -> - let tname = (Core.recordTypeName v1)- in - let fields = (Core.recordFields v1)- in (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) (Lists.map Core.fieldTerm fields)) (\ftypes -> Flows.bind (Flows.mapList (checkTypeVariables cx vars) ftypes) (\_ -> typeOfNominal "record typeOf" cx tname (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = tname,- Core.rowTypeFields = (Lists.zipWith (\n -> \t -> Core.FieldType {- Core.fieldTypeName = n,- Core.fieldTypeType = t}) (Lists.map Core.fieldName fields) ftypes)})))))- Core.TermSet v1 -> (Logic.ifElse (Sets.null v1) (Logic.ifElse (Equality.equal (Lists.length apptypes) 1) (Flows.pure (Core.TypeSet (Lists.head apptypes))) (Flows.fail "set type applied to more or less than one argument")) (Flows.bind (Flows.mapList (typeOfInternal cx vars types []) (Sets.toList v1)) (\eltypes -> Flows.bind (checkSameType "set elements" eltypes) (\unifiedType -> Flows.bind (checkTypeVariables cx vars unifiedType) (\_ -> Flows.pure (Core.TypeSet unifiedType))))))- Core.TermTypeLambda v1 -> - let v = (Core.typeLambdaParameter v1)- in - let e = (Core.typeLambdaBody v1)- in (Flows.bind (typeOfInternal cx (Sets.insert v vars) types [] e) (\t1 -> Flows.bind (checkTypeVariables cx (Sets.insert v vars) t1) (\_ -> Flows.pure (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = v,- Core.forallTypeBody = t1})))))- Core.TermTypeApplication v1 -> - let e = (Core.typedTermTerm v1)- in - let t = (Core.typedTermType v1)- in (typeOfInternal cx vars types (Lists.cons t apptypes) e)- Core.TermUnion v1 -> - let tname = (Core.injectionTypeName v1)- in - let field = (Core.injectionField v1)- in - let fname = (Core.fieldName field)- in - let fterm = (Core.fieldTerm field)- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> Flows.pure (nominalApplication tname apptypes))))))- Core.TermUnit -> (checkApplied (Flows.pure Core.TypeUnit))- Core.TermVariable v1 -> (checkApplied (Optionals.maybe (Flows.fail (Strings.cat [- "unbound variable: ",- (Core.unName v1)])) Flows.pure (Maps.lookup v1 types)))- Core.TermWrap v1 -> - let tname = (Core.wrappedTermTypeName v1)- in - let innerTerm = (Core.wrappedTermObject v1)- in (Flows.bind (typeOfInternal cx vars types [] innerTerm) (\innerType -> Flows.bind (checkTypeVariables cx vars innerType) (\_ -> typeOfNominal "wrapper typeOf" cx tname (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = tname,- Core.wrappedTypeObject = innerType})))))- _ -> (Flows.fail (Strings.cat [- "unsupported term variant in typeOf: ",- (Mantle_.termVariant (Variants.termVariant term))]))) term))--typeOfNominal :: (String -> Typing_.InferenceContext -> Core.Name -> Core.Type -> Compute.Flow t0 Core.Type)-typeOfNominal desc cx tname expected = - let resolveType = (\subst -> \v -> Optionals.fromMaybe (Core.TypeVariable v) (Maps.lookup v subst))- in (Flows.bind (requireSchemaType cx tname) (\schemaType -> - let svars = (Core.typeSchemeVariables schemaType)- in - let stype = (Core.typeSchemeType schemaType)- in (Flows.bind (Unification.unifyTypes (Typing_.inferenceContextSchemaTypes cx) stype expected desc) (\substWrapper -> - let subst = (Typing_.unTypeSubst substWrapper)- in - let tparams = (Lists.map (resolveType subst) svars)- in (Flows.pure (nominalApplication tname tparams))))))---- | The trivial inference result for the unit term-inferTypeOfUnit :: Typing_.InferenceResult-inferTypeOfUnit = Typing_.InferenceResult {- Typing_.inferenceResultTerm = Core.TermUnit,- Typing_.inferenceResultType = Core.TypeUnit,- Typing_.inferenceResultSubst = Substitution.idTypeSubst}---- | Create an inference result-yield :: (Core.Term -> Core.Type -> Typing_.TypeSubst -> Typing_.InferenceResult)-yield term typ subst = Typing_.InferenceResult {- Typing_.inferenceResultTerm = (Substitution.substTypesInTerm subst term),- Typing_.inferenceResultType = (Substitution.substInType subst typ),- Typing_.inferenceResultSubst = subst}--yieldChecked :: (t0 -> t1 -> Core.Term -> Core.Type -> Typing_.TypeSubst -> Compute.Flow t2 Typing_.InferenceResult)-yieldChecked cx vars term typ subst = - let iterm = (Substitution.substTypesInTerm subst term)- in - let itype = (Substitution.substInType subst typ)- in (Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = iterm,- Typing_.inferenceResultType = itype,- Typing_.inferenceResultSubst = subst}))--yieldDebug :: (t0 -> t1 -> Core.Term -> Core.Type -> Typing_.TypeSubst -> Compute.Flow t2 Typing_.InferenceResult)-yieldDebug cx debugId term typ subst = - let rterm = (Substitution.substTypesInTerm subst term)- in - let rtyp = (Substitution.substInType subst typ)- in (Flows.bind (Annotations.debugIf debugId (Strings.cat [- "\n\tterm: ",- Core__.term term,- "\n\ttyp: ",- Core__.type_ typ,- "\n\tsubst: ",- Typing.typeSubst subst,- "\n\trterm: ",- Core__.term rterm,- "\n\trtyp: ",- (Core__.type_ rtyp)])) (\result -> Flows.pure (Typing_.InferenceResult {- Typing_.inferenceResultTerm = rterm,- Typing_.inferenceResultType = rtyp,- Typing_.inferenceResultSubst = subst})))+-- Note: this is an automatically generated file. Do not edit.++-- | Type inference following Algorithm W, extended for nominal terms and types++module Hydra.Inference where++import qualified Hydra.Annotations as Annotations+import qualified Hydra.Checking as Checking+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Graph as Graph+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Monads as Monads+import qualified Hydra.Reflect as Reflect+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Schemas as Schemas+import qualified Hydra.Show.Core as Core__+import qualified Hydra.Show.Typing as Typing+import qualified Hydra.Sorting as Sorting+import qualified Hydra.Substitution as Substitution+import qualified Hydra.Typing as Typing_+import qualified Hydra.Unification as Unification+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Bind type constraints and continue with substitution+bindConstraints :: (Typing_.InferenceContext -> (Typing_.TypeSubst -> Compute.Flow t0 t1) -> [Typing_.TypeConstraint] -> Compute.Flow t0 t1)+bindConstraints cx f constraints = (Flows.bind (Unification.unifyTypeConstraints (Typing_.inferenceContextSchemaTypes cx) constraints) (\s -> Flows.bind (Checking.checkTypeSubst cx s) (\_ -> f s)))++-- | Place unbound type variables appearing anywhere under a typed let binding in the type scheme of that binding. These variables may appear in the binding type scheme itself or in that of a subterm, in domain types attached to functions, and in type abstraction and type application terms. This process attempts to capture type variables which have escaped unification, e.g. due to unused code. However, unbound type variables not appearing beneath any typed let binding remain unbound.+bindUnboundTypeVariables :: (Typing_.InferenceContext -> Core.Term -> Core.Term)+bindUnboundTypeVariables cx term0 = + let svars = (Sets.fromList (Maps.keys (Typing_.inferenceContextSchemaTypes cx)))+ in + let rewrite = (\recurse -> \term -> (\x -> case x of+ Core.TermLet v1 -> + let forBinding = (\b -> + let bname = (Core.bindingName b)+ in + let bterm = (Core.bindingTerm b)+ in (Maybes.maybe (Core.Binding {+ Core.bindingName = bname,+ Core.bindingTerm = (bindUnboundTypeVariables cx bterm),+ Core.bindingType = Nothing}) (\ts -> + let bvars = (Sets.fromList (Core.typeSchemeVariables ts))+ in + let unboundInType = (Rewriting.freeVariablesInType (Core.typeSchemeType ts))+ in + let unboundInTerm = (Rewriting.freeTypeVariablesInTerm bterm)+ in + let unbound = (Sets.toList (Sets.difference (Sets.union unboundInType unboundInTerm) (Sets.union svars bvars)))+ in + let ts2 = Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.concat2 (Core.typeSchemeVariables ts) unbound),+ Core.typeSchemeType = (Core.typeSchemeType ts),+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts)}+ in + let bterm2 = (Lists.foldl (\t -> \v -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = v,+ Core.typeLambdaBody = t})) bterm unbound)+ in Core.Binding {+ Core.bindingName = bname,+ Core.bindingTerm = bterm2,+ Core.bindingType = (Just ts2)}) (Core.bindingType b)))+ in (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.map forBinding (Core.letBindings v1)),+ Core.letBody = (bindUnboundTypeVariables cx (Core.letBody v1))}))+ _ -> (recurse term)) term)+ in (Rewriting.rewriteTerm rewrite term0)++-- | Fold a list of type variables over a term to build a type application term+buildTypeApplicationTerm :: ([Core.Name] -> Core.Term -> Core.Term)+buildTypeApplicationTerm tvars body = (Lists.foldl (\t -> \v -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.TypeVariable v)})) body tvars)++-- | An empty inference context+emptyInferenceContext :: Typing_.InferenceContext+emptyInferenceContext = Typing_.InferenceContext {+ Typing_.inferenceContextSchemaTypes = Maps.empty,+ Typing_.inferenceContextPrimitiveTypes = Maps.empty,+ Typing_.inferenceContextDataTypes = Maps.empty,+ Typing_.inferenceContextClassConstraints = Maps.empty,+ Typing_.inferenceContextDebug = False}++-- | Add (term variable, type scheme) pairs to the typing environment+extendContext :: ([(Core.Name, Core.TypeScheme)] -> Typing_.InferenceContext -> Typing_.InferenceContext)+extendContext pairs cx = Typing_.InferenceContext {+ Typing_.inferenceContextSchemaTypes = (Typing_.inferenceContextSchemaTypes cx),+ Typing_.inferenceContextPrimitiveTypes = (Typing_.inferenceContextPrimitiveTypes cx),+ Typing_.inferenceContextDataTypes = (Maps.union (Maps.fromList pairs) (Typing_.inferenceContextDataTypes cx)),+ Typing_.inferenceContextClassConstraints = (Typing_.inferenceContextClassConstraints cx),+ Typing_.inferenceContextDebug = (Typing_.inferenceContextDebug cx)}++-- | Finalize an inferred term by checking for unbound type variables, then normalizing type variables+finalizeInferredTerm :: (Typing_.InferenceContext -> Core.Term -> Compute.Flow t0 Core.Term)+finalizeInferredTerm cx term = + let term2 = (bindUnboundTypeVariables cx term)+ in (Flows.bind (Checking.checkForUnboundTypeVariables cx term2) (\_ -> Flows.pure (Rewriting.normalizeTypeVariablesInTerm term2)))++-- | Infer a term's type and map over the result+forInferredTerm :: (Typing_.InferenceContext -> Core.Term -> String -> (Typing_.InferenceResult -> t0) -> Compute.Flow t1 t0)+forInferredTerm cx term desc f = (Flows.map f (inferTypeOfTerm cx term desc))++-- | Get all free variables in an inference context+freeVariablesInContext :: (Typing_.InferenceContext -> S.Set Core.Name)+freeVariablesInContext cx = (Lists.foldl Sets.union Sets.empty (Lists.map Rewriting.freeVariablesInTypeSchemeSimple (Maps.elems (Typing_.inferenceContextDataTypes cx))))++-- | Generate a fresh type variable+freshVariableType :: (Compute.Flow t0 Core.Type)+freshVariableType = (Flows.map (\x -> Core.TypeVariable x) Schemas.freshName)++-- | Generalize a type to a type scheme+generalize :: (Typing_.InferenceContext -> Core.Type -> Core.TypeScheme)+generalize cx typ = + let isTypeVarName = (\name -> + let parts = (Strings.splitOn "." (Core.unName name))+ in (Equality.lte (Lists.length parts) 1))+ in + let vars = (Lists.nub (Lists.filter (\v -> Logic.and (isUnbound cx v) (isTypeVarName v)) (Rewriting.freeVariablesInTypeOrdered typ)))+ in + let allConstraints = (Typing_.inferenceContextClassConstraints cx)+ in + let relevantConstraints = (Maps.fromList (Maybes.cat (Lists.map (\v -> Maybes.map (\meta -> (v, meta)) (Maps.lookup v allConstraints)) vars)))+ in + let constraintsMaybe = (Logic.ifElse (Maps.null relevantConstraints) Nothing (Just relevantConstraints))+ in Core.TypeScheme {+ Core.typeSchemeVariables = vars,+ Core.typeSchemeType = typ,+ Core.typeSchemeConstraints = constraintsMaybe}++-- | Infer types for all elements in a graph+inferGraphTypes :: (Graph.Graph -> Compute.Flow t0 Graph.Graph)+inferGraphTypes g0 = + let fromLetTerm = (\l -> + let bindings = (Core.letBindings l)+ in + let body = (Core.letBody l)+ in Graph.Graph {+ Graph.graphElements = bindings,+ Graph.graphEnvironment = Maps.empty,+ Graph.graphTypes = Maps.empty,+ Graph.graphBody = body,+ Graph.graphPrimitives = (Graph.graphPrimitives g0),+ Graph.graphSchema = (Graph.graphSchema g0)})+ in + let toLetTerm = (\g -> + let toBinding = (\el -> Core.Binding {+ Core.bindingName = (Core.bindingName el),+ Core.bindingTerm = (Core.bindingTerm el),+ Core.bindingType = (Core.bindingType el)})+ in (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.map toBinding (Graph.graphElements g)),+ Core.letBody = (Graph.graphBody g)})))+ in + let forFinal = (\finalized -> (\x -> case x of+ Core.TermLet v1 -> (Flows.pure (fromLetTerm v1))+ Core.TermVariable _ -> (Flows.fail "Expected inferred graph as let term")) finalized)+ in (Monads.withTrace "graph inference" (Flows.bind (Schemas.graphToInferenceContext g0) (\cx -> Flows.bind (inferTypeOfTerm cx (toLetTerm g0) "graph term") (\result -> + let term = (Typing_.inferenceResultTerm result)+ in + let ts = (Typing_.inferenceResultType result)+ in (Flows.bind (finalizeInferredTerm cx term) (\finalized -> forFinal finalized))))))++-- | Infer the type of a term in graph context+inferInGraphContext :: (Core.Term -> Compute.Flow Graph.Graph Typing_.InferenceResult)+inferInGraphContext term = (Flows.bind Monads.getState (\g -> Flows.bind (Schemas.graphToInferenceContext g) (\cx -> inferTypeOfTerm cx term "single term")))++-- | Infer types for multiple terms+inferMany :: (Typing_.InferenceContext -> [(Core.Term, String)] -> Compute.Flow t0 ([Core.Term], ([Core.Type], Typing_.TypeSubst)))+inferMany cx pairs = + let dflt = + let e = (Pairs.first (Lists.head pairs))+ in + let desc = (Pairs.second (Lists.head pairs))+ in + let tl = (Lists.tail pairs)+ in (Flows.bind (inferTypeOfTerm cx e desc) (\result1 -> + let e1 = (Typing_.inferenceResultTerm result1)+ in + let t1 = (Typing_.inferenceResultType result1)+ in + let s1 = (Typing_.inferenceResultSubst result1)+ in (Flows.bind (inferMany (Substitution.substInContext s1 cx) tl) (\result2 -> + let e2 = (Pairs.first result2)+ in + let t2 = (Pairs.first (Pairs.second result2))+ in + let s2 = (Pairs.second (Pairs.second result2))+ in (Flows.pure (Lists.cons (Substitution.substTypesInTerm s2 e1) e2, (Lists.cons (Substitution.substInType s2 t1) t2, (Substitution.composeTypeSubst s1 s2))))))))+ in (Logic.ifElse (Lists.null pairs) (Flows.pure ([], ([], Substitution.idTypeSubst))) dflt)++-- | Infer the type of an annotated term+inferTypeOfAnnotatedTerm :: (Typing_.InferenceContext -> Core.AnnotatedTerm -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfAnnotatedTerm cx at = + let term = (Core.annotatedTermBody at)+ in + let ann = (Core.annotatedTermAnnotation at)+ in (Flows.bind (inferTypeOfTerm cx term "annotated term") (\result -> + let iterm = (Typing_.inferenceResultTerm result)+ in + let itype = (Typing_.inferenceResultType result)+ in + let isubst = (Typing_.inferenceResultSubst result)+ in + let iconstraints = (Typing_.inferenceResultClassConstraints result)+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = iterm,+ Core.annotatedTermAnnotation = ann})),+ Typing_.inferenceResultType = itype,+ Typing_.inferenceResultSubst = isubst,+ Typing_.inferenceResultClassConstraints = iconstraints}))))++-- | Infer the type of a function application+inferTypeOfApplication :: (Typing_.InferenceContext -> Core.Application -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfApplication cx app = + let e0 = (Core.applicationFunction app)+ in + let e1 = (Core.applicationArgument app)+ in (Flows.bind (inferTypeOfTerm cx e0 "lhs") (\lhsResult -> + let a = (Typing_.inferenceResultTerm lhsResult)+ in + let t0 = (Typing_.inferenceResultType lhsResult)+ in + let s0 = (Typing_.inferenceResultSubst lhsResult)+ in + let c0 = (Typing_.inferenceResultClassConstraints lhsResult)+ in (Flows.bind (inferTypeOfTerm (Substitution.substInContext s0 cx) e1 "rhs") (\rhsResult -> + let b = (Typing_.inferenceResultTerm rhsResult)+ in + let t1 = (Typing_.inferenceResultType rhsResult)+ in + let s1 = (Typing_.inferenceResultSubst rhsResult)+ in + let c1 = (Typing_.inferenceResultClassConstraints rhsResult)+ in (Flows.bind Schemas.freshName (\v -> Flows.bind (Unification.unifyTypes (Typing_.inferenceContextSchemaTypes cx) (Substitution.substInType s1 t0) (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = t1,+ Core.functionTypeCodomain = (Core.TypeVariable v)})) "application lhs") (\s2 -> Flows.bind (Checking.checkTypeSubst cx s2) (\_ -> + let rExpr = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Substitution.substTypesInTerm (Substitution.composeTypeSubst s1 s2) a),+ Core.applicationArgument = (Substitution.substTypesInTerm s2 b)}))+ in + let rType = (Substitution.substInType s2 (Core.TypeVariable v))+ in + let rSubst = (Substitution.composeTypeSubstList [+ s0,+ s1,+ s2])+ in + let c0Subst = (Substitution.substInClassConstraints s2 (Substitution.substInClassConstraints s1 c0))+ in + let c1Subst = (Substitution.substInClassConstraints s2 c1)+ in + let rConstraints = (mergeClassConstraints c0Subst c1Subst)+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = rExpr,+ Typing_.inferenceResultType = rType,+ Typing_.inferenceResultSubst = rSubst,+ Typing_.inferenceResultClassConstraints = rConstraints}))))))))))++-- | Infer the type of a case statement+inferTypeOfCaseStatement :: (Typing_.InferenceContext -> Core.CaseStatement -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfCaseStatement cx caseStmt = + let tname = (Core.caseStatementTypeName caseStmt)+ in + let dflt = (Core.caseStatementDefault caseStmt)+ in + let cases = (Core.caseStatementCases caseStmt)+ in + let fnames = (Lists.map Core.fieldName cases)+ in (Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Flows.mapMaybe (\t -> inferTypeOfTerm cx t (Strings.cat [+ "case ",+ (Core.unName tname),+ ".<default>"])) dflt) (\dfltResult -> Flows.bind (inferMany cx (Lists.map (\f -> (Core.fieldTerm f, (Strings.cat [+ "case ",+ (Core.unName tname),+ ".",+ (Core.unName (Core.fieldName f))]))) cases)) (\caseResults -> + let iterms = (Pairs.first caseResults)+ in + let itypes = (Pairs.first (Pairs.second caseResults))+ in + let isubst = (Pairs.second (Pairs.second caseResults))+ in (Flows.bind Schemas.freshName (\codv -> + let cod = (Core.TypeVariable codv)+ in + let caseMap = (Maps.fromList (Lists.map (\ft -> (Core.fieldTypeName ft, (Core.fieldTypeType ft))) sfields))+ in + let dfltConstraints = (Monads.maybeToList (Maybes.map (\r -> Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = cod,+ Typing_.typeConstraintRight = (Substitution.substInType isubst (Typing_.inferenceResultType r)),+ Typing_.typeConstraintComment = "match default"}) dfltResult))+ in + let caseConstraints = (Maybes.cat (Lists.zipWith (\fname -> \itype -> Maybes.map (\ftype -> Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = itype,+ Typing_.typeConstraintRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = ftype,+ Core.functionTypeCodomain = cod})),+ Typing_.typeConstraintComment = "case type"}) (Maps.lookup fname caseMap)) fnames itypes))+ in (mapConstraints cx (\subst -> yield (buildTypeApplicationTerm svars (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = tname,+ Core.caseStatementDefault = (Maybes.map Typing_.inferenceResultTerm dfltResult),+ Core.caseStatementCases = (Lists.zipWith (\n -> \t -> Core.Field {+ Core.fieldName = n,+ Core.fieldTerm = t}) fnames iterms)}))))) (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),+ Core.functionTypeCodomain = cod})) (Substitution.composeTypeSubstList (Lists.concat [+ Monads.maybeToList (Maybes.map Typing_.inferenceResultSubst dfltResult),+ [+ isubst,+ subst]]))) (Lists.concat [+ dfltConstraints,+ caseConstraints]))))))))))++-- | Infer the type of a collection+inferTypeOfCollection :: (Typing_.InferenceContext -> (Core.Type -> Core.Type) -> ([Core.Term] -> Core.Term) -> String -> [Core.Term] -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfCollection cx typCons trmCons desc els = (Flows.bind Schemas.freshName (\var -> Logic.ifElse (Lists.null els) (Flows.pure (yield (buildTypeApplicationTerm [+ var] (trmCons [])) (typCons (Core.TypeVariable var)) Substitution.idTypeSubst)) (Flows.bind (inferMany cx (Lists.zip els (Lists.map (\i -> Strings.cat [+ "#",+ (Literals.showInt32 i)]) (Math.range 1 (Math.add (Lists.length els) 1))))) (\results -> + let terms = (Pairs.first results)+ in + let types = (Pairs.first (Pairs.second results))+ in + let subst1 = (Pairs.second (Pairs.second results))+ in + let constraints = (Lists.map (\t -> Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = (Core.TypeVariable var),+ Typing_.typeConstraintRight = t,+ Typing_.typeConstraintComment = desc}) types)+ in (mapConstraints cx (\subst2 -> + let iterm = (trmCons terms)+ in + let itype = (typCons (Core.TypeVariable var))+ in + let isubst = (Substitution.composeTypeSubst subst1 subst2)+ in (yield iterm itype isubst)) constraints)))))++-- | Infer the type of a term and return a type scheme+inferTypeOf :: (Typing_.InferenceContext -> Core.Term -> Compute.Flow t0 (Core.Term, Core.TypeScheme))+inferTypeOf cx term = + let letTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "ignoredVariableName"),+ Core.bindingTerm = term,+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignoredBody"))}))+ in + let forBindings = (\bindings -> + let binding = (Lists.head bindings)+ in + let term1 = (Core.bindingTerm binding)+ in + let mts = (Core.bindingType binding)+ in (Maybes.maybe (Flows.fail "Expected a type scheme") (\ts -> Flows.pure (term1, ts)) mts))+ in + let unifyAndSubst = (\result -> + let subst = (Typing_.inferenceResultSubst result)+ in (Flows.bind (finalizeInferredTerm cx (Typing_.inferenceResultTerm result)) (\finalized -> Flows.bind (Lexical.withEmptyGraph (Core_.let_ finalized)) (\letResult -> + let bindings = (Core.letBindings letResult)+ in (Logic.ifElse (Equality.equal 1 (Lists.length bindings)) (forBindings bindings) (Flows.fail (Strings.cat [+ "Expected a single binding with a type scheme, but got: ",+ (Literals.showInt32 (Lists.length bindings)),+ " bindings"])))))))+ in (Flows.bind (inferTypeOfTerm cx letTerm "infer type of term") (\result -> unifyAndSubst result))++-- | Infer the type of an either value+inferTypeOfEither :: (Typing_.InferenceContext -> Either Core.Term Core.Term -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfEither cx e = (Eithers.either (\l -> Flows.bind (inferTypeOfTerm cx l "either left value") (\r1 -> + let iterm = (Typing_.inferenceResultTerm r1)+ in + let leftType = (Typing_.inferenceResultType r1)+ in + let subst = (Typing_.inferenceResultSubst r1)+ in (Flows.bind freshVariableType (\rightType -> + let eitherTerm = (Core.TermEither (Left iterm))+ in + let termWithLeftType = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = eitherTerm,+ Core.typeApplicationTermType = leftType}))+ in + let termWithBothTypes = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = termWithLeftType,+ Core.typeApplicationTermType = rightType}))+ in + let eitherType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = leftType,+ Core.eitherTypeRight = rightType}))+ in (yieldChecked termWithBothTypes eitherType subst))))) (\r -> Flows.bind (inferTypeOfTerm cx r "either right value") (\r1 -> + let iterm = (Typing_.inferenceResultTerm r1)+ in + let rightType = (Typing_.inferenceResultType r1)+ in + let subst = (Typing_.inferenceResultSubst r1)+ in (Flows.bind freshVariableType (\leftType -> + let eitherTerm = (Core.TermEither (Right iterm))+ in + let termWithLeftType = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = eitherTerm,+ Core.typeApplicationTermType = leftType}))+ in + let termWithBothTypes = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = termWithLeftType,+ Core.typeApplicationTermType = rightType}))+ in + let eitherType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = leftType,+ Core.eitherTypeRight = rightType}))+ in (yieldChecked termWithBothTypes eitherType subst))))) e)++-- | Infer the type of an elimination+inferTypeOfElimination :: (Typing_.InferenceContext -> Core.Elimination -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfElimination cx elm = ((\x -> case x of+ Core.EliminationRecord v1 -> (inferTypeOfProjection cx v1)+ Core.EliminationUnion v1 -> (inferTypeOfCaseStatement cx v1)+ Core.EliminationWrap v1 -> (inferTypeOfUnwrap cx v1)) elm)++-- | Infer the type of a function+inferTypeOfFunction :: (Typing_.InferenceContext -> Core.Function -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfFunction cx f = ((\x -> case x of+ Core.FunctionElimination v1 -> (inferTypeOfElimination cx v1)+ Core.FunctionLambda v1 -> (inferTypeOfLambda cx v1)+ Core.FunctionPrimitive v1 -> (inferTypeOfPrimitive cx v1)) f)++-- | Infer the type of a union injection+inferTypeOfInjection :: (Typing_.InferenceContext -> Core.Injection -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfInjection cx injection = + let tname = (Core.injectionTypeName injection)+ in + let field = (Core.injectionField injection)+ in + let fname = (Core.fieldName field)+ in + let term = (Core.fieldTerm field)+ in (Flows.bind (inferTypeOfTerm cx term "injected term") (\result -> Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in + let iterm = (Typing_.inferenceResultTerm result)+ in + let ityp = (Typing_.inferenceResultType result)+ in + let isubst = (Typing_.inferenceResultSubst result)+ in (Flows.bind (Core_.unionType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> mapConstraints cx (\subst -> yield (buildTypeApplicationTerm svars (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = tname,+ Core.injectionField = Core.Field {+ Core.fieldName = fname,+ Core.fieldTerm = iterm}}))) (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)) (Substitution.composeTypeSubst isubst subst)) [+ Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = ftyp,+ Typing_.typeConstraintRight = ityp,+ Typing_.typeConstraintComment = "schema type of injected field"}]))))))++-- | Infer the type of a lambda function+inferTypeOfLambda :: (Typing_.InferenceContext -> Core.Lambda -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfLambda cx lambda = + let var = (Core.lambdaParameter lambda)+ in + let body = (Core.lambdaBody lambda)+ in (Flows.bind Schemas.freshName (\vdom -> + let dom = (Core.TypeVariable vdom)+ in + let cx2 = (extendContext [+ (var, Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = dom,+ Core.typeSchemeConstraints = Nothing})] cx)+ in (Flows.bind (inferTypeOfTerm cx2 body "lambda body") (\result -> + let iterm = (Typing_.inferenceResultTerm result)+ in + let icod = (Typing_.inferenceResultType result)+ in + let isubst = (Typing_.inferenceResultSubst result)+ in + let rdom = (Substitution.substInType isubst dom)+ in + let rterm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = var,+ Core.lambdaDomain = (Just rdom),+ Core.lambdaBody = iterm})))+ in + let rtype = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = rdom,+ Core.functionTypeCodomain = icod}))+ in + let vars = (Sets.unions [+ Rewriting.freeVariablesInType rdom,+ (Rewriting.freeVariablesInType icod),+ (freeVariablesInContext (Substitution.substInContext isubst cx2))])+ in + let cx3 = (Substitution.substInContext isubst cx)+ in + let iconstraints = (Substitution.substInClassConstraints isubst (Typing_.inferenceResultClassConstraints result))+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = rterm,+ Typing_.inferenceResultType = rtype,+ Typing_.inferenceResultSubst = isubst,+ Typing_.inferenceResultClassConstraints = iconstraints}))))))++-- | Infer the type of a let (letrec) term which is already in a normal form+inferTypeOfLetNormalized :: (Typing_.InferenceContext -> Core.Let -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfLetNormalized cx0 letTerm = + let bins0 = (Core.letBindings letTerm)+ in + let body0 = (Core.letBody letTerm)+ in + let bnames = (Lists.map Core.bindingName bins0)+ in (Flows.bind (Schemas.freshNames (Lists.length bins0)) (\bvars -> + let tbins0 = (Lists.map (\x -> Core.TypeVariable x) bvars)+ in + let cx1 = (extendContext (Lists.zip bnames (Lists.map (\t -> Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = t,+ Core.typeSchemeConstraints = Nothing}) tbins0)) cx0)+ in (Flows.bind (inferTypesOfTemporaryBindings cx1 bins0) (\inferredResult -> + let bterms1 = (Pairs.first inferredResult)+ in + let tbins1 = (Pairs.first (Pairs.second inferredResult))+ in + let substAndConstraints = (Pairs.second (Pairs.second inferredResult))+ in + let s1 = (Pairs.first substAndConstraints)+ in + let inferredConstraints = (Pairs.second substAndConstraints)+ in (Flows.bind (Unification.unifyTypeLists (Typing_.inferenceContextSchemaTypes cx0) (Lists.map (Substitution.substInType s1) tbins0) tbins1 "temporary type bindings") (\s2 -> Flows.bind (Checking.checkTypeSubst cx0 s2) (\_ -> + let g2base = (Substitution.substInContext (Substitution.composeTypeSubst s1 s2) cx0)+ in + let constraintsWithS2 = (Substitution.substInClassConstraints s2 inferredConstraints)+ in + let composedSubst = (Substitution.composeTypeSubst s1 s2)+ in + let originalBindingConstraints = (Lists.foldl (\acc -> \b -> Maybes.maybe acc (\ts -> Maybes.maybe acc (\c -> mergeClassConstraints acc c) (Core.typeSchemeConstraints ts)) (Core.bindingType b)) Maps.empty bins0)+ in + let originalConstraintsSubst = (Substitution.substInClassConstraints composedSubst originalBindingConstraints)+ in + let allInferredConstraints = (mergeClassConstraints constraintsWithS2 originalConstraintsSubst)+ in + let mergedConstraints = (mergeClassConstraints (Typing_.inferenceContextClassConstraints g2base) allInferredConstraints)+ in + let g2 = Typing_.InferenceContext {+ Typing_.inferenceContextSchemaTypes = (Typing_.inferenceContextSchemaTypes g2base),+ Typing_.inferenceContextPrimitiveTypes = (Typing_.inferenceContextPrimitiveTypes g2base),+ Typing_.inferenceContextDataTypes = (Typing_.inferenceContextDataTypes g2base),+ Typing_.inferenceContextClassConstraints = mergedConstraints,+ Typing_.inferenceContextDebug = (Typing_.inferenceContextDebug g2base)}+ in + let bterms1Subst = (Lists.map (Substitution.substTypesInTerm s2) bterms1)+ in + let tsbins1 = (Lists.zip bnames (Lists.map (\t -> generalize g2 (Substitution.substInType s2 t)) tbins1))+ in (Flows.bind (inferTypeOfTerm (extendContext tsbins1 g2) body0 "let body") (\bodyResult -> + let body1 = (Typing_.inferenceResultTerm bodyResult)+ in + let tbody = (Typing_.inferenceResultType bodyResult)+ in + let sbody = (Typing_.inferenceResultSubst bodyResult)+ in + let st1 = (Typing_.TermSubst (Maps.fromList (Lists.map (\pair -> + let name = (Pairs.first pair)+ in + let ts = (Pairs.second pair)+ in (name, (buildTypeApplicationTerm (Core.typeSchemeVariables ts) (Core.TermVariable name)))) tsbins1)))+ in + let createBinding = (\bindingPair -> + let nameTsPair = (Pairs.first bindingPair)+ in + let term = (Pairs.second bindingPair)+ in + let name = (Pairs.first nameTsPair)+ in + let ts = (Pairs.second nameTsPair)+ in + let finalTs = (Substitution.substInTypeScheme sbody ts)+ in + let typeLambdaTerm = (Lists.foldl (\b -> \v -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = v,+ Core.typeLambdaBody = b})) (Substitution.substituteInTerm st1 term) (Lists.reverse (Core.typeSchemeVariables finalTs)))+ in Core.Binding {+ Core.bindingName = name,+ Core.bindingTerm = (Substitution.substTypesInTerm (Substitution.composeTypeSubst sbody s2) typeLambdaTerm),+ Core.bindingType = (Just finalTs)})+ in + let bins1 = (Lists.map createBinding (Lists.zip tsbins1 bterms1Subst))+ in + let bodyConstraints = (Substitution.substInClassConstraints sbody (Typing_.inferenceResultClassConstraints bodyResult))+ in + let bindingConstraintsSubst = (Substitution.substInClassConstraints sbody constraintsWithS2)+ in + let allConstraints = (mergeClassConstraints bindingConstraintsSubst bodyConstraints)+ in + let ret = Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (Core.TermLet (Core.Let {+ Core.letBindings = bins1,+ Core.letBody = body1})),+ Typing_.inferenceResultType = tbody,+ Typing_.inferenceResultSubst = (Substitution.composeTypeSubstList [+ s1,+ s2,+ sbody]),+ Typing_.inferenceResultClassConstraints = allConstraints}+ in (Flows.pure ret))))))))))++-- | Normalize a let term before inferring its type+inferTypeOfLet :: (Typing_.InferenceContext -> Core.Let -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfLet cx let0 = + let bindings0 = (Core.letBindings let0)+ in + let body0 = (Core.letBody let0)+ in + let names = (Lists.map Core.bindingName bindings0)+ in + let nameSet = (Sets.fromList names)+ in + let toPair = (\binding -> + let name = (Core.bindingName binding)+ in + let term = (Core.bindingTerm binding)+ in (name, (Lists.filter (\n -> Sets.member n nameSet) (Sets.toList (Rewriting.freeVariablesInTerm term)))))+ in + let adjList = (Lists.map toPair bindings0)+ in + let groups = (Sorting.topologicalSortComponents adjList)+ in + let bindingMap = (Maps.fromList (Lists.zip names bindings0))+ in + let createLet = (\e -> \group -> Core.TermLet (Core.Let {+ Core.letBindings = (Maybes.cat (Lists.map (\n -> Maps.lookup n bindingMap) group)),+ Core.letBody = e}))+ in + let rewrittenLet = (Lists.foldl createLet body0 (Lists.reverse groups))+ in + let restoreLet = (\iterm -> + let helper = (\level -> \bins -> \term -> + let nonzero = (\term -> (\x -> case x of+ Core.TermLet v1 -> + let bs = (Core.letBindings v1)+ in + let letBody = (Core.letBody v1)+ in (helper (Math.sub level 1) (Lists.concat [+ bs,+ bins]) letBody)) term)+ in (Logic.ifElse (Equality.equal level 0) (bins, term) (nonzero term)))+ in + let result = (helper (Lists.length groups) [] iterm)+ in + let bindingList = (Pairs.first result)+ in + let e = (Pairs.second result)+ in + let bindingMap2 = (Maps.fromList (Lists.map (\b -> (Core.bindingName b, b)) bindingList))+ in (Core.TermLet (Core.Let {+ Core.letBindings = (Maybes.cat (Lists.map (\n -> Maps.lookup n bindingMap2) names)),+ Core.letBody = e})))+ in + let rewriteResult = (\result -> + let iterm = (Typing_.inferenceResultTerm result)+ in + let itype = (Typing_.inferenceResultType result)+ in + let isubst = (Typing_.inferenceResultSubst result)+ in + let iconstraints = (Typing_.inferenceResultClassConstraints result)+ in Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (restoreLet iterm),+ Typing_.inferenceResultType = itype,+ Typing_.inferenceResultSubst = isubst,+ Typing_.inferenceResultClassConstraints = iconstraints})+ in + let res = ((\x -> case x of+ Core.TermLet v1 -> (inferTypeOfLetNormalized cx v1)+ _ -> (inferTypeOfTerm cx rewrittenLet "empty let term")) rewrittenLet)+ in (Flows.map rewriteResult res)++-- | Infer the type of a list+inferTypeOfList :: (Typing_.InferenceContext -> [Core.Term] -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfList cx = (inferTypeOfCollection cx (\x -> Core.TypeList x) (\x -> Core.TermList x) "list element")++-- | Infer the type of a literal+inferTypeOfLiteral :: (t0 -> Core.Literal -> Compute.Flow t1 Typing_.InferenceResult)+inferTypeOfLiteral _ lit = (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (Core.TermLiteral lit),+ Typing_.inferenceResultType = (Core.TypeLiteral (Reflect.literalType lit)),+ Typing_.inferenceResultSubst = Substitution.idTypeSubst,+ Typing_.inferenceResultClassConstraints = Maps.empty}))++-- | Infer the type of a map+inferTypeOfMap :: (Typing_.InferenceContext -> M.Map Core.Term Core.Term -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfMap cx m = (Flows.bind Schemas.freshName (\kvar -> Flows.bind Schemas.freshName (\vvar -> Logic.ifElse (Maps.null m) (Flows.pure (yield (buildTypeApplicationTerm [+ kvar,+ vvar] (Core.TermMap Maps.empty)) (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable kvar),+ Core.mapTypeValues = (Core.TypeVariable vvar)})) Substitution.idTypeSubst)) (Flows.bind (inferMany cx (Lists.map (\k -> (k, "map key")) (Maps.keys m))) (\kresults -> + let kterms = (Pairs.first kresults)+ in + let ktypes = (Pairs.first (Pairs.second kresults))+ in + let ksubst = (Pairs.second (Pairs.second kresults))+ in (Flows.bind (inferMany cx (Lists.map (\v -> (v, "map value")) (Maps.elems m))) (\vresults -> + let vterms = (Pairs.first vresults)+ in + let vtypes = (Pairs.first (Pairs.second vresults))+ in + let vsubst = (Pairs.second (Pairs.second vresults))+ in + let kcons = (Lists.map (\t -> Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = (Core.TypeVariable kvar),+ Typing_.typeConstraintRight = t,+ Typing_.typeConstraintComment = "map key"}) ktypes)+ in + let vcons = (Lists.map (\t -> Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = (Core.TypeVariable vvar),+ Typing_.typeConstraintRight = t,+ Typing_.typeConstraintComment = "map value"}) vtypes)+ in (mapConstraints cx (\subst -> yield (Core.TermMap (Maps.fromList (Lists.zip kterms vterms))) (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable kvar),+ Core.mapTypeValues = (Core.TypeVariable vvar)})) (Substitution.composeTypeSubstList [+ ksubst,+ vsubst,+ subst])) (Lists.concat [+ kcons,+ vcons])))))))))++-- | Infer the type of an optional+inferTypeOfOptional :: (Typing_.InferenceContext -> Maybe Core.Term -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfOptional cx m = + let trmCons = (\terms -> Logic.ifElse (Lists.null terms) (Core.TermMaybe Nothing) (Core.TermMaybe (Just (Lists.head terms))))+ in (inferTypeOfCollection cx (\x -> Core.TypeMaybe x) trmCons "optional element" (Maybes.maybe [] Lists.singleton m))++-- | Infer the type of a pair+inferTypeOfPair :: (Typing_.InferenceContext -> (Core.Term, Core.Term) -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfPair cx p = (Flows.map (\results -> + let iterms = (Pairs.first results)+ in + let itypes = (Pairs.first (Pairs.second results))+ in + let isubst = (Pairs.second (Pairs.second results))+ in + let ifst = (Lists.head iterms)+ in + let isnd = (Lists.head (Lists.tail iterms))+ in + let tyFst = (Lists.head itypes)+ in + let tySnd = (Lists.head (Lists.tail itypes))+ in + let pairTerm = (Core.TermPair (ifst, isnd))+ in + let termWithTypes = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = pairTerm,+ Core.typeApplicationTermType = tyFst})),+ Core.typeApplicationTermType = tySnd}))+ in (yield termWithTypes (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = tyFst,+ Core.pairTypeSecond = tySnd})) isubst)) (inferMany cx [+ (Pairs.first p, "pair first element"),+ (Pairs.second p, "pair second element")]))++-- | Infer the type of a primitive function. Class constraints from the primitive's type scheme are propagated to the inference result.+inferTypeOfPrimitive :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfPrimitive cx name = (Maybes.maybe (Flows.fail (Strings.cat2 "No such primitive: " (Core.unName name))) (\scheme -> Flows.bind (Schemas.instantiateTypeScheme scheme) (\ts -> + let constraints = (Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints ts))+ in (yieldCheckedWithConstraints (buildTypeApplicationTerm (Core.typeSchemeVariables ts) (Core.TermFunction (Core.FunctionPrimitive name))) (Core.typeSchemeType ts) Substitution.idTypeSubst constraints))) (Maps.lookup name (Typing_.inferenceContextPrimitiveTypes cx)))++-- | Infer the type of a record projection+inferTypeOfProjection :: (Typing_.InferenceContext -> Core.Projection -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfProjection cx proj = + let tname = (Core.projectionTypeName proj)+ in + let fname = (Core.projectionField proj)+ in (Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.recordType tname stype) (\sfields -> Flows.bind (Schemas.findFieldType fname sfields) (\ftyp -> Flows.pure (yield (buildTypeApplicationTerm svars (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = tname,+ Core.projectionField = fname}))))) (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),+ Core.functionTypeCodomain = ftyp})) Substitution.idTypeSubst))))))++-- | Infer the type of a record+inferTypeOfRecord :: (Typing_.InferenceContext -> Core.Record -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfRecord cx record = + let tname = (Core.recordTypeName record)+ in + let fields = (Core.recordFields record)+ in + let fnames = (Lists.map Core.fieldName fields)+ in (Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> Flows.bind (inferMany cx (Lists.map (\f -> (Core.fieldTerm f, (Strings.cat2 "field " (Core.unName (Core.fieldName f))))) fields)) (\results -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in + let iterms = (Pairs.first results)+ in + let itypes = (Pairs.first (Pairs.second results))+ in + let isubst = (Pairs.second (Pairs.second results))+ in + let ityp = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = tname,+ Core.rowTypeFields = (Lists.zipWith (\n -> \t -> Core.FieldType {+ Core.fieldTypeName = n,+ Core.fieldTypeType = t}) fnames itypes)}))+ in (mapConstraints cx (\subst -> yield (buildTypeApplicationTerm svars (Core.TermRecord (Core.Record {+ Core.recordTypeName = tname,+ Core.recordFields = (Lists.zipWith (\n -> \t -> Core.Field {+ Core.fieldName = n,+ Core.fieldTerm = t}) fnames iterms)}))) (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)) (Substitution.composeTypeSubst isubst subst)) [+ Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = stype,+ Typing_.typeConstraintRight = ityp,+ Typing_.typeConstraintComment = "schema type of record"}]))))++-- | Infer the type of a set+inferTypeOfSet :: (Typing_.InferenceContext -> S.Set Core.Term -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfSet cx s = (inferTypeOfCollection cx (\x -> Core.TypeSet x) (\terms -> Core.TermSet (Sets.fromList terms)) "set element" (Sets.toList s))++-- | Infer the type of a given term+inferTypeOfTerm :: (Typing_.InferenceContext -> Core.Term -> String -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfTerm cx term desc = + let matchTerm = ((\x -> case x of+ Core.TermAnnotated v1 -> (inferTypeOfAnnotatedTerm cx v1)+ Core.TermApplication v1 -> (inferTypeOfApplication cx v1)+ Core.TermEither v1 -> (inferTypeOfEither cx v1)+ Core.TermFunction v1 -> (inferTypeOfFunction cx v1)+ Core.TermLet v1 -> (inferTypeOfLet cx v1)+ Core.TermList v1 -> (inferTypeOfList cx v1)+ Core.TermLiteral v1 -> (inferTypeOfLiteral cx v1)+ Core.TermMap v1 -> (inferTypeOfMap cx v1)+ Core.TermMaybe v1 -> (inferTypeOfOptional cx v1)+ Core.TermPair v1 -> (inferTypeOfPair cx v1)+ Core.TermRecord v1 -> (inferTypeOfRecord cx v1)+ Core.TermSet v1 -> (inferTypeOfSet cx v1)+ Core.TermTypeApplication v1 -> (inferTypeOfTypeApplication cx v1)+ Core.TermTypeLambda v1 -> (inferTypeOfTypeLambda cx v1)+ Core.TermUnion v1 -> (inferTypeOfInjection cx v1)+ Core.TermUnit -> (Flows.pure inferTypeOfUnit)+ Core.TermVariable v1 -> (inferTypeOfVariable cx v1)+ Core.TermWrap v1 -> (inferTypeOfWrappedTerm cx v1)) term)+ in (Monads.withTrace desc matchTerm)++-- | Infer the type of a type abstraction; just pass through to the lambda body.+inferTypeOfTypeLambda :: (Typing_.InferenceContext -> Core.TypeLambda -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfTypeLambda cx ta = (inferTypeOfTerm cx (Core.typeLambdaBody ta) "type abstraction")++-- | Infer the type of a type application; just pass through to the inner term.+inferTypeOfTypeApplication :: (Typing_.InferenceContext -> Core.TypeApplicationTerm -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfTypeApplication cx tt = (inferTypeOfTerm cx (Core.typeApplicationTermBody tt) "type application term")++-- | The trivial inference rule for the unit term+inferTypeOfUnit :: Typing_.InferenceResult+inferTypeOfUnit = Typing_.InferenceResult {+ Typing_.inferenceResultTerm = Core.TermUnit,+ Typing_.inferenceResultType = Core.TypeUnit,+ Typing_.inferenceResultSubst = Substitution.idTypeSubst,+ Typing_.inferenceResultClassConstraints = Maps.empty}++-- | Infer the type of an unwrap operation+inferTypeOfUnwrap :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfUnwrap cx tname = (Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in (Flows.bind (Core_.wrappedType tname stype) (\wtyp -> Flows.pure (yield (buildTypeApplicationTerm svars (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap tname)))) (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)),+ Core.functionTypeCodomain = wtyp})) Substitution.idTypeSubst)))))++-- | Infer the type of a variable+inferTypeOfVariable :: (Typing_.InferenceContext -> Core.Name -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfVariable cx name = (Maybes.maybe (Flows.fail (Strings.cat2 "Variable not bound to type: " (Core.unName name))) (\scheme -> Flows.bind (Schemas.instantiateTypeScheme scheme) (\ts -> + let constraints = (Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints ts))+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (buildTypeApplicationTerm (Core.typeSchemeVariables ts) (Core.TermVariable name)),+ Typing_.inferenceResultType = (Core.typeSchemeType ts),+ Typing_.inferenceResultSubst = Substitution.idTypeSubst,+ Typing_.inferenceResultClassConstraints = constraints})))) (Maps.lookup name (Typing_.inferenceContextDataTypes cx)))++-- | Infer the type of a wrapped term+inferTypeOfWrappedTerm :: (Typing_.InferenceContext -> Core.WrappedTerm -> Compute.Flow t0 Typing_.InferenceResult)+inferTypeOfWrappedTerm cx wt = + let tname = (Core.wrappedTermTypeName wt)+ in + let term = (Core.wrappedTermBody wt)+ in (Flows.bind (Schemas.requireSchemaType cx tname) (\schemaType -> Flows.bind (inferTypeOfTerm cx term "wrapped term") (\result -> + let svars = (Core.typeSchemeVariables schemaType)+ in + let stype = (Core.typeSchemeType schemaType)+ in + let iterm = (Typing_.inferenceResultTerm result)+ in + let itype = (Typing_.inferenceResultType result)+ in + let isubst = (Typing_.inferenceResultSubst result)+ in + let ityp = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = tname,+ Core.wrappedTypeBody = itype}))+ in (mapConstraints cx (\subst -> yield (buildTypeApplicationTerm svars (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = tname,+ Core.wrappedTermBody = iterm}))) (Schemas.nominalApplication tname (Lists.map (\x -> Core.TypeVariable x) svars)) (Substitution.composeTypeSubst isubst subst)) [+ Typing_.TypeConstraint {+ Typing_.typeConstraintLeft = stype,+ Typing_.typeConstraintRight = ityp,+ Typing_.typeConstraintComment = "schema type of wrapper"}]))))++-- | Infer types for temporary let bindings. Returns a 4-tuple of (terms, types, substitution, accumulated constraints)+inferTypesOfTemporaryBindings :: (Typing_.InferenceContext -> [Core.Binding] -> Compute.Flow t0 ([Core.Term], ([Core.Type], (Typing_.TypeSubst, (M.Map Core.Name Core.TypeVariableMetadata)))))+inferTypesOfTemporaryBindings cx bins = + let dflt = + let binding = (Lists.head bins)+ in + let k = (Core.bindingName binding)+ in + let v = (Core.bindingTerm binding)+ in + let tl = (Lists.tail bins)+ in (Flows.bind (inferTypeOfTerm cx v (Strings.cat [+ "temporary let binding '",+ (Core.unName k),+ "'"])) (\result1 -> + let j = (Typing_.inferenceResultTerm result1)+ in + let u_prime = (Typing_.inferenceResultType result1)+ in + let u = (Typing_.inferenceResultSubst result1)+ in + let c1Inferred = (Typing_.inferenceResultClassConstraints result1)+ in (Flows.bind (Maybes.maybe (Flows.pure Maps.empty) (\ts -> Flows.bind (Schemas.instantiateTypeScheme ts) (\instantiatedTs -> + let freshConstraints = (Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints instantiatedTs))+ in (Flows.bind (Unification.unifyTypes (Typing_.inferenceContextSchemaTypes cx) (Core.typeSchemeType instantiatedTs) u_prime "original binding type") (\unifySubst -> Flows.pure (Substitution.substInClassConstraints unifySubst freshConstraints))))) (Core.bindingType binding)) (\originalBindingConstraints -> + let c1 = (mergeClassConstraints c1Inferred originalBindingConstraints)+ in (Flows.bind (inferTypesOfTemporaryBindings (Substitution.substInContext u cx) tl) (\result2 -> + let h = (Pairs.first result2)+ in + let r_prime = (Pairs.first (Pairs.second result2))+ in + let restPair = (Pairs.second (Pairs.second result2))+ in + let r = (Pairs.first restPair)+ in + let c2 = (Pairs.second restPair)+ in + let c1Subst = (Substitution.substInClassConstraints r c1)+ in + let mergedConstraints = (mergeClassConstraints c1Subst c2)+ in (Flows.pure (Lists.cons (Substitution.substTypesInTerm r j) h, (Lists.cons (Substitution.substInType r u_prime) r_prime, (Substitution.composeTypeSubst u r, mergedConstraints))))))))))+ in (Logic.ifElse (Lists.null bins) (Flows.pure ([], ([], (Substitution.idTypeSubst, Maps.empty)))) dflt)++-- | Create an initial type context from a graph+initialTypeContext :: (Graph.Graph -> Compute.Flow t0 Typing_.TypeContext)+initialTypeContext g = + let toPair = (\el -> + let name = (Core.bindingName el)+ in (Maybes.maybe (Flows.fail (Strings.cat2 "untyped element: " (Core.unName name))) (\ts -> Flows.pure (name, (Schemas.typeSchemeToFType ts))) (Core.bindingType el)))+ in (Flows.bind (Schemas.graphToInferenceContext g) (\ix -> Flows.bind (Flows.map Maps.fromList (Flows.mapList toPair (Graph.graphElements g))) (\types -> Flows.pure (Typing_.TypeContext {+ Typing_.typeContextTypes = types,+ Typing_.typeContextMetadata = Maps.empty,+ Typing_.typeContextTypeVariables = Sets.empty,+ Typing_.typeContextLambdaVariables = Sets.empty,+ Typing_.typeContextLetVariables = Sets.empty,+ Typing_.typeContextInferenceContext = ix}))))++-- | Check if a variable is unbound in context+isUnbound :: (Typing_.InferenceContext -> Core.Name -> Bool)+isUnbound cx v = (Logic.and (Logic.not (Sets.member v (freeVariablesInContext cx))) (Logic.not (Maps.member v (Typing_.inferenceContextSchemaTypes cx))))++-- | Map over type constraints after unification+mapConstraints :: (Typing_.InferenceContext -> (Typing_.TypeSubst -> t0) -> [Typing_.TypeConstraint] -> Compute.Flow t1 t0)+mapConstraints cx f constraints = (Flows.bind (Unification.unifyTypeConstraints (Typing_.inferenceContextSchemaTypes cx) constraints) (\s -> Flows.bind (Checking.checkTypeSubst cx s) (\_ -> Flows.pure (f s))))++-- | Merge two maps of class constraints. When both maps have constraints for the same variable, union the class sets.+mergeClassConstraints :: Ord t0 => (M.Map t0 Core.TypeVariableMetadata -> M.Map t0 Core.TypeVariableMetadata -> M.Map t0 Core.TypeVariableMetadata)+mergeClassConstraints m1 m2 = (Lists.foldl (\acc -> \pair -> + let k = (Pairs.first pair)+ in + let v = (Pairs.second pair)+ in (Maybes.maybe (Maps.insert k v acc) (\existing -> + let merged = Core.TypeVariableMetadata {+ Core.typeVariableMetadataClasses = (Sets.union (Core.typeVariableMetadataClasses existing) (Core.typeVariableMetadataClasses v))}+ in (Maps.insert k merged acc)) (Maps.lookup k acc))) m1 (Maps.toList m2))++-- | Show an inference result for debugging+showInferenceResult :: (Typing_.InferenceResult -> String)+showInferenceResult result = + let term = (Typing_.inferenceResultTerm result)+ in + let typ = (Typing_.inferenceResultType result)+ in + let subst = (Typing_.inferenceResultSubst result)+ in (Strings.cat [+ "{term=",+ (Core__.term term),+ ", type=",+ (Core__.type_ typ),+ ", subst=",+ (Typing.typeSubst subst),+ "}"])++-- | Create an inference result with no class constraints+yield :: (Core.Term -> Core.Type -> Typing_.TypeSubst -> Typing_.InferenceResult)+yield term typ subst = Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (Substitution.substTypesInTerm subst term),+ Typing_.inferenceResultType = (Substitution.substInType subst typ),+ Typing_.inferenceResultSubst = subst,+ Typing_.inferenceResultClassConstraints = Maps.empty}++-- | Create a checked inference result+yieldChecked :: (Core.Term -> Core.Type -> Typing_.TypeSubst -> Compute.Flow t0 Typing_.InferenceResult)+yieldChecked term typ subst = + let iterm = (Substitution.substTypesInTerm subst term)+ in + let itype = (Substitution.substInType subst typ)+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = iterm,+ Typing_.inferenceResultType = itype,+ Typing_.inferenceResultSubst = subst,+ Typing_.inferenceResultClassConstraints = Maps.empty}))++-- | Create a checked inference result with class constraints+yieldCheckedWithConstraints :: (Core.Term -> Core.Type -> Typing_.TypeSubst -> M.Map Core.Name Core.TypeVariableMetadata -> Compute.Flow t0 Typing_.InferenceResult)+yieldCheckedWithConstraints term typ subst constraints = + let iterm = (Substitution.substTypesInTerm subst term)+ in + let itype = (Substitution.substInType subst typ)+ in + let iconstraints = (Substitution.substInClassConstraints subst constraints)+ in (Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = iterm,+ Typing_.inferenceResultType = itype,+ Typing_.inferenceResultSubst = subst,+ Typing_.inferenceResultClassConstraints = iconstraints}))++-- | Create an inference result with debug output+yieldDebug :: (t0 -> t1 -> Core.Term -> Core.Type -> Typing_.TypeSubst -> Compute.Flow t2 Typing_.InferenceResult)+yieldDebug cx debugId term typ subst = + let rterm = (Substitution.substTypesInTerm subst term)+ in + let rtyp = (Substitution.substInType subst typ)+ in (Flows.bind (Annotations.debugIf debugId (Strings.cat [+ "\n\tterm: ",+ (Core__.term term),+ "\n\ttyp: ",+ (Core__.type_ typ),+ "\n\tsubst: ",+ (Typing.typeSubst subst),+ "\n\trterm: ",+ (Core__.term rterm),+ "\n\trtyp: ",+ (Core__.type_ rtyp)])) (\result -> Flows.pure (Typing_.InferenceResult {+ Typing_.inferenceResultTerm = rterm,+ Typing_.inferenceResultType = rtyp,+ Typing_.inferenceResultSubst = subst,+ Typing_.inferenceResultClassConstraints = Maps.empty})))++-- | Create an inference result with class constraints+yieldWithConstraints :: (Core.Term -> Core.Type -> Typing_.TypeSubst -> M.Map Core.Name Core.TypeVariableMetadata -> Typing_.InferenceResult)+yieldWithConstraints term typ subst constraints = Typing_.InferenceResult {+ Typing_.inferenceResultTerm = (Substitution.substTypesInTerm subst term),+ Typing_.inferenceResultType = (Substitution.substInType subst typ),+ Typing_.inferenceResultSubst = subst,+ Typing_.inferenceResultClassConstraints = constraints}
− src/gen-main/haskell/Hydra/Json.hs
@@ -1,40 +0,0 @@--- | A JSON syntax model. See the BNF at https://www.json.org--module Hydra.Json where--import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | A JSON value-data Value = - -- | A JSON array- ValueArray [Value] |- -- | A boolean value- ValueBoolean Bool |- -- | JSON's null value- ValueNull |- -- | A numeric value- ValueNumber Double |- -- | A JSON object as a set of key/value pairs- ValueObject (M.Map String Value) |- -- | A string value- ValueString String- deriving (Eq, Ord, Read, Show)--_Value = (Core.Name "hydra.json.Value")--_Value_array = (Core.Name "array")--_Value_boolean = (Core.Name "boolean")--_Value_null = (Core.Name "null")--_Value_number = (Core.Name "number")--_Value_object = (Core.Name "object")--_Value_string = (Core.Name "string")
+ src/gen-main/haskell/Hydra/Json/Bootstrap.hs view
@@ -0,0 +1,1504 @@+-- Note: this is an automatically generated file. Do not edit.++-- | A module which provides a minimal typing environment for decoding other modules from JSON. This avoids certain problems with generating entire source modules into target languages like Java, which is subject to method size limits for large modules like hydra.core.++module Hydra.Json.Bootstrap where++import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++typesByName :: (M.Map Core.Name Core.Type)+typesByName = (M.fromList [+ (Core.Name "hydra.compute.Adapter", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v2"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.compute.Adapter"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "isLossy"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Whether information may be lost in the course of this adaptation")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "source"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "t1")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The source type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "target"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "t2")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The target type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "coder"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v2"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The coder for transforming instances of the source type to instances of the target type")))])}))}]}))}))}))}))}))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A two-level bidirectional encoder which adapts types to types and terms to terms")))])}))),+ (Core.Name "hydra.compute.Bicoder", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v2"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.compute.Bicoder"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "encode"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Adapter")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v2"))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function from source types to adapters")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "decode"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Adapter")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v1"))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function from target types to adapters")))])}))}]}))}))}))}))}))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A two-level encoder and decoder, operating both at a type level and an instance (data) level")))])}))),+ (Core.Name "hydra.compute.Coder", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v2"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.compute.Coder"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "encode"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "v1")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v2"))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function from source values to a flow of target values")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "decode"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "v2")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v1"))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function from target values to a flow of source values")))])}))}]}))}))}))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An encoder and decoder; a bidirectional flow between two types")))])}))),+ (Core.Name "hydra.compute.Flow", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v"),+ Core.forallTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.compute.Flow"),+ Core.wrappedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "s")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.compute.Trace")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.FlowState")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A variant of the State monad with built-in logging and error handling")))])}))),+ (Core.Name "hydra.compute.FlowState", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "value"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "v"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The resulting value, or nothing in the case of failure")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "state"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "s")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The final state")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "trace"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.compute.Trace")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The trace (log) produced during evaluation")))])}))}]}))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The result of evaluating a Flow")))])}))),+ (Core.Name "hydra.compute.Trace", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.compute.Trace"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "stack"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A stack of context labels")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "messages"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A log of warnings and/or info messages")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "other"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A map of string keys to arbitrary terms as values, for application-specific use")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A container for logging and error information")))])}))),+ (Core.Name "hydra.core.AnnotatedTerm", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The term being annotated")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "annotation"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The annotation as a map from keys to values")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term together with an annotation")))])}))),+ (Core.Name "hydra.core.AnnotatedType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.AnnotatedType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type being annotated")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "annotation"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The annotation as a map from keys to values")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type together with an annotation")))])}))),+ (Core.Name "hydra.core.Application", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Application"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "function"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The left-hand side of the application")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "argument"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The right-hand side of the application")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term which applies a function to an argument")))])}))),+ (Core.Name "hydra.core.ApplicationType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.ApplicationType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "function"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The left-hand side of the application")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "argument"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The right-hand side of the application")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type-level analog of an application term")))])}))),+ (Core.Name "hydra.core.Binding", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Binding"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the bound variable")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "term"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The term to which the variable is bound")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.core.TypeScheme"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The optional type of the bound term")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A field with an optional type scheme, used to bind variables to terms in a 'let' expression")))])}))),+ (Core.Name "hydra.core.CaseStatement", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.CaseStatement"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the union type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "default"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.core.Term"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An optional default case, used if none of the explicit cases match")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "cases"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Field"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A list of case alternatives, one per union field")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A union elimination; a case statement")))])}))),+ (Core.Name "hydra.core.EitherType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.EitherType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "left"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The 'left' alternative")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "right"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The 'right' alternative")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type which provides a choice between a 'left' type and a 'right' type")))])}))),+ (Core.Name "hydra.core.Elimination", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Elimination"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "record"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Projection")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Eliminates a record by projecting a given field")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "union"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.CaseStatement")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Eliminates a union term by matching over the fields of the union. This is a case statement.")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "wrap"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Unwrap a wrapped term")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A corresponding elimination for an introduction term")))])}))),+ (Core.Name "hydra.core.Field", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Field"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the field")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "term"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The term value of the field")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A name/term pair")))])}))),+ (Core.Name "hydra.core.FieldType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.FieldType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the field")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of the field")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A name/type pair")))])}))),+ (Core.Name "hydra.core.FloatType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.FloatType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bigfloat"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An arbitrary-precision floating-point type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit floating-point type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit floating-point type")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A floating-point type")))])}))),+ (Core.Name "hydra.core.FloatValue", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bigfloat"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeBigfloat)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An arbitrary-precision floating-point value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit floating-point value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit floating-point value")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A floating-point literal value")))])}))),+ (Core.Name "hydra.core.ForallType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.ForallType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "parameter"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The variable which is bound by the lambda")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The body of the lambda")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A universally quantified type; the System F equivalent of a type scheme, and the type-level equivalent of a lambda term.")))])}))),+ (Core.Name "hydra.core.Function", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Function"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "elimination"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Elimination")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An elimination for any of a few term variants")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lambda"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Lambda")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function abstraction (lambda)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "primitive"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A reference to a built-in (primitive) function")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function")))])}))),+ (Core.Name "hydra.core.FunctionType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.FunctionType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "domain"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The domain (input) type of the function")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "codomain"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The codomain (output) type of the function")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function type, also known as an arrow type")))])}))),+ (Core.Name "hydra.core.Injection", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Injection"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the union type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "field"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Field")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The field being injected, including its name and value")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An instance of a union type; i.e. a string-indexed generalization of inl() or inr()")))])}))),+ (Core.Name "hydra.core.IntegerType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bigint"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An arbitrary-precision integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int8"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An 8-bit signed integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int16"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 16-bit signed integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit signed integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit signed integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint8"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An 8-bit unsigned integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint16"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 16-bit unsigned integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit unsigned integer type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit unsigned integer type")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An integer type")))])}))),+ (Core.Name "hydra.core.IntegerValue", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bigint"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An arbitrary-precision integer value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int8"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An 8-bit signed integer value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int16"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 16-bit signed integer value (short value)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit signed integer value (int value)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit signed integer value (long value)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint8"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint8)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An 8-bit unsigned integer value (byte)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint16"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint16)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 16-bit unsigned integer value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint32"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint32)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 32-bit unsigned integer value (unsigned int)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "uint64"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 64-bit unsigned integer value (unsigned long)")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An integer literal value")))])}))),+ (Core.Name "hydra.core.Lambda", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Lambda"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "parameter"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The parameter of the lambda")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "domain"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.core.Type"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An optional domain type for the lambda")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The body of the lambda")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function abstraction (lambda)")))])}))),+ (Core.Name "hydra.core.Let", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Let"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bindings"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Binding"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The list of variable bindings")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The body term in which the variables are bound")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A set of (possibly recursive) 'let' bindings together with a body in which they are bound")))])}))),+ (Core.Name "hydra.core.Literal", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Literal"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "binary"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeBinary),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A binary literal")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "boolean"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A boolean literal")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.FloatValue")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A floating-point literal")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "integer"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.IntegerValue")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An integer literal")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "string"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeString),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A string literal")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term constant; an instance of a literal type")))])}))),+ (Core.Name "hydra.core.LiteralType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "binary"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of a binary (byte string) value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "boolean"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of a boolean (true/false) value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.FloatType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of a floating-point value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "integer"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.IntegerType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of an integer value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "string"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of a string value")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Any of a fixed set of literal types, also called atomic types, base types, primitive types, or type constants")))])}))),+ (Core.Name "hydra.core.MapType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.MapType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "keys"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of keys in the map")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "values"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type of values in the map")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A map type")))])}))),+ (Core.Name "hydra.core.Name", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A unique identifier in some context; a string-valued key")))])}))),+ (Core.Name "hydra.core.PairType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.PairType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "first"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The first component of the pair")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "second"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The second component of the pair")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type which pairs a 'first' type and a 'second' type")))])}))),+ (Core.Name "hydra.core.Projection", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Projection"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the record type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "field"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the projected field")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A record elimination; a projection")))])}))),+ (Core.Name "hydra.core.Record", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Record"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the record type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "fields"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Field"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The fields of the record, as a list of name/term pairs")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A record, or labeled tuple; a map of field names to terms")))])}))),+ (Core.Name "hydra.core.RowType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.RowType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the row type, which must correspond to the name of a Type element")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "fields"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.FieldType"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The fields of this row type, excluding any inherited fields")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A labeled record or union type")))])}))),+ (Core.Name "hydra.core.Term", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Term"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "annotated"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.AnnotatedTerm")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term annotated with metadata")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "application"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Application")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function application")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "either"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An either value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "function"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Function")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function term")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "let"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Let")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A 'let' term, which binds variables to terms")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "list"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Term"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A list")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "literal"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Literal")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A literal value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "map"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A map of keys to values")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "maybe"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.core.Term"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An optional value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "pair"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A pair (2-tuple)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "record"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Record")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A record term")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "set"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeSet (Core.TypeVariable (Core.Name "hydra.core.Term"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A set of values")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeApplication"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.TypeApplicationTerm")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A System F type application term")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeLambda"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.TypeLambda")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A System F type abstraction term")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "union"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Injection")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An injection; an instance of a union type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "unit"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A unit value; a term with no value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "variable"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A variable reference")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "wrap"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.WrappedTerm")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A wrapped term; an instance of a wrapper type (newtype)")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A data term")))])}))),+ (Core.Name "hydra.core.Type", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.Type"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "annotated"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.AnnotatedType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An annotated type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "application"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.ApplicationType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type application")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "either"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.EitherType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An either (sum) type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "forall"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.ForallType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A universally quantified (polymorphic) type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "function"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.FunctionType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A function type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "list"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A list type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "literal"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.LiteralType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A literal type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "map"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.MapType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A map type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "maybe"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An optional type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "pair"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.PairType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A pair (2-tuple) type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "record"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.RowType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A record type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "set"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A set type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "union"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.RowType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A union type with field names")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "unit"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = Core.TypeUnit,+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The unit type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "variable"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type variable")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "wrap"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.WrappedType")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A wrapped type (newtype)")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A data type")))])}))),+ (Core.Name "hydra.core.TypeApplicationTerm", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.TypeApplicationTerm"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The term being applied to a type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type argument")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term applied to a type; a type application")))])}))),+ (Core.Name "hydra.core.TypeLambda", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.TypeLambda"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "parameter"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type variable introduced by the abstraction")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The body of the abstraction")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A System F type abstraction term")))])}))),+ (Core.Name "hydra.core.TypeScheme", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.TypeScheme"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "variables"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Name"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The free type variables")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type expression")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "constraints"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.TypeVariableMetadata"))}))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Optional metadata for type variables, including typeclass constraints. The map keys are type variable names.")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type expression together with free type variables occurring in the expression")))])}))),+ (Core.Name "hydra.core.TypeVariableMetadata", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.TypeVariableMetadata"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "classes"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeSet (Core.TypeVariable (Core.Name "hydra.core.Name"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The set of typeclass constraints on this type variable")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Metadata associated with a type variable, including typeclass constraints")))])}))),+ (Core.Name "hydra.core.WrappedTerm", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the wrapper type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The wrapped term")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term wrapped in a type name")))])}))),+ (Core.Name "hydra.core.WrappedType", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.core.WrappedType"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeName"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the wrapper (newtype)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The wrapped type")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type wrapped in a type name; a newtype")))])}))),+ (Core.Name "hydra.graph.Graph", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.graph.Graph"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "elements"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Binding"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "All of the elements in the graph")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "environment"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.core.Term")))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The lambda environment of this graph context; it indicates whether a variable is bound by a lambda (Nothing) or a let (Just term)")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "types"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The typing environment of the graph")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "body"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The body of the term which generated this context")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "primitives"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.graph.Primitive"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "All supported primitive constants and functions, by name")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "schema"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.graph.Graph"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The schema of this graph. If this parameter is omitted (nothing), the graph is its own schema graph.")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A graph, or set of name/term bindings together with parameters (annotations, primitives) and a schema graph")))])}))),+ (Core.Name "hydra.graph.Primitive", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.graph.Primitive"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The unique name of the primitive function")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type signature of the primitive function")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "implementation"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Term"))),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.graph.Graph"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.core.Term"))}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A concrete implementation of the primitive function")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A built-in function")))])}))),+ (Core.Name "hydra.graph.TermCoder", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.graph.TermCoder"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The Hydra type of encoded terms")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "coder"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.graph.Graph"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.graph.Graph"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.core.Term"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A coder between Hydra terms and instances of the given type")))])}))}]}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms")))])}))),+ (Core.Name "hydra.module.Definition", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.Definition"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "term"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.module.TermDefinition")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term definition")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.module.TypeDefinition")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type definition")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A definition, which may be either a term or type definition")))])}))),+ (Core.Name "hydra.module.FileExtension", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.module.FileExtension"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A file extension (without the dot), e.g. \"json\" or \"py\"")))])}))),+ (Core.Name "hydra.module.Library", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.Library"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "namespace"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.module.Namespace")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A common prefix for all primitive function names in the library")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "prefix"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeString),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A preferred namespace prefix for function names in the library")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "primitives"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.graph.Primitive"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The primitives defined in this library")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A library of primitive functions")))])}))),+ (Core.Name "hydra.module.Module", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.Module"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "namespace"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.module.Namespace")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A common prefix for all element names in the module")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "elements"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.core.Binding"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The elements defined in this module")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "termDependencies"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.module.Namespace"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Any modules which the term expressions of this module directly depend upon")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "typeDependencies"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.module.Namespace"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "Any modules which the type expressions of this module directly depend upon")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "description"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "An optional human-readable description of the module")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A logical collection of elements in the same namespace, having dependencies on zero or more other modules")))])}))),+ (Core.Name "hydra.module.Namespace", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.module.Namespace"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A prefix for element names")))])}))),+ (Core.Name "hydra.module.Namespaces", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "n"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.Namespaces"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "focus"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "hydra.module.Namespace")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "n"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The namespace in focus, together with its associated value")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "mapping"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.module.Namespace")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "n"))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A mapping of namespaces to values")))])}))}]}))})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A mapping from namespaces to values of type n, with a focus on one namespace")))])}))),+ (Core.Name "hydra.module.QualifiedName", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.QualifiedName"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "namespace"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "hydra.module.Namespace"))),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The optional namespace")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "local"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeString),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The local name")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A qualified name consisting of an optional namespace together with a mandatory local name")))])}))),+ (Core.Name "hydra.module.TermDefinition", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the term")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "term"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The term being defined")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type scheme of the term, including any class constraints")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A term-level definition, including a name, a term, and the type scheme of the term")))])}))),+ (Core.Name "hydra.module.TypeDefinition", (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.Name "hydra.module.TypeDefinition"),+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "name"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The name of the type")))])}))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "type"),+ Core.fieldTypeType = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "The type being defined")))])}))}]})),+ Core.annotatedTypeAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A type-level definition, including a name and the type")))])})))])
+ src/gen-main/haskell/Hydra/Json/Decode.hs view
@@ -0,0 +1,286 @@+-- Note: this is an automatically generated file. Do not edit.++-- | JSON decoding for Hydra terms. Converts JSON Values to Terms using Either for error handling.++module Hydra.Json.Decode where++import qualified Hydra.Core as Core+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Show.Core as Core_+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Decode a JSON value to a Hydra term given a type. Returns Left for type mismatches.+fromJson :: (M.Map Core.Name Core.Type -> Core.Type -> Model.Value -> Either String Core.Term)+fromJson types typ value = + let stripped = (Rewriting.deannotateType typ)+ in ((\x -> case x of+ Core.TypeLiteral v1 -> (decodeLiteral v1 value)+ Core.TypeList v1 -> + let decodeElem = (\v -> fromJson types v1 v)+ in + let arrResult = (expectArray value)+ in (Eithers.either (\err -> Left err) (\arr -> + let decoded = (Eithers.mapList decodeElem arr)+ in (Eithers.map (\ts -> Core.TermList ts) decoded)) arrResult)+ Core.TypeSet v1 -> + let decodeElem = (\v -> fromJson types v1 v)+ in + let arrResult = (expectArray value)+ in (Eithers.either (\err -> Left err) (\arr -> + let decoded = (Eithers.mapList decodeElem arr)+ in (Eithers.map (\elems -> Core.TermSet (Sets.fromList elems)) decoded)) arrResult)+ Core.TypeMaybe v1 -> + let decodeJust = (\arr -> Eithers.map (\v -> Core.TermMaybe (Just v)) (fromJson types v1 (Lists.head arr)))+ in + let decodeMaybeArray = (\arr -> + let len = (Lists.length arr)+ in (Logic.ifElse (Equality.equal len 0) (Right (Core.TermMaybe Nothing)) (Logic.ifElse (Equality.equal len 1) (decodeJust arr) (Left "expected single-element array for Just"))))+ in ((\x -> case x of+ Model.ValueNull -> (Right (Core.TermMaybe Nothing))+ Model.ValueArray v2 -> (decodeMaybeArray v2)+ _ -> (Left "expected null or single-element array for Maybe")) value)+ Core.TypeRecord v1 -> + let objResult = (expectObject value)+ in (Eithers.either (\err -> Left err) (\obj -> + let decodeField = (\ft -> + let fname = (Core.fieldTypeName ft)+ in + let ftype = (Core.fieldTypeType ft)+ in + let mval = (Maps.lookup (Core.unName fname) obj)+ in + let defaultVal = Model.ValueNull+ in + let jsonVal = (Maybes.fromMaybe defaultVal mval)+ in + let decoded = (fromJson types ftype jsonVal)+ in (Eithers.map (\v -> Core.Field {+ Core.fieldName = fname,+ Core.fieldTerm = v}) decoded))+ in + let fields = (Core.rowTypeFields v1)+ in + let decodedFields = (Eithers.mapList decodeField fields)+ in (Eithers.map (\fs -> Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.rowTypeTypeName v1),+ Core.recordFields = fs})) decodedFields)) objResult)+ Core.TypeUnion v1 -> + let decodeVariant = (\key -> \val -> \ftype -> + let jsonVal = (Maybes.fromMaybe Model.ValueNull val)+ in + let decoded = (fromJson types ftype jsonVal)+ in (Eithers.map (\v -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.rowTypeTypeName v1),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name key),+ Core.fieldTerm = v}})) decoded))+ in + let tryField = (\key -> \val -> \ft -> Logic.ifElse (Equality.equal (Core.unName (Core.fieldTypeName ft)) key) (Just (decodeVariant key val (Core.fieldTypeType ft))) Nothing)+ in + let findAndDecode = (\key -> \val -> \fts -> Logic.ifElse (Lists.null fts) (Left (Strings.cat [+ "unknown variant: ",+ key])) (Maybes.maybe (findAndDecode key val (Lists.tail fts)) (\r -> r) (tryField key val (Lists.head fts))))+ in + let decodeSingleKey = (\obj -> findAndDecode (Lists.head (Maps.keys obj)) (Maps.lookup (Lists.head (Maps.keys obj)) obj) (Core.rowTypeFields v1))+ in + let processUnion = (\obj -> Logic.ifElse (Equality.equal (Lists.length (Maps.keys obj)) 1) (decodeSingleKey obj) (Left "expected single-key object for union"))+ in + let objResult = (expectObject value)+ in (Eithers.either (\err -> Left err) (\obj -> processUnion obj) objResult)+ Core.TypeUnit -> + let objResult = (expectObject value)+ in (Eithers.map (\_ -> Core.TermUnit) objResult)+ Core.TypeWrap v1 -> + let extractInnerType = (\lt -> (\x -> case x of+ Core.TypeWrap v2 -> (Core.wrappedTypeBody v2)+ _ -> lt) lt)+ in + let decodeAndWrap = (\lt -> + let innerType = (extractInnerType lt)+ in + let decoded = (fromJson types innerType value)+ in (Eithers.map (\v -> Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTypeTypeName v1),+ Core.wrappedTermBody = v})) decoded))+ in + let lookedUp = (Maps.lookup (Core.wrappedTypeTypeName v1) types)+ in (Maybes.maybe (Left (Strings.cat [+ "unknown wrapped type: ",+ (Core.unName (Core.wrappedTypeTypeName v1))])) (\lt -> decodeAndWrap lt) lookedUp)+ Core.TypeMap v1 -> + let keyType = (Core.mapTypeKeys v1)+ in + let valType = (Core.mapTypeValues v1)+ in + let arrResult = (expectArray value)+ in (Eithers.either (\err -> Left err) (\arr -> + let decodeEntry = (\entryJson -> + let objResult = (expectObject entryJson)+ in (Eithers.either (\err -> Left err) (\entryObj -> + let keyJson = (Maps.lookup "@key" entryObj)+ in + let valJson = (Maps.lookup "@value" entryObj)+ in (Maybes.maybe (Left "missing @key in map entry") (\kj -> Maybes.maybe (Left "missing @value in map entry") (\vj -> + let decodedKey = (fromJson types keyType kj)+ in + let decodedVal = (fromJson types valType vj)+ in (Eithers.either (\err -> Left err) (\k -> Eithers.map (\v -> (k, v)) decodedVal) decodedKey)) valJson) keyJson)) objResult))+ in + let entries = (Eithers.mapList decodeEntry arr)+ in (Eithers.map (\es -> Core.TermMap (Maps.fromList es)) entries)) arrResult)+ Core.TypePair v1 -> + let firstType = (Core.pairTypeFirst v1)+ in + let secondType = (Core.pairTypeSecond v1)+ in + let objResult = (expectObject value)+ in (Eithers.either (\err -> Left err) (\obj -> + let firstJson = (Maps.lookup "@first" obj)+ in + let secondJson = (Maps.lookup "@second" obj)+ in (Maybes.maybe (Left "missing @first in pair") (\fj -> Maybes.maybe (Left "missing @second in pair") (\sj -> + let decodedFirst = (fromJson types firstType fj)+ in + let decodedSecond = (fromJson types secondType sj)+ in (Eithers.either (\err -> Left err) (\f -> Eithers.map (\s -> Core.TermPair (f, s)) decodedSecond) decodedFirst)) secondJson) firstJson)) objResult)+ Core.TypeEither v1 -> + let leftType = (Core.eitherTypeLeft v1)+ in + let rightType = (Core.eitherTypeRight v1)+ in + let objResult = (expectObject value)+ in (Eithers.either (\err -> Left err) (\obj -> + let leftJson = (Maps.lookup "@left" obj)+ in + let rightJson = (Maps.lookup "@right" obj)+ in (Maybes.maybe (Maybes.maybe (Left "expected @left or @right in Either") (\rj -> + let decoded = (fromJson types rightType rj)+ in (Eithers.map (\v -> Core.TermEither (Right v)) decoded)) rightJson) (\lj -> + let decoded = (fromJson types leftType lj)+ in (Eithers.map (\v -> Core.TermEither (Left v)) decoded)) leftJson)) objResult)+ Core.TypeVariable v1 -> + let lookedUp = (Maps.lookup v1 types)+ in (Maybes.maybe (Left (Strings.cat [+ "unknown type variable: ",+ (Core.unName v1)])) (\resolvedType -> fromJson types resolvedType value) lookedUp)+ _ -> (Left (Strings.cat [+ "unsupported type for JSON decoding: ",+ (Core_.type_ typ)]))) stripped)++-- | Decode a JSON value to a literal term+decodeLiteral :: (Core.LiteralType -> Model.Value -> Either String Core.Term)+decodeLiteral lt value = ((\x -> case x of+ Core.LiteralTypeBinary -> + let strResult = (expectString value)+ in (Eithers.map (\s -> Core.TermLiteral (Core.LiteralBinary (Literals.stringToBinary s))) strResult)+ Core.LiteralTypeBoolean -> ((\x -> case x of+ Model.ValueBoolean v2 -> (Right (Core.TermLiteral (Core.LiteralBoolean v2)))+ _ -> (Left "expected boolean")) value)+ Core.LiteralTypeFloat v1 -> (decodeFloat v1 value)+ Core.LiteralTypeInteger v1 -> (decodeInteger v1 value)+ Core.LiteralTypeString -> + let strResult = (expectString value)+ in (Eithers.map (\s -> Core.TermLiteral (Core.LiteralString s)) strResult)) lt)++-- | Decode a JSON value to a float term. Float64/Bigfloat from numbers; Float32 from string.+decodeFloat :: (Core.FloatType -> Model.Value -> Either String Core.Term)+decodeFloat ft value = ((\x -> case x of+ Core.FloatTypeBigfloat -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat n))) numResult)+ Core.FloatTypeFloat32 -> + let strResult = (expectString value)+ in (Eithers.either (\err -> Left err) (\s -> + let parsed = (Literals.readFloat32 s)+ in (Maybes.maybe (Left (Strings.cat [+ "invalid float32: ",+ s])) (\v -> Right (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 v)))) parsed)) strResult)+ Core.FloatTypeFloat64 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (Literals.bigfloatToFloat64 n)))) numResult)) ft)++-- | Decode a JSON value to an integer term. Small ints from numbers; large ints from strings.+decodeInteger :: (Core.IntegerType -> Model.Value -> Either String Core.Term)+decodeInteger it value = ((\x -> case x of+ Core.IntegerTypeBigint -> + let strResult = (expectString value)+ in (Eithers.either (\err -> Left err) (\s -> + let parsed = (Literals.readBigint s)+ in (Maybes.maybe (Left (Strings.cat [+ "invalid bigint: ",+ s])) (\v -> Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint v)))) parsed)) strResult)+ Core.IntegerTypeInt64 -> + let strResult = (expectString value)+ in (Eithers.either (\err -> Left err) (\s -> + let parsed = (Literals.readInt64 s)+ in (Maybes.maybe (Left (Strings.cat [+ "invalid int64: ",+ s])) (\v -> Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 v)))) parsed)) strResult)+ Core.IntegerTypeUint32 -> + let strResult = (expectString value)+ in (Eithers.either (\err -> Left err) (\s -> + let parsed = (Literals.readUint32 s)+ in (Maybes.maybe (Left (Strings.cat [+ "invalid uint32: ",+ s])) (\v -> Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 v)))) parsed)) strResult)+ Core.IntegerTypeUint64 -> + let strResult = (expectString value)+ in (Eithers.either (\err -> Left err) (\s -> + let parsed = (Literals.readUint64 s)+ in (Maybes.maybe (Left (Strings.cat [+ "invalid uint64: ",+ s])) (\v -> Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 v)))) parsed)) strResult)+ Core.IntegerTypeInt8 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (Literals.bigintToInt8 (Literals.bigfloatToBigint n))))) numResult)+ Core.IntegerTypeInt16 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (Literals.bigintToInt16 (Literals.bigfloatToBigint n))))) numResult)+ Core.IntegerTypeInt32 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (Literals.bigintToInt32 (Literals.bigfloatToBigint n))))) numResult)+ Core.IntegerTypeUint8 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 (Literals.bigintToUint8 (Literals.bigfloatToBigint n))))) numResult)+ Core.IntegerTypeUint16 -> + let numResult = (expectNumber value)+ in (Eithers.map (\n -> Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 (Literals.bigintToUint16 (Literals.bigfloatToBigint n))))) numResult)) it)++-- | Extract a string from a JSON value+expectString :: (Model.Value -> Either String String)+expectString value = ((\x -> case x of+ Model.ValueString v1 -> (Right v1)+ _ -> (Left "expected string")) value)++-- | Extract an array from a JSON value+expectArray :: (Model.Value -> Either String [Model.Value])+expectArray value = ((\x -> case x of+ Model.ValueArray v1 -> (Right v1)+ _ -> (Left "expected array")) value)++-- | Extract an object from a JSON value+expectObject :: (Model.Value -> Either String (M.Map String Model.Value))+expectObject value = ((\x -> case x of+ Model.ValueObject v1 -> (Right v1)+ _ -> (Left "expected object")) value)++-- | Extract a number from a JSON value+expectNumber :: (Model.Value -> Either String Double)+expectNumber value = ((\x -> case x of+ Model.ValueNumber v1 -> (Right v1)+ _ -> (Left "expected number")) value)
+ src/gen-main/haskell/Hydra/Json/Encode.hs view
@@ -0,0 +1,132 @@+-- Note: this is an automatically generated file. Do not edit.++-- | JSON encoding for Hydra terms. Converts Terms to JSON Values using Either for error handling.++module Hydra.Json.Encode where++import qualified Hydra.Core as Core+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Show.Core as Core_+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Encode a Hydra term to a JSON value. Returns Left for unsupported constructs.+toJson :: (Core.Term -> Either String Model.Value)+toJson term = + let stripped = (Rewriting.deannotateTerm term)+ in ((\x -> case x of+ Core.TermLiteral v1 -> (encodeLiteral v1)+ Core.TermList v1 -> + let results = (Eithers.mapList (\t -> toJson t) v1)+ in (Eithers.map (\vs -> Model.ValueArray vs) results)+ Core.TermSet v1 -> + let terms = (Sets.toList v1)+ in + let results = (Eithers.mapList (\t -> toJson t) terms)+ in (Eithers.map (\vs -> Model.ValueArray vs) results)+ Core.TermMaybe v1 -> (Maybes.maybe (Right Model.ValueNull) (\v -> + let encodedMaybe = (toJson v)+ in (Eithers.map (\encoded -> Model.ValueArray [+ encoded]) encodedMaybe)) v1)+ Core.TermRecord v1 -> + let encodeField = (\f -> + let fname = (Core.unName (Core.fieldName f))+ in + let fterm = (Core.fieldTerm f)+ in + let encodedField = (toJson fterm)+ in (Eithers.map (\v -> (fname, v)) encodedField))+ in + let fields = (Core.recordFields v1)+ in + let encodedFields = (Eithers.mapList encodeField fields)+ in (Eithers.map (\fs -> Model.ValueObject (Maps.fromList fs)) encodedFields)+ Core.TermUnion v1 -> + let field = (Core.injectionField v1)+ in + let fname = (Core.unName (Core.fieldName field))+ in + let fterm = (Core.fieldTerm field)+ in + let encodedUnion = (toJson fterm)+ in (Eithers.map (\v -> Model.ValueObject (Maps.fromList [+ (fname, v)])) encodedUnion)+ Core.TermUnit -> (Right (Model.ValueObject Maps.empty))+ Core.TermWrap v1 -> (toJson (Core.wrappedTermBody v1))+ Core.TermMap v1 -> + let encodeEntry = (\kv -> + let k = (Pairs.first kv)+ in + let v = (Pairs.second kv)+ in + let encodedK = (toJson k)+ in + let encodedV = (toJson v)+ in (Eithers.either (\err -> Left err) (\ek -> Eithers.map (\ev -> Model.ValueObject (Maps.fromList [+ ("@key", ek),+ ("@value", ev)])) encodedV) encodedK))+ in + let entries = (Eithers.mapList encodeEntry (Maps.toList v1))+ in (Eithers.map (\es -> Model.ValueArray es) entries)+ Core.TermPair v1 -> + let first = (Pairs.first v1)+ in + let second = (Pairs.second v1)+ in + let encodedFirst = (toJson first)+ in + let encodedSecond = (toJson second)+ in (Eithers.either (\err -> Left err) (\ef -> Eithers.map (\es -> Model.ValueObject (Maps.fromList [+ ("@first", ef),+ ("@second", es)])) encodedSecond) encodedFirst)+ Core.TermEither v1 -> (Eithers.either (\l -> + let encodedL = (toJson l)+ in (Eithers.map (\v -> Model.ValueObject (Maps.fromList [+ ("@left", v)])) encodedL)) (\r -> + let encodedR = (toJson r)+ in (Eithers.map (\v -> Model.ValueObject (Maps.fromList [+ ("@right", v)])) encodedR)) v1)+ _ -> (Left (Strings.cat [+ "unsupported term variant for JSON encoding: ",+ (Core_.term term)]))) stripped)++-- | Encode a Hydra literal to a JSON value+encodeLiteral :: (Core.Literal -> Either t0 Model.Value)+encodeLiteral lit = ((\x -> case x of+ Core.LiteralBinary v1 -> (Right (Model.ValueString (Literals.binaryToString v1)))+ Core.LiteralBoolean v1 -> (Right (Model.ValueBoolean v1))+ Core.LiteralFloat v1 -> (encodeFloat v1)+ Core.LiteralInteger v1 -> (encodeInteger v1)+ Core.LiteralString v1 -> (Right (Model.ValueString v1))) lit)++-- | Encode a float value to JSON. Float64/Bigfloat use native numbers; Float32 uses string.+encodeFloat :: (Core.FloatValue -> Either t0 Model.Value)+encodeFloat fv = ((\x -> case x of+ Core.FloatValueBigfloat v1 -> (Right (Model.ValueNumber v1))+ Core.FloatValueFloat32 v1 -> (Right (Model.ValueString (Literals.showFloat32 v1)))+ Core.FloatValueFloat64 v1 -> (Right (Model.ValueNumber (Literals.float64ToBigfloat v1)))) fv)++-- | Encode an integer value to JSON. Small ints use native numbers; large ints use strings.+encodeInteger :: (Core.IntegerValue -> Either t0 Model.Value)+encodeInteger iv = ((\x -> case x of+ Core.IntegerValueBigint v1 -> (Right (Model.ValueString (Literals.showBigint v1)))+ Core.IntegerValueInt64 v1 -> (Right (Model.ValueString (Literals.showInt64 v1)))+ Core.IntegerValueUint32 v1 -> (Right (Model.ValueString (Literals.showUint32 v1)))+ Core.IntegerValueUint64 v1 -> (Right (Model.ValueString (Literals.showUint64 v1)))+ Core.IntegerValueInt8 v1 -> (Right (Model.ValueNumber (Literals.bigintToBigfloat (Literals.int8ToBigint v1))))+ Core.IntegerValueInt16 v1 -> (Right (Model.ValueNumber (Literals.bigintToBigfloat (Literals.int16ToBigint v1))))+ Core.IntegerValueInt32 v1 -> (Right (Model.ValueNumber (Literals.bigintToBigfloat (Literals.int32ToBigint v1))))+ Core.IntegerValueUint8 v1 -> (Right (Model.ValueNumber (Literals.bigintToBigfloat (Literals.uint8ToBigint v1))))+ Core.IntegerValueUint16 v1 -> (Right (Model.ValueNumber (Literals.bigintToBigfloat (Literals.uint16ToBigint v1))))) iv)
+ src/gen-main/haskell/Hydra/Json/Model.hs view
@@ -0,0 +1,43 @@+-- Note: this is an automatically generated file. Do not edit.++-- | A JSON syntax model. See the BNF at https://www.json.org++module Hydra.Json.Model where++import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | A JSON value+data Value = + -- | A JSON array+ ValueArray [Value] |+ -- | A boolean value+ ValueBoolean Bool |+ -- | JSON's null value+ ValueNull |+ -- | A numeric value+ ValueNumber Double |+ -- | A JSON object as a set of key/value pairs+ ValueObject (M.Map String Value) |+ -- | A string value+ ValueString String+ deriving (Eq, Ord, Read, Show)++_Value = (Core.Name "hydra.json.model.Value")++_Value_array = (Core.Name "array")++_Value_boolean = (Core.Name "boolean")++_Value_null = (Core.Name "null")++_Value_number = (Core.Name "number")++_Value_object = (Core.Name "object")++_Value_string = (Core.Name "string")
+ src/gen-main/haskell/Hydra/Json/Parser.hs view
@@ -0,0 +1,114 @@+-- Note: this is an automatically generated file. Do not edit.++-- | JSON parser using Hydra parser combinators++module Hydra.Json.Parser where++import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Parsers as Parsers+import qualified Hydra.Parsing as Parsing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Parse zero or more JSON whitespace characters (space, tab, newline, carriage return)+whitespace :: (Parsing.Parser ())+whitespace = (Parsers.map (\_ -> ()) (Parsers.many (Parsers.satisfy (\c -> Lists.foldl Logic.or False [+ Equality.equal c 32,+ (Equality.equal c 9),+ (Equality.equal c 10),+ (Equality.equal c 13)]))))++-- | Parse a token followed by optional whitespace+token :: (Parsing.Parser t0 -> Parsing.Parser t0)+token p = (Parsers.bind p (\x -> Parsers.bind whitespace (\_ -> Parsers.pure x)))++-- | Parse JSON null value+jsonNull :: (Parsing.Parser Model.Value)+jsonNull = (Parsers.map (\_ -> Model.ValueNull) (token (Parsers.string "null")))++-- | Parse JSON boolean (true or false)+jsonBool :: (Parsing.Parser Model.Value)+jsonBool = (Parsers.alt (Parsers.map (\_ -> Model.ValueBoolean True) (token (Parsers.string "true"))) (Parsers.map (\_ -> Model.ValueBoolean False) (token (Parsers.string "false"))))++-- | Parse a single digit (0-9)+digit :: (Parsing.Parser Int)+digit = (Parsers.satisfy (\c -> Logic.and (Equality.gte c 48) (Equality.lte c 57)))++-- | Parse one or more digits as a string+digits :: (Parsing.Parser String)+digits = (Parsers.map Strings.fromList (Parsers.some digit))++-- | Parse the integer part of a JSON number (optional minus, then digits)+jsonIntegerPart :: (Parsing.Parser String)+jsonIntegerPart = (Parsers.bind (Parsers.optional (Parsers.char 45)) (\sign -> Parsers.bind digits (\digits -> Parsers.pure (Maybes.maybe digits (\_ -> Strings.cat2 "-" digits) sign))))++-- | Parse the optional fractional part of a JSON number+jsonFractionPart :: (Parsing.Parser (Maybe String))+jsonFractionPart = (Parsers.optional (Parsers.bind (Parsers.char 46) (\_ -> Parsers.map (\d -> Strings.cat2 "." d) digits)))++-- | Parse the optional exponent part of a JSON number+jsonExponentPart :: (Parsing.Parser (Maybe String))+jsonExponentPart = (Parsers.optional (Parsers.bind (Parsers.satisfy (\c -> Logic.or (Equality.equal c 101) (Equality.equal c 69))) (\_ -> Parsers.bind (Parsers.optional (Parsers.satisfy (\c -> Logic.or (Equality.equal c 43) (Equality.equal c 45)))) (\sign -> Parsers.map (\digits -> Strings.cat2 (Strings.cat2 "e" (Maybes.maybe "" (\arg_ -> Strings.fromList (Lists.pure arg_)) sign)) digits) digits))))++-- | Parse a JSON number (integer, decimal, or scientific notation)+jsonNumber :: (Parsing.Parser Model.Value)+jsonNumber = (token (Parsers.bind jsonIntegerPart (\intPart -> Parsers.bind jsonFractionPart (\fracPart -> Parsers.bind jsonExponentPart (\expPart -> + let numStr = (Strings.cat2 (Strings.cat2 intPart (Maybes.maybe "" Equality.identity fracPart)) (Maybes.maybe "" Equality.identity expPart))+ in (Parsers.pure (Model.ValueNumber (Maybes.maybe 0.0 Equality.identity (Literals.readBigfloat numStr)))))))))++-- | Parse a JSON escape sequence after the backslash+jsonEscapeChar :: (Parsing.Parser Int)+jsonEscapeChar = (Parsers.choice [+ Parsers.map (\_ -> 34) (Parsers.char 34),+ (Parsers.map (\_ -> 92) (Parsers.char 92)),+ (Parsers.map (\_ -> 47) (Parsers.char 47)),+ (Parsers.map (\_ -> 8) (Parsers.char 98)),+ (Parsers.map (\_ -> 12) (Parsers.char 102)),+ (Parsers.map (\_ -> 10) (Parsers.char 110)),+ (Parsers.map (\_ -> 13) (Parsers.char 114)),+ (Parsers.map (\_ -> 9) (Parsers.char 116))])++-- | Parse a single character in a JSON string (handling escapes)+jsonStringChar :: (Parsing.Parser Int)+jsonStringChar = (Parsers.alt (Parsers.bind (Parsers.char 92) (\_ -> jsonEscapeChar)) (Parsers.satisfy (\c -> Logic.and (Logic.not (Equality.equal c 34)) (Logic.not (Equality.equal c 92)))))++-- | Parse a JSON string value+jsonString :: (Parsing.Parser Model.Value)+jsonString = (token (Parsers.bind (Parsers.char 34) (\_ -> Parsers.bind (Parsers.many jsonStringChar) (\chars -> Parsers.bind (Parsers.char 34) (\_ -> Parsers.pure (Model.ValueString (Strings.fromList chars)))))))++-- | Parse a JSON array+jsonArray :: (Parsing.Parser Model.Value)+jsonArray = (Parsers.map (\x -> Model.ValueArray x) (Parsers.between (token (Parsers.char 91)) (token (Parsers.char 93)) (Parsers.sepBy (Parsers.lazy (\_ -> jsonValue)) (token (Parsers.char 44)))))++-- | Parse a JSON object key-value pair+jsonKeyValue :: (Parsing.Parser (String, Model.Value))+jsonKeyValue = (Parsers.bind (token (Parsers.bind (Parsers.char 34) (\_ -> Parsers.bind (Parsers.many jsonStringChar) (\chars -> Parsers.bind (Parsers.char 34) (\_ -> Parsers.pure (Strings.fromList chars)))))) (\key -> Parsers.bind (token (Parsers.char 58)) (\_ -> Parsers.map (\v -> (key, v)) (Parsers.lazy (\_ -> jsonValue)))))++-- | Parse a JSON object+jsonObject :: (Parsing.Parser Model.Value)+jsonObject = (Parsers.map (\arg_ -> (\x -> Model.ValueObject x) (Maps.fromList arg_)) (Parsers.between (token (Parsers.char 123)) (token (Parsers.char 125)) (Parsers.sepBy jsonKeyValue (token (Parsers.char 44)))))++-- | Parse any JSON value+jsonValue :: (Parsing.Parser Model.Value)+jsonValue = (Parsers.choice [+ jsonNull,+ jsonBool,+ jsonNumber,+ jsonString,+ jsonArray,+ jsonObject])++-- | Parse a JSON document from a string+parseJson :: (String -> Parsing.ParseResult Model.Value)+parseJson input = (Parsing.unParser (Parsers.bind whitespace (\_ -> Parsers.bind jsonValue (\v -> Parsers.bind whitespace (\_ -> Parsers.bind Parsers.eof (\_ -> Parsers.pure v))))) input)
+ src/gen-main/haskell/Hydra/Json/Writer.hs view
@@ -0,0 +1,71 @@+-- Note: this is an automatically generated file. Do not edit.++-- | JSON serialization functions using the Hydra AST++module Hydra.Json.Writer where++import qualified Hydra.Ast as Ast+import qualified Hydra.Json.Model as Model+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Serialization as Serialization+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | The colon operator used to separate keys and values in JSON objects+colonOp :: Ast.Op+colonOp = Ast.Op {+ Ast.opSymbol = (Ast.Symbol ":"),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsNone,+ Ast.paddingRight = Ast.WsSpace},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}++-- | Escape and quote a string for JSON output+jsonString :: (String -> String)+jsonString s = + let hexEscape = (\c -> + let hi = (Strings.fromList (Lists.pure (Strings.charAt (Math.div c 16) "0123456789abcdef")))+ in + let lo = (Strings.fromList (Lists.pure (Strings.charAt (Math.mod c 16) "0123456789abcdef")))+ in (Strings.cat2 (Strings.cat2 "\\u00" hi) lo))+ in + let escape = (\c -> Logic.ifElse (Equality.equal c 34) "\\\"" (Logic.ifElse (Equality.equal c 92) "\\\\" (Logic.ifElse (Equality.equal c 8) "\\b" (Logic.ifElse (Equality.equal c 12) "\\f" (Logic.ifElse (Equality.equal c 10) "\\n" (Logic.ifElse (Equality.equal c 13) "\\r" (Logic.ifElse (Equality.equal c 9) "\\t" (Logic.ifElse (Equality.lt c 32) (hexEscape c) (Strings.fromList (Lists.pure c))))))))))+ in + let escaped = (Strings.cat (Lists.map escape (Strings.toList s)))+ in (Strings.cat2 (Strings.cat2 "\"" escaped) "\"")++-- | Convert a key-value pair to an AST expression+keyValueToExpr :: ((String, Model.Value) -> Ast.Expr)+keyValueToExpr pair = + let key = (Pairs.first pair)+ in + let value = (Pairs.second pair)+ in (Serialization.ifx colonOp (Serialization.cst (jsonString key)) (valueToExpr value))++-- | Serialize a JSON value to a string+printJson :: (Model.Value -> String)+printJson value = (Serialization.printExpr (valueToExpr value))++-- | Convert a JSON value to an AST expression for serialization+valueToExpr :: (Model.Value -> Ast.Expr)+valueToExpr value = ((\x -> case x of+ Model.ValueArray v1 -> (Serialization.bracketListAdaptive (Lists.map valueToExpr v1))+ Model.ValueBoolean v1 -> (Serialization.cst (Logic.ifElse v1 "true" "false"))+ Model.ValueNull -> (Serialization.cst "null")+ Model.ValueNumber v1 -> + let rounded = (Literals.bigfloatToBigint v1)+ in (Serialization.cst (Logic.ifElse (Equality.equal v1 (Literals.bigintToBigfloat rounded)) (Literals.showBigint rounded) (Literals.showBigfloat v1)))+ Model.ValueObject v1 -> (Serialization.bracesListAdaptive (Lists.map keyValueToExpr (Maps.toList v1)))+ Model.ValueString v1 -> (Serialization.cst (jsonString v1))) value)
src/gen-main/haskell/Hydra/Languages.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Language constraints for Hydra Core module Hydra.Languages where@@ -5,8 +7,9 @@ import qualified Hydra.Coders as Coders import qualified Hydra.Core as Core import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Reflect as Reflect+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -26,12 +29,12 @@ Coders.languageConstraintsTypeVariants = typeVariants, Coders.languageConstraintsTypes = types}} where - eliminationVariants = (Sets.fromList Variants.eliminationVariants)- literalVariants = (Sets.fromList Variants.literalVariants)- floatTypes = (Sets.fromList Variants.floatTypes)- functionVariants = (Sets.fromList Variants.functionVariants)- integerTypes = (Sets.fromList Variants.integerTypes)- termVariants = (Sets.fromList Variants.termVariants)- typeVariants = (Sets.fromList Variants.typeVariants)+ eliminationVariants = (Sets.fromList Reflect.eliminationVariants)+ literalVariants = (Sets.fromList Reflect.literalVariants)+ floatTypes = (Sets.fromList Reflect.floatTypes)+ functionVariants = (Sets.fromList Reflect.functionVariants)+ integerTypes = (Sets.fromList Reflect.integerTypes)+ termVariants = (Sets.fromList Reflect.termVariants)+ typeVariants = (Sets.fromList Reflect.typeVariants) types = (\t -> (\x -> case x of _ -> True) t)
src/gen-main/haskell/Hydra/Lexical.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A module for lexical operations over graphs. module Hydra.Lexical where@@ -5,65 +7,94 @@ import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Monads as Monads import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core_-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +chooseUniqueName :: (S.Set Core.Name -> Core.Name -> Core.Name)+chooseUniqueName reserved name = + let tryName = (\index -> + let candidate = (Logic.ifElse (Equality.equal index 1) name (Core.Name (Strings.cat2 (Core.unName name) (Literals.showInt32 index))))+ in (Logic.ifElse (Sets.member candidate reserved) (tryName (Math.add index 1)) candidate))+ in (tryName 1)++-- | Look up an element in the current graph context dereferenceElement :: (Core.Name -> Compute.Flow Graph.Graph (Maybe Core.Binding)) dereferenceElement name = (Flows.map (\g -> lookupElement g name) Monads.getState) +-- | Resolve a schema type through a chain of zero or more typedefs+dereferenceSchemaType :: (Core.Name -> M.Map Core.Name Core.TypeScheme -> Maybe Core.TypeScheme)+dereferenceSchemaType name types = + let forType = (\t -> (\x -> case x of+ Core.TypeAnnotated v1 -> (forType (Core.annotatedTypeBody v1))+ Core.TypeForall v1 -> (Maybes.map (\ts -> Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.cons (Core.forallTypeParameter v1) (Core.typeSchemeVariables ts)),+ Core.typeSchemeType = (Core.typeSchemeType ts),+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts)}) (forType (Core.forallTypeBody v1)))+ Core.TypeVariable v1 -> (dereferenceSchemaType v1 types)+ _ -> (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = t,+ Core.typeSchemeConstraints = Nothing}))) t)+ in (Maybes.bind (Maps.lookup name types) (\ts -> Maybes.map (\ts2 -> Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.concat2 (Core.typeSchemeVariables ts) (Core.typeSchemeVariables ts2)),+ Core.typeSchemeType = (Core.typeSchemeType ts2),+ Core.typeSchemeConstraints = (Core.typeSchemeConstraints ts2)}) (forType (Core.typeSchemeType ts))))++-- | Look up an element by name in a graph, returning Either an error or the binding+dereferenceVariable :: (Graph.Graph -> Core.Name -> Either String Core.Binding)+dereferenceVariable g name = (Maybes.maybe (Left (Strings.cat2 "no such element: " (Core.unName name))) (\right_ -> Right right_) (lookupElement g name))++-- | Create a graph from a parent graph, optional schema, and list of element bindings elementsToGraph :: (Graph.Graph -> Maybe Graph.Graph -> [Core.Binding] -> Graph.Graph)-elementsToGraph parent schema elements = - let toPair = (\el -> (Core.bindingName el, el))- in Graph.Graph {- Graph.graphElements = (Maps.fromList (Lists.map toPair elements)),- Graph.graphEnvironment = (Graph.graphEnvironment parent),- Graph.graphTypes = (Graph.graphTypes parent),- Graph.graphBody = (Graph.graphBody parent),- Graph.graphPrimitives = (Graph.graphPrimitives parent),- Graph.graphSchema = schema}+elementsToGraph parent schema elements = Graph.Graph {+ Graph.graphElements = elements,+ Graph.graphEnvironment = (Graph.graphEnvironment parent),+ Graph.graphTypes = (Graph.graphTypes parent),+ Graph.graphBody = (Graph.graphBody parent),+ Graph.graphPrimitives = (Graph.graphPrimitives parent),+ Graph.graphSchema = schema} -- | An empty graph; no elements, no primitives, no schema, and an arbitrary body. emptyGraph :: Graph.Graph emptyGraph = Graph.Graph {- Graph.graphElements = Maps.empty,+ Graph.graphElements = [], Graph.graphEnvironment = Maps.empty, Graph.graphTypes = Maps.empty, Graph.graphBody = (Core.TermLiteral (Core.LiteralString "empty graph")), Graph.graphPrimitives = Maps.empty, Graph.graphSchema = Nothing} +-- | Add bindings to an existing graph extendGraphWithBindings :: ([Core.Binding] -> Graph.Graph -> Graph.Graph)-extendGraphWithBindings bindings g = - let newEls = (Maps.fromList (Lists.map toEl bindings)) - toEl = (\binding -> - let name = (Core.bindingName binding) - term = (Core.bindingTerm binding)- mts = (Core.bindingType binding)- in (name, Core.Binding {- Core.bindingName = name,- Core.bindingTerm = term,- Core.bindingType = mts}))- in Graph.Graph {- Graph.graphElements = (Maps.union newEls (Graph.graphElements g)),- Graph.graphEnvironment = (Graph.graphEnvironment g),- Graph.graphTypes = (Graph.graphTypes g),- Graph.graphBody = (Graph.graphBody g),- Graph.graphPrimitives = (Graph.graphPrimitives g),- Graph.graphSchema = (Graph.graphSchema g)}+extendGraphWithBindings bindings g = Graph.Graph {+ Graph.graphElements = (Lists.concat2 bindings (Graph.graphElements g)),+ Graph.graphEnvironment = (Graph.graphEnvironment g),+ Graph.graphTypes = (Graph.graphTypes g),+ Graph.graphBody = (Graph.graphBody g),+ Graph.graphPrimitives = (Graph.graphPrimitives g),+ Graph.graphSchema = (Graph.graphSchema g)} +-- | Extract the fields of a record or union type fieldsOf :: (Core.Type -> [Core.FieldType]) fieldsOf t = let stripped = (Rewriting.deannotateType t)@@ -74,20 +105,16 @@ _ -> []) stripped) getField :: (M.Map Core.Name t0 -> Core.Name -> (t0 -> Compute.Flow t1 t2) -> Compute.Flow t1 t2)-getField m fname decode = (Optionals.maybe (Flows.fail (Strings.cat [- Strings.cat [- "expected field ",- (Core.unName fname)],- " not found"])) decode (Maps.lookup fname m))+getField m fname decode = (Maybes.maybe (Flows.fail (Strings.cat2 (Strings.cat2 "expected field " (Core.unName fname)) " not found")) decode (Maps.lookup fname m)) lookupElement :: (Graph.Graph -> Core.Name -> Maybe Core.Binding)-lookupElement g name = (Maps.lookup name (Graph.graphElements g))+lookupElement g name = (Lists.find (\b -> Equality.equal (Core.bindingName b) name) (Graph.graphElements g)) lookupPrimitive :: (Graph.Graph -> Core.Name -> Maybe Graph.Primitive) lookupPrimitive g name = (Maps.lookup name (Graph.graphPrimitives g)) matchEnum :: (Core.Name -> [(Core.Name, t0)] -> Core.Term -> Compute.Flow Graph.Graph t0)-matchEnum tname pairs = (matchUnion tname (Lists.map (\pair -> matchUnitField (fst pair) (snd pair)) pairs))+matchEnum tname pairs = (matchUnion tname (Lists.map (\pair -> matchUnitField (Pairs.first pair) (Pairs.second pair)) pairs)) matchRecord :: ((M.Map Core.Name Core.Term -> Compute.Flow t0 t1) -> Core.Term -> Compute.Flow t0 t1) matchRecord decode term = @@ -98,56 +125,48 @@ matchUnion :: (Core.Name -> [(Core.Name, (Core.Term -> Compute.Flow Graph.Graph t0))] -> Core.Term -> Compute.Flow Graph.Graph t0) matchUnion tname pairs term = - let stripped = (Rewriting.deannotateAndDetypeTerm term) - mapping = (Maps.fromList pairs)- in ((\x -> case x of- Core.TermVariable v1 -> (Flows.bind (requireElement v1) (\el -> matchUnion tname pairs (Core.bindingTerm el)))- Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.unName (Core.injectionTypeName v1)) (Core.unName tname)) ( - let fname = (Core.fieldName (Core.injectionField v1)) - val = (Core.fieldTerm (Core.injectionField v1))- in (Optionals.maybe (Flows.fail (Strings.cat [- Strings.cat [- Strings.cat [- "no matching case for field ",- (Core.unName fname)],- " in union type "],- (Core.unName tname)])) (\f -> f val) (Maps.lookup fname mapping))) (Monads.unexpected (Strings.cat [- "injection for type ",- (Core.unName tname)]) (Core_.term term)))- _ -> (Monads.unexpected (Strings.cat [- Strings.cat [- "union with one of {",- (Strings.intercalate ", " (Lists.map (\pair -> Core.unName (fst pair)) pairs))],- "}"]) (Core_.term stripped))) stripped)+ let stripped = (Rewriting.deannotateAndDetypeTerm term)+ in + let mapping = (Maps.fromList pairs)+ in ((\x -> case x of+ Core.TermVariable v1 -> (Flows.bind (requireElement v1) (\el -> matchUnion tname pairs (Core.bindingTerm el)))+ Core.TermUnion v1 -> + let exp = + let fname = (Core.fieldName (Core.injectionField v1))+ in + let val = (Core.fieldTerm (Core.injectionField v1))+ in (Maybes.maybe (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 "no matching case for field \"" (Core.unName fname)) "\" in union type ") (Core.unName tname))) (\f -> f val) (Maps.lookup fname mapping))+ in (Logic.ifElse (Equality.equal (Core.unName (Core.injectionTypeName v1)) (Core.unName tname)) exp (Monads.unexpected (Strings.cat2 "injection for type " (Core.unName tname)) (Core_.term term)))+ _ -> (Monads.unexpected (Strings.cat [+ "inject(",+ (Core.unName tname),+ ") with one of {",+ (Strings.intercalate ", " (Lists.map (\pair -> Core.unName (Pairs.first pair)) pairs)),+ "}"]) (Core_.term stripped))) stripped) matchUnitField :: (t0 -> t1 -> (t0, (t2 -> Compute.Flow t3 t1))) matchUnitField fname x = (fname, (\ignored -> Flows.pure x)) requireElement :: (Core.Name -> Compute.Flow Graph.Graph Core.Binding) requireElement name = - let showAll = False - ellipsis = (\strings -> Logic.ifElse (Logic.and (Equality.gt (Lists.length strings) 3) (Logic.not showAll)) (Lists.concat2 (Lists.take 3 strings) [- "..."]) strings)- err = (\g -> Flows.fail (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- "no such element: ",- (Core.unName name)],- ". Available elements: {"],- (Strings.intercalate ", " (ellipsis (Lists.map (\el -> Core.unName (Core.bindingName el)) (Maps.elems (Graph.graphElements g)))))],- "}"]))- in (Flows.bind (dereferenceElement name) (\mel -> Optionals.maybe (Flows.bind Monads.getState err) Flows.pure mel))+ let showAll = False+ in + let ellipsis = (\strings -> Logic.ifElse (Logic.and (Equality.gt (Lists.length strings) 3) (Logic.not showAll)) (Lists.concat2 (Lists.take 3 strings) [+ "..."]) strings)+ in + let err = (\g -> Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "no such element: " (Core.unName name)) ". Available elements: {") (Strings.intercalate ", " (ellipsis (Lists.map (\el -> Core.unName (Core.bindingName el)) (Graph.graphElements g))))) "}"))+ in (Flows.bind (dereferenceElement name) (\mel -> Maybes.maybe (Flows.bind Monads.getState (\g -> err g)) Flows.pure mel)) requirePrimitive :: (Core.Name -> Compute.Flow Graph.Graph Graph.Primitive)-requirePrimitive name = (Flows.bind Monads.getState (\g -> Optionals.maybe (Flows.fail (Strings.cat [- "no such primitive function: ",- (Core.unName name)])) Flows.pure (lookupPrimitive g name)))+requirePrimitive name = (Flows.bind Monads.getState (\g -> Maybes.maybe (Flows.fail (Strings.cat2 "no such primitive function: " (Core.unName name))) Flows.pure (lookupPrimitive g name))) +requirePrimitiveType :: (Typing.TypeContext -> Core.Name -> Compute.Flow t0 Core.TypeScheme)+requirePrimitiveType tx name = + let mts = (Maps.lookup name (Typing.inferenceContextPrimitiveTypes (Typing.typeContextInferenceContext tx)))+ in (Maybes.maybe (Flows.fail (Strings.cat2 "no such primitive function: " (Core.unName name))) (\ts -> Flows.pure ts) mts)+ requireTerm :: (Core.Name -> Compute.Flow Graph.Graph Core.Term)-requireTerm name = (Flows.bind (resolveTerm name) (\mt -> Optionals.maybe (Flows.fail (Strings.cat [- "no such element: ",- (Core.unName name)])) Flows.pure mt))+requireTerm name = (Flows.bind (resolveTerm name) (\mt -> Maybes.maybe (Flows.fail (Strings.cat2 "no such element: " (Core.unName name))) Flows.pure mt)) -- | TODO: distinguish between lambda-bound and let-bound variables resolveTerm :: (Core.Name -> Compute.Flow Graph.Graph (Maybe Core.Term))@@ -157,11 +176,11 @@ in ((\x -> case x of Core.TermVariable v1 -> (resolveTerm v1) _ -> (Flows.pure (Just (Core.bindingTerm el)))) stripped))- in (Flows.bind Monads.getState (\g -> Optionals.maybe (Flows.pure Nothing) recurse (Maps.lookup name (Graph.graphElements g))))+ in (Flows.bind Monads.getState (\g -> Maybes.maybe (Flows.pure Nothing) recurse (Lists.find (\b -> Equality.equal (Core.bindingName b) name) (Graph.graphElements g)))) -- | Note: assuming for now that primitive functions are the same in the schema graph schemaContext :: (Graph.Graph -> Graph.Graph)-schemaContext g = (Optionals.fromMaybe g (Graph.graphSchema g))+schemaContext g = (Maybes.fromMaybe g (Graph.graphSchema g)) stripAndDereferenceTerm :: (Core.Term -> Compute.Flow Graph.Graph Core.Term) stripAndDereferenceTerm term = @@ -170,9 +189,15 @@ Core.TermVariable v1 -> (Flows.bind (requireTerm v1) (\t -> stripAndDereferenceTerm t)) _ -> (Flows.pure stripped)) stripped) -typeOfPrimitive :: (Core.Name -> Compute.Flow Graph.Graph Core.TypeScheme)-typeOfPrimitive name = (Flows.map Graph.primitiveType (requirePrimitive name))+-- | Strip annotations and dereference variables, returning Either an error or the resolved term+stripAndDereferenceTermEither :: (Graph.Graph -> Core.Term -> Either String Core.Term)+stripAndDereferenceTermEither g term = + let stripped = (Rewriting.deannotateAndDetypeTerm term)+ in ((\x -> case x of+ Core.TermVariable v1 -> (Eithers.either (\left_ -> Left left_) (\binding -> stripAndDereferenceTermEither g (Core.bindingTerm binding)) (dereferenceVariable g v1))+ _ -> (Right stripped)) stripped) +-- | Execute flow with empty graph withEmptyGraph :: (Compute.Flow Graph.Graph t0 -> Compute.Flow t1 t0) withEmptyGraph = (Monads.withState emptyGraph)
src/gen-main/haskell/Hydra/Literals.hs view
@@ -1,10 +1,13 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Conversion functions for literal values. module Hydra.Literals where import qualified Hydra.Core as Core import qualified Hydra.Lib.Literals as Literals-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M
− src/gen-main/haskell/Hydra/Mantle.hs
@@ -1,246 +0,0 @@--- | A set of types which supplement hydra.core, but are not referenced by hydra.core.--module Hydra.Mantle where--import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S--data CaseConvention = - CaseConventionCamel |- CaseConventionPascal |- CaseConventionLowerSnake |- CaseConventionUpperSnake - deriving (Eq, Ord, Read, Show)--_CaseConvention = (Core.Name "hydra.mantle.CaseConvention")--_CaseConvention_camel = (Core.Name "camel")--_CaseConvention_pascal = (Core.Name "pascal")--_CaseConvention_lowerSnake = (Core.Name "lowerSnake")--_CaseConvention_upperSnake = (Core.Name "upperSnake")---- | An equality judgement: less than, equal to, or greater than-data Comparison = - ComparisonLessThan |- ComparisonEqualTo |- ComparisonGreaterThan - deriving (Eq, Ord, Read, Show)--_Comparison = (Core.Name "hydra.mantle.Comparison")--_Comparison_lessThan = (Core.Name "lessThan")--_Comparison_equalTo = (Core.Name "equalTo")--_Comparison_greaterThan = (Core.Name "greaterThan")---- | A disjoint union between a 'left' type and a 'right' type-data Either a b = - EitherLeft a |- EitherRight b- deriving (Eq, Ord, Read, Show)--_Either = (Core.Name "hydra.mantle.Either")--_Either_left = (Core.Name "left")--_Either_right = (Core.Name "right")---- | The identifier of an elimination constructor-data EliminationVariant = - EliminationVariantProduct |- EliminationVariantRecord |- EliminationVariantUnion |- EliminationVariantWrap - deriving (Eq, Ord, Read, Show)--_EliminationVariant = (Core.Name "hydra.mantle.EliminationVariant")--_EliminationVariant_product = (Core.Name "product")--_EliminationVariant_record = (Core.Name "record")--_EliminationVariant_union = (Core.Name "union")--_EliminationVariant_wrap = (Core.Name "wrap")---- | The identifier of a function constructor-data FunctionVariant = - FunctionVariantElimination |- FunctionVariantLambda |- FunctionVariantPrimitive - deriving (Eq, Ord, Read, Show)--_FunctionVariant = (Core.Name "hydra.mantle.FunctionVariant")--_FunctionVariant_elimination = (Core.Name "elimination")--_FunctionVariant_lambda = (Core.Name "lambda")--_FunctionVariant_primitive = (Core.Name "primitive")---- | The identifier of a literal constructor-data LiteralVariant = - LiteralVariantBinary |- LiteralVariantBoolean |- LiteralVariantFloat |- LiteralVariantInteger |- LiteralVariantString - deriving (Eq, Ord, Read, Show)--_LiteralVariant = (Core.Name "hydra.mantle.LiteralVariant")--_LiteralVariant_binary = (Core.Name "binary")--_LiteralVariant_boolean = (Core.Name "boolean")--_LiteralVariant_float = (Core.Name "float")--_LiteralVariant_integer = (Core.Name "integer")--_LiteralVariant_string = (Core.Name "string")---- | Numeric precision: arbitrary precision, or precision to a specified number of bits-data Precision = - PrecisionArbitrary |- PrecisionBits Int- deriving (Eq, Ord, Read, Show)--_Precision = (Core.Name "hydra.mantle.Precision")--_Precision_arbitrary = (Core.Name "arbitrary")--_Precision_bits = (Core.Name "bits")---- | The identifier of a term expression constructor-data TermVariant = - TermVariantAnnotated |- TermVariantApplication |- TermVariantFunction |- TermVariantLet |- TermVariantList |- TermVariantLiteral |- TermVariantMap |- TermVariantOptional |- TermVariantProduct |- TermVariantRecord |- TermVariantSet |- TermVariantSum |- TermVariantTypeApplication |- TermVariantTypeLambda |- TermVariantUnion |- TermVariantUnit |- TermVariantVariable |- TermVariantWrap - deriving (Eq, Ord, Read, Show)--_TermVariant = (Core.Name "hydra.mantle.TermVariant")--_TermVariant_annotated = (Core.Name "annotated")--_TermVariant_application = (Core.Name "application")--_TermVariant_function = (Core.Name "function")--_TermVariant_let = (Core.Name "let")--_TermVariant_list = (Core.Name "list")--_TermVariant_literal = (Core.Name "literal")--_TermVariant_map = (Core.Name "map")--_TermVariant_optional = (Core.Name "optional")--_TermVariant_product = (Core.Name "product")--_TermVariant_record = (Core.Name "record")--_TermVariant_set = (Core.Name "set")--_TermVariant_sum = (Core.Name "sum")--_TermVariant_typeApplication = (Core.Name "typeApplication")--_TermVariant_typeLambda = (Core.Name "typeLambda")--_TermVariant_union = (Core.Name "union")--_TermVariant_unit = (Core.Name "unit")--_TermVariant_variable = (Core.Name "variable")--_TermVariant_wrap = (Core.Name "wrap")---- | Any of a small number of built-in type classes-data TypeClass = - TypeClassEquality |- TypeClassOrdering - deriving (Eq, Ord, Read, Show)--_TypeClass = (Core.Name "hydra.mantle.TypeClass")--_TypeClass_equality = (Core.Name "equality")--_TypeClass_ordering = (Core.Name "ordering")---- | The identifier of a type constructor-data TypeVariant = - TypeVariantAnnotated |- TypeVariantApplication |- TypeVariantForall |- TypeVariantFunction |- TypeVariantList |- TypeVariantLiteral |- TypeVariantMap |- TypeVariantOptional |- TypeVariantProduct |- TypeVariantRecord |- TypeVariantSet |- TypeVariantSum |- TypeVariantUnion |- TypeVariantUnit |- TypeVariantVariable |- TypeVariantWrap - deriving (Eq, Ord, Read, Show)--_TypeVariant = (Core.Name "hydra.mantle.TypeVariant")--_TypeVariant_annotated = (Core.Name "annotated")--_TypeVariant_application = (Core.Name "application")--_TypeVariant_forall = (Core.Name "forall")--_TypeVariant_function = (Core.Name "function")--_TypeVariant_list = (Core.Name "list")--_TypeVariant_literal = (Core.Name "literal")--_TypeVariant_map = (Core.Name "map")--_TypeVariant_optional = (Core.Name "optional")--_TypeVariant_product = (Core.Name "product")--_TypeVariant_record = (Core.Name "record")--_TypeVariant_set = (Core.Name "set")--_TypeVariant_sum = (Core.Name "sum")--_TypeVariant_union = (Core.Name "union")--_TypeVariant_unit = (Core.Name "unit")--_TypeVariant_variable = (Core.Name "variable")--_TypeVariant_wrap = (Core.Name "wrap")
src/gen-main/haskell/Hydra/Module.hs view
@@ -1,10 +1,13 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for Hydra namespaces and modules module Hydra.Module where import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -12,7 +15,9 @@ -- | A definition, which may be either a term or type definition data Definition = + -- | A term definition DefinitionTerm TermDefinition |+ -- | A type definition DefinitionType TypeDefinition deriving (Eq, Ord, Read, Show) @@ -56,9 +61,9 @@ -- | The elements defined in this module moduleElements :: [Core.Binding], -- | Any modules which the term expressions of this module directly depend upon- moduleTermDependencies :: [Module],+ moduleTermDependencies :: [Namespace], -- | Any modules which the type expressions of this module directly depend upon- moduleTypeDependencies :: [Module],+ moduleTypeDependencies :: [Namespace], -- | An optional human-readable description of the module moduleDescription :: (Maybe String)} deriving (Eq, Ord, Read, Show)@@ -86,7 +91,9 @@ -- | A mapping from namespaces to values of type n, with a focus on one namespace data Namespaces n = Namespaces {+ -- | The namespace in focus, together with its associated value namespacesFocus :: (Namespace, n),+ -- | A mapping of namespaces to values namespacesMapping :: (M.Map Namespace n)} deriving (Eq, Ord, Read, Show) @@ -99,7 +106,9 @@ -- | A qualified name consisting of an optional namespace together with a mandatory local name data QualifiedName = QualifiedName {+ -- | The optional namespace qualifiedNameNamespace :: (Maybe Namespace),+ -- | The local name qualifiedNameLocal :: String} deriving (Eq, Ord, Read, Show) @@ -109,12 +118,15 @@ _QualifiedName_local = (Core.Name "local") --- | A term-level definition, including a name, a term, and the type of the term+-- | A term-level definition, including a name, a term, and the type scheme of the term data TermDefinition = TermDefinition {+ -- | The name of the term termDefinitionName :: Core.Name,+ -- | The term being defined termDefinitionTerm :: Core.Term,- termDefinitionType :: Core.Type}+ -- | The type scheme of the term, including any class constraints+ termDefinitionType :: Core.TypeScheme} deriving (Eq, Ord, Read, Show) _TermDefinition = (Core.Name "hydra.module.TermDefinition")@@ -128,7 +140,9 @@ -- | A type-level definition, including a name and the type data TypeDefinition = TypeDefinition {+ -- | The name of the type typeDefinitionName :: Core.Name,+ -- | The type being defined typeDefinitionType :: Core.Type} deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Monads.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Functions for working with Hydra's 'flow' and other monads. module Hydra.Monads where@@ -5,96 +7,120 @@ import qualified Hydra.Compute as Compute import qualified Hydra.Constants as Constants import qualified Hydra.Core as Core+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Show.Core as Core_-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Monadic bind for flows bind :: (Compute.Flow t0 t1 -> (t1 -> Compute.Flow t0 t2) -> Compute.Flow t0 t2) bind l r = let q = (\s0 -> \t0 -> let fs1 = (Compute.unFlow l s0 t0)- in (Optionals.maybe (Compute.FlowState {+ in (Maybes.maybe (Compute.FlowState { Compute.flowStateValue = Nothing, Compute.flowStateState = (Compute.flowStateState fs1), Compute.flowStateTrace = (Compute.flowStateTrace fs1)}) (\v -> Compute.unFlow (r v) (Compute.flowStateState fs1) (Compute.flowStateTrace fs1)) (Compute.flowStateValue fs1))) in (Compute.Flow q) +-- | Adapt an either to a flow; a left value is mapped to a failure using the provided function+eitherToFlow :: ((t0 -> String) -> Either t0 t1 -> Compute.Flow t2 t1)+eitherToFlow formatError e = (Eithers.either (\l -> fail (formatError l)) (\r -> pure r) e)++-- | An empty trace with no stack, messages, or other attributes emptyTrace :: Compute.Trace emptyTrace = Compute.Trace { Compute.traceStack = [], Compute.traceMessages = [], Compute.traceOther = Maps.empty} +-- | Execute a flow and return the final state exec :: (Compute.Flow t0 t1 -> t0 -> t0) exec f s0 = (Compute.flowStateState (Compute.unFlow f s0 emptyTrace)) +-- | Fail a flow with an error message fail :: (String -> Compute.Flow t0 t1) fail msg = (Compute.Flow (\s -> \t -> Compute.FlowState { Compute.flowStateValue = Nothing, Compute.flowStateState = s, Compute.flowStateTrace = (pushError msg t)})) +-- | Check whether a flow succeeds flowSucceeds :: (t0 -> Compute.Flow t0 t1 -> Bool)-flowSucceeds s f = (Optionals.isJust (Compute.flowStateValue (Compute.unFlow f s emptyTrace)))+flowSucceeds s f = (Maybes.isJust (Compute.flowStateValue (Compute.unFlow f s emptyTrace))) +-- | Get the value of a flow, or a default value if the flow fails fromFlow :: (t0 -> t1 -> Compute.Flow t1 t0 -> t0)-fromFlow def cx f = (Optionals.maybe def (\xmo -> xmo) (Compute.flowStateValue (Compute.unFlow f cx emptyTrace)))+fromFlow def cx f = (Maybes.maybe def (\xmo -> xmo) (Compute.flowStateValue (Compute.unFlow f cx emptyTrace))) +-- | Get the state of the current flow getState :: (Compute.Flow t0 t0) getState = (Compute.Flow (\s0 -> \t0 -> - let fs1 = (Compute.unFlow (pure ()) s0 t0) - v = (Compute.flowStateValue fs1)- s = (Compute.flowStateState fs1)- t = (Compute.flowStateTrace fs1)- in (Optionals.maybe (Compute.FlowState {- Compute.flowStateValue = Nothing,- Compute.flowStateState = s,- Compute.flowStateTrace = t}) (\_ -> Compute.FlowState {- Compute.flowStateValue = (Just s),- Compute.flowStateState = s,- Compute.flowStateTrace = t}) v)))+ let fs1 = (Compute.unFlow (pure ()) s0 t0)+ in + let v = (Compute.flowStateValue fs1)+ in + let s = (Compute.flowStateState fs1)+ in + let t = (Compute.flowStateTrace fs1)+ in (Maybes.maybe (Compute.FlowState {+ Compute.flowStateValue = Nothing,+ Compute.flowStateState = s,+ Compute.flowStateTrace = t}) (\_ -> Compute.FlowState {+ Compute.flowStateValue = (Just s),+ Compute.flowStateState = s,+ Compute.flowStateTrace = t}) v))) +-- | Map a function over a flow map :: ((t0 -> t1) -> Compute.Flow t2 t0 -> Compute.Flow t2 t1) map f f1 = (Compute.Flow (\s0 -> \t0 -> let f2 = (Compute.unFlow f1 s0 t0) in Compute.FlowState {- Compute.flowStateValue = (Optionals.map f (Compute.flowStateValue f2)),+ Compute.flowStateValue = (Maybes.map f (Compute.flowStateValue f2)), Compute.flowStateState = (Compute.flowStateState f2), Compute.flowStateTrace = (Compute.flowStateTrace f2)})) +-- | Modify the state of a flow using a given function modify :: ((t0 -> t0) -> Compute.Flow t0 ()) modify f = (bind getState (\s -> putState (f s))) -mutateTrace :: ((Compute.Trace -> Mantle.Either String Compute.Trace) -> (Compute.Trace -> Compute.Trace -> Compute.Trace) -> Compute.Flow t0 t1 -> Compute.Flow t0 t1)-mutateTrace mutate restore f = (Compute.Flow (\s0 -> \t0 -> - let forLeft = (\msg -> Compute.FlowState {- Compute.flowStateValue = Nothing,- Compute.flowStateState = s0,- Compute.flowStateTrace = (pushError msg t0)}) - forRight = (\t1 -> - let f2 = (Compute.unFlow f s0 t1)- in Compute.FlowState {- Compute.flowStateValue = (Compute.flowStateValue f2),- Compute.flowStateState = (Compute.flowStateState f2),- Compute.flowStateTrace = (restore t0 (Compute.flowStateTrace f2))})- in ((\x -> case x of- Mantle.EitherLeft v1 -> (forLeft v1)- Mantle.EitherRight v1 -> (forRight v1)) (mutate t0))))+-- | Temporarily mutate the trace for the duration of a flow+mutateTrace :: ((Compute.Trace -> Either String Compute.Trace) -> (Compute.Trace -> Compute.Trace -> Compute.Trace) -> Compute.Flow t0 t1 -> Compute.Flow t0 t1)+mutateTrace mutate restore f = + let choose = (\forLeft -> \forRight -> \e -> Eithers.either (\l -> forLeft l) (\r -> forRight r) e)+ in + let flowFun = (\s0 -> \t0 -> + let forLeft = (\msg -> Compute.FlowState {+ Compute.flowStateValue = Nothing,+ Compute.flowStateState = s0,+ Compute.flowStateTrace = (pushError msg t0)})+ in + let forRight = (\t1 -> + let f2 = (Compute.unFlow f s0 t1)+ in Compute.FlowState {+ Compute.flowStateValue = (Compute.flowStateValue f2),+ Compute.flowStateState = (Compute.flowStateState f2),+ Compute.flowStateTrace = (restore t0 (Compute.flowStateTrace f2))})+ in (choose forLeft forRight (mutate t0)))+ in (Compute.Flow flowFun) -optionalToList :: (Maybe t0 -> [t0])-optionalToList mx = (Optionals.maybe [] Lists.pure mx)+-- | Converts an optional value either to an empty list (if nothing) or a singleton list (if just).+maybeToList :: (Maybe t0 -> [t0])+maybeToList mx = (Maybes.maybe [] Lists.pure mx) +-- | Lift a value into a flow pure :: (t0 -> Compute.Flow t1 t0) pure xp = (Compute.Flow (\s -> \t -> Compute.FlowState { Compute.flowStateValue = (Just xp),@@ -104,27 +130,30 @@ -- | Push an error message pushError :: (String -> Compute.Trace -> Compute.Trace) pushError msg t = - let condenseRepeats = + let condenseRepeats = (\ys -> let condenseGroup = (\xs -> - let x = (Lists.head xs) - n = (Lists.length xs)- in (Logic.ifElse (Equality.equal n 1) x (Strings.cat [- x,- " (x",- Literals.showInt32 n,- ")"])))- in (\ys -> Lists.map condenseGroup (Lists.group ys)) - errorMsg = (Strings.cat [- "Error: ",- msg,- " (",- Strings.intercalate " > " (condenseRepeats (Lists.reverse (Compute.traceStack t))),- ")"])- in Compute.Trace {- Compute.traceStack = (Compute.traceStack t),- Compute.traceMessages = (Lists.cons errorMsg (Compute.traceMessages t)),- Compute.traceOther = (Compute.traceOther t)}+ let x = (Lists.head xs)+ in + let n = (Lists.length xs)+ in (Logic.ifElse (Equality.equal n 1) x (Strings.cat [+ x,+ " (x",+ (Literals.showInt32 n),+ ")"])))+ in (Lists.map condenseGroup (Lists.group ys)))+ in + let errorMsg = (Strings.cat [+ "Error: ",+ msg,+ " (",+ (Strings.intercalate " > " (condenseRepeats (Lists.reverse (Compute.traceStack t)))),+ ")"])+ in Compute.Trace {+ Compute.traceStack = (Compute.traceStack t),+ Compute.traceMessages = (Lists.cons errorMsg (Compute.traceMessages t)),+ Compute.traceOther = (Compute.traceOther t)} +-- | Set the state of a flow putState :: (t0 -> Compute.Flow t0 ()) putState cx = (Compute.Flow (\s0 -> \t0 -> let f1 = (Compute.unFlow (pure ()) s0 t0)@@ -136,52 +165,46 @@ -- | Summarize a trace as a string traceSummary :: (Compute.Trace -> String) traceSummary t = - let messageLines = (Lists.nub (Compute.traceMessages t)) - keyvalLines = (Logic.ifElse (Maps.null (Compute.traceOther t)) [] (Lists.cons "key/value pairs: " (Lists.map toLine (Maps.toList (Compute.traceOther t)))))- toLine = (\pair -> Strings.cat [- Strings.cat [- Strings.cat [- "\t",- (Core.unName (fst pair))],- ": "],- (Core_.term (snd pair))])- in (Strings.intercalate "\n" (Lists.concat2 messageLines keyvalLines))+ let messageLines = (Lists.nub (Compute.traceMessages t))+ in + let toLine = (\pair -> Strings.cat2 (Strings.cat2 (Strings.cat2 "\t" (Core.unName (Pairs.first pair))) ": ") (Core_.term (Pairs.second pair)))+ in + let keyvalLines = (Logic.ifElse (Maps.null (Compute.traceOther t)) [] (Lists.cons "key/value pairs: " (Lists.map toLine (Maps.toList (Compute.traceOther t)))))+ in (Strings.intercalate "\n" (Lists.concat2 messageLines keyvalLines)) +-- | Fail if an actual value does not match an expected value unexpected :: (String -> String -> Compute.Flow t0 t1)-unexpected expected actual = (fail (Strings.cat [- Strings.cat [- Strings.cat [- "expected ",- expected],- " but found: "],- actual]))+unexpected expected actual = (fail (Strings.cat2 (Strings.cat2 (Strings.cat2 "expected " expected) " but found ") actual)) +-- | Continue the current flow after adding a warning message warn :: (String -> Compute.Flow t0 t1 -> Compute.Flow t0 t1) warn msg b = (Compute.Flow (\s0 -> \t0 -> - let f1 = (Compute.unFlow b s0 t0) - addMessage = (\t -> Compute.Trace {- Compute.traceStack = (Compute.traceStack t),- Compute.traceMessages = (Lists.cons (Strings.cat [- "Warning: ",- msg]) (Compute.traceMessages t)),- Compute.traceOther = (Compute.traceOther t)})- in Compute.FlowState {- Compute.flowStateValue = (Compute.flowStateValue f1),- Compute.flowStateState = (Compute.flowStateState f1),- Compute.flowStateTrace = (addMessage (Compute.flowStateTrace f1))}))+ let f1 = (Compute.unFlow b s0 t0)+ in + let addMessage = (\t -> Compute.Trace {+ Compute.traceStack = (Compute.traceStack t),+ Compute.traceMessages = (Lists.cons (Strings.cat2 "Warning: " msg) (Compute.traceMessages t)),+ Compute.traceOther = (Compute.traceOther t)})+ in Compute.FlowState {+ Compute.flowStateValue = (Compute.flowStateValue f1),+ Compute.flowStateState = (Compute.flowStateState f1),+ Compute.flowStateTrace = (addMessage (Compute.flowStateTrace f1))})) +-- | Continue the current flow after setting a flag withFlag :: (Core.Name -> Compute.Flow t0 t1 -> Compute.Flow t0 t1)-withFlag flag = - let mutate = (\t -> Mantle.EitherRight (Compute.Trace {+withFlag flag f = + let mutate = (\t -> Logic.ifElse False (Left "never happens") (Right (Compute.Trace { Compute.traceStack = (Compute.traceStack t), Compute.traceMessages = (Compute.traceMessages t),- Compute.traceOther = (Maps.insert flag (Core.TermLiteral (Core.LiteralBoolean True)) (Compute.traceOther t))})) - restore = (\ignored -> \t1 -> Compute.Trace {- Compute.traceStack = (Compute.traceStack t1),- Compute.traceMessages = (Compute.traceMessages t1),- Compute.traceOther = (Maps.remove flag (Compute.traceOther t1))})- in (mutateTrace mutate restore)+ Compute.traceOther = (Maps.insert flag (Core.TermLiteral (Core.LiteralBoolean True)) (Compute.traceOther t))})))+ in + let restore = (\ignored -> \t1 -> Compute.Trace {+ Compute.traceStack = (Compute.traceStack t1),+ Compute.traceMessages = (Compute.traceMessages t1),+ Compute.traceOther = (Maps.delete flag (Compute.traceOther t1))})+ in (mutateTrace mutate restore f) +-- | Continue a flow using a given state withState :: (t0 -> Compute.Flow t0 t1 -> Compute.Flow t2 t1) withState cx0 f = (Compute.Flow (\cx1 -> \t1 -> let f1 = (Compute.unFlow f cx0 t1)@@ -190,14 +213,16 @@ Compute.flowStateState = cx1, Compute.flowStateTrace = (Compute.flowStateTrace f1)})) +-- | Continue the current flow after augmenting the trace withTrace :: (String -> Compute.Flow t0 t1 -> Compute.Flow t0 t1)-withTrace msg = - let mutate = (\t -> Logic.ifElse (Equality.gte (Lists.length (Compute.traceStack t)) Constants.maxTraceDepth) (Mantle.EitherLeft "maximum trace depth exceeded. This may indicate an infinite loop") (Mantle.EitherRight (Compute.Trace {+withTrace msg f = + let mutate = (\t -> Logic.ifElse (Equality.gte (Lists.length (Compute.traceStack t)) Constants.maxTraceDepth) (Left "maximum trace depth exceeded. This may indicate an infinite loop") (Right (Compute.Trace { Compute.traceStack = (Lists.cons msg (Compute.traceStack t)), Compute.traceMessages = (Compute.traceMessages t),- Compute.traceOther = (Compute.traceOther t)}))) - restore = (\t0 -> \t1 -> Compute.Trace {- Compute.traceStack = (Compute.traceStack t0),- Compute.traceMessages = (Compute.traceMessages t1),- Compute.traceOther = (Compute.traceOther t1)})- in (mutateTrace mutate restore)+ Compute.traceOther = (Compute.traceOther t)})))+ in + let restore = (\t0 -> \t1 -> Compute.Trace {+ Compute.traceStack = (Compute.traceStack t0),+ Compute.traceMessages = (Compute.traceMessages t1),+ Compute.traceOther = (Compute.traceOther t1)})+ in (mutateTrace mutate restore f)
src/gen-main/haskell/Hydra/Names.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Functions for working with qualified names. module Hydra.Names where@@ -8,12 +10,13 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Module as Module-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -25,25 +28,24 @@ let qualName = (qualifyName name) mns = (Module.qualifiedNameNamespace qualName) local = (Module.qualifiedNameLocal qualName)- in (Optionals.maybe (Core.unName name) (\ns -> Optionals.maybe local (\pre -> Strings.cat [+ in (Maybes.maybe (Core.unName name) (\ns -> Maybes.maybe local (\pre -> Strings.cat [ pre, ":", local]) (Maps.lookup ns namespaces)) mns) +-- | Extract the local part of a name localNameOf :: (Core.Name -> String) localNameOf arg_ = (Module.qualifiedNameLocal (qualifyName arg_)) +-- | Extract the namespace of a name, if any namespaceOf :: (Core.Name -> Maybe Module.Namespace) namespaceOf arg_ = (Module.qualifiedNameNamespace (qualifyName arg_)) -namespaceToFilePath :: (Mantle.CaseConvention -> Module.FileExtension -> Module.Namespace -> String)+-- | Convert a namespace to a file path with the given case convention and file extension+namespaceToFilePath :: (Util.CaseConvention -> Module.FileExtension -> Module.Namespace -> String) namespaceToFilePath caseConv ext ns = - let parts = (Lists.map (Formatting.convertCase Mantle.CaseConventionCamel caseConv) (Strings.splitOn "." (Module.unNamespace ns)))- in (Strings.cat [- Strings.cat [- Strings.intercalate "/" parts,- "."],- (Module.unFileExtension ext)])+ let parts = (Lists.map (Formatting.convertCase Util.CaseConventionCamel caseConv) (Strings.splitOn "." (Module.unNamespace ns)))+ in (Strings.cat2 (Strings.cat2 (Strings.intercalate "/" parts) ".") (Module.unFileExtension ext)) -- | Construct a qualified (dot-separated) name qname :: (Module.Namespace -> String -> Core.Name)@@ -52,6 +54,7 @@ ".", name])) +-- | Split a dot-separated name into a namespace and local name qualifyName :: (Core.Name -> Module.QualifiedName) qualifyName name = let parts = (Lists.reverse (Strings.splitOn "." (Core.unName name)))@@ -68,9 +71,5 @@ -- | Convert a qualified name to a dot-separated name unqualifyName :: (Module.QualifiedName -> Core.Name) unqualifyName qname = - let prefix = (Optionals.maybe "" (\n -> Strings.cat [- Module.unNamespace n,- "."]) (Module.qualifiedNameNamespace qname))- in (Core.Name (Strings.cat [- prefix,- (Module.qualifiedNameLocal qname)]))+ let prefix = (Maybes.maybe "" (\n -> Strings.cat2 (Module.unNamespace n) ".") (Module.qualifiedNameNamespace qname))+ in (Core.Name (Strings.cat2 prefix (Module.qualifiedNameLocal qname)))
+ src/gen-main/haskell/Hydra/Parsers.hs view
@@ -0,0 +1,152 @@+-- Note: this is an automatically generated file. Do not edit.++-- | General-purpose parser combinators++module Hydra.Parsers where++import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Parsing as Parsing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Try the first parser; if it fails without consuming input, try the second+alt :: (Parsing.Parser t0 -> Parsing.Parser t0 -> Parsing.Parser t0)+alt p1 p2 = + let parse = (\input -> (\x -> case x of+ Parsing.ParseResultSuccess v1 -> (Parsing.ParseResultSuccess v1)+ Parsing.ParseResultFailure v1 -> (Logic.ifElse (Equality.equal (Parsing.parseErrorRemainder v1) input) (Parsing.unParser p2 input) (Parsing.ParseResultFailure v1))) (Parsing.unParser p1 input))+ in (Parsing.Parser parse)++-- | Parse any single character (codepoint)+anyChar :: (Parsing.Parser Int)+anyChar = (satisfy (\_ -> True))++-- | Apply a parser containing a function to a parser containing a value+apply :: (Parsing.Parser (t0 -> t1) -> Parsing.Parser t0 -> Parsing.Parser t1)+apply pf pa = + let parse = (\input -> (\x -> case x of+ Parsing.ParseResultSuccess v1 -> ((\x -> case x of+ Parsing.ParseResultSuccess v2 -> (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Parsing.parseSuccessValue v1 (Parsing.parseSuccessValue v2)),+ Parsing.parseSuccessRemainder = (Parsing.parseSuccessRemainder v2)}))+ Parsing.ParseResultFailure v2 -> (Parsing.ParseResultFailure v2)) (Parsing.unParser pa (Parsing.parseSuccessRemainder v1)))+ Parsing.ParseResultFailure v1 -> (Parsing.ParseResultFailure v1)) (Parsing.unParser pf input))+ in (Parsing.Parser parse)++-- | Parse something between an opening and closing parser+between :: (Parsing.Parser t0 -> Parsing.Parser t1 -> Parsing.Parser t2 -> Parsing.Parser t2)+between open close p = (bind open (\_ -> bind p (\x -> bind close (\_ -> pure x))))++-- | Sequence two parsers, passing the result of the first to a function that produces the second+bind :: (Parsing.Parser t0 -> (t0 -> Parsing.Parser t1) -> Parsing.Parser t1)+bind pa f = + let parse = (\input -> (\x -> case x of+ Parsing.ParseResultSuccess v1 -> (Parsing.unParser (f (Parsing.parseSuccessValue v1)) (Parsing.parseSuccessRemainder v1))+ Parsing.ParseResultFailure v1 -> (Parsing.ParseResultFailure v1)) (Parsing.unParser pa input))+ in (Parsing.Parser parse)++-- | Parse a specific character (codepoint)+char :: (Int -> Parsing.Parser Int)+char c = (satisfy (\x -> Equality.equal x c))++-- | Try each parser in the list until one succeeds+choice :: ([Parsing.Parser t0] -> Parsing.Parser t0)+choice ps = (Lists.foldl alt (fail "no choice matched") ps)++-- | A parser that succeeds only at the end of input+eof :: (Parsing.Parser ())+eof = (Parsing.Parser (\input -> Logic.ifElse (Equality.equal input "") (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (),+ Parsing.parseSuccessRemainder = ""})) (Parsing.ParseResultFailure (Parsing.ParseError {+ Parsing.parseErrorMessage = "expected end of input",+ Parsing.parseErrorRemainder = input}))))++-- | A parser that always fails with the given error message+fail :: (String -> Parsing.Parser t0)+fail msg = (Parsing.Parser (\input -> Parsing.ParseResultFailure (Parsing.ParseError {+ Parsing.parseErrorMessage = msg,+ Parsing.parseErrorRemainder = input})))++-- | Create a parser that defers construction of another parser until parsing time. This is essential for breaking recursive parser definitions.+lazy :: ((() -> Parsing.Parser t0) -> Parsing.Parser t0)+lazy f = (Parsing.Parser (\input -> Parsing.unParser (f ()) input))++-- | Parse zero or more occurrences of the given parser+many :: (Parsing.Parser t0 -> Parsing.Parser [t0])+many p = (alt (some p) (pure []))++-- | Apply a function to the result of a parser+map :: ((t0 -> t1) -> Parsing.Parser t0 -> Parsing.Parser t1)+map f pa = + let parse = (\input -> (\x -> case x of+ Parsing.ParseResultSuccess v1 -> (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (f (Parsing.parseSuccessValue v1)),+ Parsing.parseSuccessRemainder = (Parsing.parseSuccessRemainder v1)}))+ Parsing.ParseResultFailure v1 -> (Parsing.ParseResultFailure v1)) (Parsing.unParser pa input))+ in (Parsing.Parser parse)++-- | Optionally parse something, returning Nothing if it fails+optional :: (Parsing.Parser t0 -> Parsing.Parser (Maybe t0))+optional p = (alt (map Maybes.pure p) (pure Nothing))++-- | A parser that always succeeds with the given value without consuming input+pure :: (t0 -> Parsing.Parser t0)+pure a = (Parsing.Parser (\input -> Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = a,+ Parsing.parseSuccessRemainder = input})))++-- | Run a parser on the given input string+runParser :: (Parsing.Parser t0 -> String -> Parsing.ParseResult t0)+runParser p input = (Parsing.unParser p input)++-- | Parse a character (codepoint) that satisfies the given predicate+satisfy :: ((Int -> Bool) -> Parsing.Parser Int)+satisfy pred = + let parse = (\input -> + let codes = (Strings.toList input)+ in (Maybes.maybe (Parsing.ParseResultFailure (Parsing.ParseError {+ Parsing.parseErrorMessage = "unexpected end of input",+ Parsing.parseErrorRemainder = input})) (\c -> + let rest = (Strings.fromList (Lists.drop 1 codes))+ in (Logic.ifElse (pred c) (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = c,+ Parsing.parseSuccessRemainder = rest})) (Parsing.ParseResultFailure (Parsing.ParseError {+ Parsing.parseErrorMessage = "character did not satisfy predicate",+ Parsing.parseErrorRemainder = input})))) (Lists.safeHead codes)))+ in (Parsing.Parser parse)++-- | Parse zero or more occurrences separated by a separator+sepBy :: (Parsing.Parser t0 -> Parsing.Parser t1 -> Parsing.Parser [t0])+sepBy p sep = (alt (sepBy1 p sep) (pure []))++-- | Parse one or more occurrences separated by a separator+sepBy1 :: (Parsing.Parser t0 -> Parsing.Parser t1 -> Parsing.Parser [t0])+sepBy1 p sep = (bind p (\x -> bind (many (bind sep (\_ -> p))) (\xs -> pure (Lists.cons x xs))))++-- | Parse one or more occurrences of the given parser+some :: (Parsing.Parser t0 -> Parsing.Parser [t0])+some p = (bind p (\x -> bind (many p) (\xs -> pure (Lists.cons x xs))))++-- | Parse a specific string+string :: (String -> Parsing.Parser String)+string str = (Parsing.Parser (\input -> + let strCodes = (Strings.toList str)+ in + let inputCodes = (Strings.toList input)+ in + let strLen = (Lists.length strCodes)+ in + let inputPrefix = (Lists.take strLen inputCodes)+ in (Logic.ifElse (Equality.equal strCodes inputPrefix) (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = str,+ Parsing.parseSuccessRemainder = (Strings.fromList (Lists.drop strLen inputCodes))})) (Parsing.ParseResultFailure (Parsing.ParseError {+ Parsing.parseErrorMessage = (Strings.cat2 "expected: " str),+ Parsing.parseErrorRemainder = input})))))
+ src/gen-main/haskell/Hydra/Parsing.hs view
@@ -0,0 +1,64 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Parser combinator types for text parsing++module Hydra.Parsing where++import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | An error which occurred while parsing+data ParseError = + ParseError {+ -- | An error message+ parseErrorMessage :: String,+ -- | The remaining input at the point of failure+ parseErrorRemainder :: String}+ deriving (Eq, Ord, Read, Show)++_ParseError = (Core.Name "hydra.parsing.ParseError")++_ParseError_message = (Core.Name "message")++_ParseError_remainder = (Core.Name "remainder")++-- | The result of a parse operation+data ParseResult a = + -- | A successful parse, with a value and the remaining unparsed input+ ParseResultSuccess (ParseSuccess a) |+ -- | A failed parse, with an error message and the remaining input+ ParseResultFailure ParseError+ deriving (Eq, Ord, Read, Show)++_ParseResult = (Core.Name "hydra.parsing.ParseResult")++_ParseResult_success = (Core.Name "success")++_ParseResult_failure = (Core.Name "failure")++-- | A successful parse result+data ParseSuccess a = + ParseSuccess {+ -- | The parsed value+ parseSuccessValue :: a,+ -- | The remaining unparsed input+ parseSuccessRemainder :: String}+ deriving (Eq, Ord, Read, Show)++_ParseSuccess = (Core.Name "hydra.parsing.ParseSuccess")++_ParseSuccess_value = (Core.Name "value")++_ParseSuccess_remainder = (Core.Name "remainder")++-- | A parser which consumes characters from a string and produces a value+newtype Parser a = + Parser {+ unParser :: (String -> ParseResult a)}++_Parser = (Core.Name "hydra.parsing.Parser")
src/gen-main/haskell/Hydra/Phantoms.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Phantom types for use with Hydra DSLs module Hydra.Phantoms where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -12,7 +15,9 @@ -- | An association of a named term (element) with a phantom type data TBinding a = TBinding {+ -- | The name of the term tBindingName :: Core.Name,+ -- | The term with its phantom type tBindingTerm :: (TTerm a)} deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Query.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for language-agnostic graph pattern queries module Hydra.Query where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -147,7 +150,9 @@ -- | A range from min to max, inclusive data Range = Range {+ -- | The minimum value (inclusive) rangeMin :: Int,+ -- | The maximum value (inclusive) rangeMax :: Int} deriving (Eq, Ord, Read, Show) @@ -194,7 +199,9 @@ -- | A path with a regex quantifier data RegexSequence = RegexSequence {+ -- | The path to which the quantifier applies regexSequencePath :: Path,+ -- | The quantifier regexSequenceQuantifier :: RegexQuantifier} deriving (Eq, Ord, Read, Show) @@ -225,8 +232,11 @@ -- | A subject/predicate/object pattern data TriplePattern = TriplePattern {+ -- | The subject of the pattern triplePatternSubject :: Node,+ -- | The predicate (property) of the pattern triplePatternPredicate :: Path,+ -- | The object of the pattern triplePatternObject :: Node} deriving (Eq, Ord, Read, Show)
src/gen-main/haskell/Hydra/Reduction.hs view
@@ -1,13 +1,18 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Functions for reducing terms and types, i.e. performing computations. module Hydra.Reduction where import qualified Hydra.Arity as Arity+import qualified Hydra.Checking as Checking import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core-import qualified Hydra.Extract.Core as Core_+import qualified Hydra.Encode.Core as Core_+import qualified Hydra.Extract.Core as Core__ import qualified Hydra.Graph as Graph import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists@@ -15,12 +20,15 @@ import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Schemas as Schemas-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -30,25 +38,30 @@ alphaConvert :: (Core.Name -> Core.Name -> Core.Term -> Core.Term) alphaConvert vold vnew term = (Rewriting.replaceFreeTermVariable vold (Core.TermVariable vnew) term) +-- | Eagerly beta-reduce a type by substituting type arguments into type lambdas betaReduceType :: (Core.Type -> Compute.Flow Graph.Graph Core.Type) betaReduceType typ = - let mapExpr = (\recurse -> \t -> Flows.bind (recurse t) (\r -> (\x -> case x of- Core.TypeApplication v1 -> (reduceApp v1)- _ -> (Flows.pure r)) r)) - reduceApp = (\app -> - let lhs = (Core.applicationTypeFunction app) - rhs = (Core.applicationTypeArgument app)- in ((\x -> case x of- Core.TypeAnnotated v1 -> (Flows.bind (reduceApp (Core.ApplicationType {- Core.applicationTypeFunction = (Core.annotatedTypeSubject v1),- Core.applicationTypeArgument = rhs})) (\a -> Flows.pure (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = a,- Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))))- Core.TypeForall v1 -> (betaReduceType (Rewriting.replaceFreeTypeVariable (Core.forallTypeParameter v1) rhs (Core.forallTypeBody v1)))- Core.TypeVariable v1 -> (Flows.bind (Schemas.requireType v1) (\t_ -> betaReduceType (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = t_,- Core.applicationTypeArgument = rhs}))))) lhs))- in (Rewriting.rewriteTypeM mapExpr typ)+ let reduceApp = (\app -> + let lhs = (Core.applicationTypeFunction app)+ in + let rhs = (Core.applicationTypeArgument app)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (Flows.bind (reduceApp (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.annotatedTypeBody v1),+ Core.applicationTypeArgument = rhs})) (\a -> Flows.pure (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = a,+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))))+ Core.TypeForall v1 -> (betaReduceType (Rewriting.replaceFreeTypeVariable (Core.forallTypeParameter v1) rhs (Core.forallTypeBody v1)))+ Core.TypeVariable v1 -> (Flows.bind (Schemas.requireType v1) (\t_ -> betaReduceType (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = t_,+ Core.applicationTypeArgument = rhs}))))) lhs))+ in + let mapExpr = (\recurse -> \t -> + let findApp = (\r -> (\x -> case x of+ Core.TypeApplication v1 -> (reduceApp v1)+ _ -> (Flows.pure r)) r)+ in (Flows.bind (recurse t) (\r -> findApp r)))+ in (Rewriting.rewriteTypeM mapExpr typ) -- | Apply the special rules: -- | ((\x.e1) e2) == e1, where x does not appear free in e1@@ -61,188 +74,560 @@ let rec = (recurse t) in ((\x -> case x of Core.TermApplication v1 -> - let lhs = (Core.applicationFunction v1) - rhs = (Core.applicationArgument v1)- in ((\x -> case x of- Core.TermFunction v2 -> ((\x -> case x of- Core.FunctionLambda v3 -> - let v = (Core.lambdaParameter v3) - body = (Core.lambdaBody v3)- in (Logic.ifElse (Rewriting.isFreeVariableInTerm v body) body (Rewriting.replaceFreeTermVariable v rhs body))- _ -> rec) v2)- _ -> rec) (Rewriting.deannotateTerm lhs))+ let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in ((\x -> case x of+ Core.TermFunction v2 -> ((\x -> case x of+ Core.FunctionLambda v3 -> + let v = (Core.lambdaParameter v3)+ in + let body = (Core.lambdaBody v3)+ in (Logic.ifElse (Rewriting.isFreeVariableInTerm v body) body (Rewriting.replaceFreeTermVariable v rhs body))+ _ -> rec) v2)+ _ -> rec) (Rewriting.deannotateTerm lhs)) _ -> rec) rec)) in (Rewriting.rewriteTerm rewrite term) countPrimitiveInvocations :: Bool countPrimitiveInvocations = True +-- | Eta-reduce a term by removing redundant lambda abstractions etaReduceTerm :: (Core.Term -> Core.Term) etaReduceTerm term = - let noChange = term - reduceLambda = (\l -> - let v = (Core.lambdaParameter l) - d = (Core.lambdaDomain l)- body = (Core.lambdaBody l)- in ((\x -> case x of- Core.TermAnnotated v1 -> (reduceLambda (Core.Lambda {- Core.lambdaParameter = v,- Core.lambdaDomain = d,- Core.lambdaBody = (Core.annotatedTermSubject v1)}))- Core.TermApplication v1 -> - let lhs = (Core.applicationFunction v1) - rhs = (Core.applicationArgument v1)- in ((\x -> case x of- Core.TermAnnotated v2 -> (reduceLambda (Core.Lambda {- Core.lambdaParameter = v,- Core.lambdaDomain = d,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = lhs,- Core.applicationArgument = (Core.annotatedTermSubject v2)}))}))- Core.TermVariable v2 -> (Logic.ifElse (Logic.and (Equality.equal (Core.unName v) (Core.unName v2)) (Logic.not (Rewriting.isFreeVariableInTerm v lhs))) (etaReduceTerm lhs) noChange)- _ -> noChange) (etaReduceTerm rhs))- _ -> noChange) (etaReduceTerm body)))- in ((\x -> case x of- Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (etaReduceTerm (Core.annotatedTermSubject v1)),- Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (reduceLambda v2)- _ -> noChange) v1)- _ -> noChange) term)+ let noChange = term+ in + let reduceLambda = (\l -> + let v = (Core.lambdaParameter l)+ in + let d = (Core.lambdaDomain l)+ in + let body = (Core.lambdaBody l)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (reduceLambda (Core.Lambda {+ Core.lambdaParameter = v,+ Core.lambdaDomain = d,+ Core.lambdaBody = (Core.annotatedTermBody v1)}))+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in ((\x -> case x of+ Core.TermAnnotated v2 -> (reduceLambda (Core.Lambda {+ Core.lambdaParameter = v,+ Core.lambdaDomain = d,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs,+ Core.applicationArgument = (Core.annotatedTermBody v2)}))}))+ Core.TermVariable v2 -> (Logic.ifElse (Logic.and (Equality.equal (Core.unName v) (Core.unName v2)) (Logic.not (Rewriting.isFreeVariableInTerm v lhs))) (etaReduceTerm lhs) noChange)+ _ -> noChange) (etaReduceTerm rhs))+ _ -> noChange) (etaReduceTerm body)))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (etaReduceTerm (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (reduceLambda v2)+ _ -> noChange) v1)+ _ -> noChange) term) -- | Recursively transform arbitrary terms like 'add 42' into terms like '\x.add 42 x', in which the implicit parameters of primitive functions and eliminations are made into explicit lambda parameters. Variable references are not expanded. This is useful for targets like Python with weaker support for currying than Hydra or Haskell. Note: this is a "trusty" function which assumes the graph is well-formed, i.e. no dangling references.-expandLambdas :: (Graph.Graph -> Core.Term -> Core.Term)-expandLambdas graph term = +etaExpandTerm :: (Graph.Graph -> Core.Term -> Core.Term)+etaExpandTerm graph term = let expand = (\args -> \arity -> \t -> let apps = (Lists.foldl (\lhs -> \arg -> Core.TermApplication (Core.Application { Core.applicationFunction = lhs,- Core.applicationArgument = arg})) t args) - is = (Logic.ifElse (Equality.lte arity (Lists.length args)) [] (Math.range 1 (Math.sub arity (Lists.length args))))- pad = (\indices -> \t -> Logic.ifElse (Lists.null indices) t (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.applicationArgument = arg})) t args)+ in + let is = (Logic.ifElse (Equality.lte arity (Lists.length args)) [] (Math.range 1 (Math.sub arity (Lists.length args))))+ in + let pad = (\indices -> \t -> Logic.ifElse (Lists.null indices) t (Core.TermFunction (Core.FunctionLambda (Core.Lambda { Core.lambdaParameter = (Core.Name (Strings.cat2 "v" (Literals.showInt32 (Lists.head indices)))), Core.lambdaDomain = Nothing, Core.lambdaBody = (pad (Lists.tail indices) (Core.TermApplication (Core.Application { Core.applicationFunction = t, Core.applicationArgument = (Core.TermVariable (Core.Name (Strings.cat2 "v" (Literals.showInt32 (Lists.head indices)))))})))}))))- in (pad is apps)) - rewrite = (\args -> \recurse -> \t -> - let afterRecursion = (\term -> expand args (expansionArity graph term) term)+ in (pad is apps))+ in + let rewrite = (\args -> \recurse -> \t -> + let afterRecursion = (\term -> expand args (etaExpansionArity graph term) term)+ in + let t2 = (Rewriting.detypeTerm t) in ((\x -> case x of Core.TermApplication v1 -> - let lhs = (Core.applicationFunction v1) - rhs = (Core.applicationArgument v1)- erhs = (rewrite [] recurse rhs)- in (rewrite (Lists.cons erhs args) recurse lhs)- _ -> (afterRecursion (recurse t))) t))- in (contractTerm (Rewriting.rewriteTerm (rewrite []) term))+ let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in + let erhs = (rewrite [] recurse rhs)+ in (rewrite (Lists.cons erhs args) recurse lhs)+ _ -> (afterRecursion (recurse t2))) t2))+ in (contractTerm (Rewriting.rewriteTerm (rewrite []) term)) --- | Calculate the arity for lambda expansion-expansionArity :: (Graph.Graph -> Core.Term -> Int)-expansionArity graph term = ((\x -> case x of- Core.TermApplication v1 -> (Math.sub (expansionArity graph (Core.applicationFunction v1)) 1)+-- | Recursively transform terms to eliminate partial application, e.g. 'add 42' becomes '\x.add 42 x'. Uses the TypeContext to look up types for arity calculation. Bare primitives and variables are NOT expanded; eliminations and partial applications are. This version properly tracks the TypeContext through nested scopes.+etaExpandTermNew :: (Typing.TypeContext -> Core.Term -> Core.Term)+etaExpandTermNew tx0 term0 = + let termArityWithContext = (\tx -> \term -> (\x -> case x of+ Core.TermAnnotated v1 -> (termArityWithContext tx (Core.annotatedTermBody v1))+ Core.TermApplication v1 -> (Math.sub (termArityWithContext tx (Core.applicationFunction v1)) 1)+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination _ -> 1+ Core.FunctionLambda _ -> 0+ Core.FunctionPrimitive v2 -> (Maybes.maybe 0 Arity.typeSchemeArity (Maps.lookup v2 (Typing.inferenceContextPrimitiveTypes (Typing.typeContextInferenceContext tx))))) v1)+ Core.TermLet v1 -> (termArityWithContext (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) tx v1) (Core.letBody v1))+ Core.TermTypeLambda v1 -> (termArityWithContext (Schemas.extendTypeContextForTypeLambda tx v1) (Core.typeLambdaBody v1))+ Core.TermTypeApplication v1 -> (termArityWithContext tx (Core.typeApplicationTermBody v1))+ Core.TermVariable v1 -> (Maybes.maybe 0 Arity.typeArity (Maps.lookup v1 (Typing.typeContextTypes tx)))+ _ -> 0) term)+ in + let domainTypes = (\n -> \mt -> Logic.ifElse (Equality.lte n 0) [] (Maybes.maybe (Lists.map (\_ -> Nothing) (Math.range 1 n)) (\typ -> (\x -> case x of+ Core.TypeFunction v1 -> (Lists.cons (Just (Core.functionTypeDomain v1)) (domainTypes (Math.sub n 1) (Just (Core.functionTypeCodomain v1))))+ Core.TypeAnnotated v1 -> (domainTypes n (Just (Core.annotatedTypeBody v1)))+ Core.TypeApplication v1 -> (domainTypes n (Just (Core.applicationTypeFunction v1)))+ Core.TypeForall v1 -> (domainTypes n (Just (Core.forallTypeBody v1)))+ _ -> (Lists.map (\_ -> Nothing) (Math.range 1 n))) typ) mt))+ in + let peelFunctionDomains = (\mtyp -> \n -> Logic.ifElse (Equality.lte n 0) mtyp (Maybes.maybe Nothing (\typ -> (\x -> case x of+ Core.TypeFunction v1 -> (peelFunctionDomains (Just (Core.functionTypeCodomain v1)) (Math.sub n 1))+ Core.TypeAnnotated v1 -> (peelFunctionDomains (Just (Core.annotatedTypeBody v1)) n)+ Core.TypeApplication v1 -> (peelFunctionDomains (Just (Core.applicationTypeFunction v1)) n)+ Core.TypeForall v1 -> (peelFunctionDomains (Just (Core.forallTypeBody v1)) n)+ _ -> Nothing) typ) mtyp))+ in + let expand = (\alwaysPad -> \args -> \arity -> \headTyp -> \head -> + let applied = (Lists.foldl (\lhs -> \arg -> Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs,+ Core.applicationArgument = arg})) head args)+ in + let numArgs = (Lists.length args)+ in + let needed = (Math.sub arity numArgs)+ in (Logic.ifElse (Logic.and (Equality.gt needed 0) (Logic.or alwaysPad (Equality.gt numArgs 0))) ( + let indices = (Math.range 1 needed)+ in + let remainingType = (peelFunctionDomains headTyp numArgs)+ in + let domains = (domainTypes needed remainingType)+ in + let codomainType = (peelFunctionDomains remainingType needed)+ in + let fullyAppliedRaw = (Lists.foldl (\body -> \i -> + let vn = (Core.Name (Strings.cat2 "v" (Literals.showInt32 i)))+ in (Core.TermApplication (Core.Application {+ Core.applicationFunction = body,+ Core.applicationArgument = (Core.TermVariable vn)}))) applied indices)+ in + let fullyApplied = (Maybes.maybe fullyAppliedRaw (\ct -> Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = fullyAppliedRaw,+ Core.annotatedTermAnnotation = (Maps.singleton (Core.Name "type") (Core_.type_ ct))})) codomainType)+ in + let indexedDomains = (Lists.zip indices domains)+ in (Lists.foldl (\body -> \idPair -> + let i = (Pairs.first idPair)+ in + let dom = (Pairs.second idPair)+ in + let vn = (Core.Name (Strings.cat2 "v" (Literals.showInt32 i)))+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = vn,+ Core.lambdaDomain = dom,+ Core.lambdaBody = body})))) fullyApplied (Lists.reverse indexedDomains))) applied))+ in + let rewriteWithArgs = (\args -> \tx -> \term -> + let recurse = (\tx1 -> \term1 -> rewriteWithArgs [] tx1 term1)+ in + let termHeadType = (\tx2 -> \trm2 -> (\x -> case x of+ Core.TermAnnotated v1 -> (termHeadType tx2 (Core.annotatedTermBody v1))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionPrimitive v2 -> (Maybes.map (\ts2 -> Core.typeSchemeType ts2) (Maps.lookup v2 (Typing.inferenceContextPrimitiveTypes (Typing.typeContextInferenceContext tx2))))+ _ -> Nothing) v1)+ Core.TermLet v1 -> (termHeadType (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) tx2 v1) (Core.letBody v1))+ Core.TermTypeLambda v1 -> (termHeadType (Schemas.extendTypeContextForTypeLambda tx2 v1) (Core.typeLambdaBody v1))+ Core.TermTypeApplication v1 -> (Maybes.bind (termHeadType tx2 (Core.typeApplicationTermBody v1)) (\htyp2 -> (\x -> case x of+ Core.TypeForall v2 -> (Just (Rewriting.replaceFreeTypeVariable (Core.forallTypeParameter v2) (Core.typeApplicationTermType v1) (Core.forallTypeBody v2)))+ _ -> (Just htyp2)) htyp2))+ Core.TermVariable v1 -> (Maps.lookup v1 (Typing.typeContextTypes tx2))+ _ -> Nothing) trm2)+ in + let afterRecursion = (\trm -> + let arity = (termArityWithContext tx trm)+ in + let hType = (termHeadType tx trm)+ in (expand False args arity hType trm))+ in + let forField = (\f -> Core.Field {+ Core.fieldName = (Core.fieldName f),+ Core.fieldTerm = (recurse tx (Core.fieldTerm f))})+ in + let forCaseBranch = (\f -> + let branchBody = (recurse tx (Core.fieldTerm f))+ in + let arty = (termArityWithContext tx branchBody)+ in + let branchHType = (termHeadType tx branchBody)+ in Core.Field {+ Core.fieldName = (Core.fieldName f),+ Core.fieldTerm = (expand True [] arty branchHType branchBody)})+ in + let forElimination = (\elm -> (\x -> case x of+ Core.EliminationRecord v1 -> (Core.EliminationRecord v1)+ Core.EliminationUnion v1 -> (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map (\t1 -> recurse tx t1) (Core.caseStatementDefault v1)),+ Core.caseStatementCases = (Lists.map forCaseBranch (Core.caseStatementCases v1))}))+ Core.EliminationWrap v1 -> (Core.EliminationWrap v1)) elm)+ in + let forMap = (\mp -> + let forPair = (\pr -> (recurse tx (Pairs.first pr), (recurse tx (Pairs.second pr))))+ in (Maps.fromList (Lists.map forPair (Maps.toList mp))))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (afterRecursion (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (recurse tx (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)})))+ Core.TermApplication v1 -> + let rhs = (rewriteWithArgs [] tx (Core.applicationArgument v1))+ in (rewriteWithArgs (Lists.cons rhs args) tx (Core.applicationFunction v1))+ Core.TermEither v1 -> (afterRecursion (Core.TermEither (Eithers.either (\l -> Left (recurse tx l)) (\r -> Right (recurse tx r)) v1)))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> + let padElim = ((\x -> case x of+ Core.EliminationRecord _ -> False+ Core.EliminationUnion _ -> True+ Core.EliminationWrap _ -> False) v2)+ in + let elimTerm = (Core.TermFunction (Core.FunctionElimination (forElimination v2)))+ in + let elimHeadType = ((\x -> case x of+ Core.EliminationUnion v3 -> (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.caseStatementTypeName v3)),+ Core.functionTypeCodomain = Core.TypeUnit})))+ _ -> Nothing) v2)+ in (expand padElim args 1 elimHeadType elimTerm)+ Core.FunctionLambda v2 -> + let tx1 = (Schemas.extendTypeContextForLambda tx v2)+ in + let body = (rewriteWithArgs [] tx1 (Core.lambdaBody v2))+ in + let result = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = (Core.lambdaDomain v2),+ Core.lambdaBody = body})))+ in + let arty = (termArityWithContext tx result)+ in (expand False args arty Nothing result)+ Core.FunctionPrimitive v2 -> + let arty = (termArityWithContext tx term)+ in + let primType = (Maybes.map (\ts -> Core.typeSchemeType ts) (Maps.lookup v2 (Typing.inferenceContextPrimitiveTypes (Typing.typeContextInferenceContext tx))))+ in (expand False args arty primType term)) v1)+ Core.TermLet v1 -> + let tx1 = (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) tx v1)+ in + let mapBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (rewriteWithArgs [] tx1 (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in + let result = (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.map mapBinding (Core.letBindings v1)),+ Core.letBody = (rewriteWithArgs [] tx1 (Core.letBody v1))}))+ in (afterRecursion result)+ Core.TermList v1 -> (afterRecursion (Core.TermList (Lists.map (\el -> recurse tx el) v1)))+ Core.TermLiteral v1 -> (Core.TermLiteral v1)+ Core.TermMap v1 -> (afterRecursion (Core.TermMap (forMap v1)))+ Core.TermMaybe v1 -> (afterRecursion (Core.TermMaybe (Maybes.map (\v -> recurse tx v) v1)))+ Core.TermPair v1 -> (afterRecursion (Core.TermPair (recurse tx (Pairs.first v1), (recurse tx (Pairs.second v1)))))+ Core.TermRecord v1 -> (afterRecursion (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = (Lists.map forField (Core.recordFields v1))})))+ Core.TermSet v1 -> (afterRecursion (Core.TermSet (Sets.fromList (Lists.map (\el -> recurse tx el) (Sets.toList v1)))))+ Core.TermTypeApplication v1 -> (afterRecursion (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (recurse tx (Core.typeApplicationTermBody v1)),+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)})))+ Core.TermTypeLambda v1 -> + let tx1 = (Schemas.extendTypeContextForTypeLambda tx v1)+ in + let result = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (rewriteWithArgs [] tx1 (Core.typeLambdaBody v1))}))+ in (afterRecursion result)+ Core.TermUnion v1 -> (afterRecursion (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = (forField (Core.injectionField v1))})))+ Core.TermUnit -> Core.TermUnit+ Core.TermVariable v1 -> + let arty = (termArityWithContext tx term)+ in + let varType = (Maps.lookup v1 (Typing.typeContextTypes tx))+ in (expand False args arty varType term)+ Core.TermWrap v1 -> (afterRecursion (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = (recurse tx (Core.wrappedTermBody v1))})))) term))+ in (contractTerm (rewriteWithArgs [] tx0 term0))++-- | Calculate the arity for eta expansion Note: this is a "trusty" function which assumes the graph is well-formed, i.e. no dangling references.+etaExpansionArity :: (Graph.Graph -> Core.Term -> Int)+etaExpansionArity graph term = ((\x -> case x of+ Core.TermAnnotated v1 -> (etaExpansionArity graph (Core.annotatedTermBody v1))+ Core.TermApplication v1 -> (Math.sub (etaExpansionArity graph (Core.applicationFunction v1)) 1) Core.TermFunction v1 -> ((\x -> case x of Core.FunctionElimination _ -> 1 Core.FunctionLambda _ -> 0- Core.FunctionPrimitive v2 -> (Arity.primitiveArity (Optionals.fromJust (Lexical.lookupPrimitive graph v2)))) v1)- Core.TermTypeLambda v1 -> (expansionArity graph (Core.typeLambdaBody v1))- Core.TermTypeApplication v1 -> (expansionArity graph (Core.typedTermTerm v1))- Core.TermVariable v1 -> (Optionals.maybe 0 (\ts -> Arity.typeArity (Core.typeSchemeType ts)) (Optionals.bind (Lexical.lookupElement graph v1) (\el -> Core.bindingType el)))- _ -> 0) (Rewriting.deannotateTerm term))+ Core.FunctionPrimitive v2 -> (Arity.primitiveArity (Maybes.fromJust (Lexical.lookupPrimitive graph v2)))) v1)+ Core.TermTypeLambda v1 -> (etaExpansionArity graph (Core.typeLambdaBody v1))+ Core.TermTypeApplication v1 -> (etaExpansionArity graph (Core.typeApplicationTermBody v1))+ Core.TermVariable v1 -> (Maybes.maybe 0 (\ts -> Arity.typeArity (Core.typeSchemeType ts)) (Maybes.bind (Lexical.lookupElement graph v1) (\b -> Core.bindingType b)))+ _ -> 0) term) +-- | Recursively transform arbitrary terms like 'add 42' into terms like '\x.add 42 x', eliminating partial application. Variable references are not expanded. This is useful for targets like Python with weaker support for currying than Hydra or Haskell. Note: this is a "trusty" function which assumes the graph is well-formed, i.e. no dangling references. It also assumes that type inference has already been performed. After eta expansion, type inference needs to be performed again, as new, untyped lambdas may have been added.+etaExpandTypedTerm :: (Typing.TypeContext -> Core.Term -> Compute.Flow t0 Core.Term)+etaExpandTypedTerm tx0 term0 = + let rewrite = (\topLevel -> \forced -> \typeArgs -> \recurse -> \tx -> \term -> + let rewriteSpine = (\term -> (\x -> case x of+ Core.TermAnnotated v1 -> (Flows.bind (rewriteSpine (Core.annotatedTermBody v1)) (\body -> + let ann = (Core.annotatedTermAnnotation v1)+ in (Flows.pure (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = body,+ Core.annotatedTermAnnotation = ann})))))+ Core.TermApplication v1 -> + let l = (Logic.ifElse False [+ Core.TypeLiteral Core.LiteralTypeString] [])+ in (Flows.bind (rewriteSpine (Core.applicationFunction v1)) (\lhs -> Flows.bind (rewrite True False l recurse tx (Core.applicationArgument v1)) (\rhs -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs,+ Core.applicationArgument = rhs})))))+ Core.TermTypeApplication v1 -> (Flows.bind (rewriteSpine (Core.typeApplicationTermBody v1)) (\body -> + let typ = (Core.typeApplicationTermType v1)+ in (Flows.pure (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = body,+ Core.typeApplicationTermType = typ})))))+ _ -> (rewrite False False [] recurse tx term)) term)+ in + let arityOf = (\tx -> \term -> + let dflt = (Flows.map Arity.typeArity (Checking.typeOf tx [] term))+ in + let forFunction = (\tx -> \f -> (\x -> case x of+ Core.FunctionElimination _ -> (Flows.pure 1)+ Core.FunctionLambda v1 -> + let txl = (Schemas.extendTypeContextForLambda tx v1)+ in (arityOf txl (Core.lambdaBody v1))+ Core.FunctionPrimitive v1 -> (Flows.map Arity.typeSchemeArity (Lexical.requirePrimitiveType tx v1))) f)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (arityOf tx (Core.annotatedTermBody v1))+ Core.TermFunction v1 -> (forFunction tx v1)+ Core.TermLet v1 -> + let txl = (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) tx v1)+ in (arityOf txl (Core.letBody v1))+ Core.TermTypeApplication v1 -> (arityOf tx (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> + let txt = (Schemas.extendTypeContextForTypeLambda tx v1)+ in (arityOf txt (Core.typeLambdaBody v1))+ Core.TermVariable v1 -> (Maybes.maybe (Flows.map Arity.typeArity (Checking.typeOf tx [] (Core.TermVariable v1))) (\t -> Flows.pure (Arity.typeArity t)) (Maps.lookup v1 (Typing.typeContextTypes tx)))+ _ -> dflt) term))+ in + let extraVariables = (\n -> Lists.map (\i -> Core.Name (Strings.cat2 "v" (Literals.showInt32 i))) (Math.range 1 n))+ in + let pad = (\vars -> \body -> Logic.ifElse (Lists.null vars) body (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Lists.head vars),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (pad (Lists.tail vars) (Core.TermApplication (Core.Application {+ Core.applicationFunction = body,+ Core.applicationArgument = (Core.TermVariable (Lists.head vars))})))}))))+ in + let padn = (\n -> \body -> pad (extraVariables n) body)+ in + let unwind = (\term -> Lists.foldl (\e -> \t -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = e,+ Core.typeApplicationTermType = t})) term typeArgs)+ in + let forceExpansion = (\t -> Flows.bind (Checking.typeOf tx [] t) (\typ -> + let arity = (Arity.typeArity typ)+ in (Flows.pure (padn arity (unwind t)))))+ in + let recurseOrForce = (\term -> Logic.ifElse forced (forceExpansion term) (recurse tx (unwind term)))+ in + let forCase = (\f -> Flows.bind (rewrite False True [] recurse tx (Core.fieldTerm f)) (\r -> Flows.pure (Core.Field {+ Core.fieldName = (Core.fieldName f),+ Core.fieldTerm = r})))+ in + let forCaseStatement = (\cs -> + let tname = (Core.caseStatementTypeName cs)+ in + let dflt = (Core.caseStatementDefault cs)+ in + let cases = (Core.caseStatementCases cs)+ in (Flows.bind (Flows.mapMaybe (rewrite False False [] recurse tx) dflt) (\rdflt -> Flows.bind (Flows.mapList forCase cases) (\rcases -> Flows.pure (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = tname,+ Core.caseStatementDefault = rdflt,+ Core.caseStatementCases = rcases}))))))))+ in + let forElimination = (\elm -> + let checkBase = (\elm -> (\x -> case x of+ Core.EliminationUnion v1 -> (forCaseStatement v1)+ _ -> (recurse tx term)) elm)+ in (Flows.bind (Flows.map unwind (checkBase elm)) (\base -> Flows.pure (Logic.ifElse (Logic.or topLevel forced) (padn 1 base) base))))+ in ((\x -> case x of+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in (Flows.bind (rewrite True False [] recurse tx rhs) (\rhs2 -> Flows.bind (arityOf tx lhs) (\lhsarity -> Flows.bind (rewriteSpine lhs) (\lhs2 -> + let a2 = (Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs2,+ Core.applicationArgument = rhs2}))+ in (Flows.pure (Logic.ifElse (Equality.gt lhsarity 1) (padn (Math.sub lhsarity 1) a2) a2))))))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> (forElimination v2)+ Core.FunctionLambda v2 -> + let txl = (Schemas.extendTypeContextForLambda tx v2)+ in (Flows.map unwind (recurse txl term))+ _ -> (recurseOrForce term)) v1)+ Core.TermLet v1 -> + let txlt = (Schemas.extendTypeContextForLet (\_ -> \_ -> Nothing) tx v1)+ in (recurse txlt term)+ Core.TermTypeApplication v1 -> (rewrite topLevel forced (Lists.cons (Core.typeApplicationTermType v1) typeArgs) recurse tx (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> + let txt = (Schemas.extendTypeContextForTypeLambda tx v1)+ in (recurse txt term)+ _ -> (recurseOrForce term)) term))+ in (Rewriting.rewriteTermWithContextM (rewrite True False []) tx0 term0)+ -- | A term evaluation function which is alternatively lazy or eager reduceTerm :: (Bool -> Core.Term -> Compute.Flow Graph.Graph Core.Term) reduceTerm eager term = - let reduce = (\eager -> reduceTerm eager) - doRecurse = (\eager -> \term -> Logic.and eager ((\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda _ -> False- _ -> True) v1)- _ -> True) term))- reduceArg = (\eager -> \arg -> Logic.ifElse eager (Flows.pure arg) (reduce False arg))- applyToArguments = (\fun -> \args -> Logic.ifElse (Lists.null args) fun (applyToArguments (Core.TermApplication (Core.Application {- Core.applicationFunction = fun,- Core.applicationArgument = (Lists.head args)})) (Lists.tail args)))- replaceFreeTypeVariable = (\toReplace -> \replacement -> \term -> - let mapping = (\recurse -> \inner -> (\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Logic.ifElse (Equality.equal (Core.lambdaParameter v2) toReplace) inner (recurse inner))- _ -> (recurse inner)) v1)- Core.TermVariable v1 -> (Logic.ifElse (Equality.equal v1 toReplace) replacement inner)- _ -> (recurse inner)) inner)- in (Rewriting.rewriteTerm mapping term))- applyElimination = (\elm -> \reducedArg -> (\x -> case x of- Core.EliminationRecord v1 -> (Flows.bind (Core_.record (Core.projectionTypeName v1) (Rewriting.deannotateTerm reducedArg)) (\fields -> - let matchingFields = (Lists.filter (\f -> Equality.equal (Core.fieldName f) (Core.projectionField v1)) fields)- in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat [- "no such field: ",- Core.unName (Core.projectionField v1),- " in ",- Core.unName (Core.projectionTypeName v1),- " record"])) (Flows.pure (Core.fieldTerm (Lists.head matchingFields))))))- Core.EliminationUnion v1 -> (Flows.bind (Core_.injection (Core.caseStatementTypeName v1) reducedArg) (\field -> - let matchingFields = (Lists.filter (\f -> Equality.equal (Core.fieldName f) (Core.fieldName field)) (Core.caseStatementCases v1))- in (Logic.ifElse (Lists.null matchingFields) (Optionals.maybe (Flows.fail (Strings.cat [- "no such field ",- Core.unName (Core.fieldName field),- " in ",- Core.unName (Core.caseStatementTypeName v1),- " case statement"])) Flows.pure (Core.caseStatementDefault v1)) (Flows.pure (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.fieldTerm (Lists.head matchingFields)),- Core.applicationArgument = (Core.fieldTerm field)}))))))- Core.EliminationWrap v1 -> (Core_.wrap v1 reducedArg)) elm)- applyIfNullary = (\eager -> \original -> \args -> - let stripped = (Rewriting.deannotateTerm original)- in ((\x -> case x of- Core.TermApplication v1 -> (applyIfNullary eager (Core.applicationFunction v1) (Lists.cons (Core.applicationArgument v1) args))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> (Logic.ifElse (Lists.null args) (Flows.pure original) ( - let arg = (Lists.head args) - remainingArgs = (Lists.tail args)- in (Flows.bind (reduceArg eager (Rewriting.deannotateTerm arg)) (\reducedArg -> Flows.bind (Flows.bind (applyElimination v2 reducedArg) (reduce eager)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs)))))- Core.FunctionLambda v2 -> (Logic.ifElse (Lists.null args) (Flows.pure original) ( - let param = (Core.lambdaParameter v2) - body = (Core.lambdaBody v2)- arg = (Lists.head args)- remainingArgs = (Lists.tail args)- in (Flows.bind (reduce eager (Rewriting.deannotateTerm arg)) (\reducedArg -> Flows.bind (reduce eager (replaceFreeTypeVariable param reducedArg body)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs)))))- Core.FunctionPrimitive v2 -> (Flows.bind (Lexical.requirePrimitive v2) (\prim -> - let arity = (Arity.primitiveArity prim)- in (Logic.ifElse (Equality.gt arity (Lists.length args)) (Flows.pure (applyToArguments original args)) ( - let argList = (Lists.take arity args) - remainingArgs = (Lists.drop arity args)- in (Flows.bind (Flows.mapList (reduceArg eager) argList) (\reducedArgs -> Flows.bind (Flows.bind (Graph.primitiveImplementation prim reducedArgs) (reduce eager)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs)))))))) v1)- Core.TermVariable _ -> (Flows.pure (applyToArguments original args))- _ -> (Flows.pure (applyToArguments original args))) stripped))- mapping = (\recurse -> \mid -> Flows.bind (Logic.ifElse (doRecurse eager mid) (recurse mid) (Flows.pure mid)) (\inner -> applyIfNullary eager inner []))- in (Rewriting.rewriteTermM mapping term)+ let reduce = (\eager -> reduceTerm eager)+ in + let doRecurse = (\eager -> \term -> + let isNonLambda = (\f -> (\x -> case x of+ Core.FunctionLambda _ -> False+ _ -> True) f)+ in + let isNonLambdaTerm = ((\x -> case x of+ Core.TermFunction v1 -> (isNonLambda v1)+ Core.TermLet _ -> False+ _ -> True) term)+ in (Logic.and eager isNonLambdaTerm))+ in + let reduceArg = (\eager -> \arg -> Logic.ifElse eager (Flows.pure arg) (reduce False arg))+ in + let applyToArguments = (\fun -> \args -> Logic.ifElse (Lists.null args) fun (applyToArguments (Core.TermApplication (Core.Application {+ Core.applicationFunction = fun,+ Core.applicationArgument = (Lists.head args)})) (Lists.tail args)))+ in + let applyElimination = (\elm -> \reducedArg -> (\x -> case x of+ Core.EliminationRecord v1 -> (Flows.bind (Core__.record (Core.projectionTypeName v1) (Rewriting.deannotateTerm reducedArg)) (\fields -> + let matchingFields = (Lists.filter (\f -> Equality.equal (Core.fieldName f) (Core.projectionField v1)) fields)+ in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat [+ "no such field: ",+ (Core.unName (Core.projectionField v1)),+ " in ",+ (Core.unName (Core.projectionTypeName v1)),+ " record"])) (Flows.pure (Core.fieldTerm (Lists.head matchingFields))))))+ Core.EliminationUnion v1 -> (Flows.bind (Core__.injection (Core.caseStatementTypeName v1) reducedArg) (\field -> + let matchingFields = (Lists.filter (\f -> Equality.equal (Core.fieldName f) (Core.fieldName field)) (Core.caseStatementCases v1))+ in (Logic.ifElse (Lists.null matchingFields) (Maybes.maybe (Flows.fail (Strings.cat [+ "no such field ",+ (Core.unName (Core.fieldName field)),+ " in ",+ (Core.unName (Core.caseStatementTypeName v1)),+ " case statement"])) Flows.pure (Core.caseStatementDefault v1)) (Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.fieldTerm (Lists.head matchingFields)),+ Core.applicationArgument = (Core.fieldTerm field)}))))))+ Core.EliminationWrap v1 -> (Core__.wrap v1 reducedArg)) elm)+ in + let applyIfNullary = (\eager -> \original -> \args -> + let stripped = (Rewriting.deannotateTerm original)+ in + let forElimination = (\elm -> \args -> + let arg = (Lists.head args)+ in + let remainingArgs = (Lists.tail args)+ in (Flows.bind (reduceArg eager (Rewriting.deannotateTerm arg)) (\reducedArg -> Flows.bind (Flows.bind (applyElimination elm reducedArg) (reduce eager)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs))))+ in + let forLambda = (\l -> \args -> + let param = (Core.lambdaParameter l)+ in + let body = (Core.lambdaBody l)+ in + let arg = (Lists.head args)+ in + let remainingArgs = (Lists.tail args)+ in (Flows.bind (reduce eager (Rewriting.deannotateTerm arg)) (\reducedArg -> Flows.bind (reduce eager (Rewriting.replaceFreeTermVariable param reducedArg body)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs))))+ in + let forPrimitive = (\prim -> \arity -> \args -> + let argList = (Lists.take arity args)+ in + let remainingArgs = (Lists.drop arity args)+ in (Flows.bind (Flows.mapList (reduceArg eager) argList) (\reducedArgs -> + let strippedArgs = (Lists.map Rewriting.deannotateTerm reducedArgs)+ in (Flows.bind (Flows.bind (Graph.primitiveImplementation prim strippedArgs) (reduce eager)) (\reducedResult -> applyIfNullary eager reducedResult remainingArgs)))))+ in ((\x -> case x of+ Core.TermApplication v1 -> (applyIfNullary eager (Core.applicationFunction v1) (Lists.cons (Core.applicationArgument v1) args))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> (Logic.ifElse (Lists.null args) (Flows.pure original) (forElimination v2 args))+ Core.FunctionLambda v2 -> (Logic.ifElse (Lists.null args) (Flows.pure original) (forLambda v2 args))+ Core.FunctionPrimitive v2 -> (Flows.bind (Lexical.requirePrimitive v2) (\prim -> + let arity = (Arity.primitiveArity prim)+ in (Logic.ifElse (Equality.gt arity (Lists.length args)) (Flows.pure (applyToArguments original args)) (forPrimitive prim arity args))))) v1)+ Core.TermVariable v1 -> (Flows.bind (Lexical.dereferenceElement v1) (\mBinding -> Maybes.maybe (Flows.pure (applyToArguments original args)) (\binding -> applyIfNullary eager (Core.bindingTerm binding) args) mBinding))+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1)+ in + let body = (Core.letBody v1)+ in + let letExpr = (\b -> Core.TermLet (Core.Let {+ Core.letBindings = [+ b],+ Core.letBody = (Core.TermVariable (Core.bindingName b))}))+ in + let expandBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Rewriting.replaceFreeTermVariable (Core.bindingName b) (letExpr b) (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in + let expandedBindings = (Lists.map expandBinding bindings)+ in + let substituteBinding = (\term -> \b -> Rewriting.replaceFreeTermVariable (Core.bindingName b) (Core.bindingTerm b) term)+ in + let substituteAll = (\bs -> \term -> Lists.foldl substituteBinding term bs)+ in + let expandedBody = (substituteAll expandedBindings body)+ in (Flows.bind (reduce eager expandedBody) (\reducedBody -> applyIfNullary eager reducedBody args))+ _ -> (Flows.pure (applyToArguments original args))) stripped))+ in + let mapping = (\recurse -> \mid -> Flows.bind (Logic.ifElse (doRecurse eager mid) (recurse mid) (Flows.pure mid)) (\inner -> applyIfNullary eager inner []))+ in (Rewriting.rewriteTermM mapping term) -- | Whether a term is closed, i.e. represents a complete program termIsClosed :: (Core.Term -> Bool) termIsClosed term = (Sets.null (Rewriting.freeVariablesInTerm term)) +-- | Whether a term has been fully reduced to a value termIsValue :: (t0 -> Core.Term -> Bool) termIsValue g term = - let forList = (\els -> Lists.foldl (\b -> \t -> Logic.and b (termIsValue g t)) True els) - checkField = (\f -> termIsValue g (Core.fieldTerm f))- checkFields = (\fields -> Lists.foldl (\b -> \f -> Logic.and b (checkField f)) True fields)- functionIsValue = (\f -> (\x -> case x of- Core.FunctionElimination v1 -> ((\x -> case x of- Core.EliminationWrap _ -> True- Core.EliminationRecord _ -> True- Core.EliminationUnion v2 -> (Logic.and (checkFields (Core.caseStatementCases v2)) (Optionals.maybe True (termIsValue g) (Core.caseStatementDefault v2)))) v1)- Core.FunctionLambda v1 -> (termIsValue g (Core.lambdaBody v1))- Core.FunctionPrimitive _ -> True) f)- in ((\x -> case x of- Core.TermApplication _ -> False- Core.TermLiteral _ -> True- Core.TermFunction v1 -> (functionIsValue v1)- Core.TermList v1 -> (forList v1)- Core.TermMap v1 -> (Lists.foldl (\b -> \kv -> Logic.and b (Logic.and (termIsValue g (fst kv)) (termIsValue g (snd kv)))) True (Maps.toList v1))- Core.TermOptional v1 -> (Optionals.maybe True (termIsValue g) v1)- Core.TermRecord v1 -> (checkFields (Core.recordFields v1))- Core.TermSet v1 -> (forList (Sets.toList v1))- Core.TermUnion v1 -> (checkField (Core.injectionField v1))- Core.TermUnit -> True- Core.TermVariable _ -> False- _ -> False) (Rewriting.deannotateTerm term))+ let forList = (\els -> Lists.foldl (\b -> \t -> Logic.and b (termIsValue g t)) True els)+ in + let checkField = (\f -> termIsValue g (Core.fieldTerm f))+ in + let checkFields = (\fields -> Lists.foldl (\b -> \f -> Logic.and b (checkField f)) True fields)+ in + let functionIsValue = (\f -> (\x -> case x of+ Core.FunctionElimination v1 -> ((\x -> case x of+ Core.EliminationWrap _ -> True+ Core.EliminationRecord _ -> True+ Core.EliminationUnion v2 -> (Logic.and (checkFields (Core.caseStatementCases v2)) (Maybes.maybe True (termIsValue g) (Core.caseStatementDefault v2)))) v1)+ Core.FunctionLambda v1 -> (termIsValue g (Core.lambdaBody v1))+ Core.FunctionPrimitive _ -> True) f)+ in ((\x -> case x of+ Core.TermApplication _ -> False+ Core.TermEither v1 -> (Eithers.either (\l -> termIsValue g l) (\r -> termIsValue g r) v1)+ Core.TermLiteral _ -> True+ Core.TermFunction v1 -> (functionIsValue v1)+ Core.TermList v1 -> (forList v1)+ Core.TermMap v1 -> (Lists.foldl (\b -> \kv -> Logic.and b (Logic.and (termIsValue g (Pairs.first kv)) (termIsValue g (Pairs.second kv)))) True (Maps.toList v1))+ Core.TermMaybe v1 -> (Maybes.maybe True (termIsValue g) v1)+ Core.TermRecord v1 -> (checkFields (Core.recordFields v1))+ Core.TermSet v1 -> (forList (Sets.toList v1))+ Core.TermUnion v1 -> (checkField (Core.injectionField v1))+ Core.TermUnit -> True+ Core.TermVariable _ -> False+ _ -> False) (Rewriting.deannotateTerm term))
+ src/gen-main/haskell/Hydra/Reflect.hs view
@@ -0,0 +1,242 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Reflection functions for working with term, type, and literal type variants, as well as numeric precision.++module Hydra.Reflect where++import qualified Hydra.Core as Core+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Util as Util+import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Find the elimination inject (constructor) for a given elimination term+eliminationVariant :: (Core.Elimination -> Variants.EliminationVariant)+eliminationVariant x = case x of+ Core.EliminationRecord _ -> Variants.EliminationVariantRecord+ Core.EliminationUnion _ -> Variants.EliminationVariantUnion+ Core.EliminationWrap _ -> Variants.EliminationVariantWrap++-- | All elimination variants (constructors), in a canonical order+eliminationVariants :: [Variants.EliminationVariant]+eliminationVariants = [+ Variants.EliminationVariantRecord,+ Variants.EliminationVariantUnion,+ Variants.EliminationVariantWrap]++-- | Find the precision of a given floating-point type+floatTypePrecision :: (Core.FloatType -> Util.Precision)+floatTypePrecision x = case x of+ Core.FloatTypeBigfloat -> Util.PrecisionArbitrary+ Core.FloatTypeFloat32 -> (Util.PrecisionBits 32)+ Core.FloatTypeFloat64 -> (Util.PrecisionBits 64)++-- | All floating-point types in a canonical order+floatTypes :: [Core.FloatType]+floatTypes = [+ Core.FloatTypeBigfloat,+ Core.FloatTypeFloat32,+ Core.FloatTypeFloat64]++-- | Find the float type for a given floating-point value+floatValueType :: (Core.FloatValue -> Core.FloatType)+floatValueType x = case x of+ Core.FloatValueBigfloat _ -> Core.FloatTypeBigfloat+ Core.FloatValueFloat32 _ -> Core.FloatTypeFloat32+ Core.FloatValueFloat64 _ -> Core.FloatTypeFloat64++-- | Find the function inject (constructor) for a given function+functionVariant :: (Core.Function -> Variants.FunctionVariant)+functionVariant x = case x of+ Core.FunctionElimination _ -> Variants.FunctionVariantElimination+ Core.FunctionLambda _ -> Variants.FunctionVariantLambda+ Core.FunctionPrimitive _ -> Variants.FunctionVariantPrimitive++-- | All function variants (constructors), in a canonical order+functionVariants :: [Variants.FunctionVariant]+functionVariants = [+ Variants.FunctionVariantElimination,+ Variants.FunctionVariantLambda,+ Variants.FunctionVariantPrimitive]++-- | Find whether a given integer type is signed (true) or unsigned (false)+integerTypeIsSigned :: (Core.IntegerType -> Bool)+integerTypeIsSigned x = case x of+ Core.IntegerTypeBigint -> True+ Core.IntegerTypeInt8 -> True+ Core.IntegerTypeInt16 -> True+ Core.IntegerTypeInt32 -> True+ Core.IntegerTypeInt64 -> True+ Core.IntegerTypeUint8 -> False+ Core.IntegerTypeUint16 -> False+ Core.IntegerTypeUint32 -> False+ Core.IntegerTypeUint64 -> False++-- | Find the precision of a given integer type+integerTypePrecision :: (Core.IntegerType -> Util.Precision)+integerTypePrecision x = case x of+ Core.IntegerTypeBigint -> Util.PrecisionArbitrary+ Core.IntegerTypeInt8 -> (Util.PrecisionBits 8)+ Core.IntegerTypeInt16 -> (Util.PrecisionBits 16)+ Core.IntegerTypeInt32 -> (Util.PrecisionBits 32)+ Core.IntegerTypeInt64 -> (Util.PrecisionBits 64)+ Core.IntegerTypeUint8 -> (Util.PrecisionBits 8)+ Core.IntegerTypeUint16 -> (Util.PrecisionBits 16)+ Core.IntegerTypeUint32 -> (Util.PrecisionBits 32)+ Core.IntegerTypeUint64 -> (Util.PrecisionBits 64)++-- | All integer types, in a canonical order+integerTypes :: [Core.IntegerType]+integerTypes = [+ Core.IntegerTypeBigint,+ Core.IntegerTypeInt8,+ Core.IntegerTypeInt16,+ Core.IntegerTypeInt32,+ Core.IntegerTypeInt64,+ Core.IntegerTypeUint8,+ Core.IntegerTypeUint16,+ Core.IntegerTypeUint32,+ Core.IntegerTypeUint64]++-- | Find the integer type for a given integer value+integerValueType :: (Core.IntegerValue -> Core.IntegerType)+integerValueType x = case x of+ Core.IntegerValueBigint _ -> Core.IntegerTypeBigint+ Core.IntegerValueInt8 _ -> Core.IntegerTypeInt8+ Core.IntegerValueInt16 _ -> Core.IntegerTypeInt16+ Core.IntegerValueInt32 _ -> Core.IntegerTypeInt32+ Core.IntegerValueInt64 _ -> Core.IntegerTypeInt64+ Core.IntegerValueUint8 _ -> Core.IntegerTypeUint8+ Core.IntegerValueUint16 _ -> Core.IntegerTypeUint16+ Core.IntegerValueUint32 _ -> Core.IntegerTypeUint32+ Core.IntegerValueUint64 _ -> Core.IntegerTypeUint64++-- | Find the literal type for a given literal value+literalType :: (Core.Literal -> Core.LiteralType)+literalType x = case x of+ Core.LiteralBinary _ -> Core.LiteralTypeBinary+ Core.LiteralBoolean _ -> Core.LiteralTypeBoolean+ Core.LiteralFloat v1 -> ((\injected_ -> Core.LiteralTypeFloat injected_) (floatValueType v1))+ Core.LiteralInteger v1 -> ((\injected_ -> Core.LiteralTypeInteger injected_) (integerValueType v1))+ Core.LiteralString _ -> Core.LiteralTypeString++-- | Find the literal type inject (constructor) for a given literal value+literalTypeVariant :: (Core.LiteralType -> Variants.LiteralVariant)+literalTypeVariant x = case x of+ Core.LiteralTypeBinary -> Variants.LiteralVariantBinary+ Core.LiteralTypeBoolean -> Variants.LiteralVariantBoolean+ Core.LiteralTypeFloat _ -> Variants.LiteralVariantFloat+ Core.LiteralTypeInteger _ -> Variants.LiteralVariantInteger+ Core.LiteralTypeString -> Variants.LiteralVariantString++-- | All literal types, in a canonical order+literalTypes :: [Core.LiteralType]+literalTypes = (Lists.concat [+ [+ Core.LiteralTypeBinary,+ Core.LiteralTypeBoolean],+ (Lists.map (\x -> Core.LiteralTypeFloat x) floatTypes),+ (Lists.map (\x -> Core.LiteralTypeInteger x) integerTypes),+ [+ Core.LiteralTypeString]])++-- | Find the literal inject (constructor) for a given literal value+literalVariant :: (Core.Literal -> Variants.LiteralVariant)+literalVariant arg_ = (literalTypeVariant (literalType arg_))++-- | All literal variants, in a canonical order+literalVariants :: [Variants.LiteralVariant]+literalVariants = [+ Variants.LiteralVariantBinary,+ Variants.LiteralVariantBoolean,+ Variants.LiteralVariantFloat,+ Variants.LiteralVariantInteger,+ Variants.LiteralVariantString]++-- | Find the term inject (constructor) for a given term+termVariant :: (Core.Term -> Variants.TermVariant)+termVariant x = case x of+ Core.TermAnnotated _ -> Variants.TermVariantAnnotated+ Core.TermApplication _ -> Variants.TermVariantApplication+ Core.TermEither _ -> Variants.TermVariantEither+ Core.TermFunction _ -> Variants.TermVariantFunction+ Core.TermLet _ -> Variants.TermVariantLet+ Core.TermList _ -> Variants.TermVariantList+ Core.TermLiteral _ -> Variants.TermVariantLiteral+ Core.TermMap _ -> Variants.TermVariantMap+ Core.TermMaybe _ -> Variants.TermVariantMaybe+ Core.TermPair _ -> Variants.TermVariantPair+ Core.TermRecord _ -> Variants.TermVariantRecord+ Core.TermSet _ -> Variants.TermVariantSet+ Core.TermTypeApplication _ -> Variants.TermVariantTypeApplication+ Core.TermTypeLambda _ -> Variants.TermVariantTypeLambda+ Core.TermUnion _ -> Variants.TermVariantUnion+ Core.TermUnit -> Variants.TermVariantUnit+ Core.TermVariable _ -> Variants.TermVariantVariable+ Core.TermWrap _ -> Variants.TermVariantWrap++-- | All term (expression) variants, in a canonical order+termVariants :: [Variants.TermVariant]+termVariants = [+ Variants.TermVariantAnnotated,+ Variants.TermVariantApplication,+ Variants.TermVariantEither,+ Variants.TermVariantFunction,+ Variants.TermVariantList,+ Variants.TermVariantLiteral,+ Variants.TermVariantMap,+ Variants.TermVariantMaybe,+ Variants.TermVariantPair,+ Variants.TermVariantRecord,+ Variants.TermVariantSet,+ Variants.TermVariantTypeLambda,+ Variants.TermVariantTypeApplication,+ Variants.TermVariantUnion,+ Variants.TermVariantUnit,+ Variants.TermVariantVariable,+ Variants.TermVariantWrap]++-- | Find the type inject (constructor) for a given type+typeVariant :: (Core.Type -> Variants.TypeVariant)+typeVariant x = case x of+ Core.TypeAnnotated _ -> Variants.TypeVariantAnnotated+ Core.TypeApplication _ -> Variants.TypeVariantApplication+ Core.TypeEither _ -> Variants.TypeVariantEither+ Core.TypeFunction _ -> Variants.TypeVariantFunction+ Core.TypeForall _ -> Variants.TypeVariantForall+ Core.TypeList _ -> Variants.TypeVariantList+ Core.TypeLiteral _ -> Variants.TypeVariantLiteral+ Core.TypeMap _ -> Variants.TypeVariantMap+ Core.TypeMaybe _ -> Variants.TypeVariantMaybe+ Core.TypePair _ -> Variants.TypeVariantPair+ Core.TypeRecord _ -> Variants.TypeVariantRecord+ Core.TypeSet _ -> Variants.TypeVariantSet+ Core.TypeUnion _ -> Variants.TypeVariantUnion+ Core.TypeUnit -> Variants.TypeVariantUnit+ Core.TypeVariable _ -> Variants.TypeVariantVariable+ Core.TypeWrap _ -> Variants.TypeVariantWrap++-- | All type variants, in a canonical order+typeVariants :: [Variants.TypeVariant]+typeVariants = [+ Variants.TypeVariantAnnotated,+ Variants.TypeVariantApplication,+ Variants.TypeVariantEither,+ Variants.TypeVariantFunction,+ Variants.TypeVariantForall,+ Variants.TypeVariantList,+ Variants.TypeVariantLiteral,+ Variants.TypeVariantMap,+ Variants.TypeVariantWrap,+ Variants.TypeVariantMaybe,+ Variants.TypeVariantPair,+ Variants.TypeVariantRecord,+ Variants.TypeVariantSet,+ Variants.TypeVariantUnion,+ Variants.TypeVariantUnit,+ Variants.TypeVariantVariable]
src/gen-main/haskell/Hydra/Relational.hs view
@@ -1,9 +1,12 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | An interpretation of Codd's Relational Model, as described in 'A Relational Model of Data for Large Shared Data Banks' (1970). Types ('domains') and values are parameterized so as to allow for application-specific implementations. No special support is provided for 'nonsimple' domains; i.e. relations are assumed to be normalized. module Hydra.Relational where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M
src/gen-main/haskell/Hydra/Rewriting.hs view
@@ -1,916 +1,1729 @@--- | Utilities for type and term rewriting and analysis.--module Hydra.Rewriting where--import qualified Hydra.Accessors as Accessors-import qualified Hydra.Coders as Coders-import qualified Hydra.Compute as Compute-import qualified Hydra.Core as Core-import qualified Hydra.Lib.Equality as Equality-import qualified Hydra.Lib.Flows as Flows-import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Literals as Literals-import qualified Hydra.Lib.Logic as Logic-import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals-import qualified Hydra.Lib.Sets as Sets-import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import qualified Hydra.Names as Names-import qualified Hydra.Sorting as Sorting-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Strip type annotations from the top levels of a term-deannotateAndDetypeTerm :: (Core.Term -> Core.Term)-deannotateAndDetypeTerm t = ((\x -> case x of- Core.TermAnnotated v1 -> (deannotateAndDetypeTerm (Core.annotatedTermSubject v1))- Core.TermTypeApplication v1 -> (deannotateAndDetypeTerm (Core.typedTermTerm v1))- Core.TermTypeLambda v1 -> (deannotateAndDetypeTerm (Core.typeLambdaBody v1))- _ -> t) t)---- | Strip all annotations (including System F type annotations) from the top levels of a term-deannotateTerm :: (Core.Term -> Core.Term)-deannotateTerm t = ((\x -> case x of- Core.TermAnnotated v1 -> (deannotateTerm (Core.annotatedTermSubject v1))- _ -> t) t)---- | Strip all annotations from a term-deannotateType :: (Core.Type -> Core.Type)-deannotateType t = ((\x -> case x of- Core.TypeAnnotated v1 -> (deannotateType (Core.annotatedTypeSubject v1))- _ -> t) t)---- | Strip any top-level type lambdas from a type, extracting the (possibly nested) type body-deannotateTypeParameters :: (Core.Type -> Core.Type)-deannotateTypeParameters t = ((\x -> case x of- Core.TypeForall v1 -> (deannotateTypeParameters (Core.forallTypeBody v1))- _ -> t) (deannotateType t))---- | Recursively strip all annotations from a type-deannotateTypeRecursive :: (Core.Type -> Core.Type)-deannotateTypeRecursive typ = - let strip = (\recurse -> \typ -> - let rewritten = (recurse typ)- in ((\x -> case x of- Core.TypeAnnotated v1 -> (Core.annotatedTypeSubject v1)- _ -> rewritten) rewritten))- in (rewriteType strip typ)---- | Recursively strip all annotations from a type scheme-deannotateTypeSchemeRecursive :: (Core.TypeScheme -> Core.TypeScheme)-deannotateTypeSchemeRecursive ts = - let vars = (Core.typeSchemeVariables ts) - typ = (Core.typeSchemeType ts)- in Core.TypeScheme {- Core.typeSchemeVariables = vars,- Core.typeSchemeType = (deannotateTypeRecursive typ)}---- | A variation of expandLambdas which also attaches type annotations when padding function terms-expandTypedLambdas :: (Core.Term -> Core.Term)-expandTypedLambdas term = - let toNaryFunType = (\typ -> - let helper = (\t -> (\x -> case x of- Core.TypeFunction v1 -> - let dom0 = (Core.functionTypeDomain v1) - cod0 = (Core.functionTypeCodomain v1)- recursive = (helper cod0)- doms = (fst recursive)- cod1 = (snd recursive)- in (Lists.cons dom0 doms, cod1)- _ -> ([], t)) t)- in (helper (deannotateType typ))) - padTerm = (\i -> \doms -> \cod -> \term -> Logic.ifElse (Lists.null doms) term ( - let dom = (Lists.head doms) - var = (Core.Name (Strings.cat2 "v" (Literals.showInt32 i)))- tailDoms = (Lists.tail doms)- toFunctionType = (\doms -> \cod -> Lists.foldl (\c -> \d -> Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = d,- Core.functionTypeCodomain = c})) cod doms)- in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = var,- Core.lambdaDomain = (Just dom),- Core.lambdaBody = (padTerm (Math.add i 1) tailDoms cod (Core.TermApplication (Core.Application {- Core.applicationFunction = term,- Core.applicationArgument = (Core.TermVariable var)})))})))))- expand = (\doms -> \cod -> \term -> (\x -> case x of- Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (expand doms cod (Core.annotatedTermSubject v1)),- Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))- Core.TermApplication v1 -> - let lhs = (Core.applicationFunction v1) - rhs = (Core.applicationArgument v1)- in (rewriteTerm rewrite term)- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.lambdaParameter v2),- Core.lambdaDomain = (Core.lambdaDomain v2),- Core.lambdaBody = (expand (Lists.tail doms) cod (Core.lambdaBody v2))})))- _ -> (padTerm 1 doms cod term)) v1)- Core.TermLet v1 -> - let expandBinding = (\b -> Core.Binding {- Core.bindingName = (Core.bindingName b),- Core.bindingTerm = (expandTypedLambdas (Core.bindingTerm b)),- Core.bindingType = (Core.bindingType b)})- in (Core.TermLet (Core.Let {- Core.letBindings = (Lists.map expandBinding (Core.letBindings v1)),- Core.letEnvironment = (expand doms cod (Core.letEnvironment v1))}))- _ -> (rewriteTerm rewrite term)) term)- rewrite = (\recurse -> \term -> recurse term)- in (rewriteTerm rewrite term)---- | Flatten nested let expressions-flattenLetTerms :: (Core.Term -> Core.Term)-flattenLetTerms term = - let rewriteBinding = (\binding -> - let key0 = (Core.bindingName binding) - val0 = (Core.bindingTerm binding)- t = (Core.bindingType binding)- in ((\x -> case x of- Core.TermAnnotated v1 -> - let val1 = (Core.annotatedTermSubject v1) - ann = (Core.annotatedTermAnnotation v1)- recursive = (rewriteBinding (Core.Binding {- Core.bindingName = key0,- Core.bindingTerm = val1,- Core.bindingType = t}))- innerBinding = (fst recursive)- deps = (snd recursive)- val2 = (Core.bindingTerm innerBinding)- in (Core.Binding {- Core.bindingName = key0,- Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = val2,- Core.annotatedTermAnnotation = ann})),- Core.bindingType = t}, deps)- Core.TermLet v1 -> - let bindings1 = (Core.letBindings v1) - body1 = (Core.letEnvironment v1)- prefix = (Strings.cat2 (Core.unName key0) "_")- qualify = (\n -> Core.Name (Strings.cat2 prefix (Core.unName n)))- toSubstPair = (\b -> (Core.bindingName b, (qualify (Core.bindingName b))))- subst = (Maps.fromList (Lists.map toSubstPair bindings1))- replaceVars = (substituteVariables subst)- newBody = (replaceVars body1)- newBinding = (\b -> Core.Binding {- Core.bindingName = (qualify (Core.bindingName b)),- Core.bindingTerm = (replaceVars (Core.bindingTerm b)),- Core.bindingType = (Core.bindingType b)})- in (Core.Binding {- Core.bindingName = key0,- Core.bindingTerm = newBody,- Core.bindingType = t}, (Lists.map newBinding bindings1))- _ -> (Core.Binding {- Core.bindingName = key0,- Core.bindingTerm = val0,- Core.bindingType = t}, [])) val0)) - flatten = (\recurse -> \term -> - let rewritten = (recurse term)- in ((\x -> case x of- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - body = (Core.letEnvironment v1)- forResult = (\hr -> Lists.cons (fst hr) (snd hr))- newBindings = (Lists.concat (Lists.map (\arg_ -> forResult (rewriteBinding arg_)) bindings))- in (Core.TermLet (Core.Let {- Core.letBindings = newBindings,- Core.letEnvironment = body}))- _ -> rewritten) rewritten))- in (rewriteTerm flatten term)--foldOverTerm :: (Coders.TraversalOrder -> (t0 -> Core.Term -> t0) -> t0 -> Core.Term -> t0)-foldOverTerm order fld b0 term = ((\x -> case x of- Coders.TraversalOrderPre -> (Lists.foldl (foldOverTerm order fld) (fld b0 term) (subterms term))- Coders.TraversalOrderPost -> (fld (Lists.foldl (foldOverTerm order fld) b0 (subterms term)) term)) order)--foldOverType :: (Coders.TraversalOrder -> (t0 -> Core.Type -> t0) -> t0 -> Core.Type -> t0)-foldOverType order fld b0 typ = ((\x -> case x of- Coders.TraversalOrderPre -> (Lists.foldl (foldOverType order fld) (fld b0 typ) (subtypes typ))- Coders.TraversalOrderPost -> (fld (Lists.foldl (foldOverType order fld) b0 (subtypes typ)) typ)) order)---- | Find the free variables (i.e. variables not bound by a lambda or let) in a term-freeVariablesInTerm :: (Core.Term -> S.Set Core.Name)-freeVariablesInTerm term = - let dfltVars = (Lists.foldl (\s -> \t -> Sets.union s (freeVariablesInTerm t)) Sets.empty (subterms term))- in ((\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Sets.delete (Core.lambdaParameter v2) (freeVariablesInTerm (Core.lambdaBody v2)))- _ -> dfltVars) v1)- Core.TermVariable v1 -> (Sets.singleton v1)- _ -> dfltVars) term)---- | Find the free variables (i.e. variables not bound by a lambda or let) in a type-freeVariablesInType :: (Core.Type -> S.Set Core.Name)-freeVariablesInType typ = - let dfltVars = (Lists.foldl (\s -> \t -> Sets.union s (freeVariablesInType t)) Sets.empty (subtypes typ))- in ((\x -> case x of- Core.TypeForall v1 -> (Sets.delete (Core.forallTypeParameter v1) (freeVariablesInType (Core.forallTypeBody v1)))- Core.TypeVariable v1 -> (Sets.singleton v1)- _ -> dfltVars) typ)---- | Find the free variables in a type in deterministic left-to-right order-freeVariablesInTypeOrdered :: (Core.Type -> [Core.Name])-freeVariablesInTypeOrdered typ = - let collectVars = (\boundVars -> \t -> (\x -> case x of- Core.TypeVariable v1 -> (Logic.ifElse (Sets.member v1 boundVars) [] [- v1])- Core.TypeForall v1 -> (collectVars (Sets.insert (Core.forallTypeParameter v1) boundVars) (Core.forallTypeBody v1))- _ -> (Lists.concat (Lists.map (collectVars boundVars) (subtypes t)))) t)- in (Lists.nub (collectVars Sets.empty typ))---- | Find free variables in a type scheme (simple version)-freeVariablesInTypeSchemeSimple :: (Core.TypeScheme -> S.Set Core.Name)-freeVariablesInTypeSchemeSimple ts = - let vars = (Core.typeSchemeVariables ts) - t = (Core.typeSchemeType ts)- in (Sets.difference (freeVariablesInTypeSimple t) (Sets.fromList vars))---- | Find free variables in a type scheme-freeVariablesInTypeScheme :: (Core.TypeScheme -> S.Set Core.Name)-freeVariablesInTypeScheme ts = - let vars = (Core.typeSchemeVariables ts) - t = (Core.typeSchemeType ts)- in (Sets.difference (freeVariablesInType t) (Sets.fromList vars))---- | Same as freeVariablesInType, but ignores the binding action of lambda types-freeVariablesInTypeSimple :: (Core.Type -> S.Set Core.Name)-freeVariablesInTypeSimple typ = - let helper = (\types -> \typ -> (\x -> case x of- Core.TypeVariable v1 -> (Sets.insert v1 types)- _ -> types) typ)- in (foldOverType Coders.TraversalOrderPre helper Sets.empty typ)--inlineType :: (M.Map Core.Name Core.Type -> Core.Type -> Compute.Flow t0 Core.Type)-inlineType schema typ = - let f = (\recurse -> \typ -> Flows.bind (recurse typ) (\tr -> (\x -> case x of- Core.TypeVariable v1 -> (Optionals.maybe (Flows.fail (Strings.cat2 "No such type in schema: " (Core.unName v1))) (inlineType schema) (Maps.lookup v1 schema))- _ -> (Flows.pure tr)) tr))- in (rewriteTypeM f typ)---- | Check whether a variable is free (not bound) in a term-isFreeVariableInTerm :: (Core.Name -> Core.Term -> Bool)-isFreeVariableInTerm v term = (Logic.not (Sets.member v (freeVariablesInTerm term)))---- | Check whether a term is a lambda, possibly nested within let and/or annotation terms-isLambda :: (Core.Term -> Bool)-isLambda term = ((\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda _ -> True- _ -> False) v1)- Core.TermLet v1 -> (isLambda (Core.letEnvironment v1))- _ -> False) (deannotateTerm term))---- | Apply a transformation to the first type beneath a chain of annotations-mapBeneathTypeAnnotations :: ((Core.Type -> Core.Type) -> Core.Type -> Core.Type)-mapBeneathTypeAnnotations f t = ((\x -> case x of- Core.TypeAnnotated v1 -> (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = (mapBeneathTypeAnnotations f (Core.annotatedTypeSubject v1)),- Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))- _ -> (f t)) t)---- | Recursively replace the type variables of let bindings with the systematic type variables t0, t1, t2, ...-normalizeTypeVariablesInTerm :: (Core.Term -> Core.Term)-normalizeTypeVariablesInTerm term = - let substType = (\subst -> \typ -> - let rewrite = (\recurse -> \typ -> (\x -> case x of- Core.TypeVariable v1 -> (Core.TypeVariable (replaceName subst v1))- _ -> (recurse typ)) typ)- in (rewriteType rewrite typ)) - replaceName = (\subst -> \v -> Optionals.fromMaybe v (Maps.lookup v subst))- rewriteWithSubst = (\substAndBound -> - let subst = (fst substAndBound) - boundVars = (snd substAndBound)- rewrite = (\recurse -> \term -> (\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationProduct v3 -> - let arity = (Core.tupleProjectionArity v3) - index = (Core.tupleProjectionIndex v3)- domain = (Core.tupleProjectionDomain v3)- in (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = arity,- Core.tupleProjectionIndex = index,- Core.tupleProjectionDomain = (Optionals.map (\types -> Lists.map (substType subst) types) domain)}))))- _ -> (recurse term)) v2)- Core.FunctionLambda v2 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.lambdaParameter v2),- Core.lambdaDomain = (Optionals.map (substType subst) (Core.lambdaDomain v2)),- Core.lambdaBody = (rewriteWithSubst (subst, boundVars) (Core.lambdaBody v2))})))- _ -> (recurse term)) v1)- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)- rewriteBinding = (\b -> Optionals.maybe b (\ts -> - let vars = (Core.typeSchemeVariables ts) - typ = (Core.typeSchemeType ts)- varsLen = (Lists.length vars)- boundVarsLen = (Sets.size boundVars)- normalVariables = (Lists.map (\i -> Core.Name (Strings.cat2 "t" (Literals.showInt32 i))) (Math.range 0 (Math.add varsLen boundVarsLen)))- newVars = (Lists.take (Lists.length vars) (Lists.filter (\n -> Logic.not (Sets.member n boundVars)) normalVariables))- newSubst = (Maps.union (Maps.fromList (Lists.zip vars newVars)) subst)- newValue = (rewriteWithSubst (newSubst, (Sets.union boundVars (Sets.fromList newVars))) (Core.bindingTerm b))- in Core.Binding {- Core.bindingName = (Core.bindingName b),- Core.bindingTerm = newValue,- Core.bindingType = (Just (Core.TypeScheme {- Core.typeSchemeVariables = newVars,- Core.typeSchemeType = (substType newSubst typ)}))}) (Core.bindingType b))- in (Core.TermLet (Core.Let {- Core.letBindings = (Lists.map rewriteBinding bindings),- Core.letEnvironment = (rewriteWithSubst (subst, boundVars) env)}))- Core.TermTypeApplication v1 -> (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (rewriteWithSubst (subst, boundVars) (Core.typedTermTerm v1)),- Core.typedTermType = (substType subst (Core.typedTermType v1))}))- Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {- Core.typeLambdaParameter = (replaceName subst (Core.typeLambdaParameter v1)),- Core.typeLambdaBody = (rewriteWithSubst (subst, boundVars) (Core.typeLambdaBody v1))}))- _ -> (recurse term)) term)- in (rewriteTerm rewrite))- in (rewriteWithSubst (Maps.empty, Sets.empty) term)---- | Recursively remove term annotations, including within subterms-removeTermAnnotations :: (Core.Term -> Core.Term)-removeTermAnnotations term = - let remove = (\recurse -> \term -> - let rewritten = (recurse term)- in ((\x -> case x of- Core.TermAnnotated v1 -> (Core.annotatedTermSubject v1)- _ -> rewritten) term))- in (rewriteTerm remove term)---- | Recursively remove type annotations, including within subtypes-removeTypeAnnotations :: (Core.Type -> Core.Type)-removeTypeAnnotations typ = - let remove = (\recurse -> \typ -> - let rewritten = (recurse typ)- in ((\x -> case x of- Core.TypeAnnotated v1 -> (Core.annotatedTypeSubject v1)- _ -> rewritten) rewritten))- in (rewriteType remove typ)---- | Strip type annotations from terms while preserving other annotations-removeTypesFromTerm :: (Core.Term -> Core.Term)-removeTypesFromTerm term = - let strip = (\recurse -> \term -> - let rewritten = (recurse term) - stripBinding = (\b -> Core.Binding {- Core.bindingName = (Core.bindingName b),- Core.bindingTerm = (Core.bindingTerm b),- Core.bindingType = Nothing})- in ((\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationProduct v3 -> (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = (Core.tupleProjectionIndex v3),- Core.tupleProjectionIndex = (Core.tupleProjectionArity v3),- Core.tupleProjectionDomain = Nothing}))))- _ -> (Core.TermFunction (Core.FunctionElimination v2))) v2)- Core.FunctionLambda v2 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.lambdaParameter v2),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.lambdaBody v2)})))- _ -> (Core.TermFunction v1)) v1)- Core.TermLet v1 -> (Core.TermLet (Core.Let {- Core.letBindings = (Lists.map stripBinding (Core.letBindings v1)),- Core.letEnvironment = (Core.letEnvironment v1)}))- Core.TermTypeApplication v1 -> (Core.typedTermTerm v1)- Core.TermTypeLambda v1 -> (Core.typeLambdaBody v1)- _ -> rewritten) rewritten))- in (rewriteTerm strip term)---- | Replace a free variable in a term-replaceFreeTermVariable :: (Core.Name -> Core.Term -> Core.Term -> Core.Term)-replaceFreeTermVariable vold tnew term = - let rewrite = (\recurse -> \t -> (\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> - let v = (Core.lambdaParameter v2)- in (Logic.ifElse (Equality.equal v vold) t (recurse t))- _ -> (recurse t)) v1)- Core.TermVariable v1 -> (Logic.ifElse (Equality.equal v1 vold) tnew (Core.TermVariable v1))- _ -> (recurse t)) t)- in (rewriteTerm rewrite term)---- | Replace free occurrences of a name in a type-replaceFreeTypeVariable :: (Core.Name -> Core.Type -> Core.Type -> Core.Type)-replaceFreeTypeVariable v rep typ = - let mapExpr = (\recurse -> \t -> (\x -> case x of- Core.TypeForall v1 -> (Logic.ifElse (Equality.equal v (Core.forallTypeParameter v1)) t (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.forallTypeParameter v1),- Core.forallTypeBody = (recurse (Core.forallTypeBody v1))})))- Core.TypeVariable v1 -> (Logic.ifElse (Equality.equal v v1) rep t)- _ -> (recurse t)) t)- in (rewriteType mapExpr typ)--rewrite :: ((t0 -> t1) -> (t1 -> t0) -> t0)-rewrite fsub f = - let recurse = (f (fsub recurse))- in recurse--rewriteTerm :: (((Core.Term -> Core.Term) -> Core.Term -> Core.Term) -> Core.Term -> Core.Term)-rewriteTerm f = - let fsub = (\recurse -> \term -> - let forElimination = (\elm -> (\x -> case x of- Core.EliminationProduct v1 -> (Core.EliminationProduct v1)- Core.EliminationRecord v1 -> (Core.EliminationRecord v1)- Core.EliminationUnion v1 -> (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = (Core.caseStatementTypeName v1),- Core.caseStatementDefault = (Optionals.map recurse (Core.caseStatementDefault v1)),- Core.caseStatementCases = (Lists.map forField (Core.caseStatementCases v1))}))- Core.EliminationWrap v1 -> (Core.EliminationWrap v1)) elm) - forField = (\f -> Core.Field {- Core.fieldName = (Core.fieldName f),- Core.fieldTerm = (recurse (Core.fieldTerm f))})- forFunction = (\fun -> (\x -> case x of- Core.FunctionElimination v1 -> (Core.FunctionElimination (forElimination v1))- Core.FunctionLambda v1 -> (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.lambdaParameter v1),- Core.lambdaDomain = (Core.lambdaDomain v1),- Core.lambdaBody = (recurse (Core.lambdaBody v1))}))- Core.FunctionPrimitive v1 -> (Core.FunctionPrimitive v1)) fun)- forLet = (\lt -> - let mapBinding = (\b -> Core.Binding {- Core.bindingName = (Core.bindingName b),- Core.bindingTerm = (recurse (Core.bindingTerm b)),- Core.bindingType = (Core.bindingType b)})- in Core.Let {- Core.letBindings = (Lists.map mapBinding (Core.letBindings lt)),- Core.letEnvironment = (recurse (Core.letEnvironment lt))})- forMap = (\m -> - let forPair = (\p -> (recurse (fst p), (recurse (snd p))))- in (Maps.fromList (Lists.map forPair (Maps.toList m))))- in ((\x -> case x of- Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = (recurse (Core.annotatedTermSubject v1)),- Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))- Core.TermApplication v1 -> (Core.TermApplication (Core.Application {- Core.applicationFunction = (recurse (Core.applicationFunction v1)),- Core.applicationArgument = (recurse (Core.applicationArgument v1))}))- Core.TermFunction v1 -> (Core.TermFunction (forFunction v1))- Core.TermLet v1 -> (Core.TermLet (forLet v1))- Core.TermList v1 -> (Core.TermList (Lists.map recurse v1))- Core.TermLiteral v1 -> (Core.TermLiteral v1)- Core.TermMap v1 -> (Core.TermMap (forMap v1))- Core.TermWrap v1 -> (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),- Core.wrappedTermObject = (recurse (Core.wrappedTermObject v1))}))- Core.TermOptional v1 -> (Core.TermOptional (Optionals.map recurse v1))- Core.TermProduct v1 -> (Core.TermProduct (Lists.map recurse v1))- Core.TermRecord v1 -> (Core.TermRecord (Core.Record {- Core.recordTypeName = (Core.recordTypeName v1),- Core.recordFields = (Lists.map forField (Core.recordFields v1))}))- Core.TermSet v1 -> (Core.TermSet (Sets.fromList (Lists.map recurse (Sets.toList v1))))- Core.TermSum v1 -> (Core.TermSum (Core.Sum {- Core.sumIndex = (Core.sumIndex v1),- Core.sumSize = (Core.sumSize v1),- Core.sumTerm = (recurse (Core.sumTerm v1))}))- Core.TermTypeApplication v1 -> (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (recurse (Core.typedTermTerm v1)),- Core.typedTermType = (Core.typedTermType v1)}))- Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {- Core.typeLambdaParameter = (Core.typeLambdaParameter v1),- Core.typeLambdaBody = (recurse (Core.typeLambdaBody v1))}))- Core.TermUnion v1 -> (Core.TermUnion (Core.Injection {- Core.injectionTypeName = (Core.injectionTypeName v1),- Core.injectionField = (forField (Core.injectionField v1))}))- Core.TermUnit -> Core.TermUnit- Core.TermVariable v1 -> (Core.TermVariable v1)) term))- in (rewrite fsub f)--rewriteTermM :: (((Core.Term -> Compute.Flow t0 Core.Term) -> Core.Term -> Compute.Flow t0 Core.Term) -> Core.Term -> Compute.Flow t0 Core.Term)-rewriteTermM f = - let fsub = (\recurse -> \term -> - let forField = (\f -> Flows.map (\t -> Core.Field {- Core.fieldName = (Core.fieldName f),- Core.fieldTerm = t}) (recurse (Core.fieldTerm f))) - forPair = (\kv -> - let k = (fst kv) - v = (snd kv)- in (Flows.bind (recurse k) (\km -> Flows.bind (recurse v) (\vm -> Flows.pure (km, vm)))))- mapBinding = (\binding -> - let k = (Core.bindingName binding) - v = (Core.bindingTerm binding)- t = (Core.bindingType binding)- in (Flows.bind (recurse v) (\v_ -> Flows.pure (Core.Binding {- Core.bindingName = k,- Core.bindingTerm = v_,- Core.bindingType = t}))))- in ((\x -> case x of- Core.TermAnnotated v1 -> (Flows.bind (recurse (Core.annotatedTermSubject v1)) (\ex -> Flows.pure (Core.TermAnnotated (Core.AnnotatedTerm {- Core.annotatedTermSubject = ex,- Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))))- Core.TermApplication v1 -> (Flows.bind (recurse (Core.applicationFunction v1)) (\lhs -> Flows.bind (recurse (Core.applicationArgument v1)) (\rhs -> Flows.pure (Core.TermApplication (Core.Application {- Core.applicationFunction = lhs,- Core.applicationArgument = rhs})))))- Core.TermFunction v1 -> (Flows.bind ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationProduct v3 -> (Flows.pure (Core.FunctionElimination (Core.EliminationProduct v3)))- Core.EliminationRecord v3 -> (Flows.pure (Core.FunctionElimination (Core.EliminationRecord v3)))- Core.EliminationUnion v3 -> - let n = (Core.caseStatementTypeName v3) - def = (Core.caseStatementDefault v3)- cases = (Core.caseStatementCases v3)- in (Flows.bind (Optionals.maybe (Flows.pure Nothing) (\t -> Flows.map Optionals.pure (recurse t)) def) (\rdef -> Flows.map (\rcases -> Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = n,- Core.caseStatementDefault = rdef,- Core.caseStatementCases = rcases}))) (Flows.mapList forField cases)))- Core.EliminationWrap v3 -> (Flows.pure (Core.FunctionElimination (Core.EliminationWrap v3)))) v2)- Core.FunctionLambda v2 -> - let v = (Core.lambdaParameter v2) - d = (Core.lambdaDomain v2)- body = (Core.lambdaBody v2)- in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = v,- Core.lambdaDomain = d,- Core.lambdaBody = rbody}))))- Core.FunctionPrimitive v2 -> (Flows.pure (Core.FunctionPrimitive v2))) v1) (\rfun -> Flows.pure (Core.TermFunction rfun)))- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)- in (Flows.bind (Flows.mapList mapBinding bindings) (\rbindings -> Flows.bind (recurse env) (\renv -> Flows.pure (Core.TermLet (Core.Let {- Core.letBindings = rbindings,- Core.letEnvironment = renv})))))- Core.TermList v1 -> (Flows.bind (Flows.mapList recurse v1) (\rels -> Flows.pure (Core.TermList rels)))- Core.TermLiteral v1 -> (Flows.pure (Core.TermLiteral v1))- Core.TermMap v1 -> (Flows.bind (Flows.mapList forPair (Maps.toList v1)) (\pairs -> Flows.pure (Core.TermMap (Maps.fromList pairs))))- Core.TermOptional v1 -> (Flows.bind (Flows.mapOptional recurse v1) (\rm -> Flows.pure (Core.TermOptional rm)))- Core.TermProduct v1 -> (Flows.map (\rtuple -> Core.TermProduct rtuple) (Flows.mapList recurse v1))- Core.TermRecord v1 -> - let n = (Core.recordTypeName v1) - fields = (Core.recordFields v1)- in (Flows.map (\rfields -> Core.TermRecord (Core.Record {- Core.recordTypeName = n,- Core.recordFields = rfields})) (Flows.mapList forField fields))- Core.TermSet v1 -> (Flows.bind (Flows.mapList recurse (Sets.toList v1)) (\rlist -> Flows.pure (Core.TermSet (Sets.fromList rlist))))- Core.TermSum v1 -> - let i = (Core.sumIndex v1) - s = (Core.sumSize v1)- trm = (Core.sumTerm v1)- in (Flows.bind (recurse trm) (\rtrm -> Flows.pure (Core.TermSum (Core.Sum {- Core.sumIndex = i,- Core.sumSize = s,- Core.sumTerm = rtrm}))))- Core.TermTypeApplication v1 -> (Flows.bind (recurse (Core.typedTermTerm v1)) (\t -> Flows.pure (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = t,- Core.typedTermType = (Core.typedTermType v1)}))))- Core.TermTypeLambda v1 -> - let v = (Core.typeLambdaParameter v1) - body = (Core.typeLambdaBody v1)- in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.TermTypeLambda (Core.TypeLambda {- Core.typeLambdaParameter = v,- Core.typeLambdaBody = rbody}))))- Core.TermUnion v1 -> - let n = (Core.injectionTypeName v1) - field = (Core.injectionField v1)- in (Flows.map (\rfield -> Core.TermUnion (Core.Injection {- Core.injectionTypeName = n,- Core.injectionField = rfield})) (forField field))- Core.TermUnit -> (Flows.pure Core.TermUnit)- Core.TermVariable v1 -> (Flows.pure (Core.TermVariable v1))- Core.TermWrap v1 -> - let name = (Core.wrappedTermTypeName v1) - t = (Core.wrappedTermObject v1)- in (Flows.bind (recurse t) (\rt -> Flows.pure (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = name,- Core.wrappedTermObject = rt}))))) term))- in (rewrite fsub f)--rewriteType :: (((Core.Type -> Core.Type) -> Core.Type -> Core.Type) -> Core.Type -> Core.Type)-rewriteType f = - let fsub = (\recurse -> \typ -> - let forField = (\f -> Core.FieldType {- Core.fieldTypeName = (Core.fieldTypeName f),- Core.fieldTypeType = (recurse (Core.fieldTypeType f))})- in ((\x -> case x of- Core.TypeAnnotated v1 -> (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = (recurse (Core.annotatedTypeSubject v1)),- Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))- Core.TypeApplication v1 -> (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (recurse (Core.applicationTypeFunction v1)),- Core.applicationTypeArgument = (recurse (Core.applicationTypeArgument v1))}))- Core.TypeFunction v1 -> (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (recurse (Core.functionTypeDomain v1)),- Core.functionTypeCodomain = (recurse (Core.functionTypeCodomain v1))}))- Core.TypeForall v1 -> (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.forallTypeParameter v1),- Core.forallTypeBody = (recurse (Core.forallTypeBody v1))}))- Core.TypeList v1 -> (Core.TypeList (recurse v1))- Core.TypeLiteral v1 -> (Core.TypeLiteral v1)- Core.TypeMap v1 -> (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (recurse (Core.mapTypeKeys v1)),- Core.mapTypeValues = (recurse (Core.mapTypeValues v1))}))- Core.TypeOptional v1 -> (Core.TypeOptional (recurse v1))- Core.TypeProduct v1 -> (Core.TypeProduct (Lists.map recurse v1))- Core.TypeRecord v1 -> (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = (Core.rowTypeTypeName v1),- Core.rowTypeFields = (Lists.map forField (Core.rowTypeFields v1))}))- Core.TypeSet v1 -> (Core.TypeSet (recurse v1))- Core.TypeSum v1 -> (Core.TypeSum (Lists.map recurse v1))- Core.TypeUnion v1 -> (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = (Core.rowTypeTypeName v1),- Core.rowTypeFields = (Lists.map forField (Core.rowTypeFields v1))}))- Core.TypeUnit -> Core.TypeUnit- Core.TypeVariable v1 -> (Core.TypeVariable v1)- Core.TypeWrap v1 -> (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = (Core.wrappedTypeTypeName v1),- Core.wrappedTypeObject = (recurse (Core.wrappedTypeObject v1))}))) typ))- in (rewrite fsub f)--rewriteTypeM :: (((Core.Type -> Compute.Flow t0 Core.Type) -> Core.Type -> Compute.Flow t0 Core.Type) -> Core.Type -> Compute.Flow t0 Core.Type)-rewriteTypeM = - let fsub = (\recurse -> \typ -> (\x -> case x of- Core.TypeAnnotated v1 -> (Flows.bind (recurse (Core.annotatedTypeSubject v1)) (\t -> Flows.pure (Core.TypeAnnotated (Core.AnnotatedType {- Core.annotatedTypeSubject = t,- Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))))- Core.TypeApplication v1 -> (Flows.bind (recurse (Core.applicationTypeFunction v1)) (\lhs -> Flows.bind (recurse (Core.applicationTypeArgument v1)) (\rhs -> Flows.pure (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = lhs,- Core.applicationTypeArgument = rhs})))))- Core.TypeFunction v1 -> (Flows.bind (recurse (Core.functionTypeDomain v1)) (\dom -> Flows.bind (recurse (Core.functionTypeCodomain v1)) (\cod -> Flows.pure (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = dom,- Core.functionTypeCodomain = cod})))))- Core.TypeForall v1 -> (Flows.bind (recurse (Core.forallTypeBody v1)) (\b -> Flows.pure (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.forallTypeParameter v1),- Core.forallTypeBody = b}))))- Core.TypeList v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeList rt)))- Core.TypeLiteral v1 -> (Flows.pure (Core.TypeLiteral v1))- Core.TypeMap v1 -> (Flows.bind (recurse (Core.mapTypeKeys v1)) (\kt -> Flows.bind (recurse (Core.mapTypeValues v1)) (\vt -> Flows.pure (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = kt,- Core.mapTypeValues = vt})))))- Core.TypeOptional v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeOptional rt)))- Core.TypeProduct v1 -> (Flows.bind (Flows.mapList recurse v1) (\rtypes -> Flows.pure (Core.TypeProduct rtypes)))- Core.TypeRecord v1 -> - let name = (Core.rowTypeTypeName v1) - fields = (Core.rowTypeFields v1)- forField = (\f -> Flows.bind (recurse (Core.fieldTypeType f)) (\t -> Flows.pure (Core.FieldType {- Core.fieldTypeName = (Core.fieldTypeName f),- Core.fieldTypeType = t})))- in (Flows.bind (Flows.mapList forField fields) (\rfields -> Flows.pure (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = name,- Core.rowTypeFields = rfields}))))- Core.TypeSet v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeSet rt)))- Core.TypeSum v1 -> (Flows.bind (Flows.mapList recurse v1) (\rtypes -> Flows.pure (Core.TypeSum rtypes)))- Core.TypeUnion v1 -> - let name = (Core.rowTypeTypeName v1) - fields = (Core.rowTypeFields v1)- forField = (\f -> Flows.bind (recurse (Core.fieldTypeType f)) (\t -> Flows.pure (Core.FieldType {- Core.fieldTypeName = (Core.fieldTypeName f),- Core.fieldTypeType = t})))- in (Flows.bind (Flows.mapList forField fields) (\rfields -> Flows.pure (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = name,- Core.rowTypeFields = rfields}))))- Core.TypeUnit -> (Flows.pure Core.TypeUnit)- Core.TypeVariable v1 -> (Flows.pure (Core.TypeVariable v1))- Core.TypeWrap v1 -> (Flows.bind (recurse (Core.wrappedTypeObject v1)) (\t -> Flows.pure (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = (Core.wrappedTypeTypeName v1),- Core.wrappedTypeObject = t}))))) typ)- in (\f -> rewrite fsub f)---- | Simplify terms by applying beta reduction where possible-simplifyTerm :: (Core.Term -> Core.Term)-simplifyTerm term = - let simplify = (\recurse -> \term -> - let stripped = (deannotateTerm term)- in (recurse ((\x -> case x of- Core.TermApplication v1 -> - let lhs = (Core.applicationFunction v1) - rhs = (Core.applicationArgument v1)- strippedLhs = (deannotateTerm lhs)- in ((\x -> case x of- Core.TermFunction v2 -> ((\x -> case x of- Core.FunctionLambda v3 -> - let var = (Core.lambdaParameter v3) - body = (Core.lambdaBody v3)- in (Logic.ifElse (Sets.member var (freeVariablesInTerm body)) ( - let strippedRhs = (deannotateTerm rhs)- in ((\x -> case x of- Core.TermVariable v4 -> (simplifyTerm (substituteVariable var v4 body))- _ -> term) strippedRhs)) (simplifyTerm body))- _ -> term) v2)- _ -> term) strippedLhs)- _ -> term) stripped)))- in (rewriteTerm simplify term)---- | Substitute type variables in a type-substituteTypeVariables :: (M.Map Core.Name Core.Name -> Core.Type -> Core.Type)-substituteTypeVariables subst typ = - let replace = (\recurse -> \typ -> (\x -> case x of- Core.TypeVariable v1 -> (Core.TypeVariable (Optionals.fromMaybe v1 (Maps.lookup v1 subst)))- _ -> (recurse typ)) typ)- in (rewriteType replace typ)---- | Substitute one variable for another in a term-substituteVariable :: (Core.Name -> Core.Name -> Core.Term -> Core.Term)-substituteVariable from to term = - let replace = (\recurse -> \term -> (\x -> case x of- Core.TermVariable v1 -> (Core.TermVariable (Logic.ifElse (Equality.equal v1 from) to v1))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Logic.ifElse (Equality.equal (Core.lambdaParameter v2) from) term (recurse term))- _ -> (recurse term)) v1)- _ -> (recurse term)) term)- in (rewriteTerm replace term)---- | Substitute multiple variables in a term-substituteVariables :: (M.Map Core.Name Core.Name -> Core.Term -> Core.Term)-substituteVariables subst term = - let replace = (\recurse -> \term -> (\x -> case x of- Core.TermVariable v1 -> (Core.TermVariable (Optionals.fromMaybe v1 (Maps.lookup v1 subst)))- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionLambda v2 -> (Optionals.maybe (recurse term) (\_ -> term) (Maps.lookup (Core.lambdaParameter v2) subst))- _ -> (recurse term)) v1)- _ -> (recurse term)) term)- in (rewriteTerm replace term)---- | Find the children of a given term-subterms :: (Core.Term -> [Core.Term])-subterms x = case x of- Core.TermAnnotated v1 -> [- Core.annotatedTermSubject v1]- Core.TermApplication v1 -> [- Core.applicationFunction v1,- (Core.applicationArgument v1)]- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationUnion v3 -> (Lists.concat2 (Optionals.maybe [] (\t -> [- t]) (Core.caseStatementDefault v3)) (Lists.map Core.fieldTerm (Core.caseStatementCases v3)))- _ -> []) v2)- Core.FunctionLambda v2 -> [- Core.lambdaBody v2]- _ -> []) v1)- Core.TermLet v1 -> (Lists.cons (Core.letEnvironment v1) (Lists.map Core.bindingTerm (Core.letBindings v1)))- Core.TermList v1 -> v1- Core.TermLiteral _ -> []- Core.TermMap v1 -> (Lists.concat (Lists.map (\p -> [- fst p,- (snd p)]) (Maps.toList v1)))- Core.TermOptional v1 -> (Optionals.maybe [] (\t -> [- t]) v1)- Core.TermProduct v1 -> v1- Core.TermRecord v1 -> (Lists.map Core.fieldTerm (Core.recordFields v1))- Core.TermSet v1 -> (Sets.toList v1)- Core.TermSum v1 -> [- Core.sumTerm v1]- Core.TermTypeApplication v1 -> [- Core.typedTermTerm v1]- Core.TermTypeLambda v1 -> [- Core.typeLambdaBody v1]- Core.TermUnion v1 -> [- Core.fieldTerm (Core.injectionField v1)]- Core.TermUnit -> []- Core.TermVariable _ -> []- Core.TermWrap v1 -> [- Core.wrappedTermObject v1]---- | Find the children of a given term-subtermsWithAccessors :: (Core.Term -> [(Accessors.TermAccessor, Core.Term)])-subtermsWithAccessors x = case x of- Core.TermAnnotated v1 -> [- (Accessors.TermAccessorAnnotatedSubject, (Core.annotatedTermSubject v1))]- Core.TermApplication v1 -> [- (Accessors.TermAccessorApplicationFunction, (Core.applicationFunction v1)),- (Accessors.TermAccessorApplicationArgument, (Core.applicationArgument v1))]- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationUnion v3 -> (Lists.concat2 (Optionals.maybe [] (\t -> [- (Accessors.TermAccessorUnionCasesDefault, t)]) (Core.caseStatementDefault v3)) (Lists.map (\f -> (Accessors.TermAccessorUnionCasesBranch (Core.fieldName f), (Core.fieldTerm f))) (Core.caseStatementCases v3)))- _ -> []) v2)- Core.FunctionLambda v2 -> [- (Accessors.TermAccessorLambdaBody, (Core.lambdaBody v2))]- _ -> []) v1)- Core.TermLet v1 -> (Lists.cons (Accessors.TermAccessorLetEnvironment, (Core.letEnvironment v1)) (Lists.map (\b -> (Accessors.TermAccessorLetBinding (Core.bindingName b), (Core.bindingTerm b))) (Core.letBindings v1)))- Core.TermList v1 -> (Lists.map (\e -> (Accessors.TermAccessorListElement 0, e)) v1)- Core.TermLiteral _ -> []- Core.TermMap v1 -> (Lists.concat (Lists.map (\p -> [- (Accessors.TermAccessorMapKey 0, (fst p)),- (Accessors.TermAccessorMapValue 0, (snd p))]) (Maps.toList v1)))- Core.TermOptional v1 -> (Optionals.maybe [] (\t -> [- (Accessors.TermAccessorOptionalTerm, t)]) v1)- Core.TermProduct v1 -> (Lists.map (\e -> (Accessors.TermAccessorProductTerm 0, e)) v1)- Core.TermRecord v1 -> (Lists.map (\f -> (Accessors.TermAccessorRecordField (Core.fieldName f), (Core.fieldTerm f))) (Core.recordFields v1))- Core.TermSet v1 -> (Lists.map (\e -> (Accessors.TermAccessorListElement 0, e)) (Sets.toList v1))- Core.TermSum v1 -> [- (Accessors.TermAccessorSumTerm, (Core.sumTerm v1))]- Core.TermTypeApplication v1 -> [- (Accessors.TermAccessorTypeApplicationTerm, (Core.typedTermTerm v1))]- Core.TermTypeLambda v1 -> [- (Accessors.TermAccessorTypeLambdaBody, (Core.typeLambdaBody v1))]- Core.TermUnion v1 -> [- (Accessors.TermAccessorInjectionTerm, (Core.fieldTerm (Core.injectionField v1)))]- Core.TermUnit -> []- Core.TermVariable _ -> []- Core.TermWrap v1 -> [- (Accessors.TermAccessorWrappedTerm, (Core.wrappedTermObject v1))]---- | Find the children of a given type expression-subtypes :: (Core.Type -> [Core.Type])-subtypes x = case x of- Core.TypeAnnotated v1 -> [- Core.annotatedTypeSubject v1]- Core.TypeApplication v1 -> [- Core.applicationTypeFunction v1,- (Core.applicationTypeArgument v1)]- Core.TypeFunction v1 -> [- Core.functionTypeDomain v1,- (Core.functionTypeCodomain v1)]- Core.TypeForall v1 -> [- Core.forallTypeBody v1]- Core.TypeList v1 -> [- v1]- Core.TypeLiteral _ -> []- Core.TypeMap v1 -> [- Core.mapTypeKeys v1,- (Core.mapTypeValues v1)]- Core.TypeOptional v1 -> [- v1]- Core.TypeProduct v1 -> v1- Core.TypeRecord v1 -> (Lists.map Core.fieldTypeType (Core.rowTypeFields v1))- Core.TypeSet v1 -> [- v1]- Core.TypeSum v1 -> v1- Core.TypeUnion v1 -> (Lists.map Core.fieldTypeType (Core.rowTypeFields v1))- Core.TypeUnit -> []- Core.TypeVariable _ -> []- Core.TypeWrap v1 -> [- Core.wrappedTypeObject v1]---- | Note: does not distinguish between bound and free variables; use freeVariablesInTerm for that-termDependencyNames :: (Bool -> Bool -> Bool -> Core.Term -> S.Set Core.Name)-termDependencyNames binds withPrims withNoms = - let addNames = (\names -> \term -> - let nominal = (\name -> Logic.ifElse withNoms (Sets.insert name names) names) - prim = (\name -> Logic.ifElse withPrims (Sets.insert name names) names)- var = (\name -> Logic.ifElse binds (Sets.insert name names) names)- in ((\x -> case x of- Core.TermFunction v1 -> ((\x -> case x of- Core.FunctionPrimitive v2 -> (prim v2)- Core.FunctionElimination v2 -> ((\x -> case x of- Core.EliminationRecord v3 -> (nominal (Core.projectionTypeName v3))- Core.EliminationUnion v3 -> (nominal (Core.caseStatementTypeName v3))- Core.EliminationWrap v3 -> (nominal v3)- _ -> names) v2)- _ -> names) v1)- Core.TermRecord v1 -> (nominal (Core.recordTypeName v1))- Core.TermUnion v1 -> (nominal (Core.injectionTypeName v1))- Core.TermVariable v1 -> (var v1)- Core.TermWrap v1 -> (nominal (Core.wrappedTermTypeName v1))- _ -> names) term))- in (foldOverTerm Coders.TraversalOrderPre addNames Sets.empty)---- | Generate short names from a list of fully qualified names-toShortNames :: ([Core.Name] -> M.Map Core.Name Core.Name)-toShortNames original = - let groupNamesByLocal = (\names -> Lists.foldl addName Maps.empty names) - addName = (\acc -> \name -> - let local = (Names.localNameOf name) - group = (Optionals.fromMaybe Sets.empty (Maps.lookup local acc))- in (Maps.insert local (Sets.insert name group) acc))- groups = (groupNamesByLocal original)- renameGroup = (\localNames -> - let local = (fst localNames) - names = (snd localNames)- rangeFrom = (\start -> Lists.cons start (rangeFrom (Math.add start 1)))- rename = (\name -> \i -> (name, (Core.Name (Logic.ifElse (Equality.gt i 1) (Strings.cat2 local (Literals.showInt32 i)) local))))- in (Lists.zipWith rename (Sets.toList names) (rangeFrom 1)))- in (Maps.fromList (Lists.concat (Lists.map renameGroup (Maps.toList groups))))---- | Topological sort of connected components, in terms of dependencies between variable/term binding pairs-topologicalSortBindingMap :: (M.Map Core.Name Core.Term -> [[(Core.Name, Core.Term)]])-topologicalSortBindingMap bindingMap = - let bindings = (Maps.toList bindingMap) - keys = (Sets.fromList (Lists.map fst bindings))- hasTypeAnnotation = (\term -> (\x -> case x of- Core.TermAnnotated v1 -> (hasTypeAnnotation (Core.annotatedTermSubject v1))- _ -> False) term)- depsOf = (\nameAndTerm -> - let name = (fst nameAndTerm) - term = (snd nameAndTerm)- in (name, (Logic.ifElse (hasTypeAnnotation term) [] (Sets.toList (Sets.intersection keys (freeVariablesInTerm term))))))- toPair = (\name -> (name, (Optionals.fromMaybe (Core.TermLiteral (Core.LiteralString "Impossible!")) (Maps.lookup name bindingMap))))- in (Lists.map (Lists.map toPair) (Sorting.topologicalSortComponents (Lists.map depsOf bindings)))---- | Topological sort of elements based on their dependencies-topologicalSortBindings :: ([Core.Binding] -> Mantle.Either [[Core.Name]] [Core.Name])-topologicalSortBindings els = - let adjlist = (\e -> (Core.bindingName e, (Sets.toList (termDependencyNames False True True (Core.bindingTerm e)))))- in (Sorting.topologicalSort (Lists.map adjlist els))--typeDependencyNames :: (Bool -> Core.Type -> S.Set Core.Name)-typeDependencyNames withSchema typ = (Logic.ifElse withSchema (Sets.union (freeVariablesInType typ) (typeNamesInType typ)) (freeVariablesInType typ))--typeNamesInType :: (Core.Type -> S.Set Core.Name)-typeNamesInType = (foldOverType Coders.TraversalOrderPre addNames Sets.empty) - where - addNames = (\names -> \typ -> (\x -> case x of- Core.TypeRecord v1 -> - let tname = (Core.rowTypeTypeName v1)- in (Sets.insert tname names)- Core.TypeUnion v1 -> - let tname = (Core.rowTypeTypeName v1)- in (Sets.insert tname names)- Core.TypeWrap v1 -> - let tname = (Core.wrappedTypeTypeName v1)- in (Sets.insert tname names)- _ -> names) typ)+-- Note: this is an automatically generated file. Do not edit.++-- | Utilities for type and term rewriting and analysis.++module Hydra.Rewriting where++import qualified Hydra.Accessors as Accessors+import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Names as Names+import qualified Hydra.Sorting as Sorting+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Apply a term-level function inside any leading type lambdas+applyInsideTypeLambdasAndAnnotations :: ((Core.Term -> Core.Term) -> Core.Term -> Core.Term)+applyInsideTypeLambdasAndAnnotations f term0 = ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (applyInsideTypeLambdasAndAnnotations f (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (applyInsideTypeLambdasAndAnnotations f (Core.typeLambdaBody v1))}))+ _ -> (f term0)) term0)++-- | Strip type annotations from the top levels of a term+deannotateAndDetypeTerm :: (Core.Term -> Core.Term)+deannotateAndDetypeTerm t = ((\x -> case x of+ Core.TermAnnotated v1 -> (deannotateAndDetypeTerm (Core.annotatedTermBody v1))+ Core.TermTypeApplication v1 -> (deannotateAndDetypeTerm (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (deannotateAndDetypeTerm (Core.typeLambdaBody v1))+ _ -> t) t)++-- | Strip all annotations (including System F type annotations) from the top levels of a term+deannotateTerm :: (Core.Term -> Core.Term)+deannotateTerm t = ((\x -> case x of+ Core.TermAnnotated v1 -> (deannotateTerm (Core.annotatedTermBody v1))+ _ -> t) t)++-- | Strip all annotations from a term+deannotateType :: (Core.Type -> Core.Type)+deannotateType t = ((\x -> case x of+ Core.TypeAnnotated v1 -> (deannotateType (Core.annotatedTypeBody v1))+ _ -> t) t)++-- | Strip any top-level type lambdas from a type, extracting the (possibly nested) type body+deannotateTypeParameters :: (Core.Type -> Core.Type)+deannotateTypeParameters t = ((\x -> case x of+ Core.TypeForall v1 -> (deannotateTypeParameters (Core.forallTypeBody v1))+ _ -> t) (deannotateType t))++-- | Recursively strip all annotations from a type+deannotateTypeRecursive :: (Core.Type -> Core.Type)+deannotateTypeRecursive typ = + let strip = (\recurse -> \typ -> + let rewritten = (recurse typ)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (Core.annotatedTypeBody v1)+ _ -> rewritten) rewritten))+ in (rewriteType strip typ)++-- | Recursively strip all annotations from a type scheme+deannotateTypeSchemeRecursive :: (Core.TypeScheme -> Core.TypeScheme)+deannotateTypeSchemeRecursive ts = + let vars = (Core.typeSchemeVariables ts)+ in + let typ = (Core.typeSchemeType ts)+ in + let constraints = (Core.typeSchemeConstraints ts)+ in Core.TypeScheme {+ Core.typeSchemeVariables = vars,+ Core.typeSchemeType = (deannotateTypeRecursive typ),+ Core.typeSchemeConstraints = constraints}++-- | Strip System F type annotations from the top levels of a term, but leave application-specific annotations intact+detypeTerm :: (Core.Term -> Core.Term)+detypeTerm t = ((\x -> case x of+ Core.TermAnnotated v1 -> + let subj = (Core.annotatedTermBody v1)+ in + let ann = (Core.annotatedTermAnnotation v1)+ in (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (detypeTerm subj),+ Core.annotatedTermAnnotation = ann}))+ Core.TermTypeApplication v1 -> (deannotateAndDetypeTerm (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (deannotateAndDetypeTerm (Core.typeLambdaBody v1))+ _ -> t) t)++-- | Flatten nested let expressions+flattenLetTerms :: (Core.Term -> Core.Term)+flattenLetTerms term = + let rewriteBinding = (\binding -> + let key0 = (Core.bindingName binding)+ in + let val0 = (Core.bindingTerm binding)+ in + let t = (Core.bindingType binding)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> + let val1 = (Core.annotatedTermBody v1)+ in + let ann = (Core.annotatedTermAnnotation v1)+ in + let recursive = (rewriteBinding (Core.Binding {+ Core.bindingName = key0,+ Core.bindingTerm = val1,+ Core.bindingType = t}))+ in + let innerBinding = (Pairs.first recursive)+ in + let deps = (Pairs.second recursive)+ in + let val2 = (Core.bindingTerm innerBinding)+ in (Core.Binding {+ Core.bindingName = key0,+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = val2,+ Core.annotatedTermAnnotation = ann})),+ Core.bindingType = t}, deps)+ Core.TermLet v1 -> + let bindings1 = (Core.letBindings v1)+ in + let body1 = (Core.letBody v1)+ in + let prefix = (Strings.cat2 (Core.unName key0) "_")+ in + let qualify = (\n -> Core.Name (Strings.cat2 prefix (Core.unName n)))+ in + let toSubstPair = (\b -> (Core.bindingName b, (qualify (Core.bindingName b))))+ in + let subst = (Maps.fromList (Lists.map toSubstPair bindings1))+ in + let replaceVars = (substituteVariables subst)+ in + let newBody = (replaceVars body1)+ in + let newBinding = (\b -> Core.Binding {+ Core.bindingName = (qualify (Core.bindingName b)),+ Core.bindingTerm = (replaceVars (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in (Core.Binding {+ Core.bindingName = key0,+ Core.bindingTerm = newBody,+ Core.bindingType = t}, (Lists.map newBinding bindings1))+ _ -> (Core.Binding {+ Core.bindingName = key0,+ Core.bindingTerm = val0,+ Core.bindingType = t}, [])) val0))+ in + let flattenBodyLet = (\bindings -> \body -> (\x -> case x of+ Core.TermLet v1 -> + let innerBindings = (Core.letBindings v1)+ in + let innerBody = (Core.letBody v1)+ in (flattenBodyLet (Lists.concat2 bindings innerBindings) innerBody)+ _ -> (Lists.concat2 [] bindings, body)) body)+ in + let flatten = (\recurse -> \term -> + let rewritten = (recurse term)+ in ((\x -> case x of+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1)+ in + let body = (Core.letBody v1)+ in + let forResult = (\hr -> Lists.concat2 (Pairs.second hr) (Lists.pure (Pairs.first hr)))+ in + let flattenedBindings = (Lists.concat (Lists.map (\arg_ -> forResult (rewriteBinding arg_)) bindings))+ in + let merged = (flattenBodyLet flattenedBindings body)+ in + let newBindings = (Pairs.first merged)+ in + let newBody = (Pairs.second merged)+ in (Core.TermLet (Core.Let {+ Core.letBindings = newBindings,+ Core.letBody = newBody}))+ _ -> rewritten) rewritten))+ in (rewriteTerm flatten term)++-- | Fold over a term, traversing its subterms in the specified order+foldOverTerm :: (Coders.TraversalOrder -> (t0 -> Core.Term -> t0) -> t0 -> Core.Term -> t0)+foldOverTerm order fld b0 term = ((\x -> case x of+ Coders.TraversalOrderPre -> (Lists.foldl (foldOverTerm order fld) (fld b0 term) (subterms term))+ Coders.TraversalOrderPost -> (fld (Lists.foldl (foldOverTerm order fld) b0 (subterms term)) term)) order)++-- | Fold over a type, traversing its subtypes in the specified order+foldOverType :: (Coders.TraversalOrder -> (t0 -> Core.Type -> t0) -> t0 -> Core.Type -> t0)+foldOverType order fld b0 typ = ((\x -> case x of+ Coders.TraversalOrderPre -> (Lists.foldl (foldOverType order fld) (fld b0 typ) (subtypes typ))+ Coders.TraversalOrderPost -> (fld (Lists.foldl (foldOverType order fld) b0 (subtypes typ)) typ)) order)++-- | Get the set of free type variables in a term (including schema names, where they appear in type annotations). In this context, only the type schemes of let bindings can bind type variables; type lambdas do not.+freeTypeVariablesInTerm :: (Core.Term -> S.Set Core.Name)+freeTypeVariablesInTerm term0 = + let allOf = (\sets -> Lists.foldl Sets.union Sets.empty sets)+ in + let tryType = (\tvars -> \typ -> Sets.difference (freeVariablesInType typ) tvars)+ in + let getAll = (\vars -> \term -> + let recurse = (getAll vars)+ in + let dflt = (allOf (Lists.map recurse (subterms term)))+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination _ -> dflt+ Core.FunctionLambda v2 -> + let domt = (Maybes.maybe Sets.empty (tryType vars) (Core.lambdaDomain v2))+ in (Sets.union domt (recurse (Core.lambdaBody v2)))+ _ -> dflt) v1)+ Core.TermLet v1 -> + let forBinding = (\b -> + let newVars = (Maybes.maybe vars (\ts -> Sets.union vars (Sets.fromList (Core.typeSchemeVariables ts))) (Core.bindingType b))+ in (Sets.union (getAll newVars (Core.bindingTerm b)) (Maybes.maybe Sets.empty (\ts -> tryType newVars (Core.typeSchemeType ts)) (Core.bindingType b))))+ in (Sets.union (allOf (Lists.map forBinding (Core.letBindings v1))) (recurse (Core.letBody v1)))+ Core.TermTypeApplication v1 -> (Sets.union (tryType vars (Core.typeApplicationTermType v1)) (recurse (Core.typeApplicationTermBody v1)))+ Core.TermTypeLambda v1 -> (Sets.union (tryType vars (Core.TypeVariable (Core.typeLambdaParameter v1))) (recurse (Core.typeLambdaBody v1)))+ _ -> dflt) term))+ in (getAll Sets.empty term0)++-- | Find the free variables (i.e. variables not bound by a lambda or let) in a term+freeVariablesInTerm :: (Core.Term -> S.Set Core.Name)+freeVariablesInTerm term = + let dfltVars = (Lists.foldl (\s -> \t -> Sets.union s (freeVariablesInTerm t)) Sets.empty (subterms term))+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Sets.delete (Core.lambdaParameter v2) (freeVariablesInTerm (Core.lambdaBody v2)))+ _ -> dfltVars) v1)+ Core.TermLet v1 -> (Sets.difference dfltVars (Sets.fromList (Lists.map Core.bindingName (Core.letBindings v1))))+ Core.TermVariable v1 -> (Sets.singleton v1)+ _ -> dfltVars) term)++-- | Find the free variables (i.e. variables not bound by a lambda or let) in a type+freeVariablesInType :: (Core.Type -> S.Set Core.Name)+freeVariablesInType typ = + let dfltVars = (Lists.foldl (\s -> \t -> Sets.union s (freeVariablesInType t)) Sets.empty (subtypes typ))+ in ((\x -> case x of+ Core.TypeForall v1 -> (Sets.delete (Core.forallTypeParameter v1) (freeVariablesInType (Core.forallTypeBody v1)))+ Core.TypeVariable v1 -> (Sets.singleton v1)+ _ -> dfltVars) typ)++-- | Find the free variables in a type in deterministic left-to-right order+freeVariablesInTypeOrdered :: (Core.Type -> [Core.Name])+freeVariablesInTypeOrdered typ = + let collectVars = (\boundVars -> \t -> (\x -> case x of+ Core.TypeVariable v1 -> (Logic.ifElse (Sets.member v1 boundVars) [] [+ v1])+ Core.TypeForall v1 -> (collectVars (Sets.insert (Core.forallTypeParameter v1) boundVars) (Core.forallTypeBody v1))+ _ -> (Lists.concat (Lists.map (collectVars boundVars) (subtypes t)))) t)+ in (Lists.nub (collectVars Sets.empty typ))++-- | Find free variables in a type scheme (simple version)+freeVariablesInTypeSchemeSimple :: (Core.TypeScheme -> S.Set Core.Name)+freeVariablesInTypeSchemeSimple ts = + let vars = (Core.typeSchemeVariables ts)+ in + let t = (Core.typeSchemeType ts)+ in (Sets.difference (freeVariablesInTypeSimple t) (Sets.fromList vars))++-- | Find free variables in a type scheme+freeVariablesInTypeScheme :: (Core.TypeScheme -> S.Set Core.Name)+freeVariablesInTypeScheme ts = + let vars = (Core.typeSchemeVariables ts)+ in + let t = (Core.typeSchemeType ts)+ in (Sets.difference (freeVariablesInType t) (Sets.fromList vars))++-- | Same as freeVariablesInType, but ignores the binding action of lambda types+freeVariablesInTypeSimple :: (Core.Type -> S.Set Core.Name)+freeVariablesInTypeSimple typ = + let helper = (\types -> \typ -> (\x -> case x of+ Core.TypeVariable v1 -> (Sets.insert v1 types)+ _ -> types) typ)+ in (foldOverType Coders.TraversalOrderPre helper Sets.empty typ)++-- | Inline all type variables in a type using the provided schema. Note: this function is only appropriate for nonrecursive type definitions+inlineType :: (M.Map Core.Name Core.Type -> Core.Type -> Compute.Flow t0 Core.Type)+inlineType schema typ = + let f = (\recurse -> \typ -> + let afterRecurse = (\tr -> (\x -> case x of+ Core.TypeVariable v1 -> (Maybes.maybe (Flows.fail (Strings.cat2 "No such type in schema: " (Core.unName v1))) (inlineType schema) (Maps.lookup v1 schema))+ _ -> (Flows.pure tr)) tr)+ in (Flows.bind (recurse typ) (\tr -> afterRecurse tr)))+ in (rewriteTypeM f typ)++-- | Check whether a variable is free (not bound) in a term+isFreeVariableInTerm :: (Core.Name -> Core.Term -> Bool)+isFreeVariableInTerm v term = (Logic.not (Sets.member v (freeVariablesInTerm term)))++-- | Check whether a term is a lambda, possibly nested within let and/or annotation terms+isLambda :: (Core.Term -> Bool)+isLambda term = ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda _ -> True+ _ -> False) v1)+ Core.TermLet v1 -> (isLambda (Core.letBody v1))+ _ -> False) (deannotateTerm term))++-- | Rewrite terms like `let foo = bar in λx.baz` to `λx.let foo = bar in baz`, lifting lambda-bound variables above let-bound variables, recursively. This is helpful for targets such as Python.+liftLambdaAboveLet :: (Core.Term -> Core.Term)+liftLambdaAboveLet term0 = + let rewrite = (\recurse -> \term -> + let rewriteBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (rewrite recurse (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in + let rewriteBindings = (\bs -> Lists.map rewriteBinding bs)+ in + let digForLambdas = (\original -> \cons -> \term -> (\x -> case x of+ Core.TermAnnotated v1 -> (digForLambdas original (\t -> Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (cons t),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)})) (Core.annotatedTermBody v1))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = (Core.lambdaDomain v2),+ Core.lambdaBody = (digForLambdas (cons (Core.lambdaBody v2)) (\t -> cons t) (Core.lambdaBody v2))})))+ _ -> (recurse original)) v1)+ Core.TermLet v1 -> (digForLambdas original (\t -> cons (Core.TermLet (Core.Let {+ Core.letBindings = (rewriteBindings (Core.letBindings v1)),+ Core.letBody = t}))) (Core.letBody v1))+ _ -> (recurse original)) term)+ in ((\x -> case x of+ Core.TermLet v1 -> (digForLambdas term (\t -> Core.TermLet (Core.Let {+ Core.letBindings = (rewriteBindings (Core.letBindings v1)),+ Core.letBody = t})) (Core.letBody v1))+ _ -> (recurse term)) term))+ in (rewriteTerm rewrite term0)++-- | Apply a transformation to the first type beneath a chain of annotations+mapBeneathTypeAnnotations :: ((Core.Type -> Core.Type) -> Core.Type -> Core.Type)+mapBeneathTypeAnnotations f t = ((\x -> case x of+ Core.TypeAnnotated v1 -> (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (mapBeneathTypeAnnotations f (Core.annotatedTypeBody v1)),+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))+ _ -> (f t)) t)++-- | Recursively replace the type variables of let bindings with the systematic type variables t0, t1, t2, ...+normalizeTypeVariablesInTerm :: (Core.Term -> Core.Term)+normalizeTypeVariablesInTerm term = + let replaceName = (\subst -> \v -> Maybes.fromMaybe v (Maps.lookup v subst))+ in + let substType = (\subst -> \typ -> + let rewrite = (\recurse -> \typ -> (\x -> case x of+ Core.TypeVariable v1 -> (Core.TypeVariable (replaceName subst v1))+ _ -> (recurse typ)) typ)+ in (rewriteType rewrite typ))+ in + let rewriteWithSubst = (\state -> \term0 -> + let sb = (Pairs.first state)+ in + let next = (Pairs.second state)+ in + let subst = (Pairs.first sb)+ in + let boundVars = (Pairs.second sb)+ in + let rewrite = (\recurse -> \term -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination _ -> (recurse term)+ Core.FunctionLambda v2 -> + let domain = (Core.lambdaDomain v2)+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = (Maybes.map (substType subst) domain),+ Core.lambdaBody = (rewriteWithSubst ((subst, boundVars), next) (Core.lambdaBody v2))})))+ _ -> (recurse term)) v1)+ Core.TermLet v1 -> + let bindings0 = (Core.letBindings v1)+ in + let body0 = (Core.letBody v1)+ in + let step = (\acc -> \bs -> + let b = (Lists.head bs)+ in + let tl = (Lists.tail bs)+ in + let noType = + let newVal = (rewriteWithSubst ((subst, boundVars), next) (Core.bindingTerm b))+ in + let b1 = Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = newVal,+ Core.bindingType = Nothing}+ in (step (Lists.cons b1 acc) tl)+ in + let withType = (\ts -> + let vars = (Core.typeSchemeVariables ts)+ in + let typ = (Core.typeSchemeType ts)+ in + let k = (Lists.length vars)+ in + let gen = (\i -> \rem -> \acc2 -> + let ti = (Core.Name (Strings.cat2 "t" (Literals.showInt32 (Math.add next i))))+ in (Logic.ifElse (Equality.equal rem 0) (Lists.reverse acc2) (gen (Math.add i 1) (Math.sub rem 1) (Lists.cons ti acc2))))+ in + let newVars = (gen 0 k [])+ in + let newSubst = (Maps.union (Maps.fromList (Lists.zip vars newVars)) subst)+ in + let newBound = (Sets.union boundVars (Sets.fromList newVars))+ in + let newVal = (rewriteWithSubst ((newSubst, newBound), (Math.add next k)) (Core.bindingTerm b))+ in + let renameConstraintKeys = (\constraintMap -> Maps.fromList (Lists.map (\p -> + let oldName = (Pairs.first p)+ in + let meta = (Pairs.second p)+ in + let newName = (Maybes.fromMaybe oldName (Maps.lookup oldName newSubst))+ in (newName, meta)) (Maps.toList constraintMap)))+ in + let oldConstraints = (Core.typeSchemeConstraints ts)+ in + let newConstraints = (Maybes.map renameConstraintKeys oldConstraints)+ in + let b1 = Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = newVal,+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = newVars,+ Core.typeSchemeType = (substType newSubst typ),+ Core.typeSchemeConstraints = newConstraints}))}+ in (step (Lists.cons b1 acc) tl))+ in (Logic.ifElse (Lists.null bs) (Lists.reverse acc) (Maybes.maybe noType (\ts -> withType ts) (Core.bindingType b))))+ in + let bindings1 = (step [] bindings0)+ in (Core.TermLet (Core.Let {+ Core.letBindings = bindings1,+ Core.letBody = (rewriteWithSubst ((subst, boundVars), next) body0)}))+ Core.TermTypeApplication v1 -> (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (rewriteWithSubst ((subst, boundVars), next) (Core.typeApplicationTermBody v1)),+ Core.typeApplicationTermType = (substType subst (Core.typeApplicationTermType v1))}))+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (replaceName subst (Core.typeLambdaParameter v1)),+ Core.typeLambdaBody = (rewriteWithSubst ((subst, boundVars), next) (Core.typeLambdaBody v1))}))+ _ -> (recurse term)) term)+ in (rewriteTerm rewrite term0))+ in (rewriteWithSubst ((Maps.empty, Sets.empty), 0) term)++-- | Given a let expression, remove any unused bindings. The resulting expression is still a let, even if has no remaining bindings+pruneLet :: (Core.Let -> Core.Let)+pruneLet l = + let bindingMap = (Maps.fromList (Lists.map (\b -> (Core.bindingName b, (Core.bindingTerm b))) (Core.letBindings l)))+ in + let rootName = (Core.Name "[[[root]]]")+ in + let adj = (\n -> Sets.intersection (Sets.fromList (Maps.keys bindingMap)) (freeVariablesInTerm (Logic.ifElse (Equality.equal n rootName) (Core.letBody l) (Maybes.fromJust (Maps.lookup n bindingMap)))))+ in + let reachable = (Sorting.findReachableNodes adj rootName)+ in + let prunedBindings = (Lists.filter (\b -> Sets.member (Core.bindingName b) reachable) (Core.letBindings l))+ in Core.Let {+ Core.letBindings = prunedBindings,+ Core.letBody = (Core.letBody l)}++-- | Recursively remove term annotations, including within subterms+removeTermAnnotations :: (Core.Term -> Core.Term)+removeTermAnnotations term = + let remove = (\recurse -> \term -> + let rewritten = (recurse term)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.annotatedTermBody v1)+ _ -> rewritten) term))+ in (rewriteTerm remove term)++-- | Recursively remove type annotations, including within subtypes+removeTypeAnnotations :: (Core.Type -> Core.Type)+removeTypeAnnotations typ = + let remove = (\recurse -> \typ -> + let rewritten = (recurse typ)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (Core.annotatedTypeBody v1)+ _ -> rewritten) rewritten))+ in (rewriteType remove typ)++-- | Strip type annotations (TypeLambda, TypeApplication, binding type schemes) from terms while preserving lambda domain types and other annotations+removeTypeAnnotationsFromTerm :: (Core.Term -> Core.Term)+removeTypeAnnotationsFromTerm term = + let strip = (\recurse -> \term -> + let rewritten = (recurse term)+ in + let stripBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Core.bindingTerm b),+ Core.bindingType = Nothing})+ in ((\x -> case x of+ Core.TermLet v1 -> (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.map stripBinding (Core.letBindings v1)),+ Core.letBody = (Core.letBody v1)}))+ Core.TermTypeApplication v1 -> (Core.typeApplicationTermBody v1)+ Core.TermTypeLambda v1 -> (Core.typeLambdaBody v1)+ _ -> rewritten) rewritten))+ in (rewriteTerm strip term)++-- | Strip type annotations from terms while preserving other annotations+removeTypesFromTerm :: (Core.Term -> Core.Term)+removeTypesFromTerm term = + let strip = (\recurse -> \term -> + let rewritten = (recurse term)+ in + let stripBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (Core.bindingTerm b),+ Core.bindingType = Nothing})+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> (Core.TermFunction (Core.FunctionElimination v2))+ Core.FunctionLambda v2 -> (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v2),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.lambdaBody v2)})))+ _ -> (Core.TermFunction v1)) v1)+ Core.TermLet v1 -> (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.map stripBinding (Core.letBindings v1)),+ Core.letBody = (Core.letBody v1)}))+ Core.TermTypeApplication v1 -> (Core.typeApplicationTermBody v1)+ Core.TermTypeLambda v1 -> (Core.typeLambdaBody v1)+ _ -> rewritten) rewritten))+ in (rewriteTerm strip term)++-- | Replace a free variable in a term+replaceFreeTermVariable :: (Core.Name -> Core.Term -> Core.Term -> Core.Term)+replaceFreeTermVariable vold tnew term = + let rewrite = (\recurse -> \t -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> + let v = (Core.lambdaParameter v2)+ in (Logic.ifElse (Equality.equal v vold) t (recurse t))+ _ -> (recurse t)) v1)+ Core.TermVariable v1 -> (Logic.ifElse (Equality.equal v1 vold) tnew (Core.TermVariable v1))+ _ -> (recurse t)) t)+ in (rewriteTerm rewrite term)++-- | Replace free occurrences of a name in a type+replaceFreeTypeVariable :: (Core.Name -> Core.Type -> Core.Type -> Core.Type)+replaceFreeTypeVariable v rep typ = + let mapExpr = (\recurse -> \t -> (\x -> case x of+ Core.TypeForall v1 -> (Logic.ifElse (Equality.equal v (Core.forallTypeParameter v1)) t (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.forallTypeParameter v1),+ Core.forallTypeBody = (recurse (Core.forallTypeBody v1))})))+ Core.TypeVariable v1 -> (Logic.ifElse (Equality.equal v v1) rep t)+ _ -> (recurse t)) t)+ in (rewriteType mapExpr typ)++-- | Replace all occurrences of simple typedefs (type aliases) with the aliased types, recursively+replaceTypedefs :: (M.Map Core.Name Core.TypeScheme -> Core.Type -> Core.Type)+replaceTypedefs types typ0 = + let rewrite = (\recurse -> \typ -> (\x -> case x of+ Core.TypeAnnotated v1 -> (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (rewrite recurse (Core.annotatedTypeBody v1)),+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))+ Core.TypeRecord _ -> typ+ Core.TypeUnion _ -> typ+ Core.TypeVariable v1 -> + let forMono = (\t -> (\x -> case x of+ Core.TypeRecord _ -> typ+ Core.TypeUnion _ -> typ+ Core.TypeWrap _ -> typ+ _ -> (rewrite recurse t)) t)+ in + let forTypeScheme = (\ts -> + let t = (Core.typeSchemeType ts)+ in (Logic.ifElse (Lists.null (Core.typeSchemeVariables ts)) (forMono t) typ))+ in (Maybes.maybe typ (\ts -> forTypeScheme ts) (Maps.lookup v1 types))+ Core.TypeWrap _ -> typ+ _ -> (recurse typ)) typ)+ in (rewriteType rewrite typ0)++-- | Rewrite a term, and at the same time, fold a function over it, accumulating a value+rewriteAndFoldTerm :: (((t0 -> Core.Term -> (t0, Core.Term)) -> t0 -> Core.Term -> (t0, Core.Term)) -> t0 -> Core.Term -> (t0, Core.Term))+rewriteAndFoldTerm f term0 = + let fsub = (\recurse -> \val0 -> \term0 -> + let forSingle = (\rec -> \cons -> \val -> \term -> + let r = (rec val term)+ in (Pairs.first r, (cons (Pairs.second r))))+ in + let forMany = (\rec -> \cons -> \val -> \els -> + let rr = (Lists.foldl (\r -> \el -> + let r2 = (rec (Pairs.first r) el)+ in (Pairs.first r2, (Lists.cons (Pairs.second r2) (Pairs.second r)))) (val, []) els)+ in (Pairs.first rr, (cons (Lists.reverse (Pairs.second rr)))))+ in + let forField = (\val -> \field -> + let r = (recurse val (Core.fieldTerm field))+ in (Pairs.first r, Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = (Pairs.second r)}))+ in + let forFields = (forMany forField (\x -> x))+ in + let forPair = (\val -> \kv -> + let rk = (recurse val (Pairs.first kv))+ in + let rv = (recurse (Pairs.first rk) (Pairs.second kv))+ in (Pairs.first rv, (Pairs.second rk, (Pairs.second rv))))+ in + let forBinding = (\val -> \binding -> + let r = (recurse val (Core.bindingTerm binding))+ in (Pairs.first r, Core.Binding {+ Core.bindingName = (Core.bindingName binding),+ Core.bindingTerm = (Pairs.second r),+ Core.bindingType = (Core.bindingType binding)}))+ in + let forElimination = (\val -> \elm -> + let r = ((\x -> case x of+ Core.EliminationUnion v1 -> + let rmd = (Maybes.map (recurse val) (Core.caseStatementDefault v1))+ in + let val1 = (Maybes.maybe val Pairs.first rmd)+ in + let rcases = (forFields val1 (Core.caseStatementCases v1))+ in (Pairs.first rcases, (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map Pairs.second rmd),+ Core.caseStatementCases = (Pairs.second rcases)})))+ _ -> (val, elm)) elm)+ in (Pairs.first r, (Pairs.second r)))+ in + let forFunction = (\val -> \fun -> (\x -> case x of+ Core.FunctionElimination v1 -> + let re = (forElimination val v1)+ in (Pairs.first re, (Core.FunctionElimination (Pairs.second re)))+ Core.FunctionLambda v1 -> + let rl = (recurse val (Core.lambdaBody v1))+ in (Pairs.first rl, (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (Pairs.second rl)})))+ _ -> (val, fun)) fun)+ in + let dflt = (val0, term0)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (forSingle recurse (\t -> Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = t,+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)})) val0 (Core.annotatedTermBody v1))+ Core.TermApplication v1 -> + let rlhs = (recurse val0 (Core.applicationFunction v1))+ in + let rrhs = (recurse (Pairs.first rlhs) (Core.applicationArgument v1))+ in (Pairs.first rrhs, (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Pairs.second rlhs),+ Core.applicationArgument = (Pairs.second rrhs)})))+ Core.TermEither v1 -> (Eithers.either (\l -> + let rl = (recurse val0 l)+ in (Pairs.first rl, (Core.TermEither (Left (Pairs.second rl))))) (\r -> + let rr = (recurse val0 r)+ in (Pairs.first rr, (Core.TermEither (Right (Pairs.second rr))))) v1)+ Core.TermFunction v1 -> (forSingle forFunction (\f -> Core.TermFunction f) val0 v1)+ Core.TermLet v1 -> + let renv = (recurse val0 (Core.letBody v1))+ in (forMany forBinding (\bins -> Core.TermLet (Core.Let {+ Core.letBindings = bins,+ Core.letBody = (Pairs.second renv)})) (Pairs.first renv) (Core.letBindings v1))+ Core.TermList v1 -> (forMany recurse (\x -> Core.TermList x) val0 v1)+ Core.TermMap v1 -> (forMany forPair (\pairs -> Core.TermMap (Maps.fromList pairs)) val0 (Maps.toList v1))+ Core.TermMaybe v1 -> (Maybes.maybe dflt (\t -> forSingle recurse (\t1 -> Core.TermMaybe (Just t1)) val0 t) v1)+ Core.TermPair v1 -> + let rf = (recurse val0 (Pairs.first v1))+ in + let rs = (recurse (Pairs.first rf) (Pairs.second v1))+ in (Pairs.first rs, (Core.TermPair (Pairs.second rf, (Pairs.second rs))))+ Core.TermRecord v1 -> (forMany forField (\fields -> Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = fields})) val0 (Core.recordFields v1))+ Core.TermSet v1 -> (forMany recurse (\e -> Core.TermSet (Sets.fromList e)) val0 (Sets.toList v1))+ Core.TermTypeApplication v1 -> (forSingle recurse (\t -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)})) val0 (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (forSingle recurse (\t -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = t})) val0 (Core.typeLambdaBody v1))+ Core.TermUnion v1 -> (forSingle recurse (\t -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.fieldName (Core.injectionField v1)),+ Core.fieldTerm = t}})) val0 (Core.fieldTerm (Core.injectionField v1)))+ Core.TermWrap v1 -> (forSingle recurse (\t -> Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = t})) val0 (Core.wrappedTermBody v1))+ _ -> dflt) term0))+ in + let recurse = (f (fsub recurse))+ in (recurse term0)++-- | Monadic version: rewrite a term and fold a function over it, accumulating a value+rewriteAndFoldTermM :: (((t0 -> Core.Term -> Compute.Flow t1 (t0, Core.Term)) -> t0 -> Core.Term -> Compute.Flow t1 (t0, Core.Term)) -> t0 -> Core.Term -> Compute.Flow t1 (t0, Core.Term))+rewriteAndFoldTermM f term0 = + let fsub = (\recurse -> \val0 -> \term0 -> + let forSingle = (\rec -> \cons -> \val -> \term -> Flows.bind (rec val term) (\r -> Flows.pure (Pairs.first r, (cons (Pairs.second r)))))+ in + let forMany = (\rec -> \cons -> \val -> \els -> Flows.bind (Flows.foldl (\r -> \el -> Flows.bind (rec (Pairs.first r) el) (\r2 -> Flows.pure (Pairs.first r2, (Lists.cons (Pairs.second r2) (Pairs.second r))))) (val, []) els) (\rr -> Flows.pure (Pairs.first rr, (cons (Lists.reverse (Pairs.second rr))))))+ in + let forField = (\val -> \field -> Flows.bind (recurse val (Core.fieldTerm field)) (\r -> Flows.pure (Pairs.first r, Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = (Pairs.second r)})))+ in + let forFields = (forMany forField (\x -> x))+ in + let forPair = (\val -> \kv -> Flows.bind (recurse val (Pairs.first kv)) (\rk -> Flows.bind (recurse (Pairs.first rk) (Pairs.second kv)) (\rv -> Flows.pure (Pairs.first rv, (Pairs.second rk, (Pairs.second rv))))))+ in + let forBinding = (\val -> \binding -> Flows.bind (recurse val (Core.bindingTerm binding)) (\r -> Flows.pure (Pairs.first r, Core.Binding {+ Core.bindingName = (Core.bindingName binding),+ Core.bindingTerm = (Pairs.second r),+ Core.bindingType = (Core.bindingType binding)})))+ in + let forElimination = (\val -> \elm -> + let rw = (\elm -> (\x -> case x of+ Core.EliminationUnion v1 -> (Flows.bind (Maybes.maybe (Flows.pure Nothing) (\def -> Flows.map Maybes.pure (recurse val def)) (Core.caseStatementDefault v1)) (\rmd -> + let val1 = (Maybes.maybe val Pairs.first rmd)+ in (Flows.bind (forFields val1 (Core.caseStatementCases v1)) (\rcases -> Flows.pure (Pairs.first rcases, (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map Pairs.second rmd),+ Core.caseStatementCases = (Pairs.second rcases)})))))))+ _ -> (Flows.pure (val, elm))) elm)+ in (Flows.bind (rw elm) (\r -> Flows.pure (Pairs.first r, (Pairs.second r)))))+ in + let forFunction = (\val -> \fun -> (\x -> case x of+ Core.FunctionElimination v1 -> (Flows.bind (forElimination val v1) (\r -> Flows.pure (Pairs.first r, (Core.FunctionElimination (Pairs.second r)))))+ Core.FunctionLambda v1 -> (Flows.bind (recurse val (Core.lambdaBody v1)) (\r -> Flows.pure (Pairs.first r, (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (Pairs.second r)})))))+ _ -> (Flows.pure (val, fun))) fun)+ in + let dflt = (Flows.pure (val0, term0))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (forSingle recurse (\t -> Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = t,+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)})) val0 (Core.annotatedTermBody v1))+ Core.TermApplication v1 -> (Flows.bind (recurse val0 (Core.applicationFunction v1)) (\rlhs -> Flows.bind (recurse (Pairs.first rlhs) (Core.applicationArgument v1)) (\rrhs -> Flows.pure (Pairs.first rrhs, (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Pairs.second rlhs),+ Core.applicationArgument = (Pairs.second rrhs)}))))))+ Core.TermEither v1 -> (Eithers.either (\l -> Flows.bind (recurse val0 l) (\rl -> Flows.pure (Pairs.first rl, (Core.TermEither (Left (Pairs.second rl)))))) (\r -> Flows.bind (recurse val0 r) (\rr -> Flows.pure (Pairs.first rr, (Core.TermEither (Right (Pairs.second rr)))))) v1)+ Core.TermFunction v1 -> (forSingle forFunction (\f -> Core.TermFunction f) val0 v1)+ Core.TermLet v1 -> (Flows.bind (recurse val0 (Core.letBody v1)) (\renv -> forMany forBinding (\bins -> Core.TermLet (Core.Let {+ Core.letBindings = bins,+ Core.letBody = (Pairs.second renv)})) (Pairs.first renv) (Core.letBindings v1)))+ Core.TermList v1 -> (forMany recurse (\x -> Core.TermList x) val0 v1)+ Core.TermMap v1 -> (forMany forPair (\pairs -> Core.TermMap (Maps.fromList pairs)) val0 (Maps.toList v1))+ Core.TermMaybe v1 -> (Maybes.maybe dflt (\t -> forSingle recurse (\t1 -> Core.TermMaybe (Just t1)) val0 t) v1)+ Core.TermPair v1 -> (Flows.bind (recurse val0 (Pairs.first v1)) (\rf -> Flows.bind (recurse (Pairs.first rf) (Pairs.second v1)) (\rs -> Flows.pure (Pairs.first rs, (Core.TermPair (Pairs.second rf, (Pairs.second rs)))))))+ Core.TermRecord v1 -> (forMany forField (\fields -> Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = fields})) val0 (Core.recordFields v1))+ Core.TermSet v1 -> (forMany recurse (\e -> Core.TermSet (Sets.fromList e)) val0 (Sets.toList v1))+ Core.TermTypeApplication v1 -> (forSingle recurse (\t -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)})) val0 (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (forSingle recurse (\t -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = t})) val0 (Core.typeLambdaBody v1))+ Core.TermUnion v1 -> (forSingle recurse (\t -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.fieldName (Core.injectionField v1)),+ Core.fieldTerm = t}})) val0 (Core.fieldTerm (Core.injectionField v1)))+ Core.TermWrap v1 -> (forSingle recurse (\t -> Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = t})) val0 (Core.wrappedTermBody v1))+ _ -> dflt) term0))+ in + let recurse = (f (fsub recurse))+ in (recurse term0)++-- | Rewrite a term with path tracking, and fold a function over it, accumulating a value. The path is a list of TermAccessors from root to current position.+rewriteAndFoldTermWithPath :: ((([Accessors.TermAccessor] -> t0 -> Core.Term -> (t0, Core.Term)) -> [Accessors.TermAccessor] -> t0 -> Core.Term -> (t0, Core.Term)) -> t0 -> Core.Term -> (t0, Core.Term))+rewriteAndFoldTermWithPath f term0 = + let fsub = (\recurse -> \path -> \val0 -> \term0 -> + let forSingleWithAccessor = (\rec -> \cons -> \accessor -> \val -> \term -> + let r = (rec (Lists.concat2 path [+ accessor]) val term)+ in (Pairs.first r, (cons (Pairs.second r))))+ in + let forManyWithAccessors = (\rec -> \cons -> \val -> \accessorTermPairs -> + let rr = (Lists.foldl (\r -> \atp -> + let r2 = (rec (Lists.concat2 path [+ Pairs.first atp]) (Pairs.first r) (Pairs.second atp))+ in (Pairs.first r2, (Lists.cons (Pairs.second r2) (Pairs.second r)))) (val, []) accessorTermPairs)+ in (Pairs.first rr, (cons (Lists.reverse (Pairs.second rr)))))+ in + let forFieldWithAccessor = (\mkAccessor -> \val -> \field -> + let r = (recurse (Lists.concat2 path [+ mkAccessor (Core.fieldName field)]) val (Core.fieldTerm field))+ in (Pairs.first r, Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = (Pairs.second r)}))+ in + let forFieldsWithAccessor = (\mkAccessor -> forManyWithAccessors (\path1 -> \val1 -> \field1 -> forFieldWithAccessor mkAccessor val1 field1) (\x -> x))+ in + let forPairWithAccessors = (\keyAccessor -> \valAccessor -> \val -> \kv -> + let rk = (recurse (Lists.concat2 path [+ keyAccessor]) val (Pairs.first kv))+ in + let rv = (recurse (Lists.concat2 path [+ valAccessor]) (Pairs.first rk) (Pairs.second kv))+ in (Pairs.first rv, (Pairs.second rk, (Pairs.second rv))))+ in + let forBindingWithAccessor = (\val -> \binding -> + let r = (recurse (Lists.concat2 path [+ Accessors.TermAccessorLetBinding (Core.bindingName binding)]) val (Core.bindingTerm binding))+ in (Pairs.first r, Core.Binding {+ Core.bindingName = (Core.bindingName binding),+ Core.bindingTerm = (Pairs.second r),+ Core.bindingType = (Core.bindingType binding)}))+ in + let forElimination = (\val -> \elm -> + let r = ((\x -> case x of+ Core.EliminationUnion v1 -> + let rmd = (Maybes.map (\def -> recurse (Lists.concat2 path [+ Accessors.TermAccessorUnionCasesDefault]) val def) (Core.caseStatementDefault v1))+ in + let val1 = (Maybes.maybe val Pairs.first rmd)+ in + let rcases = (forManyWithAccessors recurse (\x -> x) val1 (Lists.map (\f -> (Accessors.TermAccessorUnionCasesBranch (Core.fieldName f), (Core.fieldTerm f))) (Core.caseStatementCases v1)))+ in (Pairs.first rcases, (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map Pairs.second rmd),+ Core.caseStatementCases = (Lists.map (\ft -> Core.Field {+ Core.fieldName = (Pairs.first ft),+ Core.fieldTerm = (Pairs.second ft)}) (Lists.zip (Lists.map Core.fieldName (Core.caseStatementCases v1)) (Pairs.second rcases)))})))+ _ -> (val, elm)) elm)+ in (Pairs.first r, (Pairs.second r)))+ in + let forFunction = (\val -> \fun -> (\x -> case x of+ Core.FunctionElimination v1 -> + let re = (forElimination val v1)+ in (Pairs.first re, (Core.FunctionElimination (Pairs.second re)))+ Core.FunctionLambda v1 -> + let rl = (recurse (Lists.concat2 path [+ Accessors.TermAccessorLambdaBody]) val (Core.lambdaBody v1))+ in (Pairs.first rl, (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (Pairs.second rl)})))+ _ -> (val, fun)) fun)+ in + let dflt = (val0, term0)+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (forSingleWithAccessor recurse (\t -> Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = t,+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)})) Accessors.TermAccessorAnnotatedBody val0 (Core.annotatedTermBody v1))+ Core.TermApplication v1 -> + let rlhs = (recurse (Lists.concat2 path [+ Accessors.TermAccessorApplicationFunction]) val0 (Core.applicationFunction v1))+ in + let rrhs = (recurse (Lists.concat2 path [+ Accessors.TermAccessorApplicationArgument]) (Pairs.first rlhs) (Core.applicationArgument v1))+ in (Pairs.first rrhs, (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Pairs.second rlhs),+ Core.applicationArgument = (Pairs.second rrhs)})))+ Core.TermEither v1 -> (Eithers.either (\l -> + let rl = (recurse (Lists.concat2 path [+ Accessors.TermAccessorSumTerm]) val0 l)+ in (Pairs.first rl, (Core.TermEither (Left (Pairs.second rl))))) (\r -> + let rr = (recurse (Lists.concat2 path [+ Accessors.TermAccessorSumTerm]) val0 r)+ in (Pairs.first rr, (Core.TermEither (Right (Pairs.second rr))))) v1)+ Core.TermFunction v1 -> + let rf = (forFunction val0 v1)+ in (Pairs.first rf, (Core.TermFunction (Pairs.second rf)))+ Core.TermLet v1 -> + let renv = (recurse (Lists.concat2 path [+ Accessors.TermAccessorLetBody]) val0 (Core.letBody v1))+ in + let rbindings = (Lists.foldl (\r -> \binding -> + let rb = (forBindingWithAccessor (Pairs.first r) binding)+ in (Pairs.first rb, (Lists.cons (Pairs.second rb) (Pairs.second r)))) (Pairs.first renv, []) (Core.letBindings v1))+ in (Pairs.first rbindings, (Core.TermLet (Core.Let {+ Core.letBindings = (Lists.reverse (Pairs.second rbindings)),+ Core.letBody = (Pairs.second renv)})))+ Core.TermList v1 -> + let idx = 0+ in + let rr = (Lists.foldl (\r -> \el -> + let r2 = (recurse (Lists.concat2 path [+ Accessors.TermAccessorListElement (Pairs.first r)]) (Pairs.first (Pairs.second r)) el)+ in (Math.add (Pairs.first r) 1, (Pairs.first r2, (Lists.cons (Pairs.second r2) (Pairs.second (Pairs.second r)))))) (idx, (val0, [])) v1)+ in (Pairs.first (Pairs.second rr), (Core.TermList (Lists.reverse (Pairs.second (Pairs.second rr)))))+ Core.TermMap v1 -> + let idx = 0+ in + let rr = (Lists.foldl (\r -> \kv -> + let rk = (recurse (Lists.concat2 path [+ Accessors.TermAccessorMapKey (Pairs.first r)]) (Pairs.first (Pairs.second r)) (Pairs.first kv))+ in + let rv = (recurse (Lists.concat2 path [+ Accessors.TermAccessorMapValue (Pairs.first r)]) (Pairs.first rk) (Pairs.second kv))+ in (Math.add (Pairs.first r) 1, (Pairs.first rv, (Lists.cons (Pairs.second rk, (Pairs.second rv)) (Pairs.second (Pairs.second r)))))) (idx, (val0, [])) (Maps.toList v1))+ in (Pairs.first (Pairs.second rr), (Core.TermMap (Maps.fromList (Lists.reverse (Pairs.second (Pairs.second rr))))))+ Core.TermMaybe v1 -> (Maybes.maybe dflt (\t -> forSingleWithAccessor recurse (\t1 -> Core.TermMaybe (Just t1)) Accessors.TermAccessorMaybeTerm val0 t) v1)+ Core.TermPair v1 -> + let rf = (recurse (Lists.concat2 path [+ Accessors.TermAccessorProductTerm 0]) val0 (Pairs.first v1))+ in + let rs = (recurse (Lists.concat2 path [+ Accessors.TermAccessorProductTerm 1]) (Pairs.first rf) (Pairs.second v1))+ in (Pairs.first rs, (Core.TermPair (Pairs.second rf, (Pairs.second rs))))+ Core.TermRecord v1 -> + let rfields = (forManyWithAccessors recurse (\x -> x) val0 (Lists.map (\f -> (Accessors.TermAccessorRecordField (Core.fieldName f), (Core.fieldTerm f))) (Core.recordFields v1)))+ in (Pairs.first rfields, (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = (Lists.map (\ft -> Core.Field {+ Core.fieldName = (Pairs.first ft),+ Core.fieldTerm = (Pairs.second ft)}) (Lists.zip (Lists.map Core.fieldName (Core.recordFields v1)) (Pairs.second rfields)))})))+ Core.TermSet v1 -> + let idx = 0+ in + let rr = (Lists.foldl (\r -> \el -> + let r2 = (recurse (Lists.concat2 path [+ Accessors.TermAccessorSetElement (Pairs.first r)]) (Pairs.first (Pairs.second r)) el)+ in (Math.add (Pairs.first r) 1, (Pairs.first r2, (Lists.cons (Pairs.second r2) (Pairs.second (Pairs.second r)))))) (idx, (val0, [])) (Sets.toList v1))+ in (Pairs.first (Pairs.second rr), (Core.TermSet (Sets.fromList (Lists.reverse (Pairs.second (Pairs.second rr))))))+ Core.TermTypeApplication v1 -> (forSingleWithAccessor recurse (\t -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)})) Accessors.TermAccessorTypeApplicationTerm val0 (Core.typeApplicationTermBody v1))+ Core.TermTypeLambda v1 -> (forSingleWithAccessor recurse (\t -> Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = t})) Accessors.TermAccessorTypeLambdaBody val0 (Core.typeLambdaBody v1))+ Core.TermUnion v1 -> (forSingleWithAccessor recurse (\t -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.fieldName (Core.injectionField v1)),+ Core.fieldTerm = t}})) Accessors.TermAccessorInjectionTerm val0 (Core.fieldTerm (Core.injectionField v1)))+ Core.TermWrap v1 -> (forSingleWithAccessor recurse (\t -> Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = t})) Accessors.TermAccessorWrappedTerm val0 (Core.wrappedTermBody v1))+ _ -> dflt) term0))+ in + let recurse = (f (fsub recurse))+ in (recurse [] term0)++rewriteTerm :: (((Core.Term -> Core.Term) -> Core.Term -> Core.Term) -> Core.Term -> Core.Term)+rewriteTerm f term0 = + let fsub = (\recurse -> \term -> + let forField = (\f -> Core.Field {+ Core.fieldName = (Core.fieldName f),+ Core.fieldTerm = (recurse (Core.fieldTerm f))})+ in + let forElimination = (\elm -> (\x -> case x of+ Core.EliminationRecord v1 -> (Core.EliminationRecord v1)+ Core.EliminationUnion v1 -> (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map recurse (Core.caseStatementDefault v1)),+ Core.caseStatementCases = (Lists.map forField (Core.caseStatementCases v1))}))+ Core.EliminationWrap v1 -> (Core.EliminationWrap v1)) elm)+ in + let forFunction = (\fun -> (\x -> case x of+ Core.FunctionElimination v1 -> (Core.FunctionElimination (forElimination v1))+ Core.FunctionLambda v1 -> (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (recurse (Core.lambdaBody v1))}))+ Core.FunctionPrimitive v1 -> (Core.FunctionPrimitive v1)) fun)+ in + let forLet = (\lt -> + let mapBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (recurse (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in Core.Let {+ Core.letBindings = (Lists.map mapBinding (Core.letBindings lt)),+ Core.letBody = (recurse (Core.letBody lt))})+ in + let forMap = (\m -> + let forPair = (\p -> (recurse (Pairs.first p), (recurse (Pairs.second p))))+ in (Maps.fromList (Lists.map forPair (Maps.toList m))))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (recurse (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))+ Core.TermApplication v1 -> (Core.TermApplication (Core.Application {+ Core.applicationFunction = (recurse (Core.applicationFunction v1)),+ Core.applicationArgument = (recurse (Core.applicationArgument v1))}))+ Core.TermEither v1 -> (Core.TermEither (Eithers.either (\l -> Left (recurse l)) (\r -> Right (recurse r)) v1))+ Core.TermFunction v1 -> (Core.TermFunction (forFunction v1))+ Core.TermLet v1 -> (Core.TermLet (forLet v1))+ Core.TermList v1 -> (Core.TermList (Lists.map recurse v1))+ Core.TermLiteral v1 -> (Core.TermLiteral v1)+ Core.TermMap v1 -> (Core.TermMap (forMap v1))+ Core.TermMaybe v1 -> (Core.TermMaybe (Maybes.map recurse v1))+ Core.TermPair v1 -> (Core.TermPair (recurse (Pairs.first v1), (recurse (Pairs.second v1))))+ Core.TermRecord v1 -> (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = (Lists.map forField (Core.recordFields v1))}))+ Core.TermSet v1 -> (Core.TermSet (Sets.fromList (Lists.map recurse (Sets.toList v1))))+ Core.TermTypeApplication v1 -> (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (recurse (Core.typeApplicationTermBody v1)),+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)}))+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (recurse (Core.typeLambdaBody v1))}))+ Core.TermUnion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = (forField (Core.injectionField v1))}))+ Core.TermUnit -> Core.TermUnit+ Core.TermVariable v1 -> (Core.TermVariable v1)+ Core.TermWrap v1 -> (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = (recurse (Core.wrappedTermBody v1))}))) term))+ in + let recurse = (f (fsub recurse))+ in (recurse term0)++-- | Monadic term rewriting with custom transformation function+rewriteTermM :: (((Core.Term -> Compute.Flow t0 Core.Term) -> Core.Term -> Compute.Flow t0 Core.Term) -> Core.Term -> Compute.Flow t0 Core.Term)+rewriteTermM f term0 = + let fsub = (\recurse -> \term -> + let forField = (\field -> Flows.bind (recurse (Core.fieldTerm field)) (\t -> Flows.pure (Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = t})))+ in + let forPair = (\kv -> Flows.bind (recurse (Pairs.first kv)) (\k -> Flows.bind (recurse (Pairs.second kv)) (\v -> Flows.pure (k, v))))+ in + let mapBinding = (\b -> Flows.bind (recurse (Core.bindingTerm b)) (\v -> Flows.pure (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = v,+ Core.bindingType = (Core.bindingType b)})))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Flows.bind (recurse (Core.annotatedTermBody v1)) (\ex -> Flows.pure (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = ex,+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))))+ Core.TermApplication v1 -> (Flows.bind (recurse (Core.applicationFunction v1)) (\lhs -> Flows.bind (recurse (Core.applicationArgument v1)) (\rhs -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs,+ Core.applicationArgument = rhs})))))+ Core.TermEither v1 -> (Flows.bind (Eithers.either (\l -> Flows.map (\x -> Left x) (recurse l)) (\r -> Flows.map (\x -> Right x) (recurse r)) v1) (\re -> Flows.pure (Core.TermEither re)))+ Core.TermFunction v1 -> + let forElm = (\e -> (\x -> case x of+ Core.EliminationRecord v2 -> (Flows.pure (Core.FunctionElimination (Core.EliminationRecord v2)))+ Core.EliminationUnion v2 -> + let n = (Core.caseStatementTypeName v2)+ in + let def = (Core.caseStatementDefault v2)+ in + let cases = (Core.caseStatementCases v2)+ in (Flows.bind (Maybes.maybe (Flows.pure Nothing) (\t -> Flows.map Maybes.pure (recurse t)) def) (\rdef -> Flows.map (\rcases -> Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = n,+ Core.caseStatementDefault = rdef,+ Core.caseStatementCases = rcases}))) (Flows.mapList forField cases)))+ Core.EliminationWrap v2 -> (Flows.pure (Core.FunctionElimination (Core.EliminationWrap v2)))) e)+ in + let forFun = (\fun -> (\x -> case x of+ Core.FunctionElimination v2 -> (forElm v2)+ Core.FunctionLambda v2 -> + let v = (Core.lambdaParameter v2)+ in + let d = (Core.lambdaDomain v2)+ in + let body = (Core.lambdaBody v2)+ in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = v,+ Core.lambdaDomain = d,+ Core.lambdaBody = rbody}))))+ Core.FunctionPrimitive v2 -> (Flows.pure (Core.FunctionPrimitive v2))) fun)+ in (Flows.bind (forFun v1) (\rfun -> Flows.pure (Core.TermFunction rfun)))+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1)+ in + let env = (Core.letBody v1)+ in (Flows.bind (Flows.mapList mapBinding bindings) (\rbindings -> Flows.bind (recurse env) (\renv -> Flows.pure (Core.TermLet (Core.Let {+ Core.letBindings = rbindings,+ Core.letBody = renv})))))+ Core.TermList v1 -> (Flows.bind (Flows.mapList recurse v1) (\rels -> Flows.pure (Core.TermList rels)))+ Core.TermLiteral v1 -> (Flows.pure (Core.TermLiteral v1))+ Core.TermMap v1 -> (Flows.bind (Flows.mapList forPair (Maps.toList v1)) (\pairs -> Flows.pure (Core.TermMap (Maps.fromList pairs))))+ Core.TermMaybe v1 -> (Flows.bind (Flows.mapMaybe recurse v1) (\rm -> Flows.pure (Core.TermMaybe rm)))+ Core.TermPair v1 -> (Flows.bind (recurse (Pairs.first v1)) (\rf -> Flows.bind (recurse (Pairs.second v1)) (\rs -> Flows.pure (Core.TermPair (rf, rs)))))+ Core.TermRecord v1 -> + let n = (Core.recordTypeName v1)+ in + let fields = (Core.recordFields v1)+ in (Flows.map (\rfields -> Core.TermRecord (Core.Record {+ Core.recordTypeName = n,+ Core.recordFields = rfields})) (Flows.mapList forField fields))+ Core.TermSet v1 -> (Flows.bind (Flows.mapList recurse (Sets.toList v1)) (\rlist -> Flows.pure (Core.TermSet (Sets.fromList rlist))))+ Core.TermTypeApplication v1 -> (Flows.bind (recurse (Core.typeApplicationTermBody v1)) (\t -> Flows.pure (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)}))))+ Core.TermTypeLambda v1 -> + let v = (Core.typeLambdaParameter v1)+ in + let body = (Core.typeLambdaBody v1)+ in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = v,+ Core.typeLambdaBody = rbody}))))+ Core.TermUnion v1 -> + let n = (Core.injectionTypeName v1)+ in + let field = (Core.injectionField v1)+ in (Flows.map (\rfield -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = n,+ Core.injectionField = rfield})) (forField field))+ Core.TermUnit -> (Flows.pure Core.TermUnit)+ Core.TermVariable v1 -> (Flows.pure (Core.TermVariable v1))+ Core.TermWrap v1 -> + let name = (Core.wrappedTermTypeName v1)+ in + let t = (Core.wrappedTermBody v1)+ in (Flows.bind (recurse t) (\rt -> Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = name,+ Core.wrappedTermBody = rt}))))) term))+ in + let recurse = (f (fsub recurse))+ in (recurse term0)++-- | A variant of rewriteTerm which allows a context (e.g. a TypeContext) to be passed down to all subterms during rewriting+rewriteTermWithContext :: (((t0 -> Core.Term -> Core.Term) -> t0 -> Core.Term -> Core.Term) -> t0 -> Core.Term -> Core.Term)+rewriteTermWithContext f cx0 term0 = + let forSubterms = (\recurse0 -> \cx -> \term -> + let recurse = (recurse0 cx)+ in + let forField = (\field -> Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = (recurse (Core.fieldTerm field))})+ in + let forElimination = (\elm -> (\x -> case x of+ Core.EliminationRecord v1 -> (Core.EliminationRecord v1)+ Core.EliminationUnion v1 -> (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.caseStatementTypeName v1),+ Core.caseStatementDefault = (Maybes.map recurse (Core.caseStatementDefault v1)),+ Core.caseStatementCases = (Lists.map forField (Core.caseStatementCases v1))}))+ Core.EliminationWrap v1 -> (Core.EliminationWrap v1)) elm)+ in + let forFunction = (\fun -> (\x -> case x of+ Core.FunctionElimination v1 -> (Core.FunctionElimination (forElimination v1))+ Core.FunctionLambda v1 -> (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.lambdaParameter v1),+ Core.lambdaDomain = (Core.lambdaDomain v1),+ Core.lambdaBody = (recurse (Core.lambdaBody v1))}))+ Core.FunctionPrimitive v1 -> (Core.FunctionPrimitive v1)) fun)+ in + let forLet = (\lt -> + let mapBinding = (\b -> Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (recurse (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)})+ in Core.Let {+ Core.letBindings = (Lists.map mapBinding (Core.letBindings lt)),+ Core.letBody = (recurse (Core.letBody lt))})+ in + let forMap = (\m -> + let forPair = (\p -> (recurse (Pairs.first p), (recurse (Pairs.second p))))+ in (Maps.fromList (Lists.map forPair (Maps.toList m))))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (recurse (Core.annotatedTermBody v1)),+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))+ Core.TermApplication v1 -> (Core.TermApplication (Core.Application {+ Core.applicationFunction = (recurse (Core.applicationFunction v1)),+ Core.applicationArgument = (recurse (Core.applicationArgument v1))}))+ Core.TermEither v1 -> (Core.TermEither (Eithers.either (\l -> Left (recurse l)) (\r -> Right (recurse r)) v1))+ Core.TermFunction v1 -> (Core.TermFunction (forFunction v1))+ Core.TermLet v1 -> (Core.TermLet (forLet v1))+ Core.TermList v1 -> (Core.TermList (Lists.map recurse v1))+ Core.TermLiteral v1 -> (Core.TermLiteral v1)+ Core.TermMap v1 -> (Core.TermMap (forMap v1))+ Core.TermMaybe v1 -> (Core.TermMaybe (Maybes.map recurse v1))+ Core.TermPair v1 -> (Core.TermPair (recurse (Pairs.first v1), (recurse (Pairs.second v1))))+ Core.TermRecord v1 -> (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.recordTypeName v1),+ Core.recordFields = (Lists.map forField (Core.recordFields v1))}))+ Core.TermSet v1 -> (Core.TermSet (Sets.fromList (Lists.map recurse (Sets.toList v1))))+ Core.TermTypeApplication v1 -> (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (recurse (Core.typeApplicationTermBody v1)),+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)}))+ Core.TermTypeLambda v1 -> (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.typeLambdaParameter v1),+ Core.typeLambdaBody = (recurse (Core.typeLambdaBody v1))}))+ Core.TermUnion v1 -> (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.injectionTypeName v1),+ Core.injectionField = (forField (Core.injectionField v1))}))+ Core.TermUnit -> Core.TermUnit+ Core.TermVariable v1 -> (Core.TermVariable v1)+ Core.TermWrap v1 -> (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.wrappedTermTypeName v1),+ Core.wrappedTermBody = (recurse (Core.wrappedTermBody v1))}))) term))+ in + let rewrite = (\cx -> \term -> f (forSubterms rewrite) cx term)+ in (rewrite cx0 term0)++-- | A variant of rewriteTermM which allows a context (e.g. a TypeContext) to be passed down to all subterms during rewriting+rewriteTermWithContextM :: (((t0 -> Core.Term -> Compute.Flow t1 Core.Term) -> t0 -> Core.Term -> Compute.Flow t1 Core.Term) -> t0 -> Core.Term -> Compute.Flow t1 Core.Term)+rewriteTermWithContextM f cx0 term0 = + let forSubterms = (\recurse0 -> \cx -> \term -> + let recurse = (recurse0 cx)+ in + let forField = (\field -> Flows.bind (recurse (Core.fieldTerm field)) (\t -> Flows.pure (Core.Field {+ Core.fieldName = (Core.fieldName field),+ Core.fieldTerm = t})))+ in + let forPair = (\kv -> Flows.bind (recurse (Pairs.first kv)) (\k -> Flows.bind (recurse (Pairs.second kv)) (\v -> Flows.pure (k, v))))+ in + let forElimination = (\e -> (\x -> case x of+ Core.EliminationRecord v1 -> (Flows.pure (Core.FunctionElimination (Core.EliminationRecord v1)))+ Core.EliminationUnion v1 -> + let n = (Core.caseStatementTypeName v1)+ in + let def = (Core.caseStatementDefault v1)+ in + let cases = (Core.caseStatementCases v1)+ in (Flows.bind (Maybes.maybe (Flows.pure Nothing) (\t -> Flows.map Maybes.pure (recurse t)) def) (\rdef -> Flows.map (\rcases -> Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = n,+ Core.caseStatementDefault = rdef,+ Core.caseStatementCases = rcases}))) (Flows.mapList forField cases)))+ Core.EliminationWrap v1 -> (Flows.pure (Core.FunctionElimination (Core.EliminationWrap v1)))) e)+ in + let forFunction = (\fun -> (\x -> case x of+ Core.FunctionElimination v1 -> (forElimination v1)+ Core.FunctionLambda v1 -> + let v = (Core.lambdaParameter v1)+ in + let d = (Core.lambdaDomain v1)+ in + let body = (Core.lambdaBody v1)+ in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = v,+ Core.lambdaDomain = d,+ Core.lambdaBody = rbody}))))+ Core.FunctionPrimitive v1 -> (Flows.pure (Core.FunctionPrimitive v1))) fun)+ in + let mapBinding = (\b -> Flows.bind (recurse (Core.bindingTerm b)) (\v -> Flows.pure (Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = v,+ Core.bindingType = (Core.bindingType b)})))+ in ((\x -> case x of+ Core.TermAnnotated v1 -> (Flows.bind (recurse (Core.annotatedTermBody v1)) (\ex -> Flows.pure (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = ex,+ Core.annotatedTermAnnotation = (Core.annotatedTermAnnotation v1)}))))+ Core.TermApplication v1 -> (Flows.bind (recurse (Core.applicationFunction v1)) (\lhs -> Flows.bind (recurse (Core.applicationArgument v1)) (\rhs -> Flows.pure (Core.TermApplication (Core.Application {+ Core.applicationFunction = lhs,+ Core.applicationArgument = rhs})))))+ Core.TermEither v1 -> (Flows.bind (Eithers.either (\l -> Flows.map (\x -> Left x) (recurse l)) (\r -> Flows.map (\x -> Right x) (recurse r)) v1) (\re -> Flows.pure (Core.TermEither re)))+ Core.TermFunction v1 -> (Flows.bind (forFunction v1) (\rfun -> Flows.pure (Core.TermFunction rfun)))+ Core.TermLet v1 -> + let bindings = (Core.letBindings v1)+ in + let body = (Core.letBody v1)+ in (Flows.bind (Flows.mapList mapBinding bindings) (\rbindings -> Flows.bind (recurse body) (\rbody -> Flows.pure (Core.TermLet (Core.Let {+ Core.letBindings = rbindings,+ Core.letBody = rbody})))))+ Core.TermList v1 -> (Flows.bind (Flows.mapList recurse v1) (\rels -> Flows.pure (Core.TermList rels)))+ Core.TermLiteral v1 -> (Flows.pure (Core.TermLiteral v1))+ Core.TermMap v1 -> (Flows.bind (Flows.mapList forPair (Maps.toList v1)) (\pairs -> Flows.pure (Core.TermMap (Maps.fromList pairs))))+ Core.TermMaybe v1 -> (Flows.bind (Flows.mapMaybe recurse v1) (\rm -> Flows.pure (Core.TermMaybe rm)))+ Core.TermPair v1 -> (Flows.bind (recurse (Pairs.first v1)) (\rfirst -> Flows.bind (recurse (Pairs.second v1)) (\rsecond -> Flows.pure (Core.TermPair (rfirst, rsecond)))))+ Core.TermRecord v1 -> + let n = (Core.recordTypeName v1)+ in + let fields = (Core.recordFields v1)+ in (Flows.map (\rfields -> Core.TermRecord (Core.Record {+ Core.recordTypeName = n,+ Core.recordFields = rfields})) (Flows.mapList forField fields))+ Core.TermSet v1 -> (Flows.bind (Flows.mapList recurse (Sets.toList v1)) (\rlist -> Flows.pure (Core.TermSet (Sets.fromList rlist))))+ Core.TermTypeApplication v1 -> (Flows.bind (recurse (Core.typeApplicationTermBody v1)) (\t -> Flows.pure (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = t,+ Core.typeApplicationTermType = (Core.typeApplicationTermType v1)}))))+ Core.TermTypeLambda v1 -> + let v = (Core.typeLambdaParameter v1)+ in + let body = (Core.typeLambdaBody v1)+ in (Flows.bind (recurse body) (\rbody -> Flows.pure (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = v,+ Core.typeLambdaBody = rbody}))))+ Core.TermUnion v1 -> + let n = (Core.injectionTypeName v1)+ in + let field = (Core.injectionField v1)+ in (Flows.map (\rfield -> Core.TermUnion (Core.Injection {+ Core.injectionTypeName = n,+ Core.injectionField = rfield})) (forField field))+ Core.TermUnit -> (Flows.pure Core.TermUnit)+ Core.TermVariable v1 -> (Flows.pure (Core.TermVariable v1))+ Core.TermWrap v1 -> + let name = (Core.wrappedTermTypeName v1)+ in + let t = (Core.wrappedTermBody v1)+ in (Flows.bind (recurse t) (\rt -> Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = name,+ Core.wrappedTermBody = rt}))))) term))+ in + let rewrite = (\cx -> \term -> f (forSubterms rewrite) cx term)+ in (rewrite cx0 term0)++rewriteType :: (((Core.Type -> Core.Type) -> Core.Type -> Core.Type) -> Core.Type -> Core.Type)+rewriteType f typ0 = + let fsub = (\recurse -> \typ -> + let forField = (\field -> Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName field),+ Core.fieldTypeType = (recurse (Core.fieldTypeType field))})+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (recurse (Core.annotatedTypeBody v1)),+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))+ Core.TypeApplication v1 -> (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (recurse (Core.applicationTypeFunction v1)),+ Core.applicationTypeArgument = (recurse (Core.applicationTypeArgument v1))}))+ Core.TypeEither v1 -> (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (recurse (Core.eitherTypeLeft v1)),+ Core.eitherTypeRight = (recurse (Core.eitherTypeRight v1))}))+ Core.TypePair v1 -> (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (recurse (Core.pairTypeFirst v1)),+ Core.pairTypeSecond = (recurse (Core.pairTypeSecond v1))}))+ Core.TypeFunction v1 -> (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (recurse (Core.functionTypeDomain v1)),+ Core.functionTypeCodomain = (recurse (Core.functionTypeCodomain v1))}))+ Core.TypeForall v1 -> (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.forallTypeParameter v1),+ Core.forallTypeBody = (recurse (Core.forallTypeBody v1))}))+ Core.TypeList v1 -> (Core.TypeList (recurse v1))+ Core.TypeLiteral v1 -> (Core.TypeLiteral v1)+ Core.TypeMap v1 -> (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (recurse (Core.mapTypeKeys v1)),+ Core.mapTypeValues = (recurse (Core.mapTypeValues v1))}))+ Core.TypeMaybe v1 -> (Core.TypeMaybe (recurse v1))+ Core.TypeRecord v1 -> (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = (Core.rowTypeTypeName v1),+ Core.rowTypeFields = (Lists.map forField (Core.rowTypeFields v1))}))+ Core.TypeSet v1 -> (Core.TypeSet (recurse v1))+ Core.TypeUnion v1 -> (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = (Core.rowTypeTypeName v1),+ Core.rowTypeFields = (Lists.map forField (Core.rowTypeFields v1))}))+ Core.TypeUnit -> Core.TypeUnit+ Core.TypeVariable v1 -> (Core.TypeVariable v1)+ Core.TypeWrap v1 -> (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.wrappedTypeTypeName v1),+ Core.wrappedTypeBody = (recurse (Core.wrappedTypeBody v1))}))) typ))+ in + let recurse = (f (fsub recurse))+ in (recurse typ0)++-- | Monadic type rewriting+rewriteTypeM :: (((Core.Type -> Compute.Flow t0 Core.Type) -> Core.Type -> Compute.Flow t0 Core.Type) -> Core.Type -> Compute.Flow t0 Core.Type)+rewriteTypeM f typ0 = + let fsub = (\recurse -> \typ -> (\x -> case x of+ Core.TypeAnnotated v1 -> (Flows.bind (recurse (Core.annotatedTypeBody v1)) (\t -> Flows.pure (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = t,+ Core.annotatedTypeAnnotation = (Core.annotatedTypeAnnotation v1)}))))+ Core.TypeApplication v1 -> (Flows.bind (recurse (Core.applicationTypeFunction v1)) (\lhs -> Flows.bind (recurse (Core.applicationTypeArgument v1)) (\rhs -> Flows.pure (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = lhs,+ Core.applicationTypeArgument = rhs})))))+ Core.TypeEither v1 -> (Flows.bind (recurse (Core.eitherTypeLeft v1)) (\left -> Flows.bind (recurse (Core.eitherTypeRight v1)) (\right -> Flows.pure (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = left,+ Core.eitherTypeRight = right})))))+ Core.TypePair v1 -> (Flows.bind (recurse (Core.pairTypeFirst v1)) (\pairFirst -> Flows.bind (recurse (Core.pairTypeSecond v1)) (\pairSecond -> Flows.pure (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = pairFirst,+ Core.pairTypeSecond = pairSecond})))))+ Core.TypeFunction v1 -> (Flows.bind (recurse (Core.functionTypeDomain v1)) (\dom -> Flows.bind (recurse (Core.functionTypeCodomain v1)) (\cod -> Flows.pure (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = dom,+ Core.functionTypeCodomain = cod})))))+ Core.TypeForall v1 -> (Flows.bind (recurse (Core.forallTypeBody v1)) (\b -> Flows.pure (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.forallTypeParameter v1),+ Core.forallTypeBody = b}))))+ Core.TypeList v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeList rt)))+ Core.TypeLiteral v1 -> (Flows.pure (Core.TypeLiteral v1))+ Core.TypeMap v1 -> (Flows.bind (recurse (Core.mapTypeKeys v1)) (\kt -> Flows.bind (recurse (Core.mapTypeValues v1)) (\vt -> Flows.pure (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = kt,+ Core.mapTypeValues = vt})))))+ Core.TypeMaybe v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeMaybe rt)))+ Core.TypeRecord v1 -> + let name = (Core.rowTypeTypeName v1)+ in + let fields = (Core.rowTypeFields v1)+ in + let forField = (\f -> Flows.bind (recurse (Core.fieldTypeType f)) (\t -> Flows.pure (Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName f),+ Core.fieldTypeType = t})))+ in (Flows.bind (Flows.mapList forField fields) (\rfields -> Flows.pure (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = name,+ Core.rowTypeFields = rfields}))))+ Core.TypeSet v1 -> (Flows.bind (recurse v1) (\rt -> Flows.pure (Core.TypeSet rt)))+ Core.TypeUnion v1 -> + let name = (Core.rowTypeTypeName v1)+ in + let fields = (Core.rowTypeFields v1)+ in + let forField = (\f -> Flows.bind (recurse (Core.fieldTypeType f)) (\t -> Flows.pure (Core.FieldType {+ Core.fieldTypeName = (Core.fieldTypeName f),+ Core.fieldTypeType = t})))+ in (Flows.bind (Flows.mapList forField fields) (\rfields -> Flows.pure (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = name,+ Core.rowTypeFields = rfields}))))+ Core.TypeUnit -> (Flows.pure Core.TypeUnit)+ Core.TypeVariable v1 -> (Flows.pure (Core.TypeVariable v1))+ Core.TypeWrap v1 -> (Flows.bind (recurse (Core.wrappedTypeBody v1)) (\t -> Flows.pure (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.wrappedTypeTypeName v1),+ Core.wrappedTypeBody = t}))))) typ)+ in + let recurse = (f (fsub recurse))+ in (recurse typ0)++-- | Simplify terms by applying beta reduction where possible+simplifyTerm :: (Core.Term -> Core.Term)+simplifyTerm term = + let simplify = (\recurse -> \term -> + let forRhs = (\rhs -> \var -> \body -> (\x -> case x of+ Core.TermVariable v1 -> (simplifyTerm (substituteVariable var v1 body))+ _ -> term) (deannotateTerm rhs))+ in + let forLhs = (\lhs -> \rhs -> + let forFun = (\fun -> (\x -> case x of+ Core.FunctionLambda v1 -> + let var = (Core.lambdaParameter v1)+ in + let body = (Core.lambdaBody v1)+ in (Logic.ifElse (Sets.member var (freeVariablesInTerm body)) (forRhs rhs var body) (simplifyTerm body))+ _ -> term) fun)+ in ((\x -> case x of+ Core.TermFunction v1 -> (forFun v1)+ _ -> term) (deannotateTerm lhs)))+ in + let forTerm = (\stripped -> (\x -> case x of+ Core.TermApplication v1 -> + let lhs = (Core.applicationFunction v1)+ in + let rhs = (Core.applicationArgument v1)+ in (forLhs lhs rhs)+ _ -> term) stripped)+ in + let stripped = (deannotateTerm term)+ in (recurse (forTerm stripped)))+ in (rewriteTerm simplify term)++-- | Substitute type variables in a type+substituteTypeVariables :: (M.Map Core.Name Core.Name -> Core.Type -> Core.Type)+substituteTypeVariables subst typ = + let replace = (\recurse -> \typ -> (\x -> case x of+ Core.TypeVariable v1 -> (Core.TypeVariable (Maybes.fromMaybe v1 (Maps.lookup v1 subst)))+ _ -> (recurse typ)) typ)+ in (rewriteType replace typ)++-- | Substitute one variable for another in a term+substituteVariable :: (Core.Name -> Core.Name -> Core.Term -> Core.Term)+substituteVariable from to term = + let replace = (\recurse -> \term -> (\x -> case x of+ Core.TermVariable v1 -> (Core.TermVariable (Logic.ifElse (Equality.equal v1 from) to v1))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Logic.ifElse (Equality.equal (Core.lambdaParameter v2) from) term (recurse term))+ _ -> (recurse term)) v1)+ _ -> (recurse term)) term)+ in (rewriteTerm replace term)++-- | Substitute multiple variables in a term+substituteVariables :: (M.Map Core.Name Core.Name -> Core.Term -> Core.Term)+substituteVariables subst term = + let replace = (\recurse -> \term -> (\x -> case x of+ Core.TermVariable v1 -> (Core.TermVariable (Maybes.fromMaybe v1 (Maps.lookup v1 subst)))+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> (Maybes.maybe (recurse term) (\_ -> term) (Maps.lookup (Core.lambdaParameter v2) subst))+ _ -> (recurse term)) v1)+ _ -> (recurse term)) term)+ in (rewriteTerm replace term)++-- | Strip outer type lambda wrappers from a term, preserving type application wrappers and annotations+stripTypeLambdas :: (Core.Term -> Core.Term)+stripTypeLambdas t = ((\x -> case x of+ Core.TermAnnotated v1 -> + let subj = (Core.annotatedTermBody v1)+ in + let ann = (Core.annotatedTermAnnotation v1)+ in (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (stripTypeLambdas subj),+ Core.annotatedTermAnnotation = ann}))+ Core.TermTypeLambda v1 -> (stripTypeLambdas (Core.typeLambdaBody v1))+ _ -> t) t)++-- | Find the children of a given term+subterms :: (Core.Term -> [Core.Term])+subterms x = case x of+ Core.TermAnnotated v1 -> [+ Core.annotatedTermBody v1]+ Core.TermApplication v1 -> [+ Core.applicationFunction v1,+ (Core.applicationArgument v1)]+ Core.TermEither v1 -> (Eithers.either (\l -> [+ l]) (\r -> [+ r]) v1)+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationUnion v3 -> (Lists.concat2 (Maybes.maybe [] (\t -> [+ t]) (Core.caseStatementDefault v3)) (Lists.map Core.fieldTerm (Core.caseStatementCases v3)))+ _ -> []) v2)+ Core.FunctionLambda v2 -> [+ Core.lambdaBody v2]+ _ -> []) v1)+ Core.TermLet v1 -> (Lists.cons (Core.letBody v1) (Lists.map Core.bindingTerm (Core.letBindings v1)))+ Core.TermList v1 -> v1+ Core.TermLiteral _ -> []+ Core.TermMap v1 -> (Lists.concat (Lists.map (\p -> [+ Pairs.first p,+ (Pairs.second p)]) (Maps.toList v1)))+ Core.TermMaybe v1 -> (Maybes.maybe [] (\t -> [+ t]) v1)+ Core.TermPair v1 -> [+ Pairs.first v1,+ (Pairs.second v1)]+ Core.TermRecord v1 -> (Lists.map Core.fieldTerm (Core.recordFields v1))+ Core.TermSet v1 -> (Sets.toList v1)+ Core.TermTypeApplication v1 -> [+ Core.typeApplicationTermBody v1]+ Core.TermTypeLambda v1 -> [+ Core.typeLambdaBody v1]+ Core.TermUnion v1 -> [+ Core.fieldTerm (Core.injectionField v1)]+ Core.TermUnit -> []+ Core.TermVariable _ -> []+ Core.TermWrap v1 -> [+ Core.wrappedTermBody v1]++-- | Find the children of a given term+subtermsWithAccessors :: (Core.Term -> [(Accessors.TermAccessor, Core.Term)])+subtermsWithAccessors x = case x of+ Core.TermAnnotated v1 -> [+ (Accessors.TermAccessorAnnotatedBody, (Core.annotatedTermBody v1))]+ Core.TermApplication v1 -> [+ (Accessors.TermAccessorApplicationFunction, (Core.applicationFunction v1)),+ (Accessors.TermAccessorApplicationArgument, (Core.applicationArgument v1))]+ Core.TermEither _ -> []+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationUnion v3 -> (Lists.concat2 (Maybes.maybe [] (\t -> [+ (Accessors.TermAccessorUnionCasesDefault, t)]) (Core.caseStatementDefault v3)) (Lists.map (\f -> (Accessors.TermAccessorUnionCasesBranch (Core.fieldName f), (Core.fieldTerm f))) (Core.caseStatementCases v3)))+ _ -> []) v2)+ Core.FunctionLambda v2 -> [+ (Accessors.TermAccessorLambdaBody, (Core.lambdaBody v2))]+ _ -> []) v1)+ Core.TermLet v1 -> (Lists.cons (Accessors.TermAccessorLetBody, (Core.letBody v1)) (Lists.map (\b -> (Accessors.TermAccessorLetBinding (Core.bindingName b), (Core.bindingTerm b))) (Core.letBindings v1)))+ Core.TermList v1 -> (Lists.map (\e -> (Accessors.TermAccessorListElement 0, e)) v1)+ Core.TermLiteral _ -> []+ Core.TermMap v1 -> (Lists.concat (Lists.map (\p -> [+ (Accessors.TermAccessorMapKey 0, (Pairs.first p)),+ (Accessors.TermAccessorMapValue 0, (Pairs.second p))]) (Maps.toList v1)))+ Core.TermMaybe v1 -> (Maybes.maybe [] (\t -> [+ (Accessors.TermAccessorMaybeTerm, t)]) v1)+ Core.TermPair _ -> []+ Core.TermRecord v1 -> (Lists.map (\f -> (Accessors.TermAccessorRecordField (Core.fieldName f), (Core.fieldTerm f))) (Core.recordFields v1))+ Core.TermSet v1 -> (Lists.map (\e -> (Accessors.TermAccessorListElement 0, e)) (Sets.toList v1))+ Core.TermTypeApplication v1 -> [+ (Accessors.TermAccessorTypeApplicationTerm, (Core.typeApplicationTermBody v1))]+ Core.TermTypeLambda v1 -> [+ (Accessors.TermAccessorTypeLambdaBody, (Core.typeLambdaBody v1))]+ Core.TermUnion v1 -> [+ (Accessors.TermAccessorInjectionTerm, (Core.fieldTerm (Core.injectionField v1)))]+ Core.TermUnit -> []+ Core.TermVariable _ -> []+ Core.TermWrap v1 -> [+ (Accessors.TermAccessorWrappedTerm, (Core.wrappedTermBody v1))]++-- | Find the children of a given type expression+subtypes :: (Core.Type -> [Core.Type])+subtypes x = case x of+ Core.TypeAnnotated v1 -> [+ Core.annotatedTypeBody v1]+ Core.TypeApplication v1 -> [+ Core.applicationTypeFunction v1,+ (Core.applicationTypeArgument v1)]+ Core.TypeEither v1 -> [+ Core.eitherTypeLeft v1,+ (Core.eitherTypeRight v1)]+ Core.TypePair v1 -> [+ Core.pairTypeFirst v1,+ (Core.pairTypeSecond v1)]+ Core.TypeFunction v1 -> [+ Core.functionTypeDomain v1,+ (Core.functionTypeCodomain v1)]+ Core.TypeForall v1 -> [+ Core.forallTypeBody v1]+ Core.TypeList v1 -> [+ v1]+ Core.TypeLiteral _ -> []+ Core.TypeMap v1 -> [+ Core.mapTypeKeys v1,+ (Core.mapTypeValues v1)]+ Core.TypeMaybe v1 -> [+ v1]+ Core.TypeRecord v1 -> (Lists.map Core.fieldTypeType (Core.rowTypeFields v1))+ Core.TypeSet v1 -> [+ v1]+ Core.TypeUnion v1 -> (Lists.map Core.fieldTypeType (Core.rowTypeFields v1))+ Core.TypeUnit -> []+ Core.TypeVariable _ -> []+ Core.TypeWrap v1 -> [+ Core.wrappedTypeBody v1]++-- | Note: does not distinguish between bound and free variables; use freeVariablesInTerm for that+termDependencyNames :: (Bool -> Bool -> Bool -> Core.Term -> S.Set Core.Name)+termDependencyNames binds withPrims withNoms term0 = + let addNames = (\names -> \term -> + let nominal = (\name -> Logic.ifElse withNoms (Sets.insert name names) names)+ in + let prim = (\name -> Logic.ifElse withPrims (Sets.insert name names) names)+ in + let var = (\name -> Logic.ifElse binds (Sets.insert name names) names)+ in ((\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionPrimitive v2 -> (prim v2)+ Core.FunctionElimination v2 -> ((\x -> case x of+ Core.EliminationRecord v3 -> (nominal (Core.projectionTypeName v3))+ Core.EliminationUnion v3 -> (nominal (Core.caseStatementTypeName v3))+ Core.EliminationWrap v3 -> (nominal v3)) v2)+ _ -> names) v1)+ Core.TermRecord v1 -> (nominal (Core.recordTypeName v1))+ Core.TermUnion v1 -> (nominal (Core.injectionTypeName v1))+ Core.TermVariable v1 -> (var v1)+ Core.TermWrap v1 -> (nominal (Core.wrappedTermTypeName v1))+ _ -> names) term))+ in (foldOverTerm Coders.TraversalOrderPre addNames Sets.empty term0)++-- | Generate short names from a list of fully qualified names+toShortNames :: ([Core.Name] -> M.Map Core.Name Core.Name)+toShortNames original = + let addName = (\acc -> \name -> + let local = (Names.localNameOf name)+ in + let group = (Maybes.fromMaybe Sets.empty (Maps.lookup local acc))+ in (Maps.insert local (Sets.insert name group) acc))+ in + let groupNamesByLocal = (\names -> Lists.foldl addName Maps.empty names)+ in + let groups = (groupNamesByLocal original)+ in + let renameGroup = (\localNames -> + let local = (Pairs.first localNames)+ in + let names = (Pairs.second localNames)+ in + let rangeFrom = (\start -> Lists.cons start (rangeFrom (Math.add start 1)))+ in + let rename = (\name -> \i -> (name, (Core.Name (Logic.ifElse (Equality.gt i 1) (Strings.cat2 local (Literals.showInt32 i)) local))))+ in (Lists.zipWith rename (Sets.toList names) (rangeFrom 1)))+ in (Maps.fromList (Lists.concat (Lists.map renameGroup (Maps.toList groups))))++-- | Topological sort of connected components, in terms of dependencies between variable/term binding pairs+topologicalSortBindingMap :: (M.Map Core.Name Core.Term -> [[(Core.Name, Core.Term)]])+topologicalSortBindingMap bindingMap = + let bindings = (Maps.toList bindingMap)+ in + let keys = (Sets.fromList (Lists.map Pairs.first bindings))+ in + let hasTypeAnnotation = (\term -> (\x -> case x of+ Core.TermAnnotated v1 -> (hasTypeAnnotation (Core.annotatedTermBody v1))+ _ -> False) term)+ in + let depsOf = (\nameAndTerm -> + let name = (Pairs.first nameAndTerm)+ in + let term = (Pairs.second nameAndTerm)+ in (name, (Logic.ifElse (hasTypeAnnotation term) [] (Sets.toList (Sets.intersection keys (freeVariablesInTerm term))))))+ in + let toPair = (\name -> (name, (Maybes.fromMaybe (Core.TermLiteral (Core.LiteralString "Impossible!")) (Maps.lookup name bindingMap))))+ in (Lists.map (Lists.map toPair) (Sorting.topologicalSortComponents (Lists.map depsOf bindings)))++-- | Topological sort of elements based on their dependencies+topologicalSortBindings :: ([Core.Binding] -> Either [[Core.Name]] [Core.Name])+topologicalSortBindings els = + let adjlist = (\e -> (Core.bindingName e, (Sets.toList (termDependencyNames False True True (Core.bindingTerm e)))))+ in (Sorting.topologicalSort (Lists.map adjlist els))++typeDependencyNames :: (Bool -> Core.Type -> S.Set Core.Name)+typeDependencyNames withSchema typ = (Logic.ifElse withSchema (Sets.union (freeVariablesInType typ) (typeNamesInType typ)) (freeVariablesInType typ))++typeNamesInType :: (Core.Type -> S.Set Core.Name)+typeNamesInType typ0 = + let addNames = (\names -> \typ -> (\x -> case x of+ Core.TypeRecord v1 -> + let tname = (Core.rowTypeTypeName v1)+ in (Sets.insert tname names)+ Core.TypeUnion v1 -> + let tname = (Core.rowTypeTypeName v1)+ in (Sets.insert tname names)+ Core.TypeWrap v1 -> + let tname = (Core.wrappedTypeTypeName v1)+ in (Sets.insert tname names)+ _ -> names) typ)+ in (foldOverType Coders.TraversalOrderPre addNames Sets.empty typ0)++-- | Rename all shadowed variables (both lambda parameters and let-bound variables that shadow lambda parameters) in a term.+unshadowVariables :: (Core.Term -> Core.Term)+unshadowVariables term0 = + let freshName = (\base -> \i -> \m -> + let candidate = (Core.Name (Strings.cat2 (Core.unName base) (Literals.showInt32 i)))+ in (Logic.ifElse (Maps.member candidate m) (freshName base (Math.add i 1) m) candidate))+ in + let f = (\recurse -> \m -> \term -> (\x -> case x of+ Core.TermFunction v1 -> ((\x -> case x of+ Core.FunctionLambda v2 -> + let v = (Core.lambdaParameter v2)+ in + let domain = (Core.lambdaDomain v2)+ in + let body = (Core.lambdaBody v2)+ in (Logic.ifElse (Maps.member v m) ( + let v2 = (freshName v 2 m)+ in + let m2 = (Maps.insert v v2 (Maps.insert v2 v2 m))+ in (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = v2,+ Core.lambdaDomain = domain,+ Core.lambdaBody = (f recurse m2 body)})))) (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = v,+ Core.lambdaDomain = domain,+ Core.lambdaBody = (f recurse (Maps.insert v v m) body)}))))+ _ -> (recurse m term)) v1)+ Core.TermLet v1 -> + let m2 = (Lists.foldl (\acc -> \b -> + let bname = (Core.bindingName b)+ in (Logic.ifElse (Maps.member bname acc) acc (Maps.insert bname bname acc))) m (Core.letBindings v1))+ in (recurse m2 term)+ Core.TermVariable v1 -> (Core.TermVariable (Maybes.maybe v1 (\renamed -> renamed) (Maps.lookup v1 m)))+ _ -> (recurse m term)) term)+ in (rewriteTermWithContext f Maps.empty term0)
src/gen-main/haskell/Hydra/Schemas.hs view
@@ -1,7 +1,10 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Various functions for dereferencing and decoding schema types. module Hydra.Schemas where +import qualified Hydra.Annotations as Annotations import qualified Hydra.Coders as Coders import qualified Hydra.Compute as Compute import qualified Hydra.Constants as Constants@@ -13,84 +16,114 @@ import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle import qualified Hydra.Module as Module import qualified Hydra.Monads as Monads import qualified Hydra.Names as Names+import qualified Hydra.Reflect as Reflect import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core___ import qualified Hydra.Sorting as Sorting+import qualified Hydra.Substitution as Substitution import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util import qualified Hydra.Variants as Variants-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Add names to existing namespaces mapping+addNamesToNamespaces :: ((Module.Namespace -> t0) -> S.Set Core.Name -> Module.Namespaces t0 -> Module.Namespaces t0)+addNamesToNamespaces encodeNamespace names ns0 = + let nss = (Sets.fromList (Maybes.cat (Lists.map Names.namespaceOf (Sets.toList names))))+ in + let toPair = (\ns -> (ns, (encodeNamespace ns)))+ in Module.Namespaces {+ Module.namespacesFocus = (Module.namespacesFocus ns0),+ Module.namespacesMapping = (Maps.union (Module.namespacesMapping ns0) (Maps.fromList (Lists.map toPair (Sets.toList nss))))}+ -- | Get dependency namespaces from definitions definitionDependencyNamespaces :: ([Module.Definition] -> S.Set Module.Namespace) definitionDependencyNamespaces defs = let defNames = (\def -> (\x -> case x of Module.DefinitionType v1 -> (Rewriting.typeDependencyNames True (Module.typeDefinitionType v1))- Module.DefinitionTerm v1 -> (Rewriting.termDependencyNames True True True (Module.termDefinitionTerm v1))) def) - allNames = (Sets.unions (Lists.map defNames defs))- in (Sets.fromList (Optionals.cat (Lists.map Names.namespaceOf (Sets.toList allNames))))+ Module.DefinitionTerm v1 -> (Rewriting.termDependencyNames True True True (Module.termDefinitionTerm v1))) def)+ in + let allNames = (Sets.unions (Lists.map defNames defs))+ in (Sets.fromList (Maybes.cat (Lists.map Names.namespaceOf (Sets.toList allNames)))) -- | Find dependency namespaces in all of a set of terms dependencyNamespaces :: (Bool -> Bool -> Bool -> Bool -> [Core.Binding] -> Compute.Flow Graph.Graph (S.Set Module.Namespace))-dependencyNamespaces binds withPrims withNoms withSchema els = +dependencyNamespaces binds withPrims withNoms withSchema els = (Flows.bind Monads.getState (\cx -> let depNames = (\el -> - let term = (Core.bindingTerm el) - dataNames = (Rewriting.termDependencyNames binds withPrims withNoms term)- schemaNames = (Logic.ifElse withSchema (Optionals.maybe Sets.empty (\ts -> Rewriting.typeDependencyNames True (Core.typeSchemeType ts)) (Core.bindingType el)) Sets.empty)- in (Logic.ifElse (Core__.isEncodedType (Rewriting.deannotateTerm term)) (Flows.bind (Core_.type_ term) (\typ -> Flows.pure (Sets.unions [- dataNames,- schemaNames,- (Rewriting.typeDependencyNames True typ)]))) (Flows.pure (Sets.unions [- dataNames,- schemaNames]))))- in (Flows.bind (Flows.mapList depNames els) (\namesList -> Flows.pure (Sets.fromList (Optionals.cat (Lists.map Names.namespaceOf (Sets.toList (Sets.delete Constants.placeholderName (Sets.unions namesList))))))))+ let term = (Core.bindingTerm el)+ in + let deannotatedTerm = (Rewriting.deannotateTerm term)+ in + let dataNames = (Rewriting.termDependencyNames binds withPrims withNoms term)+ in + let schemaNames = (Logic.ifElse withSchema (Maybes.maybe Sets.empty (\ts -> Rewriting.typeDependencyNames True (Core.typeSchemeType ts)) (Core.bindingType el)) Sets.empty)+ in (Logic.ifElse (isEncodedType deannotatedTerm) (Flows.bind (Monads.withTrace "dependency namespace (type)" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx term))) (\typ -> Flows.pure (Sets.unions [+ dataNames,+ schemaNames,+ (Rewriting.typeDependencyNames True typ)]))) (Logic.ifElse (isEncodedTerm deannotatedTerm) (Flows.bind (Monads.withTrace "dependency namespace (term)" (Monads.eitherToFlow Util.unDecodingError (Core_.term cx term))) (\decodedTerm -> Flows.pure (Sets.unions [+ dataNames,+ schemaNames,+ (Rewriting.termDependencyNames binds withPrims withNoms decodedTerm)]))) (Flows.pure (Sets.unions [+ dataNames,+ schemaNames])))))+ in (Flows.bind (Flows.mapList depNames els) (\namesList -> Flows.pure (Sets.fromList (Maybes.cat (Lists.map Names.namespaceOf (Sets.toList (Sets.delete Constants.placeholderName (Sets.unions namesList)))))))))) -- | Dereference a type name to get the actual type dereferenceType :: (Core.Name -> Compute.Flow Graph.Graph (Maybe Core.Type))-dereferenceType name = (Flows.bind (Lexical.dereferenceElement name) (\mel -> Optionals.maybe (Flows.pure Nothing) (\el -> Flows.map Optionals.pure (Core_.type_ (Core.bindingTerm el))) mel))+dereferenceType name = (Flows.bind Monads.getState (\cx -> Flows.bind (Lexical.dereferenceElement name) (\mel -> Maybes.maybe (Flows.pure Nothing) (\el -> Flows.map Maybes.pure (Monads.withTrace "dereference type" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el))))) mel))) -elementAsTypedTerm :: (Core.Binding -> Compute.Flow t0 Core.TypedTerm)-elementAsTypedTerm el = (Optionals.maybe (Flows.fail "missing element type") (\ts -> Flows.pure (Core.TypedTerm {- Core.typedTermTerm = (Core.bindingTerm el),- Core.typedTermType = (Core.typeSchemeType ts)})) (Core.bindingType el))+-- | Convert an element to a typed term+elementAsTypeApplicationTerm :: (Core.Binding -> Compute.Flow t0 Core.TypeApplicationTerm)+elementAsTypeApplicationTerm el = (Maybes.maybe (Flows.fail "missing element type") (\ts -> Flows.pure (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.bindingTerm el),+ Core.typeApplicationTermType = (Core.typeSchemeType ts)})) (Core.bindingType el)) -- | Get elements with their dependencies elementsWithDependencies :: ([Core.Binding] -> Compute.Flow Graph.Graph [Core.Binding]) elementsWithDependencies original = - let depNames = (\el -> Sets.toList (Rewriting.termDependencyNames True False False (Core.bindingTerm el))) - allDepNames = (Lists.nub (Lists.concat2 (Lists.map Core.bindingName original) (Lists.concat (Lists.map depNames original))))- in (Flows.mapList Lexical.requireElement allDepNames)+ let depNames = (\el -> Sets.toList (Rewriting.termDependencyNames True False False (Core.bindingTerm el)))+ in + let allDepNames = (Lists.nub (Lists.concat2 (Lists.map Core.bindingName original) (Lists.concat (Lists.map depNames original))))+ in (Flows.mapList Lexical.requireElement allDepNames) -- | Extend a type context by descending into a System F lambda body extendTypeContextForLambda :: (Typing.TypeContext -> Core.Lambda -> Typing.TypeContext) extendTypeContextForLambda tcontext lam = let var = (Core.lambdaParameter lam)- in - let dom = (Optionals.fromJust (Core.lambdaDomain lam))- in Typing.TypeContext {- Typing.typeContextTypes = (Maps.insert var dom (Typing.typeContextTypes tcontext)),- Typing.typeContextVariables = (Typing.typeContextVariables tcontext),- Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tcontext)}+ in Typing.TypeContext {+ Typing.typeContextTypes = (Maybes.maybe (Typing.typeContextTypes tcontext) (\dom -> Maps.insert var dom (Typing.typeContextTypes tcontext)) (Core.lambdaDomain lam)),+ Typing.typeContextMetadata = (Maps.delete var (Typing.typeContextMetadata tcontext)),+ Typing.typeContextTypeVariables = (Typing.typeContextTypeVariables tcontext),+ Typing.typeContextLambdaVariables = (Sets.insert var (Typing.typeContextLambdaVariables tcontext)),+ Typing.typeContextLetVariables = (Sets.delete var (Typing.typeContextLetVariables tcontext)),+ Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tcontext)} -- | Extend a type context by descending into a let body-extendTypeContextForLet :: (Typing.TypeContext -> Core.Let -> Typing.TypeContext)-extendTypeContextForLet tcontext letrec = +extendTypeContextForLet :: ((Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> Typing.TypeContext -> Core.Let -> Typing.TypeContext)+extendTypeContextForLet forBinding tcontext letrec = let bindings = (Core.letBindings letrec) in Typing.TypeContext {- Typing.typeContextTypes = (Maps.union (Typing.typeContextTypes tcontext) (Maps.fromList (Lists.map (\b -> (Core.bindingName b, (typeSchemeToFType (Optionals.fromJust (Core.bindingType b))))) bindings))),- Typing.typeContextVariables = (Typing.typeContextVariables tcontext),+ Typing.typeContextTypes = (Maps.union (Maps.fromList (Maybes.cat (Lists.map (\b -> Maybes.map (\ts -> (Core.bindingName b, (typeSchemeToFType ts))) (Core.bindingType b)) bindings))) (Typing.typeContextTypes tcontext)),+ Typing.typeContextMetadata = (Lists.foldl (\m -> \b -> Maybes.maybe (Maps.delete (Core.bindingName b) m) (\t -> Maps.insert (Core.bindingName b) t m) (forBinding tcontext b)) (Typing.typeContextMetadata tcontext) bindings),+ Typing.typeContextTypeVariables = (Typing.typeContextTypeVariables tcontext),+ Typing.typeContextLambdaVariables = (Lists.foldl (\s -> \b -> Sets.delete (Core.bindingName b) s) (Typing.typeContextLambdaVariables tcontext) bindings),+ Typing.typeContextLetVariables = (Lists.foldl (\s -> \b -> Sets.insert (Core.bindingName b) s) (Typing.typeContextLetVariables tcontext) bindings), Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tcontext)} -- | Extend a type context by descending into a System F type lambda body@@ -99,79 +132,170 @@ let name = (Core.typeLambdaParameter tlam) in Typing.TypeContext { Typing.typeContextTypes = (Typing.typeContextTypes tcontext),- Typing.typeContextVariables = (Sets.insert name (Typing.typeContextVariables tcontext)),+ Typing.typeContextMetadata = (Typing.typeContextMetadata tcontext),+ Typing.typeContextTypeVariables = (Sets.insert name (Typing.typeContextTypeVariables tcontext)),+ Typing.typeContextLambdaVariables = (Typing.typeContextLambdaVariables tcontext),+ Typing.typeContextLetVariables = (Typing.typeContextLetVariables tcontext), Typing.typeContextInferenceContext = (Typing.typeContextInferenceContext tcontext)} fieldMap :: ([Core.Field] -> M.Map Core.Name Core.Term)-fieldMap fields = (Maps.fromList (Lists.map toPair fields)) - where - toPair = (\f -> (Core.fieldName f, (Core.fieldTerm f)))+fieldMap fields = + let toPair = (\f -> (Core.fieldName f, (Core.fieldTerm f)))+ in (Maps.fromList (Lists.map toPair fields)) fieldTypeMap :: ([Core.FieldType] -> M.Map Core.Name Core.Type)-fieldTypeMap fields = (Maps.fromList (Lists.map toPair fields)) - where - toPair = (\f -> (Core.fieldTypeName f, (Core.fieldTypeType f)))--findFieldType :: (Core.Name -> [Core.FieldType] -> Compute.Flow t0 Core.Type)-findFieldType fname fields = - let matchingFields = (Lists.filter (\ft -> Equality.equal (Core.unName (Core.fieldTypeName ft)) (Core.unName fname)) fields)- in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat2 "No such field: " (Core.unName fname))) (Logic.ifElse (Equality.equal (Lists.length matchingFields) 1) (Flows.pure (Core.fieldTypeType (Lists.head matchingFields))) (Flows.fail (Strings.cat2 "Multiple fields named " (Core.unName fname)))))+fieldTypeMap fields = + let toPair = (\f -> (Core.fieldTypeName f, (Core.fieldTypeType f)))+ in (Maps.fromList (Lists.map toPair fields)) -- | Get field types from a record or union type fieldTypes :: (Core.Type -> Compute.Flow Graph.Graph (M.Map Core.Name Core.Type))-fieldTypes t = +fieldTypes t = (Flows.bind Monads.getState (\cx -> let toMap = (\fields -> Maps.fromList (Lists.map (\ft -> (Core.fieldTypeName ft, (Core.fieldTypeType ft))) fields)) in ((\x -> case x of Core.TypeForall v1 -> (fieldTypes (Core.forallTypeBody v1)) Core.TypeRecord v1 -> (Flows.pure (toMap (Core.rowTypeFields v1))) Core.TypeUnion v1 -> (Flows.pure (toMap (Core.rowTypeFields v1)))- Core.TypeVariable v1 -> (Monads.withTrace (Strings.cat2 "field types of " (Core.unName v1)) (Flows.bind (Lexical.requireElement v1) (\el -> Flows.bind (Core_.type_ (Core.bindingTerm el)) fieldTypes)))- _ -> (Monads.unexpected "record or union type" (Core___.type_ t))) (Rewriting.deannotateType t))+ Core.TypeVariable v1 -> (Monads.withTrace (Strings.cat2 "field types of " (Core.unName v1)) (Flows.bind (Lexical.requireElement v1) (\el -> Flows.bind (Monads.withTrace "field types" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) fieldTypes)))+ _ -> (Monads.unexpected "record or union type" (Core___.type_ t))) (Rewriting.deannotateType t)))) +-- | Find a field type by name in a list of field types+findFieldType :: (Core.Name -> [Core.FieldType] -> Compute.Flow t0 Core.Type)+findFieldType fname fields = + let matchingFields = (Lists.filter (\ft -> Equality.equal (Core.unName (Core.fieldTypeName ft)) (Core.unName fname)) fields)+ in (Logic.ifElse (Lists.null matchingFields) (Flows.fail (Strings.cat2 "No such field: " (Core.unName fname))) (Logic.ifElse (Equality.equal (Lists.length matchingFields) 1) (Flows.pure (Core.fieldTypeType (Lists.head matchingFields))) (Flows.fail (Strings.cat2 "Multiple fields named " (Core.unName fname)))))++-- | Generate a fresh type variable name+freshName :: (Compute.Flow t0 Core.Name)+freshName = (Flows.map normalTypeVariable (Annotations.nextCount Constants.key_freshTypeVariableCount))++-- | Generate multiple fresh type variable names+freshNames :: (Int -> Compute.Flow t0 [Core.Name])+freshNames n = (Flows.sequence (Lists.replicate n freshName))++-- | Test whether a given System F type is polymorphic (i.e., a forall type)+fTypeIsPolymorphic :: (Core.Type -> Bool)+fTypeIsPolymorphic typ = ((\x -> case x of+ Core.TypeAnnotated v1 -> (fTypeIsPolymorphic (Core.annotatedTypeBody v1))+ Core.TypeForall _ -> True+ _ -> False) typ)+ -- | Convert a forall type to a type scheme fTypeToTypeScheme :: (Core.Type -> Core.TypeScheme)-fTypeToTypeScheme typ = (gatherForall [] typ) - where - gatherForall = (\vars -> \typ -> (\x -> case x of- Core.TypeForall v1 -> (gatherForall (Lists.cons (Core.forallTypeParameter v1) vars) (Core.forallTypeBody v1))- _ -> Core.TypeScheme {- Core.typeSchemeVariables = (Lists.reverse vars),- Core.typeSchemeType = typ}) (Rewriting.deannotateType typ))+fTypeToTypeScheme typ = + let gatherForall = (\vars -> \typ -> (\x -> case x of+ Core.TypeForall v1 -> (gatherForall (Lists.cons (Core.forallTypeParameter v1) vars) (Core.forallTypeBody v1))+ _ -> Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.reverse vars),+ Core.typeSchemeType = typ,+ Core.typeSchemeConstraints = Nothing}) (Rewriting.deannotateType typ))+ in (gatherForall [] typ) +-- | Fully strip a type of forall quantifiers, normalizing bound variable names for alpha-equivalence comparison+fullyStripAndNormalizeType :: (Core.Type -> Core.Type)+fullyStripAndNormalizeType typ = + let go = (\depth -> \subst -> \t -> (\x -> case x of+ Core.TypeForall v1 -> + let oldVar = (Core.forallTypeParameter v1)+ in + let newVar = (Core.Name (Strings.cat2 "_" (Literals.showInt32 depth)))+ in (go (Math.add depth 1) (Maps.insert oldVar newVar subst) (Core.forallTypeBody v1))+ _ -> (subst, t)) (Rewriting.deannotateType t))+ in + let result = (go 0 Maps.empty typ)+ in + let subst = (Pairs.first result)+ in + let body = (Pairs.second result)+ in (Rewriting.substituteTypeVariables subst body)+ -- | Fully strip a type of forall quantifiers fullyStripType :: (Core.Type -> Core.Type) fullyStripType typ = ((\x -> case x of Core.TypeForall v1 -> (fullyStripType (Core.forallTypeBody v1)) _ -> typ) (Rewriting.deannotateType typ)) +-- | Convert a graph to a let expression+graphAsLet :: (Graph.Graph -> Core.Let)+graphAsLet g = Core.Let {+ Core.letBindings = (Graph.graphElements g),+ Core.letBody = (Graph.graphBody g)}+ -- | Convert a graph to a term, taking advantage of the built-in duality between graphs and terms graphAsTerm :: (Graph.Graph -> Core.Term)-graphAsTerm g = - let toBinding = (\el -> - let name = (Core.bindingName el)- in - let term = (Core.bindingTerm el)- in - let mts = (Core.bindingType el)- in Core.Binding {- Core.bindingName = name,- Core.bindingTerm = term,- Core.bindingType = mts})- in (Core.TermLet (Core.Let {- Core.letBindings = (Lists.map toBinding (Maps.elems (Graph.graphElements g))),- Core.letEnvironment = (Graph.graphBody g)}))+graphAsTerm g = (Core.TermLet (graphAsLet g)) -- | Decode a schema graph which encodes a set of named types graphAsTypes :: (Graph.Graph -> Compute.Flow Graph.Graph (M.Map Core.Name Core.Type))-graphAsTypes sg = - let els = (Maps.elems (Graph.graphElements sg))+graphAsTypes sg = (Flows.bind Monads.getState (\cx -> + let els = (Graph.graphElements sg) in - let toPair = (\el -> Flows.bind (Core_.type_ (Core.bindingTerm el)) (\typ -> Flows.pure (Core.bindingName el, typ)))- in (Flows.bind (Flows.mapList toPair els) (\pairs -> Flows.pure (Maps.fromList pairs)))+ let toPair = (\el -> Flows.bind (Monads.withTrace (Strings.cat2 "graph as types: " (Core.unName (Core.bindingName el))) (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) (\typ -> Flows.pure (Core.bindingName el, typ)))+ in (Flows.bind (Flows.mapList toPair els) (\pairs -> Flows.pure (Maps.fromList pairs))))) +-- | Convert a graph to an inference context+graphToInferenceContext :: (Graph.Graph -> Compute.Flow t0 Typing.InferenceContext)+graphToInferenceContext graph = + let schema = (Maybes.fromMaybe graph (Graph.graphSchema graph))+ in + let primTypes = (Maps.fromList (Lists.map (\p -> (Graph.primitiveName p, (Graph.primitiveType p))) (Maps.elems (Graph.graphPrimitives graph))))+ in + let varTypes = (Maps.fromList (Maybes.cat (Lists.map (\b -> Maybes.map (\ts -> (Core.bindingName b, ts)) (Core.bindingType b)) (Graph.graphElements graph))))+ in (Flows.bind (schemaGraphToTypingEnvironment schema) (\schemaTypes -> Flows.pure (Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = schemaTypes,+ Typing.inferenceContextPrimitiveTypes = primTypes,+ Typing.inferenceContextDataTypes = varTypes,+ Typing.inferenceContextClassConstraints = Maps.empty,+ Typing.inferenceContextDebug = False})))++-- | Convert a graph to a type context including the graph's element types+graphToTypeContext :: (Graph.Graph -> Compute.Flow t0 Typing.TypeContext)+graphToTypeContext graph = (Flows.bind (graphToInferenceContext graph) (\ix -> + let elementTypes = (Maps.fromList (Maybes.cat (Lists.map (\b -> Maybes.map (\ts -> (Core.bindingName b, (typeSchemeToFType ts))) (Core.bindingType b)) (Graph.graphElements graph))))+ in (Flows.pure (Typing.TypeContext {+ Typing.typeContextTypes = elementTypes,+ Typing.typeContextMetadata = Maps.empty,+ Typing.typeContextTypeVariables = Sets.empty,+ Typing.typeContextLambdaVariables = Sets.empty,+ Typing.typeContextLetVariables = Sets.empty,+ Typing.typeContextInferenceContext = ix}))))++-- | Instantiate a type by replacing all forall-bound type variables with fresh variables+instantiateType :: (Core.Type -> Compute.Flow t0 Core.Type)+instantiateType typ = (Flows.bind (instantiateTypeScheme (typeToTypeScheme typ)) (\ts -> Flows.pure (typeSchemeToFType ts)))++-- | Instantiate a type scheme with fresh variables+instantiateTypeScheme :: (Core.TypeScheme -> Compute.Flow t0 Core.TypeScheme)+instantiateTypeScheme scheme = + let oldVars = (Core.typeSchemeVariables scheme)+ in (Flows.bind (freshNames (Lists.length oldVars)) (\newVars -> + let subst = (Typing.TypeSubst (Maps.fromList (Lists.zip oldVars (Lists.map (\x -> Core.TypeVariable x) newVars))))+ in + let nameSubst = (Maps.fromList (Lists.zip oldVars newVars))+ in + let renamedConstraints = (Maybes.map (\oldConstraints -> Maps.fromList (Lists.map (\kv -> (Maybes.fromMaybe (Pairs.first kv) (Maps.lookup (Pairs.first kv) nameSubst), (Pairs.second kv))) (Maps.toList oldConstraints))) (Core.typeSchemeConstraints scheme))+ in (Flows.pure (Core.TypeScheme {+ Core.typeSchemeVariables = newVars,+ Core.typeSchemeType = (Substitution.substInType subst (Core.typeSchemeType scheme)),+ Core.typeSchemeConstraints = renamedConstraints}))))++-- | Determines whether a given term is an encoded term (meta-level term)+isEncodedTerm :: (Core.Term -> Bool)+isEncodedTerm t = ((\x -> case x of+ Core.TermApplication v1 -> (isEncodedTerm (Core.applicationFunction v1))+ Core.TermUnion v1 -> (Equality.equal "hydra.core.Term" (Core.unName (Core.injectionTypeName v1)))+ _ -> False) (Rewriting.deannotateTerm t))++-- | Determines whether a given term is an encoded type+isEncodedType :: (Core.Term -> Bool)+isEncodedType t = ((\x -> case x of+ Core.TermApplication v1 -> (isEncodedType (Core.applicationFunction v1))+ Core.TermUnion v1 -> (Equality.equal "hydra.core.Type" (Core.unName (Core.injectionTypeName v1)))+ _ -> False) (Rewriting.deannotateTerm t))+ -- | Check if a row type represents an enum (all fields are unit-typed) isEnumRowType :: (Core.RowType -> Bool)-isEnumRowType rt = (Lists.foldl Logic.and True (Lists.map (\f -> Core__.isUnitType (Core.fieldTypeType f)) (Core.rowTypeFields rt)))+isEnumRowType rt = (Lists.foldl Logic.and True (Lists.map (\f -> isUnitType (Rewriting.deannotateType (Core.fieldTypeType f))) (Core.rowTypeFields rt))) -- | Check if a type is an enum type isEnumType :: (Core.Type -> Bool)@@ -182,117 +306,213 @@ -- | Check if an element is serializable (no function types in dependencies) isSerializable :: (Core.Binding -> Compute.Flow Graph.Graph Bool) isSerializable el = - let variants = (\typ -> Lists.map Variants.typeVariant (Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> Lists.cons t m) [] typ))+ let variants = (\typ -> Lists.map Reflect.typeVariant (Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> Lists.cons t m) [] typ)) in (Flows.map (\deps -> let allVariants = (Sets.fromList (Lists.concat (Lists.map variants (Maps.elems deps))))- in (Logic.not (Sets.member Mantle.TypeVariantFunction allVariants))) (typeDependencies False Equality.identity (Core.bindingName el)))+ in (Logic.not (Sets.member Variants.TypeVariantFunction allVariants))) (typeDependencies False Equality.identity (Core.bindingName el))) +-- | Check if a type is serializable (no function types in the type itself)+isSerializableType :: (Core.Type -> Bool)+isSerializableType typ = + let allVariants = (Sets.fromList (Lists.map Reflect.typeVariant (Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> Lists.cons t m) [] typ)))+ in (Logic.not (Sets.member Variants.TypeVariantFunction allVariants))++-- | Check if a type (by name) is serializable, resolving all type dependencies+isSerializableByName :: (Core.Name -> Compute.Flow Graph.Graph Bool)+isSerializableByName name = + let variants = (\typ -> Lists.map Reflect.typeVariant (Rewriting.foldOverType Coders.TraversalOrderPre (\m -> \t -> Lists.cons t m) [] typ))+ in (Flows.map (\deps -> + let allVariants = (Sets.fromList (Lists.concat (Lists.map variants (Maps.elems deps))))+ in (Logic.not (Sets.member Variants.TypeVariantFunction allVariants))) (typeDependencies False Equality.identity name))++-- | Check whether a type is a type (always true for non-encoded types)+isType :: (Core.Type -> Bool)+isType t = ((\x -> case x of+ Core.TypeApplication v1 -> (isType (Core.applicationTypeFunction v1))+ Core.TypeForall v1 -> (isType (Core.forallTypeBody v1))+ Core.TypeUnion v1 -> (Equality.equal "hydra.core.Type" (Core.unName (Core.rowTypeTypeName v1)))+ Core.TypeVariable v1 -> (Equality.equal v1 (Core.Name "hydra.core.Type"))+ _ -> False) (Rewriting.deannotateType t))++-- | Check whether a term is the unit term+isUnitTerm :: (Core.Term -> Bool)+isUnitTerm x = case x of+ Core.TermUnit -> True+ _ -> False++-- | Check whether a type is the unit type+isUnitType :: (Core.Type -> Bool)+isUnitType x = case x of+ Core.TypeUnit -> True+ _ -> False++-- | Check whether a module contains any binary literal values+moduleContainsBinaryLiterals :: (Module.Module -> Bool)+moduleContainsBinaryLiterals mod = + let checkTerm = (\found -> \term -> Logic.or found ((\x -> case x of+ Core.TermLiteral v1 -> ((\x -> case x of+ Core.LiteralBinary _ -> True+ _ -> False) v1)+ _ -> False) term))+ in + let termContainsBinary = (\term -> Rewriting.foldOverTerm Coders.TraversalOrderPre checkTerm False term)+ in (Lists.foldl (\acc -> \el -> Logic.or acc (termContainsBinary (Core.bindingTerm el))) False (Module.moduleElements mod))+ -- | Find dependency namespaces in all elements of a module, excluding the module's own namespace moduleDependencyNamespaces :: (Bool -> Bool -> Bool -> Bool -> Module.Module -> Compute.Flow Graph.Graph (S.Set Module.Namespace)) moduleDependencyNamespaces binds withPrims withNoms withSchema mod = (Flows.bind (dependencyNamespaces binds withPrims withNoms withSchema (Module.moduleElements mod)) (\deps -> Flows.pure (Sets.delete (Module.moduleNamespace mod) deps))) +-- | Create namespaces mapping for definitions namespacesForDefinitions :: ((Module.Namespace -> t0) -> Module.Namespace -> [Module.Definition] -> Module.Namespaces t0) namespacesForDefinitions encodeNamespace focusNs defs = - let nss = (Sets.delete focusNs (definitionDependencyNamespaces defs)) - toPair = (\ns -> (ns, (encodeNamespace ns)))- in Module.Namespaces {- Module.namespacesFocus = (toPair focusNs),- Module.namespacesMapping = (Maps.fromList (Lists.map toPair (Sets.toList nss)))}+ let nss = (Sets.delete focusNs (definitionDependencyNamespaces defs))+ in + let toPair = (\ns -> (ns, (encodeNamespace ns)))+ in Module.Namespaces {+ Module.namespacesFocus = (toPair focusNs),+ Module.namespacesMapping = (Maps.fromList (Lists.map toPair (Sets.toList nss)))} +-- | Apply type arguments to a nominal type+nominalApplication :: (Core.Name -> [Core.Type] -> Core.Type)+nominalApplication tname args = (Lists.foldl (\t -> \a -> Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = t,+ Core.applicationTypeArgument = a})) (Core.TypeVariable tname) args)++-- | Type variable naming convention follows Haskell: t0, t1, etc.+normalTypeVariable :: (Int -> Core.Name)+normalTypeVariable i = (Core.Name (Strings.cat2 "t" (Literals.showInt32 i)))++-- | Partition a list of definitions into type definitions and term definitions+partitionDefinitions :: ([Module.Definition] -> ([Module.TypeDefinition], [Module.TermDefinition]))+partitionDefinitions defs = + let getType = (\def -> (\x -> case x of+ Module.DefinitionType v1 -> (Just v1)+ Module.DefinitionTerm _ -> Nothing) def)+ in + let getTerm = (\def -> (\x -> case x of+ Module.DefinitionType _ -> Nothing+ Module.DefinitionTerm v1 -> (Just v1)) def)+ in (Maybes.cat (Lists.map getType defs), (Maybes.cat (Lists.map getTerm defs)))+ -- | Require a name to resolve to a record type requireRecordType :: (Core.Name -> Compute.Flow Graph.Graph Core.RowType)-requireRecordType = (requireRowType "record type" (\t -> (\x -> case x of- Core.TypeRecord v1 -> (Just v1)- _ -> Nothing) t))+requireRecordType name = + let toRecord = (\t -> (\x -> case x of+ Core.TypeRecord v1 -> (Just v1)+ _ -> Nothing) t)+ in (requireRowType "record type" toRecord name) +-- | Require a name to resolve to a row type requireRowType :: (String -> (Core.Type -> Maybe t0) -> Core.Name -> Compute.Flow Graph.Graph t0) requireRowType label getter name = let rawType = (\t -> (\x -> case x of- Core.TypeAnnotated v1 -> (rawType (Core.annotatedTypeSubject v1))+ Core.TypeAnnotated v1 -> (rawType (Core.annotatedTypeBody v1)) Core.TypeForall v1 -> (rawType (Core.forallTypeBody v1)) _ -> t) t)- in (Flows.bind (requireType name) (\t -> Optionals.maybe (Flows.fail (Strings.cat [+ in (Flows.bind (requireType name) (\t -> Maybes.maybe (Flows.fail (Strings.cat [ Core.unName name, " does not resolve to a ", label, " type: ", (Core___.type_ t)])) Flows.pure (getter (rawType t)))) +-- | Look up a schema type in the context and instantiate it+requireSchemaType :: (Typing.InferenceContext -> Core.Name -> Compute.Flow t0 Core.TypeScheme)+requireSchemaType cx tname = + let types = (Typing.inferenceContextSchemaTypes cx)+ in (Maybes.maybe (Flows.fail (Strings.cat [+ "No such schema type: ",+ (Core.unName tname),+ ". Available types are: ",+ (Strings.intercalate ", " (Lists.map Core.unName (Maps.keys types)))])) (\ts -> instantiateTypeScheme (Rewriting.deannotateTypeSchemeRecursive ts)) (Maps.lookup tname types))+ -- | Require a type by name requireType :: (Core.Name -> Compute.Flow Graph.Graph Core.Type)-requireType name = (Monads.withTrace (Strings.cat2 "require type " (Core.unName name)) (Flows.bind (Lexical.withSchemaContext (Lexical.requireElement name)) (\el -> Core_.type_ (Core.bindingTerm el))))+requireType name = (Flows.bind Monads.getState (\cx -> Monads.withTrace (Strings.cat2 "require type " (Core.unName name)) (Flows.bind (Lexical.withSchemaContext (Lexical.requireElement name)) (\el -> Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))))) +-- | Require a field type from a union type+requireUnionField :: (Core.Name -> Core.Name -> Compute.Flow Graph.Graph Core.Type)+requireUnionField tname fname = + let withRowType = (\rt -> + let matches = (Lists.filter (\ft -> Equality.equal (Core.fieldTypeName ft) fname) (Core.rowTypeFields rt))+ in (Logic.ifElse (Lists.null matches) (Flows.fail (Strings.cat [+ "no field \"",+ (Core.unName fname),+ "\" in union type \"",+ (Core.unName tname)])) (Flows.pure (Core.fieldTypeType (Lists.head matches)))))+ in (Flows.bind (requireUnionType tname) withRowType)+ -- | Require a name to resolve to a union type requireUnionType :: (Core.Name -> Compute.Flow Graph.Graph Core.RowType)-requireUnionType = (requireRowType "union" (\t -> (\x -> case x of- Core.TypeUnion v1 -> (Just v1)- _ -> Nothing) t))+requireUnionType name = + let toUnion = (\t -> (\x -> case x of+ Core.TypeUnion v1 -> (Just v1)+ _ -> Nothing) t)+ in (requireRowType "union" toUnion name) -- | Resolve a type, dereferencing type variables resolveType :: (Core.Type -> Compute.Flow Graph.Graph (Maybe Core.Type))-resolveType typ = ((\x -> case x of- Core.TypeVariable v1 -> (Lexical.withSchemaContext (Flows.bind (Lexical.resolveTerm v1) (\mterm -> Optionals.maybe (Flows.pure Nothing) (\t -> Flows.map Optionals.pure (Core_.type_ t)) mterm)))- _ -> (Flows.pure (Just typ))) (Rewriting.deannotateType typ))+resolveType typ = (Flows.bind Monads.getState (\cx -> (\x -> case x of+ Core.TypeVariable v1 -> (Lexical.withSchemaContext (Flows.bind (Lexical.resolveTerm v1) (\mterm -> Maybes.maybe (Flows.pure Nothing) (\t -> Flows.map Maybes.pure (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx t))) mterm)))+ _ -> (Flows.pure (Just typ))) (Rewriting.deannotateType typ))) +-- | Convert a schema graph to a typing environment schemaGraphToTypingEnvironment :: (Graph.Graph -> Compute.Flow t0 (M.Map Core.Name Core.TypeScheme)) schemaGraphToTypingEnvironment g = let toTypeScheme = (\vars -> \typ -> (\x -> case x of Core.TypeForall v1 -> (toTypeScheme (Lists.cons (Core.forallTypeParameter v1) vars) (Core.forallTypeBody v1)) _ -> Core.TypeScheme { Core.typeSchemeVariables = (Lists.reverse vars),- Core.typeSchemeType = typ}) (Rewriting.deannotateType typ))+ Core.typeSchemeType = typ,+ Core.typeSchemeConstraints = Nothing}) (Rewriting.deannotateType typ)) in - let toPair = (\el -> Flows.map (\mts -> Optionals.map (\ts -> (Core.bindingName el, ts)) mts) (Optionals.maybe (Flows.bind (Core_.type_ (Core.bindingTerm el)) (\typ -> - let ts = (fTypeToTypeScheme typ)- in (Flows.pure (Just ts)))) (\ts -> Logic.ifElse (Equality.equal ts (Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme"))})) (Flows.map Optionals.pure (Core_.typeScheme (Core.bindingTerm el))) (Logic.ifElse (Equality.equal ts (Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.Type"))})) (Flows.map (\decoded -> Just (toTypeScheme [] decoded)) (Core_.type_ (Core.bindingTerm el))) ((\x -> case x of- Core.TermRecord v1 -> (Logic.ifElse (Equality.equal (Core.recordTypeName v1) (Core.Name "hydra.core.TypeScheme")) (Flows.map Optionals.pure (Core_.typeScheme (Core.bindingTerm el))) (Flows.pure Nothing))- Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.injectionTypeName v1) (Core.Name "hydra.core.Type")) (Flows.map (\decoded -> Just (toTypeScheme [] decoded)) (Core_.type_ (Core.bindingTerm el))) (Flows.pure Nothing))- _ -> (Flows.pure Nothing)) (Rewriting.deannotateTerm (Core.bindingTerm el))))) (Core.bindingType el)))- in (Monads.withState g (Flows.bind (Flows.mapList toPair (Maps.elems (Graph.graphElements g))) (\mpairs -> Flows.pure (Maps.fromList (Optionals.cat mpairs)))))+ let toPair = (\el -> Flows.bind Monads.getState (\cx -> + let forTerm = (\term -> (\x -> case x of+ Core.TermRecord v1 -> (Logic.ifElse (Equality.equal (Core.recordTypeName v1) (Core.Name "hydra.core.TypeScheme")) (Flows.map Maybes.pure (Monads.eitherToFlow Util.unDecodingError (Core_.typeScheme cx (Core.bindingTerm el)))) (Flows.pure Nothing))+ Core.TermUnion v1 -> (Logic.ifElse (Equality.equal (Core.injectionTypeName v1) (Core.Name "hydra.core.Type")) (Flows.map (\decoded -> Just (toTypeScheme [] decoded)) (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) (Flows.pure Nothing))+ _ -> (Flows.pure Nothing)) term)+ in (Flows.bind (Maybes.maybe (Flows.map (\typ -> Just (fTypeToTypeScheme typ)) (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) (\ts -> Logic.ifElse (Equality.equal ts (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme")),+ Core.typeSchemeConstraints = Nothing})) (Flows.map Maybes.pure (Monads.eitherToFlow Util.unDecodingError (Core_.typeScheme cx (Core.bindingTerm el)))) (Logic.ifElse (Equality.equal ts (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.typeSchemeConstraints = Nothing})) (Flows.map (\decoded -> Just (toTypeScheme [] decoded)) (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) (forTerm (Rewriting.deannotateTerm (Core.bindingTerm el))))) (Core.bindingType el)) (\mts -> Flows.pure (Maybes.map (\ts -> (Core.bindingName el, ts)) mts)))))+ in (Monads.withTrace "schema graph to typing environment" (Monads.withState g (Flows.bind (Flows.mapList toPair (Graph.graphElements g)) (\mpairs -> Flows.pure (Maps.fromList (Maybes.cat mpairs)))))) -- | Find the equivalent graph representation of a term-termAsGraph :: (Core.Term -> M.Map Core.Name Core.Binding)+termAsGraph :: (Core.Term -> [Core.Binding]) termAsGraph term = ((\x -> case x of- Core.TermLet v1 -> - let bindings = (Core.letBindings v1)- in - let fromBinding = (\b -> - let name = (Core.bindingName b)- in - let term = (Core.bindingTerm b)- in - let ts = (Core.bindingType b)- in (name, Core.Binding {- Core.bindingName = name,- Core.bindingTerm = term,- Core.bindingType = ts}))- in (Maps.fromList (Lists.map fromBinding bindings))- _ -> Maps.empty) (Rewriting.deannotateTerm term))+ Core.TermLet v1 -> (Core.letBindings v1)+ _ -> []) (Rewriting.deannotateTerm term)) -- | Topologically sort type definitions by dependencies topologicalSortTypeDefinitions :: ([Module.TypeDefinition] -> [[Module.TypeDefinition]]) topologicalSortTypeDefinitions defs = - let toPair = (\def -> (Module.typeDefinitionName def, (Sets.toList (Rewriting.typeDependencyNames False (Module.typeDefinitionType def))))) - nameToDef = (Maps.fromList (Lists.map (\d -> (Module.typeDefinitionName d, d)) defs))- sorted = (Sorting.topologicalSortComponents (Lists.map toPair defs))- in (Lists.map (\names -> Optionals.cat (Lists.map (\n -> Maps.lookup n nameToDef) names)) sorted)+ let toPair = (\def -> (Module.typeDefinitionName def, (Sets.toList (Rewriting.typeDependencyNames False (Module.typeDefinitionType def)))))+ in + let nameToDef = (Maps.fromList (Lists.map (\d -> (Module.typeDefinitionName d, d)) defs))+ in + let sorted = (Sorting.topologicalSortComponents (Lists.map toPair defs))+ in (Lists.map (\names -> Maybes.cat (Lists.map (\n -> Maps.lookup n nameToDef) names)) sorted) -- | Get all type dependencies for a given type name typeDependencies :: (Bool -> (Core.Type -> Core.Type) -> Core.Name -> Compute.Flow Graph.Graph (M.Map Core.Name Core.Type))-typeDependencies withSchema transform name = - let requireType = (\name -> Monads.withTrace (Strings.cat2 "type dependencies of " (Core.unName name)) (Flows.bind (Lexical.requireElement name) (\el -> Core_.type_ (Core.bindingTerm el)))) - toPair = (\name -> Flows.bind (requireType name) (\typ -> Flows.pure (name, (transform typ))))- deps = (\seeds -> \names -> Logic.ifElse (Sets.null seeds) (Flows.pure names) (Flows.bind (Flows.mapList toPair (Sets.toList seeds)) (\pairs -> - let newNames = (Maps.union names (Maps.fromList pairs)) - refs = (Lists.foldl Sets.union Sets.empty (Lists.map (\pair -> Rewriting.typeDependencyNames withSchema (snd pair)) pairs))- visited = (Sets.fromList (Maps.keys names))- newSeeds = (Sets.difference refs visited)- in (deps newSeeds newNames))))- in (deps (Sets.singleton name) Maps.empty)+typeDependencies withSchema transform name = (Flows.bind Monads.getState (\cx -> + let requireType = (\name -> Monads.withTrace (Strings.cat2 "type dependencies of " (Core.unName name)) (Flows.bind (Lexical.requireElement name) (\el -> Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))))+ in + let toPair = (\name -> Flows.bind (requireType name) (\typ -> Flows.pure (name, (transform typ))))+ in + let deps = (\seeds -> \names -> Logic.ifElse (Sets.null seeds) (Flows.pure names) (Flows.bind (Flows.mapList toPair (Sets.toList seeds)) (\pairs -> + let newNames = (Maps.union names (Maps.fromList pairs))+ in + let refs = (Lists.foldl Sets.union Sets.empty (Lists.map (\pair -> Rewriting.typeDependencyNames withSchema (Pairs.second pair)) pairs))+ in + let visited = (Sets.fromList (Maps.keys names))+ in + let newSeeds = (Sets.difference refs visited)+ in (deps newSeeds newNames))))+ in (Monads.withTrace "type dependencies" (deps (Sets.singleton name) Maps.empty)))) -- | Convert a type scheme to a forall type typeSchemeToFType :: (Core.TypeScheme -> Core.Type)@@ -304,13 +524,42 @@ Core.forallTypeParameter = v, Core.forallTypeBody = t})) body (Lists.reverse vars)) --- | Encode a map of named types to a map of elements-typesToElements :: (M.Map Core.Name Core.Type -> M.Map Core.Name Core.Binding)+-- | Convert a (System F -style) type to a type scheme+typeToTypeScheme :: (Core.Type -> Core.TypeScheme)+typeToTypeScheme t0 = + let helper = (\vars -> \t -> (\x -> case x of+ Core.TypeForall v1 -> (helper (Lists.cons (Core.forallTypeParameter v1) vars) (Core.forallTypeBody v1))+ _ -> Core.TypeScheme {+ Core.typeSchemeVariables = (Lists.reverse vars),+ Core.typeSchemeType = t,+ Core.typeSchemeConstraints = Nothing}) (Rewriting.deannotateType t))+ in (helper [] t0)++-- | Encode a map of named types to a list of elements+typesToElements :: (M.Map Core.Name Core.Type -> [Core.Binding]) typesToElements typeMap = let toElement = (\pair -> - let name = (fst pair)- in (name, Core.Binding {+ let name = (Pairs.first pair)+ in Core.Binding { Core.bindingName = name,- Core.bindingTerm = (Core__.type_ (snd pair)),- Core.bindingType = Nothing}))- in (Maps.fromList (Lists.map toElement (Maps.toList typeMap)))+ Core.bindingTerm = (Core__.type_ (Pairs.second pair)),+ Core.bindingType = Nothing})+ in (Lists.map toElement (Maps.toList typeMap))++-- | Execute a computation in the context of a lambda body, extending the type context with the lambda parameter+withLambdaContext :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t1) -> t0 -> Core.Lambda -> (t1 -> t2) -> t2)+withLambdaContext getContext setContext env lam body = + let newContext = (extendTypeContextForLambda (getContext env) lam)+ in (body (setContext newContext env))++-- | Execute a computation in the context of a let body, extending the type context with the let bindings+withLetContext :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t1) -> (Typing.TypeContext -> Core.Binding -> Maybe Core.Term) -> t0 -> Core.Let -> (t1 -> t2) -> t2)+withLetContext getContext setContext forBinding env letrec body = + let newContext = (extendTypeContextForLet forBinding (getContext env) letrec)+ in (body (setContext newContext env))++-- | Execute a computation in the context of a type lambda body, extending the type context with the type parameter+withTypeLambdaContext :: ((t0 -> Typing.TypeContext) -> (Typing.TypeContext -> t0 -> t1) -> t0 -> Core.TypeLambda -> (t1 -> t2) -> t2)+withTypeLambdaContext getContext setContext env tlam body = + let newContext = (extendTypeContextForTypeLambda (getContext env) tlam)+ in (body (setContext newContext env))
src/gen-main/haskell/Hydra/Serialization.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for constructing generic program code ASTs, used for the serialization phase of source code generation. module Hydra.Serialization where@@ -8,10 +10,11 @@ import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Strings as Strings-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -59,28 +62,24 @@ Ast.bracketsClose = (sym "}")} curlyBracesList :: (Maybe String -> Ast.BlockStyle -> [Ast.Expr] -> Ast.Expr)-curlyBracesList msymb style els = (Logic.ifElse (Lists.null els) (cst "{}") (brackets curlyBraces style (symbolSep (Optionals.fromMaybe "," msymb) style els)))+curlyBracesList msymb style els = (Logic.ifElse (Lists.null els) (cst "{}") (brackets curlyBraces style (symbolSep (Maybes.fromMaybe "," msymb) style els))) cst :: (String -> Ast.Expr) cst s = (Ast.ExprConst (sym s)) customIndent :: (String -> String -> String)-customIndent idt s = (Strings.cat (Lists.intersperse "\n" (Lists.map (\line -> Strings.cat [- idt,- line]) (Strings.lines s))))+customIndent idt s = (Strings.cat (Lists.intersperse "\n" (Lists.map (\line -> Strings.cat2 idt line) (Strings.lines s)))) customIndentBlock :: (String -> [Ast.Expr] -> Ast.Expr)-customIndentBlock idt els = (Logic.ifElse (Lists.null els) (cst "") (Logic.ifElse (Equality.equal (Lists.length els) 1) (Lists.head els) ( - let head = (Lists.head els) - rest = (Lists.tail els)- idtOp = Ast.Op {- Ast.opSymbol = (sym ""),- Ast.opPadding = Ast.Padding {- Ast.paddingLeft = Ast.WsSpace,- Ast.paddingRight = (Ast.WsBreakAndIndent idt)},- Ast.opPrecedence = (Ast.Precedence 0),- Ast.opAssociativity = Ast.AssociativityNone}- in (ifx idtOp head (newlineSep rest)))))+customIndentBlock idt els = + let idtOp = Ast.Op {+ Ast.opSymbol = (sym ""),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsSpace,+ Ast.paddingRight = (Ast.WsBreakAndIndent idt)},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}+ in (Maybes.maybe (cst "") (\head -> Logic.ifElse (Equality.equal (Lists.length els) 1) head (ifx idtOp head (newlineSep (Lists.drop 1 els)))) (Lists.safeHead els)) dotSep :: ([Ast.Expr] -> Ast.Expr) dotSep = (sep (Ast.Op {@@ -106,42 +105,57 @@ -- | Find the approximate length (number of characters, including spaces and newlines) of an expression without actually printing it. expressionLength :: (Ast.Expr -> Int) expressionLength e = - let symbolLength = (\s -> Strings.length (Ast.unSymbol s)) - wsLength = (\ws -> (\x -> case x of- Ast.WsNone -> 0- Ast.WsSpace -> 1- Ast.WsBreak -> 1- Ast.WsBreakAndIndent v1 -> (Math.add 1 (Strings.length v1))- Ast.WsDoubleBreak -> 2) ws)- blockStyleLength = (\style -> - let mindentLen = (Optionals.maybe 0 Strings.length (Ast.blockStyleIndent style)) - nlBeforeLen = (Logic.ifElse (Ast.blockStyleNewlineBeforeContent style) 1 0)- nlAfterLen = (Logic.ifElse (Ast.blockStyleNewlineAfterContent style) 1 0)- in (Math.add mindentLen (Math.add nlBeforeLen nlAfterLen)))- bracketsLength = (\brackets -> Math.add (symbolLength (Ast.bracketsOpen brackets)) (symbolLength (Ast.bracketsClose brackets)))- bracketExprLength = (\be -> Math.add (bracketsLength (Ast.bracketExprBrackets be)) (Math.add (expressionLength (Ast.bracketExprEnclosed be)) (blockStyleLength (Ast.bracketExprStyle be))))- indentedExpressionLength = (\ie -> - let baseLen = (expressionLength (Ast.indentedExpressionExpr ie)) - indentLen = ((\x -> case x of- Ast.IndentStyleAllLines v1 -> (Strings.length v1)- Ast.IndentStyleSubsequentLines v1 -> (Strings.length v1)) (Ast.indentedExpressionStyle ie))- in (Math.add baseLen indentLen))- opLength = (\op -> - let symLen = (symbolLength (Ast.opSymbol op)) - padding = (Ast.opPadding op)- leftLen = (wsLength (Ast.paddingLeft padding))- rightLen = (wsLength (Ast.paddingRight padding))- in (Math.add symLen (Math.add leftLen rightLen)))- opExprLength = (\oe -> - let opLen = (opLength (Ast.opExprOp oe)) - leftLen = (expressionLength (Ast.opExprLhs oe))- rightLen = (expressionLength (Ast.opExprRhs oe))- in (Math.add opLen (Math.add leftLen rightLen)))- in ((\x -> case x of- Ast.ExprConst v1 -> (symbolLength v1)- Ast.ExprIndent v1 -> (indentedExpressionLength v1)- Ast.ExprOp v1 -> (opExprLength v1)- Ast.ExprBrackets v1 -> (bracketExprLength v1)) e)+ let symbolLength = (\s -> Strings.length (Ast.unSymbol s))+ in + let wsLength = (\ws -> (\x -> case x of+ Ast.WsNone -> 0+ Ast.WsSpace -> 1+ Ast.WsBreak -> 1+ Ast.WsBreakAndIndent v1 -> (Math.add 1 (Strings.length v1))+ Ast.WsDoubleBreak -> 2) ws)+ in + let blockStyleLength = (\style -> + let mindentLen = (Maybes.maybe 0 Strings.length (Ast.blockStyleIndent style))+ in + let nlBeforeLen = (Logic.ifElse (Ast.blockStyleNewlineBeforeContent style) 1 0)+ in + let nlAfterLen = (Logic.ifElse (Ast.blockStyleNewlineAfterContent style) 1 0)+ in (Math.add mindentLen (Math.add nlBeforeLen nlAfterLen)))+ in + let bracketsLength = (\brackets -> Math.add (symbolLength (Ast.bracketsOpen brackets)) (symbolLength (Ast.bracketsClose brackets)))+ in + let bracketExprLength = (\be -> Math.add (bracketsLength (Ast.bracketExprBrackets be)) (Math.add (expressionLength (Ast.bracketExprEnclosed be)) (blockStyleLength (Ast.bracketExprStyle be))))+ in + let indentedExpressionLength = (\ie -> + let baseLen = (expressionLength (Ast.indentedExpressionExpr ie))+ in + let indentLen = ((\x -> case x of+ Ast.IndentStyleAllLines v1 -> (Strings.length v1)+ Ast.IndentStyleSubsequentLines v1 -> (Strings.length v1)) (Ast.indentedExpressionStyle ie))+ in (Math.add baseLen indentLen))+ in + let opLength = (\op -> + let symLen = (symbolLength (Ast.opSymbol op))+ in + let padding = (Ast.opPadding op)+ in + let leftLen = (wsLength (Ast.paddingLeft padding))+ in + let rightLen = (wsLength (Ast.paddingRight padding))+ in (Math.add symLen (Math.add leftLen rightLen)))+ in + let opExprLength = (\oe -> + let opLen = (opLength (Ast.opExprOp oe))+ in + let leftLen = (expressionLength (Ast.opExprLhs oe))+ in + let rightLen = (expressionLength (Ast.opExprRhs oe))+ in (Math.add opLen (Math.add leftLen rightLen)))+ in ((\x -> case x of+ Ast.ExprConst v1 -> (symbolLength v1)+ Ast.ExprIndent v1 -> (indentedExpressionLength v1)+ Ast.ExprOp v1 -> (opExprLength v1)+ Ast.ExprBrackets v1 -> (bracketExprLength v1)) e) fullBlockStyle :: Ast.BlockStyle fullBlockStyle = Ast.BlockStyle {@@ -175,15 +189,16 @@ infixWs :: (String -> Ast.Expr -> Ast.Expr -> Ast.Expr) infixWs op l r = (spaceSep [ l,- cst op,+ (cst op), r]) infixWsList :: (String -> [Ast.Expr] -> Ast.Expr) infixWsList op opers = - let opExpr = (cst op) - foldFun = (\e -> \r -> Logic.ifElse (Lists.null e) [- r] (Lists.cons r (Lists.cons opExpr e)))- in (spaceSep (Lists.foldl foldFun [] (Lists.reverse opers)))+ let opExpr = (cst op)+ in + let foldFun = (\e -> \r -> Logic.ifElse (Lists.null e) [+ r] (Lists.cons r (Lists.cons opExpr e)))+ in (spaceSep (Lists.foldl foldFun [] (Lists.reverse opers))) inlineStyle :: Ast.BlockStyle inlineStyle = Ast.BlockStyle {@@ -236,16 +251,14 @@ Ast.opAssociativity = Ast.AssociativityNone} orSep :: (Ast.BlockStyle -> [Ast.Expr] -> Ast.Expr)-orSep style l = (Logic.ifElse (Lists.null l) (cst "") (Logic.ifElse (Equality.equal (Lists.length l) 1) (Lists.head l) ( - let h = (Lists.head l) - r = (Lists.tail l)- newlines = (Ast.blockStyleNewlineBeforeContent style)- in (ifx (orOp newlines) h (orSep style r)))))+orSep style l = + let newlines = (Ast.blockStyleNewlineBeforeContent style)+ in (Maybes.maybe (cst "") (\h -> Lists.foldl (\acc -> \el -> ifx (orOp newlines) acc el) h (Lists.drop 1 l)) (Lists.safeHead l)) parenList :: (Bool -> [Ast.Expr] -> Ast.Expr)-parenList newlines els = (Logic.ifElse (Lists.null els) (cst "()") ( +parenList newlines els = let style = (Logic.ifElse (Logic.and newlines (Equality.gt (Lists.length els) 1)) halfBlockStyle inlineStyle)- in (brackets parentheses style (commaSep style els))))+ in (Logic.ifElse (Lists.null els) (cst "()") (brackets parentheses style (commaSep style els))) parens :: (Ast.Expr -> Ast.Expr) parens = (brackets parentheses inlineStyle)@@ -259,53 +272,68 @@ parenthesize exp = let assocLeft = (\a -> (\x -> case x of Ast.AssociativityRight -> False- _ -> True) a) - assocRight = (\a -> (\x -> case x of- Ast.AssociativityLeft -> False- _ -> True) a)- in ((\x -> case x of- Ast.ExprBrackets v1 -> (Ast.ExprBrackets (Ast.BracketExpr {- Ast.bracketExprBrackets = (Ast.bracketExprBrackets v1),- Ast.bracketExprEnclosed = (parenthesize (Ast.bracketExprEnclosed v1)),- Ast.bracketExprStyle = (Ast.bracketExprStyle v1)}))- Ast.ExprConst _ -> exp- Ast.ExprIndent v1 -> (Ast.ExprIndent (Ast.IndentedExpression {- Ast.indentedExpressionStyle = (Ast.indentedExpressionStyle v1),- Ast.indentedExpressionExpr = (parenthesize (Ast.indentedExpressionExpr v1))}))- Ast.ExprOp v1 -> - let op = (Ast.opExprOp v1) - prec = (Ast.unPrecedence (Ast.opPrecedence op))- assoc = (Ast.opAssociativity op)- lhs = (Ast.opExprLhs v1)- rhs = (Ast.opExprRhs v1)- lhs_ = (parenthesize lhs)- rhs_ = (parenthesize rhs)- lhs2 = ((\x -> case x of- Ast.ExprOp v2 -> - let lop = (Ast.opExprOp v2) - lprec = (Ast.unPrecedence (Ast.opPrecedence lop))- lassoc = (Ast.opAssociativity lop)- comparison = (Equality.compare prec lprec)- in ((\x -> case x of- Mantle.ComparisonLessThan -> lhs_- Mantle.ComparisonGreaterThan -> (parens lhs_)- Mantle.ComparisonEqualTo -> (Logic.ifElse (Logic.and (assocLeft assoc) (assocLeft lassoc)) lhs_ (parens lhs_))) comparison)- _ -> lhs_) lhs_)- rhs2 = ((\x -> case x of- Ast.ExprOp v2 -> - let rop = (Ast.opExprOp v2) - rprec = (Ast.unPrecedence (Ast.opPrecedence rop))- rassoc = (Ast.opAssociativity rop)- comparison = (Equality.compare prec rprec)- in ((\x -> case x of- Mantle.ComparisonLessThan -> rhs_- Mantle.ComparisonGreaterThan -> (parens rhs_)- Mantle.ComparisonEqualTo -> (Logic.ifElse (Logic.and (assocRight assoc) (assocRight rassoc)) rhs_ (parens rhs_))) comparison)- _ -> rhs_) rhs_)- in (Ast.ExprOp (Ast.OpExpr {- Ast.opExprOp = op,- Ast.opExprLhs = lhs2,- Ast.opExprRhs = rhs2}))) exp)+ _ -> True) a)+ in + let assocRight = (\a -> (\x -> case x of+ Ast.AssociativityLeft -> False+ _ -> True) a)+ in ((\x -> case x of+ Ast.ExprBrackets v1 -> (Ast.ExprBrackets (Ast.BracketExpr {+ Ast.bracketExprBrackets = (Ast.bracketExprBrackets v1),+ Ast.bracketExprEnclosed = (parenthesize (Ast.bracketExprEnclosed v1)),+ Ast.bracketExprStyle = (Ast.bracketExprStyle v1)}))+ Ast.ExprConst _ -> exp+ Ast.ExprIndent v1 -> (Ast.ExprIndent (Ast.IndentedExpression {+ Ast.indentedExpressionStyle = (Ast.indentedExpressionStyle v1),+ Ast.indentedExpressionExpr = (parenthesize (Ast.indentedExpressionExpr v1))}))+ Ast.ExprOp v1 -> + let op = (Ast.opExprOp v1)+ in + let prec = (Ast.unPrecedence (Ast.opPrecedence op))+ in + let assoc = (Ast.opAssociativity op)+ in + let lhs = (Ast.opExprLhs v1)+ in + let rhs = (Ast.opExprRhs v1)+ in + let lhs_ = (parenthesize lhs)+ in + let rhs_ = (parenthesize rhs)+ in + let lhs2 = ((\x -> case x of+ Ast.ExprOp v2 -> + let lop = (Ast.opExprOp v2)+ in + let lprec = (Ast.unPrecedence (Ast.opPrecedence lop))+ in + let lassoc = (Ast.opAssociativity lop)+ in + let comparison = (Equality.compare prec lprec)+ in ((\x -> case x of+ Util.ComparisonLessThan -> lhs_+ Util.ComparisonGreaterThan -> (parens lhs_)+ Util.ComparisonEqualTo -> (Logic.ifElse (Logic.and (assocLeft assoc) (assocLeft lassoc)) lhs_ (parens lhs_))) comparison)+ _ -> lhs_) lhs_)+ in + let rhs2 = ((\x -> case x of+ Ast.ExprOp v2 -> + let rop = (Ast.opExprOp v2)+ in + let rprec = (Ast.unPrecedence (Ast.opPrecedence rop))+ in + let rassoc = (Ast.opAssociativity rop)+ in + let comparison = (Equality.compare prec rprec)+ in ((\x -> case x of+ Util.ComparisonLessThan -> rhs_+ Util.ComparisonGreaterThan -> (parens rhs_)+ Util.ComparisonEqualTo -> (Logic.ifElse (Logic.and (assocRight assoc) (assocRight rassoc)) rhs_ (parens rhs_))) comparison)+ _ -> rhs_) rhs_)+ in (Ast.ExprOp (Ast.OpExpr {+ Ast.opExprOp = op,+ Ast.opExprLhs = lhs2,+ Ast.opExprRhs = rhs2}))) exp) prefix :: (String -> Ast.Expr -> Ast.Expr) prefix p expr = @@ -325,73 +353,74 @@ Ast.WsSpace -> " " Ast.WsBreak -> "\n" Ast.WsBreakAndIndent _ -> "\n"- Ast.WsDoubleBreak -> "\n\n") ws) - idt = (\ws -> \s -> (\x -> case x of- Ast.WsBreakAndIndent v1 -> (customIndent v1 s)- _ -> s) ws)- in ((\x -> case x of- Ast.ExprConst v1 -> (Ast.unSymbol v1)- Ast.ExprIndent v1 -> - let style = (Ast.indentedExpressionStyle v1) - expr = (Ast.indentedExpressionExpr v1)- lns = (Strings.lines (printExpr expr))- in (Strings.intercalate "\n" ((\x -> case x of- Ast.IndentStyleAllLines v2 -> (Lists.map (\line -> Strings.cat [- v2,- line]) lns)- Ast.IndentStyleSubsequentLines v2 -> (Logic.ifElse (Equality.equal (Lists.length lns) 1) lns (Lists.cons (Lists.head lns) (Lists.map (\line -> Strings.cat [- v2,- line]) (Lists.tail lns))))) style))- Ast.ExprOp v1 -> - let op = (Ast.opExprOp v1) - sym = (Ast.unSymbol (Ast.opSymbol op))- padding = (Ast.opPadding op)- padl = (Ast.paddingLeft padding)- padr = (Ast.paddingRight padding)- l = (Ast.opExprLhs v1)- r = (Ast.opExprRhs v1)- lhs = (idt padl (printExpr l))- rhs = (idt padr (printExpr r))- in (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- lhs,- (pad padl)],- sym],- (pad padr)],- rhs])- Ast.ExprBrackets v1 -> - let brackets = (Ast.bracketExprBrackets v1) - l = (Ast.unSymbol (Ast.bracketsOpen brackets))- r = (Ast.unSymbol (Ast.bracketsClose brackets))- e = (Ast.bracketExprEnclosed v1)- style = (Ast.bracketExprStyle v1)- body = (printExpr e)- doIndent = (Ast.blockStyleIndent style)- nlBefore = (Ast.blockStyleNewlineBeforeContent style)- nlAfter = (Ast.blockStyleNewlineAfterContent style)- ibody = (Optionals.maybe body (\idt -> customIndent idt body) doIndent)- pre = (Logic.ifElse nlBefore "\n" "")- suf = (Logic.ifElse nlAfter "\n" "")- in (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- l,- pre],- ibody],- suf],- r])) e)+ Ast.WsDoubleBreak -> "\n\n") ws)+ in + let idt = (\ws -> \s -> (\x -> case x of+ Ast.WsBreakAndIndent v1 -> (customIndent v1 s)+ _ -> s) ws)+ in ((\x -> case x of+ Ast.ExprConst v1 -> (Ast.unSymbol v1)+ Ast.ExprIndent v1 -> + let style = (Ast.indentedExpressionStyle v1)+ in + let expr = (Ast.indentedExpressionExpr v1)+ in + let lns = (Strings.lines (printExpr expr))+ in + let ilns = ((\x -> case x of+ Ast.IndentStyleAllLines v2 -> (Lists.map (\line -> Strings.cat2 v2 line) lns)+ Ast.IndentStyleSubsequentLines v2 -> (Logic.ifElse (Equality.equal (Lists.length lns) 1) lns (Lists.cons (Lists.head lns) (Lists.map (\line -> Strings.cat2 v2 line) (Lists.tail lns))))) style)+ in (Strings.intercalate "\n" ilns)+ Ast.ExprOp v1 -> + let op = (Ast.opExprOp v1)+ in + let sym = (Ast.unSymbol (Ast.opSymbol op))+ in + let padding = (Ast.opPadding op)+ in + let padl = (Ast.paddingLeft padding)+ in + let padr = (Ast.paddingRight padding)+ in + let l = (Ast.opExprLhs v1)+ in + let r = (Ast.opExprRhs v1)+ in + let lhs = (idt padl (printExpr l))+ in + let rhs = (idt padr (printExpr r))+ in (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 lhs (pad padl)) sym) (pad padr)) rhs)+ Ast.ExprBrackets v1 -> + let brackets = (Ast.bracketExprBrackets v1)+ in + let l = (Ast.unSymbol (Ast.bracketsOpen brackets))+ in + let r = (Ast.unSymbol (Ast.bracketsClose brackets))+ in + let e = (Ast.bracketExprEnclosed v1)+ in + let style = (Ast.bracketExprStyle v1)+ in + let body = (printExpr e)+ in + let doIndent = (Ast.blockStyleIndent style)+ in + let nlBefore = (Ast.blockStyleNewlineBeforeContent style)+ in + let nlAfter = (Ast.blockStyleNewlineAfterContent style)+ in + let ibody = (Maybes.maybe body (\idt -> customIndent idt body) doIndent)+ in + let pre = (Logic.ifElse nlBefore "\n" "")+ in + let suf = (Logic.ifElse nlAfter "\n" "")+ in (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 l pre) ibody) suf) r)) e) semicolonSep :: ([Ast.Expr] -> Ast.Expr) semicolonSep = (symbolSep ";" inlineStyle) sep :: (Ast.Op -> [Ast.Expr] -> Ast.Expr)-sep op els = (Logic.ifElse (Lists.null els) (cst "") (Logic.ifElse (Equality.equal (Lists.length els) 1) (Lists.head els) ( - let h = (Lists.head els) - r = (Lists.tail els)- in (ifx op h (sep op r)))))+sep op els = (Maybes.maybe (cst "") (\h -> Lists.foldl (\acc -> \el -> ifx op acc el) h (Lists.drop 1 els)) (Lists.safeHead els)) spaceSep :: ([Ast.Expr] -> Ast.Expr) spaceSep = (sep (Ast.Op {@@ -407,25 +436,37 @@ Ast.bracketsOpen = (sym "["), Ast.bracketsClose = (sym "]")} +-- | Append a suffix string to an expression+suffix :: (String -> Ast.Expr -> Ast.Expr)+suffix s expr = + let sufOp = Ast.Op {+ Ast.opSymbol = (sym s),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsNone,+ Ast.paddingRight = Ast.WsNone},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}+ in (ifx sufOp expr (cst ""))+ sym :: (String -> Ast.Symbol) sym s = (Ast.Symbol s) symbolSep :: (String -> Ast.BlockStyle -> [Ast.Expr] -> Ast.Expr)-symbolSep symb style l = (Logic.ifElse (Lists.null l) (cst "") (Logic.ifElse (Equality.equal (Lists.length l) 1) (Lists.head l) ( - let h = (Lists.head l) - r = (Lists.tail l)- breakCount = (Lists.length (Lists.filter (\x_ -> x_) [- Ast.blockStyleNewlineBeforeContent style,- (Ast.blockStyleNewlineAfterContent style)]))- break = (Logic.ifElse (Equality.equal breakCount 0) Ast.WsSpace (Logic.ifElse (Equality.equal breakCount 1) Ast.WsBreak Ast.WsDoubleBreak))- commaOp = Ast.Op {+symbolSep symb style l = + let breakCount = (Lists.length (Lists.filter (\x_ -> x_) [+ Ast.blockStyleNewlineBeforeContent style,+ (Ast.blockStyleNewlineAfterContent style)]))+ in + let break = (Logic.ifElse (Equality.equal breakCount 0) Ast.WsSpace (Logic.ifElse (Equality.equal breakCount 1) Ast.WsBreak Ast.WsDoubleBreak))+ in + let commaOp = Ast.Op { Ast.opSymbol = (sym symb), Ast.opPadding = Ast.Padding { Ast.paddingLeft = Ast.WsNone, Ast.paddingRight = break}, Ast.opPrecedence = (Ast.Precedence 0), Ast.opAssociativity = Ast.AssociativityNone}- in (ifx commaOp h (symbolSep symb style r)))))+ in (Maybes.maybe (cst "") (\h -> Lists.foldl (\acc -> \el -> ifx commaOp acc el) h (Lists.drop 1 l)) (Lists.safeHead l)) tabIndent :: (Ast.Expr -> Ast.Expr) tabIndent e = (Ast.ExprIndent (Ast.IndentedExpression {@@ -439,22 +480,10 @@ tabIndentSingleSpace exprs = (tabIndent (newlineSep exprs)) unsupportedType :: (String -> Ast.Expr)-unsupportedType label = (cst (Strings.cat [- Strings.cat [- "[",- label],- "]"]))+unsupportedType label = (cst (Strings.cat2 (Strings.cat2 "[" label) "]")) unsupportedVariant :: (String -> String -> Ast.Expr)-unsupportedVariant label obj = (cst (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- "[unsupported ",- label],- ": "],- (Literals.showString obj)],- "]"]))+unsupportedVariant label obj = (cst (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "[unsupported " label) ": ") (Literals.showString obj)) "]")) withComma :: (Ast.Expr -> Ast.Expr) withComma e = (noSep [
src/gen-main/haskell/Hydra/Show/Accessors.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for working with term accessors. module Hydra.Show.Accessors where@@ -6,13 +8,15 @@ import qualified Hydra.Core as Core import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Module as Module import qualified Hydra.Names as Names import qualified Hydra.Rewriting as Rewriting-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -21,52 +25,53 @@ -- | Convert a term accessor to a string representation termAccessor :: (Accessors.TermAccessor -> Maybe String) termAccessor accessor = - let idx = (\i -> Nothing) - idxSuff = (\suffix -> \i -> Optionals.map (\s -> Strings.cat2 s suffix) (idx i))- in ((\x -> case x of- Accessors.TermAccessorAnnotatedSubject -> Nothing- Accessors.TermAccessorApplicationFunction -> (Just "fun")- Accessors.TermAccessorApplicationArgument -> (Just "arg")- Accessors.TermAccessorLambdaBody -> (Just "body")- Accessors.TermAccessorUnionCasesDefault -> (Just "default")- Accessors.TermAccessorUnionCasesBranch v1 -> (Just (Strings.cat2 "." (Core.unName v1)))- Accessors.TermAccessorLetEnvironment -> (Just "in")- Accessors.TermAccessorLetBinding v1 -> (Just (Strings.cat2 (Core.unName v1) "="))- Accessors.TermAccessorListElement v1 -> (idx v1)- Accessors.TermAccessorMapKey v1 -> (idxSuff ".key" v1)- Accessors.TermAccessorMapValue v1 -> (idxSuff ".value" v1)- Accessors.TermAccessorOptionalTerm -> (Just "just")- Accessors.TermAccessorProductTerm v1 -> (idx v1)- Accessors.TermAccessorRecordField v1 -> (Just (Strings.cat2 "." (Core.unName v1)))- Accessors.TermAccessorSetElement v1 -> (idx v1)- Accessors.TermAccessorSumTerm -> Nothing- Accessors.TermAccessorTypeLambdaBody -> Nothing- Accessors.TermAccessorTypeApplicationTerm -> Nothing- Accessors.TermAccessorInjectionTerm -> Nothing- Accessors.TermAccessorWrappedTerm -> Nothing) accessor)+ let idx = (\i -> Nothing)+ in + let idxSuff = (\suffix -> \i -> Maybes.map (\s -> Strings.cat2 s suffix) (idx i))+ in ((\x -> case x of+ Accessors.TermAccessorAnnotatedBody -> Nothing+ Accessors.TermAccessorApplicationFunction -> (Just "fun")+ Accessors.TermAccessorApplicationArgument -> (Just "arg")+ Accessors.TermAccessorLambdaBody -> (Just "body")+ Accessors.TermAccessorUnionCasesDefault -> (Just "default")+ Accessors.TermAccessorUnionCasesBranch v1 -> (Just (Strings.cat2 "." (Core.unName v1)))+ Accessors.TermAccessorLetBody -> (Just "in")+ Accessors.TermAccessorLetBinding v1 -> (Just (Strings.cat2 (Core.unName v1) "="))+ Accessors.TermAccessorListElement v1 -> (idx v1)+ Accessors.TermAccessorMapKey v1 -> (idxSuff ".key" v1)+ Accessors.TermAccessorMapValue v1 -> (idxSuff ".value" v1)+ Accessors.TermAccessorMaybeTerm -> (Just "just")+ Accessors.TermAccessorProductTerm v1 -> (idx v1)+ Accessors.TermAccessorRecordField v1 -> (Just (Strings.cat2 "." (Core.unName v1)))+ Accessors.TermAccessorSetElement v1 -> (idx v1)+ Accessors.TermAccessorSumTerm -> Nothing+ Accessors.TermAccessorTypeLambdaBody -> Nothing+ Accessors.TermAccessorTypeApplicationTerm -> Nothing+ Accessors.TermAccessorInjectionTerm -> Nothing+ Accessors.TermAccessorWrappedTerm -> Nothing) accessor) -- | Build an accessor graph from a term termToAccessorGraph :: (M.Map Module.Namespace String -> Core.Term -> Accessors.AccessorGraph) termToAccessorGraph namespaces term = - let dontCareAccessor = Accessors.TermAccessorAnnotatedSubject + let dontCareAccessor = Accessors.TermAccessorAnnotatedBody helper = (\ids -> \mroot -> \path -> \state -> \accessorTerm -> - let accessor = (fst accessorTerm) - currentTerm = (snd accessorTerm)- nodesEdges = (fst state)- visited = (snd state)- nodes = (fst nodesEdges)- edges = (snd nodesEdges)+ let accessor = (Pairs.first accessorTerm) + currentTerm = (Pairs.second accessorTerm)+ nodesEdges = (Pairs.first state)+ visited = (Pairs.second state)+ nodes = (Pairs.first nodesEdges)+ edges = (Pairs.second nodesEdges) nextPath = (Lists.cons accessor path) in ((\x -> case x of Core.TermLet v1 -> let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)+ env = (Core.letBody v1) bindingNames = (Lists.map Core.bindingName bindings) addBindingName = (\nodesVisitedIds -> \name -> - let currentNodesVisited = (fst nodesVisitedIds) - currentIds = (snd nodesVisitedIds)- currentNodes = (fst currentNodesVisited)- currentVisited = (snd currentNodesVisited)+ let currentNodesVisited = (Pairs.first nodesVisitedIds) + currentIds = (Pairs.second nodesVisitedIds)+ currentNodes = (Pairs.first currentNodesVisited)+ currentVisited = (Pairs.second currentNodesVisited) rawLabel = (Names.compactName namespaces name) uniqueLabel = (Names.uniqueLabel currentVisited rawLabel) node = Accessors.AccessorNode {@@ -78,18 +83,18 @@ newIds = (Maps.insert name node currentIds) in ((newNodes, newVisited), newIds)) nodesVisitedIds1 = (Lists.foldl addBindingName (([], visited), ids) bindingNames)- nodes1 = (fst (fst nodesVisitedIds1))- visited1 = (snd (fst nodesVisitedIds1))- ids1 = (snd nodesVisitedIds1)+ nodes1 = (Pairs.first (Pairs.first nodesVisitedIds1))+ visited1 = (Pairs.second (Pairs.first nodesVisitedIds1))+ ids1 = (Pairs.second nodesVisitedIds1) addBindingTerm = (\currentState -> \nodeBinding -> - let root = (fst nodeBinding) - binding = (snd nodeBinding)+ let root = (Pairs.first nodeBinding) + binding = (Pairs.second nodeBinding) term1 = (Core.bindingTerm binding) in (helper ids1 (Just root) [] currentState (dontCareAccessor, term1))) nodeBindingPairs = (Lists.zip nodes1 bindings) stateAfterBindings = (Lists.foldl addBindingTerm ((Lists.concat2 nodes1 nodes, edges), visited1) nodeBindingPairs)- in (helper ids1 mroot nextPath stateAfterBindings (Accessors.TermAccessorLetEnvironment, env))- Core.TermVariable v1 -> (Optionals.maybe state (\root -> Optionals.maybe state (\node -> + in (helper ids1 mroot nextPath stateAfterBindings (Accessors.TermAccessorLetBody, env))+ Core.TermVariable v1 -> (Maybes.maybe state (\root -> Maybes.maybe state (\node -> let edge = Accessors.AccessorEdge { Accessors.accessorEdgeSource = root, Accessors.accessorEdgePath = (Accessors.AccessorPath (Lists.reverse nextPath)),@@ -99,9 +104,9 @@ _ -> (Lists.foldl (helper ids mroot nextPath) state (Rewriting.subtermsWithAccessors currentTerm))) currentTerm)) initialState = (([], []), Sets.empty) result = (helper Maps.empty Nothing [] initialState (dontCareAccessor, term))- finalNodesEdges = (fst result)- finalNodes = (fst finalNodesEdges)- finalEdges = (snd finalNodesEdges)+ finalNodesEdges = (Pairs.first result)+ finalNodes = (Pairs.first finalNodesEdges)+ finalEdges = (Pairs.second finalNodesEdges) in Accessors.AccessorGraph { Accessors.accessorGraphNodes = finalNodes, Accessors.accessorGraphEdges = finalEdges}
src/gen-main/haskell/Hydra/Show/Core.hs view
@@ -1,104 +1,120 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | String representations of hydra.core types module Hydra.Show.Core where import qualified Hydra.Core as Core+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Literals as Literals import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -readTerm :: (t0 -> Maybe t1)-readTerm _ = Nothing+-- | A placeholder for reading terms from their serialized form. Not implemented.+readTerm :: (String -> Maybe Core.Term)+readTerm s = (Just (Core.TermLiteral (Core.LiteralString s))) -- | Show a binding as a string binding :: (Core.Binding -> String) binding el = - let name = (Core.unName (Core.bindingName el)) - t = (Core.bindingTerm el)- typeStr = (Optionals.maybe "" (\ts -> Strings.cat2 " : " (typeScheme ts)) (Core.bindingType el))- in (Strings.cat [- name,- " = ",- term t,- typeStr])+ let name = (Core.unName (Core.bindingName el))+ in + let t = (Core.bindingTerm el)+ in + let typeStr = (Maybes.maybe "" (\ts -> Strings.cat [+ ":(",+ (typeScheme ts),+ ")"]) (Core.bindingType el))+ in (Strings.cat [+ name,+ typeStr,+ " = ",+ (term t)]) -- | Show an elimination as a string elimination :: (Core.Elimination -> String) elimination elm = ((\x -> case x of- Core.EliminationProduct v1 -> - let arity = (Core.tupleProjectionArity v1) - index = (Core.tupleProjectionIndex v1)- domain = (Core.tupleProjectionDomain v1)- in (Strings.cat [- "[",- Literals.showInt32 index,- "/",- Literals.showInt32 arity,- "]"]) Core.EliminationRecord v1 -> - let tname = (Core.unName (Core.projectionTypeName v1)) - fname = (Core.unName (Core.projectionField v1))- in (Strings.cat [- "project(",- tname,- "){",- fname,- "}"])+ let tname = (Core.unName (Core.projectionTypeName v1))+ in + let fname = (Core.unName (Core.projectionField v1))+ in (Strings.cat [+ "project(",+ tname,+ "){",+ fname,+ "}"]) Core.EliminationUnion v1 -> - let tname = (Core.unName (Core.caseStatementTypeName v1)) - mdef = (Core.caseStatementDefault v1)- cases = (Core.caseStatementCases v1)- defaultField = (Optionals.maybe [] (\d -> [- Core.Field {- Core.fieldName = (Core.Name "[default]"),- Core.fieldTerm = d}]) mdef)- allFields = (Lists.concat [- cases,- defaultField])- in (Strings.cat [- "case(",- tname,- ")",- (fields allFields)])+ let tname = (Core.unName (Core.caseStatementTypeName v1))+ in + let mdef = (Core.caseStatementDefault v1)+ in + let cases = (Core.caseStatementCases v1)+ in + let defaultField = (Maybes.maybe [] (\d -> [+ Core.Field {+ Core.fieldName = (Core.Name "[default]"),+ Core.fieldTerm = d}]) mdef)+ in + let allFields = (Lists.concat [+ cases,+ defaultField])+ in (Strings.cat [+ "case(",+ tname,+ ")",+ (fields allFields)]) Core.EliminationWrap v1 -> (Strings.cat [ "unwrap(",- Core.unName v1,+ (Core.unName v1), ")"])) elm) +field :: (Core.Field -> String)+field field = + let fname = (Core.unName (Core.fieldName field))+ in + let fterm = (Core.fieldTerm field)+ in (Strings.cat [+ fname,+ "=",+ (term fterm)])++fieldType :: (Core.FieldType -> String)+fieldType ft = + let fname = (Core.unName (Core.fieldTypeName ft))+ in + let ftyp = (Core.fieldTypeType ft)+ in (Strings.cat [+ fname,+ ":",+ (type_ ftyp)])+ -- | Show a list of fields as a string fields :: ([Core.Field] -> String) fields flds = - let showField = (\field -> - let fname = (Core.unName (Core.fieldName field)) - fterm = (Core.fieldTerm field)- in (Strings.cat2 fname (Strings.cat2 "=" (term fterm)))) - fieldStrs = (Lists.map showField flds)+ let fieldStrs = (Lists.map field flds) in (Strings.cat [ "{",- Strings.intercalate ", " fieldStrs,+ (Strings.intercalate ", " fieldStrs), "}"]) -- | Show a float value as a string float :: (Core.FloatValue -> String) float fv = ((\x -> case x of- Core.FloatValueBigfloat v1 -> (Strings.cat [- Literals.showBigfloat v1,- ":bigfloat"])- Core.FloatValueFloat32 v1 -> (Strings.cat [- Literals.showFloat32 v1,- ":float32"])- Core.FloatValueFloat64 v1 -> (Strings.cat [- Literals.showFloat64 v1,- ":float64"])) fv)+ Core.FloatValueBigfloat v1 -> (Strings.cat2 (Literals.showBigfloat v1) ":bigfloat")+ Core.FloatValueFloat32 v1 -> (Strings.cat2 (Literals.showFloat32 v1) ":float32")+ Core.FloatValueFloat64 v1 -> (Strings.cat2 (Literals.showFloat64 v1) ":float64")) fv) -- | Show a float type as a string floatType :: (Core.FloatType -> String)@@ -122,7 +138,7 @@ let f = (Core.injectionField inj) in (Strings.cat [ "inject(",- Core.unName tname,+ (Core.unName tname), ")", (fields [ f])])@@ -130,33 +146,15 @@ -- | Show an integer value as a string integer :: (Core.IntegerValue -> String) integer iv = ((\x -> case x of- Core.IntegerValueBigint v1 -> (Strings.cat [- Literals.showBigint v1,- ":bigint"])- Core.IntegerValueInt8 v1 -> (Strings.cat [- Literals.showInt8 v1,- ":int8"])- Core.IntegerValueInt16 v1 -> (Strings.cat [- Literals.showInt16 v1,- ":int16"])- Core.IntegerValueInt32 v1 -> (Strings.cat [- Literals.showInt32 v1,- ":int32"])- Core.IntegerValueInt64 v1 -> (Strings.cat [- Literals.showInt64 v1,- ":int64"])- Core.IntegerValueUint8 v1 -> (Strings.cat [- Literals.showUint8 v1,- ":uint8"])- Core.IntegerValueUint16 v1 -> (Strings.cat [- Literals.showUint16 v1,- ":uint16"])- Core.IntegerValueUint32 v1 -> (Strings.cat [- Literals.showUint32 v1,- ":uint32"])- Core.IntegerValueUint64 v1 -> (Strings.cat [- Literals.showUint64 v1,- ":uint64"])) iv)+ Core.IntegerValueBigint v1 -> (Strings.cat2 (Literals.showBigint v1) ":bigint")+ Core.IntegerValueInt8 v1 -> (Strings.cat2 (Literals.showInt8 v1) ":int8")+ Core.IntegerValueInt16 v1 -> (Strings.cat2 (Literals.showInt16 v1) ":int16")+ Core.IntegerValueInt32 v1 -> (Strings.cat2 (Literals.showInt32 v1) ":int32")+ Core.IntegerValueInt64 v1 -> (Strings.cat2 (Literals.showInt64 v1) ":int64")+ Core.IntegerValueUint8 v1 -> (Strings.cat2 (Literals.showUint8 v1) ":uint8")+ Core.IntegerValueUint16 v1 -> (Strings.cat2 (Literals.showUint16 v1) ":uint16")+ Core.IntegerValueUint32 v1 -> (Strings.cat2 (Literals.showUint32 v1) ":uint32")+ Core.IntegerValueUint64 v1 -> (Strings.cat2 (Literals.showUint64 v1) ":uint64")) iv) -- | Show an integer type as a string integerType :: (Core.IntegerType -> String)@@ -174,23 +172,41 @@ -- | Show a lambda as a string lambda :: (Core.Lambda -> String) lambda l = - let v = (Core.unName (Core.lambdaParameter l)) - mt = (Core.lambdaDomain l)- body = (Core.lambdaBody l)- typeStr = (Optionals.maybe "" (\t -> Strings.cat2 ":" (type_ t)) mt)- in (Strings.cat [- "\955",- v,- typeStr,- ".",- (term body)])+ let v = (Core.unName (Core.lambdaParameter l))+ in + let mt = (Core.lambdaDomain l)+ in + let body = (Core.lambdaBody l)+ in + let typeStr = (Maybes.maybe "" (\t -> Strings.cat2 ":" (type_ t)) mt)+ in (Strings.cat [+ "\955",+ v,+ typeStr,+ ".",+ (term body)]) +-- | Show a let expression as a string+let_ :: (Core.Let -> String)+let_ l = + let bindings = (Core.letBindings l)+ in + let env = (Core.letBody l)+ in + let bindingStrs = (Lists.map binding bindings)+ in (Strings.cat [+ "let ",+ (Strings.intercalate ", " bindingStrs),+ " in ",+ (term env)])++-- | Show a list using a given function to show each element list :: ((t0 -> String) -> [t0] -> String) list f xs = let elementStrs = (Lists.map f xs) in (Strings.cat [ "[",- Strings.intercalate ", " elementStrs,+ (Strings.intercalate ", " elementStrs), "]"]) -- | Show a literal as a string@@ -215,217 +231,230 @@ term :: (Core.Term -> String) term t = let gatherTerms = (\prev -> \app -> - let lhs = (Core.applicationFunction app) - rhs = (Core.applicationArgument app)- in ((\x -> case x of- Core.TermApplication v1 -> (gatherTerms (Lists.cons rhs prev) v1)- _ -> (Lists.cons lhs (Lists.cons rhs prev))) lhs))+ let lhs = (Core.applicationFunction app)+ in + let rhs = (Core.applicationArgument app)+ in ((\x -> case x of+ Core.TermApplication v1 -> (gatherTerms (Lists.cons rhs prev) v1)+ _ -> (Lists.cons lhs (Lists.cons rhs prev))) lhs)) in ((\x -> case x of- Core.TermAnnotated v1 -> (term (Core.annotatedTermSubject v1))+ Core.TermAnnotated v1 -> (term (Core.annotatedTermBody v1)) Core.TermApplication v1 -> - let terms = (gatherTerms [] v1) - termStrs = (Lists.map term terms)- in (Strings.cat [- "(",- Strings.intercalate " @ " termStrs,- ")"])+ let terms = (gatherTerms [] v1)+ in + let termStrs = (Lists.map term terms)+ in (Strings.cat [+ "(",+ (Strings.intercalate " @ " termStrs),+ ")"])+ Core.TermEither v1 -> (Eithers.either (\l -> Strings.cat [+ "left(",+ (term l),+ ")"]) (\r -> Strings.cat [+ "right(",+ (term r),+ ")"]) v1) Core.TermFunction v1 -> (function v1)- Core.TermLet v1 -> - let bindings = (Core.letBindings v1) - env = (Core.letEnvironment v1)- bindingStrs = (Lists.map binding bindings)- in (Strings.cat [- "let ",- Strings.intercalate ", " bindingStrs,- " in ",- (term env)])+ Core.TermLet v1 -> (let_ v1) Core.TermList v1 -> let termStrs = (Lists.map term v1) in (Strings.cat [ "[",- Strings.intercalate ", " termStrs,+ (Strings.intercalate ", " termStrs), "]"]) Core.TermLiteral v1 -> (literal v1) Core.TermMap v1 -> let entry = (\p -> Strings.cat [- term (fst p),+ term (Pairs.first p), "=",- (term (snd p))])+ (term (Pairs.second p))]) in (Strings.cat [ "{",- Strings.intercalate ", " (Lists.map entry (Maps.toList v1)),+ (Strings.intercalate ", " (Lists.map entry (Maps.toList v1))), "}"])- Core.TermOptional v1 -> (Optionals.maybe "nothing" (\t -> Strings.cat [+ Core.TermMaybe v1 -> (Maybes.maybe "nothing" (\t -> Strings.cat [ "just(",- term t,+ (term t), ")"]) v1)- Core.TermProduct v1 -> - let termStrs = (Lists.map term v1)- in (Strings.cat [- "(",- Strings.intercalate ", " termStrs,- ")"])+ Core.TermPair v1 -> (Strings.cat [+ "(",+ (term (Pairs.first v1)),+ ", ",+ (term (Pairs.second v1)),+ ")"]) Core.TermRecord v1 -> - let tname = (Core.unName (Core.recordTypeName v1)) - flds = (Core.recordFields v1)- in (Strings.cat [- "record(",- tname,- ")",- (fields flds)])+ let tname = (Core.unName (Core.recordTypeName v1))+ in + let flds = (Core.recordFields v1)+ in (Strings.cat [+ "record(",+ tname,+ ")",+ (fields flds)]) Core.TermSet v1 -> (Strings.cat [ "{",- Strings.intercalate ", " (Lists.map term (Sets.toList v1)),+ (Strings.intercalate ", " (Lists.map term (Sets.toList v1))), "}"])- Core.TermSum v1 -> - let index = (Core.sumIndex v1) - size = (Core.sumSize v1)- t2 = (Core.sumTerm v1)- in (Strings.cat [- "(",- Literals.showInt32 index,- "/",- Literals.showInt32 size,- "=",- term t2,- ")"]) Core.TermTypeLambda v1 -> - let param = (Core.unName (Core.typeLambdaParameter v1)) - body = (Core.typeLambdaBody v1)- in (Strings.cat [- "\923",- param,- ".",- (term body)])+ let param = (Core.unName (Core.typeLambdaParameter v1))+ in + let body = (Core.typeLambdaBody v1)+ in (Strings.cat [+ "\923",+ param,+ ".",+ (term body)]) Core.TermTypeApplication v1 -> - let t2 = (Core.typedTermTerm v1) - typ = (Core.typedTermType v1)- in (Strings.cat [- term t2,- "\10216",- type_ typ,- "\10217"])+ let t2 = (Core.typeApplicationTermBody v1)+ in + let typ = (Core.typeApplicationTermType v1)+ in (Strings.cat [+ term t2,+ "\10216",+ (type_ typ),+ "\10217"]) Core.TermUnion v1 -> (injection v1) Core.TermUnit -> "unit" Core.TermVariable v1 -> (Core.unName v1) Core.TermWrap v1 -> - let tname = (Core.unName (Core.wrappedTermTypeName v1)) - term1 = (Core.wrappedTermObject v1)- in (Strings.cat [- "wrap(",- tname,- "){",- term term1,- "}"])) t)+ let tname = (Core.unName (Core.wrappedTermTypeName v1))+ in + let term1 = (Core.wrappedTermBody v1)+ in (Strings.cat [+ "wrap(",+ tname,+ "){",+ (term term1),+ "}"])) t) -- | Show a type as a string type_ :: (Core.Type -> String) type_ typ = - let showFieldType = (\ft -> - let fname = (Core.unName (Core.fieldTypeName ft)) - ftyp = (Core.fieldTypeType ft)- in (Strings.cat [- fname,- ":",- (type_ ftyp)])) - showRowType = (\rt -> - let flds = (Core.rowTypeFields rt) - fieldStrs = (Lists.map showFieldType flds)- in (Strings.cat [- "{",- Strings.intercalate ", " fieldStrs,- "}"]))- gatherTypes = (\prev -> \app -> - let lhs = (Core.applicationTypeFunction app) - rhs = (Core.applicationTypeArgument app)+ let showRowType = (\rt -> + let flds = (Core.rowTypeFields rt)+ in + let fieldStrs = (Lists.map fieldType flds)+ in (Strings.cat [+ "{",+ (Strings.intercalate ", " fieldStrs),+ "}"]))+ in + let gatherTypes = (\prev -> \app -> + let lhs = (Core.applicationTypeFunction app)+ in + let rhs = (Core.applicationTypeArgument app) in ((\x -> case x of Core.TypeApplication v1 -> (gatherTypes (Lists.cons rhs prev) v1) _ -> (Lists.cons lhs (Lists.cons rhs prev))) lhs))- gatherFunctionTypes = (\prev -> \t -> (\x -> case x of+ in + let gatherFunctionTypes = (\prev -> \t -> (\x -> case x of Core.TypeFunction v1 -> - let dom = (Core.functionTypeDomain v1) - cod = (Core.functionTypeCodomain v1)- in (gatherFunctionTypes (Lists.cons dom prev) cod)+ let dom = (Core.functionTypeDomain v1)+ in + let cod = (Core.functionTypeCodomain v1)+ in (gatherFunctionTypes (Lists.cons dom prev) cod) _ -> (Lists.reverse (Lists.cons t prev))) t)- in ((\x -> case x of- Core.TypeAnnotated v1 -> (type_ (Core.annotatedTypeSubject v1))- Core.TypeApplication v1 -> - let types = (gatherTypes [] v1) - typeStrs = (Lists.map type_ types)- in (Strings.cat [- "(",- Strings.intercalate " @ " typeStrs,- ")"])- Core.TypeForall v1 -> - let var = (Core.unName (Core.forallTypeParameter v1)) - body = (Core.forallTypeBody v1)- in (Strings.cat [- "(\8704",- var,- ".",- type_ body,- ")"])- Core.TypeFunction _ -> - let types = (gatherFunctionTypes [] typ) - typeStrs = (Lists.map type_ types)- in (Strings.cat [- "(",- Strings.intercalate " \8594 " typeStrs,- ")"])- Core.TypeList v1 -> (Strings.cat [- "list<",- type_ v1,- ">"])- Core.TypeLiteral v1 -> (literalType v1)- Core.TypeMap v1 -> - let keyTyp = (Core.mapTypeKeys v1) - valTyp = (Core.mapTypeValues v1)- in (Strings.cat [- "map<",- type_ keyTyp,- ", ",- type_ valTyp,- ">"])- Core.TypeOptional v1 -> (Strings.cat [- "optional<",- type_ v1,- ">"])- Core.TypeProduct v1 -> - let typeStrs = (Lists.map type_ v1)- in (Strings.intercalate "\215" typeStrs)- Core.TypeRecord v1 -> (Strings.cat2 "record" (showRowType v1))- Core.TypeSet v1 -> (Strings.cat [- "set<",- type_ v1,- ">"])- Core.TypeSum v1 -> - let typeStrs = (Lists.map type_ v1)- in (Strings.intercalate "+" typeStrs)- Core.TypeUnion v1 -> (Strings.cat2 "union" (showRowType v1))- Core.TypeUnit -> "unit"- Core.TypeVariable v1 -> (Core.unName v1)- Core.TypeWrap v1 -> - let tname = (Core.unName (Core.wrappedTypeTypeName v1)) - typ1 = (Core.wrappedTypeObject v1)- in (Strings.cat [- "wrap[",- tname,- "](",- type_ typ1,- ")"])) typ)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (type_ (Core.annotatedTypeBody v1))+ Core.TypeApplication v1 -> + let types = (gatherTypes [] v1)+ in + let typeStrs = (Lists.map type_ types)+ in (Strings.cat [+ "(",+ (Strings.intercalate " @ " typeStrs),+ ")"])+ Core.TypeEither v1 -> + let leftTyp = (Core.eitherTypeLeft v1)+ in + let rightTyp = (Core.eitherTypeRight v1)+ in (Strings.cat [+ "either<",+ (type_ leftTyp),+ ", ",+ (type_ rightTyp),+ ">"])+ Core.TypeForall v1 -> + let var = (Core.unName (Core.forallTypeParameter v1))+ in + let body = (Core.forallTypeBody v1)+ in (Strings.cat [+ "(\8704",+ var,+ ".",+ (type_ body),+ ")"])+ Core.TypeFunction _ -> + let types = (gatherFunctionTypes [] typ)+ in + let typeStrs = (Lists.map type_ types)+ in (Strings.cat [+ "(",+ (Strings.intercalate " \8594 " typeStrs),+ ")"])+ Core.TypeList v1 -> (Strings.cat [+ "list<",+ (type_ v1),+ ">"])+ Core.TypeLiteral v1 -> (literalType v1)+ Core.TypeMap v1 -> + let keyTyp = (Core.mapTypeKeys v1)+ in + let valTyp = (Core.mapTypeValues v1)+ in (Strings.cat [+ "map<",+ (type_ keyTyp),+ ", ",+ (type_ valTyp),+ ">"])+ Core.TypeMaybe v1 -> (Strings.cat [+ "maybe<",+ (type_ v1),+ ">"])+ Core.TypePair v1 -> + let firstTyp = (Core.pairTypeFirst v1)+ in + let secondTyp = (Core.pairTypeSecond v1)+ in (Strings.cat [+ "(",+ (type_ firstTyp),+ ", ",+ (type_ secondTyp),+ ")"])+ Core.TypeRecord v1 -> (Strings.cat2 "record" (showRowType v1))+ Core.TypeSet v1 -> (Strings.cat [+ "set<",+ (type_ v1),+ ">"])+ Core.TypeUnion v1 -> (Strings.cat2 "union" (showRowType v1))+ Core.TypeUnit -> "unit"+ Core.TypeVariable v1 -> (Core.unName v1)+ Core.TypeWrap v1 -> + let tname = (Core.unName (Core.wrappedTypeTypeName v1))+ in + let typ1 = (Core.wrappedTypeBody v1)+ in (Strings.cat [+ "wrap[",+ tname,+ "](",+ (type_ typ1),+ ")"])) typ) -- | Show a type scheme as a string typeScheme :: (Core.TypeScheme -> String) typeScheme ts = - let vars = (Core.typeSchemeVariables ts) - body = (Core.typeSchemeType ts)- varNames = (Lists.map Core.unName vars)- fa = (Logic.ifElse (Lists.null vars) "" (Strings.cat [- "\8704[",- Strings.intercalate "," varNames,- "]."]))- in (Strings.cat [- "(",- fa,- type_ body,- ")"])+ let vars = (Core.typeSchemeVariables ts)+ in + let body = (Core.typeSchemeType ts)+ in + let varNames = (Lists.map Core.unName vars)+ in + let fa = (Logic.ifElse (Lists.null vars) "" (Strings.cat [+ "\8704[",+ (Strings.intercalate "," varNames),+ "]."]))+ in (Strings.cat [+ "(",+ fa,+ (type_ body),+ ")"])
src/gen-main/haskell/Hydra/Show/Graph.hs view
@@ -1,13 +1,15 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | String representations of hydra.graph types module Hydra.Show.Graph where import qualified Hydra.Graph as Graph import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Show.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -16,9 +18,9 @@ -- | Show a graph as a string graph :: (Graph.Graph -> String) graph graph = - let elements = (Maps.elems (Graph.graphElements graph)) + let elements = (Graph.graphElements graph) elementStrs = (Lists.map Core.binding elements) in (Strings.cat [ "{",- Strings.intercalate ", " elementStrs,+ (Strings.intercalate ", " elementStrs), "}"])
− src/gen-main/haskell/Hydra/Show/Mantle.hs
@@ -1,52 +0,0 @@--- | String representations of hydra.mantle types--module Hydra.Show.Mantle where--import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---- | Show a term variant as a string-termVariant :: (Mantle.TermVariant -> String)-termVariant x = case x of- Mantle.TermVariantAnnotated -> "annotated"- Mantle.TermVariantApplication -> "application"- Mantle.TermVariantFunction -> "function"- Mantle.TermVariantLet -> "let"- Mantle.TermVariantList -> "list"- Mantle.TermVariantLiteral -> "literal"- Mantle.TermVariantMap -> "map"- Mantle.TermVariantOptional -> "optional"- Mantle.TermVariantProduct -> "product"- Mantle.TermVariantRecord -> "record"- Mantle.TermVariantSet -> "set"- Mantle.TermVariantSum -> "sum"- Mantle.TermVariantTypeLambda -> "typeLambda"- Mantle.TermVariantTypeApplication -> "typeApplication"- Mantle.TermVariantUnion -> "union"- Mantle.TermVariantUnit -> "unit"- Mantle.TermVariantVariable -> "variable"- Mantle.TermVariantWrap -> "wrap"---- | Show a type variant as a string-typeVariant :: (Mantle.TypeVariant -> String)-typeVariant x = case x of- Mantle.TypeVariantAnnotated -> "annotated"- Mantle.TypeVariantApplication -> "application"- Mantle.TypeVariantForall -> "forall"- Mantle.TypeVariantFunction -> "function"- Mantle.TypeVariantList -> "list"- Mantle.TypeVariantLiteral -> "literal"- Mantle.TypeVariantMap -> "map"- Mantle.TypeVariantOptional -> "optional"- Mantle.TypeVariantProduct -> "product"- Mantle.TypeVariantRecord -> "record"- Mantle.TypeVariantSet -> "set"- Mantle.TypeVariantSum -> "sum"- Mantle.TypeVariantUnion -> "union"- Mantle.TypeVariantUnit -> "unit"- Mantle.TypeVariantVariable -> "variable"- Mantle.TypeVariantWrap -> "wrap"
+ src/gen-main/haskell/Hydra/Show/Meta.hs view
@@ -0,0 +1,55 @@+-- Note: this is an automatically generated file. Do not edit.++-- | String representations of hydra.meta types++module Hydra.Show.Meta where++import qualified Hydra.Variants as Variants+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Show a term variant as a string+termVariant :: (Variants.TermVariant -> String)+termVariant x = case x of+ Variants.TermVariantAnnotated -> "annotated"+ Variants.TermVariantApplication -> "application"+ Variants.TermVariantEither -> "either"+ Variants.TermVariantFunction -> "function"+ Variants.TermVariantLet -> "let"+ Variants.TermVariantList -> "list"+ Variants.TermVariantLiteral -> "literal"+ Variants.TermVariantMap -> "map"+ Variants.TermVariantMaybe -> "maybe"+ Variants.TermVariantPair -> "pair"+ Variants.TermVariantRecord -> "record"+ Variants.TermVariantSet -> "set"+ Variants.TermVariantTypeLambda -> "typeLambda"+ Variants.TermVariantTypeApplication -> "typeApplication"+ Variants.TermVariantUnion -> "union"+ Variants.TermVariantUnit -> "unit"+ Variants.TermVariantVariable -> "variable"+ Variants.TermVariantWrap -> "wrap"++-- | Show a type variant as a string+typeVariant :: (Variants.TypeVariant -> String)+typeVariant x = case x of+ Variants.TypeVariantAnnotated -> "annotated"+ Variants.TypeVariantApplication -> "application"+ Variants.TypeVariantEither -> "either"+ Variants.TypeVariantForall -> "forall"+ Variants.TypeVariantFunction -> "function"+ Variants.TypeVariantList -> "list"+ Variants.TypeVariantLiteral -> "literal"+ Variants.TypeVariantMap -> "map"+ Variants.TypeVariantMaybe -> "maybe"+ Variants.TypeVariantPair -> "pair"+ Variants.TypeVariantRecord -> "record"+ Variants.TypeVariantSet -> "set"+ Variants.TypeVariantUnion -> "union"+ Variants.TypeVariantUnit -> "unit"+ Variants.TypeVariantVariable -> "variable"+ Variants.TypeVariantWrap -> "wrap"
src/gen-main/haskell/Hydra/Show/Typing.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | String representations of hydra.typing types module Hydra.Show.Typing where@@ -5,10 +7,12 @@ import qualified Hydra.Core as Core import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Show.Core as Core_ import qualified Hydra.Typing as Typing-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -30,8 +34,8 @@ let subst = (Typing.unTypeSubst ts) pairs = (Maps.toList subst) showPair = (\pair -> - let name = (Core.unName (fst pair)) - typ = (snd pair)+ let name = (Core.unName (Pairs.first pair)) + typ = (Pairs.second pair) in (Strings.cat [ name, "\8614",@@ -39,5 +43,5 @@ pairStrs = (Lists.map showPair pairs) in (Strings.cat [ "{",- Strings.intercalate "," pairStrs,+ (Strings.intercalate "," pairStrs), "}"])
+ src/gen-main/haskell/Hydra/Show/Util.hs view
@@ -0,0 +1,21 @@+-- Note: this is an automatically generated file. Do not edit.++-- | String representations of hydra.util types++module Hydra.Show.Util where++import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Show a case convention as a string+caseConvention :: (Util.CaseConvention -> String)+caseConvention c = ((\x -> case x of+ Util.CaseConventionLowerSnake -> "lower_snake_case"+ Util.CaseConventionUpperSnake -> "UPPER_SNAKE_CASE"+ Util.CaseConventionCamel -> "camelCase"+ Util.CaseConventionPascal -> "PascalCase") c)
src/gen-main/haskell/Hydra/Sorting.hs view
@@ -1,56 +1,94 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for sorting. module Hydra.Sorting where +import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals-import qualified Hydra.Mantle as Mantle+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Tarjan as Tarjan import qualified Hydra.Topology as Topology-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -createOrderingIsomorphism :: (Ord t0) => ([t0] -> [t0] -> Topology.OrderingIsomorphism t1)+-- | Convert an adjacency list to a map, concatenating values for duplicate keys+adjacencyListToMap :: Ord t0 => ([(t0, [t1])] -> M.Map t0 [t1])+adjacencyListToMap pairs = (Lists.foldl (\mp -> \p -> + let k = (Pairs.first p)+ in + let vs = (Pairs.second p)+ in + let existing = (Maybes.maybe [] Equality.identity (Maps.lookup k mp))+ in (Maps.insert k (Lists.concat2 existing vs) mp)) Maps.empty pairs)++createOrderingIsomorphism :: Ord t0 => ([t0] -> [t0] -> Topology.OrderingIsomorphism t1) createOrderingIsomorphism sourceOrd targetOrd = let sourceToTargetMapping = (\els -> let mp = (Maps.fromList (Lists.zip sourceOrd els))- in (Optionals.cat (Lists.map (\n -> Maps.lookup n mp) targetOrd)))+ in (Maybes.cat (Lists.map (\n -> Maps.lookup n mp) targetOrd))) in let targetToSourceMapping = (\els -> let mp = (Maps.fromList (Lists.zip targetOrd els))- in (Optionals.cat (Lists.map (\n -> Maps.lookup n mp) sourceOrd)))+ in (Maybes.cat (Lists.map (\n -> Maps.lookup n mp) sourceOrd))) in Topology.OrderingIsomorphism { Topology.orderingIsomorphismEncode = sourceToTargetMapping, Topology.orderingIsomorphismDecode = targetToSourceMapping} -topologicalSort :: (Ord t0) => ([(t0, [t0])] -> Mantle.Either [[t0]] [t0])+-- | Given an adjacency function and a distinguished root node, find all reachable nodes (including the root node)+findReachableNodes :: Ord t0 => ((t0 -> S.Set t0) -> t0 -> S.Set t0)+findReachableNodes adj root = + let visit = (\visited -> \node -> + let toVisit = (Sets.difference (adj node) visited)+ in (Logic.ifElse (Sets.null toVisit) visited (Lists.foldl (\v -> \n -> visit (Sets.insert n v) n) visited (Sets.toList toVisit))))+ in (visit (Sets.singleton root) root)++-- | 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.+propagateTags :: (Ord t0, Ord t1) => ([(t0, [t0])] -> [(t0, [t1])] -> [(t0, (S.Set t1))])+propagateTags edges nodeTags = + let adjMap = (adjacencyListToMap edges)+ in + let tagMap = (Maps.map Sets.fromList (adjacencyListToMap nodeTags))+ in + let allNodes = (Sets.toList (Sets.fromList (Lists.concat2 (Lists.map Pairs.first edges) (Lists.map Pairs.first nodeTags))))+ in + let getTagsForNode = (\node -> + let reachable = (findReachableNodes (\n -> Sets.fromList (Maybes.maybe [] Equality.identity (Maps.lookup n adjMap))) node)+ in (Sets.unions (Lists.map (\n -> Maybes.maybe Sets.empty Equality.identity (Maps.lookup n tagMap)) (Sets.toList reachable))))+ in (Lists.map (\n -> (n, (getTagsForNode n))) allNodes)++-- | 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.+topologicalSort :: Ord t0 => ([(t0, [t0])] -> Either [[t0]] [t0]) topologicalSort pairs = let sccs = (topologicalSortComponents pairs) in let isCycle = (\scc -> Logic.not (Lists.null (Lists.tail scc))) in let withCycles = (Lists.filter isCycle sccs)- in (Logic.ifElse (Lists.null withCycles) (Mantle.EitherRight (Lists.concat sccs)) (Mantle.EitherLeft withCycles))+ in (Logic.ifElse (Lists.null withCycles) (Right (Lists.concat sccs)) (Left withCycles)) -topologicalSortComponents :: (Ord t0) => ([(t0, [t0])] -> [[t0]])+-- | Find the strongly connected components (including cycles and isolated vertices) of a graph, in (reverse) topological order, i.e. dependencies before dependents+topologicalSortComponents :: Ord t0 => ([(t0, [t0])] -> [[t0]]) topologicalSortComponents pairs = let graphResult = (Tarjan.adjacencyListsToGraph pairs) in - let g = (fst graphResult)- in - let getKey = (snd graphResult)- in (Lists.map (\comp -> Lists.map getKey comp) (Tarjan.stronglyConnectedComponents g))+ let g = (Pairs.first graphResult)+ in (Lists.map (\comp -> Lists.map (Pairs.second graphResult) comp) (Tarjan.stronglyConnectedComponents g)) -topologicalSortNodes :: (Ord t1) => ((t0 -> t1) -> (t0 -> [t1]) -> [t0] -> [[t0]])+-- | 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.+topologicalSortNodes :: Ord t1 => ((t0 -> t1) -> (t0 -> [t1]) -> [t0] -> [[t0]]) topologicalSortNodes getKey getAdj nodes = let nodesByKey = (Maps.fromList (Lists.map (\n -> (getKey n, n)) nodes)) in let pairs = (Lists.map (\n -> (getKey n, (getAdj n))) nodes) in let comps = (topologicalSortComponents pairs)- in (Lists.map (\c -> Optionals.cat (Lists.map (\k -> Maps.lookup k nodesByKey) c)) comps)+ in (Lists.map (\c -> Maybes.cat (Lists.map (\k -> Maps.lookup k nodesByKey) c)) comps)
+ src/gen-main/haskell/Hydra/Sources/Decode/Accessors.hs view
@@ -0,0 +1,1352 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.accessors++module Hydra.Sources.Decode.Accessors where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.accessors"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.accessors.accessorEdge"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.accessors.AccessorEdge"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "source"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.accessorNode"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_source"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.accessorPath"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_path"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "target"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.accessorNode"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_target"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorEdge"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "source"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_source"))},+ Core.Field {+ Core.fieldName = (Core.Name "path"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_path"))},+ Core.Field {+ Core.fieldName = (Core.Name "target"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_target"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.accessors.AccessorEdge"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.accessors.accessorGraph"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.accessors.AccessorGraph"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "nodes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.accessorNode"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_nodes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "edges"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.accessorEdge"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_edges"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorGraph"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "nodes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_nodes"))},+ Core.Field {+ Core.fieldName = (Core.Name "edges"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_edges"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.accessors.AccessorGraph"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.accessors.accessorNode"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.accessors.AccessorNode"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "label"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_label"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "id"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_id"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.accessors.AccessorNode"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "label"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_label"))},+ Core.Field {+ Core.fieldName = (Core.Name "id"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_id"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.accessors.AccessorNode"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.accessors.accessorPath"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.accessors.AccessorPath"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.accessors.AccessorPath"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.accessors.termAccessor"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.accessors.AccessorPath"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.accessors.termAccessor"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.accessors.TermAccessor"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotatedBody"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotatedBody"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applicationFunction"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applicationFunction"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applicationArgument"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applicationArgument"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambdaBody"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambdaBody"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unionCasesDefault"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unionCasesDefault"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unionCasesBranch"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unionCasesBranch"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "letBody"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "letBody"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "letBinding"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "letBinding"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "listElement"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "listElement"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "mapKey"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "mapKey"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "mapValue"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "mapValue"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybeTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybeTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "productTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "productTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "recordField"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "recordField"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "setElement"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "setElement"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sumTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sumTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambdaBody"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeLambdaBody"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplicationTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeApplicationTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "injectionTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "injectionTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrappedTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrappedTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.accessors.TermAccessor"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.accessors",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.accessors")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Ast.hs view
@@ -0,0 +1,2117 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.ast++module Hydra.Sources.Decode.Ast where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.ast"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.associativity"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.ast.Associativity"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "none"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "both"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "both"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Associativity"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.blockStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.BlockStyle"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "indent"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_indent"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "newlineBeforeContent"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_newlineBeforeContent"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "newlineAfterContent"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_newlineAfterContent"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.BlockStyle"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "indent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_indent"))},+ Core.Field {+ Core.fieldName = (Core.Name "newlineBeforeContent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_newlineBeforeContent"))},+ Core.Field {+ Core.fieldName = (Core.Name "newlineAfterContent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_newlineAfterContent"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.BlockStyle"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.bracketExpr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.BracketExpr"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "brackets"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.brackets"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_brackets"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "enclosed"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_enclosed"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "style"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.blockStyle"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_style"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.BracketExpr"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "brackets"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_brackets"))},+ Core.Field {+ Core.fieldName = (Core.Name "enclosed"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_enclosed"))},+ Core.Field {+ Core.fieldName = (Core.Name "style"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_style"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.BracketExpr"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.brackets"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.Brackets"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "open"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_open"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "close"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_close"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Brackets"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "open"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_open"))},+ Core.Field {+ Core.fieldName = (Core.Name "close"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_close"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Brackets"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.expr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.ast.Expr"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "const"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "const"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.ast.symbol")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "indent"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "indent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.ast.indentedExpression")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "op"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "op"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.ast.opExpr")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "brackets"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Expr"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "brackets"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.ast.bracketExpr")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Expr"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.indentedExpression"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.IndentedExpression"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "style"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.indentStyle"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_style"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expr"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.IndentedExpression"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "style"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_style"))},+ Core.Field {+ Core.fieldName = (Core.Name "expr"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expr"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.IndentedExpression"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.indentStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.ast.IndentStyle"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "allLines"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.IndentStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "allLines"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "subsequentLines"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.IndentStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "subsequentLines"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.IndentStyle"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.op"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.Op"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_symbol"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "padding"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.padding"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_padding"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "precedence"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.precedence"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_precedence"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "associativity"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.associativity"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_associativity"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Op"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "symbol"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_symbol"))},+ Core.Field {+ Core.fieldName = (Core.Name "padding"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_padding"))},+ Core.Field {+ Core.fieldName = (Core.Name "precedence"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_precedence"))},+ Core.Field {+ Core.fieldName = (Core.Name "associativity"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_associativity"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Op"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.opExpr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.OpExpr"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "op"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.op"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_op"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "lhs"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_lhs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "rhs"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_rhs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.OpExpr"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "op"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_op"))},+ Core.Field {+ Core.fieldName = (Core.Name "lhs"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_lhs"))},+ Core.Field {+ Core.fieldName = (Core.Name "rhs"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_rhs"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.OpExpr"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.padding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.ast.Padding"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.ws"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.ws"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.ast.Padding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Padding"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.precedence"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.ast.Precedence"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.ast.Precedence"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Precedence"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.symbol"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.ast.Symbol"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.ast.Symbol"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Symbol"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.ast.ws"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.ast.Ws"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "none"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "space"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "space"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "break"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "break"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "breakAndIndent"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "breakAndIndent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "doubleBreak"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.ast.Ws"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "doubleBreak"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.ast.Ws"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.ast",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.ast")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Classes.hs view
@@ -0,0 +1,187 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.classes++module Hydra.Sources.Decode.Classes where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.classes"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.classes.typeClass"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.classes.TypeClass"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equality"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equality"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "ordering"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.classes.TypeClass"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ordering"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.classes.TypeClass"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.classes",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.classes")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Coders.hs view
@@ -0,0 +1,466 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.coders++module Hydra.Sources.Decode.Coders where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.coders"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.coders.coderDirection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.coders.CoderDirection"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "encode"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "decode"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.coders.CoderDirection"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.coders.languageName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.coders.LanguageName"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.coders.LanguageName"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.coders.LanguageName"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.coders.traversalOrder"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.coders.TraversalOrder"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pre"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.TraversalOrder"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pre"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "post"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.coders.TraversalOrder"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "post"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.coders.TraversalOrder"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.graph"),+ (Module.Namespace "hydra.decode.compute"),+ (Module.Namespace "hydra.decode.variants")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.coders",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.coders")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Compute.hs view
@@ -0,0 +1,394 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.compute++module Hydra.Sources.Decode.Compute where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.compute"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.compute.flowState"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.compute.FlowState"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "value"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_value"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "state"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_state"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "trace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.compute.trace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_trace"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_value"))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_state"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_trace"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "s",+ (Core.Name "v")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "s"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.FlowState")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s"))}))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.compute.trace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.compute.Trace"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "stack"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_stack"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "messages"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_messages"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "other"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_other"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_stack"))},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_messages"))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_other"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.compute.Trace"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.compute",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.compute")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Constraints.hs view
@@ -0,0 +1,221 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.constraints++module Hydra.Sources.Decode.Constraints where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.constraints"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.constraints.pathEquation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.constraints.PathEquation"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.constraints.PathEquation"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.constraints.PathEquation"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.constraints.patternImplication"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.constraints.PatternImplication"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "antecedent"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_antecedent"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "consequent"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_consequent"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.constraints.PatternImplication"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "antecedent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_antecedent"))},+ Core.Field {+ Core.fieldName = (Core.Name "consequent"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_consequent"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.constraints.PatternImplication"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.query")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.constraints",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.constraints")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Core.hs view
@@ -0,0 +1,6219 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.core++module Hydra.Sources.Decode.Core where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.core"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.annotatedTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.AnnotatedTerm"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "annotation"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_annotation"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_annotation"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.AnnotatedTerm"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.annotatedType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.AnnotatedType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "annotation"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_annotation"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_annotation"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.AnnotatedType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.application"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Application"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "function"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_function"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "argument"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_argument"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Application"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_function"))},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_argument"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Application"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.applicationType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.ApplicationType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "function"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_function"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "argument"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_argument"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.ApplicationType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_function"))},+ Core.Field {+ Core.fieldName = (Core.Name "argument"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_argument"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.ApplicationType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.binding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Binding"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Binding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Binding"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.caseStatement"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.CaseStatement"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "default"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_default"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "cases"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.field"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_cases"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.CaseStatement"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "default"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_default"))},+ Core.Field {+ Core.fieldName = (Core.Name "cases"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_cases"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.CaseStatement"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.eitherType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.EitherType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.EitherType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.EitherType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.pairType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.PairType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "first"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_first"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "second"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_second"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.PairType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_first"))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_second"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.PairType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.elimination"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.Elimination"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Elimination"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.projection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Elimination"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.caseStatement")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Elimination"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Elimination"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.field"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Field"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Field"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.fieldType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.FieldType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.FieldType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.FieldType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.floatType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.FloatType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigfloat"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.FloatType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.floatValue"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.FloatValue"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigfloat"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigfloat literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigfloat value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected float32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected float32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected float64 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected float64 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.FloatValue"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.forallType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.ForallType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "parameter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_parameter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.ForallType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_parameter"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.ForallType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.function"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.Function"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "elimination"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Function"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "elimination"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.elimination")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambda"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Function"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.lambda")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primitive"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Function"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Function"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.functionType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.FunctionType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "domain"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_domain"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "codomain"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_codomain"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.FunctionType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_domain"))},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_codomain"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.FunctionType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.injection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Injection"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "field"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.field"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_field"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_field"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Injection"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.integerType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.IntegerType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigint"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int8"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int16"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint8"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint16"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.IntegerType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.integerValue"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.IntegerValue"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigint"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigint literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigint value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int8"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int8 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int8 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int16"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int16 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int16 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int64 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int64 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint8"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint8 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint8 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint16"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint16 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint16 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint64 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected uint64 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.IntegerValue"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.lambda"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Lambda"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "parameter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_parameter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "domain"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_domain"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Lambda"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_parameter"))},+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_domain"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Lambda"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.let"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Let"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bindings"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.binding"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_bindings"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Let"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_bindings"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Let"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.literal"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.Literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected binary literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.floatValue")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.integerValue")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Literal"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.literalType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.LiteralType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.floatType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.integerType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.LiteralType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.mapType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.MapType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "keys"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_keys"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "values"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_values"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.MapType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "keys"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_keys"))},+ Core.Field {+ Core.fieldName = (Core.Name "values"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_values"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.MapType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.name"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.core.Name"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Name"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.projection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Projection"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "field"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_field"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Projection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_field"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Projection"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.record"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.Record"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "fields"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.field"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_fields"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_fields"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Record"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.rowType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.RowType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "fields"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.fieldType"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_fields"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.RowType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_fields"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.RowType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.term"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.Term"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.annotatedTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.application")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.function")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "let"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.let")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.literal")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.record")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplication"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.typeApplicationTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambda"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeLambda"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.typeLambda")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.injection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.wrappedTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Term"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.type"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.core.Type"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.annotatedType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.applicationType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.eitherType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "forall"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.forallType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.functionType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.literalType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.mapType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.pairType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.rowType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.rowType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Type"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.wrappedType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Type"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.typeApplicationTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.TypeApplicationTerm"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeApplicationTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.TypeApplicationTerm"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.typeLambda"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.TypeLambda"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "parameter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_parameter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeLambda"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "parameter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_parameter"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.TypeLambda"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.typeScheme"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.TypeScheme"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "variables"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_variables"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "constraints"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeVariableMetadata"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_constraints"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeScheme"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "variables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_variables"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "constraints"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_constraints"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.TypeScheme"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.typeVariableMetadata"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.TypeVariableMetadata"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "classes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_classes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.TypeVariableMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "classes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_classes"))}]}))))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.TypeVariableMetadata"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.wrappedTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.WrappedTerm"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.WrappedTerm"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.core.wrappedType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.core.WrappedType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.WrappedType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.core",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.core")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Grammar.hs view
@@ -0,0 +1,1109 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.grammar++module Hydra.Sources.Decode.Grammar where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.grammar"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.constant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.grammar.Constant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Constant"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Constant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.grammar"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.grammar.Grammar"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Grammar"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.production"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Grammar"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.label"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.grammar.Label"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Label"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Label"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.labeledPattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.grammar.LabeledPattern"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "label"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.label"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_label"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_pattern"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.grammar.LabeledPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "label"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_label"))},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_pattern"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.LabeledPattern"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.pattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.grammar.Pattern"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "alternatives"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "constant"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "constant"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.constant")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "ignored"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ignored"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "labeled"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "labeled"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.labeledPattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nil"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nil"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nonterminal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nonterminal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.symbol")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "option"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "option"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "plus"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "plus"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "regex"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.regex")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sequence"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sequence"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "star"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "star"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Pattern"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.production"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.grammar.Production"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.symbol"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_symbol"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_pattern"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.grammar.Production"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "symbol"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_symbol"))},+ Core.Field {+ Core.fieldName = (Core.Name "pattern"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_pattern"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Production"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.regex"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.grammar.Regex"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Regex"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Regex"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.grammar.symbol"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.grammar.Symbol"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.grammar.Symbol"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.grammar.Symbol"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.grammar",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.grammar")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Json/Model.hs view
@@ -0,0 +1,485 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.json.model++module Hydra.Sources.Decode.Json.Model where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.json.model"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.json.model.value"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.json.model.Value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "array"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "array"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "null"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "null"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "number"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "number"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigfloat literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected bigfloat value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "f"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "object"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.json.model.Value"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.json.model.Value"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.json.model",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.json.model")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Module.hs view
@@ -0,0 +1,1106 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.module++module Hydra.Sources.Decode.Module where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.module"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.definition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.module.Definition"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.module.Definition"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.module.termDefinition")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.module.Definition"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.module.typeDefinition")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.Definition"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.fileExtension"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.module.FileExtension"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.module.FileExtension"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.FileExtension"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.module"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.module.Module"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_namespace"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "elements"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.binding"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_elements"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "termDependencies"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_termDependencies"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeDependencies"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeDependencies"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "description"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_description"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.Module"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "namespace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_namespace"))},+ Core.Field {+ Core.fieldName = (Core.Name "elements"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_elements"))},+ Core.Field {+ Core.fieldName = (Core.Name "termDependencies"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_termDependencies"))},+ Core.Field {+ Core.fieldName = (Core.Name "typeDependencies"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeDependencies"))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_description"))}]}))))})))}))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.Module"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.namespace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.module.Namespace"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.module.Namespace"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.Namespace"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.namespaces"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.module.Namespaces"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "focus"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_focus"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "mapping"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_mapping"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.Namespaces"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "focus"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_focus"))},+ Core.Field {+ Core.fieldName = (Core.Name "mapping"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_mapping"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "n"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "n"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.module.Namespaces")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "n"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.qualifiedName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.module.QualifiedName"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "namespace"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.namespace"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_namespace"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "local"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_local"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.QualifiedName"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "namespace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_namespace"))},+ Core.Field {+ Core.fieldName = (Core.Name "local"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_local"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.QualifiedName"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.termDefinition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.module.TermDefinition"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.TermDefinition"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.module.typeDefinition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.module.TypeDefinition"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.module.TypeDefinition"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.module.TypeDefinition"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.graph")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.module",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.module")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Parsing.hs view
@@ -0,0 +1,559 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.parsing++module Hydra.Sources.Decode.Parsing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.parsing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.parsing.parseError"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.parsing.ParseError"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "message"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_message"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "remainder"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_remainder"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.parsing.ParseError"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "message"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_message"))},+ Core.Field {+ Core.fieldName = (Core.Name "remainder"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_remainder"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.parsing.ParseError"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.parsing.parseResult"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.parsing.ParseResult"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "success"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.parsing.ParseResult"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.parsing.parseSuccess")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "failure"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.parsing.ParseResult"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "failure"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.parsing.parseError")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.parsing.ParseResult")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.parsing.parseSuccess"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.parsing.ParseSuccess"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_value"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "remainder"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_remainder"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.parsing.ParseSuccess"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_value"))},+ Core.Field {+ Core.fieldName = (Core.Name "remainder"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_remainder"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.parsing.ParseSuccess")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.parsing",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.parsing")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Phantoms.hs view
@@ -0,0 +1,221 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.phantoms++module Hydra.Sources.Decode.Phantoms where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.phantoms"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.phantoms.tBinding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.phantoms.TBinding"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.phantoms.tTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.phantoms.TBinding"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.phantoms.TBinding")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.phantoms.tTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.phantoms.TTerm"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.phantoms.TTerm"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.term")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.phantoms.TTerm")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.phantoms",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.phantoms")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Query.hs view
@@ -0,0 +1,2272 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.query++module Hydra.Sources.Decode.Query where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.query"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.comparisonConstraint"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.ComparisonConstraint"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "notEqual"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "notEqual"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThan"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThan"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThanOrEqual"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThanOrEqual"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThanOrEqual"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThanOrEqual"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.ComparisonConstraint"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.edge"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.Edge"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "out"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_out"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "in"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_in"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Edge"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "out"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_out"))},+ Core.Field {+ Core.fieldName = (Core.Name "in"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_in"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Edge"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.graphPattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.GraphPattern"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "graph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_graph"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "patterns"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_patterns"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.GraphPattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "graph"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_graph"))},+ Core.Field {+ Core.fieldName = (Core.Name "patterns"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_patterns"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.GraphPattern"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.node"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.Node"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.term")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.variable")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wildcard"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Node"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wildcard"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Node"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.path"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.Path"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "step"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "step"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.step")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "regex"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.regexSequence")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inverse"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Path"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inverse"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.path")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Path"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.pattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.Pattern"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "triple"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "triple"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.triplePattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "negation"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "negation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "conjunction"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "conjunction"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "disjunction"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "disjunction"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "graph"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Pattern"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "graph"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.graphPattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Pattern"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.query"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.Query"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "variables"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.variable"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_variables"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "patterns"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.pattern"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_patterns"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Query"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "variables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_variables"))},+ Core.Field {+ Core.fieldName = (Core.Name "patterns"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_patterns"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Query"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.range"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.Range"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "min"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_min"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "max"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_max"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.Range"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "min"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_min"))},+ Core.Field {+ Core.fieldName = (Core.Name "max"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_max"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Range"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.regexQuantifier"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.RegexQuantifier"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "one"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "zeroOrOne"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "zeroOrOne"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "zeroOrMore"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "zeroOrMore"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "oneOrMore"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "oneOrMore"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "exactly"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "exactly"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "atLeast"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "atLeast"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "range"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "range"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.range")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.RegexQuantifier"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.regexSequence"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.RegexSequence"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_path"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "quantifier"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.regexQuantifier"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_quantifier"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.RegexSequence"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "path"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_path"))},+ Core.Field {+ Core.fieldName = (Core.Name "quantifier"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_quantifier"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.RegexSequence"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.step"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.query.Step"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "edge"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "edge"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.edge")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "project"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "project"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.core.projection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "compare"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.query.Step"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "compare"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.query.comparisonConstraint")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Step"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.triplePattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.query.TriplePattern"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "subject"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.node"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_subject"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "predicate"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.path"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_predicate"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "object"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.query.node"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_object"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.query.TriplePattern"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "subject"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_subject"))},+ Core.Field {+ Core.fieldName = (Core.Name "predicate"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_predicate"))},+ Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_object"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.TriplePattern"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.query.variable"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.query.Variable"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.query.Variable"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.query.Variable"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.query",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.query")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Relational.hs view
@@ -0,0 +1,953 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.relational++module Hydra.Sources.Decode.Relational where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.relational"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.columnName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.ColumnName"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.ColumnName"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.relational.ColumnName"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.columnSchema"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.relational.ColumnSchema"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "domain"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_domain"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.ColumnSchema"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "domain"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_domain"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.relational.ColumnSchema")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.foreignKey"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.relational.ForeignKey"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foreignRelation"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.relationName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_foreignRelation"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "keys"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_keys"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.ForeignKey"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "foreignRelation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_foreignRelation"))},+ Core.Field {+ Core.fieldName = (Core.Name "keys"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_keys"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.relational.ForeignKey"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.primaryKey"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.PrimaryKey"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.PrimaryKey"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.relational.PrimaryKey"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.relation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.Relation"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Relation"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.relational.row")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "v"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.relational.Relation")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.relationName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.RelationName"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.RelationName"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.relational.RelationName"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.relationSchema"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.relational.RelationSchema"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.relationName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "columns"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.relational.columnSchema")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_columns"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "primaryKeys"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.primaryKey"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_primaryKeys"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foreignKeys"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.foreignKey"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_foreignKeys"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "columns"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_columns"))},+ Core.Field {+ Core.fieldName = (Core.Name "primaryKeys"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_primaryKeys"))},+ Core.Field {+ Core.fieldName = (Core.Name "foreignKeys"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_foreignKeys"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.relational.RelationSchema")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.relationship"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.Relationship"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Relationship"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "v"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.relational.Relationship")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))})),+ Core.typeSchemeConstraints = (Just (M.fromList [+ (Core.Name "v", Core.TypeVariableMetadata {+ Core.typeVariableMetadataClasses = (S.fromList [+ Core.Name "ordering"])})]))}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.relational.row"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.relational.Row"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.relational.Row"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "v"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.relational.Row")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.relational",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.relational")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Tabular.hs view
@@ -0,0 +1,543 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.tabular++module Hydra.Sources.Decode.Tabular where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.tabular"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.tabular.columnType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.tabular.ColumnType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.ColumnType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.tabular.ColumnType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.tabular.dataRow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.tabular.DataRow"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.tabular.DataRow"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "v"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.tabular.DataRow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.tabular.headerRow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.tabular.HeaderRow"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.tabular.HeaderRow"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.tabular.HeaderRow"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.tabular.table"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.tabular.Table"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "header"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.tabular.headerRow"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_header"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "data"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.tabular.dataRow")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_data"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.Table"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "header"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_header"))},+ Core.Field {+ Core.fieldName = (Core.Name "data"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_data"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "v"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "v"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.tabular.Table")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.tabular.tableType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.tabular.TableType"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.relational.relationName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "columns"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.tabular.columnType"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_columns"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.tabular.TableType"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "columns"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_columns"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.tabular.TableType"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.relational")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.tabular",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.tabular")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Testing.hs view
@@ -0,0 +1,7425 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.testing++module Hydra.Sources.Decode.Testing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.testing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.alphaConversionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.AlphaConversionTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "oldVariable"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_oldVariable"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "newVariable"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_newVariable"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "result"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_result"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "oldVariable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_oldVariable"))},+ Core.Field {+ Core.fieldName = (Core.Name "newVariable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_newVariable"))},+ Core.Field {+ Core.fieldName = (Core.Name "result"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_result"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.AlphaConversionTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.evaluationStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.EvaluationStyle"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "eager"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.EvaluationStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "eager"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lazy"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.EvaluationStyle"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lazy"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.EvaluationStyle"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.caseConversionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.CaseConversionTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "fromConvention"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.util.caseConvention"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_fromConvention"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "toConvention"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.util.caseConvention"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_toConvention"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "fromString"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_fromString"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "toString"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_toString"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "fromConvention"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_fromConvention"))},+ Core.Field {+ Core.fieldName = (Core.Name "toConvention"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_toConvention"))},+ Core.Field {+ Core.fieldName = (Core.Name "fromString"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_fromString"))},+ Core.Field {+ Core.fieldName = (Core.Name "toString"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_toString"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.CaseConversionTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.delegatedEvaluationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.DelegatedEvaluationTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DelegatedEvaluationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.DelegatedEvaluationTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.etaExpansionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.EtaExpansionTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.EtaExpansionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.EtaExpansionTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.deannotateTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.DeannotateTermTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DeannotateTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.DeannotateTermTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.deannotateTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.DeannotateTypeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.DeannotateTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.DeannotateTypeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.flattenLetTermsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.FlattenLetTermsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FlattenLetTermsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.FlattenLetTermsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.foldOperation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.FoldOperation"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sumInt32Literals"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "sumInt32Literals"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "collectListLengths"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "collectListLengths"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "collectLabels"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "collectLabels"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.FoldOperation"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.foldOverTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.FoldOverTermTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "traversalOrder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.coders.traversalOrder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_traversalOrder"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "operation"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.foldOperation"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_operation"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "traversalOrder"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_traversalOrder"))},+ Core.Field {+ Core.fieldName = (Core.Name "operation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_operation"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.FoldOverTermTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.freeVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.FreeVariablesTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.FreeVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.FreeVariablesTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.hoistPredicate"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.HoistPredicate"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "caseStatements"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "caseStatements"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applications"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "applications"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lists"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lists"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nothing"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.HoistPredicate"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.hoistLetBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.HoistLetBindingsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.let"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.let"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistLetBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.HoistLetBindingsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.hoistPolymorphicLetBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.HoistPolymorphicLetBindingsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.let"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.let"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.hoistSubtermsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.HoistSubtermsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "predicate"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.hoistPredicate"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_predicate"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistSubtermsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "predicate"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_predicate"))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.HoistSubtermsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.hoistCaseStatementsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.HoistCaseStatementsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.HoistCaseStatementsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.HoistCaseStatementsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.termRewriter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.TermRewriter"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceFooWithBar"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TermRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceFooWithBar"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceInt32WithInt64"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TermRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceInt32WithInt64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TermRewriter"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.rewriteTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.RewriteTermTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "rewriter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.termRewriter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_rewriter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.RewriteTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_rewriter"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.RewriteTermTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.typeRewriter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.TypeRewriter"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceStringWithInt32"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TypeRewriter"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "replaceStringWithInt32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TypeRewriter"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.rewriteTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.RewriteTypeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "rewriter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.typeRewriter"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_rewriter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.RewriteTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_rewriter"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.RewriteTypeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.evaluationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.EvaluationTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "evaluationStyle"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.evaluationStyle"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_evaluationStyle"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.EvaluationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "evaluationStyle"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_evaluationStyle"))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.EvaluationTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.inferenceFailureTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.InferenceFailureTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.InferenceFailureTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))}]}))))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.InferenceFailureTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.inferenceTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.InferenceTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.InferenceTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.InferenceTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonCoderTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.JsonCoderTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "json"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_json"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonCoderTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "json"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_json"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.JsonCoderTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonDecodeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.JsonDecodeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "json"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_json"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonDecodeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "json"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_json"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.JsonDecodeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonEncodeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.JsonEncodeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonEncodeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.JsonEncodeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonParserTestCase"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.parserTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.testing.ParserTestCase")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.json.model.Value"))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonRoundtripTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.JsonRoundtripTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JsonRoundtripTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.JsonRoundtripTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.liftLambdaAboveLetTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.LiftLambdaAboveLetTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.jsonWriterTestCase"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.writerTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.json.model.value"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.testing.WriterTestCase")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "hydra.json.model.Value"))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.parserTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.ParserTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.parsing.parseResult")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.ParserTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.testing.ParserTestCase")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.tag"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.testing.Tag"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.testing.Tag"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.Tag"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.testCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.testing.TestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "alphaConversion"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "alphaConversion"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.alphaConversionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "caseConversion"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "caseConversion"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.caseConversionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "deannotateTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "deannotateTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.deannotateTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "deannotateType"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "deannotateType"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.deannotateTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "delegatedEvaluation"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "delegatedEvaluation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.delegatedEvaluationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "etaExpansion"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "etaExpansion"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.etaExpansionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "flattenLetTerms"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "flattenLetTerms"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.flattenLetTermsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "freeVariables"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "freeVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.freeVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "evaluation"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "evaluation"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.evaluationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inference"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inference"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.inferenceTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inferenceFailure"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "inferenceFailure"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.inferenceFailureTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonCoder"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonCoder"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonCoderTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonDecode"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonDecode"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonDecodeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonEncode"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonEncode"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonEncodeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonParser"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonParser"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonParserTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonRoundtrip"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonRoundtrip"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonRoundtripTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonWriter"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "jsonWriter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.jsonWriterTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "liftLambdaAboveLet"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "liftLambdaAboveLet"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.liftLambdaAboveLetTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "serialization"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "serialization"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.serializationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "simplifyTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "simplifyTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.simplifyTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSort"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSort"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.topologicalSortTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSortBindings"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSortBindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.topologicalSortBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSortSCC"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "topologicalSortSCC"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.topologicalSortSCCTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeChecking"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeChecking"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.typeCheckingTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeCheckingFailure"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeCheckingFailure"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.typeCheckingFailureTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeReduction"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeReduction"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.typeReductionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "normalizeTypeVariables"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "normalizeTypeVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.normalizeTypeVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foldOverTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "foldOverTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.foldOverTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriteTerm"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "rewriteTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.rewriteTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriteType"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "rewriteType"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.rewriteTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistSubterms"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistSubterms"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.hoistSubtermsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistCaseStatements"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistCaseStatements"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.hoistCaseStatementsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistLetBindings"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistLetBindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.hoistLetBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistPolymorphicLetBindings"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hoistPolymorphicLetBindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.hoistPolymorphicLetBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "substInType"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "substInType"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.substInTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variableOccursInType"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variableOccursInType"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.variableOccursInTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unifyTypes"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unifyTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.unifyTypesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "joinTypes"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "joinTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.joinTypesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unshadowVariables"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unshadowVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.testing.unshadowVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.testCaseWithMetadata"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TestCaseWithMetadata"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "case"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.testCase"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_case"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "description"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_description"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "tags"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.tag"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_tags"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "case"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_case"))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_description"))},+ Core.Field {+ Core.fieldName = (Core.Name "tags"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_tags"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TestCaseWithMetadata"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.testGroup"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TestGroup"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "description"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_description"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "subgroups"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.testGroup"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_subgroups"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "cases"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.testing.testCaseWithMetadata"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_cases"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "description"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_description"))},+ Core.Field {+ Core.fieldName = (Core.Name "subgroups"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_subgroups"))},+ Core.Field {+ Core.fieldName = (Core.Name "cases"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_cases"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TestGroup"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.typeCheckingTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TypeCheckingTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "outputTerm"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_outputTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "outputType"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_outputType"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeCheckingTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "outputTerm"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_outputTerm"))},+ Core.Field {+ Core.fieldName = (Core.Name "outputType"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_outputType"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TypeCheckingTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.typeCheckingFailureTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TypeCheckingFailureTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeCheckingFailureTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))}]}))))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TypeCheckingFailureTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.topologicalSortBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TopologicalSortBindingsTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bindings"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_bindings"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortBindingsTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_bindings"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TopologicalSortBindingsTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.topologicalSortTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TopologicalSortTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "adjacencyList"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_adjacencyList"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "adjacencyList"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_adjacencyList"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TopologicalSortTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.topologicalSortSCCTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TopologicalSortSCCTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "adjacencyList"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_adjacencyList"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TopologicalSortSCCTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "adjacencyList"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_adjacencyList"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TopologicalSortSCCTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.serializationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.SerializationTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.ast.expr"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SerializationTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.SerializationTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.simplifyTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.SimplifyTermTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SimplifyTermTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.SimplifyTermTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.normalizeTypeVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.NormalizeTypeVariablesTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.typeReductionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.TypeReductionTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.TypeReductionTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.TypeReductionTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.writerTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.WriterTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.WriterTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.testing.WriterTestCase")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.substInTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.SubstInTypeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "substitution"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodePair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_substitution"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.SubstInTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "substitution"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_substitution"))},+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.SubstInTypeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.variableOccursInTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.VariableOccursInTypeTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "variable"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_variable"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.VariableOccursInTypeTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_variable"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.VariableOccursInTypeTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.unshadowVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.UnshadowVariablesTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "input"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "output"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_output"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.UnshadowVariablesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "input"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_input"))},+ Core.Field {+ Core.fieldName = (Core.Name "output"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_output"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.UnshadowVariablesTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.unifyTypesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.UnifyTypesTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "schemaTypes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_schemaTypes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.typing.typeSubst"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "schemaTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_schemaTypes"))},+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.UnifyTypesTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.testing.joinTypesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.testing.JoinTypesTestCase"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "expected"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.typing.typeConstraint"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_expected"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.testing.JoinTypesTestCase"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))},+ Core.Field {+ Core.fieldName = (Core.Name "expected"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_expected"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.testing.JoinTypesTestCase"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.ast"),+ (Module.Namespace "hydra.decode.coders"),+ (Module.Namespace "hydra.decode.compute"),+ (Module.Namespace "hydra.decode.graph"),+ (Module.Namespace "hydra.decode.json.model"),+ (Module.Namespace "hydra.decode.module"),+ (Module.Namespace "hydra.decode.parsing"),+ (Module.Namespace "hydra.decode.typing"),+ (Module.Namespace "hydra.decode.util")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.testing",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.testing")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Topology.hs view
@@ -0,0 +1,478 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.topology++module Hydra.Sources.Decode.Topology where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.topology"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.topology.graph"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.topology.Vertex")),+ Core.mapTypeValues = (Core.TypeList (Core.TypeVariable (Core.Name "hydra.topology.Vertex")))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.topology.tarjanState"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.topology.TarjanState"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "counter"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_counter"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "indices"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_indices"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "lowLinks"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_lowLinks"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "stack"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_stack"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "onStack"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_onStack"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "sccs"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.topology.vertex"))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_sccs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "counter"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_counter"))},+ Core.Field {+ Core.fieldName = (Core.Name "indices"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_indices"))},+ Core.Field {+ Core.fieldName = (Core.Name "lowLinks"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_lowLinks"))},+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_stack"))},+ Core.Field {+ Core.fieldName = (Core.Name "onStack"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_onStack"))},+ Core.Field {+ Core.fieldName = (Core.Name "sccs"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_sccs"))}]}))))})))}))})))}))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.topology.TarjanState"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.topology.vertex"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.core.Literal"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.topology",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.topology")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Typing.hs view
@@ -0,0 +1,1078 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.typing++module Hydra.Sources.Decode.Typing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.typing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.functionStructure"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "env"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.typing.FunctionStructure"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeParams"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeParams"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "params"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_params"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bindings"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.binding"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_bindings"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "body"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_body"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "domains"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_domains"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "codomain"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMaybe")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_codomain"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "environment"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "env"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_environment"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeParams"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeParams"))},+ Core.Field {+ Core.fieldName = (Core.Name "params"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_params"))},+ Core.Field {+ Core.fieldName = (Core.Name "bindings"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_bindings"))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_body"))},+ Core.Field {+ Core.fieldName = (Core.Name "domains"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_domains"))},+ Core.Field {+ Core.fieldName = (Core.Name "codomain"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_codomain"))},+ Core.Field {+ Core.fieldName = (Core.Name "environment"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_environment"))}]}))))})))}))})))}))})))}))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "env"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "env"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.typing.FunctionStructure")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "env"))}))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.inferenceContext"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.typing.InferenceContext"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "schemaTypes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_schemaTypes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "primitiveTypes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_primitiveTypes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "dataTypes"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeScheme"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_dataTypes"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "classConstraints"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeVariableMetadata"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_classConstraints"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "debug"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected boolean literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "b"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_debug"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "schemaTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_schemaTypes"))},+ Core.Field {+ Core.fieldName = (Core.Name "primitiveTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_primitiveTypes"))},+ Core.Field {+ Core.fieldName = (Core.Name "dataTypes"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_dataTypes"))},+ Core.Field {+ Core.fieldName = (Core.Name "classConstraints"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_classConstraints"))},+ Core.Field {+ Core.fieldName = (Core.Name "debug"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_debug"))}]}))))})))}))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.InferenceContext"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.inferenceResult"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.typing.InferenceResult"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_term"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_type"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "subst"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.typing.typeSubst"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_subst"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "classConstraints"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.typeVariableMetadata"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_classConstraints"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_term"))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_type"))},+ Core.Field {+ Core.fieldName = (Core.Name "subst"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_subst"))},+ Core.Field {+ Core.fieldName = (Core.Name "classConstraints"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_classConstraints"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.InferenceResult"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.termSubst"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.typing.TermSubst"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.typing.TermSubst"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.TermSubst"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.typeConstraint"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.typing.TypeConstraint"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "left"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_left"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "right"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_right"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "comment"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_comment"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.TypeConstraint"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_left"))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_right"))},+ Core.Field {+ Core.fieldName = (Core.Name "comment"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_comment"))}]}))))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.TypeConstraint"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.typeContext"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.typing.TypeContext"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "types"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_types"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "metadata"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.term"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_metadata"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeVariables"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeVariables"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "lambdaVariables"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_lambdaVariables"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "letVariables"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeSet")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_letVariables"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "inferenceContext"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.typing.inferenceContext"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_inferenceContext"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "types"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_types"))},+ Core.Field {+ Core.fieldName = (Core.Name "metadata"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_metadata"))},+ Core.Field {+ Core.fieldName = (Core.Name "typeVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeVariables"))},+ Core.Field {+ Core.fieldName = (Core.Name "lambdaVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_lambdaVariables"))},+ Core.Field {+ Core.fieldName = (Core.Name "letVariables"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_letVariables"))},+ Core.Field {+ Core.fieldName = (Core.Name "inferenceContext"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_inferenceContext"))}]}))))})))}))})))}))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.TypeContext"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.typing.typeSubst"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.typing.TypeSubst"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.typing.TypeSubst"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.typing.TypeSubst"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.typing",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.typing")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Util.hs view
@@ -0,0 +1,743 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.util++module Hydra.Sources.Decode.Util where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.util"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.util.caseConvention"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.util.CaseConvention"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "camel"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "camel"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pascal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pascal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lowerSnake"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lowerSnake"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "upperSnake"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "upperSnake"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.util.CaseConvention"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.util.comparison"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.util.Comparison"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThan"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equalTo"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThan"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.util.Comparison"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.util.decodingError"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected wrapped type hydra.util.DecodingError"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedTerm"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "b"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedTerm"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.util.DecodingError"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.util.precision"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.util.Precision"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "arbitrary"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Precision"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "arbitrary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bits"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Precision"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bits"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected int32 value"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "i"))))})))}]}))))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.util.Precision"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.util",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.util")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Variants.hs view
@@ -0,0 +1,1558 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.variants++module Hydra.Sources.Decode.Variants where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.variants"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.variants.eliminationVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.variants.EliminationVariant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.variants.EliminationVariant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.variants.functionVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.variants.FunctionVariant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "elimination"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "elimination"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambda"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primitive"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.variants.FunctionVariant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.variants.literalVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.variants.LiteralVariant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.variants.LiteralVariant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.variants.termVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.variants.TermVariant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "let"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplication"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambda"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "typeLambda"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.variants.TermVariant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.variants.typeVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.variants.TypeVariant"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "forall"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.variants.TypeVariant"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.variants",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.variants")}
+ src/gen-main/haskell/Hydra/Sources/Decode/Workflow.hs view
@@ -0,0 +1,641 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.decode.workflow++module Hydra.Sources.Decode.Workflow where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.decode.workflow"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.workflow.hydraSchemaSpec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.workflow.HydraSchemaSpec"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "modules"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.module.module"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_modules"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "typeName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_typeName"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.workflow.HydraSchemaSpec"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "modules"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_modules"))},+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_typeName"))}]}))))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.workflow.HydraSchemaSpec"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.workflow.schemaSpec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected union of type hydra.workflow.SchemaSpec"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inj"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "field"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "inj"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fname"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fterm"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "field"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "variantMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "hydra"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.decode.workflow.hydraSchemaSpec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "file"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "file"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))}))))),+ (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "provided"))}), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "provided"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "t"))}}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.decodeUnit")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))}))}))})))))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "no such field "),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ (Core.TermLiteral (Core.LiteralString " in union type ")),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "tname"))}))])}))}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fterm"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fname"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "variantMap"))}))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.workflow.SchemaSpec"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.decode.workflow.transformWorkflow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected record of type hydra.workflow.TransformWorkflow"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "record"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fieldMap"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.toFieldMap")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "record"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "name"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "schemaSpec"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.decode.workflow.schemaSpec"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_schemaSpec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "srcDir"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_srcDir"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.extract.helpers.requireField")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "destDir"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "cx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "raw"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "err"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "err"))}))))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stripped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = (Just (Core.TermEither (Left (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.util.DecodingError"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected string literal"))}))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "s"))))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "fieldMap"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "field_destDir"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_name"))},+ Core.Field {+ Core.fieldName = (Core.Name "schemaSpec"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_schemaSpec"))},+ Core.Field {+ Core.fieldName = (Core.Name "srcDir"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_srcDir"))},+ Core.Field {+ Core.fieldName = (Core.Name "destDir"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "field_destDir"))}]}))))})))}))})))}))})))}))})))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stripped"))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.lexical.stripAndDereferenceTermEither")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cx"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "raw"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.graph.Graph")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Term")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "hydra.util.DecodingError")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "hydra.workflow.TransformWorkflow"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.extract.helpers",+ (Module.Namespace "hydra.lexical"),+ (Module.Namespace "hydra.rewriting"),+ (Module.Namespace "hydra.decode.core"),+ (Module.Namespace "hydra.decode.compute"),+ (Module.Namespace "hydra.decode.graph"),+ (Module.Namespace "hydra.decode.module")],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.workflow",+ (Module.Namespace "hydra.util")],+ Module.moduleDescription = (Just "Term decoders for hydra.workflow")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Accessors.hs view
@@ -0,0 +1,1109 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.accessors++module Hydra.Sources.Encode.Accessors where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.accessors"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.accessors.accessorEdge"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.AccessorEdge"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "source"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.accessors.accessorNode")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorEdge"),+ Core.projectionField = (Core.Name "source")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "path"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.accessors.accessorPath")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorEdge"),+ Core.projectionField = (Core.Name "path")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "target"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.accessors.accessorNode")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorEdge"),+ Core.projectionField = (Core.Name "target")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.accessors.accessorGraph"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.AccessorGraph"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nodes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.accessors.accessorNode"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorGraph"),+ Core.projectionField = (Core.Name "nodes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "edges"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.accessors.accessorEdge"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorGraph"),+ Core.projectionField = (Core.Name "edges")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.accessors.accessorNode"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.AccessorNode"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorNode"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "label"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorNode"),+ Core.projectionField = (Core.Name "label")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "id"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.accessors.AccessorNode"),+ Core.projectionField = (Core.Name "id")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.accessors.accessorPath"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.AccessorPath"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.accessors.termAccessor"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.accessors.AccessorPath")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.accessors.termAccessor"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.accessors.TermAccessor"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "annotatedBody"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotatedBody"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "applicationFunction"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applicationFunction"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "applicationArgument"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applicationArgument"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lambdaBody"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambdaBody"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unionCasesDefault"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unionCasesDefault"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unionCasesBranch"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unionCasesBranch"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "letBody"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "letBody"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "letBinding"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "letBinding"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "listElement"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "listElement"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "mapKey"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "mapKey"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "mapValue"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "mapValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "maybeTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybeTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "productTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "productTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "recordField"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "recordField"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "setElement"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "setElement"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "sumTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sumTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeLambdaBody"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambdaBody"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeApplicationTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplicationTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "injectionTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "injectionTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrappedTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.accessors.TermAccessor"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrappedTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.accessors"],+ Module.moduleDescription = (Just "Term encoders for hydra.accessors")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Ast.hs view
@@ -0,0 +1,1211 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.ast++module Hydra.Sources.Encode.Ast where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.ast"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.associativity"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.ast.Associativity"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Associativity"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "none"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Associativity"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Associativity"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "both"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Associativity"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "both"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.blockStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.BlockStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "indent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BlockStyle"),+ Core.projectionField = (Core.Name "indent")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "newlineBeforeContent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BlockStyle"),+ Core.projectionField = (Core.Name "newlineBeforeContent")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "newlineAfterContent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BlockStyle"),+ Core.projectionField = (Core.Name "newlineAfterContent")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.bracketExpr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.BracketExpr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "brackets"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.brackets")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BracketExpr"),+ Core.projectionField = (Core.Name "brackets")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "enclosed"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.expr")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BracketExpr"),+ Core.projectionField = (Core.Name "enclosed")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "style"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.blockStyle")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.BracketExpr"),+ Core.projectionField = (Core.Name "style")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.brackets"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Brackets"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "open"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.symbol")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Brackets"),+ Core.projectionField = (Core.Name "open")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "close"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.symbol")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Brackets"),+ Core.projectionField = (Core.Name "close")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.expr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.ast.Expr"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "const"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Expr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "const"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.symbol")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "indent"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Expr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "indent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.indentedExpression")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "op"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Expr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "op"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.opExpr")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "brackets"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Expr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "brackets"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.bracketExpr")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.indentedExpression"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.IndentedExpression"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "style"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.indentStyle")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.IndentedExpression"),+ Core.projectionField = (Core.Name "style")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.expr")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.IndentedExpression"),+ Core.projectionField = (Core.Name "expr")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.indentStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.ast.IndentStyle"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "allLines"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.IndentStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "allLines"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "subsequentLines"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.IndentStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "subsequentLines"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.op"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Op"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "symbol"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.symbol")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Op"),+ Core.projectionField = (Core.Name "symbol")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "padding"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.padding")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Op"),+ Core.projectionField = (Core.Name "padding")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "precedence"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.precedence")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Op"),+ Core.projectionField = (Core.Name "precedence")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "associativity"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.associativity")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Op"),+ Core.projectionField = (Core.Name "associativity")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.opExpr"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.OpExpr"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "op"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.op")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.OpExpr"),+ Core.projectionField = (Core.Name "op")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lhs"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.expr")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.OpExpr"),+ Core.projectionField = (Core.Name "lhs")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rhs"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.expr")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.OpExpr"),+ Core.projectionField = (Core.Name "rhs")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.padding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Padding"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.ws")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Padding"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.ws")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.ast.Padding"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.precedence"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Precedence"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.ast.Precedence")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.symbol"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Symbol"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.ast.Symbol")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.ast.ws"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.ast.Ws"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "none"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Ws"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "none"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "space"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Ws"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "space"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "break"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Ws"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "break"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "breakAndIndent"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Ws"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "breakAndIndent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "doubleBreak"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.ast.Ws"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "doubleBreak"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.ast"],+ Module.moduleDescription = (Just "Term encoders for hydra.ast")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Classes.hs view
@@ -0,0 +1,109 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.classes++module Hydra.Sources.Encode.Classes where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.classes"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.classes.typeClass"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.classes.TypeClass"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "equality"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.classes.TypeClass"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equality"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "ordering"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.classes.TypeClass"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "ordering"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.classes"],+ Module.moduleDescription = (Just "Term encoders for hydra.classes")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Coders.hs view
@@ -0,0 +1,230 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.coders++module Hydra.Sources.Encode.Coders where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.coders"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.coders.coderDirection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.coders.CoderDirection"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "encode"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.coders.CoderDirection"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "decode"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.coders.languageName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.coders.LanguageName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.coders.LanguageName")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.coders.traversalOrder"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.TraversalOrder"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "pre"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.coders.TraversalOrder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pre"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "post"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.coders.TraversalOrder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "post"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.coders"],+ Module.moduleDescription = (Just "Term encoders for hydra.coders")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Compute.hs view
@@ -0,0 +1,242 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.compute++module Hydra.Sources.Encode.Compute where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.compute"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.compute.flowState"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.compute.FlowState"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "value")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "state"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "s")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "state")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "trace"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.compute.trace")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.projectionField = (Core.Name "trace")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.compute.trace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.compute.Trace"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "stack"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Trace"),+ Core.projectionField = (Core.Name "stack")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "messages"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Trace"),+ Core.projectionField = (Core.Name "messages")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "other"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Trace"),+ Core.projectionField = (Core.Name "other")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.compute"],+ Module.moduleDescription = (Just "Term encoders for hydra.compute")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Constraints.hs view
@@ -0,0 +1,134 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.constraints++module Hydra.Sources.Encode.Constraints where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.constraints"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.constraints.pathEquation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.constraints.PathEquation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.path")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.constraints.PathEquation"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.path")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.constraints.PathEquation"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.constraints.patternImplication"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.constraints.PatternImplication"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "antecedent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.pattern")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.constraints.PatternImplication"),+ Core.projectionField = (Core.Name "antecedent")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "consequent"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.pattern")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.constraints.PatternImplication"),+ Core.projectionField = (Core.Name "consequent")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.constraints"],+ Module.moduleDescription = (Just "Term encoders for hydra.constraints")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Core.hs view
@@ -0,0 +1,4477 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.core++module Hydra.Sources.Encode.Core where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.core"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.annotatedTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.AnnotatedTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.projectionField = (Core.Name "annotation")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.annotatedType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.AnnotatedType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.AnnotatedType"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.AnnotatedType"),+ Core.projectionField = (Core.Name "annotation")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.application"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Application"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Application"),+ Core.projectionField = (Core.Name "function")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "argument"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Application"),+ Core.projectionField = (Core.Name "argument")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.applicationType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.ApplicationType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ApplicationType"),+ Core.projectionField = (Core.Name "function")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "argument"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ApplicationType"),+ Core.projectionField = (Core.Name "argument")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.binding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Binding"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Binding"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Binding"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Binding"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.caseStatement"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.CaseStatement"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.CaseStatement"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "default"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.CaseStatement"),+ Core.projectionField = (Core.Name "default")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "cases"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.field"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.CaseStatement"),+ Core.projectionField = (Core.Name "cases")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.eitherType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.EitherType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.EitherType"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.EitherType"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.pairType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.PairType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "first"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.PairType"),+ Core.projectionField = (Core.Name "first")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "second"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.PairType"),+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.elimination"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Elimination"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Elimination"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.projection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Elimination"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.caseStatement")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Elimination"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.field"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Field"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Field"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.fieldType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FieldType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.FieldType"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.FieldType"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.floatType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatType"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigfloat"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.floatValue"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigfloat"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FloatValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.forallType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.ForallType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "parameter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ForallType"),+ Core.projectionField = (Core.Name "parameter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ForallType"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.function"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Function"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "elimination"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "elimination"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.elimination")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.lambda")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primitive"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.functionType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.FunctionType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "domain"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.FunctionType"),+ Core.projectionField = (Core.Name "domain")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "codomain"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.FunctionType"),+ Core.projectionField = (Core.Name "codomain")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.injection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Injection"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "field"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.field")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Injection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.integerType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerType"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int8"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int16"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint8"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint16"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.integerValue"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bigint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigint"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int8"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int16"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "int64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint8"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint8"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint16"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint16"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.IntegerValue"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "uint64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "uint64"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.lambda"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Lambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "parameter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Lambda"),+ Core.projectionField = (Core.Name "parameter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "domain"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Lambda"),+ Core.projectionField = (Core.Name "domain")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Lambda"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.let"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Let"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.binding"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Let"),+ Core.projectionField = (Core.Name "bindings")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Let"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.literal"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Literal"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.floatValue")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.integerValue")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.literalType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.LiteralType"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.LiteralType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.LiteralType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.LiteralType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.floatType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.LiteralType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.integerType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.LiteralType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.mapType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.MapType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "keys"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.MapType"),+ Core.projectionField = (Core.Name "keys")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "values"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.MapType"),+ Core.projectionField = (Core.Name "values")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.name"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.core.Name")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.projection"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Projection"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Projection"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "field"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Projection"),+ Core.projectionField = (Core.Name "field")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.record"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Record"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "fields"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.field"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.Record"),+ Core.projectionField = (Core.Name "fields")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.rowType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.RowType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.RowType"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "fields"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.fieldType"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.RowType"),+ Core.projectionField = (Core.Name "fields")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.term"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Term"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.annotatedTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.application")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.function")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "let"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.let")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.literal")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.record")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplication"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.typeApplicationTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeLambda"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.typeLambda")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.injection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.wrappedTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.type"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Type"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.annotatedType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.applicationType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.eitherType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "forall"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.forallType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.functionType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.literalType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.mapType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.pairType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.rowType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.rowType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.wrappedType")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.typeApplicationTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.TypeApplicationTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeApplicationTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeApplicationTerm"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.typeLambda"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.TypeLambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "parameter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeLambda"),+ Core.projectionField = (Core.Name "parameter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeLambda"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.typeScheme"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.TypeScheme"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeScheme"),+ Core.projectionField = (Core.Name "variables")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeScheme"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "constraints"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeVariableMetadata"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeScheme"),+ Core.projectionField = (Core.Name "constraints")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.typeVariableMetadata"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.TypeVariableMetadata"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "classes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.TypeVariableMetadata"),+ Core.projectionField = (Core.Name "classes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.wrappedTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.WrappedTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.core.wrappedType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.WrappedType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedType"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.WrappedType"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.core"],+ Module.moduleDescription = (Just "Term encoders for hydra.core")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Grammar.hs view
@@ -0,0 +1,702 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.grammar++module Hydra.Sources.Encode.Grammar where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.grammar"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.constant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Constant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.grammar.Constant")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.grammar"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Grammar"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.grammar.production"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.grammar.Grammar")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.label"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Label"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.grammar.Label")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.labeledPattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.LabeledPattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "label"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.label")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.grammar.LabeledPattern"),+ Core.projectionField = (Core.Name "label")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.grammar.LabeledPattern"),+ Core.projectionField = (Core.Name "pattern")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.pattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.grammar.Pattern"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "alternatives"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "alternatives"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "constant"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "constant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.constant")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "ignored"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "ignored"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "labeled"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "labeled"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.labeledPattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nil"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nil"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nonterminal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nonterminal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.symbol")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "option"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "option"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "plus"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "plus"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "regex"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.regex")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "sequence"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sequence"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "star"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "star"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.production"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Production"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "symbol"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.symbol")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.grammar.Production"),+ Core.projectionField = (Core.Name "symbol")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.grammar.pattern")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.grammar.Production"),+ Core.projectionField = (Core.Name "pattern")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.regex"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Regex"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.grammar.Regex")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.grammar.symbol"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.grammar.Symbol"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.grammar.Symbol")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.grammar"],+ Module.moduleDescription = (Just "Term encoders for hydra.grammar")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Json/Model.hs view
@@ -0,0 +1,302 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.json.model++module Hydra.Sources.Encode.Json.Model where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.json.model"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.json.model.value"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.json.model.Value"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "array"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "array"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "null"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "null"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "number"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "number"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.FloatValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bigfloat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "object"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "object"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.json.model.Value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.json.model"],+ Module.moduleDescription = (Just "Term encoders for hydra.json.model")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Module.hs view
@@ -0,0 +1,616 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.module++module Hydra.Sources.Encode.Module where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.module"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.definition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.module.Definition"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.Definition"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.module.termDefinition")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "type"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.Definition"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.module.typeDefinition")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.fileExtension"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.FileExtension"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.module.FileExtension")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.module"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.Module"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "namespace"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.module.namespace")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Module"),+ Core.projectionField = (Core.Name "namespace")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "elements"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.binding"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Module"),+ Core.projectionField = (Core.Name "elements")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "termDependencies"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Module"),+ Core.projectionField = (Core.Name "termDependencies")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeDependencies"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Module"),+ Core.projectionField = (Core.Name "typeDependencies")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Module"),+ Core.projectionField = (Core.Name "description")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.namespace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.Namespace"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.module.Namespace")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.namespaces"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.Namespaces"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "focus"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Namespaces"),+ Core.projectionField = (Core.Name "focus")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "mapping"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.Namespaces"),+ Core.projectionField = (Core.Name "mapping")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.qualifiedName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.QualifiedName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "namespace"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.namespace"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.QualifiedName"),+ Core.projectionField = (Core.Name "namespace")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "local"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.QualifiedName"),+ Core.projectionField = (Core.Name "local")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.termDefinition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.TermDefinition"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.TermDefinition"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.module.typeDefinition"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.module.TypeDefinition"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.TypeDefinition"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.module.TypeDefinition"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.module"],+ Module.moduleDescription = (Just "Term encoders for hydra.module")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Parsing.hs view
@@ -0,0 +1,246 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.parsing++module Hydra.Sources.Encode.Parsing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.parsing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.parsing.parseError"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.parsing.ParseError"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "message"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.parsing.ParseError"),+ Core.projectionField = (Core.Name "message")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "remainder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.parsing.ParseError"),+ Core.projectionField = (Core.Name "remainder")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.parsing.parseResult"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.parsing.ParseResult"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.parsing.ParseResult"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "success"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.parsing.parseSuccess")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "failure"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.parsing.ParseResult"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "failure"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.parsing.parseError")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]}))))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.parsing.parseSuccess"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.parsing.ParseSuccess"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "value"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "a")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.parsing.ParseSuccess"),+ Core.projectionField = (Core.Name "value")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "remainder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.parsing.ParseSuccess"),+ Core.projectionField = (Core.Name "remainder")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.parsing"],+ Module.moduleDescription = (Just "Term encoders for hydra.parsing")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Phantoms.hs view
@@ -0,0 +1,112 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.phantoms++module Hydra.Sources.Encode.Phantoms where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.phantoms"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.phantoms.tBinding"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.phantoms.TBinding"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.phantoms.TBinding"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.phantoms.tTerm")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.phantoms.TBinding"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.phantoms.tTerm"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.phantoms.TTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.phantoms.TTerm")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.phantoms"],+ Module.moduleDescription = (Just "Term encoders for hydra.phantoms")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Query.hs view
@@ -0,0 +1,1544 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.query++module Hydra.Sources.Encode.Query where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.query"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.comparisonConstraint"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.ComparisonConstraint"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "equal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "notEqual"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "notEqual"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThan"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThan"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lessThanOrEqual"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThanOrEqual"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThanOrEqual"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.ComparisonConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThanOrEqual"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.edge"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Edge"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Edge"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "out"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Edge"),+ Core.projectionField = (Core.Name "out")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "in"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Edge"),+ Core.projectionField = (Core.Name "in")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.graphPattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.GraphPattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "graph"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.GraphPattern"),+ Core.projectionField = (Core.Name "graph")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "patterns"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.GraphPattern"),+ Core.projectionField = (Core.Name "patterns")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.node"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.Node"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Node"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Node"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.variable")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wildcard"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Node"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wildcard"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.path"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.Path"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "step"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Path"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "step"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.step")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "regex"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Path"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "regex"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.regexSequence")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "inverse"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Path"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inverse"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.path")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.pattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.Pattern"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "triple"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "triple"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.triplePattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "negation"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "negation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.pattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "conjunction"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "conjunction"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "disjunction"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "disjunction"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "graph"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Pattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "graph"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.graphPattern")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.query"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Query"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.query.variable"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Query"),+ Core.projectionField = (Core.Name "variables")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "patterns"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.query.pattern"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Query"),+ Core.projectionField = (Core.Name "patterns")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.range"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Range"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "min"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Range"),+ Core.projectionField = (Core.Name "min")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "max"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.Range"),+ Core.projectionField = (Core.Name "max")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.regexQuantifier"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.RegexQuantifier"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "one"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "zeroOrOne"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "zeroOrOne"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "zeroOrMore"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "zeroOrMore"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "oneOrMore"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "oneOrMore"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "exactly"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "exactly"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "atLeast"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "atLeast"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "range"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexQuantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "range"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.range")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.regexSequence"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.RegexSequence"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "path"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.path")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.RegexSequence"),+ Core.projectionField = (Core.Name "path")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "quantifier"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.regexQuantifier")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.RegexSequence"),+ Core.projectionField = (Core.Name "quantifier")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.step"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.query.Step"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "edge"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Step"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "edge"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.edge")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "project"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Step"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "project"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.projection")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "compare"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Step"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "compare"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.comparisonConstraint")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.triplePattern"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.TriplePattern"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "subject"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.node")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.TriplePattern"),+ Core.projectionField = (Core.Name "subject")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "predicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.path")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.TriplePattern"),+ Core.projectionField = (Core.Name "predicate")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "object"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.query.node")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.query.TriplePattern"),+ Core.projectionField = (Core.Name "object")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.query.variable"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.query.Variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.query.Variable")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.query"],+ Module.moduleDescription = (Just "Term encoders for hydra.query")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Relational.hs view
@@ -0,0 +1,517 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.relational++module Hydra.Sources.Encode.Relational where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.relational"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.columnName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.ColumnName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.ColumnName")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.columnSchema"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.ColumnSchema"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.ColumnSchema"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "domain"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "t")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.ColumnSchema"),+ Core.projectionField = (Core.Name "domain")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.foreignKey"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.ForeignKey"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foreignRelation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.relationName")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.ForeignKey"),+ Core.projectionField = (Core.Name "foreignRelation")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "keys"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.ForeignKey"),+ Core.projectionField = (Core.Name "keys")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.primaryKey"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.PrimaryKey"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.PrimaryKey")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.relation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.Relation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.row")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.Relation")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.relationName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.RelationName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.RelationName")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.relationSchema"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.RelationSchema"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.relationName")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "columns"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.columnSchema")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.projectionField = (Core.Name "columns")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primaryKeys"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.primaryKey"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.projectionField = (Core.Name "primaryKeys")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foreignKeys"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.foreignKey"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.relational.RelationSchema"),+ Core.projectionField = (Core.Name "foreignKeys")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.relationship"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.Relationship"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.Relationship")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.relational.row"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.relational.Row"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.relational.Row")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.relational"],+ Module.moduleDescription = (Just "Term encoders for hydra.relational")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Tabular.hs view
@@ -0,0 +1,324 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.tabular++module Hydra.Sources.Encode.Tabular where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.tabular"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.tabular.columnType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.tabular.ColumnType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.columnName")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.ColumnType"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.ColumnType"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.tabular.dataRow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.tabular.DataRow"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.tabular.DataRow")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.tabular.headerRow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.tabular.HeaderRow"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.tabular.HeaderRow")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.tabular.table"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.tabular.Table"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "header"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.tabular.headerRow"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.Table"),+ Core.projectionField = (Core.Name "header")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "data"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.tabular.dataRow")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.Table"),+ Core.projectionField = (Core.Name "data")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.tabular.tableType"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.tabular.TableType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.relational.relationName")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.TableType"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "columns"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.tabular.columnType"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.tabular.TableType"),+ Core.projectionField = (Core.Name "columns")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.tabular"],+ Module.moduleDescription = (Just "Term encoders for hydra.tabular")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Testing.hs view
@@ -0,0 +1,5049 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.testing++module Hydra.Sources.Encode.Testing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.testing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.alphaConversionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.AlphaConversionTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "oldVariable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.projectionField = (Core.Name "oldVariable")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "newVariable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.projectionField = (Core.Name "newVariable")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "result"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.AlphaConversionTestCase"),+ Core.projectionField = (Core.Name "result")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.evaluationStyle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.EvaluationStyle"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "eager"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.EvaluationStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "eager"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lazy"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.EvaluationStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lazy"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.caseConversionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.CaseConversionTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "fromConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.util.caseConvention")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.projectionField = (Core.Name "fromConvention")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "toConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.util.caseConvention")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.projectionField = (Core.Name "toConvention")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "fromString"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.projectionField = (Core.Name "fromString")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "toString"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.CaseConversionTestCase"),+ Core.projectionField = (Core.Name "toString")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.delegatedEvaluationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.DelegatedEvaluationTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DelegatedEvaluationTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DelegatedEvaluationTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.etaExpansionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.EtaExpansionTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.EtaExpansionTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.EtaExpansionTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.deannotateTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.DeannotateTermTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DeannotateTermTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DeannotateTermTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.deannotateTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.DeannotateTypeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DeannotateTypeTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.DeannotateTypeTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.flattenLetTermsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FlattenLetTermsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FlattenLetTermsTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FlattenLetTermsTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.foldOperation"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.FoldOperation"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "sumInt32Literals"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FoldOperation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sumInt32Literals"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "collectListLengths"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FoldOperation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "collectListLengths"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "collectLabels"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FoldOperation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "collectLabels"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.foldOverTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FoldOverTermTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "traversalOrder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.coders.traversalOrder")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.projectionField = (Core.Name "traversalOrder")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "operation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.foldOperation")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.projectionField = (Core.Name "operation")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FoldOverTermTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.freeVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.FreeVariablesTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FreeVariablesTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.FreeVariablesTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.hoistPredicate"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.HoistPredicate"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "caseStatements"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistPredicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "caseStatements"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "applications"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistPredicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "applications"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lists"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistPredicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lists"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistPredicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nothing"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.hoistLetBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistLetBindingsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.let")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistLetBindingsTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.let")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistLetBindingsTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.hoistPolymorphicLetBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistPolymorphicLetBindingsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.let")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.let")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.hoistSubtermsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistSubtermsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "predicate"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.hoistPredicate")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistSubtermsTestCase"),+ Core.projectionField = (Core.Name "predicate")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistSubtermsTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistSubtermsTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.hoistCaseStatementsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.HoistCaseStatementsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistCaseStatementsTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.HoistCaseStatementsTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.termRewriter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.TermRewriter"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "replaceFooWithBar"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TermRewriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceFooWithBar"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "replaceInt32WithInt64"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TermRewriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceInt32WithInt64"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.rewriteTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.RewriteTermTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTermTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.termRewriter")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTermTestCase"),+ Core.projectionField = (Core.Name "rewriter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTermTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.typeRewriter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.TypeRewriter"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "replaceStringWithInt32"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TypeRewriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "replaceStringWithInt32"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.rewriteTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.RewriteTypeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTypeTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.typeRewriter")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTypeTestCase"),+ Core.projectionField = (Core.Name "rewriter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.RewriteTypeTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.evaluationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.EvaluationTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "evaluationStyle"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.evaluationStyle")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.EvaluationTestCase"),+ Core.projectionField = (Core.Name "evaluationStyle")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.EvaluationTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.EvaluationTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.inferenceFailureTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.InferenceFailureTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.InferenceFailureTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.inferenceTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.InferenceTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.InferenceTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.InferenceTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonCoderTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.JsonCoderTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonCoderTestCase"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonCoderTestCase"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "json"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.json.model.value")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonCoderTestCase"),+ Core.projectionField = (Core.Name "json")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonDecodeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.JsonDecodeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonDecodeTestCase"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "json"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.json.model.value")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonDecodeTestCase"),+ Core.projectionField = (Core.Name "json")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonDecodeTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonEncodeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.JsonEncodeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonEncodeTestCase"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.json.model.value"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonEncodeTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonParserTestCase"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.parserTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.json.model.value"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonRoundtripTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.JsonRoundtripTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonRoundtripTestCase"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JsonRoundtripTestCase"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.liftLambdaAboveLetTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.LiftLambdaAboveLetTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.jsonWriterTestCase"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.writerTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.json.model.value"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.parserTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.ParserTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.ParserTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.parsing.parseResult")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.ParserTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.tag"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.Tag"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.testing.Tag")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.testCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.testing.TestCase"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "alphaConversion"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "alphaConversion"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.alphaConversionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "caseConversion"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "caseConversion"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.caseConversionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "deannotateTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "deannotateTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.deannotateTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "deannotateType"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "deannotateType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.deannotateTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "delegatedEvaluation"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "delegatedEvaluation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.delegatedEvaluationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "etaExpansion"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "etaExpansion"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.etaExpansionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "flattenLetTerms"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "flattenLetTerms"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.flattenLetTermsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "freeVariables"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "freeVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.freeVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "evaluation"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "evaluation"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.evaluationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "inference"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inference"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.inferenceTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "inferenceFailure"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inferenceFailure"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.inferenceFailureTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonCoder"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonCoder"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonCoderTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonDecode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonDecode"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonDecodeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonEncode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonEncode"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonEncodeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonParser"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonParser"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonParserTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonRoundtrip"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonRoundtrip"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonRoundtripTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "jsonWriter"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "jsonWriter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.jsonWriterTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "liftLambdaAboveLet"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "liftLambdaAboveLet"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.liftLambdaAboveLetTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "serialization"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "serialization"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.serializationTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "simplifyTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "simplifyTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.simplifyTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "topologicalSort"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSort"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.topologicalSortTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "topologicalSortBindings"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSortBindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.topologicalSortBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "topologicalSortSCC"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "topologicalSortSCC"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.topologicalSortSCCTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeChecking"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeChecking"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.typeCheckingTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeCheckingFailure"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeCheckingFailure"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.typeCheckingFailureTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeReduction"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeReduction"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.typeReductionTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "normalizeTypeVariables"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "normalizeTypeVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.normalizeTypeVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "foldOverTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foldOverTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.foldOverTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriteTerm"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriteTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.rewriteTermTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "rewriteType"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "rewriteType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.rewriteTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "hoistSubterms"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistSubterms"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.hoistSubtermsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "hoistCaseStatements"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistCaseStatements"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.hoistCaseStatementsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "hoistLetBindings"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistLetBindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.hoistLetBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "hoistPolymorphicLetBindings"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hoistPolymorphicLetBindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.hoistPolymorphicLetBindingsTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "substInType"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "substInType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.substInTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variableOccursInType"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variableOccursInType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.variableOccursInTypeTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unifyTypes"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unifyTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.unifyTypesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "joinTypes"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "joinTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.joinTypesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unshadowVariables"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unshadowVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.unshadowVariablesTestCase")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.testCaseWithMetadata"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestCaseWithMetadata"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "case"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.testing.testCase")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.projectionField = (Core.Name "case")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.projectionField = (Core.Name "description")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "tags"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.testing.tag"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestCaseWithMetadata"),+ Core.projectionField = (Core.Name "tags")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.testGroup"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TestGroup"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.projectionField = (Core.Name "description")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "subgroups"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.testing.testGroup"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.projectionField = (Core.Name "subgroups")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "cases"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.testing.testCaseWithMetadata"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TestGroup"),+ Core.projectionField = (Core.Name "cases")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.typeCheckingTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TypeCheckingTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeCheckingTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "outputTerm"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeCheckingTestCase"),+ Core.projectionField = (Core.Name "outputTerm")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "outputType"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeCheckingTestCase"),+ Core.projectionField = (Core.Name "outputType")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.typeCheckingFailureTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TypeCheckingFailureTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeCheckingFailureTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.topologicalSortBindingsTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TopologicalSortBindingsTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortBindingsTestCase"),+ Core.projectionField = (Core.Name "bindings")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortBindingsTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.topologicalSortTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TopologicalSortTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "adjacencyList"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortTestCase"),+ Core.projectionField = (Core.Name "adjacencyList")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.topologicalSortSCCTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TopologicalSortSCCTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "adjacencyList"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortSCCTestCase"),+ Core.projectionField = (Core.Name "adjacencyList")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TopologicalSortSCCTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.serializationTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.SerializationTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.ast.expr")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SerializationTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SerializationTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.simplifyTermTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.SimplifyTermTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SimplifyTermTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SimplifyTermTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.normalizeTypeVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.NormalizeTypeVariablesTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.typeReductionTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.TypeReductionTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeReductionTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.TypeReductionTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.writerTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.WriterTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "a")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.WriterTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.WriterTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.substInTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.SubstInTypeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "substitution"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SubstInTypeTestCase"),+ Core.projectionField = (Core.Name "substitution")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SubstInTypeTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.SubstInTypeTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.variableOccursInTypeTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.VariableOccursInTypeTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.VariableOccursInTypeTestCase"),+ Core.projectionField = (Core.Name "variable")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.VariableOccursInTypeTestCase"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.VariableOccursInTypeTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.unshadowVariablesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.UnshadowVariablesTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "input"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnshadowVariablesTestCase"),+ Core.projectionField = (Core.Name "input")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "output"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnshadowVariablesTestCase"),+ Core.projectionField = (Core.Name "output")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.unifyTypesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.UnifyTypesTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "schemaTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.projectionField = (Core.Name "schemaTypes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.typing.typeSubst"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.UnifyTypesTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.testing.joinTypesTestCase"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.testing.JoinTypesTestCase"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JoinTypesTestCase"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JoinTypesTestCase"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "expected"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.typing.typeConstraint"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.testing.JoinTypesTestCase"),+ Core.projectionField = (Core.Name "expected")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.testing"],+ Module.moduleDescription = (Just "Term encoders for hydra.testing")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Topology.hs view
@@ -0,0 +1,309 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.topology++module Hydra.Sources.Encode.Topology where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.topology"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.topology.graph"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.topology.tarjanState"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.topology.TarjanState"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "counter"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "counter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "indices"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "indices")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lowLinks"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "lowLinks")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "stack"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "stack")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "onStack"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "onStack")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "sccs"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.topology.vertex"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.topology.TarjanState"),+ Core.projectionField = (Core.Name "sccs")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.topology.vertex"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.topology"],+ Module.moduleDescription = (Just "Term encoders for hydra.topology")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Typing.hs view
@@ -0,0 +1,834 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.typing++module Hydra.Sources.Encode.Typing where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.typing"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.functionStructure"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "env"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.FunctionStructure"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeParams"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "typeParams")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "params"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "params")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bindings"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.binding"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "bindings")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "body"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "domains"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "domains")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "codomain"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "opt"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "codomain")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "environment"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "env")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.FunctionStructure"),+ Core.projectionField = (Core.Name "environment")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.inferenceContext"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.InferenceContext"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "schemaTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.projectionField = (Core.Name "schemaTypes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primitiveTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.projectionField = (Core.Name "primitiveTypes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "dataTypes"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeScheme"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.projectionField = (Core.Name "dataTypes")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "classConstraints"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeVariableMetadata"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.projectionField = (Core.Name "classConstraints")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "debug"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceContext"),+ Core.projectionField = (Core.Name "debug")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.inferenceResult"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.InferenceResult"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "term"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.term")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.projectionField = (Core.Name "term")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "type"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.projectionField = (Core.Name "type")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "subst"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.typing.typeSubst")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.projectionField = (Core.Name "subst")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "classConstraints"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.typeVariableMetadata"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.InferenceResult"),+ Core.projectionField = (Core.Name "classConstraints")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.termSubst"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.TermSubst"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.typing.TermSubst")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.typeConstraint"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.TypeConstraint"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "left"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeConstraint"),+ Core.projectionField = (Core.Name "left")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "right"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.type")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeConstraint"),+ Core.projectionField = (Core.Name "right")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "comment"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeConstraint"),+ Core.projectionField = (Core.Name "comment")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.typeContext"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.TypeContext"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "types"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "types")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "metadata"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.term"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "metadata")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "typeVariables")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambdaVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "lambdaVariables")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "letVariables"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "letVariables")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "inferenceContext"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.typing.inferenceContext")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.typing.TypeContext"),+ Core.projectionField = (Core.Name "inferenceContext")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.typing.typeSubst"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.typing.TypeSubst"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.name"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.core.type"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.typing.TypeSubst")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.typing"],+ Module.moduleDescription = (Just "Term encoders for hydra.typing")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Util.hs view
@@ -0,0 +1,440 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.util++module Hydra.Sources.Encode.Util where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.util"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.util.caseConvention"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.util.CaseConvention"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "camel"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.CaseConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "camel"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "pascal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.CaseConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pascal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lowerSnake"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.CaseConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lowerSnake"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "upperSnake"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.CaseConvention"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "upperSnake"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.util.comparison"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.util.Comparison"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.Comparison"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lessThan"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.Comparison"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "equalTo"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.Comparison"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "greaterThan"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.util.decodingError"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.WrappedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.DecodingError"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.util.DecodingError")))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.util.precision"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.util.Precision"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "arbitrary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.Precision"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "arbitrary"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "bits"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.util.Precision"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bits"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.util"],+ Module.moduleDescription = (Just "Term encoders for hydra.util")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Variants.hs view
@@ -0,0 +1,1814 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.variants++module Hydra.Sources.Encode.Variants where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.variants"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.variants.eliminationVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.variants.EliminationVariant"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.EliminationVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.EliminationVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.EliminationVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.variants.functionVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.variants.FunctionVariant"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "elimination"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.FunctionVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "elimination"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "lambda"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.FunctionVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "lambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "primitive"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.FunctionVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "primitive"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.variants.literalVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.variants.LiteralVariant"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "binary"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.LiteralVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "binary"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.LiteralVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "boolean"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.LiteralVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "float"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.LiteralVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "integer"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.LiteralVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "string"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.variants.termVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.variants.TermVariant"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "let"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "let"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeApplication"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeApplication"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "typeLambda"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeLambda"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TermVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.variants.typeVariant"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.variants.TypeVariant"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "annotated"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "application"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "application"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "either"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "either"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "forall"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "function"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "function"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "list"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "literal"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "map"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "map"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "maybe"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "maybe"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "pair"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "pair"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "record"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "set"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "set"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "union"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "unit"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "variable"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "variable"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "wrap"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.variants.TypeVariant"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrap"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.variants"],+ Module.moduleDescription = (Just "Term encoders for hydra.variants")}
+ src/gen-main/haskell/Hydra/Sources/Encode/Workflow.hs view
@@ -0,0 +1,333 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Source module for hydra.encode.workflow++module Hydra.Sources.Encode.Workflow where++import qualified Hydra.Core as Core+import qualified Hydra.Module as Module+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++module_ :: Module.Module+module_ = Module.Module {+ Module.moduleNamespace = (Module.Namespace "hydra.encode.workflow"),+ Module.moduleElements = [+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.workflow.hydraSchemaSpec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.workflow.HydraSchemaSpec"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "modules"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.encode.module.module"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.HydraSchemaSpec"),+ Core.projectionField = (Core.Name "modules")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "typeName"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.core.name")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.HydraSchemaSpec"),+ Core.projectionField = (Core.Name "typeName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.workflow.schemaSpec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.workflow.SchemaSpec"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "hydra"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.workflow.SchemaSpec"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.workflow.hydraSchemaSpec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "file"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.workflow.SchemaSpec"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "file"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "provided"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "union"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Injection"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.workflow.SchemaSpec"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "field"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "provided"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = Core.TermUnit}}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}]}))}]}))}}))})))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "hydra.encode.workflow.transformWorkflow"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "record"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Record"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "typeName"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.workflow.TransformWorkflow"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "fields"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "name"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.projectionField = (Core.Name "name")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "schemaSpec"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.encode.workflow.schemaSpec")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.projectionField = (Core.Name "schemaSpec")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "srcDir"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.projectionField = (Core.Name "srcDir")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]})),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.Field"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "destDir"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "term"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}}))}))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.workflow.TransformWorkflow"),+ Core.projectionField = (Core.Name "destDir")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}]}))])}]}))}}))}))),+ Core.bindingType = Nothing}],+ Module.moduleTermDependencies = [+ Module.Namespace "hydra.encode.core"],+ Module.moduleTypeDependencies = [+ Module.Namespace "hydra.workflow"],+ Module.moduleDescription = (Just "Term encoders for hydra.workflow")}
src/gen-main/haskell/Hydra/Substitution.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Variable substitution in type and term expressions. module Hydra.Substitution where@@ -6,54 +8,97 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Typing as Typing-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Compose two type substitutions composeTypeSubst :: (Typing.TypeSubst -> Typing.TypeSubst -> Typing.TypeSubst)-composeTypeSubst s1 s2 = - let isExtra = (\k -> \v -> Optionals.isNothing (Maps.lookup k (Typing.unTypeSubst s1))) +composeTypeSubst s1 s2 = (Logic.ifElse (Maps.null (Typing.unTypeSubst s1)) s2 (Logic.ifElse (Maps.null (Typing.unTypeSubst s2)) s1 (composeTypeSubstNonEmpty s1 s2)))++-- | Compose two non-empty type substitutions (internal helper)+composeTypeSubstNonEmpty :: (Typing.TypeSubst -> Typing.TypeSubst -> Typing.TypeSubst)+composeTypeSubstNonEmpty s1 s2 = + let isExtra = (\k -> \v -> Maybes.isNothing (Maps.lookup k (Typing.unTypeSubst s1))) withExtra = (Maps.filterWithKey isExtra (Typing.unTypeSubst s2)) in (Typing.TypeSubst (Maps.union withExtra (Maps.map (substInType s2) (Typing.unTypeSubst s1)))) +-- | Compose a list of type substitutions composeTypeSubstList :: ([Typing.TypeSubst] -> Typing.TypeSubst) composeTypeSubstList = (Lists.foldl composeTypeSubst idTypeSubst) +-- | The identity type substitution idTypeSubst :: Typing.TypeSubst idTypeSubst = (Typing.TypeSubst Maps.empty) +-- | Create a type substitution with a single variable mapping singletonTypeSubst :: (Core.Name -> Core.Type -> Typing.TypeSubst) singletonTypeSubst v t = (Typing.TypeSubst (Maps.singleton v t)) +-- | Apply a term substitution to a binding+substituteInBinding :: (Typing.TermSubst -> Core.Binding -> Core.Binding)+substituteInBinding subst b = Core.Binding {+ Core.bindingName = (Core.bindingName b),+ Core.bindingTerm = (substituteInTerm subst (Core.bindingTerm b)),+ Core.bindingType = (Core.bindingType b)}++-- | Apply a type substitution to a type constraint substituteInConstraint :: (Typing.TypeSubst -> Typing.TypeConstraint -> Typing.TypeConstraint) substituteInConstraint subst c = Typing.TypeConstraint { Typing.typeConstraintLeft = (substInType subst (Typing.typeConstraintLeft c)), Typing.typeConstraintRight = (substInType subst (Typing.typeConstraintRight c)), Typing.typeConstraintComment = (Typing.typeConstraintComment c)} +-- | Apply a type substitution to a list of type constraints substituteInConstraints :: (Typing.TypeSubst -> [Typing.TypeConstraint] -> [Typing.TypeConstraint]) substituteInConstraints subst cs = (Lists.map (substituteInConstraint subst) cs) +-- | Apply a type substitution to class constraints, propagating to free variables+substInClassConstraints :: (Typing.TypeSubst -> M.Map Core.Name Core.TypeVariableMetadata -> M.Map Core.Name Core.TypeVariableMetadata)+substInClassConstraints subst constraints = + let substMap = (Typing.unTypeSubst subst)+ in + let insertOrMerge = (\varName -> \metadata -> \acc -> Maybes.maybe (Maps.insert varName metadata acc) (\existing -> + let merged = Core.TypeVariableMetadata {+ Core.typeVariableMetadataClasses = (Sets.union (Core.typeVariableMetadataClasses existing) (Core.typeVariableMetadataClasses metadata))}+ in (Maps.insert varName merged acc)) (Maps.lookup varName acc))+ in (Lists.foldl (\acc -> \pair -> + let varName = (Pairs.first pair)+ in + let metadata = (Pairs.second pair)+ in (Maybes.maybe (insertOrMerge varName metadata acc) (\targetType -> + let freeVars = (Sets.toList (Rewriting.freeVariablesInType targetType))+ in (Lists.foldl (\acc2 -> \freeVar -> insertOrMerge freeVar metadata acc2) acc freeVars)) (Maps.lookup varName substMap))) Maps.empty (Maps.toList constraints))++-- | Apply a type substitution to an inference context substInContext :: (Typing.TypeSubst -> Typing.InferenceContext -> Typing.InferenceContext)-substInContext subst cx = Typing.InferenceContext {- Typing.inferenceContextSchemaTypes = (Typing.inferenceContextSchemaTypes cx),- Typing.inferenceContextPrimitiveTypes = (Typing.inferenceContextPrimitiveTypes cx),- Typing.inferenceContextDataTypes = (Maps.map (substInTypeScheme subst) (Typing.inferenceContextDataTypes cx)),- Typing.inferenceContextDebug = (Typing.inferenceContextDebug cx)}+substInContext subst cx = + let newDataTypes = (Maps.map (substInTypeScheme subst) (Typing.inferenceContextDataTypes cx))+ in + let newClassConstraints = (substInClassConstraints subst (Typing.inferenceContextClassConstraints cx))+ in Typing.InferenceContext {+ Typing.inferenceContextSchemaTypes = (Typing.inferenceContextSchemaTypes cx),+ Typing.inferenceContextPrimitiveTypes = (Typing.inferenceContextPrimitiveTypes cx),+ Typing.inferenceContextDataTypes = newDataTypes,+ Typing.inferenceContextClassConstraints = newClassConstraints,+ Typing.inferenceContextDebug = (Typing.inferenceContextDebug cx)} +-- | Apply a term substitution to a term substituteInTerm :: (Typing.TermSubst -> Core.Term -> Core.Term)-substituteInTerm subst = +substituteInTerm subst term0 = let s = (Typing.unTermSubst subst) rewrite = (\recurse -> \term -> let withLambda = (\l -> let v = (Core.lambdaParameter l) - subst2 = (Typing.TermSubst (Maps.remove v s))+ subst2 = (Typing.TermSubst (Maps.delete v s)) in (Core.TermFunction (Core.FunctionLambda (Core.Lambda { Core.lambdaParameter = v, Core.lambdaDomain = (Core.lambdaDomain l),@@ -68,70 +113,73 @@ Core.bindingType = (Core.bindingType b)}) in (Core.TermLet (Core.Let { Core.letBindings = (Lists.map rewriteBinding bindings),- Core.letEnvironment = (substituteInTerm subst2 (Core.letEnvironment lt))})))+ Core.letBody = (substituteInTerm subst2 (Core.letBody lt))}))) in ((\x -> case x of Core.TermFunction v1 -> ((\x -> case x of Core.FunctionLambda v2 -> (withLambda v2) _ -> (recurse term)) v1) Core.TermLet v1 -> (withLet v1)- Core.TermVariable v1 -> (Optionals.maybe (recurse term) (\sterm -> sterm) (Maps.lookup v1 s))+ Core.TermVariable v1 -> (Maybes.maybe (recurse term) (\sterm -> sterm) (Maps.lookup v1 s)) _ -> (recurse term)) term))- in (Rewriting.rewriteTerm rewrite)+ in (Rewriting.rewriteTerm rewrite term0) +-- | Apply a type substitution to a type substInType :: (Typing.TypeSubst -> Core.Type -> Core.Type)-substInType subst = +substInType subst typ0 = (Logic.ifElse (Maps.null (Typing.unTypeSubst subst)) typ0 (substInTypeNonEmpty subst typ0))++-- | Apply a non-empty type substitution to a type (internal helper)+substInTypeNonEmpty :: (Typing.TypeSubst -> Core.Type -> Core.Type)+substInTypeNonEmpty subst typ0 = let rewrite = (\recurse -> \typ -> (\x -> case x of- Core.TypeForall v1 -> (Optionals.maybe (recurse typ) (\styp -> Core.TypeForall (Core.ForallType {+ Core.TypeForall v1 -> (Maybes.maybe (recurse typ) (\styp -> Core.TypeForall (Core.ForallType { Core.forallTypeParameter = (Core.forallTypeParameter v1), Core.forallTypeBody = (substInType (removeVar (Core.forallTypeParameter v1)) (Core.forallTypeBody v1))})) (Maps.lookup (Core.forallTypeParameter v1) (Typing.unTypeSubst subst)))- Core.TypeVariable v1 -> (Optionals.maybe typ (\styp -> styp) (Maps.lookup v1 (Typing.unTypeSubst subst)))+ Core.TypeVariable v1 -> (Maybes.maybe typ (\styp -> styp) (Maps.lookup v1 (Typing.unTypeSubst subst))) _ -> (recurse typ)) typ) - removeVar = (\v -> Typing.TypeSubst (Maps.remove v (Typing.unTypeSubst subst)))- in (Rewriting.rewriteType rewrite)+ removeVar = (\v -> Typing.TypeSubst (Maps.delete v (Typing.unTypeSubst subst)))+ in (Rewriting.rewriteType rewrite typ0) +-- | Apply a type substitution to a type scheme substInTypeScheme :: (Typing.TypeSubst -> Core.TypeScheme -> Core.TypeScheme) substInTypeScheme subst ts = Core.TypeScheme { Core.typeSchemeVariables = (Core.typeSchemeVariables ts),- Core.typeSchemeType = (substInType subst (Core.typeSchemeType ts))}+ Core.typeSchemeType = (substInType subst (Core.typeSchemeType ts)),+ Core.typeSchemeConstraints = (Maybes.map (substInClassConstraints subst) (Core.typeSchemeConstraints ts))} +-- | Apply a type substitution to the type annotations within a term substTypesInTerm :: (Typing.TypeSubst -> Core.Term -> Core.Term)-substTypesInTerm subst = +substTypesInTerm subst term0 = let rewrite = (\recurse -> \term -> - let forElimination = (\elm -> (\x -> case x of- Core.EliminationProduct v1 -> (forTupleProjection v1)- _ -> (recurse term)) elm) + let dflt = (recurse term) forFunction = (\f -> (\x -> case x of- Core.FunctionElimination v1 -> (forElimination v1)+ Core.FunctionElimination _ -> dflt Core.FunctionLambda v1 -> (forLambda v1)- _ -> (recurse term)) f)- forLambda = (\l -> recurse (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ _ -> dflt) f)+ forLambda = (\l -> Core.TermFunction (Core.FunctionLambda (Core.Lambda { Core.lambdaParameter = (Core.lambdaParameter l),- Core.lambdaDomain = (Optionals.map (substInType subst) (Core.lambdaDomain l)),- Core.lambdaBody = (Core.lambdaBody l)}))))+ Core.lambdaDomain = (Maybes.map (substInType subst) (Core.lambdaDomain l)),+ Core.lambdaBody = (substTypesInTerm subst (Core.lambdaBody l))}))) forLet = (\l -> let rewriteBinding = (\b -> Core.Binding { Core.bindingName = (Core.bindingName b),- Core.bindingTerm = (Core.bindingTerm b),- Core.bindingType = (Optionals.map (substInTypeScheme subst) (Core.bindingType b))})- in (recurse (Core.TermLet (Core.Let {+ Core.bindingTerm = (substTypesInTerm subst (Core.bindingTerm b)),+ Core.bindingType = (Maybes.map (substInTypeScheme subst) (Core.bindingType b))})+ in (Core.TermLet (Core.Let { Core.letBindings = (Lists.map rewriteBinding (Core.letBindings l)),- Core.letEnvironment = (Core.letEnvironment l)}))))- forTupleProjection = (\tp -> recurse (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = (Core.tupleProjectionArity tp),- Core.tupleProjectionIndex = (Core.tupleProjectionIndex tp),- Core.tupleProjectionDomain = (Optionals.map (\types -> Lists.map (substInType subst) types) (Core.tupleProjectionDomain tp))})))))+ Core.letBody = (substTypesInTerm subst (Core.letBody l))})))+ forTypeApplication = (\tt -> Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (substTypesInTerm subst (Core.typeApplicationTermBody tt)),+ Core.typeApplicationTermType = (substInType subst (Core.typeApplicationTermType tt))})) forTypeLambda = (\ta -> let param = (Core.typeLambdaParameter ta) - subst2 = (Typing.TypeSubst (Maps.remove param (Typing.unTypeSubst subst)))+ subst2 = (Typing.TypeSubst (Maps.delete param (Typing.unTypeSubst subst))) in (Core.TermTypeLambda (Core.TypeLambda { Core.typeLambdaParameter = param, Core.typeLambdaBody = (substTypesInTerm subst2 (Core.typeLambdaBody ta))}))) in ((\x -> case x of Core.TermFunction v1 -> (forFunction v1) Core.TermLet v1 -> (forLet v1)+ Core.TermTypeApplication v1 -> (forTypeApplication v1) Core.TermTypeLambda v1 -> (forTypeLambda v1)- Core.TermTypeApplication v1 -> (recurse (Core.TermTypeApplication (Core.TypedTerm {- Core.typedTermTerm = (Core.typedTermTerm v1),- Core.typedTermType = (substInType subst (Core.typedTermType v1))})))- _ -> (recurse term)) term))- in (Rewriting.rewriteTerm rewrite)+ _ -> dflt) term))+ in (Rewriting.rewriteTerm rewrite term0)
src/gen-main/haskell/Hydra/Tabular.hs view
@@ -1,14 +1,31 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A simple, untyped tabular data model, suitable for CSVs and TSVs module Hydra.Tabular where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Relational as Relational+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | A column type, consisting of a name and a value type+data ColumnType = + ColumnType {+ columnTypeName :: Relational.ColumnName,+ columnTypeType :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_ColumnType = (Core.Name "hydra.tabular.ColumnType")++_ColumnType_name = (Core.Name "name")++_ColumnType_type = (Core.Name "type")+ -- | A data row, containing optional-valued cells; one per column newtype DataRow v = DataRow {@@ -39,3 +56,16 @@ _Table_header = (Core.Name "header") _Table_data = (Core.Name "data")++-- | A type definition for a table, including column names and types+data TableType = + TableType {+ tableTypeName :: Relational.RelationName,+ tableTypeColumns :: [ColumnType]}+ deriving (Eq, Ord, Read, Show)++_TableType = (Core.Name "hydra.tabular.TableType")++_TableType_name = (Core.Name "name")++_TableType_columns = (Core.Name "columns")
src/gen-main/haskell/Hydra/Tarjan.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | This implementation of Tarjan's algorithm was originally based on GraphSCC by Iavor S. Diatchki: https://hackage.haskell.org/package/GraphSCC. module Hydra.Tarjan where@@ -10,45 +12,61 @@ import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Monads as Monads import qualified Hydra.Topology as Topology-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -adjacencyListsToGraph :: (Ord t0) => ([(t0, [t0])] -> (M.Map Int [Int], (Int -> t0)))+-- | 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.+adjacencyListsToGraph :: Ord t0 => ([(t0, [t0])] -> (M.Map Int [Int], (Int -> t0))) adjacencyListsToGraph edges0 = - let sortedEdges = (Lists.sortOn fst edges0) - indexedEdges = (Lists.zip (Math.range 0 (Lists.length sortedEdges)) sortedEdges)- keyToVertex = (Maps.fromList (Lists.map (\vkNeighbors -> - let v = (fst vkNeighbors) - kNeighbors = (snd vkNeighbors)- k = (fst kNeighbors)- in (k, v)) indexedEdges))- vertexMap = (Maps.fromList (Lists.map (\vkNeighbors -> - let v = (fst vkNeighbors) - kNeighbors = (snd vkNeighbors)- k = (fst kNeighbors)- in (v, k)) indexedEdges))- graph = (Maps.fromList (Lists.map (\vkNeighbors -> - let v = (fst vkNeighbors) - kNeighbors = (snd vkNeighbors)- neighbors = (snd kNeighbors)- in (v, (Optionals.mapMaybe (\k -> Maps.lookup k keyToVertex) neighbors))) indexedEdges))- vertexToKey = (\v -> Optionals.fromJust (Maps.lookup v vertexMap))- in (graph, vertexToKey)+ let sortedEdges = (Lists.sortOn Pairs.first edges0)+ in + let indexedEdges = (Lists.zip (Math.range 0 (Lists.length sortedEdges)) sortedEdges)+ in + let keyToVertex = (Maps.fromList (Lists.map (\vkNeighbors -> + let v = (Pairs.first vkNeighbors)+ in + let kNeighbors = (Pairs.second vkNeighbors)+ in + let k = (Pairs.first kNeighbors)+ in (k, v)) indexedEdges))+ in + let vertexMap = (Maps.fromList (Lists.map (\vkNeighbors -> + let v = (Pairs.first vkNeighbors)+ in + let kNeighbors = (Pairs.second vkNeighbors)+ in + let k = (Pairs.first kNeighbors)+ in (v, k)) indexedEdges))+ in + let graph = (Maps.fromList (Lists.map (\vkNeighbors -> + let v = (Pairs.first vkNeighbors)+ in + let kNeighbors = (Pairs.second vkNeighbors)+ in + let neighbors = (Pairs.second kNeighbors)+ in (v, (Maybes.mapMaybe (\k -> Maps.lookup k keyToVertex) neighbors))) indexedEdges))+ in + let vertexToKey = (\v -> Maybes.fromJust (Maps.lookup v vertexMap))+ in (graph, vertexToKey) -- | Compute the strongly connected components of the given graph. The components are returned in reverse topological order stronglyConnectedComponents :: (M.Map Int [Int] -> [[Int]]) stronglyConnectedComponents graph = - let verts = (Maps.keys graph) - processVertex = (\v -> Flows.bind (Flows.map (\st -> Maps.member v (Topology.tarjanStateIndices st)) Monads.getState) (\visited -> Logic.ifElse (Logic.not visited) (strongConnect graph v) (Flows.pure ())))- finalState = (Monads.exec (Flows.mapList processVertex verts) initialState)- in (Lists.reverse (Lists.map Lists.sort (Topology.tarjanStateSccs finalState)))+ let verts = (Maps.keys graph)+ in + let processVertex = (\v -> Flows.bind (Flows.map (\st -> Maps.member v (Topology.tarjanStateIndices st)) Monads.getState) (\visited -> Logic.ifElse (Logic.not visited) (strongConnect graph v) (Flows.pure ())))+ in + let finalState = (Monads.exec (Flows.mapList processVertex verts) initialState)+ in (Lists.reverse (Lists.map Lists.sort (Topology.tarjanStateSccs finalState))) -- | Initial state for Tarjan's algorithm initialState :: Topology.TarjanState@@ -63,65 +81,79 @@ -- | Pop vertices off the stack until the given vertex is reached, collecting the current strongly connected component popStackUntil :: (Int -> Compute.Flow Topology.TarjanState [Int]) popStackUntil v = - let go = (\acc -> Flows.bind Monads.getState (\st -> Logic.ifElse (Lists.null (Topology.tarjanStateStack st)) (Flows.fail "popStackUntil: empty stack") ( - let x = (Lists.head (Topology.tarjanStateStack st)) - xs = (Lists.tail (Topology.tarjanStateStack st))- newSt = Topology.TarjanState {- Topology.tarjanStateCounter = (Topology.tarjanStateCounter st),- Topology.tarjanStateIndices = (Topology.tarjanStateIndices st),- Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks st),- Topology.tarjanStateStack = xs,- Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack st),- Topology.tarjanStateSccs = (Topology.tarjanStateSccs st)}- newSt2 = Topology.TarjanState {- Topology.tarjanStateCounter = (Topology.tarjanStateCounter newSt),- Topology.tarjanStateIndices = (Topology.tarjanStateIndices newSt),- Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks newSt),- Topology.tarjanStateStack = (Topology.tarjanStateStack newSt),- Topology.tarjanStateOnStack = (Sets.delete x (Topology.tarjanStateOnStack st)),- Topology.tarjanStateSccs = (Topology.tarjanStateSccs newSt)}- acc_ = (Lists.cons x acc)- in (Flows.bind (Monads.putState newSt2) (\_ -> Logic.ifElse (Equality.equal x v) (Flows.pure (Lists.reverse acc_)) (go acc_))))))+ let go = (\acc -> + let succeed = (\st -> + let x = (Lists.head (Topology.tarjanStateStack st))+ in + let xs = (Lists.tail (Topology.tarjanStateStack st))+ in + let newSt = Topology.TarjanState {+ Topology.tarjanStateCounter = (Topology.tarjanStateCounter st),+ Topology.tarjanStateIndices = (Topology.tarjanStateIndices st),+ Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks st),+ Topology.tarjanStateStack = xs,+ Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack st),+ Topology.tarjanStateSccs = (Topology.tarjanStateSccs st)}+ in + let newSt2 = Topology.TarjanState {+ Topology.tarjanStateCounter = (Topology.tarjanStateCounter newSt),+ Topology.tarjanStateIndices = (Topology.tarjanStateIndices newSt),+ Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks newSt),+ Topology.tarjanStateStack = (Topology.tarjanStateStack newSt),+ Topology.tarjanStateOnStack = (Sets.delete x (Topology.tarjanStateOnStack st)),+ Topology.tarjanStateSccs = (Topology.tarjanStateSccs newSt)}+ in + let acc_ = (Lists.cons x acc)+ in (Flows.bind (Monads.putState newSt2) (\_ -> Logic.ifElse (Equality.equal x v) (Flows.pure (Lists.reverse acc_)) (go acc_))))+ in (Flows.bind Monads.getState (\st -> Logic.ifElse (Lists.null (Topology.tarjanStateStack st)) (Flows.fail "popStackUntil: empty stack") (succeed st)))) in (go []) -- | Visit a vertex and recursively explore its successors strongConnect :: (M.Map Int [Int] -> Int -> Compute.Flow Topology.TarjanState ()) strongConnect graph v = (Flows.bind Monads.getState (\st -> - let i = (Topology.tarjanStateCounter st) - newSt = Topology.TarjanState {- Topology.tarjanStateCounter = (Math.add i 1),- Topology.tarjanStateIndices = (Maps.insert v i (Topology.tarjanStateIndices st)),- Topology.tarjanStateLowLinks = (Maps.insert v i (Topology.tarjanStateLowLinks st)),- Topology.tarjanStateStack = (Lists.cons v (Topology.tarjanStateStack st)),- Topology.tarjanStateOnStack = (Sets.insert v (Topology.tarjanStateOnStack st)),- Topology.tarjanStateSccs = (Topology.tarjanStateSccs st)}- neighbors = (Maps.findWithDefault [] v graph)- processNeighbor = (\w -> Flows.bind Monads.getState (\st_ -> Logic.ifElse (Logic.not (Maps.member w (Topology.tarjanStateIndices st_))) (Flows.bind (strongConnect graph w) (\_ -> Flows.bind Monads.getState (\stAfter -> - let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks stAfter)) - low_w = (Maps.findWithDefault Constants.maxInt32 w (Topology.tarjanStateLowLinks stAfter))- in (Flows.bind (Monads.modify (\s -> Topology.TarjanState {- Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),- Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),- Topology.tarjanStateLowLinks = (Maps.insert v (Equality.min low_v low_w) (Topology.tarjanStateLowLinks s)),- Topology.tarjanStateStack = (Topology.tarjanStateStack s),- Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),- Topology.tarjanStateSccs = (Topology.tarjanStateSccs s)})) (\_ -> Flows.pure ()))))) (Logic.ifElse (Sets.member w (Topology.tarjanStateOnStack st_)) ( - let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks st_)) - idx_w = (Maps.findWithDefault Constants.maxInt32 w (Topology.tarjanStateIndices st_))- in (Flows.bind (Monads.modify (\s -> Topology.TarjanState {- Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),- Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),- Topology.tarjanStateLowLinks = (Maps.insert v (Equality.min low_v idx_w) (Topology.tarjanStateLowLinks s)),- Topology.tarjanStateStack = (Topology.tarjanStateStack s),- Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),- Topology.tarjanStateSccs = (Topology.tarjanStateSccs s)})) (\_ -> Flows.pure ()))) (Flows.pure ()))))- in (Flows.bind (Monads.putState newSt) (\_ -> Flows.bind (Flows.mapList processNeighbor neighbors) (\_ -> Flows.bind Monads.getState (\stFinal -> - let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks stFinal)) - idx_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateIndices stFinal))- in (Logic.ifElse (Equality.equal low_v idx_v) (Flows.bind (popStackUntil v) (\comp -> Flows.bind (Monads.modify (\s -> Topology.TarjanState {- Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),- Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),- Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks s),- Topology.tarjanStateStack = (Topology.tarjanStateStack s),- Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),- Topology.tarjanStateSccs = (Lists.cons comp (Topology.tarjanStateSccs s))})) (\_ -> Flows.pure ()))) (Flows.pure ()))))))))+ let i = (Topology.tarjanStateCounter st)+ in + let newSt = Topology.TarjanState {+ Topology.tarjanStateCounter = (Math.add i 1),+ Topology.tarjanStateIndices = (Maps.insert v i (Topology.tarjanStateIndices st)),+ Topology.tarjanStateLowLinks = (Maps.insert v i (Topology.tarjanStateLowLinks st)),+ Topology.tarjanStateStack = (Lists.cons v (Topology.tarjanStateStack st)),+ Topology.tarjanStateOnStack = (Sets.insert v (Topology.tarjanStateOnStack st)),+ Topology.tarjanStateSccs = (Topology.tarjanStateSccs st)}+ in + let neighbors = (Maps.findWithDefault [] v graph)+ in + let processNeighbor = (\w -> + let lowLink = (\st_ -> + let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks st_))+ in + let idx_w = (Maps.findWithDefault Constants.maxInt32 w (Topology.tarjanStateIndices st_))+ in (Flows.bind (Monads.modify (\s -> Topology.TarjanState {+ Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),+ Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),+ Topology.tarjanStateLowLinks = (Maps.insert v (Equality.min low_v idx_w) (Topology.tarjanStateLowLinks s)),+ Topology.tarjanStateStack = (Topology.tarjanStateStack s),+ Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),+ Topology.tarjanStateSccs = (Topology.tarjanStateSccs s)})) (\_ -> Flows.pure ())))+ in (Flows.bind Monads.getState (\st_ -> Logic.ifElse (Logic.not (Maps.member w (Topology.tarjanStateIndices st_))) (Flows.bind (strongConnect graph w) (\_ -> Flows.bind Monads.getState (\stAfter -> + let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks stAfter))+ in + let low_w = (Maps.findWithDefault Constants.maxInt32 w (Topology.tarjanStateLowLinks stAfter))+ in (Flows.bind (Monads.modify (\s -> Topology.TarjanState {+ Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),+ Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),+ Topology.tarjanStateLowLinks = (Maps.insert v (Equality.min low_v low_w) (Topology.tarjanStateLowLinks s)),+ Topology.tarjanStateStack = (Topology.tarjanStateStack s),+ Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),+ Topology.tarjanStateSccs = (Topology.tarjanStateSccs s)})) (\_ -> Flows.pure ()))))) (Logic.ifElse (Sets.member w (Topology.tarjanStateOnStack st_)) (lowLink st_) (Flows.pure ())))))+ in (Flows.bind (Monads.putState newSt) (\_ -> Flows.bind (Flows.mapList processNeighbor neighbors) (\_ -> Flows.bind Monads.getState (\stFinal -> + let low_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateLowLinks stFinal))+ in + let idx_v = (Maps.findWithDefault Constants.maxInt32 v (Topology.tarjanStateIndices stFinal))+ in (Logic.ifElse (Equality.equal low_v idx_v) (Flows.bind (popStackUntil v) (\comp -> Flows.bind (Monads.modify (\s -> Topology.TarjanState {+ Topology.tarjanStateCounter = (Topology.tarjanStateCounter s),+ Topology.tarjanStateIndices = (Topology.tarjanStateIndices s),+ Topology.tarjanStateLowLinks = (Topology.tarjanStateLowLinks s),+ Topology.tarjanStateStack = (Topology.tarjanStateStack s),+ Topology.tarjanStateOnStack = (Topology.tarjanStateOnStack s),+ Topology.tarjanStateSccs = (Lists.cons comp (Topology.tarjanStateSccs s))})) (\_ -> Flows.pure ()))) (Flows.pure ()))))))))
src/gen-main/haskell/Hydra/Templates.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A utility which instantiates a nonrecursive type with default values module Hydra.Templates where@@ -9,11 +11,14 @@ import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Monads as Monads import qualified Hydra.Show.Core as Core__-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M@@ -22,62 +27,72 @@ -- | Create a graph schema from a graph which contains nothing but encoded type definitions graphToSchema :: (Graph.Graph -> Compute.Flow Graph.Graph (M.Map Core.Name Core.Type)) graphToSchema g = - let toPair = (\nameAndEl -> - let name = (fst nameAndEl) - el = (snd nameAndEl)- in (Flows.bind (Core_.type_ (Core.bindingTerm el)) (\t -> Flows.pure (name, t))))- in (Flows.bind (Flows.mapList toPair (Maps.toList (Graph.graphElements g))) (\pairs -> Flows.pure (Maps.fromList pairs)))+ let toPair = (\el -> + let name = (Core.bindingName el)+ in (Flows.bind Monads.getState (\cx -> Flows.bind (Monads.withTrace "graph to schema" (Monads.eitherToFlow Util.unDecodingError (Core_.type_ cx (Core.bindingTerm el)))) (\t -> Flows.pure (name, t)))))+ in (Flows.bind (Flows.mapList toPair (Graph.graphElements g)) (\pairs -> Flows.pure (Maps.fromList pairs))) +-- | Given a graph schema and a nonrecursive type, instantiate it with default values. If the minimal flag is set, the smallest possible term is produced; otherwise, exactly one subterm is produced for constructors which do not otherwise require one, e.g. in lists and optionals instantiateTemplate :: (Bool -> M.Map Core.Name Core.Type -> Core.Type -> Compute.Flow t0 Core.Term) instantiateTemplate minimal schema t = - let inst = (instantiateTemplate minimal schema) - noPoly = (Flows.fail "Polymorphic and function types are not currently supported")- in ((\x -> case x of- Core.TypeAnnotated v1 -> (inst (Core.annotatedTypeSubject v1))- Core.TypeApplication _ -> noPoly- Core.TypeFunction _ -> noPoly- Core.TypeForall _ -> noPoly- Core.TypeList v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermList [])) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermList [- e]))))- Core.TypeLiteral v1 -> (Flows.pure (Core.TermLiteral ((\x -> case x of- Core.LiteralTypeBinary -> (Core.LiteralString "")- Core.LiteralTypeBoolean -> (Core.LiteralBoolean False)- Core.LiteralTypeInteger v2 -> (Core.LiteralInteger ((\x -> case x of- Core.IntegerTypeBigint -> (Core.IntegerValueBigint 0)- Core.IntegerTypeInt8 -> (Core.IntegerValueInt8 0)- Core.IntegerTypeInt16 -> (Core.IntegerValueInt16 0)- Core.IntegerTypeInt32 -> (Core.IntegerValueInt32 0)- Core.IntegerTypeInt64 -> (Core.IntegerValueInt64 0)- Core.IntegerTypeUint8 -> (Core.IntegerValueUint8 0)- Core.IntegerTypeUint16 -> (Core.IntegerValueUint16 0)- Core.IntegerTypeUint32 -> (Core.IntegerValueUint32 0)- Core.IntegerTypeUint64 -> (Core.IntegerValueUint64 0)) v2))- Core.LiteralTypeFloat v2 -> (Core.LiteralFloat ((\x -> case x of- Core.FloatTypeBigfloat -> (Core.FloatValueBigfloat 0.0)- Core.FloatTypeFloat32 -> (Core.FloatValueFloat32 0.0)- Core.FloatTypeFloat64 -> (Core.FloatValueFloat64 0.0)) v2))- Core.LiteralTypeString -> (Core.LiteralString "")) v1)))- Core.TypeMap v1 -> - let kt = (Core.mapTypeKeys v1) - vt = (Core.mapTypeValues v1)- in (Logic.ifElse minimal (Flows.pure (Core.TermMap Maps.empty)) (Flows.bind (inst kt) (\ke -> Flows.bind (inst vt) (\ve -> Flows.pure (Core.TermMap (Maps.singleton ke ve))))))- Core.TypeOptional v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermOptional Nothing)) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermOptional (Just e)))))- Core.TypeProduct v1 -> (Flows.bind (Flows.mapList inst v1) (\es -> Flows.pure (Core.TermProduct es)))- Core.TypeRecord v1 -> - let tname = (Core.rowTypeTypeName v1) - fields = (Core.rowTypeFields v1)- toField = (\ft -> Flows.bind (inst (Core.fieldTypeType ft)) (\e -> Flows.pure (Core.Field {- Core.fieldName = (Core.fieldTypeName ft),- Core.fieldTerm = e})))- in (Flows.bind (Flows.mapList toField fields) (\dfields -> Flows.pure (Core.TermRecord (Core.Record {- Core.recordTypeName = tname,- Core.recordFields = dfields}))))- Core.TypeSet v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermSet Sets.empty)) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermSet (Sets.fromList [- e])))))- Core.TypeVariable v1 -> (Optionals.maybe (Flows.fail (Strings.cat2 "Type variable " (Strings.cat2 (Core__.term (Core.TermVariable v1)) " not found in schema"))) inst (Maps.lookup v1 schema))- Core.TypeWrap v1 -> - let tname = (Core.wrappedTypeTypeName v1) - t_ = (Core.wrappedTypeObject v1)- in (Flows.bind (inst t_) (\e -> Flows.pure (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = tname,- Core.wrappedTermObject = e}))))) t)+ let inst = (instantiateTemplate minimal schema)+ in + let noPoly = (Flows.fail "Polymorphic and function types are not currently supported")+ in + let forFloat = (\ft -> (\x -> case x of+ Core.FloatTypeBigfloat -> (Core.FloatValueBigfloat 0.0)+ Core.FloatTypeFloat32 -> (Core.FloatValueFloat32 0.0)+ Core.FloatTypeFloat64 -> (Core.FloatValueFloat64 0.0)) ft)+ in + let forInteger = (\it -> (\x -> case x of+ Core.IntegerTypeBigint -> (Core.IntegerValueBigint 0)+ Core.IntegerTypeInt8 -> (Core.IntegerValueInt8 0)+ Core.IntegerTypeInt16 -> (Core.IntegerValueInt16 0)+ Core.IntegerTypeInt32 -> (Core.IntegerValueInt32 0)+ Core.IntegerTypeInt64 -> (Core.IntegerValueInt64 0)+ Core.IntegerTypeUint8 -> (Core.IntegerValueUint8 0)+ Core.IntegerTypeUint16 -> (Core.IntegerValueUint16 0)+ Core.IntegerTypeUint32 -> (Core.IntegerValueUint32 0)+ Core.IntegerTypeUint64 -> (Core.IntegerValueUint64 0)) it)+ in + let forLiteral = (\lt -> (\x -> case x of+ Core.LiteralTypeBinary -> (Core.LiteralString "")+ Core.LiteralTypeBoolean -> (Core.LiteralBoolean False)+ Core.LiteralTypeInteger v1 -> (Core.LiteralInteger (forInteger v1))+ Core.LiteralTypeFloat v1 -> (Core.LiteralFloat (forFloat v1))+ Core.LiteralTypeString -> (Core.LiteralString "")) lt)+ in ((\x -> case x of+ Core.TypeAnnotated v1 -> (inst (Core.annotatedTypeBody v1))+ Core.TypeApplication _ -> noPoly+ Core.TypeFunction _ -> noPoly+ Core.TypeForall _ -> noPoly+ Core.TypeList v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermList [])) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermList [+ e]))))+ Core.TypeLiteral v1 -> (Flows.pure (Core.TermLiteral (forLiteral v1)))+ Core.TypeMap v1 -> + let kt = (Core.mapTypeKeys v1)+ in + let vt = (Core.mapTypeValues v1)+ in (Logic.ifElse minimal (Flows.pure (Core.TermMap Maps.empty)) (Flows.bind (inst kt) (\ke -> Flows.bind (inst vt) (\ve -> Flows.pure (Core.TermMap (Maps.singleton ke ve))))))+ Core.TypeMaybe v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermMaybe Nothing)) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermMaybe (Just e)))))+ Core.TypeRecord v1 -> + let tname = (Core.rowTypeTypeName v1)+ in + let fields = (Core.rowTypeFields v1)+ in + let toField = (\ft -> Flows.bind (inst (Core.fieldTypeType ft)) (\e -> Flows.pure (Core.Field {+ Core.fieldName = (Core.fieldTypeName ft),+ Core.fieldTerm = e})))+ in (Flows.bind (Flows.mapList toField fields) (\dfields -> Flows.pure (Core.TermRecord (Core.Record {+ Core.recordTypeName = tname,+ Core.recordFields = dfields}))))+ Core.TypeSet v1 -> (Logic.ifElse minimal (Flows.pure (Core.TermSet Sets.empty)) (Flows.bind (inst v1) (\e -> Flows.pure (Core.TermSet (Sets.fromList [+ e])))))+ Core.TypeVariable v1 -> (Maybes.maybe (Flows.fail (Strings.cat2 "Type variable " (Strings.cat2 (Core__.term (Core.TermVariable v1)) " not found in schema"))) inst (Maps.lookup v1 schema))+ Core.TypeWrap v1 -> + let tname = (Core.wrappedTypeTypeName v1)+ in + let t_ = (Core.wrappedTypeBody v1)+ in (Flows.bind (inst t_) (\e -> Flows.pure (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = tname,+ Core.wrappedTermBody = e}))))) t)
src/gen-main/haskell/Hydra/Testing.hs view
@@ -1,15 +1,49 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for unit testing module Hydra.Testing where +import qualified Hydra.Ast as Ast+import qualified Hydra.Coders as Coders+import qualified Hydra.Compute as Compute import qualified Hydra.Core as Core-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Graph as Graph+import qualified Hydra.Json.Model as Model+import qualified Hydra.Module as Module+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Typing as Typing+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | A test case which performs alpha conversion (variable renaming) on a term and compares the result with the expected term+data AlphaConversionTestCase = + AlphaConversionTestCase {+ -- | The term on which to perform alpha conversion+ alphaConversionTestCaseTerm :: Core.Term,+ -- | The variable name to replace+ alphaConversionTestCaseOldVariable :: Core.Name,+ -- | The new variable name+ alphaConversionTestCaseNewVariable :: Core.Name,+ -- | The expected result term after alpha conversion+ alphaConversionTestCaseResult :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_AlphaConversionTestCase = (Core.Name "hydra.testing.AlphaConversionTestCase")++_AlphaConversionTestCase_term = (Core.Name "term")++_AlphaConversionTestCase_oldVariable = (Core.Name "oldVariable")++_AlphaConversionTestCase_newVariable = (Core.Name "newVariable")++_AlphaConversionTestCase_result = (Core.Name "result")+ -- | One of two evaluation styles: eager or lazy data EvaluationStyle = EvaluationStyleEager |@@ -25,9 +59,13 @@ -- | A test case which checks that strings are converted between different case conventions correctly data CaseConversionTestCase = CaseConversionTestCase {- caseConversionTestCaseFromConvention :: Mantle.CaseConvention,- caseConversionTestCaseToConvention :: Mantle.CaseConvention,+ -- | The source case convention+ caseConversionTestCaseFromConvention :: Util.CaseConvention,+ -- | The target case convention+ caseConversionTestCaseToConvention :: Util.CaseConvention,+ -- | The input string caseConversionTestCaseFromString :: String,+ -- | The expected output string caseConversionTestCaseToString :: String} deriving (Eq, Ord, Read, Show) @@ -41,11 +79,293 @@ _CaseConversionTestCase_toString = (Core.Name "toString") +-- | A test case in which we delegate evaluation of an input term and an expected output term to a target programming language like Haskell, Java, or Python, checking whether the term evaluates as expected when translated into that language+data DelegatedEvaluationTestCase = + DelegatedEvaluationTestCase {+ -- | The first of two terms which should evaluate to the same expression+ delegatedEvaluationTestCaseInput :: Core.Term,+ -- | The second of two terms which should evaluate to the same expression+ delegatedEvaluationTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_DelegatedEvaluationTestCase = (Core.Name "hydra.testing.DelegatedEvaluationTestCase")++_DelegatedEvaluationTestCase_input = (Core.Name "input")++_DelegatedEvaluationTestCase_output = (Core.Name "output")++-- | A test case which performs eta expansion (adding missing lambda abstractions) on a given term and compares the result with the expected result+data EtaExpansionTestCase = + EtaExpansionTestCase {+ -- | The term to eta expand+ etaExpansionTestCaseInput :: Core.Term,+ -- | The expected result+ etaExpansionTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_EtaExpansionTestCase = (Core.Name "hydra.testing.EtaExpansionTestCase")++_EtaExpansionTestCase_input = (Core.Name "input")++_EtaExpansionTestCase_output = (Core.Name "output")++-- | A test case which strips all annotations from a term and compares the result with the expected term+data DeannotateTermTestCase = + DeannotateTermTestCase {+ -- | The term to deannotate+ deannotateTermTestCaseInput :: Core.Term,+ -- | The expected deannotated term+ deannotateTermTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_DeannotateTermTestCase = (Core.Name "hydra.testing.DeannotateTermTestCase")++_DeannotateTermTestCase_input = (Core.Name "input")++_DeannotateTermTestCase_output = (Core.Name "output")++-- | A test case which strips all annotations from a type and compares the result with the expected type+data DeannotateTypeTestCase = + DeannotateTypeTestCase {+ -- | The type to deannotate+ deannotateTypeTestCaseInput :: Core.Type,+ -- | The expected deannotated type+ deannotateTypeTestCaseOutput :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_DeannotateTypeTestCase = (Core.Name "hydra.testing.DeannotateTypeTestCase")++_DeannotateTypeTestCase_input = (Core.Name "input")++_DeannotateTypeTestCase_output = (Core.Name "output")++-- | A test case which flattens nested let terms, lifting inner bindings to the outer let, and compares the result with the expected term+data FlattenLetTermsTestCase = + FlattenLetTermsTestCase {+ -- | The term to flatten+ flattenLetTermsTestCaseInput :: Core.Term,+ -- | The expected flattened term+ flattenLetTermsTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_FlattenLetTermsTestCase = (Core.Name "hydra.testing.FlattenLetTermsTestCase")++_FlattenLetTermsTestCase_input = (Core.Name "input")++_FlattenLetTermsTestCase_output = (Core.Name "output")++-- | A predefined fold operation for testing foldOverTerm+data FoldOperation = + -- | Sum all Int32 literals in a term+ FoldOperationSumInt32Literals |+ -- | Collect the lengths of all list terms (returns list of integers in traversal order)+ FoldOperationCollectListLengths |+ -- | Collect labels (first element of pairs where first is a string literal)+ FoldOperationCollectLabels + deriving (Eq, Ord, Read, Show)++_FoldOperation = (Core.Name "hydra.testing.FoldOperation")++_FoldOperation_sumInt32Literals = (Core.Name "sumInt32Literals")++_FoldOperation_collectListLengths = (Core.Name "collectListLengths")++_FoldOperation_collectLabels = (Core.Name "collectLabels")++-- | A test case which applies a fold operation over a term and compares the result+data FoldOverTermTestCase = + FoldOverTermTestCase {+ -- | The term to fold over+ foldOverTermTestCaseInput :: Core.Term,+ -- | The traversal order (pre or post)+ foldOverTermTestCaseTraversalOrder :: Coders.TraversalOrder,+ -- | The fold operation to apply+ foldOverTermTestCaseOperation :: FoldOperation,+ -- | The expected result of the fold+ foldOverTermTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_FoldOverTermTestCase = (Core.Name "hydra.testing.FoldOverTermTestCase")++_FoldOverTermTestCase_input = (Core.Name "input")++_FoldOverTermTestCase_traversalOrder = (Core.Name "traversalOrder")++_FoldOverTermTestCase_operation = (Core.Name "operation")++_FoldOverTermTestCase_output = (Core.Name "output")++-- | A test case which computes the free variables of a term and compares the result with an expected set of names+data FreeVariablesTestCase = + FreeVariablesTestCase {+ -- | The term to analyze+ freeVariablesTestCaseInput :: Core.Term,+ -- | The expected set of free variable names+ freeVariablesTestCaseOutput :: (S.Set Core.Name)}+ deriving (Eq, Ord, Read, Show)++_FreeVariablesTestCase = (Core.Name "hydra.testing.FreeVariablesTestCase")++_FreeVariablesTestCase_input = (Core.Name "input")++_FreeVariablesTestCase_output = (Core.Name "output")++-- | A predefined predicate for testing hoistSubterms. Each predicate determines which subterms should be hoisted into let bindings.+data HoistPredicate = + -- | Hoist case statements (elimination unions) that appear in non-top-level positions+ HoistPredicateCaseStatements |+ -- | Hoist function applications that appear in non-top-level positions+ HoistPredicateApplications |+ -- | Hoist list terms that appear in non-top-level positions+ HoistPredicateLists |+ -- | Never hoist anything (identity transformation for let terms)+ HoistPredicateNothing + deriving (Eq, Ord, Read, Show)++_HoistPredicate = (Core.Name "hydra.testing.HoistPredicate")++_HoistPredicate_caseStatements = (Core.Name "caseStatements")++_HoistPredicate_applications = (Core.Name "applications")++_HoistPredicate_lists = (Core.Name "lists")++_HoistPredicate_nothing = (Core.Name "nothing")++-- | A test case for hoistLetBindings with hoistAll=True, which hoists ALL nested let bindings to the top level of a let term, not just polymorphic ones. This is used for targets like Java that cannot have let expressions in arbitrary positions.+data HoistLetBindingsTestCase = + HoistLetBindingsTestCase {+ -- | The input let term+ hoistLetBindingsTestCaseInput :: Core.Let,+ -- | The expected output let term with all nested bindings hoisted to top+ hoistLetBindingsTestCaseOutput :: Core.Let}+ deriving (Eq, Ord, Read, Show)++_HoistLetBindingsTestCase = (Core.Name "hydra.testing.HoistLetBindingsTestCase")++_HoistLetBindingsTestCase_input = (Core.Name "input")++_HoistLetBindingsTestCase_output = (Core.Name "output")++-- | A test case for the hoistPolymorphicLetBindings function, which hoists polymorphic let bindings to the top level of a let term. This is used for targets like Java which don't support polymorphic lambdas.+data HoistPolymorphicLetBindingsTestCase = + HoistPolymorphicLetBindingsTestCase {+ -- | The input let term+ hoistPolymorphicLetBindingsTestCaseInput :: Core.Let,+ -- | The expected output let term with polymorphic bindings hoisted to top+ hoistPolymorphicLetBindingsTestCaseOutput :: Core.Let}+ deriving (Eq, Ord, Read, Show)++_HoistPolymorphicLetBindingsTestCase = (Core.Name "hydra.testing.HoistPolymorphicLetBindingsTestCase")++_HoistPolymorphicLetBindingsTestCase_input = (Core.Name "input")++_HoistPolymorphicLetBindingsTestCase_output = (Core.Name "output")++-- | A test case which hoists subterms into let bindings based on a predicate, and compares the result with the expected term. The predicate decides which subterms at which positions should be extracted into new bindings.+data HoistSubtermsTestCase = + HoistSubtermsTestCase {+ -- | The predicate that determines which subterms to hoist+ hoistSubtermsTestCasePredicate :: HoistPredicate,+ -- | The input term (must contain a let expression for hoisting to occur)+ hoistSubtermsTestCaseInput :: Core.Term,+ -- | The expected output term with hoisted subterms as new bindings+ hoistSubtermsTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_HoistSubtermsTestCase = (Core.Name "hydra.testing.HoistSubtermsTestCase")++_HoistSubtermsTestCase_predicate = (Core.Name "predicate")++_HoistSubtermsTestCase_input = (Core.Name "input")++_HoistSubtermsTestCase_output = (Core.Name "output")++-- | A test case for the hoistCaseStatements function, which hoists case statements into let bindings, but only when they appear inside a lambda body. This is used for targets like Python which don't support inline match expressions.+data HoistCaseStatementsTestCase = + HoistCaseStatementsTestCase {+ -- | The input term+ hoistCaseStatementsTestCaseInput :: Core.Term,+ -- | The expected output term with hoisted case statements+ hoistCaseStatementsTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_HoistCaseStatementsTestCase = (Core.Name "hydra.testing.HoistCaseStatementsTestCase")++_HoistCaseStatementsTestCase_input = (Core.Name "input")++_HoistCaseStatementsTestCase_output = (Core.Name "output")++-- | A predefined term rewriter for testing rewriteTerm+data TermRewriter = + -- | Replace all string literal 'foo' with 'bar'+ TermRewriterReplaceFooWithBar |+ -- | Replace all Int32 literals with Int64 literals of the same value+ TermRewriterReplaceInt32WithInt64 + deriving (Eq, Ord, Read, Show)++_TermRewriter = (Core.Name "hydra.testing.TermRewriter")++_TermRewriter_replaceFooWithBar = (Core.Name "replaceFooWithBar")++_TermRewriter_replaceInt32WithInt64 = (Core.Name "replaceInt32WithInt64")++-- | A test case which applies a term rewriter and compares the result+data RewriteTermTestCase = + RewriteTermTestCase {+ -- | The term to rewrite+ rewriteTermTestCaseInput :: Core.Term,+ -- | The rewriter to apply+ rewriteTermTestCaseRewriter :: TermRewriter,+ -- | The expected rewritten term+ rewriteTermTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_RewriteTermTestCase = (Core.Name "hydra.testing.RewriteTermTestCase")++_RewriteTermTestCase_input = (Core.Name "input")++_RewriteTermTestCase_rewriter = (Core.Name "rewriter")++_RewriteTermTestCase_output = (Core.Name "output")++-- | A predefined type rewriter for testing rewriteType+data TypeRewriter = + -- | Replace all String types with Int32 types+ TypeRewriterReplaceStringWithInt32 + deriving (Eq, Ord, Read, Show)++_TypeRewriter = (Core.Name "hydra.testing.TypeRewriter")++_TypeRewriter_replaceStringWithInt32 = (Core.Name "replaceStringWithInt32")++-- | A test case which applies a type rewriter and compares the result+data RewriteTypeTestCase = + RewriteTypeTestCase {+ -- | The type to rewrite+ rewriteTypeTestCaseInput :: Core.Type,+ -- | The rewriter to apply+ rewriteTypeTestCaseRewriter :: TypeRewriter,+ -- | The expected rewritten type+ rewriteTypeTestCaseOutput :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_RewriteTypeTestCase = (Core.Name "hydra.testing.RewriteTypeTestCase")++_RewriteTypeTestCase_input = (Core.Name "input")++_RewriteTypeTestCase_rewriter = (Core.Name "rewriter")++_RewriteTypeTestCase_output = (Core.Name "output")+ -- | A test case which evaluates (reduces) a given term and compares it with the expected result data EvaluationTestCase = EvaluationTestCase {+ -- | The evaluation style (eager or lazy) evaluationTestCaseEvaluationStyle :: EvaluationStyle,+ -- | The term to evaluate evaluationTestCaseInput :: Core.Term,+ -- | The expected result evaluationTestCaseOutput :: Core.Term} deriving (Eq, Ord, Read, Show) @@ -60,6 +380,7 @@ -- | A test case providing a term for which type inference is expected to fail data InferenceFailureTestCase = InferenceFailureTestCase {+ -- | The term for which inference should fail inferenceFailureTestCaseInput :: Core.Term} deriving (Eq, Ord, Read, Show) @@ -70,7 +391,9 @@ -- | A test case which performs type inference on a given term and compares the result with an expected type scheme data InferenceTestCase = InferenceTestCase {+ -- | The term to infer inferenceTestCaseInput :: Core.Term,+ -- | The expected type scheme inferenceTestCaseOutput :: Core.TypeScheme} deriving (Eq, Ord, Read, Show) @@ -80,6 +403,115 @@ _InferenceTestCase_output = (Core.Name "output") +-- | A test case which encodes a Hydra term to JSON using a type-directed coder, and verifies that decoding produces the original term (round-trip)+data JsonCoderTestCase = + JsonCoderTestCase {+ -- | The Hydra type that determines how the term is encoded/decoded+ jsonCoderTestCaseType :: Core.Type,+ -- | The Hydra term to encode+ jsonCoderTestCaseTerm :: Core.Term,+ -- | The expected JSON value+ jsonCoderTestCaseJson :: Model.Value}+ deriving (Eq, Ord, Read, Show)++_JsonCoderTestCase = (Core.Name "hydra.testing.JsonCoderTestCase")++_JsonCoderTestCase_type = (Core.Name "type")++_JsonCoderTestCase_term = (Core.Name "term")++_JsonCoderTestCase_json = (Core.Name "json")++-- | A test case for the Either-based JSON decoder. Takes a type, input JSON, and expected result (Either String Term).+data JsonDecodeTestCase = + JsonDecodeTestCase {+ -- | The Hydra type to decode into+ jsonDecodeTestCaseType :: Core.Type,+ -- | The input JSON value+ jsonDecodeTestCaseJson :: Model.Value,+ -- | The expected result: Left for error, Right for decoded term+ jsonDecodeTestCaseExpected :: (Either String Core.Term)}+ deriving (Eq, Ord, Read, Show)++_JsonDecodeTestCase = (Core.Name "hydra.testing.JsonDecodeTestCase")++_JsonDecodeTestCase_type = (Core.Name "type")++_JsonDecodeTestCase_json = (Core.Name "json")++_JsonDecodeTestCase_expected = (Core.Name "expected")++-- | A test case for the Either-based JSON encoder. Takes an input term and expected result (Either String Value).+data JsonEncodeTestCase = + JsonEncodeTestCase {+ -- | The Hydra term to encode+ jsonEncodeTestCaseTerm :: Core.Term,+ -- | The expected result: Left for error, Right for encoded JSON+ jsonEncodeTestCaseExpected :: (Either String Model.Value)}+ deriving (Eq, Ord, Read, Show)++_JsonEncodeTestCase = (Core.Name "hydra.testing.JsonEncodeTestCase")++_JsonEncodeTestCase_term = (Core.Name "term")++_JsonEncodeTestCase_expected = (Core.Name "expected")++-- | A test case which parses a JSON string and compares the result with an expected JSON value+type JsonParserTestCase = (ParserTestCase Model.Value)++_JsonParserTestCase = (Core.Name "hydra.testing.JsonParserTestCase")++-- | A test case for round-trip encoding/decoding using the Either-based JSON functions. Encodes a term, then decodes it back, verifying the result equals the original.+data JsonRoundtripTestCase = + JsonRoundtripTestCase {+ -- | The Hydra type for encoding/decoding+ jsonRoundtripTestCaseType :: Core.Type,+ -- | The Hydra term to round-trip+ jsonRoundtripTestCaseTerm :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_JsonRoundtripTestCase = (Core.Name "hydra.testing.JsonRoundtripTestCase")++_JsonRoundtripTestCase_type = (Core.Name "type")++_JsonRoundtripTestCase_term = (Core.Name "term")++-- | A test case which lifts lambda abstractions above let expressions and compares the result with the expected term+data LiftLambdaAboveLetTestCase = + LiftLambdaAboveLetTestCase {+ -- | The term to transform+ liftLambdaAboveLetTestCaseInput :: Core.Term,+ -- | The expected transformed term+ liftLambdaAboveLetTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_LiftLambdaAboveLetTestCase = (Core.Name "hydra.testing.LiftLambdaAboveLetTestCase")++_LiftLambdaAboveLetTestCase_input = (Core.Name "input")++_LiftLambdaAboveLetTestCase_output = (Core.Name "output")++-- | A test case which serializes a JSON value to a string and compares it to the expected string+type JsonWriterTestCase = (WriterTestCase Model.Value)++_JsonWriterTestCase = (Core.Name "hydra.testing.JsonWriterTestCase")++-- | A test case which parses an input string and compares the result with an expected value+data ParserTestCase a = + ParserTestCase {+ -- | The input string to parse+ parserTestCaseInput :: String,+ -- | The expected parse result+ parserTestCaseOutput :: (Parsing.ParseResult a)}+ deriving (Eq, Ord, Read, Show)++_ParserTestCase = (Core.Name "hydra.testing.ParserTestCase")++_ParserTestCase_input = (Core.Name "input")++_ParserTestCase_output = (Core.Name "output")++-- | A tag for categorizing test cases newtype Tag = Tag { unTag :: String}@@ -87,30 +519,228 @@ _Tag = (Core.Name "hydra.testing.Tag") +-- | A codec for generating compiled test files from test groups into a target programming language+data TestCodec = + TestCodec {+ -- | The name of the target programming language+ testCodecLanguage :: Coders.LanguageName,+ -- | The file extension for test files (e.g., 'hs', 'java', 'py')+ testCodecFileExtension :: Module.FileExtension,+ -- | A function for encoding Hydra terms into the target language+ testCodecEncodeTerm :: (Core.Term -> Compute.Flow Graph.Graph String),+ -- | A function for encoding Hydra types into the target language+ testCodecEncodeType :: (Core.Type -> Compute.Flow Graph.Graph String),+ -- | A function for formatting test case names according to the target language's conventions+ testCodecFormatTestName :: (String -> String),+ -- | A function for formatting module names according to the target language's conventions+ testCodecFormatModuleName :: (Module.Namespace -> String),+ -- | A template string for individual test case assertions+ testCodecTestCaseTemplate :: String,+ -- | A template string for wrapping a group of test cases+ testCodecTestGroupTemplate :: String,+ -- | A template string for the overall test module structure+ testCodecModuleTemplate :: String,+ -- | A template string for import/include statements+ testCodecImportTemplate :: String,+ -- | A function that determines the necessary imports for a given set of dependencies+ testCodecFindImports :: (S.Set Core.Name -> [String])}++_TestCodec = (Core.Name "hydra.testing.TestCodec")++_TestCodec_language = (Core.Name "language")++_TestCodec_fileExtension = (Core.Name "fileExtension")++_TestCodec_encodeTerm = (Core.Name "encodeTerm")++_TestCodec_encodeType = (Core.Name "encodeType")++_TestCodec_formatTestName = (Core.Name "formatTestName")++_TestCodec_formatModuleName = (Core.Name "formatModuleName")++_TestCodec_testCaseTemplate = (Core.Name "testCaseTemplate")++_TestCodec_testGroupTemplate = (Core.Name "testGroupTemplate")++_TestCodec_moduleTemplate = (Core.Name "moduleTemplate")++_TestCodec_importTemplate = (Core.Name "importTemplate")++_TestCodec_findImports = (Core.Name "findImports")+ -- | A simple test case with an input and an expected output data TestCase = + -- | An alpha conversion test+ TestCaseAlphaConversion AlphaConversionTestCase |+ -- | A case conversion test TestCaseCaseConversion CaseConversionTestCase |+ -- | A deannotate term test+ TestCaseDeannotateTerm DeannotateTermTestCase |+ -- | A deannotate type test+ TestCaseDeannotateType DeannotateTypeTestCase |+ -- | A delegated evaluation test+ TestCaseDelegatedEvaluation DelegatedEvaluationTestCase |+ -- | An eta expansion test+ TestCaseEtaExpansion EtaExpansionTestCase |+ -- | A flatten let terms test+ TestCaseFlattenLetTerms FlattenLetTermsTestCase |+ -- | A free variables test+ TestCaseFreeVariables FreeVariablesTestCase |+ -- | A term evaluation test TestCaseEvaluation EvaluationTestCase |+ -- | A type inference test TestCaseInference InferenceTestCase |- TestCaseInferenceFailure InferenceFailureTestCase+ -- | A type inference failure test+ TestCaseInferenceFailure InferenceFailureTestCase |+ -- | A JSON coder (round-trip) test using Flow-based coder+ TestCaseJsonCoder JsonCoderTestCase |+ -- | A JSON decode test using Either-based decoder+ TestCaseJsonDecode JsonDecodeTestCase |+ -- | A JSON encode test using Either-based encoder+ TestCaseJsonEncode JsonEncodeTestCase |+ -- | A JSON parser test+ TestCaseJsonParser JsonParserTestCase |+ -- | A JSON round-trip test using Either-based encoder/decoder+ TestCaseJsonRoundtrip JsonRoundtripTestCase |+ -- | A JSON writer test+ TestCaseJsonWriter JsonWriterTestCase |+ -- | A lift lambda above let test+ TestCaseLiftLambdaAboveLet LiftLambdaAboveLetTestCase |+ -- | An AST serialization test+ TestCaseSerialization SerializationTestCase |+ -- | A simplify term test+ TestCaseSimplifyTerm SimplifyTermTestCase |+ -- | A topological sort test+ TestCaseTopologicalSort TopologicalSortTestCase |+ -- | A topological sort bindings test+ TestCaseTopologicalSortBindings TopologicalSortBindingsTestCase |+ -- | A topological sort with SCC detection test+ TestCaseTopologicalSortSCC TopologicalSortSCCTestCase |+ -- | A type checking test+ TestCaseTypeChecking TypeCheckingTestCase |+ -- | A type checking failure test (currently unused)+ TestCaseTypeCheckingFailure TypeCheckingFailureTestCase |+ -- | A type reduction test+ TestCaseTypeReduction TypeReductionTestCase |+ -- | A normalize type variables test+ TestCaseNormalizeTypeVariables NormalizeTypeVariablesTestCase |+ -- | A fold over term test+ TestCaseFoldOverTerm FoldOverTermTestCase |+ -- | A rewrite term test+ TestCaseRewriteTerm RewriteTermTestCase |+ -- | A rewrite type test+ TestCaseRewriteType RewriteTypeTestCase |+ -- | A hoist subterms test+ TestCaseHoistSubterms HoistSubtermsTestCase |+ -- | A hoist case statements test+ TestCaseHoistCaseStatements HoistCaseStatementsTestCase |+ -- | A hoist all let bindings test (hoistAll=True, for Java)+ TestCaseHoistLetBindings HoistLetBindingsTestCase |+ -- | A hoist polymorphic let bindings test+ TestCaseHoistPolymorphicLetBindings HoistPolymorphicLetBindingsTestCase |+ -- | A type substitution test+ TestCaseSubstInType SubstInTypeTestCase |+ -- | An occur check test for type unification+ TestCaseVariableOccursInType VariableOccursInTypeTestCase |+ -- | A type unification test+ TestCaseUnifyTypes UnifyTypesTestCase |+ -- | A join types test (produce type constraints)+ TestCaseJoinTypes JoinTypesTestCase |+ -- | An unshadow variables test+ TestCaseUnshadowVariables UnshadowVariablesTestCase deriving (Eq, Ord, Read, Show) _TestCase = (Core.Name "hydra.testing.TestCase") +_TestCase_alphaConversion = (Core.Name "alphaConversion")+ _TestCase_caseConversion = (Core.Name "caseConversion") +_TestCase_deannotateTerm = (Core.Name "deannotateTerm")++_TestCase_deannotateType = (Core.Name "deannotateType")++_TestCase_delegatedEvaluation = (Core.Name "delegatedEvaluation")++_TestCase_etaExpansion = (Core.Name "etaExpansion")++_TestCase_flattenLetTerms = (Core.Name "flattenLetTerms")++_TestCase_freeVariables = (Core.Name "freeVariables")+ _TestCase_evaluation = (Core.Name "evaluation") _TestCase_inference = (Core.Name "inference") _TestCase_inferenceFailure = (Core.Name "inferenceFailure") +_TestCase_jsonCoder = (Core.Name "jsonCoder")++_TestCase_jsonDecode = (Core.Name "jsonDecode")++_TestCase_jsonEncode = (Core.Name "jsonEncode")++_TestCase_jsonParser = (Core.Name "jsonParser")++_TestCase_jsonRoundtrip = (Core.Name "jsonRoundtrip")++_TestCase_jsonWriter = (Core.Name "jsonWriter")++_TestCase_liftLambdaAboveLet = (Core.Name "liftLambdaAboveLet")++_TestCase_serialization = (Core.Name "serialization")++_TestCase_simplifyTerm = (Core.Name "simplifyTerm")++_TestCase_topologicalSort = (Core.Name "topologicalSort")++_TestCase_topologicalSortBindings = (Core.Name "topologicalSortBindings")++_TestCase_topologicalSortSCC = (Core.Name "topologicalSortSCC")++_TestCase_typeChecking = (Core.Name "typeChecking")++_TestCase_typeCheckingFailure = (Core.Name "typeCheckingFailure")++_TestCase_typeReduction = (Core.Name "typeReduction")++_TestCase_normalizeTypeVariables = (Core.Name "normalizeTypeVariables")++_TestCase_foldOverTerm = (Core.Name "foldOverTerm")++_TestCase_rewriteTerm = (Core.Name "rewriteTerm")++_TestCase_rewriteType = (Core.Name "rewriteType")++_TestCase_hoistSubterms = (Core.Name "hoistSubterms")++_TestCase_hoistCaseStatements = (Core.Name "hoistCaseStatements")++_TestCase_hoistLetBindings = (Core.Name "hoistLetBindings")++_TestCase_hoistPolymorphicLetBindings = (Core.Name "hoistPolymorphicLetBindings")++_TestCase_substInType = (Core.Name "substInType")++_TestCase_variableOccursInType = (Core.Name "variableOccursInType")++_TestCase_unifyTypes = (Core.Name "unifyTypes")++_TestCase_joinTypes = (Core.Name "joinTypes")++_TestCase_unshadowVariables = (Core.Name "unshadowVariables")+ -- | One of a number of test case variants, together with metadata including a test name, an optional description, and optional tags data TestCaseWithMetadata = TestCaseWithMetadata {+ -- | The name of the test case testCaseWithMetadataName :: String,+ -- | The test case itself testCaseWithMetadataCase :: TestCase,+ -- | An optional description of the test testCaseWithMetadataDescription :: (Maybe String),+ -- | Zero or more tags for categorizing the test testCaseWithMetadataTags :: [Tag]} deriving (Eq, Ord, Read, Show) @@ -127,9 +757,13 @@ -- | A collection of test cases with a name and optional description data TestGroup = TestGroup {+ -- | The name of the test group testGroupName :: String,+ -- | An optional description of the group testGroupDescription :: (Maybe String),+ -- | Nested test groups testGroupSubgroups :: [TestGroup],+ -- | The test cases in this group testGroupCases :: [TestCaseWithMetadata]} deriving (Eq, Ord, Read, Show) @@ -142,3 +776,248 @@ _TestGroup_subgroups = (Core.Name "subgroups") _TestGroup_cases = (Core.Name "cases")++-- | A test case which performs type checking on a given term and compares the result with an expected annotated term and type+data TypeCheckingTestCase = + TypeCheckingTestCase {+ -- | An untyped term on which to perform inference, then type check+ typeCheckingTestCaseInput :: Core.Term,+ -- | The expected fully annotated System F term after type inference+ typeCheckingTestCaseOutputTerm :: Core.Term,+ -- | The expected inferred type+ typeCheckingTestCaseOutputType :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_TypeCheckingTestCase = (Core.Name "hydra.testing.TypeCheckingTestCase")++_TypeCheckingTestCase_input = (Core.Name "input")++_TypeCheckingTestCase_outputTerm = (Core.Name "outputTerm")++_TypeCheckingTestCase_outputType = (Core.Name "outputType")++-- | A test case providing a term for which type checking is expected to fail. Note: there are currently no such test cases.+data TypeCheckingFailureTestCase = + TypeCheckingFailureTestCase {+ -- | The term for which type checking should fail+ typeCheckingFailureTestCaseInput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_TypeCheckingFailureTestCase = (Core.Name "hydra.testing.TypeCheckingFailureTestCase")++_TypeCheckingFailureTestCase_input = (Core.Name "input")++-- | A test case which performs topological sort on a map of bindings (name -> term) and compares the result with expected groups of bindings in topological order+data TopologicalSortBindingsTestCase = + TopologicalSortBindingsTestCase {+ -- | The bindings as a list of (name, term) pairs+ topologicalSortBindingsTestCaseBindings :: [(Core.Name, Core.Term)],+ -- | The expected groups of bindings in topological order+ topologicalSortBindingsTestCaseExpected :: [[(Core.Name, Core.Term)]]}+ deriving (Eq, Ord, Read, Show)++_TopologicalSortBindingsTestCase = (Core.Name "hydra.testing.TopologicalSortBindingsTestCase")++_TopologicalSortBindingsTestCase_bindings = (Core.Name "bindings")++_TopologicalSortBindingsTestCase_expected = (Core.Name "expected")++-- | A test case which performs topological sort on a directed graph and compares the result with either an expected sorted list or expected cycles+data TopologicalSortTestCase = + TopologicalSortTestCase {+ -- | The directed graph as an adjacency list (node to list of dependencies)+ topologicalSortTestCaseAdjacencyList :: [(Int, [Int])],+ -- | The expected result: Left for cycles, Right for sorted nodes+ topologicalSortTestCaseExpected :: (Either [[Int]] [Int])}+ deriving (Eq, Ord, Read, Show)++_TopologicalSortTestCase = (Core.Name "hydra.testing.TopologicalSortTestCase")++_TopologicalSortTestCase_adjacencyList = (Core.Name "adjacencyList")++_TopologicalSortTestCase_expected = (Core.Name "expected")++-- | A test case which performs topological sort with strongly connected component detection and compares the result with expected components+data TopologicalSortSCCTestCase = + TopologicalSortSCCTestCase {+ -- | The directed graph as an adjacency list+ topologicalSortSCCTestCaseAdjacencyList :: [(Int, [Int])],+ -- | The expected strongly connected components in topological order+ topologicalSortSCCTestCaseExpected :: [[Int]]}+ deriving (Eq, Ord, Read, Show)++_TopologicalSortSCCTestCase = (Core.Name "hydra.testing.TopologicalSortSCCTestCase")++_TopologicalSortSCCTestCase_adjacencyList = (Core.Name "adjacencyList")++_TopologicalSortSCCTestCase_expected = (Core.Name "expected")++-- | A test case which serializes an AST expression to a string and compares it with the expected output+data SerializationTestCase = + SerializationTestCase {+ -- | The AST expression to serialize+ serializationTestCaseInput :: Ast.Expr,+ -- | The expected serialized string+ serializationTestCaseOutput :: String}+ deriving (Eq, Ord, Read, Show)++_SerializationTestCase = (Core.Name "hydra.testing.SerializationTestCase")++_SerializationTestCase_input = (Core.Name "input")++_SerializationTestCase_output = (Core.Name "output")++-- | A test case which performs term simplification (beta reduction and optimization) and compares the result with the expected term+data SimplifyTermTestCase = + SimplifyTermTestCase {+ -- | The term to simplify+ simplifyTermTestCaseInput :: Core.Term,+ -- | The expected simplified term+ simplifyTermTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_SimplifyTermTestCase = (Core.Name "hydra.testing.SimplifyTermTestCase")++_SimplifyTermTestCase_input = (Core.Name "input")++_SimplifyTermTestCase_output = (Core.Name "output")++-- | A test case which normalizes type variables in a term (renaming them to t0, t1, t2, etc.) and compares the result with the expected term+data NormalizeTypeVariablesTestCase = + NormalizeTypeVariablesTestCase {+ -- | The term with type annotations to normalize+ normalizeTypeVariablesTestCaseInput :: Core.Term,+ -- | The expected term with normalized type variable names+ normalizeTypeVariablesTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_NormalizeTypeVariablesTestCase = (Core.Name "hydra.testing.NormalizeTypeVariablesTestCase")++_NormalizeTypeVariablesTestCase_input = (Core.Name "input")++_NormalizeTypeVariablesTestCase_output = (Core.Name "output")++-- | A test case which performs beta reduction on a type (reducing type applications) and compares the result with the expected type+data TypeReductionTestCase = + TypeReductionTestCase {+ -- | The type to reduce+ typeReductionTestCaseInput :: Core.Type,+ -- | The expected reduced type+ typeReductionTestCaseOutput :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_TypeReductionTestCase = (Core.Name "hydra.testing.TypeReductionTestCase")++_TypeReductionTestCase_input = (Core.Name "input")++_TypeReductionTestCase_output = (Core.Name "output")++-- | A test case which writes a value to a string and compares it to the expected string+data WriterTestCase a = + WriterTestCase {+ -- | The input value to write+ writerTestCaseInput :: a,+ -- | The expected string+ writerTestCaseOutput :: String}+ deriving (Eq, Ord, Read, Show)++_WriterTestCase = (Core.Name "hydra.testing.WriterTestCase")++_WriterTestCase_input = (Core.Name "input")++_WriterTestCase_output = (Core.Name "output")++-- | A test case which applies a type substitution to a type and compares the result. The substitution is provided as a list of (variable name, replacement type) pairs.+data SubstInTypeTestCase = + SubstInTypeTestCase {+ -- | The type substitution as a list of (name, type) pairs+ substInTypeTestCaseSubstitution :: [(Core.Name, Core.Type)],+ -- | The type to substitute into+ substInTypeTestCaseInput :: Core.Type,+ -- | The expected result type+ substInTypeTestCaseOutput :: Core.Type}+ deriving (Eq, Ord, Read, Show)++_SubstInTypeTestCase = (Core.Name "hydra.testing.SubstInTypeTestCase")++_SubstInTypeTestCase_substitution = (Core.Name "substitution")++_SubstInTypeTestCase_input = (Core.Name "input")++_SubstInTypeTestCase_output = (Core.Name "output")++-- | A test case which checks whether a type variable occurs in a type expression. This is the occur check used in type unification.+data VariableOccursInTypeTestCase = + VariableOccursInTypeTestCase {+ -- | The variable name to search for+ variableOccursInTypeTestCaseVariable :: Core.Name,+ -- | The type to search within+ variableOccursInTypeTestCaseType :: Core.Type,+ -- | Whether the variable occurs in the type+ variableOccursInTypeTestCaseExpected :: Bool}+ deriving (Eq, Ord, Read, Show)++_VariableOccursInTypeTestCase = (Core.Name "hydra.testing.VariableOccursInTypeTestCase")++_VariableOccursInTypeTestCase_variable = (Core.Name "variable")++_VariableOccursInTypeTestCase_type = (Core.Name "type")++_VariableOccursInTypeTestCase_expected = (Core.Name "expected")++-- | A test case which renames shadowed variables in a term and compares the result with the expected term+data UnshadowVariablesTestCase = + UnshadowVariablesTestCase {+ -- | The term with potentially shadowed variables+ unshadowVariablesTestCaseInput :: Core.Term,+ -- | The expected term after unshadowing+ unshadowVariablesTestCaseOutput :: Core.Term}+ deriving (Eq, Ord, Read, Show)++_UnshadowVariablesTestCase = (Core.Name "hydra.testing.UnshadowVariablesTestCase")++_UnshadowVariablesTestCase_input = (Core.Name "input")++_UnshadowVariablesTestCase_output = (Core.Name "output")++-- | A test case which attempts to unify two types and compares the result. The expected result is either Left (failure message substring) or Right (substitution).+data UnifyTypesTestCase = + UnifyTypesTestCase {+ -- | The schema types map (type variable names that should not be bound)+ unifyTypesTestCaseSchemaTypes :: [Core.Name],+ -- | The left type to unify+ unifyTypesTestCaseLeft :: Core.Type,+ -- | The right type to unify+ unifyTypesTestCaseRight :: Core.Type,+ -- | The expected result: Left for failure (substring of error), Right for substitution+ unifyTypesTestCaseExpected :: (Either String Typing.TypeSubst)}+ deriving (Eq, Ord, Read, Show)++_UnifyTypesTestCase = (Core.Name "hydra.testing.UnifyTypesTestCase")++_UnifyTypesTestCase_schemaTypes = (Core.Name "schemaTypes")++_UnifyTypesTestCase_left = (Core.Name "left")++_UnifyTypesTestCase_right = (Core.Name "right")++_UnifyTypesTestCase_expected = (Core.Name "expected")++-- | A test case which joins two types (producing type constraints or failing). The expected result is either Left (failure) or Right (list of constraints).+data JoinTypesTestCase = + JoinTypesTestCase {+ -- | The left type to join+ joinTypesTestCaseLeft :: Core.Type,+ -- | The right type to join+ joinTypesTestCaseRight :: Core.Type,+ -- | The expected result: Left for failure, Right for constraints+ joinTypesTestCaseExpected :: (Either () [Typing.TypeConstraint])}+ deriving (Eq, Ord, Read, Show)++_JoinTypesTestCase = (Core.Name "hydra.testing.JoinTypesTestCase")++_JoinTypesTestCase_left = (Core.Name "left")++_JoinTypesTestCase_right = (Core.Name "right")++_JoinTypesTestCase_expected = (Core.Name "expected")
src/gen-main/haskell/Hydra/Topology.hs view
@@ -1,14 +1,18 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for simple graphs as adjacency lists module Hydra.Topology where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | A directed graph represented as an adjacency list mapping vertices to their outgoing neighbors type Graph = (M.Map Vertex [Vertex]) _Graph = (Core.Name "hydra.topology.Graph")@@ -56,6 +60,7 @@ _TarjanState_sccs = (Core.Name "sccs") +-- | A graph vertex, represented as a 32-bit integer identifier type Vertex = Int _Vertex = (Core.Name "hydra.topology.Vertex")
src/gen-main/haskell/Hydra/Typing.hs view
@@ -1,15 +1,53 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Types supporting type inference and type reconstruction. module Hydra.Typing where import qualified Hydra.Core as Core-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S --- | The context provided to type inference, including various typing enviroments.+-- | A structured representation of a function term's components, replacing ad-hoc tuples. This captures all the information extracted from peeling lambdas, type lambdas, lets, and type applications from a term.+data FunctionStructure env = + FunctionStructure {+ -- | Type parameters (from type lambdas)+ functionStructureTypeParams :: [Core.Name],+ -- | Value parameters (from lambdas)+ functionStructureParams :: [Core.Name],+ -- | Let bindings accumulated from the term+ functionStructureBindings :: [Core.Binding],+ -- | The body term after removing all lambdas, lets, etc.+ functionStructureBody :: Core.Term,+ -- | Domain types of the value parameters+ functionStructureDomains :: [Core.Type],+ -- | The return type of the function (if type inference succeeded)+ functionStructureCodomain :: (Maybe Core.Type),+ -- | Updated environment after processing all bindings+ functionStructureEnvironment :: env}+ deriving (Eq, Ord, Read, Show)++_FunctionStructure = (Core.Name "hydra.typing.FunctionStructure")++_FunctionStructure_typeParams = (Core.Name "typeParams")++_FunctionStructure_params = (Core.Name "params")++_FunctionStructure_bindings = (Core.Name "bindings")++_FunctionStructure_body = (Core.Name "body")++_FunctionStructure_domains = (Core.Name "domains")++_FunctionStructure_codomain = (Core.Name "codomain")++_FunctionStructure_environment = (Core.Name "environment")++-- | The context provided to type inference, including various typing environments. data InferenceContext = InferenceContext { -- | A fixed typing environment which is derived from the schema of the graph.@@ -18,6 +56,9 @@ inferenceContextPrimitiveTypes :: (M.Map Core.Name Core.TypeScheme), -- | A mutable typing environment which is specific to the current graph being processed. This environment is (usually) smaller than the schema and primitive typing environments, and is subject to global substitutions. inferenceContextDataTypes :: (M.Map Core.Name Core.TypeScheme),+ -- | A mutable map from type variable names to their accumulated class constraints. This is populated during type inference when operations requiring Eq or Ord are encountered.+ inferenceContextClassConstraints :: (M.Map Core.Name Core.TypeVariableMetadata),+ -- | Whether to enable debug output during type inference inferenceContextDebug :: Bool} deriving (Eq, Ord, Read, Show) @@ -29,14 +70,21 @@ _InferenceContext_dataTypes = (Core.Name "dataTypes") +_InferenceContext_classConstraints = (Core.Name "classConstraints")+ _InferenceContext_debug = (Core.Name "debug") -- | The result of applying inference rules to a term. data InferenceResult = InferenceResult {+ -- | The term which was inferred inferenceResultTerm :: Core.Term,+ -- | The inferred type of the term inferenceResultType :: Core.Type,- inferenceResultSubst :: TypeSubst}+ -- | The type substitution resulting from unification+ inferenceResultSubst :: TypeSubst,+ -- | Class constraints discovered during inference (e.g., Ord constraints from Map.lookup)+ inferenceResultClassConstraints :: (M.Map Core.Name Core.TypeVariableMetadata)} deriving (Eq, Ord, Read, Show) _InferenceResult = (Core.Name "hydra.typing.InferenceResult")@@ -47,6 +95,8 @@ _InferenceResult_subst = (Core.Name "subst") +_InferenceResult_classConstraints = (Core.Name "classConstraints")+ -- | A substitution of term variables for terms newtype TermSubst = TermSubst {@@ -58,7 +108,9 @@ -- | An assertion that two types can be unified into a single type data TypeConstraint = TypeConstraint {+ -- | The left-hand side of the constraint typeConstraintLeft :: Core.Type,+ -- | The right-hand side of the constraint typeConstraintRight :: Core.Type, -- | A description of the type constraint which may be used for tracing or debugging typeConstraintComment :: String}@@ -75,8 +127,17 @@ -- | A typing environment used for type reconstruction (typeOf) over System F terms data TypeContext = TypeContext {+ -- | A mapping of lambda- and let-bound variables to their types typeContextTypes :: (M.Map Core.Name Core.Type),- typeContextVariables :: (S.Set Core.Name),+ -- | Any additional metadata about lambda- and let-bound variables+ typeContextMetadata :: (M.Map Core.Name Core.Term),+ -- | The set of type variables introduced by enclosing type lambdas+ typeContextTypeVariables :: (S.Set Core.Name),+ -- | The set of term variables introduced by lambdas (even if untyped)+ typeContextLambdaVariables :: (S.Set Core.Name),+ -- | The set of term variables introduced by let bindings (even if untyped)+ typeContextLetVariables :: (S.Set Core.Name),+ -- | The schema types, primitive types, and data types of the graph typeContextInferenceContext :: InferenceContext} deriving (Eq, Ord, Read, Show) @@ -84,7 +145,13 @@ _TypeContext_types = (Core.Name "types") -_TypeContext_variables = (Core.Name "variables")+_TypeContext_metadata = (Core.Name "metadata")++_TypeContext_typeVariables = (Core.Name "typeVariables")++_TypeContext_lambdaVariables = (Core.Name "lambdaVariables")++_TypeContext_letVariables = (Core.Name "letVariables") _TypeContext_inferenceContext = (Core.Name "inferenceContext")
src/gen-main/haskell/Hydra/Unification.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | Utilities for type unification. module Hydra.Unification where@@ -10,133 +12,127 @@ import qualified Hydra.Lib.Lists as Lists import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes import qualified Hydra.Lib.Strings as Strings import qualified Hydra.Rewriting as Rewriting import qualified Hydra.Show.Core as Core_ import qualified Hydra.Substitution as Substitution import qualified Hydra.Typing as Typing-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S +-- | Join two types, producing a list of type constraints.The comment is used to provide context for the constraints. joinTypes :: (Core.Type -> Core.Type -> String -> Compute.Flow t0 [Typing.TypeConstraint]) joinTypes left right comment = - let sleft = (Rewriting.deannotateType left) - sright = (Rewriting.deannotateType right)- joinOne = (\l -> \r -> Typing.TypeConstraint {+ let sleft = (Rewriting.deannotateType left)+ in + let sright = (Rewriting.deannotateType right)+ in + let joinOne = (\l -> \r -> Typing.TypeConstraint { Typing.typeConstraintLeft = l, Typing.typeConstraintRight = r,- Typing.typeConstraintComment = (Strings.cat [- "join types; ",- comment])})- cannotUnify = (Flows.fail (Strings.cat [- Strings.cat [- Strings.cat [- "cannot unify ",- (Core_.type_ sleft)],- " with "],- (Core_.type_ sright)]))- assertEqual = (Logic.ifElse (Equality.equal sleft sright) (Flows.pure []) cannotUnify)- joinList = (\lefts -> \rights -> Logic.ifElse (Equality.equal (Lists.length lefts) (Lists.length rights)) (Flows.pure (Lists.zipWith joinOne lefts rights)) cannotUnify)- joinRowTypes = (\left -> \right -> Logic.ifElse (Logic.and (Equality.equal (Core.unName (Core.rowTypeTypeName left)) (Core.unName (Core.rowTypeTypeName right))) (Logic.and (Equality.equal (Lists.length (Lists.map Core.fieldTypeName (Core.rowTypeFields left))) (Lists.length (Lists.map Core.fieldTypeName (Core.rowTypeFields right)))) (Lists.foldl Logic.and True (Lists.zipWith (\left -> \right -> Equality.equal (Core.unName left) (Core.unName right)) (Lists.map Core.fieldTypeName (Core.rowTypeFields left)) (Lists.map Core.fieldTypeName (Core.rowTypeFields right)))))) (joinList (Lists.map Core.fieldTypeType (Core.rowTypeFields left)) (Lists.map Core.fieldTypeType (Core.rowTypeFields right))) cannotUnify)- in ((\x -> case x of- Core.TypeApplication v1 -> ((\x -> case x of- Core.TypeApplication v2 -> (Flows.pure [- joinOne (Core.applicationTypeFunction v1) (Core.applicationTypeFunction v2),- (joinOne (Core.applicationTypeArgument v1) (Core.applicationTypeArgument v2))])- _ -> cannotUnify) sright)- Core.TypeFunction v1 -> ((\x -> case x of- Core.TypeFunction v2 -> (Flows.pure [- joinOne (Core.functionTypeDomain v1) (Core.functionTypeDomain v2),- (joinOne (Core.functionTypeCodomain v1) (Core.functionTypeCodomain v2))])- _ -> cannotUnify) sright)- Core.TypeList v1 -> ((\x -> case x of- Core.TypeList v2 -> (Flows.pure [- joinOne v1 v2])- _ -> cannotUnify) sright)- Core.TypeLiteral _ -> assertEqual- Core.TypeMap v1 -> ((\x -> case x of- Core.TypeMap v2 -> (Flows.pure [- joinOne (Core.mapTypeKeys v1) (Core.mapTypeKeys v2),- (joinOne (Core.mapTypeValues v1) (Core.mapTypeValues v2))])- _ -> cannotUnify) sright)- Core.TypeOptional v1 -> ((\x -> case x of- Core.TypeOptional v2 -> (Flows.pure [- joinOne v1 v2])- _ -> cannotUnify) sright)- Core.TypeProduct v1 -> ((\x -> case x of- Core.TypeProduct v2 -> (joinList v1 v2)- _ -> cannotUnify) sright)- Core.TypeRecord v1 -> ((\x -> case x of- Core.TypeRecord v2 -> (joinRowTypes v1 v2)- _ -> cannotUnify) sright)- Core.TypeSet v1 -> ((\x -> case x of- Core.TypeSet v2 -> (Flows.pure [- joinOne v1 v2])- _ -> cannotUnify) sright)- Core.TypeSum v1 -> ((\x -> case x of- Core.TypeSum v2 -> (joinList v1 v2)- _ -> cannotUnify) sright)- Core.TypeUnion v1 -> ((\x -> case x of- Core.TypeUnion v2 -> (joinRowTypes v1 v2)- _ -> cannotUnify) sright)- Core.TypeUnit -> ((\x -> case x of- Core.TypeUnit -> (Flows.pure [])- _ -> cannotUnify) sright)- Core.TypeWrap v1 -> ((\x -> case x of- Core.TypeWrap v2 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTypeTypeName v1)) (Core.unName (Core.wrappedTypeTypeName v2))) (Flows.pure [- joinOne (Core.wrappedTypeObject v1) (Core.wrappedTypeObject v2)]) cannotUnify)- _ -> cannotUnify) sright)- _ -> cannotUnify) sleft)+ Typing.typeConstraintComment = (Strings.cat2 "join types; " comment)})+ in + let cannotUnify = (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 "cannot unify " (Core_.type_ sleft)) " with ") (Core_.type_ sright)))+ in + let assertEqual = (Logic.ifElse (Equality.equal sleft sright) (Flows.pure []) cannotUnify)+ in + let joinList = (\lefts -> \rights -> Logic.ifElse (Equality.equal (Lists.length lefts) (Lists.length rights)) (Flows.pure (Lists.zipWith joinOne lefts rights)) cannotUnify)+ in + let joinRowTypes = (\left -> \right -> Logic.ifElse (Logic.and (Equality.equal (Core.unName (Core.rowTypeTypeName left)) (Core.unName (Core.rowTypeTypeName right))) (Logic.and (Equality.equal (Lists.length (Lists.map Core.fieldTypeName (Core.rowTypeFields left))) (Lists.length (Lists.map Core.fieldTypeName (Core.rowTypeFields right)))) (Lists.foldl Logic.and True (Lists.zipWith (\left -> \right -> Equality.equal (Core.unName left) (Core.unName right)) (Lists.map Core.fieldTypeName (Core.rowTypeFields left)) (Lists.map Core.fieldTypeName (Core.rowTypeFields right)))))) (joinList (Lists.map Core.fieldTypeType (Core.rowTypeFields left)) (Lists.map Core.fieldTypeType (Core.rowTypeFields right))) cannotUnify)+ in ((\x -> case x of+ Core.TypeApplication v1 -> ((\x -> case x of+ Core.TypeApplication v2 -> (Flows.pure [+ joinOne (Core.applicationTypeFunction v1) (Core.applicationTypeFunction v2),+ (joinOne (Core.applicationTypeArgument v1) (Core.applicationTypeArgument v2))])+ _ -> cannotUnify) sright)+ Core.TypeEither v1 -> ((\x -> case x of+ Core.TypeEither v2 -> (Flows.pure [+ joinOne (Core.eitherTypeLeft v1) (Core.eitherTypeLeft v2),+ (joinOne (Core.eitherTypeRight v1) (Core.eitherTypeRight v2))])+ _ -> cannotUnify) sright)+ Core.TypeFunction v1 -> ((\x -> case x of+ Core.TypeFunction v2 -> (Flows.pure [+ joinOne (Core.functionTypeDomain v1) (Core.functionTypeDomain v2),+ (joinOne (Core.functionTypeCodomain v1) (Core.functionTypeCodomain v2))])+ _ -> cannotUnify) sright)+ Core.TypeList v1 -> ((\x -> case x of+ Core.TypeList v2 -> (Flows.pure [+ joinOne v1 v2])+ _ -> cannotUnify) sright)+ Core.TypeLiteral _ -> assertEqual+ Core.TypeMap v1 -> ((\x -> case x of+ Core.TypeMap v2 -> (Flows.pure [+ joinOne (Core.mapTypeKeys v1) (Core.mapTypeKeys v2),+ (joinOne (Core.mapTypeValues v1) (Core.mapTypeValues v2))])+ _ -> cannotUnify) sright)+ Core.TypeMaybe v1 -> ((\x -> case x of+ Core.TypeMaybe v2 -> (Flows.pure [+ joinOne v1 v2])+ _ -> cannotUnify) sright)+ Core.TypePair v1 -> ((\x -> case x of+ Core.TypePair v2 -> (Flows.pure [+ joinOne (Core.pairTypeFirst v1) (Core.pairTypeFirst v2),+ (joinOne (Core.pairTypeSecond v1) (Core.pairTypeSecond v2))])+ _ -> cannotUnify) sright)+ Core.TypeRecord v1 -> ((\x -> case x of+ Core.TypeRecord v2 -> (joinRowTypes v1 v2)+ _ -> cannotUnify) sright)+ Core.TypeSet v1 -> ((\x -> case x of+ Core.TypeSet v2 -> (Flows.pure [+ joinOne v1 v2])+ _ -> cannotUnify) sright)+ Core.TypeUnion v1 -> ((\x -> case x of+ Core.TypeUnion v2 -> (joinRowTypes v1 v2)+ _ -> cannotUnify) sright)+ Core.TypeUnit -> ((\x -> case x of+ Core.TypeUnit -> (Flows.pure [])+ _ -> cannotUnify) sright)+ Core.TypeWrap v1 -> ((\x -> case x of+ Core.TypeWrap v2 -> (Logic.ifElse (Equality.equal (Core.unName (Core.wrappedTypeTypeName v1)) (Core.unName (Core.wrappedTypeTypeName v2))) (Flows.pure [+ joinOne (Core.wrappedTypeBody v1) (Core.wrappedTypeBody v2)]) cannotUnify)+ _ -> cannotUnify) sright)+ _ -> cannotUnify) sleft) +-- | Robinson's algorithm, following https://www.cs.cornell.edu/courses/cs6110/2017sp/lectures/lec23.pdf+-- | Specifically this is an implementation of the following rules:+-- | * Unify({(x, t)} ∪ E) = {t/x} Unify(E{t/x}) if x ∉ FV(t)+-- | * Unify(∅) = I (the identity substitution x ↦ x)+-- | * Unify({(x, x)} ∪ E) = Unify(E)+-- | * Unify({(f(s1, ..., sn), f(t1, ..., tn))} ∪ E) = Unify({(s1, t1), ..., (sn, tn)} ∪ E)) unifyTypeConstraints :: (M.Map Core.Name t0 -> [Typing.TypeConstraint] -> Compute.Flow t1 Typing.TypeSubst) unifyTypeConstraints schemaTypes constraints = let withConstraint = (\c -> \rest -> - let sleft = (Rewriting.deannotateType (Typing.typeConstraintLeft c)) - sright = (Rewriting.deannotateType (Typing.typeConstraintRight c))- comment = (Typing.typeConstraintComment c)- tryBinding = (\v -> \t -> Logic.ifElse (variableOccursInType v t) (Flows.fail (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- "Variable ",- (Core.unName v)],- " appears free in type "],- (Core_.type_ t)],- " ("],- comment],- ")"])) (bind v t))- bind = (\v -> \t -> - let subst = (Substitution.singletonTypeSubst v t) - withResult = (\s -> Substitution.composeTypeSubst subst s)- in (Flows.map withResult (unifyTypeConstraints schemaTypes (Substitution.substituteInConstraints subst rest))))- noVars = - let withConstraints = (\constraints2 -> unifyTypeConstraints schemaTypes (Lists.concat2 constraints2 rest))- in (Flows.bind (joinTypes sleft sright comment) withConstraints)- in ((\x -> case x of- Core.TypeVariable v1 -> ((\x -> case x of- Core.TypeVariable v2 -> (Logic.ifElse (Equality.equal (Core.unName v1) (Core.unName v2)) (unifyTypeConstraints schemaTypes rest) (Logic.ifElse (Optionals.isJust (Maps.lookup v1 schemaTypes)) (Logic.ifElse (Optionals.isJust (Maps.lookup v2 schemaTypes)) (Flows.fail (Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- Strings.cat [- "Attempted to unify schema names ",- (Core.unName v1)],- " and "],- (Core.unName v2)],- " ("],- comment],- ")"])) (bind v2 sleft)) (bind v1 sright)))- _ -> (tryBinding v1 sright)) sright)- _ -> ((\x -> case x of- Core.TypeVariable v1 -> (tryBinding v1 sleft)- _ -> noVars) sright)) sleft))+ let sleft = (Rewriting.deannotateType (Typing.typeConstraintLeft c))+ in + let sright = (Rewriting.deannotateType (Typing.typeConstraintRight c))+ in + let comment = (Typing.typeConstraintComment c)+ in + let bind = (\v -> \t -> + let subst = (Substitution.singletonTypeSubst v t)+ in + let withResult = (\s -> Substitution.composeTypeSubst subst s)+ in (Flows.map withResult (unifyTypeConstraints schemaTypes (Substitution.substituteInConstraints subst rest))))+ in + let tryBinding = (\v -> \t -> Logic.ifElse (variableOccursInType v t) (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "Variable " (Core.unName v)) " appears free in type ") (Core_.type_ t)) " (") comment) ")")) (bind v t))+ in + let noVars = + let withConstraints = (\constraints2 -> unifyTypeConstraints schemaTypes (Lists.concat2 constraints2 rest))+ in (Flows.bind (joinTypes sleft sright comment) withConstraints)+ in + let dflt = ((\x -> case x of+ Core.TypeVariable v1 -> (tryBinding v1 sleft)+ _ -> noVars) sright)+ in ((\x -> case x of+ Core.TypeVariable v1 -> ((\x -> case x of+ Core.TypeVariable v2 -> (Logic.ifElse (Equality.equal (Core.unName v1) (Core.unName v2)) (unifyTypeConstraints schemaTypes rest) (Logic.ifElse (Maybes.isJust (Maps.lookup v1 schemaTypes)) (Logic.ifElse (Maybes.isJust (Maps.lookup v2 schemaTypes)) (Flows.fail (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 (Strings.cat2 "Attempted to unify schema names " (Core.unName v1)) " and ") (Core.unName v2)) " (") comment) ")")) (bind v2 sleft)) (bind v1 sright)))+ _ -> (tryBinding v1 sright)) sright)+ _ -> dflt) sleft)) in (Logic.ifElse (Lists.null constraints) (Flows.pure Substitution.idTypeSubst) (withConstraint (Lists.head constraints) (Lists.tail constraints))) unifyTypeLists :: (M.Map Core.Name t0 -> [Core.Type] -> [Core.Type] -> String -> Compute.Flow t1 Typing.TypeSubst)@@ -156,8 +152,8 @@ -- | Determine whether a type variable appears within a type expression.No distinction is made between free and bound type variables. variableOccursInType :: (Core.Name -> Core.Type -> Bool)-variableOccursInType var = +variableOccursInType var typ0 = let tryType = (\b -> \typ -> (\x -> case x of Core.TypeVariable v1 -> (Logic.or b (Equality.equal (Core.unName v1) (Core.unName var))) _ -> b) typ)- in (Rewriting.foldOverType Coders.TraversalOrderPre tryType False)+ in (Rewriting.foldOverType Coders.TraversalOrderPre tryType False typ0)
+ src/gen-main/haskell/Hydra/Util.hs view
@@ -0,0 +1,68 @@+-- Note: this is an automatically generated file. Do not edit.++-- | General-purpose utility types used across Hydra.++module Hydra.Util where++import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | A naming convention for symbols, such as camelCase or snake_case+data CaseConvention = + CaseConventionCamel |+ CaseConventionPascal |+ CaseConventionLowerSnake |+ CaseConventionUpperSnake + deriving (Eq, Ord, Read, Show)++_CaseConvention = (Core.Name "hydra.util.CaseConvention")++_CaseConvention_camel = (Core.Name "camel")++_CaseConvention_pascal = (Core.Name "pascal")++_CaseConvention_lowerSnake = (Core.Name "lowerSnake")++_CaseConvention_upperSnake = (Core.Name "upperSnake")++-- | An equality judgement: less than, equal to, or greater than+data Comparison = + ComparisonLessThan |+ ComparisonEqualTo |+ ComparisonGreaterThan + deriving (Eq, Ord, Read, Show)++_Comparison = (Core.Name "hydra.util.Comparison")++_Comparison_lessThan = (Core.Name "lessThan")++_Comparison_equalTo = (Core.Name "equalTo")++_Comparison_greaterThan = (Core.Name "greaterThan")++-- | An error that occurred during decoding of a term+newtype DecodingError = + DecodingError {+ unDecodingError :: String}+ deriving (Eq, Ord, Read, Show)++_DecodingError = (Core.Name "hydra.util.DecodingError")++-- | Numeric precision: arbitrary precision, or precision to a specified number of bits+data Precision = + -- | Arbitrary precision+ PrecisionArbitrary |+ -- | Precision to a specified number of bits+ PrecisionBits Int+ deriving (Eq, Ord, Read, Show)++_Precision = (Core.Name "hydra.util.Precision")++_Precision_arbitrary = (Core.Name "arbitrary")++_Precision_bits = (Core.Name "bits")
src/gen-main/haskell/Hydra/Variants.hs view
@@ -1,240 +1,178 @@--- | Functions for working with term, type, and literal type variants, as well as numeric precision.+-- Note: this is an automatically generated file. Do not edit. +-- | Variant types which describe the structure of Hydra core types and terms.+ module Hydra.Variants where import qualified Hydra.Core as Core-import qualified Hydra.Lib.Lists as Lists-import qualified Hydra.Mantle as Mantle-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S --- | Find the elimination variant (constructor) for a given elimination term-eliminationVariant :: (Core.Elimination -> Mantle.EliminationVariant)-eliminationVariant x = case x of- Core.EliminationProduct _ -> Mantle.EliminationVariantProduct- Core.EliminationRecord _ -> Mantle.EliminationVariantRecord- Core.EliminationUnion _ -> Mantle.EliminationVariantUnion- Core.EliminationWrap _ -> Mantle.EliminationVariantWrap+-- | The identifier of an elimination constructor+data EliminationVariant = + EliminationVariantRecord |+ EliminationVariantUnion |+ EliminationVariantWrap + deriving (Eq, Ord, Read, Show) --- | All elimination variants (constructors), in a canonical order-eliminationVariants :: [Mantle.EliminationVariant]-eliminationVariants = [- Mantle.EliminationVariantProduct,- Mantle.EliminationVariantRecord,- Mantle.EliminationVariantUnion,- Mantle.EliminationVariantWrap]+_EliminationVariant = (Core.Name "hydra.variants.EliminationVariant") --- | Find the precision of a given floating-point type-floatTypePrecision :: (Core.FloatType -> Mantle.Precision)-floatTypePrecision x = case x of- Core.FloatTypeBigfloat -> Mantle.PrecisionArbitrary- Core.FloatTypeFloat32 -> (Mantle.PrecisionBits 32)- Core.FloatTypeFloat64 -> (Mantle.PrecisionBits 64)+_EliminationVariant_record = (Core.Name "record") --- | All floating-point types in a canonical order-floatTypes :: [Core.FloatType]-floatTypes = [- Core.FloatTypeBigfloat,- Core.FloatTypeFloat32,- Core.FloatTypeFloat64]+_EliminationVariant_union = (Core.Name "union") --- | Find the float type for a given floating-point value-floatValueType :: (Core.FloatValue -> Core.FloatType)-floatValueType x = case x of- Core.FloatValueBigfloat _ -> Core.FloatTypeBigfloat- Core.FloatValueFloat32 _ -> Core.FloatTypeFloat32- Core.FloatValueFloat64 _ -> Core.FloatTypeFloat64+_EliminationVariant_wrap = (Core.Name "wrap") --- | Find the function variant (constructor) for a given function-functionVariant :: (Core.Function -> Mantle.FunctionVariant)-functionVariant x = case x of- Core.FunctionElimination _ -> Mantle.FunctionVariantElimination- Core.FunctionLambda _ -> Mantle.FunctionVariantLambda- Core.FunctionPrimitive _ -> Mantle.FunctionVariantPrimitive+-- | The identifier of a function constructor+data FunctionVariant = + FunctionVariantElimination |+ FunctionVariantLambda |+ FunctionVariantPrimitive + deriving (Eq, Ord, Read, Show) --- | All function variants (constructors), in a canonical order-functionVariants :: [Mantle.FunctionVariant]-functionVariants = [- Mantle.FunctionVariantElimination,- Mantle.FunctionVariantLambda,- Mantle.FunctionVariantPrimitive]+_FunctionVariant = (Core.Name "hydra.variants.FunctionVariant") --- | Find whether a given integer type is signed (true) or unsigned (false)-integerTypeIsSigned :: (Core.IntegerType -> Bool)-integerTypeIsSigned x = case x of- Core.IntegerTypeBigint -> True- Core.IntegerTypeInt8 -> True- Core.IntegerTypeInt16 -> True- Core.IntegerTypeInt32 -> True- Core.IntegerTypeInt64 -> True- Core.IntegerTypeUint8 -> False- Core.IntegerTypeUint16 -> False- Core.IntegerTypeUint32 -> False- Core.IntegerTypeUint64 -> False+_FunctionVariant_elimination = (Core.Name "elimination") --- | Find the precision of a given integer type-integerTypePrecision :: (Core.IntegerType -> Mantle.Precision)-integerTypePrecision x = case x of- Core.IntegerTypeBigint -> Mantle.PrecisionArbitrary- Core.IntegerTypeInt8 -> (Mantle.PrecisionBits 8)- Core.IntegerTypeInt16 -> (Mantle.PrecisionBits 16)- Core.IntegerTypeInt32 -> (Mantle.PrecisionBits 32)- Core.IntegerTypeInt64 -> (Mantle.PrecisionBits 64)- Core.IntegerTypeUint8 -> (Mantle.PrecisionBits 8)- Core.IntegerTypeUint16 -> (Mantle.PrecisionBits 16)- Core.IntegerTypeUint32 -> (Mantle.PrecisionBits 32)- Core.IntegerTypeUint64 -> (Mantle.PrecisionBits 64)+_FunctionVariant_lambda = (Core.Name "lambda") --- | All integer types, in a canonical order-integerTypes :: [Core.IntegerType]-integerTypes = [- Core.IntegerTypeBigint,- Core.IntegerTypeInt8,- Core.IntegerTypeInt16,- Core.IntegerTypeInt32,- Core.IntegerTypeInt64,- Core.IntegerTypeUint8,- Core.IntegerTypeUint16,- Core.IntegerTypeUint32,- Core.IntegerTypeUint64]+_FunctionVariant_primitive = (Core.Name "primitive") --- | Find the integer type for a given integer value-integerValueType :: (Core.IntegerValue -> Core.IntegerType)-integerValueType x = case x of- Core.IntegerValueBigint _ -> Core.IntegerTypeBigint- Core.IntegerValueInt8 _ -> Core.IntegerTypeInt8- Core.IntegerValueInt16 _ -> Core.IntegerTypeInt16- Core.IntegerValueInt32 _ -> Core.IntegerTypeInt32- Core.IntegerValueInt64 _ -> Core.IntegerTypeInt64- Core.IntegerValueUint8 _ -> Core.IntegerTypeUint8- Core.IntegerValueUint16 _ -> Core.IntegerTypeUint16- Core.IntegerValueUint32 _ -> Core.IntegerTypeUint32- Core.IntegerValueUint64 _ -> Core.IntegerTypeUint64+-- | The identifier of a literal constructor+data LiteralVariant = + LiteralVariantBinary |+ LiteralVariantBoolean |+ LiteralVariantFloat |+ LiteralVariantInteger |+ LiteralVariantString + deriving (Eq, Ord, Read, Show) --- | Find the literal type for a given literal value-literalType :: (Core.Literal -> Core.LiteralType)-literalType x = case x of- Core.LiteralBinary _ -> Core.LiteralTypeBinary- Core.LiteralBoolean _ -> Core.LiteralTypeBoolean- Core.LiteralFloat v1 -> ((\injected_ -> Core.LiteralTypeFloat injected_) (floatValueType v1))- Core.LiteralInteger v1 -> ((\injected_ -> Core.LiteralTypeInteger injected_) (integerValueType v1))- Core.LiteralString _ -> Core.LiteralTypeString+_LiteralVariant = (Core.Name "hydra.variants.LiteralVariant") --- | Find the literal type variant (constructor) for a given literal value-literalTypeVariant :: (Core.LiteralType -> Mantle.LiteralVariant)-literalTypeVariant x = case x of- Core.LiteralTypeBinary -> Mantle.LiteralVariantBinary- Core.LiteralTypeBoolean -> Mantle.LiteralVariantBoolean- Core.LiteralTypeFloat _ -> Mantle.LiteralVariantFloat- Core.LiteralTypeInteger _ -> Mantle.LiteralVariantInteger- Core.LiteralTypeString -> Mantle.LiteralVariantString+_LiteralVariant_binary = (Core.Name "binary") --- | All literal types, in a canonical order-literalTypes :: [Core.LiteralType]-literalTypes = (Lists.concat [- [- Core.LiteralTypeBinary,- Core.LiteralTypeBoolean],- Lists.map (\x -> Core.LiteralTypeFloat x) floatTypes,- Lists.map (\x -> Core.LiteralTypeInteger x) integerTypes,- [- Core.LiteralTypeString]])+_LiteralVariant_boolean = (Core.Name "boolean") --- | Find the literal variant (constructor) for a given literal value-literalVariant :: (Core.Literal -> Mantle.LiteralVariant)-literalVariant arg_ = (literalTypeVariant (literalType arg_))+_LiteralVariant_float = (Core.Name "float") --- | All literal variants, in a canonical order-literalVariants :: [Mantle.LiteralVariant]-literalVariants = [- Mantle.LiteralVariantBinary,- Mantle.LiteralVariantBoolean,- Mantle.LiteralVariantFloat,- Mantle.LiteralVariantInteger,- Mantle.LiteralVariantString]+_LiteralVariant_integer = (Core.Name "integer") --- | Find the term variant (constructor) for a given term-termVariant :: (Core.Term -> Mantle.TermVariant)-termVariant x = case x of- Core.TermAnnotated _ -> Mantle.TermVariantAnnotated- Core.TermApplication _ -> Mantle.TermVariantApplication- Core.TermFunction _ -> Mantle.TermVariantFunction- Core.TermLet _ -> Mantle.TermVariantLet- Core.TermList _ -> Mantle.TermVariantList- Core.TermLiteral _ -> Mantle.TermVariantLiteral- Core.TermMap _ -> Mantle.TermVariantMap- Core.TermOptional _ -> Mantle.TermVariantOptional- Core.TermProduct _ -> Mantle.TermVariantProduct- Core.TermRecord _ -> Mantle.TermVariantRecord- Core.TermSet _ -> Mantle.TermVariantSet- Core.TermSum _ -> Mantle.TermVariantSum- Core.TermTypeApplication _ -> Mantle.TermVariantTypeApplication- Core.TermTypeLambda _ -> Mantle.TermVariantTypeLambda- Core.TermUnion _ -> Mantle.TermVariantUnion- Core.TermUnit -> Mantle.TermVariantUnit- Core.TermVariable _ -> Mantle.TermVariantVariable- Core.TermWrap _ -> Mantle.TermVariantWrap+_LiteralVariant_string = (Core.Name "string") --- | All term (expression) variants, in a canonical order-termVariants :: [Mantle.TermVariant]-termVariants = [- Mantle.TermVariantAnnotated,- Mantle.TermVariantApplication,- Mantle.TermVariantLiteral,- Mantle.TermVariantFunction,- Mantle.TermVariantList,- Mantle.TermVariantMap,- Mantle.TermVariantOptional,- Mantle.TermVariantProduct,- Mantle.TermVariantRecord,- Mantle.TermVariantSet,- Mantle.TermVariantSum,- Mantle.TermVariantTypeLambda,- Mantle.TermVariantTypeApplication,- Mantle.TermVariantUnion,- Mantle.TermVariantUnit,- Mantle.TermVariantVariable,- Mantle.TermVariantWrap]+-- | The identifier of a term expression constructor+data TermVariant = + TermVariantAnnotated |+ TermVariantApplication |+ TermVariantEither |+ TermVariantFunction |+ TermVariantLet |+ TermVariantList |+ TermVariantLiteral |+ TermVariantMap |+ TermVariantMaybe |+ TermVariantPair |+ TermVariantRecord |+ TermVariantSet |+ TermVariantTypeApplication |+ TermVariantTypeLambda |+ TermVariantUnion |+ TermVariantUnit |+ TermVariantVariable |+ TermVariantWrap + deriving (Eq, Ord, Read, Show) --- | Find the type variant (constructor) for a given type-typeVariant :: (Core.Type -> Mantle.TypeVariant)-typeVariant x = case x of- Core.TypeAnnotated _ -> Mantle.TypeVariantAnnotated- Core.TypeApplication _ -> Mantle.TypeVariantApplication- Core.TypeFunction _ -> Mantle.TypeVariantFunction- Core.TypeForall _ -> Mantle.TypeVariantForall- Core.TypeList _ -> Mantle.TypeVariantList- Core.TypeLiteral _ -> Mantle.TypeVariantLiteral- Core.TypeMap _ -> Mantle.TypeVariantMap- Core.TypeOptional _ -> Mantle.TypeVariantOptional- Core.TypeProduct _ -> Mantle.TypeVariantProduct- Core.TypeRecord _ -> Mantle.TypeVariantRecord- Core.TypeSet _ -> Mantle.TypeVariantSet- Core.TypeSum _ -> Mantle.TypeVariantSum- Core.TypeUnion _ -> Mantle.TypeVariantUnion- Core.TypeUnit -> Mantle.TypeVariantUnit- Core.TypeVariable _ -> Mantle.TypeVariantVariable- Core.TypeWrap _ -> Mantle.TypeVariantWrap+_TermVariant = (Core.Name "hydra.variants.TermVariant") --- | All type variants, in a canonical order-typeVariants :: [Mantle.TypeVariant]-typeVariants = [- Mantle.TypeVariantAnnotated,- Mantle.TypeVariantApplication,- Mantle.TypeVariantFunction,- Mantle.TypeVariantForall,- Mantle.TypeVariantList,- Mantle.TypeVariantLiteral,- Mantle.TypeVariantMap,- Mantle.TypeVariantWrap,- Mantle.TypeVariantOptional,- Mantle.TypeVariantProduct,- Mantle.TypeVariantRecord,- Mantle.TypeVariantSet,- Mantle.TypeVariantSum,- Mantle.TypeVariantUnion,- Mantle.TypeVariantUnit,- Mantle.TypeVariantVariable]+_TermVariant_annotated = (Core.Name "annotated")++_TermVariant_application = (Core.Name "application")++_TermVariant_either = (Core.Name "either")++_TermVariant_function = (Core.Name "function")++_TermVariant_let = (Core.Name "let")++_TermVariant_list = (Core.Name "list")++_TermVariant_literal = (Core.Name "literal")++_TermVariant_map = (Core.Name "map")++_TermVariant_maybe = (Core.Name "maybe")++_TermVariant_pair = (Core.Name "pair")++_TermVariant_record = (Core.Name "record")++_TermVariant_set = (Core.Name "set")++_TermVariant_typeApplication = (Core.Name "typeApplication")++_TermVariant_typeLambda = (Core.Name "typeLambda")++_TermVariant_union = (Core.Name "union")++_TermVariant_unit = (Core.Name "unit")++_TermVariant_variable = (Core.Name "variable")++_TermVariant_wrap = (Core.Name "wrap")++-- | The identifier of a type constructor+data TypeVariant = + TypeVariantAnnotated |+ TypeVariantApplication |+ TypeVariantEither |+ TypeVariantForall |+ TypeVariantFunction |+ TypeVariantList |+ TypeVariantLiteral |+ TypeVariantMap |+ TypeVariantMaybe |+ TypeVariantPair |+ TypeVariantRecord |+ TypeVariantSet |+ TypeVariantUnion |+ TypeVariantUnit |+ TypeVariantVariable |+ TypeVariantWrap + deriving (Eq, Ord, Read, Show)++_TypeVariant = (Core.Name "hydra.variants.TypeVariant")++_TypeVariant_annotated = (Core.Name "annotated")++_TypeVariant_application = (Core.Name "application")++_TypeVariant_either = (Core.Name "either")++_TypeVariant_forall = (Core.Name "forall")++_TypeVariant_function = (Core.Name "function")++_TypeVariant_list = (Core.Name "list")++_TypeVariant_literal = (Core.Name "literal")++_TypeVariant_map = (Core.Name "map")++_TypeVariant_maybe = (Core.Name "maybe")++_TypeVariant_pair = (Core.Name "pair")++_TypeVariant_record = (Core.Name "record")++_TypeVariant_set = (Core.Name "set")++_TypeVariant_union = (Core.Name "union")++_TypeVariant_unit = (Core.Name "unit")++_TypeVariant_variable = (Core.Name "variable")++_TypeVariant_wrap = (Core.Name "wrap")
src/gen-main/haskell/Hydra/Workflow.hs view
@@ -1,3 +1,5 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A model for Hydra transformation workflows module Hydra.Workflow where@@ -6,7 +8,8 @@ import qualified Hydra.Core as Core import qualified Hydra.Graph as Graph import qualified Hydra.Module as Module-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M
+ src/gen-test/haskell/Generation/Hydra/Test/AnnotationsSpec.hs view
@@ -0,0 +1,216 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.annotations"},ModuleName {unModuleName = "Annotations"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.annotations"},ModuleName {unModuleName = "Annotations"}),(Namespace {unNamespace = "hydra.compute"},ModuleName {unModuleName = "Compute"}),(Namespace {unNamespace = "hydra.core"},ModuleName {unModuleName = "Core"}),(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.monads"},ModuleName {unModuleName = "Monads"})]++module Generation.Hydra.Test.AnnotationsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Annotations as Annotations+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Monads as Monads++spec :: H.Spec+spec = H.describe "annotations" $ do+ H.describe "arbitrary annotations" $ do+ H.it "set single annotation #1" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))) (Core.TermLiteral (Core.LiteralString "foo")))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "k1", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])}))+ H.it "set single annotation #2" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "myKey") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17))))) (Core.TermLiteral (Core.LiteralString "bar")))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "myKey", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17)))))])}))+ H.it "set single annotation #3" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "x") (Just (Core.TermLiteral (Core.LiteralString "hello"))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "x", (Core.TermLiteral (Core.LiteralString "hello")))])}))+ H.it "get existing annotation #1" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "k1") (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "value"))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))+ (Just (Core.TermLiteral (Core.LiteralString "value")))+ H.it "get existing annotation #2" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "foo") (Annotations.setTermAnnotation (Core.Name "foo") (Just (Core.TermLiteral (Core.LiteralString ""))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))))+ (Just (Core.TermLiteral (Core.LiteralString "")))+ H.it "get existing annotation #3" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "key") (Annotations.setTermAnnotation (Core.Name "key") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)))) (Core.TermLiteral (Core.LiteralString "test"))))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123))))+ H.it "get missing annotation #1" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "k1") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 42))))+ (Nothing)+ H.it "get missing annotation #2" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "nonexistent") (Core.TermLiteral (Core.LiteralString "hello")))+ (Nothing)+ H.it "get missing annotation #3" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "k1") (Annotations.setTermAnnotation (Core.Name "k2") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))+ (Nothing)+ H.it "set multiple annotations #1" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "k2") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))) (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "first"))) (Core.TermLiteral (Core.LiteralBoolean True))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralBoolean True)),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "k1", (Core.TermLiteral (Core.LiteralString "first"))),+ (Core.Name "k2", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200))))])}))+ H.it "set multiple annotations #2" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "b") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))) (Annotations.setTermAnnotation (Core.Name "a") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))) (Core.TermLiteral (Core.LiteralString "test"))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "test")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "a", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))),+ (Core.Name "b", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))))])}))+ H.it "outer annotation overrides inner #1" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "outer"))) (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "inner"))) (Core.TermLiteral (Core.LiteralString "bar"))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "k1", (Core.TermLiteral (Core.LiteralString "outer")))])}))+ H.it "outer annotation overrides inner #2" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "x") (Just (Core.TermLiteral (Core.LiteralString "new"))) (Annotations.setTermAnnotation (Core.Name "x") (Just (Core.TermLiteral (Core.LiteralString "old"))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "x", (Core.TermLiteral (Core.LiteralString "new")))])}))+ H.it "outer annotation overrides inner #3" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "key") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))) (Annotations.setTermAnnotation (Core.Name "key") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))) (Core.TermLiteral (Core.LiteralBoolean False))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralBoolean False)),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "key", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999))))])}))+ H.it "unset single annotation #1" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "k1") Nothing (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "foo"))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))))+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))+ H.it "unset single annotation #2" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "x") Nothing (Annotations.setTermAnnotation (Core.Name "x") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))) (Core.TermLiteral (Core.LiteralString "test"))))+ (Core.TermLiteral (Core.LiteralString "test"))+ H.it "unset one of multiple annotations #1" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "k1") Nothing (Annotations.setTermAnnotation (Core.Name "k2") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))) (Annotations.setTermAnnotation (Core.Name "k1") (Just (Core.TermLiteral (Core.LiteralString "first"))) (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137))))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "k2", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200))))])}))+ H.it "unset one of multiple annotations #2" $ H.shouldBe+ (Annotations.setTermAnnotation (Core.Name "b") Nothing (Annotations.setTermAnnotation (Core.Name "b") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))) (Annotations.setTermAnnotation (Core.Name "a") (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))) (Core.TermLiteral (Core.LiteralString "x")))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "x")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "a", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])}))+ H.describe "descriptions" $ do+ H.it "set description #1" $ H.shouldBe+ (Annotations.setTermDescription (Just "my description") (Core.TermLiteral (Core.LiteralString "foo")))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "my description")))])}))+ H.it "set description #2" $ H.shouldBe+ (Annotations.setTermDescription (Just "") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "")))])}))+ H.it "set description #3" $ H.shouldBe+ (Annotations.setTermDescription (Just "A longer description with spaces") (Core.TermLiteral (Core.LiteralBoolean True)))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralBoolean True)),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "A longer description with spaces")))])}))+ H.it "get existing description #1" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Annotations.setTermDescription (Just "hello") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))) Lexical.emptyGraph Monads.emptyTrace))+ (Just (Just "hello"))+ H.it "get existing description #2" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Annotations.setTermDescription (Just "") (Core.TermLiteral (Core.LiteralString "test")))) Lexical.emptyGraph Monads.emptyTrace))+ (Just (Just ""))+ H.it "get existing description #3" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Annotations.setTermDescription (Just "desc") (Core.TermLiteral (Core.LiteralBoolean False)))) Lexical.emptyGraph Monads.emptyTrace))+ (Just (Just "desc"))+ H.it "get missing description #1" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 42)))) Lexical.emptyGraph Monads.emptyTrace))+ (Just Nothing)+ H.it "get missing description #2" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Core.TermLiteral (Core.LiteralString "no description here"))) Lexical.emptyGraph Monads.emptyTrace))+ (Just Nothing)+ H.it "get missing description #3" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Annotations.getTermDescription (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))) Lexical.emptyGraph Monads.emptyTrace))+ (Just Nothing)+ H.it "outer description overrides inner #1" $ H.shouldBe+ (Annotations.setTermDescription (Just "outer") (Annotations.setTermDescription (Just "inner") (Core.TermLiteral (Core.LiteralString "bar"))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "outer")))])}))+ H.it "outer description overrides inner #2" $ H.shouldBe+ (Annotations.setTermDescription (Just "new") (Annotations.setTermDescription (Just "old") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))))+ (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "description", (Core.TermLiteral (Core.LiteralString "new")))])}))+ H.it "unset description #1" $ H.shouldBe+ (Annotations.setTermDescription Nothing (Annotations.setTermDescription (Just "desc") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))))+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))+ H.it "unset description #2" $ H.shouldBe+ (Annotations.setTermDescription Nothing (Annotations.setTermDescription (Just "to be removed") (Core.TermLiteral (Core.LiteralString "test"))))+ (Core.TermLiteral (Core.LiteralString "test"))+ H.describe "layered annotations" $ do+ H.it "get annotation from unannotated term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "one") (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))+ (Nothing)+ H.it "get annotation from singly annotated term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "one") (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])})))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))+ H.it "get inner annotation from doubly annotated term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "one") (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "two", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])})))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))+ H.it "get outer annotation from doubly annotated term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "two") (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "two", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])})))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))+ H.it "get non-overridden annotation from triply annotated term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "two") (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "two", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))))])})))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))+ H.it "outer annotation overrides inner in layered term" $ H.shouldBe+ (Annotations.getTermAnnotation (Core.Name "one") (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "two", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])})),+ Core.annotatedTermAnnotation = (M.fromList [+ (Core.Name "one", (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))))])})))+ (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))))
+ src/gen-test/haskell/Generation/Hydra/Test/FormattingSpec.hs view
@@ -0,0 +1,69 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.formatting"},ModuleName {unModuleName = "Formatting"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.formatting"},ModuleName {unModuleName = "Formatting"}),(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.util"},ModuleName {unModuleName = "Util"})]++module Generation.Hydra.Test.FormattingSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Util as Util++spec :: H.Spec+spec = H.describe "formatting" $ do+ H.describe "case conversion" $ do+ H.it "#1 (lower_snake_case -> UPPER_SNAKE_CASE)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionLowerSnake Util.CaseConventionUpperSnake "a_hello_world_42_a42_42a_b")+ ("A_HELLO_WORLD_42_A42_42A_B")+ H.it "#2 (lower_snake_case -> camelCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionLowerSnake Util.CaseConventionCamel "a_hello_world_42_a42_42a_b")+ ("aHelloWorld42A4242aB")+ H.it "#3 (lower_snake_case -> PascalCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionLowerSnake Util.CaseConventionPascal "a_hello_world_42_a42_42a_b")+ ("AHelloWorld42A4242aB")+ H.it "#4 (lower_snake_case -> lower_snake_case)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionLowerSnake Util.CaseConventionLowerSnake "a_hello_world_42_a42_42a_b")+ ("a_hello_world_42_a42_42a_b")+ H.it "#5 (UPPER_SNAKE_CASE -> lower_snake_case)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionUpperSnake Util.CaseConventionLowerSnake "A_HELLO_WORLD_42_A42_42A_B")+ ("a_hello_world_42_a42_42a_b")+ H.it "#6 (UPPER_SNAKE_CASE -> camelCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionUpperSnake Util.CaseConventionCamel "A_HELLO_WORLD_42_A42_42A_B")+ ("aHelloWorld42A4242aB")+ H.it "#7 (UPPER_SNAKE_CASE -> PascalCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionUpperSnake Util.CaseConventionPascal "A_HELLO_WORLD_42_A42_42A_B")+ ("AHelloWorld42A4242aB")+ H.it "#8 (UPPER_SNAKE_CASE -> UPPER_SNAKE_CASE)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionUpperSnake Util.CaseConventionUpperSnake "A_HELLO_WORLD_42_A42_42A_B")+ ("A_HELLO_WORLD_42_A42_42A_B")+ H.it "#9 (camelCase -> lower_snake_case)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionCamel Util.CaseConventionLowerSnake "aHelloWorld42A4242aB")+ ("a_hello_world42_a4242a_b")+ H.it "#10 (camelCase -> UPPER_SNAKE_CASE)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionCamel Util.CaseConventionUpperSnake "aHelloWorld42A4242aB")+ ("A_HELLO_WORLD42_A4242A_B")+ H.it "#11 (camelCase -> PascalCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionCamel Util.CaseConventionPascal "aHelloWorld42A4242aB")+ ("AHelloWorld42A4242aB")+ H.it "#12 (camelCase -> camelCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionCamel Util.CaseConventionCamel "aHelloWorld42A4242aB")+ ("aHelloWorld42A4242aB")+ H.it "#13 (PascalCase -> lower_snake_case)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionPascal Util.CaseConventionLowerSnake "AHelloWorld42A4242aB")+ ("a_hello_world42_a4242a_b")+ H.it "#14 (PascalCase -> UPPER_SNAKE_CASE)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionPascal Util.CaseConventionUpperSnake "AHelloWorld42A4242aB")+ ("A_HELLO_WORLD42_A4242A_B")+ H.it "#15 (PascalCase -> camelCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionPascal Util.CaseConventionCamel "AHelloWorld42A4242aB")+ ("aHelloWorld42A4242aB")+ H.it "#16 (PascalCase -> PascalCase)" $ H.shouldBe+ (Formatting.convertCase Util.CaseConventionPascal Util.CaseConventionPascal "AHelloWorld42A4242aB")+ ("AHelloWorld42A4242aB")
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/CharsSpec.hs view
@@ -0,0 +1,85 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.chars"},ModuleName {unModuleName = "Chars"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.chars"},ModuleName {unModuleName = "Chars"})]++module Generation.Hydra.Test.Lib.CharsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Chars as Chars++spec :: H.Spec+spec = H.describe "hydra.lib.chars primitives" $ do+ H.describe "isAlphaNum" $ do+ H.it "letter" $ H.shouldBe+ (Chars.isAlphaNum 97)+ (True)+ H.it "digit" $ H.shouldBe+ (Chars.isAlphaNum 53)+ (True)+ H.it "space" $ H.shouldBe+ (Chars.isAlphaNum 32)+ (False)+ H.it "punctuation" $ H.shouldBe+ (Chars.isAlphaNum 46)+ (False)+ H.describe "isLower" $ do+ H.it "lowercase" $ H.shouldBe+ (Chars.isLower 97)+ (True)+ H.it "uppercase" $ H.shouldBe+ (Chars.isLower 65)+ (False)+ H.it "digit" $ H.shouldBe+ (Chars.isLower 53)+ (False)+ H.describe "isSpace" $ do+ H.it "space" $ H.shouldBe+ (Chars.isSpace 32)+ (True)+ H.it "tab" $ H.shouldBe+ (Chars.isSpace 9)+ (True)+ H.it "newline" $ H.shouldBe+ (Chars.isSpace 10)+ (True)+ H.it "letter" $ H.shouldBe+ (Chars.isSpace 97)+ (False)+ H.describe "isUpper" $ do+ H.it "uppercase" $ H.shouldBe+ (Chars.isUpper 65)+ (True)+ H.it "lowercase" $ H.shouldBe+ (Chars.isUpper 97)+ (False)+ H.it "digit" $ H.shouldBe+ (Chars.isUpper 53)+ (False)+ H.describe "toLower" $ do+ H.it "uppercase" $ H.shouldBe+ (Chars.toLower 65)+ (97)+ H.it "lowercase" $ H.shouldBe+ (Chars.toLower 97)+ (97)+ H.it "digit" $ H.shouldBe+ (Chars.toLower 53)+ (53)+ H.describe "toUpper" $ do+ H.it "lowercase" $ H.shouldBe+ (Chars.toUpper 97)+ (65)+ H.it "uppercase" $ H.shouldBe+ (Chars.toUpper 65)+ (65)+ H.it "digit" $ H.shouldBe+ (Chars.toUpper 53)+ (53)
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/EithersSpec.hs view
@@ -0,0 +1,190 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.eithers"},ModuleName {unModuleName = "Eithers"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.eithers"},ModuleName {unModuleName = "Eithers"}),(Namespace {unNamespace = "hydra.lib.equality"},ModuleName {unModuleName = "Equality"}),(Namespace {unNamespace = "hydra.lib.logic"},ModuleName {unModuleName = "Logic"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.Lib.EithersSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Eithers as Eithers+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "hydra.lib.eithers primitives" $ do+ H.describe "bind" $ do+ H.it "bind Right with success" $ H.shouldBe+ (Eithers.bind (Right "ab") (\s -> Logic.ifElse (Strings.null s) (Left 0) (Right (Strings.length s))))+ (Right 2 :: Either Int Int)+ H.it "bind Right with failure" $ H.shouldBe+ (Eithers.bind (Right "") (\s -> Logic.ifElse (Strings.null s) (Left 0) (Right (Strings.length s))))+ (Left 0 :: Either Int Int)+ H.it "bind Left returns Left unchanged" $ H.shouldBe+ (Eithers.bind (Left 42) (\s -> Logic.ifElse (Strings.null s) (Left 0) (Right (Strings.length s))))+ (Left 42 :: Either Int Int)+ H.describe "bimap" $ do+ H.it "map left value" $ H.shouldBe+ (Eithers.bimap (\x -> Math.mul x 2) (\s -> Strings.length s) (Left 5))+ (Left 10 :: Either Int Int)+ H.it "map right value" $ H.shouldBe+ (Eithers.bimap (\x -> Math.mul x 2) (\s -> Strings.length s) (Right "ab"))+ (Right 2 :: Either Int Int)+ H.describe "isLeft" $ do+ H.it "left value" $ H.shouldBe+ (Eithers.isLeft (Left 42))+ (True)+ H.it "right value" $ H.shouldBe+ (Eithers.isLeft (Right "test"))+ (False)+ H.describe "isRight" $ do+ H.it "right value" $ H.shouldBe+ (Eithers.isRight (Right "test"))+ (True)+ H.it "left value" $ H.shouldBe+ (Eithers.isRight (Left 42))+ (False)+ H.describe "fromLeft" $ do+ H.it "extract left" $ H.shouldBe+ (Eithers.fromLeft 99 (Left 42))+ (42)+ H.it "use default for right" $ H.shouldBe+ (Eithers.fromLeft 99 (Right "test"))+ (99)+ H.describe "fromRight" $ do+ H.it "extract right" $ H.shouldBe+ (Eithers.fromRight "default" (Right "test"))+ ("test")+ H.it "use default for left" $ H.shouldBe+ (Eithers.fromRight "default" (Left 42))+ ("default")+ H.describe "either" $ do+ H.it "apply left function" $ H.shouldBe+ (Eithers.either (\x -> Math.mul x 2) (\s -> Strings.length s) (Left 5))+ (10)+ H.it "apply right function" $ H.shouldBe+ (Eithers.either (\x -> Math.mul x 2) (\s -> Strings.length s) (Right "ab"))+ (2)+ H.describe "lefts" $ do+ H.it "filter left values" $ H.shouldBe+ (Eithers.lefts [+ Left 1,+ (Right "a"),+ (Left 2),+ (Right "b")])+ ([+ 1,+ 2])+ H.it "all lefts" $ H.shouldBe+ (Eithers.lefts [+ Left 1,+ (Left 2)])+ ([+ 1,+ 2])+ H.it "all rights" $ H.shouldBe+ (Eithers.lefts [+ Right "a",+ (Right "b")])+ ([] :: [Int])+ H.it "empty list" $ H.shouldBe+ (Eithers.lefts [])+ ([] :: [Int])+ H.describe "rights" $ do+ H.it "filter right values" $ H.shouldBe+ (Eithers.rights [+ Left 1,+ (Right "a"),+ (Left 2),+ (Right "b")])+ ([+ "a",+ "b"])+ H.it "all rights" $ H.shouldBe+ (Eithers.rights [+ Right "a",+ (Right "b")])+ ([+ "a",+ "b"])+ H.it "all lefts" $ H.shouldBe+ (Eithers.rights [+ Left 1,+ (Left 2)])+ ([] :: [Int])+ H.it "empty list" $ H.shouldBe+ (Eithers.rights [])+ ([] :: [Int])+ H.describe "partitionEithers" $ do+ H.it "partition mixed" $ H.shouldBe+ (Eithers.partitionEithers [+ Left 1,+ (Right "a"),+ (Left 2),+ (Right "b")])+ (([+ 1,+ 2], [+ "a",+ "b"]))+ H.it "all lefts" $ H.shouldBe+ (Eithers.partitionEithers [+ Left 1,+ (Left 2)])+ (([+ 1,+ 2], []) :: ([Int], [Int]))+ H.it "all rights" $ H.shouldBe+ (Eithers.partitionEithers [+ Right "a",+ (Right "b")])+ (([], [+ "a",+ "b"]) :: ([Int], [String]))+ H.it "empty list" $ H.shouldBe+ (Eithers.partitionEithers [])+ (([], []) :: ([Int], [Int]))+ H.describe "map" $ do+ H.it "map right value" $ H.shouldBe+ (Eithers.map (\x -> Math.mul x 2) (Right 5))+ (Right 10 :: Either Int Int)+ H.it "preserve left" $ H.shouldBe+ (Eithers.map (\x -> Math.mul x 2) (Left 99))+ (Left 99 :: Either Int Int)+ H.describe "mapList" $ do+ H.it "all succeed" $ H.shouldBe+ (Eithers.mapList (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) [+ 1,+ 2,+ 3])+ (Right [+ 2,+ 4,+ 6] :: Either String [Int])+ H.it "first fails" $ H.shouldBe+ (Eithers.mapList (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) [+ 1,+ 0,+ 3])+ (Left "zero" :: Either String [Int])+ H.it "empty list" $ H.shouldBe+ (Eithers.mapList (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) [])+ (Right [] :: Either String [Int])+ H.describe "mapMaybe" $ do+ H.it "just succeeds" $ H.shouldBe+ (Eithers.mapMaybe (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) (Just 5))+ (Right (Just 10) :: Either String (Maybe Int))+ H.it "just fails" $ H.shouldBe+ (Eithers.mapMaybe (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) (Just 0))+ (Left "zero" :: Either String (Maybe Int))+ H.it "nothing" $ H.shouldBe+ (Eithers.mapMaybe (\x -> Logic.ifElse (Equality.equal x 0) (Left "zero") (Right (Math.mul x 2))) Nothing)+ (Right Nothing :: Either String (Maybe Int))
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/EqualitySpec.hs view
@@ -0,0 +1,190 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.equality"},ModuleName {unModuleName = "Equality"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.equality"},ModuleName {unModuleName = "Equality"}),(Namespace {unNamespace = "hydra.util"},ModuleName {unModuleName = "Util"})]++module Generation.Hydra.Test.Lib.EqualitySpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Util as Util++spec :: H.Spec+spec = H.describe "hydra.lib.equality primitives" $ do+ H.describe "compare" $ do+ H.it "less than" $ H.shouldBe+ (Equality.compare 3 5)+ (Util.ComparisonLessThan)+ H.it "equal" $ H.shouldBe+ (Equality.compare 5 5)+ (Util.ComparisonEqualTo)+ H.it "greater than" $ H.shouldBe+ (Equality.compare 5 3)+ (Util.ComparisonGreaterThan)+ H.describe "equal" $ do+ H.it "equal integers" $ H.shouldBe+ (Equality.equal 5 5)+ (True)+ H.it "unequal integers" $ H.shouldBe+ (Equality.equal 5 3)+ (False)+ H.describe "gt" $ do+ H.it "greater" $ H.shouldBe+ (Equality.gt 5 3)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.gt 5 5)+ (False)+ H.it "less" $ H.shouldBe+ (Equality.gt 3 5)+ (False)+ H.describe "gte" $ do+ H.it "greater" $ H.shouldBe+ (Equality.gte 5 3)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.gte 5 5)+ (True)+ H.it "less" $ H.shouldBe+ (Equality.gte 3 5)+ (False)+ H.describe "identity" $ do+ H.it "integer" $ H.shouldBe+ (Equality.identity 42)+ (42)+ H.describe "lt" $ do+ H.it "less" $ H.shouldBe+ (Equality.lt 3 5)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.lt 5 5)+ (False)+ H.it "greater" $ H.shouldBe+ (Equality.lt 5 3)+ (False)+ H.describe "lte" $ do+ H.it "less" $ H.shouldBe+ (Equality.lte 3 5)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.lte 5 5)+ (True)+ H.it "greater" $ H.shouldBe+ (Equality.lte 5 3)+ (False)+ H.describe "max" $ do+ H.it "first greater" $ H.shouldBe+ (Equality.max 5 3)+ (5)+ H.it "second greater" $ H.shouldBe+ (Equality.max 3 5)+ (5)+ H.it "equal" $ H.shouldBe+ (Equality.max 5 5)+ (5)+ H.describe "min" $ do+ H.it "first less" $ H.shouldBe+ (Equality.min 3 5)+ (3)+ H.it "second less" $ H.shouldBe+ (Equality.min 5 3)+ (3)+ H.it "equal" $ H.shouldBe+ (Equality.min 5 5)+ (5)+ H.describe "compare strings" $ do+ H.it "less than (lexicographic)" $ H.shouldBe+ (Equality.compare "apple" "banana")+ (Util.ComparisonLessThan)+ H.it "equal" $ H.shouldBe+ (Equality.compare "hello" "hello")+ (Util.ComparisonEqualTo)+ H.it "greater than (lexicographic)" $ H.shouldBe+ (Equality.compare "zebra" "apple")+ (Util.ComparisonGreaterThan)+ H.it "empty vs non-empty" $ H.shouldBe+ (Equality.compare "" "a")+ (Util.ComparisonLessThan)+ H.it "prefix vs longer" $ H.shouldBe+ (Equality.compare "ab" "abc")+ (Util.ComparisonLessThan)+ H.describe "lt strings" $ do+ H.it "less (lexicographic)" $ H.shouldBe+ (Equality.lt "apple" "banana")+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.lt "hello" "hello")+ (False)+ H.it "greater" $ H.shouldBe+ (Equality.lt "zebra" "apple")+ (False)+ H.describe "gt strings" $ do+ H.it "greater (lexicographic)" $ H.shouldBe+ (Equality.gt "zebra" "apple")+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.gt "hello" "hello")+ (False)+ H.it "less" $ H.shouldBe+ (Equality.gt "apple" "banana")+ (False)+ H.describe "max strings" $ do+ H.it "first greater" $ H.shouldBe+ (Equality.max "zebra" "apple")+ ("zebra")+ H.it "second greater" $ H.shouldBe+ (Equality.max "apple" "zebra")+ ("zebra")+ H.it "equal" $ H.shouldBe+ (Equality.max "hello" "hello")+ ("hello")+ H.describe "min strings" $ do+ H.it "first less" $ H.shouldBe+ (Equality.min "apple" "zebra")+ ("apple")+ H.it "second less" $ H.shouldBe+ (Equality.min "zebra" "apple")+ ("apple")+ H.it "equal" $ H.shouldBe+ (Equality.min "hello" "hello")+ ("hello")+ H.describe "compare floats" $ do+ H.it "less than" $ H.shouldBe+ (Equality.compare 1.5 2.5)+ (Util.ComparisonLessThan)+ H.it "equal" $ H.shouldBe+ (Equality.compare 3.14 3.14)+ (Util.ComparisonEqualTo)+ H.it "greater than" $ H.shouldBe+ (Equality.compare 5.0 3.0)+ (Util.ComparisonGreaterThan)+ H.it "negative vs positive" $ H.shouldBe+ (Equality.compare (-1.0) 1.0)+ (Util.ComparisonLessThan)+ H.describe "lt floats" $ do+ H.it "less" $ H.shouldBe+ (Equality.lt 1.5 2.5)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.lt 3.14 3.14)+ (False)+ H.it "greater" $ H.shouldBe+ (Equality.lt 5.0 3.0)+ (False)+ H.describe "gt floats" $ do+ H.it "greater" $ H.shouldBe+ (Equality.gt 5.0 3.0)+ (True)+ H.it "equal" $ H.shouldBe+ (Equality.gt 3.14 3.14)+ (False)+ H.it "less" $ H.shouldBe+ (Equality.gt 1.5 2.5)+ (False)
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/FlowsSpec.hs view
@@ -0,0 +1,183 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.flows"},ModuleName {unModuleName = "Flows"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.compute"},ModuleName {unModuleName = "Compute"}),(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.flows"},ModuleName {unModuleName = "Flows"}),(Namespace {unNamespace = "hydra.lib.maps"},ModuleName {unModuleName = "Maps"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.sets"},ModuleName {unModuleName = "Sets"}),(Namespace {unNamespace = "hydra.monads"},ModuleName {unModuleName = "Monads"})]++module Generation.Hydra.Test.Lib.FlowsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Compute as Compute+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Flows as Flows+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Monads as Monads++spec :: H.Spec+spec = H.describe "hydra.lib.flows primitives" $ do+ H.describe "apply" $ do+ H.it "apply add" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 3)) (\f -> Monads.bind (Monads.pure 5) (\x -> Monads.pure (f x)))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 8)+ H.describe "bind" $ do+ H.it "bind add" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 5) (\n -> Monads.pure (Math.add n 5))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 10)+ H.it "bind multiply" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 3) (\n -> Monads.pure (Math.mul n 4))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 12)+ H.describe "fail" $ do+ H.it "fail with message" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.fail "test error message") Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Nothing :: Maybe Int)+ H.describe "foldl" $ do+ H.it "foldl sum" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 0) (\a0 -> Monads.bind (Monads.pure (Math.add a0 1)) (\a1 -> Monads.bind (Monads.pure (Math.add a1 2)) (\a2 -> Monads.pure (Math.add a2 3))))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 6)+ H.describe "map" $ do+ H.it "map negate" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Flows.map Math.negate (Monads.pure 5)) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (-5))+ H.it "map abs" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Flows.map Math.abs (Monads.pure (-3))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 3)+ H.describe "mapElems" $ do+ H.it "mapElems add one" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 1 1)) (\v1 -> Monads.bind (Monads.pure (Math.add 2 1)) (\v2 -> Monads.pure (Maps.fromList [+ ("a", v1),+ ("b", v2)])))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (M.fromList [+ ("a", 2),+ ("b", 3)]))+ H.describe "mapKeys" $ do+ H.it "mapKeys add one" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 1 1)) (\k1 -> Monads.bind (Monads.pure (Math.add 2 1)) (\k2 -> Monads.pure (Maps.fromList [+ (k1, "a"),+ (k2, "b")])))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (M.fromList [+ (2, "a"),+ (3, "b")]))+ H.describe "mapList" $ do+ H.it "mapList add one" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 1 1)) (\y1 -> Monads.bind (Monads.pure (Math.add 2 1)) (\y2 -> Monads.bind (Monads.pure (Math.add 3 1)) (\y3 -> Monads.pure [+ y1,+ y2,+ y3])))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just [+ 2,+ 3,+ 4])+ H.describe "mapMaybe" $ do+ H.it "mapMaybe just" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 5 1)) (\y -> Monads.pure (Just y))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (Just 6))+ H.it "mapMaybe nothing" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure Nothing) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just Nothing :: Maybe (Maybe Int))+ H.describe "mapSet" $ do+ H.it "mapSet add one" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure (Math.add 1 1)) (\y1 -> Monads.bind (Monads.pure (Math.add 2 1)) (\y2 -> Monads.bind (Monads.pure (Math.add 3 1)) (\y3 -> Monads.pure (Sets.fromList [+ y1,+ y2,+ y3]))))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (S.fromList [+ 2,+ 3,+ 4]))+ H.describe "pure" $ do+ H.it "pure integer" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure 42) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 42)+ H.it "pure zero" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure 0) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 0)+ H.it "pure negative" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure (-5)) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (-5))+ H.it "pure string" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure "hello") Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just "hello")+ H.describe "sequence" $ do+ H.it "sequence pure list" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 1) (\x1 -> Monads.bind (Monads.pure 2) (\x2 -> Monads.bind (Monads.pure 3) (\x3 -> Monads.pure [+ x1,+ x2,+ x3])))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just [+ 1,+ 2,+ 3])+ H.describe "withDefault" $ do+ H.it "withDefault on success returns original" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Flows.withDefault 0 (Monads.pure 42)) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 42)+ H.it "withDefault on failure returns fallback" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Flows.withDefault 99 (Monads.fail "error")) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 99)
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/ListsSpec.hs view
@@ -0,0 +1,1370 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.lists"},ModuleName {unModuleName = "Lists"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.equality"},ModuleName {unModuleName = "Equality"}),(Namespace {unNamespace = "hydra.lib.lists"},ModuleName {unModuleName = "Lists"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.Lib.ListsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "hydra.lib.lists primitives" $ do+ H.describe "apply" $ do+ H.describe "string transformations" $ do+ H.it "string transformations" $ H.shouldBe+ (Lists.apply [+ Strings.toUpper,+ Strings.toLower] [+ "One",+ "Two",+ "Three"])+ ([+ "ONE",+ "TWO",+ "THREE",+ "one",+ "two",+ "three"])+ H.describe "edge cases" $ do+ H.it "empty function list" $ H.shouldBe+ (Lists.apply [] [+ "a",+ "b"])+ ([] :: [Int])+ H.it "empty input list" $ H.shouldBe+ (Lists.apply [+ Strings.toUpper] [])+ ([])+ H.it "single function" $ H.shouldBe+ (Lists.apply [+ Strings.toUpper] [+ "hello"])+ ([+ "HELLO"])+ H.it "single input" $ H.shouldBe+ (Lists.apply [+ Strings.toUpper,+ Strings.toLower] [+ "Test"])+ ([+ "TEST",+ "test"])+ H.describe "at" $ do+ H.it "first element" $ H.shouldBe+ (Lists.at 0 [+ 1,+ 2,+ 3])+ (1)+ H.it "middle element" $ H.shouldBe+ (Lists.at 1 [+ 1,+ 2,+ 3])+ (2)+ H.it "last element" $ H.shouldBe+ (Lists.at 2 [+ 1,+ 2,+ 3])+ (3)+ H.it "single element list" $ H.shouldBe+ (Lists.at 0 [+ 42])+ (42)+ H.it "string list access" $ H.shouldBe+ (Lists.at 1 [+ "hello",+ "world"])+ ("world")+ H.describe "bind" $ do+ H.it "negation function" $ H.shouldBe+ (Lists.bind [+ 1,+ 2,+ 3,+ 4] (\x -> Lists.pure (Math.negate x)))+ ([+ (-1),+ (-2),+ (-3),+ (-4)])+ H.it "empty list" $ H.shouldBe+ (Lists.bind [] (\x -> Lists.pure (Math.negate x)))+ ([])+ H.it "single element" $ H.shouldBe+ (Lists.bind [+ 5] (\x -> Lists.pure (Math.negate x)))+ ([+ (-5)])+ H.it "duplicate elements" $ H.shouldBe+ (Lists.bind [+ 1,+ 1,+ 2] (\x -> Lists.pure (Math.negate x)))+ ([+ (-1),+ (-1),+ (-2)])+ H.describe "concat" $ do+ H.it "multiple non-empty lists" $ H.shouldBe+ (Lists.concat [+ [+ 1,+ 2,+ 3],+ [+ 4,+ 5],+ [+ 6,+ 7,+ 8]])+ ([+ 1,+ 2,+ 3,+ 4,+ 5,+ 6,+ 7,+ 8])+ H.it "empty lists included" $ H.shouldBe+ (Lists.concat [+ [],+ [+ 1,+ 2],+ [],+ [+ 3]])+ ([+ 1,+ 2,+ 3])+ H.it "single list" $ H.shouldBe+ (Lists.concat [+ [+ 1,+ 2,+ 3]])+ ([+ 1,+ 2,+ 3])+ H.it "all empty lists" $ H.shouldBe+ (Lists.concat [+ [],+ [],+ []])+ ([] :: [Int])+ H.it "empty list of lists" $ H.shouldBe+ (Lists.concat [])+ ([] :: [Int])+ H.describe "concat2" $ do+ H.it "two non-empty lists" $ H.shouldBe+ (Lists.concat2 [+ 1,+ 2] [+ 3,+ 4])+ ([+ 1,+ 2,+ 3,+ 4])+ H.it "first list empty" $ H.shouldBe+ (Lists.concat2 [] [+ 1,+ 2])+ ([+ 1,+ 2])+ H.it "second list empty" $ H.shouldBe+ (Lists.concat2 [+ 1,+ 2] [])+ ([+ 1,+ 2])+ H.it "both lists empty" $ H.shouldBe+ (Lists.concat2 [] [])+ ([] :: [Int])+ H.it "single elements" $ H.shouldBe+ (Lists.concat2 [+ 1] [+ 2])+ ([+ 1,+ 2])+ H.it "string lists" $ H.shouldBe+ (Lists.concat2 [+ "a",+ "b"] [+ "c",+ "d"])+ ([+ "a",+ "b",+ "c",+ "d"])+ H.describe "cons" $ do+ H.it "cons to non-empty list" $ H.shouldBe+ (Lists.cons 1 [+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "cons to empty list" $ H.shouldBe+ (Lists.cons 1 [])+ ([+ 1])+ H.it "cons negative number" $ H.shouldBe+ (Lists.cons (-1) [+ 2,+ 3])+ ([+ (-1),+ 2,+ 3])+ H.it "cons string" $ H.shouldBe+ (Lists.cons "hello" [+ "world"])+ ([+ "hello",+ "world"])+ H.describe "drop" $ do+ H.it "drop from beginning" $ H.shouldBe+ (Lists.drop 2 [+ 1,+ 2,+ 3,+ 4,+ 5])+ ([+ 3,+ 4,+ 5])+ H.it "drop zero elements" $ H.shouldBe+ (Lists.drop 0 [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "drop all elements" $ H.shouldBe+ (Lists.drop 3 [+ 1,+ 2,+ 3])+ ([])+ H.it "drop more than length" $ H.shouldBe+ (Lists.drop 5 [+ 1,+ 2])+ ([])+ H.it "drop from empty list" $ H.shouldBe+ (Lists.drop 3 [])+ ([] :: [Int])+ H.it "drop negative amount" $ H.shouldBe+ (Lists.drop (-1) [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.describe "dropWhile" $ do+ H.it "drop while less than 3" $ H.shouldBe+ (Lists.dropWhile (\x -> Equality.lt x 3) [+ 1,+ 2,+ 3,+ 2,+ 1])+ ([+ 3,+ 2,+ 1])+ H.it "drop all elements" $ H.shouldBe+ (Lists.dropWhile (\x -> Equality.lt x 10) [+ 1,+ 2,+ 3])+ ([])+ H.it "drop no elements" $ H.shouldBe+ (Lists.dropWhile (\x -> Equality.lt x 0) [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "empty list" $ H.shouldBe+ (Lists.dropWhile (\x -> Equality.lt x 5) [])+ ([])+ H.describe "elem" $ do+ H.it "element present" $ H.shouldBe+ (Lists.elem 2 [+ 1,+ 2,+ 3])+ (True)+ H.it "element not present" $ H.shouldBe+ (Lists.elem 4 [+ 1,+ 2,+ 3])+ (False)+ H.it "empty list" $ H.shouldBe+ (Lists.elem 1 [])+ (False)+ H.it "single element present" $ H.shouldBe+ (Lists.elem 1 [+ 1])+ (True)+ H.it "single element not present" $ H.shouldBe+ (Lists.elem 2 [+ 1])+ (False)+ H.it "duplicate elements" $ H.shouldBe+ (Lists.elem 2 [+ 1,+ 2,+ 2,+ 3])+ (True)+ H.it "string element present" $ H.shouldBe+ (Lists.elem "hello" [+ "world",+ "hello",+ "test"])+ (True)+ H.it "string element not present" $ H.shouldBe+ (Lists.elem "missing" [+ "world",+ "hello"])+ (False)+ H.describe "filter" $ do+ H.it "filter positive numbers" $ H.shouldBe+ (Lists.filter (\x -> Equality.gt x 0) [+ (-1),+ 2,+ (-3),+ 4,+ 5])+ ([+ 2,+ 4,+ 5])+ H.it "filter all elements" $ H.shouldBe+ (Lists.filter (\x -> Equality.lt x 10) [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "filter no elements" $ H.shouldBe+ (Lists.filter (\x -> Equality.gt x 10) [+ 1,+ 2,+ 3])+ ([])+ H.it "empty list" $ H.shouldBe+ (Lists.filter (\x -> Equality.gt x 0) [])+ ([])+ H.describe "find" $ do+ H.it "find existing element" $ H.shouldBe+ (Lists.find (\x -> Equality.gt x 3) [+ 1,+ 2,+ 4,+ 5])+ (Just 4)+ H.it "find first matching" $ H.shouldBe+ (Lists.find (\x -> Equality.gt x 0) [+ 1,+ 2,+ 3])+ (Just 1)+ H.it "find no match" $ H.shouldBe+ (Lists.find (\x -> Equality.gt x 10) [+ 1,+ 2,+ 3])+ (Nothing)+ H.it "find in empty list" $ H.shouldBe+ (Lists.find (\x -> Equality.gt x 0) [])+ (Nothing)+ H.it "find single element" $ H.shouldBe+ (Lists.find (\x -> Equality.equal x 42) [+ 42])+ (Just 42)+ H.describe "foldl" $ do+ H.it "sum with addition" $ H.shouldBe+ (Lists.foldl Math.add 0 [+ 1,+ 2,+ 3,+ 4])+ (10)+ H.it "product with multiplication" $ H.shouldBe+ (Lists.foldl Math.mul 1 [+ 2,+ 3,+ 4])+ (24)+ H.it "empty list" $ H.shouldBe+ (Lists.foldl Math.add 5 [])+ (5)+ H.it "single element" $ H.shouldBe+ (Lists.foldl Math.add 10 [+ 5])+ (15)+ H.it "subtraction fold" $ H.shouldBe+ (Lists.foldl Math.sub 10 [+ 1,+ 2,+ 3])+ (4)+ H.describe "group" $ do+ H.it "consecutive duplicates" $ H.shouldBe+ (Lists.group [+ 1,+ 1,+ 2,+ 2,+ 2,+ 3,+ 1])+ ([+ [+ 1,+ 1],+ [+ 2,+ 2,+ 2],+ [+ 3],+ [+ 1]])+ H.it "no duplicates" $ H.shouldBe+ (Lists.group [+ 1,+ 2,+ 3])+ ([+ [+ 1],+ [+ 2],+ [+ 3]])+ H.it "all same" $ H.shouldBe+ (Lists.group [+ 1,+ 1,+ 1])+ ([+ [+ 1,+ 1,+ 1]])+ H.it "empty list" $ H.shouldBe+ (Lists.group [])+ ([] :: [[Int]])+ H.it "single element" $ H.shouldBe+ (Lists.group [+ 1])+ ([+ [+ 1]])+ H.describe "head" $ do+ H.it "three element list" $ H.shouldBe+ (Lists.head [+ 1,+ 2,+ 3])+ (1)+ H.it "single element list" $ H.shouldBe+ (Lists.head [+ 42])+ (42)+ H.it "negative numbers" $ H.shouldBe+ (Lists.head [+ (-1),+ (-2),+ (-3)])+ ((-1))+ H.it "string list" $ H.shouldBe+ (Lists.head [+ "hello",+ "world"])+ ("hello")+ H.describe "init" $ do+ H.it "multiple elements" $ H.shouldBe+ (Lists.init [+ 1,+ 2,+ 3,+ 4])+ ([+ 1,+ 2,+ 3])+ H.it "two elements" $ H.shouldBe+ (Lists.init [+ 1,+ 2])+ ([+ 1])+ H.it "single element" $ H.shouldBe+ (Lists.init [+ 1])+ ([])+ H.it "string list" $ H.shouldBe+ (Lists.init [+ "a",+ "b",+ "c"])+ ([+ "a",+ "b"])+ H.describe "intercalate" $ do+ H.it "double zero separator" $ H.shouldBe+ (Lists.intercalate [+ 0,+ 0] [+ [+ 1,+ 2,+ 3],+ [+ 4,+ 5],+ [+ 6,+ 7,+ 8]])+ ([+ 1,+ 2,+ 3,+ 0,+ 0,+ 4,+ 5,+ 0,+ 0,+ 6,+ 7,+ 8])+ H.it "empty separator" $ H.shouldBe+ (Lists.intercalate [] [+ [+ 1,+ 2],+ [+ 3,+ 4]])+ ([+ 1,+ 2,+ 3,+ 4])+ H.it "single element separator" $ H.shouldBe+ (Lists.intercalate [+ 99] [+ [+ 1],+ [+ 2],+ [+ 3]])+ ([+ 1,+ 99,+ 2,+ 99,+ 3])+ H.it "empty list of lists" $ H.shouldBe+ (Lists.intercalate [+ 0] [])+ ([])+ H.it "single list" $ H.shouldBe+ (Lists.intercalate [+ 0] [+ [+ 1,+ 2,+ 3]])+ ([+ 1,+ 2,+ 3])+ H.it "lists with empty lists" $ H.shouldBe+ (Lists.intercalate [+ 0] [+ [],+ [+ 1],+ []])+ ([+ 0,+ 1,+ 0])+ H.describe "intersperse" $ do+ H.it "string interspersion" $ H.shouldBe+ (Lists.intersperse "and" [+ "one",+ "two",+ "three"])+ ([+ "one",+ "and",+ "two",+ "and",+ "three"])+ H.it "single element" $ H.shouldBe+ (Lists.intersperse "x" [+ "only"])+ ([+ "only"])+ H.it "empty list" $ H.shouldBe+ (Lists.intersperse "x" [])+ ([])+ H.it "two elements" $ H.shouldBe+ (Lists.intersperse "+" [+ "a",+ "b"])+ ([+ "a",+ "+",+ "b"])+ H.it "number interspersion" $ H.shouldBe+ (Lists.intersperse 0 [+ 1,+ 2,+ 3])+ ([+ 1,+ 0,+ 2,+ 0,+ 3])+ H.describe "last" $ do+ H.it "three element list" $ H.shouldBe+ (Lists.last [+ 1,+ 2,+ 3])+ (3)+ H.it "single element list" $ H.shouldBe+ (Lists.last [+ 42])+ (42)+ H.it "negative numbers" $ H.shouldBe+ (Lists.last [+ (-1),+ (-2),+ (-3)])+ ((-3))+ H.it "string list" $ H.shouldBe+ (Lists.last [+ "hello",+ "world"])+ ("world")+ H.describe "length" $ do+ H.it "three elements" $ H.shouldBe+ (Lists.length [+ 1,+ 2,+ 3])+ (3)+ H.it "empty list" $ H.shouldBe+ (Lists.length [])+ (0)+ H.it "single element" $ H.shouldBe+ (Lists.length [+ 42])+ (1)+ H.it "many elements" $ H.shouldBe+ (Lists.length [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6,+ 7,+ 8,+ 9,+ 10])+ (10)+ H.it "string list" $ H.shouldBe+ (Lists.length [+ "a",+ "b",+ "c"])+ (3)+ H.describe "map" $ do+ H.it "string to uppercase" $ H.shouldBe+ (Lists.map Strings.toUpper [+ "one",+ "two"])+ ([+ "ONE",+ "TWO"])+ H.it "empty list" $ H.shouldBe+ (Lists.map Strings.toUpper [])+ ([])+ H.it "single element" $ H.shouldBe+ (Lists.map Strings.toUpper [+ "hello"])+ ([+ "HELLO"])+ H.it "number negation" $ H.shouldBe+ (Lists.map Math.negate [+ 1,+ 2,+ 3])+ ([+ (-1),+ (-2),+ (-3)])+ H.it "identity function" $ H.shouldBe+ (Lists.map Equality.identity [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.describe "nub" $ do+ H.it "remove duplicates" $ H.shouldBe+ (Lists.nub [+ 1,+ 2,+ 1,+ 3,+ 2,+ 4])+ ([+ 1,+ 2,+ 3,+ 4])+ H.it "no duplicates" $ H.shouldBe+ (Lists.nub [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "all duplicates" $ H.shouldBe+ (Lists.nub [+ 1,+ 1,+ 1])+ ([+ 1])+ H.it "empty list" $ H.shouldBe+ (Lists.nub [])+ ([] :: [Int])+ H.it "single element" $ H.shouldBe+ (Lists.nub [+ 1])+ ([+ 1])+ H.it "string duplicates" $ H.shouldBe+ (Lists.nub [+ "a",+ "b",+ "a",+ "c"])+ ([+ "a",+ "b",+ "c"])+ H.describe "null" $ do+ H.it "empty int list" $ H.shouldBe+ (Lists.null [])+ (True)+ H.it "single element" $ H.shouldBe+ (Lists.null [+ 1])+ (False)+ H.it "multiple elements" $ H.shouldBe+ (Lists.null [+ 1,+ 2,+ 3])+ (False)+ H.it "empty string list" $ H.shouldBe+ (Lists.null [])+ (True)+ H.it "non-empty string list" $ H.shouldBe+ (Lists.null [+ "a"])+ (False)+ H.describe "partition" $ do+ H.it "partition greater than 3" $ H.shouldBe+ (Lists.partition (\x -> Equality.gt x 3) [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6])+ (([+ 4,+ 5,+ 6], [+ 1,+ 2,+ 3]))+ H.it "partition all elements" $ H.shouldBe+ (Lists.partition (\x -> Equality.lt x 10) [+ 1,+ 2,+ 3])+ (([+ 1,+ 2,+ 3], []))+ H.it "partition no elements" $ H.shouldBe+ (Lists.partition (\x -> Equality.gt x 10) [+ 1,+ 2,+ 3])+ (([], [+ 1,+ 2,+ 3]))+ H.it "partition even numbers" $ H.shouldBe+ (Lists.partition (\x -> Math.even x) [+ 1,+ 2,+ 3,+ 4,+ 5,+ 6])+ (([+ 2,+ 4,+ 6], [+ 1,+ 3,+ 5]))+ H.it "empty list" $ H.shouldBe+ (Lists.partition (\x -> Equality.lt x 5) [])+ (([], []))+ H.describe "pure" $ do+ H.it "string element" $ H.shouldBe+ (Lists.pure "one")+ ([+ "one"])+ H.it "empty string" $ H.shouldBe+ (Lists.pure "")+ ([+ ""])+ H.it "number element" $ H.shouldBe+ (Lists.pure 42)+ ([+ 42])+ H.it "negative number" $ H.shouldBe+ (Lists.pure (-5))+ ([+ (-5)])+ H.describe "replicate" $ do+ H.it "replicate three times" $ H.shouldBe+ (Lists.replicate 3 42)+ ([+ 42,+ 42,+ 42])+ H.it "replicate zero times" $ H.shouldBe+ (Lists.replicate 0 1)+ ([])+ H.it "replicate once" $ H.shouldBe+ (Lists.replicate 1 99)+ ([+ 99])+ H.it "replicate string" $ H.shouldBe+ (Lists.replicate 2 "hello")+ ([+ "hello",+ "hello"])+ H.describe "reverse" $ do+ H.it "multiple elements" $ H.shouldBe+ (Lists.reverse [+ 1,+ 2,+ 3,+ 4])+ ([+ 4,+ 3,+ 2,+ 1])+ H.it "single element" $ H.shouldBe+ (Lists.reverse [+ 1])+ ([+ 1])+ H.it "empty list" $ H.shouldBe+ (Lists.reverse [])+ ([] :: [Int])+ H.it "two elements" $ H.shouldBe+ (Lists.reverse [+ 1,+ 2])+ ([+ 2,+ 1])+ H.it "string list" $ H.shouldBe+ (Lists.reverse [+ "a",+ "b",+ "c"])+ ([+ "c",+ "b",+ "a"])+ H.describe "safeHead" $ do+ H.it "non-empty int list" $ H.shouldBe+ (Lists.safeHead [+ 1,+ 2,+ 3])+ (Just 1)+ H.it "empty int list" $ H.shouldBe+ (Lists.safeHead [])+ (Nothing :: Maybe Int)+ H.it "single element" $ H.shouldBe+ (Lists.safeHead [+ 42])+ (Just 42)+ H.it "non-empty string list" $ H.shouldBe+ (Lists.safeHead [+ "hello",+ "world"])+ (Just "hello")+ H.it "empty string list" $ H.shouldBe+ (Lists.safeHead [])+ (Nothing :: Maybe Int)+ H.describe "singleton" $ do+ H.it "number element" $ H.shouldBe+ (Lists.singleton 42)+ ([+ 42])+ H.it "negative number" $ H.shouldBe+ (Lists.singleton (-1))+ ([+ (-1)])+ H.it "zero" $ H.shouldBe+ (Lists.singleton 0)+ ([+ 0])+ H.it "string element" $ H.shouldBe+ (Lists.singleton "hello")+ ([+ "hello"])+ H.describe "sort" $ do+ H.it "unsorted numbers" $ H.shouldBe+ (Lists.sort [+ 3,+ 1,+ 4,+ 1,+ 5])+ ([+ 1,+ 1,+ 3,+ 4,+ 5])+ H.it "already sorted" $ H.shouldBe+ (Lists.sort [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "reverse sorted" $ H.shouldBe+ (Lists.sort [+ 3,+ 2,+ 1])+ ([+ 1,+ 2,+ 3])+ H.it "single element" $ H.shouldBe+ (Lists.sort [+ 1])+ ([+ 1])+ H.it "empty list" $ H.shouldBe+ (Lists.sort [])+ ([] :: [Int])+ H.it "duplicates" $ H.shouldBe+ (Lists.sort [+ 2,+ 1,+ 2,+ 3,+ 1])+ ([+ 1,+ 1,+ 2,+ 2,+ 3])+ H.it "string sort" $ H.shouldBe+ (Lists.sort [+ "zebra",+ "apple",+ "banana"])+ ([+ "apple",+ "banana",+ "zebra"])+ H.describe "sortOn" $ do+ H.it "sort by string length" $ H.shouldBe+ (Lists.sortOn Strings.length [+ "hello",+ "hi",+ "world"])+ ([+ "hi",+ "hello",+ "world"])+ H.it "empty string list" $ H.shouldBe+ (Lists.sortOn Strings.length [])+ ([])+ H.it "single string element" $ H.shouldBe+ (Lists.sortOn Strings.length [+ "test"])+ ([+ "test"])+ H.it "sort by negation" $ H.shouldBe+ (Lists.sortOn Math.negate [+ 1,+ 3,+ 2])+ ([+ 3,+ 2,+ 1])+ H.it "sort by absolute value" $ H.shouldBe+ (Lists.sortOn Math.abs [+ (-1),+ (-3),+ 2])+ ([+ (-1),+ 2,+ (-3)])+ H.describe "span" $ do+ H.it "span less than 3" $ H.shouldBe+ (Lists.span (\x -> Equality.lt x 3) [+ 1,+ 2,+ 3,+ 1,+ 2])+ (([+ 1,+ 2], [+ 3,+ 1,+ 2]))+ H.it "span all elements" $ H.shouldBe+ (Lists.span (\x -> Equality.lt x 10) [+ 1,+ 2,+ 3])+ (([+ 1,+ 2,+ 3], []))+ H.it "span no elements" $ H.shouldBe+ (Lists.span (\x -> Equality.gt x 10) [+ 1,+ 2,+ 3])+ (([], [+ 1,+ 2,+ 3]))+ H.it "empty list" $ H.shouldBe+ (Lists.span (\x -> Equality.lt x 5) [])+ (([], []))+ H.describe "tail" $ do+ H.it "multiple elements" $ H.shouldBe+ (Lists.tail [+ 1,+ 2,+ 3,+ 4])+ ([+ 2,+ 3,+ 4])+ H.it "two elements" $ H.shouldBe+ (Lists.tail [+ 1,+ 2])+ ([+ 2])+ H.it "single element" $ H.shouldBe+ (Lists.tail [+ 1])+ ([])+ H.it "string list" $ H.shouldBe+ (Lists.tail [+ "a",+ "b",+ "c"])+ ([+ "b",+ "c"])+ H.describe "take" $ do+ H.it "take from beginning" $ H.shouldBe+ (Lists.take 2 [+ 1,+ 2,+ 3,+ 4,+ 5])+ ([+ 1,+ 2])+ H.it "take zero elements" $ H.shouldBe+ (Lists.take 0 [+ 1,+ 2,+ 3])+ ([])+ H.it "take all elements" $ H.shouldBe+ (Lists.take 3 [+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "take more than length" $ H.shouldBe+ (Lists.take 5 [+ 1,+ 2])+ ([+ 1,+ 2])+ H.it "take from empty list" $ H.shouldBe+ (Lists.take 3 [])+ ([] :: [Int])+ H.it "take negative amount" $ H.shouldBe+ (Lists.take (-1) [+ 1,+ 2,+ 3])+ ([])+ H.describe "transpose" $ do+ H.it "square matrix" $ H.shouldBe+ (Lists.transpose [+ [+ 1,+ 2,+ 3],+ [+ 4,+ 5,+ 6]])+ ([+ [+ 1,+ 4],+ [+ 2,+ 5],+ [+ 3,+ 6]])+ H.it "empty lists" $ H.shouldBe+ (Lists.transpose [])+ ([] :: [[Int]])+ H.it "single row" $ H.shouldBe+ (Lists.transpose [+ [+ 1,+ 2,+ 3]])+ ([+ [+ 1],+ [+ 2],+ [+ 3]])+ H.it "single column" $ H.shouldBe+ (Lists.transpose [+ [+ 1],+ [+ 2],+ [+ 3]])+ ([+ [+ 1,+ 2,+ 3]])+ H.it "ragged matrix" $ H.shouldBe+ (Lists.transpose [+ [+ 1,+ 2],+ [+ 3],+ [+ 4,+ 5,+ 6]])+ ([+ [+ 1,+ 3,+ 4],+ [+ 2,+ 5],+ [+ 6]])+ H.describe "zip" $ do+ H.it "equal length lists" $ H.shouldBe+ (Lists.zip [+ 1,+ 2,+ 3] [+ "a",+ "b",+ "c"])+ ([+ (1, "a"),+ (2, "b"),+ (3, "c")])+ H.it "first list shorter" $ H.shouldBe+ (Lists.zip [+ 1,+ 2] [+ "a",+ "b",+ "c"])+ ([+ (1, "a"),+ (2, "b")])+ H.it "second list shorter" $ H.shouldBe+ (Lists.zip [+ 1,+ 2,+ 3] [+ "a",+ "b"])+ ([+ (1, "a"),+ (2, "b")])+ H.it "empty first list" $ H.shouldBe+ (Lists.zip [] [+ "a",+ "b"])+ ([] :: [(Int, String)])+ H.it "empty second list" $ H.shouldBe+ (Lists.zip [+ 1,+ 2] [])+ ([] :: [(Int, Int)])+ H.it "both empty lists" $ H.shouldBe+ (Lists.zip [] [])+ ([] :: [(Int, Int)])+ H.describe "zipWith" $ do+ H.it "addition" $ H.shouldBe+ (Lists.zipWith Math.add [+ 1,+ 2,+ 3] [+ 4,+ 5,+ 6])+ ([+ 5,+ 7,+ 9])+ H.it "first list shorter" $ H.shouldBe+ (Lists.zipWith Math.add [+ 1,+ 2] [+ 4,+ 5,+ 6])+ ([+ 5,+ 7])+ H.it "second list shorter" $ H.shouldBe+ (Lists.zipWith Math.add [+ 1,+ 2,+ 3] [+ 4,+ 5])+ ([+ 5,+ 7])+ H.it "empty first list" $ H.shouldBe+ (Lists.zipWith Math.add [] [+ 1,+ 2,+ 3])+ ([])+ H.it "empty second list" $ H.shouldBe+ (Lists.zipWith Math.add [+ 1,+ 2,+ 3] [])+ ([])+ H.it "string concatenation" $ H.shouldBe+ (Lists.zipWith Strings.cat2 [+ "a",+ "b"] [+ "1",+ "2"])+ ([+ "a1",+ "b2"])
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/LiteralsSpec.hs view
@@ -0,0 +1,578 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.literals"},ModuleName {unModuleName = "Literals"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.literals"},ModuleName {unModuleName = "Literals"})]++module Generation.Hydra.Test.Lib.LiteralsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Literals as Literals++spec :: H.Spec+spec = H.describe "hydra.lib.literals primitives" $ do+ H.describe "bigintToInt8" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigintToInt8 42)+ (42)+ H.it "negative" $ H.shouldBe+ (Literals.bigintToInt8 (-42))+ ((-42))+ H.describe "bigintToInt16" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigintToInt16 1000)+ (1000)+ H.it "negative" $ H.shouldBe+ (Literals.bigintToInt16 (-1000))+ ((-1000))+ H.describe "bigintToInt32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigintToInt32 42)+ (42)+ H.it "negative" $ H.shouldBe+ (Literals.bigintToInt32 (-42))+ ((-42))+ H.it "zero" $ H.shouldBe+ (Literals.bigintToInt32 0)+ (0)+ H.describe "bigintToInt64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigintToInt64 1000000)+ (1000000)+ H.it "negative" $ H.shouldBe+ (Literals.bigintToInt64 (-1000000))+ ((-1000000))+ H.describe "bigintToUint8" $ do+ H.it "zero" $ H.shouldBe+ (Literals.bigintToUint8 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.bigintToUint8 100)+ (100)+ H.describe "bigintToUint16" $ do+ H.it "zero" $ H.shouldBe+ (Literals.bigintToUint16 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.bigintToUint16 1000)+ (1000)+ H.describe "bigintToUint32" $ do+ H.it "zero" $ H.shouldBe+ (Literals.bigintToUint32 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.bigintToUint32 100000)+ (100000)+ H.describe "bigintToUint64" $ do+ H.it "zero" $ H.shouldBe+ (Literals.bigintToUint64 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.bigintToUint64 1000000)+ (1000000)+ H.describe "int8ToBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.int8ToBigint 42)+ (42)+ H.it "negative" $ H.shouldBe+ (Literals.int8ToBigint (-42))+ ((-42))+ H.it "max value" $ H.shouldBe+ (Literals.int8ToBigint 127)+ (127)+ H.it "min value" $ H.shouldBe+ (Literals.int8ToBigint (-128))+ ((-128))+ H.describe "int16ToBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.int16ToBigint 1000)+ (1000)+ H.it "negative" $ H.shouldBe+ (Literals.int16ToBigint (-1000))+ ((-1000))+ H.describe "int32ToBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.int32ToBigint 42)+ (42)+ H.it "negative" $ H.shouldBe+ (Literals.int32ToBigint (-42))+ ((-42))+ H.it "zero" $ H.shouldBe+ (Literals.int32ToBigint 0)+ (0)+ H.describe "int64ToBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.int64ToBigint 1000000)+ (1000000)+ H.it "negative" $ H.shouldBe+ (Literals.int64ToBigint (-1000000))+ ((-1000000))+ H.describe "uint8ToBigint" $ do+ H.it "zero" $ H.shouldBe+ (Literals.uint8ToBigint 0)+ (0)+ H.it "max value" $ H.shouldBe+ (Literals.uint8ToBigint 255)+ (255)+ H.describe "uint16ToBigint" $ do+ H.it "zero" $ H.shouldBe+ (Literals.uint16ToBigint 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.uint16ToBigint 1000)+ (1000)+ H.describe "uint32ToBigint" $ do+ H.it "zero" $ H.shouldBe+ (Literals.uint32ToBigint 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.uint32ToBigint 100000)+ (100000)+ H.describe "uint64ToBigint" $ do+ H.it "zero" $ H.shouldBe+ (Literals.uint64ToBigint 0)+ (0)+ H.it "typical value" $ H.shouldBe+ (Literals.uint64ToBigint 1000000)+ (1000000)+ H.describe "float32ToBigfloat" $ do+ H.it "positive" $ H.shouldBe+ (Literals.float32ToBigfloat 2.5)+ (2.5)+ H.it "negative" $ H.shouldBe+ (Literals.float32ToBigfloat (-2.5))+ ((-2.5))+ H.it "zero" $ H.shouldBe+ (Literals.float32ToBigfloat 0.0)+ (0.0)+ H.describe "float64ToBigfloat" $ do+ H.it "positive" $ H.shouldBe+ (Literals.float64ToBigfloat 3.14159)+ (3.14159)+ H.it "negative" $ H.shouldBe+ (Literals.float64ToBigfloat (-2.71828))+ ((-2.71828))+ H.it "zero" $ H.shouldBe+ (Literals.float64ToBigfloat 0.0)+ (0.0)+ H.describe "bigfloatToFloat32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigfloatToFloat32 3.14)+ (3.14)+ H.it "negative" $ H.shouldBe+ (Literals.bigfloatToFloat32 (-2.5))+ ((-2.5))+ H.it "zero" $ H.shouldBe+ (Literals.bigfloatToFloat32 0.0)+ (0.0)+ H.describe "bigfloatToFloat64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigfloatToFloat64 3.14159)+ (3.14159)+ H.it "negative" $ H.shouldBe+ (Literals.bigfloatToFloat64 (-2.71828))+ ((-2.71828))+ H.it "zero" $ H.shouldBe+ (Literals.bigfloatToFloat64 0.0)+ (0.0)+ H.describe "bigintToBigfloat" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigintToBigfloat 42)+ (42.0)+ H.it "negative" $ H.shouldBe+ (Literals.bigintToBigfloat (-42))+ ((-42.0))+ H.it "zero" $ H.shouldBe+ (Literals.bigintToBigfloat 0)+ (0.0)+ H.describe "bigfloatToBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.bigfloatToBigint 42.7)+ (43)+ H.it "negative" $ H.shouldBe+ (Literals.bigfloatToBigint (-42.7))+ ((-43))+ H.it "zero" $ H.shouldBe+ (Literals.bigfloatToBigint 0.0)+ (0)+ H.it "round down" $ H.shouldBe+ (Literals.bigfloatToBigint 42.3)+ (42)+ H.it "half even up" $ H.shouldBe+ (Literals.bigfloatToBigint 42.5)+ (42)+ H.it "half even down" $ H.shouldBe+ (Literals.bigfloatToBigint 43.5)+ (44)+ H.describe "showInt8" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showInt8 42)+ ("42")+ H.it "negative" $ H.shouldBe+ (Literals.showInt8 (-42))+ ("-42")+ H.describe "showInt16" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showInt16 1000)+ ("1000")+ H.it "negative" $ H.shouldBe+ (Literals.showInt16 (-1000))+ ("-1000")+ H.describe "showInt32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showInt32 42)+ ("42")+ H.it "negative" $ H.shouldBe+ (Literals.showInt32 (-42))+ ("-42")+ H.it "zero" $ H.shouldBe+ (Literals.showInt32 0)+ ("0")+ H.describe "showInt64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showInt64 1000000)+ ("1000000")+ H.it "negative" $ H.shouldBe+ (Literals.showInt64 (-1000000))+ ("-1000000")+ H.describe "showUint8" $ do+ H.it "zero" $ H.shouldBe+ (Literals.showUint8 0)+ ("0")+ H.it "max value" $ H.shouldBe+ (Literals.showUint8 255)+ ("255")+ H.describe "showUint16" $ do+ H.it "zero" $ H.shouldBe+ (Literals.showUint16 0)+ ("0")+ H.it "typical value" $ H.shouldBe+ (Literals.showUint16 1000)+ ("1000")+ H.describe "showUint32" $ do+ H.it "zero" $ H.shouldBe+ (Literals.showUint32 0)+ ("0")+ H.it "typical value" $ H.shouldBe+ (Literals.showUint32 100000)+ ("100000")+ H.describe "showUint64" $ do+ H.it "zero" $ H.shouldBe+ (Literals.showUint64 0)+ ("0")+ H.it "typical value" $ H.shouldBe+ (Literals.showUint64 1000000)+ ("1000000")+ H.describe "showBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showBigint 42)+ ("42")+ H.it "negative" $ H.shouldBe+ (Literals.showBigint (-42))+ ("-42")+ H.it "zero" $ H.shouldBe+ (Literals.showBigint 0)+ ("0")+ H.describe "showFloat32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showFloat32 3.14)+ ("3.14")+ H.it "negative" $ H.shouldBe+ (Literals.showFloat32 (-2.5))+ ("-2.5")+ H.it "zero" $ H.shouldBe+ (Literals.showFloat32 0.0)+ ("0.0")+ H.it "small positive" $ H.shouldBe+ (Literals.showFloat32 5.0e-2)+ ("5.0e-2")+ H.it "small positive 2" $ H.shouldBe+ (Literals.showFloat32 3.0e-2)+ ("3.0e-2")+ H.it "very small" $ H.shouldBe+ (Literals.showFloat32 1.0e-3)+ ("1.0e-3")+ H.it "normal decimal" $ H.shouldBe+ (Literals.showFloat32 0.1)+ ("0.1")+ H.describe "showFloat64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showFloat64 3.14159)+ ("3.14159")+ H.it "zero" $ H.shouldBe+ (Literals.showFloat64 0.0)+ ("0.0")+ H.it "small positive" $ H.shouldBe+ (Literals.showFloat64 5.0e-2)+ ("5.0e-2")+ H.it "small positive 2" $ H.shouldBe+ (Literals.showFloat64 3.0e-2)+ ("3.0e-2")+ H.it "very small" $ H.shouldBe+ (Literals.showFloat64 1.0e-3)+ ("1.0e-3")+ H.it "normal decimal" $ H.shouldBe+ (Literals.showFloat64 0.1)+ ("0.1")+ H.describe "showBigfloat" $ do+ H.it "positive" $ H.shouldBe+ (Literals.showBigfloat 3.14)+ ("3.14")+ H.it "zero" $ H.shouldBe+ (Literals.showBigfloat 0.0)+ ("0.0")+ H.it "small positive" $ H.shouldBe+ (Literals.showBigfloat 5.0e-2)+ ("5.0e-2")+ H.it "small positive 2" $ H.shouldBe+ (Literals.showBigfloat 3.0e-2)+ ("3.0e-2")+ H.it "very small" $ H.shouldBe+ (Literals.showBigfloat 1.0e-3)+ ("1.0e-3")+ H.it "normal decimal" $ H.shouldBe+ (Literals.showBigfloat 0.1)+ ("0.1")+ H.describe "showBoolean" $ do+ H.it "true" $ H.shouldBe+ (Literals.showBoolean True)+ ("true")+ H.it "false" $ H.shouldBe+ (Literals.showBoolean False)+ ("false")+ H.describe "showString" $ do+ H.it "simple" $ H.shouldBe+ (Literals.showString "hello")+ ("\"hello\"")+ H.it "empty" $ H.shouldBe+ (Literals.showString "")+ ("\"\"")+ H.it "latin accented" $ H.shouldBe+ (Literals.showString "caf\233")+ ("\"caf\\233\"")+ H.it "greek lambda" $ H.shouldBe+ (Literals.showString "\955")+ ("\"\\955\"")+ H.it "mixed ascii and non-ascii" $ H.shouldBe+ (Literals.showString "A\233B")+ ("\"A\\233B\"")+ H.it "tab" $ H.shouldBe+ (Literals.showString "\t")+ ("\"\\t\"")+ H.it "newline" $ H.shouldBe+ (Literals.showString "\n")+ ("\"\\n\"")+ H.it "carriage return" $ H.shouldBe+ (Literals.showString "\r")+ ("\"\\r\"")+ H.it "backslash" $ H.shouldBe+ (Literals.showString "\\")+ ("\"\\\\\"")+ H.it "double quote" $ H.shouldBe+ (Literals.showString "\"")+ ("\"\\\"\"")+ H.it "null" $ H.shouldBe+ (Literals.showString "\NUL")+ ("\"\\NUL\"")+ H.it "bell" $ H.shouldBe+ (Literals.showString "\a")+ ("\"\\a\"")+ H.it "backspace" $ H.shouldBe+ (Literals.showString "\b")+ ("\"\\b\"")+ H.it "form feed" $ H.shouldBe+ (Literals.showString "\f")+ ("\"\\f\"")+ H.it "vertical tab" $ H.shouldBe+ (Literals.showString "\v")+ ("\"\\v\"")+ H.it "delete" $ H.shouldBe+ (Literals.showString "\DEL")+ ("\"\\DEL\"")+ H.describe "readInt8" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readInt8 "42")+ (Just 42)+ H.it "negative" $ H.shouldBe+ (Literals.readInt8 "-42")+ (Just (-42))+ H.it "max value" $ H.shouldBe+ (Literals.readInt8 "127")+ (Just 127)+ H.it "min value" $ H.shouldBe+ (Literals.readInt8 "-128")+ (Just (-128))+ H.it "invalid" $ H.shouldBe+ (Literals.readInt8 "abc")+ (Nothing)+ H.it "overflow" $ H.shouldBe+ (Literals.readInt8 "128")+ (Nothing)+ H.describe "readInt16" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readInt16 "1000")+ (Just 1000)+ H.it "negative" $ H.shouldBe+ (Literals.readInt16 "-1000")+ (Just (-1000))+ H.it "invalid" $ H.shouldBe+ (Literals.readInt16 "abc")+ (Nothing)+ H.describe "readInt32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readInt32 "42")+ (Just 42)+ H.it "negative" $ H.shouldBe+ (Literals.readInt32 "-42")+ (Just (-42))+ H.it "invalid" $ H.shouldBe+ (Literals.readInt32 "abc")+ (Nothing)+ H.describe "readInt64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readInt64 "1000000")+ (Just 1000000)+ H.it "negative" $ H.shouldBe+ (Literals.readInt64 "-1000000")+ (Just (-1000000))+ H.it "invalid" $ H.shouldBe+ (Literals.readInt64 "abc")+ (Nothing)+ H.describe "readUint8" $ do+ H.it "zero" $ H.shouldBe+ (Literals.readUint8 "0")+ (Just 0)+ H.it "typical" $ H.shouldBe+ (Literals.readUint8 "100")+ (Just 100)+ H.it "max value" $ H.shouldBe+ (Literals.readUint8 "255")+ (Just 255)+ H.it "invalid" $ H.shouldBe+ (Literals.readUint8 "abc")+ (Nothing)+ H.it "negative" $ H.shouldBe+ (Literals.readUint8 "-1")+ (Nothing)+ H.describe "readUint16" $ do+ H.it "zero" $ H.shouldBe+ (Literals.readUint16 "0")+ (Just 0)+ H.it "typical" $ H.shouldBe+ (Literals.readUint16 "1000")+ (Just 1000)+ H.it "invalid" $ H.shouldBe+ (Literals.readUint16 "abc")+ (Nothing)+ H.it "negative" $ H.shouldBe+ (Literals.readUint16 "-1")+ (Nothing)+ H.describe "readUint32" $ do+ H.it "zero" $ H.shouldBe+ (Literals.readUint32 "0")+ (Just 0)+ H.it "typical" $ H.shouldBe+ (Literals.readUint32 "100000")+ (Just 100000)+ H.it "invalid" $ H.shouldBe+ (Literals.readUint32 "abc")+ (Nothing)+ H.it "negative" $ H.shouldBe+ (Literals.readUint32 "-1")+ (Nothing)+ H.describe "readUint64" $ do+ H.it "zero" $ H.shouldBe+ (Literals.readUint64 "0")+ (Just 0)+ H.it "typical" $ H.shouldBe+ (Literals.readUint64 "1000000")+ (Just 1000000)+ H.it "invalid" $ H.shouldBe+ (Literals.readUint64 "abc")+ (Nothing)+ H.it "negative" $ H.shouldBe+ (Literals.readUint64 "-1")+ (Nothing)+ H.describe "readBigint" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readBigint "42")+ (Just 42)+ H.it "negative" $ H.shouldBe+ (Literals.readBigint "-42")+ (Just (-42))+ H.it "zero" $ H.shouldBe+ (Literals.readBigint "0")+ (Just 0)+ H.it "large" $ H.shouldBe+ (Literals.readBigint "123456789012345678901234567890")+ (Just 123456789012345678901234567890)+ H.it "invalid" $ H.shouldBe+ (Literals.readBigint "abc")+ (Nothing)+ H.describe "readFloat32" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readFloat32 "3.14")+ (Just 3.14)+ H.it "negative" $ H.shouldBe+ (Literals.readFloat32 "-2.5")+ (Just (-2.5))+ H.it "invalid" $ H.shouldBe+ (Literals.readFloat32 "abc")+ (Nothing)+ H.describe "readFloat64" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readFloat64 "3.14159")+ (Just 3.14159)+ H.it "negative" $ H.shouldBe+ (Literals.readFloat64 "-2.71828")+ (Just (-2.71828))+ H.it "invalid" $ H.shouldBe+ (Literals.readFloat64 "abc")+ (Nothing)+ H.describe "readBigfloat" $ do+ H.it "positive" $ H.shouldBe+ (Literals.readBigfloat "3.14")+ (Just 3.14)+ H.it "invalid" $ H.shouldBe+ (Literals.readBigfloat "abc")+ (Nothing)+ H.describe "readBoolean" $ do+ H.it "true" $ H.shouldBe+ (Literals.readBoolean "true")+ (Just True)+ H.it "false" $ H.shouldBe+ (Literals.readBoolean "false")+ (Just False)+ H.it "invalid" $ H.shouldBe+ (Literals.readBoolean "yes")+ (Nothing)+ H.describe "readString" $ do+ H.it "quoted string" $ H.shouldBe+ (Literals.readString "\"hello\"")+ (Just "hello")+ H.it "empty quoted" $ H.shouldBe+ (Literals.readString "\"\"")+ (Just "")+ H.it "unquoted" $ H.shouldBe+ (Literals.readString "hello")+ (Nothing)+ H.describe "stringToBinary" $ do+ H.it "simple base64" $ H.shouldBe+ (Literals.stringToBinary "aGVsbG8=")+ (Literals.stringToBinary "aGVsbG8=")+ H.it "empty string" $ H.shouldBe+ (Literals.stringToBinary "")+ (Literals.stringToBinary "")+ H.describe "binaryToString" $ do+ H.it "simple binary" $ H.shouldBe+ (Literals.binaryToString (Literals.stringToBinary "aGVsbG8="))+ ("aGVsbG8=")+ H.it "empty binary" $ H.shouldBe+ (Literals.binaryToString (Literals.stringToBinary ""))+ ("")
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/LogicSpec.hs view
@@ -0,0 +1,74 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.logic"},ModuleName {unModuleName = "Logic"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.logic"},ModuleName {unModuleName = "Logic"})]++module Generation.Hydra.Test.Lib.LogicSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Logic as Logic++spec :: H.Spec+spec = H.describe "hydra.lib.logic primitives" $ do+ H.describe "and" $ do+ H.it "true and true" $ H.shouldBe+ (Logic.and True True)+ (True)+ H.it "true and false" $ H.shouldBe+ (Logic.and True False)+ (False)+ H.it "false and true" $ H.shouldBe+ (Logic.and False True)+ (False)+ H.it "false and false" $ H.shouldBe+ (Logic.and False False)+ (False)+ H.describe "ifElse" $ do+ H.describe "boolean values" $ do+ H.it "true condition returns then" $ H.shouldBe+ (Logic.ifElse True True False)+ (True)+ H.it "false condition returns else" $ H.shouldBe+ (Logic.ifElse False True False)+ (False)+ H.describe "integer values" $ do+ H.it "true selects first int" $ H.shouldBe+ (Logic.ifElse True 42 0)+ (42)+ H.it "false selects second int" $ H.shouldBe+ (Logic.ifElse False 42 0)+ (0)+ H.describe "string values" $ do+ H.it "true selects first string" $ H.shouldBe+ (Logic.ifElse True "yes" "no")+ ("yes")+ H.it "false selects second string" $ H.shouldBe+ (Logic.ifElse False "yes" "no")+ ("no")+ H.describe "not" $ do+ H.it "not true" $ H.shouldBe+ (Logic.not True)+ (False)+ H.it "not false" $ H.shouldBe+ (Logic.not False)+ (True)+ H.describe "or" $ do+ H.it "true or true" $ H.shouldBe+ (Logic.or True True)+ (True)+ H.it "true or false" $ H.shouldBe+ (Logic.or True False)+ (True)+ H.it "false or true" $ H.shouldBe+ (Logic.or False True)+ (True)+ H.it "false or false" $ H.shouldBe+ (Logic.or False False)+ (False)
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/MapsSpec.hs view
@@ -0,0 +1,319 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.maps"},ModuleName {unModuleName = "Maps"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.equality"},ModuleName {unModuleName = "Equality"}),(Namespace {unNamespace = "hydra.lib.maps"},ModuleName {unModuleName = "Maps"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.Lib.MapsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "hydra.lib.maps primitives" $ do+ H.describe "alter" $ do+ H.it "insert new key" $ H.shouldBe+ (Maps.alter (\opt -> Just "new") 3 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "new")])+ H.it "update existing key" $ H.shouldBe+ (Maps.alter (\opt -> Just "updated") 2 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a"),+ (2, "updated")])+ H.it "delete key" $ H.shouldBe+ (Maps.alter (\opt -> Nothing) 2 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a")])+ H.describe "bimap" $ do+ H.it "transform both" $ H.shouldBe+ (Maps.bimap (\k -> Math.mul k 2) (\v -> Strings.toUpper v) (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (2, "A"),+ (4, "B")])+ H.it "empty map" $ H.shouldBe+ (Maps.bimap (\k -> Math.mul k 2) (\v -> Strings.toUpper v) M.empty)+ (M.empty)+ H.describe "elems" $ do+ H.it "get all elements" $ H.shouldBe+ (Maps.elems (M.fromList [+ (1, "a"),+ (2, "b")]))+ ([+ "a",+ "b"])+ H.it "unsorted keys" $ H.shouldBe+ (Maps.elems (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ ([+ "a",+ "b",+ "c"])+ H.it "empty map" $ H.shouldBe+ (Maps.elems M.empty)+ ([] :: [Int])+ H.describe "empty" $ do+ H.it "empty map" $ H.shouldBe+ (Maps.empty)+ (M.empty :: M.Map Int Int)+ H.describe "filter" $ do+ H.it "filter values starting with a" $ H.shouldBe+ (Maps.filter (\v -> Equality.equal (Strings.charAt 0 v) 97) (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "ab")]))+ (M.fromList [+ (1, "a"),+ (3, "ab")])+ H.it "filter all" $ H.shouldBe+ (Maps.filter (\v -> Equality.equal (Strings.charAt 0 v) 97) (M.fromList [+ (1, "b"),+ (2, "c")]))+ (M.empty)+ H.it "empty map" $ H.shouldBe+ (Maps.filter (\v -> Equality.equal (Strings.charAt 0 v) 97) M.empty)+ (M.empty :: M.Map Int String)+ H.describe "filterWithKey" $ do+ H.it "filter by key > 1" $ H.shouldBe+ (Maps.filterWithKey (\k -> \v -> Equality.gt k 1) (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ (M.fromList [+ (2, "b"),+ (3, "c")])+ H.it "filter all" $ H.shouldBe+ (Maps.filterWithKey (\k -> \v -> Equality.gt k 1) (M.fromList [+ (1, "a")]))+ (M.empty)+ H.it "empty map" $ H.shouldBe+ (Maps.filterWithKey (\k -> \v -> Equality.gt k 1) M.empty)+ (M.empty :: M.Map Int Int)+ H.describe "findWithDefault" $ do+ H.it "find existing" $ H.shouldBe+ (Maps.findWithDefault "default" 2 (M.fromList [+ (1, "a"),+ (2, "b")]))+ ("b")+ H.it "use default" $ H.shouldBe+ (Maps.findWithDefault "default" 3 (M.fromList [+ (1, "a"),+ (2, "b")]))+ ("default")+ H.describe "fromList" $ do+ H.it "create from pairs" $ H.shouldBe+ (Maps.fromList [+ (1, "a"),+ (2, "b")])+ (M.fromList [+ (1, "a"),+ (2, "b")])+ H.it "duplicate keys" $ H.shouldBe+ (Maps.fromList [+ (1, "a"),+ (1, "b")])+ (M.fromList [+ (1, "b")])+ H.it "empty list" $ H.shouldBe+ (Maps.fromList [])+ (M.empty :: M.Map Int Int)+ H.describe "insert" $ do+ H.it "insert new key" $ H.shouldBe+ (Maps.insert 3 "c" (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")])+ H.it "update existing" $ H.shouldBe+ (Maps.insert 2 "updated" (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a"),+ (2, "updated")])+ H.it "insert into empty" $ H.shouldBe+ (Maps.insert 1 "x" M.empty)+ (M.fromList [+ (1, "x")])+ H.describe "keys" $ do+ H.it "get all keys" $ H.shouldBe+ (Maps.keys (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ ([+ 1,+ 2,+ 3])+ H.it "unsorted keys" $ H.shouldBe+ (Maps.keys (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ ([+ 1,+ 2,+ 3])+ H.it "empty map" $ H.shouldBe+ (Maps.keys M.empty)+ ([] :: [Int])+ H.describe "lookup" $ do+ H.it "find existing key" $ H.shouldBe+ (Maps.lookup 2 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (Just "b")+ H.it "key not found" $ H.shouldBe+ (Maps.lookup 3 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (Nothing)+ H.it "lookup in empty" $ H.shouldBe+ (Maps.lookup 1 M.empty)+ (Nothing :: Maybe Int)+ H.describe "map" $ do+ H.it "map over values" $ H.shouldBe+ (Maps.map (\s -> Strings.toUpper s) (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "A"),+ (2, "B")])+ H.it "map empty" $ H.shouldBe+ (Maps.map (\s -> Strings.toUpper s) M.empty)+ (M.empty :: M.Map Int String)+ H.describe "mapKeys" $ do+ H.it "double keys" $ H.shouldBe+ (Maps.mapKeys (\k -> Math.mul k 2) (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (2, "a"),+ (4, "b")])+ H.it "empty map" $ H.shouldBe+ (Maps.mapKeys (\k -> Math.mul k 2) M.empty)+ (M.empty :: M.Map Int Int)+ H.describe "member" $ do+ H.it "key exists" $ H.shouldBe+ (Maps.member 2 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (True)+ H.it "key missing" $ H.shouldBe+ (Maps.member 3 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (False)+ H.it "empty map" $ H.shouldBe+ (Maps.member 1 M.empty)+ (False)+ H.describe "null" $ do+ H.it "empty map" $ H.shouldBe+ (Maps.null M.empty)+ (True)+ H.it "non-empty map" $ H.shouldBe+ (Maps.null (M.fromList [+ (1, "a")]))+ (False)+ H.describe "remove" $ do+ H.it "remove existing" $ H.shouldBe+ (Maps.delete 2 (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ (M.fromList [+ (1, "a"),+ (3, "c")])+ H.it "remove non-existing" $ H.shouldBe+ (Maps.delete 4 (M.fromList [+ (1, "a"),+ (2, "b")]))+ (M.fromList [+ (1, "a"),+ (2, "b")])+ H.it "remove from empty" $ H.shouldBe+ (Maps.delete 1 M.empty)+ (M.empty :: M.Map Int Int)+ H.describe "singleton" $ do+ H.it "single entry" $ H.shouldBe+ (Maps.singleton 42 "hello")+ (M.fromList [+ (42, "hello")])+ H.describe "size" $ do+ H.it "three entries" $ H.shouldBe+ (Maps.size (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ (3)+ H.it "single entry" $ H.shouldBe+ (Maps.size (M.fromList [+ (42, "test")]))+ (1)+ H.it "empty map" $ H.shouldBe+ (Maps.size M.empty)+ (0)+ H.describe "toList" $ do+ H.it "convert to pairs" $ H.shouldBe+ (Maps.toList (M.fromList [+ (1, "a"),+ (2, "b")]))+ ([+ (1, "a"),+ (2, "b")])+ H.it "unsorted keys" $ H.shouldBe+ (Maps.toList (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")]))+ ([+ (1, "a"),+ (2, "b"),+ (3, "c")])+ H.it "empty map" $ H.shouldBe+ (Maps.toList M.empty)+ ([] :: [(Int, Int)])+ H.describe "union" $ do+ H.it "union two maps" $ H.shouldBe+ (Maps.union (M.fromList [+ (1, "a"),+ (2, "b")]) (M.fromList [+ (2, "x"),+ (3, "c")]))+ (M.fromList [+ (1, "a"),+ (2, "b"),+ (3, "c")])+ H.it "union with empty" $ H.shouldBe+ (Maps.union (M.fromList [+ (1, "a")]) M.empty)+ (M.fromList [+ (1, "a")])+ H.it "empty with map" $ H.shouldBe+ (Maps.union M.empty (M.fromList [+ (1, "a")]))+ (M.fromList [+ (1, "a")])
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/MathSpec.hs view
@@ -0,0 +1,468 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.math"},ModuleName {unModuleName = "Math"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"})]++module Generation.Hydra.Test.Lib.MathSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Math as Math++spec :: H.Spec+spec = H.describe "hydra.lib.math primitives" $ do+ H.describe "abs" $ do+ H.it "positive" $ H.shouldBe+ (Math.abs 5)+ (5)+ H.it "negative" $ H.shouldBe+ (Math.abs (-5))+ (5)+ H.it "zero" $ H.shouldBe+ (Math.abs 0)+ (0)+ H.describe "add" $ do+ H.it "positive numbers" $ H.shouldBe+ (Math.add 3 5)+ (8)+ H.it "negative numbers" $ H.shouldBe+ (Math.add (-3) (-5))+ ((-8))+ H.it "mixed sign" $ H.shouldBe+ (Math.add 10 (-3))+ (7)+ H.it "with zero" $ H.shouldBe+ (Math.add 42 0)+ (42)+ H.describe "div" $ do+ H.it "exact division" $ H.shouldBe+ (Math.div 10 2)+ (5)+ H.it "truncates toward negative infinity" $ H.shouldBe+ (Math.div 10 3)+ (3)+ H.it "negative dividend" $ H.shouldBe+ (Math.div (-10) 3)+ ((-4))+ H.it "negative divisor" $ H.shouldBe+ (Math.div 10 (-3))+ ((-4))+ H.describe "even" $ do+ H.it "even positive" $ H.shouldBe+ (Math.even 4)+ (True)+ H.it "odd positive" $ H.shouldBe+ (Math.even 5)+ (False)+ H.it "even negative" $ H.shouldBe+ (Math.even (-4))+ (True)+ H.it "odd negative" $ H.shouldBe+ (Math.even (-5))+ (False)+ H.it "zero" $ H.shouldBe+ (Math.even 0)+ (True)+ H.describe "max" $ do+ H.it "first is larger" $ H.shouldBe+ (Math.max 10 5)+ (10)+ H.it "second is larger" $ H.shouldBe+ (Math.max 5 10)+ (10)+ H.it "equal values" $ H.shouldBe+ (Math.max 7 7)+ (7)+ H.it "negative numbers" $ H.shouldBe+ (Math.max (-3) (-5))+ ((-3))+ H.it "mixed sign" $ H.shouldBe+ (Math.max (-5) 5)+ (5)+ H.it "with zero" $ H.shouldBe+ (Math.max 0 42)+ (42)+ H.describe "min" $ do+ H.it "first is smaller" $ H.shouldBe+ (Math.min 5 10)+ (5)+ H.it "second is smaller" $ H.shouldBe+ (Math.min 10 5)+ (5)+ H.it "equal values" $ H.shouldBe+ (Math.min 7 7)+ (7)+ H.it "negative numbers" $ H.shouldBe+ (Math.min (-3) (-5))+ ((-5))+ H.it "mixed sign" $ H.shouldBe+ (Math.min (-5) 5)+ ((-5))+ H.it "with zero" $ H.shouldBe+ (Math.min 0 42)+ (0)+ H.describe "mod" $ do+ H.it "basic modulo" $ H.shouldBe+ (Math.mod 10 3)+ (1)+ H.it "exact division" $ H.shouldBe+ (Math.mod 10 2)+ (0)+ H.it "negative dividend" $ H.shouldBe+ (Math.mod (-10) 3)+ (2)+ H.it "negative divisor" $ H.shouldBe+ (Math.mod 10 (-3))+ ((-2))+ H.describe "mul" $ do+ H.it "positive numbers" $ H.shouldBe+ (Math.mul 3 5)+ (15)+ H.it "negative numbers" $ H.shouldBe+ (Math.mul (-3) (-5))+ (15)+ H.it "mixed sign" $ H.shouldBe+ (Math.mul 3 (-5))+ ((-15))+ H.it "with zero" $ H.shouldBe+ (Math.mul 42 0)+ (0)+ H.it "with one" $ H.shouldBe+ (Math.mul 42 1)+ (42)+ H.describe "negate" $ do+ H.it "positive" $ H.shouldBe+ (Math.negate 5)+ ((-5))+ H.it "negative" $ H.shouldBe+ (Math.negate (-5))+ (5)+ H.it "zero" $ H.shouldBe+ (Math.negate 0)+ (0)+ H.describe "odd" $ do+ H.it "odd positive" $ H.shouldBe+ (Math.odd 5)+ (True)+ H.it "even positive" $ H.shouldBe+ (Math.odd 4)+ (False)+ H.it "odd negative" $ H.shouldBe+ (Math.odd (-5))+ (True)+ H.it "even negative" $ H.shouldBe+ (Math.odd (-4))+ (False)+ H.it "zero" $ H.shouldBe+ (Math.odd 0)+ (False)+ H.describe "pred" $ do+ H.it "positive" $ H.shouldBe+ (Math.pred 5)+ (4)+ H.it "zero" $ H.shouldBe+ (Math.pred 0)+ ((-1))+ H.it "negative" $ H.shouldBe+ (Math.pred (-5))+ ((-6))+ H.describe "range" $ do+ H.it "ascending range" $ H.shouldBe+ (Math.range 1 5)+ ([+ 1,+ 2,+ 3,+ 4,+ 5])+ H.it "single element" $ H.shouldBe+ (Math.range 5 5)+ ([+ 5])+ H.it "two elements" $ H.shouldBe+ (Math.range 3 4)+ ([+ 3,+ 4])+ H.it "negative start" $ H.shouldBe+ (Math.range (-2) 2)+ ([+ (-2),+ (-1),+ 0,+ 1,+ 2])+ H.describe "rem" $ do+ H.it "basic remainder" $ H.shouldBe+ (Math.rem 10 3)+ (1)+ H.it "exact division" $ H.shouldBe+ (Math.rem 10 2)+ (0)+ H.it "negative dividend" $ H.shouldBe+ (Math.rem (-10) 3)+ ((-1))+ H.it "negative divisor" $ H.shouldBe+ (Math.rem 10 (-3))+ (1)+ H.describe "signum" $ do+ H.it "positive" $ H.shouldBe+ (Math.signum 5)+ (1)+ H.it "negative" $ H.shouldBe+ (Math.signum (-5))+ ((-1))+ H.it "zero" $ H.shouldBe+ (Math.signum 0)+ (0)+ H.describe "sub" $ do+ H.it "positive numbers" $ H.shouldBe+ (Math.sub 10 3)+ (7)+ H.it "negative numbers" $ H.shouldBe+ (Math.sub (-10) (-3))+ ((-7))+ H.it "mixed sign" $ H.shouldBe+ (Math.sub 10 (-3))+ (13)+ H.it "with zero" $ H.shouldBe+ (Math.sub 42 0)+ (42)+ H.describe "succ" $ do+ H.it "positive" $ H.shouldBe+ (Math.succ 5)+ (6)+ H.it "zero" $ H.shouldBe+ (Math.succ 0)+ (1)+ H.it "negative" $ H.shouldBe+ (Math.succ (-5))+ ((-4))+ H.describe "e" $ do+ H.it "Euler's number" $ H.shouldBe+ (Math.e)+ (2.718281828459045)+ H.describe "pi" $ do+ H.it "pi constant" $ H.shouldBe+ (Math.pi)+ (3.141592653589793)+ H.describe "sin" $ do+ H.it "sin 0" $ H.shouldBe+ (Math.sin 0.0)+ (0.0)+ H.it "sin pi/2" $ H.shouldBe+ (Math.sin 1.5707963267948966)+ (1.0)+ H.it "sin pi" $ H.shouldBe+ (Math.sin 3.141592653589793)+ (1.2246467991473532e-16)+ H.describe "cos" $ do+ H.it "cos 0" $ H.shouldBe+ (Math.cos 0.0)+ (1.0)+ H.it "cos pi/2" $ H.shouldBe+ (Math.cos 1.5707963267948966)+ (6.123233995736766e-17)+ H.it "cos pi" $ H.shouldBe+ (Math.cos 3.141592653589793)+ ((-1.0))+ H.describe "tan" $ do+ H.it "tan 0" $ H.shouldBe+ (Math.tan 0.0)+ (0.0)+ H.it "tan pi/4" $ H.shouldBe+ (Math.tan 0.7853981633974483)+ (0.9999999999999999)+ H.describe "asin" $ do+ H.it "asin 0" $ H.shouldBe+ (Math.asin 0.0)+ (0.0)+ H.it "asin 1" $ H.shouldBe+ (Math.asin 1.0)+ (1.5707963267948966)+ H.it "asin -1" $ H.shouldBe+ (Math.asin (-1.0))+ ((-1.5707963267948966))+ H.describe "acos" $ do+ H.it "acos 1" $ H.shouldBe+ (Math.acos 1.0)+ (0.0)+ H.it "acos 0" $ H.shouldBe+ (Math.acos 0.0)+ (1.5707963267948966)+ H.it "acos -1" $ H.shouldBe+ (Math.acos (-1.0))+ (3.141592653589793)+ H.describe "atan" $ do+ H.it "atan 0" $ H.shouldBe+ (Math.atan 0.0)+ (0.0)+ H.it "atan 1" $ H.shouldBe+ (Math.atan 1.0)+ (0.7853981633974483)+ H.describe "atan2" $ do+ H.it "atan2 1 1" $ H.shouldBe+ (Math.atan2 1.0 1.0)+ (0.7853981633974483)+ H.it "atan2 1 0" $ H.shouldBe+ (Math.atan2 1.0 0.0)+ (1.5707963267948966)+ H.it "atan2 0 1" $ H.shouldBe+ (Math.atan2 0.0 1.0)+ (0.0)+ H.describe "sinh" $ do+ H.it "sinh 0" $ H.shouldBe+ (Math.sinh 0.0)+ (0.0)+ H.it "sinh 1" $ H.shouldBe+ (Math.sinh 1.0)+ (1.1752011936438014)+ H.describe "cosh" $ do+ H.it "cosh 0" $ H.shouldBe+ (Math.cosh 0.0)+ (1.0)+ H.it "cosh 1" $ H.shouldBe+ (Math.cosh 1.0)+ (1.5430806348152437)+ H.describe "tanh" $ do+ H.it "tanh 0" $ H.shouldBe+ (Math.tanh 0.0)+ (0.0)+ H.it "tanh 1" $ H.shouldBe+ (Math.tanh 1.0)+ (0.7615941559557649)+ H.describe "asinh" $ do+ H.it "asinh 0" $ H.shouldBe+ (Math.asinh 0.0)+ (0.0)+ H.it "asinh 1" $ H.shouldBe+ (Math.asinh 1.0)+ (0.881373587019543)+ H.describe "acosh" $ do+ H.it "acosh 1" $ H.shouldBe+ (Math.acosh 1.0)+ (0.0)+ H.it "acosh 2" $ H.shouldBe+ (Math.acosh 2.0)+ (1.3169578969248166)+ H.describe "atanh" $ do+ H.it "atanh 0" $ H.shouldBe+ (Math.atanh 0.0)+ (0.0)+ H.it "atanh 0.5" $ H.shouldBe+ (Math.atanh 0.5)+ (0.5493061443340549)+ H.describe "exp" $ do+ H.it "exp 0" $ H.shouldBe+ (Math.exp 0.0)+ (1.0)+ H.it "exp 1" $ H.shouldBe+ (Math.exp 1.0)+ (2.718281828459045)+ H.it "exp -1" $ H.shouldBe+ (Math.exp (-1.0))+ (0.36787944117144233)+ H.describe "log" $ do+ H.it "log 1" $ H.shouldBe+ (Math.log 1.0)+ (0.0)+ H.it "log e" $ H.shouldBe+ (Math.log 2.718281828459045)+ (1.0)+ H.describe "logBase" $ do+ H.it "log10 1" $ H.shouldBe+ (Math.logBase 10.0 1.0)+ (0.0)+ H.it "log10 10" $ H.shouldBe+ (Math.logBase 10.0 10.0)+ (1.0)+ H.it "log10 100" $ H.shouldBe+ (Math.logBase 10.0 100.0)+ (2.0)+ H.it "log2 8" $ H.shouldBe+ (Math.logBase 2.0 8.0)+ (3.0)+ H.describe "pow" $ do+ H.it "2^3" $ H.shouldBe+ (Math.pow 2.0 3.0)+ (8.0)+ H.it "10^0" $ H.shouldBe+ (Math.pow 10.0 0.0)+ (1.0)+ H.it "2^-1" $ H.shouldBe+ (Math.pow 2.0 (-1.0))+ (0.5)+ H.describe "sqrt" $ do+ H.it "sqrt 4" $ H.shouldBe+ (Math.sqrt 4.0)+ (2.0)+ H.it "sqrt 9" $ H.shouldBe+ (Math.sqrt 9.0)+ (3.0)+ H.it "sqrt 2" $ H.shouldBe+ (Math.sqrt 2.0)+ (1.4142135623730951)+ H.it "sqrt 0" $ H.shouldBe+ (Math.sqrt 0.0)+ (0.0)+ H.describe "ceiling" $ do+ H.it "ceiling 3.2" $ H.shouldBe+ (Math.ceiling 3.2)+ (4)+ H.it "ceiling 3.0" $ H.shouldBe+ (Math.ceiling 3.0)+ (3)+ H.it "ceiling -3.2" $ H.shouldBe+ (Math.ceiling (-3.2))+ ((-3))+ H.it "ceiling -3.0" $ H.shouldBe+ (Math.ceiling (-3.0))+ ((-3))+ H.describe "floor" $ do+ H.it "floor 3.8" $ H.shouldBe+ (Math.floor 3.8)+ (3)+ H.it "floor 3.0" $ H.shouldBe+ (Math.floor 3.0)+ (3)+ H.it "floor -3.2" $ H.shouldBe+ (Math.floor (-3.2))+ ((-4))+ H.it "floor -3.0" $ H.shouldBe+ (Math.floor (-3.0))+ ((-3))+ H.describe "round" $ do+ H.it "round 3.4" $ H.shouldBe+ (Math.round 3.4)+ (3)+ H.it "round 3.5" $ H.shouldBe+ (Math.round 3.5)+ (4)+ H.it "round 3.6" $ H.shouldBe+ (Math.round 3.6)+ (4)+ H.it "round -3.4" $ H.shouldBe+ (Math.round (-3.4))+ ((-3))+ H.it "round -3.5" $ H.shouldBe+ (Math.round (-3.5))+ ((-4))+ H.describe "truncate" $ do+ H.it "truncate 3.8" $ H.shouldBe+ (Math.truncate 3.8)+ (3)+ H.it "truncate 3.2" $ H.shouldBe+ (Math.truncate 3.2)+ (3)+ H.it "truncate -3.8" $ H.shouldBe+ (Math.truncate (-3.8))+ ((-3))+ H.it "truncate -3.2" $ H.shouldBe+ (Math.truncate (-3.2))+ ((-3))
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/MaybesSpec.hs view
@@ -0,0 +1,146 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.maybes"},ModuleName {unModuleName = "Maybes"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.equality"},ModuleName {unModuleName = "Equality"}),(Namespace {unNamespace = "hydra.lib.logic"},ModuleName {unModuleName = "Logic"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.maybes"},ModuleName {unModuleName = "Maybes"})]++module Generation.Hydra.Test.Lib.MaybesSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Equality as Equality+import qualified Hydra.Lib.Logic as Logic+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Maybes as Maybes++spec :: H.Spec+spec = H.describe "hydra.lib.maybes primitives" $ do+ H.describe "apply" $ do+ H.it "both just" $ H.shouldBe+ (Maybes.apply (Just (Math.add 3)) (Just 5))+ (Just 8)+ H.it "nothing function" $ H.shouldBe+ (Maybes.apply Nothing (Just 5))+ (Nothing :: Maybe Int)+ H.it "nothing value" $ H.shouldBe+ (Maybes.apply (Just (Math.add 3)) Nothing)+ (Nothing)+ H.describe "bind" $ do+ H.it "just to just" $ H.shouldBe+ (Maybes.bind (Just 5) (\x -> Just (Math.mul x 2)))+ (Just 10)+ H.it "nothing to nothing" $ H.shouldBe+ (Maybes.bind Nothing (\x -> Just (Math.mul x 2)))+ (Nothing)+ H.describe "cases" $ do+ H.it "just applies function" $ H.shouldBe+ (Maybes.cases (Just 5) 0 (\x -> Math.mul x 2))+ (10)+ H.it "nothing returns default" $ H.shouldBe+ (Maybes.cases Nothing 99 (\x -> Math.mul x 2))+ (99)+ H.describe "cat" $ do+ H.it "filters nothings" $ H.shouldBe+ (Maybes.cat [+ Just 1,+ Nothing,+ (Just 2)])+ ([+ 1,+ 2])+ H.it "all justs" $ H.shouldBe+ (Maybes.cat [+ Just 1,+ (Just 2)])+ ([+ 1,+ 2])+ H.it "all nothings" $ H.shouldBe+ (Maybes.cat [+ Nothing,+ Nothing])+ ([] :: [Int])+ H.it "empty list" $ H.shouldBe+ (Maybes.cat [])+ ([] :: [Int])+ H.describe "compose" $ do+ H.it "both succeed" $ H.shouldBe+ (Maybes.compose (\x -> Logic.ifElse (Equality.lte x 5) (Just (Math.add x 1)) Nothing) (\y -> Logic.ifElse (Equality.gte y 5) (Just (Math.mul y 2)) Nothing) 5)+ (Just 12)+ H.it "first fails" $ H.shouldBe+ (Maybes.compose (\x -> Logic.ifElse (Equality.lte x 5) (Just (Math.add x 1)) Nothing) (\y -> Logic.ifElse (Equality.gte y 5) (Just (Math.mul y 2)) Nothing) 10)+ (Nothing)+ H.it "second fails" $ H.shouldBe+ (Maybes.compose (\x -> Logic.ifElse (Equality.lte x 5) (Just (Math.add x 1)) Nothing) (\y -> Logic.ifElse (Equality.gte y 5) (Just (Math.mul y 2)) Nothing) 3)+ (Nothing)+ H.describe "fromJust" $ do+ H.it "extract from just" $ H.shouldBe+ (Maybes.fromJust (Just 42))+ (42)+ H.describe "fromMaybe" $ do+ H.it "just value" $ H.shouldBe+ (Maybes.fromMaybe 0 (Just 42))+ (42)+ H.it "nothing with default" $ H.shouldBe+ (Maybes.fromMaybe 99 Nothing)+ (99)+ H.describe "isJust" $ do+ H.it "just value" $ H.shouldBe+ (Maybes.isJust (Just 42))+ (True)+ H.it "nothing" $ H.shouldBe+ (Maybes.isJust Nothing)+ (False)+ H.describe "isNothing" $ do+ H.it "just value" $ H.shouldBe+ (Maybes.isNothing (Just 42))+ (False)+ H.it "nothing" $ H.shouldBe+ (Maybes.isNothing Nothing)+ (True)+ H.describe "map" $ do+ H.it "maps just value" $ H.shouldBe+ (Maybes.map (\x -> Math.mul x 2) (Just 5))+ (Just 10)+ H.it "nothing unchanged" $ H.shouldBe+ (Maybes.map (\x -> Math.mul x 2) Nothing)+ (Nothing)+ H.describe "mapMaybe" $ do+ H.it "filter and transform" $ H.shouldBe+ (Maybes.mapMaybe (\x -> Logic.ifElse (Equality.gt x 2) (Just (Math.mul x 2)) Nothing) [+ 1,+ 2,+ 3,+ 4,+ 5])+ ([+ 6,+ 8,+ 10])+ H.it "empty result" $ H.shouldBe+ (Maybes.mapMaybe (\x -> Logic.ifElse (Equality.gt x 2) (Just (Math.mul x 2)) Nothing) [+ 1,+ 2])+ ([])+ H.it "empty input" $ H.shouldBe+ (Maybes.mapMaybe (\x -> Logic.ifElse (Equality.gt x 2) (Just (Math.mul x 2)) Nothing) [])+ ([])+ H.describe "maybe" $ do+ H.it "just value applies function" $ H.shouldBe+ (Maybes.maybe 0 (\x -> Math.mul x 2) (Just 5))+ (10)+ H.it "nothing returns default" $ H.shouldBe+ (Maybes.maybe 99 (\x -> Math.mul x 2) Nothing)+ (99)+ H.describe "pure" $ do+ H.it "wraps integer" $ H.shouldBe+ (Maybes.pure 42)+ (Just 42)+ H.it "wraps string" $ H.shouldBe+ (Maybes.pure "hello")+ (Just "hello")
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/PairsSpec.hs view
@@ -0,0 +1,48 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.pairs"},ModuleName {unModuleName = "Pairs"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.pairs"},ModuleName {unModuleName = "Pairs"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.Lib.PairsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Pairs as Pairs+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "hydra.lib.pairs primitives" $ do+ H.describe "bimap" $ do+ H.it "transform both elements" $ H.shouldBe+ (Pairs.bimap (\x -> Math.mul x 2) (\s -> Strings.length s) (5, "ab"))+ ((10, 2))+ H.it "with zero" $ H.shouldBe+ (Pairs.bimap (\x -> Math.mul x 2) (\s -> Strings.length s) (0, "hello"))+ ((0, 5))+ H.describe "first" $ do+ H.it "extract first element" $ H.shouldBe+ (Pairs.first (42, "hello"))+ (42)+ H.it "with zero" $ H.shouldBe+ (Pairs.first (0, "world"))+ (0)+ H.it "negative number" $ H.shouldBe+ (Pairs.first ((-5), "test"))+ ((-5))+ H.describe "second" $ do+ H.it "extract second element" $ H.shouldBe+ (Pairs.second (42, "hello"))+ ("hello")+ H.it "empty string" $ H.shouldBe+ (Pairs.second (0, ""))+ ("")+ H.it "long string" $ H.shouldBe+ (Pairs.second (123, "testing"))+ ("testing")
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/SetsSpec.hs view
@@ -0,0 +1,289 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.sets"},ModuleName {unModuleName = "Sets"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.sets"},ModuleName {unModuleName = "Sets"})]++module Generation.Hydra.Test.Lib.SetsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Sets as Sets++spec :: H.Spec+spec = H.describe "hydra.lib.sets primitives" $ do+ H.describe "empty" $ do+ H.it "empty set" $ H.shouldBe+ (Sets.empty)+ (S.empty :: S.Set Int)+ H.describe "singleton" $ do+ H.it "single element" $ H.shouldBe+ (Sets.singleton 42)+ (S.fromList [+ 42])+ H.describe "fromList" $ do+ H.it "create from list" $ H.shouldBe+ (Sets.fromList [+ 1,+ 2,+ 3])+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "duplicates removed" $ H.shouldBe+ (Sets.fromList [+ 1,+ 2,+ 1,+ 3])+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "empty list" $ H.shouldBe+ (Sets.fromList [])+ (S.empty :: S.Set Int)+ H.describe "toList" $ do+ H.it "convert to list" $ H.shouldBe+ (Sets.toList (S.fromList [+ 1,+ 2,+ 3]))+ ([+ 1,+ 2,+ 3])+ H.it "unsorted input" $ H.shouldBe+ (Sets.toList (S.fromList [+ 1,+ 2,+ 3]))+ ([+ 1,+ 2,+ 3])+ H.it "empty set" $ H.shouldBe+ (Sets.toList S.empty)+ ([] :: [Int])+ H.describe "insert" $ do+ H.it "insert new element" $ H.shouldBe+ (Sets.insert 4 (S.fromList [+ 1,+ 2,+ 3]))+ (S.fromList [+ 1,+ 2,+ 3,+ 4])+ H.it "insert existing element" $ H.shouldBe+ (Sets.insert 2 (S.fromList [+ 1,+ 2,+ 3]))+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "insert into empty" $ H.shouldBe+ (Sets.insert 1 S.empty)+ (S.fromList [+ 1])+ H.describe "delete" $ do+ H.it "delete existing" $ H.shouldBe+ (Sets.delete 2 (S.fromList [+ 1,+ 2,+ 3]))+ (S.fromList [+ 1,+ 3])+ H.it "delete non-existing" $ H.shouldBe+ (Sets.delete 4 (S.fromList [+ 1,+ 2,+ 3]))+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "delete from empty" $ H.shouldBe+ (Sets.delete 1 S.empty)+ (S.empty)+ H.describe "member" $ do+ H.it "element exists" $ H.shouldBe+ (Sets.member 2 (S.fromList [+ 1,+ 2,+ 3]))+ (True)+ H.it "element missing" $ H.shouldBe+ (Sets.member 4 (S.fromList [+ 1,+ 2,+ 3]))+ (False)+ H.it "empty set" $ H.shouldBe+ (Sets.member 1 S.empty)+ (False)+ H.describe "size" $ do+ H.it "three elements" $ H.shouldBe+ (Sets.size (S.fromList [+ 1,+ 2,+ 3]))+ (3)+ H.it "single element" $ H.shouldBe+ (Sets.size (S.fromList [+ 42]))+ (1)+ H.it "empty set" $ H.shouldBe+ (Sets.size S.empty)+ (0)+ H.describe "null" $ do+ H.it "empty set" $ H.shouldBe+ (Sets.null S.empty)+ (True)+ H.it "non-empty set" $ H.shouldBe+ (Sets.null (S.fromList [+ 1,+ 2]))+ (False)+ H.describe "union" $ do+ H.it "union two sets" $ H.shouldBe+ (Sets.union (S.fromList [+ 1,+ 2]) (S.fromList [+ 2,+ 3]))+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "union with empty" $ H.shouldBe+ (Sets.union (S.fromList [+ 1,+ 2]) S.empty)+ (S.fromList [+ 1,+ 2])+ H.it "empty with non-empty" $ H.shouldBe+ (Sets.union S.empty (S.fromList [+ 1,+ 2]))+ (S.fromList [+ 1,+ 2])+ H.describe "unions" $ do+ H.it "union of multiple sets" $ H.shouldBe+ (Sets.unions [+ S.fromList [+ 1,+ 2],+ (S.fromList [+ 2,+ 3]),+ (S.fromList [+ 3,+ 4])])+ (S.fromList [+ 1,+ 2,+ 3,+ 4])+ H.it "union with empty sets" $ H.shouldBe+ (Sets.unions [+ S.fromList [+ 1,+ 2],+ S.empty,+ (S.fromList [+ 3])])+ (S.fromList [+ 1,+ 2,+ 3])+ H.it "empty list of sets" $ H.shouldBe+ (Sets.unions [])+ (S.empty :: S.Set Int)+ H.it "single set" $ H.shouldBe+ (Sets.unions [+ S.fromList [+ 1,+ 2,+ 3]])+ (S.fromList [+ 1,+ 2,+ 3])+ H.describe "intersection" $ do+ H.it "common elements" $ H.shouldBe+ (Sets.intersection (S.fromList [+ 1,+ 2,+ 3]) (S.fromList [+ 2,+ 3,+ 4]))+ (S.fromList [+ 2,+ 3])+ H.it "no common elements" $ H.shouldBe+ (Sets.intersection (S.fromList [+ 1,+ 2]) (S.fromList [+ 3,+ 4]))+ (S.empty)+ H.it "intersection with empty" $ H.shouldBe+ (Sets.intersection (S.fromList [+ 1,+ 2]) S.empty)+ (S.empty)+ H.describe "difference" $ do+ H.it "remove elements" $ H.shouldBe+ (Sets.difference (S.fromList [+ 1,+ 2,+ 3]) (S.fromList [+ 2,+ 4]))+ (S.fromList [+ 1,+ 3])+ H.it "no overlap" $ H.shouldBe+ (Sets.difference (S.fromList [+ 1,+ 2]) (S.fromList [+ 3,+ 4]))+ (S.fromList [+ 1,+ 2])+ H.it "difference with empty" $ H.shouldBe+ (Sets.difference (S.fromList [+ 1,+ 2]) S.empty)+ (S.fromList [+ 1,+ 2])+ H.describe "map" $ do+ H.it "map function" $ H.shouldBe+ (Sets.map (\x -> Math.mul x 2) (S.fromList [+ 1,+ 2,+ 3]))+ (S.fromList [+ 2,+ 4,+ 6])+ H.it "map on empty" $ H.shouldBe+ (Sets.map (\x -> Math.mul x 2) S.empty)+ (S.empty)
+ src/gen-test/haskell/Generation/Hydra/Test/Lib/StringsSpec.hs view
@@ -0,0 +1,497 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.lib.strings"},ModuleName {unModuleName = "Strings"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.Lib.StringsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "hydra.lib.strings primitives" $ do+ H.describe "cat" $ do+ H.it "basic concatenation" $ H.shouldBe+ (Strings.cat [+ "one",+ "two",+ "three"])+ ("onetwothree")+ H.it "single string" $ H.shouldBe+ (Strings.cat [+ "hello"])+ ("hello")+ H.it "empty list" $ H.shouldBe+ (Strings.cat [])+ ("")+ H.it "with empty strings" $ H.shouldBe+ (Strings.cat [+ "",+ "one",+ "",+ ""])+ ("one")+ H.it "all empty strings" $ H.shouldBe+ (Strings.cat [+ "",+ "",+ "",+ ""])+ ("")+ H.it "unicode strings" $ H.shouldBe+ (Strings.cat [+ "\241",+ "\19990",+ "\127757"])+ ("\241\19990\127757")+ H.it "combining characters" $ H.shouldBe+ (Strings.cat [+ "e",+ "\769"])+ ("e\769")+ H.it "control characters" $ H.shouldBe+ (Strings.cat [+ "\n",+ "\t",+ "\r"])+ ("\n\t\r")+ H.it "null character" $ H.shouldBe+ (Strings.cat [+ "hello",+ "\NUL",+ "world"])+ ("hello\NULworld")+ H.describe "cat2" $ do+ H.it "basic concatenation" $ H.shouldBe+ (Strings.cat2 "hello" "world")+ ("helloworld")+ H.it "empty first string" $ H.shouldBe+ (Strings.cat2 "" "world")+ ("world")+ H.it "empty second string" $ H.shouldBe+ (Strings.cat2 "hello" "")+ ("hello")+ H.it "both empty strings" $ H.shouldBe+ (Strings.cat2 "" "")+ ("")+ H.it "unicode characters" $ H.shouldBe+ (Strings.cat2 "\241" "\19990")+ ("\241\19990")+ H.it "special characters" $ H.shouldBe+ (Strings.cat2 "\n" "\t")+ ("\n\t")+ H.it "null characters" $ H.shouldBe+ (Strings.cat2 "hello\NUL" "world")+ ("hello\NULworld")+ H.describe "charAt" $ do+ H.it "first character" $ H.shouldBe+ (Strings.charAt 0 "hello")+ (104)+ H.it "middle character" $ H.shouldBe+ (Strings.charAt 2 "hello")+ (108)+ H.it "last character" $ H.shouldBe+ (Strings.charAt 4 "hello")+ (111)+ H.it "single character string" $ H.shouldBe+ (Strings.charAt 0 "a")+ (97)+ H.it "unicode character" $ H.shouldBe+ (Strings.charAt 0 "\241")+ (241)+ H.it "multi-byte unicode" $ H.shouldBe+ (Strings.charAt 0 "\19990")+ (19990)+ H.it "second of combining pair" $ H.shouldBe+ (Strings.charAt 1 "e\769")+ (769)+ H.describe "fromList" $ do+ H.it "basic ascii string" $ H.shouldBe+ (Strings.fromList [+ 104,+ 101,+ 108,+ 108,+ 111])+ ("hello")+ H.it "empty code point list" $ H.shouldBe+ (Strings.fromList [])+ ("")+ H.it "single character" $ H.shouldBe+ (Strings.fromList [+ 97])+ ("a")+ H.it "unicode characters" $ H.shouldBe+ (Strings.fromList [+ 241,+ 19990,+ 127757])+ ("\241\19990\127757")+ H.it "combining character sequence" $ H.shouldBe+ (Strings.fromList [+ 101,+ 769])+ ("e\769")+ H.it "special characters" $ H.shouldBe+ (Strings.fromList [+ 10,+ 9,+ 13])+ ("\n\t\r")+ H.it "null character" $ H.shouldBe+ (Strings.fromList [+ 104,+ 0,+ 105])+ ("h\NULi")+ H.describe "intercalate" $ do+ H.it "comma separator" $ H.shouldBe+ (Strings.intercalate "," [+ "one",+ "two",+ "three"])+ ("one,two,three")+ H.it "empty separator" $ H.shouldBe+ (Strings.intercalate "" [+ "a",+ "b",+ "c"])+ ("abc")+ H.it "multi-character separator" $ H.shouldBe+ (Strings.intercalate " | " [+ "A",+ "B",+ "C"])+ ("A | B | C")+ H.it "empty string list" $ H.shouldBe+ (Strings.intercalate "," [])+ ("")+ H.it "single item list" $ H.shouldBe+ (Strings.intercalate "," [+ "only"])+ ("only")+ H.it "empty strings in list" $ H.shouldBe+ (Strings.intercalate "," [+ "",+ "a",+ ""])+ (",a,")+ H.it "unicode separator" $ H.shouldBe+ (Strings.intercalate "\127757" [+ "link1",+ "link2"])+ ("link1\127757link2")+ H.it "newline separator" $ H.shouldBe+ (Strings.intercalate "\n" [+ "line1",+ "line2"])+ ("line1\nline2")+ H.describe "length" $ do+ H.it "empty string" $ H.shouldBe+ (Strings.length "")+ (0)+ H.it "single character" $ H.shouldBe+ (Strings.length "a")+ (1)+ H.it "basic word" $ H.shouldBe+ (Strings.length "hello")+ (5)+ H.it "unicode characters" $ H.shouldBe+ (Strings.length "\241\19990\127757")+ (3)+ H.it "combining character sequence" $ H.shouldBe+ (Strings.length "e\769")+ (2)+ H.it "special characters" $ H.shouldBe+ (Strings.length "\n\t\r")+ (3)+ H.describe "lines" $ do+ H.it "single line" $ H.shouldBe+ (Strings.lines "hello world")+ ([+ "hello world"])+ H.it "two lines" $ H.shouldBe+ (Strings.lines "hello\nworld")+ ([+ "hello",+ "world"])+ H.it "three lines" $ H.shouldBe+ (Strings.lines "one\ntwo\nthree")+ ([+ "one",+ "two",+ "three"])+ H.it "empty string" $ H.shouldBe+ (Strings.lines "")+ ([])+ H.it "just newline" $ H.shouldBe+ (Strings.lines "\n")+ ([+ ""])+ H.it "trailing newline" $ H.shouldBe+ (Strings.lines "hello\n")+ ([+ "hello"])+ H.it "leading newline" $ H.shouldBe+ (Strings.lines "\nhello")+ ([+ "",+ "hello"])+ H.it "multiple consecutive newlines" $ H.shouldBe+ (Strings.lines "a\n\nb")+ ([+ "a",+ "",+ "b"])+ H.it "unicode content" $ H.shouldBe+ (Strings.lines "\241\n\19990")+ ([+ "\241",+ "\19990"])+ H.it "tabs not split" $ H.shouldBe+ (Strings.lines "a\tb\nc")+ ([+ "a\tb",+ "c"])+ H.describe "null" $ do+ H.it "empty string" $ H.shouldBe+ (Strings.null "")+ (True)+ H.it "single character" $ H.shouldBe+ (Strings.null "a")+ (False)+ H.it "space" $ H.shouldBe+ (Strings.null " ")+ (False)+ H.it "unicode space" $ H.shouldBe+ (Strings.null "\160")+ (False)+ H.it "newline" $ H.shouldBe+ (Strings.null "\n")+ (False)+ H.it "null character" $ H.shouldBe+ (Strings.null "\NUL")+ (False)+ H.it "multi-character" $ H.shouldBe+ (Strings.null "hello")+ (False)+ H.describe "splitOn" $ do+ H.it "basic separator" $ H.shouldBe+ (Strings.splitOn "ss" "Mississippi")+ ([+ "Mi",+ "i",+ "ippi"])+ H.it "single char separator" $ H.shouldBe+ (Strings.splitOn " " "one two three")+ ([+ "one",+ "two",+ "three"])+ H.it "multi-char separator" $ H.shouldBe+ (Strings.splitOn " " "a b c")+ ([+ "a",+ "b",+ "c"])+ H.it "separator not found" $ H.shouldBe+ (Strings.splitOn "x" "hello")+ ([+ "hello"])+ H.it "separator at start" $ H.shouldBe+ (Strings.splitOn "h" "hello")+ ([+ "",+ "ello"])+ H.it "separator at end" $ H.shouldBe+ (Strings.splitOn "o" "hello")+ ([+ "hell",+ ""])+ H.it "leading and trailing separator" $ H.shouldBe+ (Strings.splitOn " " " one two ")+ ([+ "",+ "one",+ "two",+ ""])+ H.it "whole string as separator" $ H.shouldBe+ (Strings.splitOn "Mississippi" "Mississippi")+ ([+ "",+ ""])+ H.it "consecutive separators" $ H.shouldBe+ (Strings.splitOn " " "a b")+ ([+ "a",+ "",+ "b"])+ H.it "multiple occurrences" $ H.shouldBe+ (Strings.splitOn "l" "hello")+ ([+ "he",+ "",+ "o"])+ H.it "overlapping pattern" $ H.shouldBe+ (Strings.splitOn "aa" "aaa")+ ([+ "",+ "a"])+ H.it "empty separator" $ H.shouldBe+ (Strings.splitOn "" "abc")+ ([+ "",+ "a",+ "b",+ "c"])+ H.it "separator on empty string" $ H.shouldBe+ (Strings.splitOn "x" "")+ ([+ ""])+ H.it "both empty" $ H.shouldBe+ (Strings.splitOn "" "")+ ([+ ""])+ H.it "single char both" $ H.shouldBe+ (Strings.splitOn "a" "a")+ ([+ "",+ ""])+ H.it "unicode separator" $ H.shouldBe+ (Strings.splitOn "\19990" "hello\19990world")+ ([+ "hello",+ "world"])+ H.it "unicode content" $ H.shouldBe+ (Strings.splitOn "," "\241,\19990,\127757")+ ([+ "\241",+ "\19990",+ "\127757"])+ H.it "newline separator" $ H.shouldBe+ (Strings.splitOn "\n" "line1\nline2\nline3")+ ([+ "line1",+ "line2",+ "line3"])+ H.describe "toList" $ do+ H.it "empty string" $ H.shouldBe+ (Strings.toList "")+ ([])+ H.it "single character" $ H.shouldBe+ (Strings.toList "a")+ ([+ 97])+ H.it "basic word" $ H.shouldBe+ (Strings.toList "hello")+ ([+ 104,+ 101,+ 108,+ 108,+ 111])+ H.it "unicode characters" $ H.shouldBe+ (Strings.toList "\241\19990\127757")+ ([+ 241,+ 19990,+ 127757])+ H.it "combining character sequence" $ H.shouldBe+ (Strings.toList "e\769")+ ([+ 101,+ 769])+ H.it "control characters" $ H.shouldBe+ (Strings.toList "\n\t\r")+ ([+ 10,+ 9,+ 13])+ H.it "null character" $ H.shouldBe+ (Strings.toList "h\NULi")+ ([+ 104,+ 0,+ 105])+ H.describe "toLower" $ do+ H.it "mixed case" $ H.shouldBe+ (Strings.toLower "Hello World")+ ("hello world")+ H.it "all uppercase" $ H.shouldBe+ (Strings.toLower "HELLO")+ ("hello")+ H.it "all lowercase" $ H.shouldBe+ (Strings.toLower "hello")+ ("hello")+ H.it "empty string" $ H.shouldBe+ (Strings.toLower "")+ ("")+ H.it "with numbers and punctuation" $ H.shouldBe+ (Strings.toLower "Abc123, XYZ!")+ ("abc123, xyz!")+ H.it "control characters" $ H.shouldBe+ (Strings.toLower "\n\t\r")+ ("\n\t\r")+ H.it "unicode accented chars" $ H.shouldBe+ (Strings.toLower "\209\193\201\205\211\218")+ ("\241\225\233\237\243\250")+ H.describe "toUpper" $ do+ H.it "mixed case" $ H.shouldBe+ (Strings.toUpper "hello World")+ ("HELLO WORLD")+ H.it "all lowercase" $ H.shouldBe+ (Strings.toUpper "hello")+ ("HELLO")+ H.it "all uppercase" $ H.shouldBe+ (Strings.toUpper "HELLO")+ ("HELLO")+ H.it "empty string" $ H.shouldBe+ (Strings.toUpper "")+ ("")+ H.it "with numbers and punctuation" $ H.shouldBe+ (Strings.toUpper "abc123, xyz!")+ ("ABC123, XYZ!")+ H.it "control characters" $ H.shouldBe+ (Strings.toUpper "\n\t\r")+ ("\n\t\r")+ H.it "unicode accented chars" $ H.shouldBe+ (Strings.toUpper "\241\225\233\237\243\250")+ ("\209\193\201\205\211\218")+ H.describe "unlines" $ do+ H.it "multiple lines" $ H.shouldBe+ (Strings.unlines [+ "one",+ "two",+ "three"])+ ("one\ntwo\nthree\n")+ H.it "single line" $ H.shouldBe+ (Strings.unlines [+ "hello"])+ ("hello\n")+ H.it "empty list" $ H.shouldBe+ (Strings.unlines [])+ ("")+ H.it "with empty lines" $ H.shouldBe+ (Strings.unlines [+ "hello",+ "",+ "world"])+ ("hello\n\nworld\n")+ H.it "all empty lines" $ H.shouldBe+ (Strings.unlines [+ "",+ "",+ ""])+ ("\n\n\n")+ H.it "unicode content" $ H.shouldBe+ (Strings.unlines [+ "\241o\241o",+ "\19990\30028"])+ ("\241o\241o\n\19990\30028\n")
+ src/gen-test/haskell/Generation/Hydra/Test/MonadsSpec.hs view
@@ -0,0 +1,67 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.monads"},ModuleName {unModuleName = "Monads"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.compute"},ModuleName {unModuleName = "Compute"}),(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.monads"},ModuleName {unModuleName = "Monads"})]++module Generation.Hydra.Test.MonadsSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Compute as Compute+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Monads as Monads++spec :: H.Spec+spec = H.describe "monads" $ do+ H.describe "pure" $ do+ H.it "integer" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure 42) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 42)+ H.it "string" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.pure "hello") Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just "hello")+ H.describe "map" $ do+ H.it "map negate" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.map Math.negate (Monads.pure 5)) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just (-5))+ H.it "map absolute" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.map Math.abs (Monads.pure (-3))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 3)+ H.describe "bind" $ do+ H.it "bind add" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 10) (\n -> Monads.pure (Math.add n 5))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 15)+ H.it "bind multiply" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.bind (Monads.pure 3) (\n -> Monads.pure (Math.mul n 4))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Just 12)+ H.describe "error traces" $ do+ H.it "Error traces are in the right order" $ H.shouldBe+ (Compute.flowStateValue (Compute.unFlow (Monads.withTrace "one" (Monads.withTrace "two" (Monads.fail "oops"))) Lexical.emptyGraph (Compute.Trace {+ Compute.traceStack = [],+ Compute.traceMessages = [],+ Compute.traceOther = M.empty})))+ (Nothing :: Maybe Int)
+ src/gen-test/haskell/Generation/Hydra/Test/ReductionSpec.hs view
@@ -0,0 +1,216 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.reduction"},ModuleName {unModuleName = "Reduction"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.lib.lists"},ModuleName {unModuleName = "Lists"}),(Namespace {unNamespace = "hydra.lib.math"},ModuleName {unModuleName = "Math"}),(Namespace {unNamespace = "hydra.lib.sets"},ModuleName {unModuleName = "Sets"}),(Namespace {unNamespace = "hydra.lib.strings"},ModuleName {unModuleName = "Strings"})]++module Generation.Hydra.Test.ReductionSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Lib.Lists as Lists+import qualified Hydra.Lib.Math as Math+import qualified Hydra.Lib.Sets as Sets+import qualified Hydra.Lib.Strings as Strings++spec :: H.Spec+spec = H.describe "reduction" $ do+ H.describe "beta reduction" $ do+ H.it "identity function applied to literal" $ H.shouldBe+ ((\x -> x) 42)+ (42)+ H.it "constant function" $ H.shouldBe+ ((\x -> 1) 42)+ (1)+ H.it "nested application" $ H.shouldBe+ ((\x -> \y -> x) 1 2)+ (1)+ H.describe "monomorphic primitives" $ do+ H.it "toUpper on lowercase" $ H.shouldBe+ (Strings.toUpper "hello")+ ("HELLO")+ H.it "toUpper on mixed case" $ H.shouldBe+ (Strings.toUpper "Hello World")+ ("HELLO WORLD")+ H.it "toUpper on empty string" $ H.shouldBe+ (Strings.toUpper "")+ ("")+ H.it "toLower on uppercase" $ H.shouldBe+ (Strings.toLower "HELLO")+ ("hello")+ H.it "string length" $ H.shouldBe+ (Strings.length "hello")+ (5)+ H.it "string length of empty" $ H.shouldBe+ (Strings.length "")+ (0)+ H.it "add two positive integers" $ H.shouldBe+ (Math.add 3 5)+ (8)+ H.it "add negative and positive" $ H.shouldBe+ (Math.add (-10) 3)+ ((-7))+ H.it "add with zero" $ H.shouldBe+ (Math.add 0 42)+ (42)+ H.it "subtract integers" $ H.shouldBe+ (Math.sub 10 3)+ (7)+ H.it "multiply integers" $ H.shouldBe+ (Math.mul 6 7)+ (42)+ H.it "multiply by zero" $ H.shouldBe+ (Math.mul 100 0)+ (0)+ H.it "divide integers" $ H.shouldBe+ (Math.div 20 4)+ (5)+ H.it "modulo" $ H.shouldBe+ (Math.mod 17 5)+ (2)+ H.it "splitOn basic" $ H.shouldBe+ (Strings.splitOn "," "a,b,c")+ ([+ "a",+ "b",+ "c"])+ H.it "cat2 strings" $ H.shouldBe+ (Strings.cat2 "hello" "world")+ ("helloworld")+ H.describe "polymorphic primitives" $ do+ H.it "length of integer list" $ H.shouldBe+ (Lists.length [+ 1,+ 2,+ 3])+ (3)+ H.it "length of string list" $ H.shouldBe+ (Lists.length [+ "a",+ "b"])+ (2)+ H.it "length of empty list" $ H.shouldBe+ (Lists.length [])+ (0)+ H.it "length of single element list" $ H.shouldBe+ (Lists.length [+ True])+ (1)+ H.it "head of integer list" $ H.shouldBe+ (Lists.head [+ 10,+ 20,+ 30])+ (10)+ H.it "head of string list" $ H.shouldBe+ (Lists.head [+ "first",+ "second"])+ ("first")+ H.it "last of integer list" $ H.shouldBe+ (Lists.last [+ 10,+ 20,+ 30])+ (30)+ H.it "concat two integer lists" $ H.shouldBe+ (Lists.concat2 [+ 1,+ 2] [+ 3,+ 4])+ ([+ 1,+ 2,+ 3,+ 4])+ H.it "concat with empty list" $ H.shouldBe+ (Lists.concat2 [] [+ 1,+ 2])+ ([+ 1,+ 2])+ H.it "reverse integer list" $ H.shouldBe+ (Lists.reverse [+ 1,+ 2,+ 3])+ ([+ 3,+ 2,+ 1])+ H.it "reverse empty list" $ H.shouldBe+ (Lists.reverse [])+ ([] :: [Int])+ H.describe "nullary primitives" $ do+ H.it "empty set has size zero" $ H.shouldBe+ (Sets.size Sets.empty)+ (0)+ H.describe "literals as values" $ do+ H.it "integer literal is a value" $ H.shouldBe+ (42)+ (42)+ H.it "negative integer literal" $ H.shouldBe+ ((-17))+ ((-17))+ H.it "zero integer literal" $ H.shouldBe+ (0)+ (0)+ H.it "string literal is a value" $ H.shouldBe+ ("hello")+ ("hello")+ H.it "empty string literal" $ H.shouldBe+ ("")+ ("")+ H.it "string with special characters" $ H.shouldBe+ ("hello\nworld\ttab")+ ("hello\nworld\ttab")+ H.it "boolean true is a value" $ H.shouldBe+ (True)+ (True)+ H.it "boolean false is a value" $ H.shouldBe+ (False)+ (False)+ H.it "float literal is a value" $ H.shouldBe+ (3.14)+ (3.14)+ H.it "negative float literal" $ H.shouldBe+ ((-2.718))+ ((-2.718))+ H.it "zero float literal" $ H.shouldBe+ (0.0)+ (0.0)+ H.describe "list reduction" $ do+ H.it "empty list is a value" $ H.shouldBe+ ([])+ ([] :: [Int])+ H.it "list of literals is a value" $ H.shouldBe+ ([+ 1,+ 2,+ 3])+ ([+ 1,+ 2,+ 3])+ H.it "list with reducible element" $ H.shouldBe+ ([+ (\x -> x) 42])+ ([+ 42])+ H.describe "optional reduction" $ do+ H.it "nothing is a value" $ H.shouldBe+ (Nothing)+ (Nothing :: Maybe Int)+ H.it "just literal is a value" $ H.shouldBe+ (Just 42)+ (Just 42)+ H.it "just with reducible content" $ H.shouldBe+ (Just ((\x -> x) 42))+ (Just 42)
+ src/gen-test/haskell/Generation/Hydra/Test/SortingSpec.hs view
@@ -0,0 +1,350 @@+-- Note: this is an automatically generated file. Do not edit.++-- DEBUG: Focus namespace = (Namespace {unNamespace = "generation.hydra.test.sorting"},ModuleName {unModuleName = "Sorting"})+-- DEBUG: Namespace mappings:+-- [(Namespace {unNamespace = "hydra.lexical"},ModuleName {unModuleName = "Lexical"}),(Namespace {unNamespace = "hydra.sorting"},ModuleName {unModuleName = "Sorting"})]++module Generation.Hydra.Test.SortingSpec where++import Hydra.Kernel+import qualified Test.Hspec as H+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import qualified Hydra.Lexical as Lexical+import qualified Hydra.Sorting as Sorting++spec :: H.Spec+spec = H.describe "sorting" $ do+ H.describe "topological sort" $ do+ H.it "empty set" $ H.shouldBe+ (Sorting.topologicalSort [])+ (Right [] :: Either [[Int]] [Int])+ H.it "singleton set" $ H.shouldBe+ (Sorting.topologicalSort [+ (1, [])])+ (Right [+ 1] :: Either [[Int]] [Int])+ H.it "discrete set with multiple elements" $ H.shouldBe+ (Sorting.topologicalSort [+ (3, []),+ (1, []),+ (2, [])])+ (Right [+ 1,+ 2,+ 3] :: Either [[Int]] [Int])+ H.it "linked list" $ H.shouldBe+ (Sorting.topologicalSort [+ (3, [+ 1]),+ (2, [+ 3]),+ (1, [])])+ (Right [+ 1,+ 3,+ 2] :: Either [[Int]] [Int])+ H.it "binary tree" $ H.shouldBe+ (Sorting.topologicalSort [+ (3, [+ 1,+ 4]),+ (4, [+ 6,+ 2]),+ (1, [+ 5]),+ (2, []),+ (6, []),+ (5, [])])+ (Right [+ 5,+ 1,+ 2,+ 6,+ 4,+ 3] :: Either [[Int]] [Int])+ H.it "two trees" $ H.shouldBe+ (Sorting.topologicalSort [+ (3, [+ 1,+ 4]),+ (5, [+ 6,+ 2]),+ (2, [+ 7]),+ (1, []),+ (4, []),+ (6, []),+ (7, [])])+ (Right [+ 1,+ 7,+ 2,+ 4,+ 3,+ 6,+ 5] :: Either [[Int]] [Int])+ H.it "diamond DAG" $ H.shouldBe+ (Sorting.topologicalSort [+ (1, [+ 3,+ 4]),+ (3, [+ 2]),+ (4, [+ 2]),+ (2, [+ 5]),+ (5, [])])+ (Right [+ 5,+ 2,+ 3,+ 4,+ 1] :: Either [[Int]] [Int])+ H.it "two-node cycle" $ H.shouldBe+ (Sorting.topologicalSort [+ (1, [+ 2]),+ (2, [+ 1])])+ (Left [+ [+ 1,+ 2]] :: Either [[Int]] [Int])+ H.it "cycle with incoming and outgoing edges" $ H.shouldBe+ (Sorting.topologicalSort [+ (1, [+ 3]),+ (3, [+ 2]),+ (2, [+ 3,+ 4]),+ (4, [+ 5]),+ (5, [])])+ (Left [+ [+ 2,+ 3]] :: Either [[Int]] [Int])+ H.describe "topological sort SCC" $ do+ H.it "empty set" $ H.shouldBe+ (Sorting.topologicalSortComponents [])+ ([] :: [[Int]])+ H.it "singleton set" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [])])+ ([+ [+ 1]])+ H.it "discrete set with multiple elements" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (3, []),+ (1, []),+ (2, [])])+ ([+ [+ 1],+ [+ 2],+ [+ 3]])+ H.it "single two-element component #1" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2]),+ (2, [])])+ ([+ [+ 2],+ [+ 1]])+ H.it "single two-element component #2" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (2, [+ 1]),+ (1, [])])+ ([+ [+ 1],+ [+ 2]])+ H.it "multiple-element component" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (2, [+ 1,+ 3]),+ (1, [+ 3]),+ (3, [])])+ ([+ [+ 3],+ [+ 1],+ [+ 2]])+ H.it "cycle of two nodes #1" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2]),+ (2, [+ 1])])+ ([+ [+ 1,+ 2]])+ H.it "cycle of two nodes #2" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (2, [+ 1]),+ (1, [+ 2])])+ ([+ [+ 1,+ 2]])+ H.it "cycle of three nodes #1" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2]),+ (2, [+ 3]),+ (3, [+ 1])])+ ([+ [+ 1,+ 2,+ 3]])+ H.it "cycle of three nodes #2" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (2, [+ 1]),+ (3, [+ 2]),+ (1, [+ 3])])+ ([+ [+ 1,+ 2,+ 3]])+ H.it "multiple disconnected cycles" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (200, []),+ (100, []),+ (300, []),+ (10, [+ 20]),+ (20, [+ 10]),+ (1, [+ 2]),+ (2, [+ 3]),+ (3, [+ 1])])+ ([+ [+ 1,+ 2,+ 3],+ [+ 10,+ 20],+ [+ 100],+ [+ 200],+ [+ 300]])+ H.it "complex cycles" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2,+ 3]),+ (2, [+ 3]),+ (3, [+ 1])])+ ([+ [+ 1,+ 2,+ 3]])+ H.it "chain of three SCCs" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2,+ 10]),+ (2, [+ 3]),+ (3, [+ 1]),+ (10, [+ 20]),+ (20, [+ 100,+ 10]),+ (100, [])])+ ([+ [+ 100],+ [+ 10,+ 20],+ [+ 1,+ 2,+ 3]])+ H.it "SCCs with dependencies to/from non-SCC nodes" $ H.shouldBe+ (Sorting.topologicalSortComponents [+ (1, [+ 2,+ 3,+ 10]),+ (2, [+ 3]),+ (3, [+ 1]),+ (10, [+ 20,+ 30]),+ (20, [+ 30]),+ (30, []),+ (100, [+ 200,+ 2]),+ (200, []),+ (300, [+ 100]),+ (1000, []),+ (2000, [])])+ ([+ [+ 30],+ [+ 20],+ [+ 10],+ [+ 1,+ 2,+ 3],+ [+ 200],+ [+ 100],+ [+ 300],+ [+ 1000],+ [+ 2000]])
+ src/gen-test/haskell/Generation/Spec.hs view
@@ -0,0 +1,44 @@+-- Note: this is an automatically generated file. Do not edit.++module Generation.Spec (spec) where++import qualified Test.Hspec as H+import qualified Generation.Hydra.Test.Lib.CharsSpec as Generation_Hydra_Test_Lib_CharsSpec+import qualified Generation.Hydra.Test.Lib.EithersSpec as Generation_Hydra_Test_Lib_EithersSpec+import qualified Generation.Hydra.Test.Lib.EqualitySpec as Generation_Hydra_Test_Lib_EqualitySpec+import qualified Generation.Hydra.Test.Lib.FlowsSpec as Generation_Hydra_Test_Lib_FlowsSpec+import qualified Generation.Hydra.Test.Lib.ListsSpec as Generation_Hydra_Test_Lib_ListsSpec+import qualified Generation.Hydra.Test.Lib.LiteralsSpec as Generation_Hydra_Test_Lib_LiteralsSpec+import qualified Generation.Hydra.Test.Lib.LogicSpec as Generation_Hydra_Test_Lib_LogicSpec+import qualified Generation.Hydra.Test.Lib.MapsSpec as Generation_Hydra_Test_Lib_MapsSpec+import qualified Generation.Hydra.Test.Lib.MathSpec as Generation_Hydra_Test_Lib_MathSpec+import qualified Generation.Hydra.Test.Lib.MaybesSpec as Generation_Hydra_Test_Lib_MaybesSpec+import qualified Generation.Hydra.Test.Lib.PairsSpec as Generation_Hydra_Test_Lib_PairsSpec+import qualified Generation.Hydra.Test.Lib.SetsSpec as Generation_Hydra_Test_Lib_SetsSpec+import qualified Generation.Hydra.Test.Lib.StringsSpec as Generation_Hydra_Test_Lib_StringsSpec+import qualified Generation.Hydra.Test.AnnotationsSpec as Generation_Hydra_Test_AnnotationsSpec+import qualified Generation.Hydra.Test.FormattingSpec as Generation_Hydra_Test_FormattingSpec+import qualified Generation.Hydra.Test.MonadsSpec as Generation_Hydra_Test_MonadsSpec+import qualified Generation.Hydra.Test.ReductionSpec as Generation_Hydra_Test_ReductionSpec+import qualified Generation.Hydra.Test.SortingSpec as Generation_Hydra_Test_SortingSpec++spec :: H.Spec+spec = do+ Generation_Hydra_Test_Lib_CharsSpec.spec+ Generation_Hydra_Test_Lib_EithersSpec.spec+ Generation_Hydra_Test_Lib_EqualitySpec.spec+ Generation_Hydra_Test_Lib_FlowsSpec.spec+ Generation_Hydra_Test_Lib_ListsSpec.spec+ Generation_Hydra_Test_Lib_LiteralsSpec.spec+ Generation_Hydra_Test_Lib_LogicSpec.spec+ Generation_Hydra_Test_Lib_MapsSpec.spec+ Generation_Hydra_Test_Lib_MathSpec.spec+ Generation_Hydra_Test_Lib_MaybesSpec.spec+ Generation_Hydra_Test_Lib_PairsSpec.spec+ Generation_Hydra_Test_Lib_SetsSpec.spec+ Generation_Hydra_Test_Lib_StringsSpec.spec+ Generation_Hydra_Test_AnnotationsSpec.spec+ Generation_Hydra_Test_FormattingSpec.spec+ Generation_Hydra_Test_MonadsSpec.spec+ Generation_Hydra_Test_ReductionSpec.spec+ Generation_Hydra_Test_SortingSpec.spec
+ src/gen-test/haskell/Hydra/Test/Annotations.hs view
@@ -0,0 +1,2362 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.annotations functions++module Hydra.Test.Annotations where++import qualified Hydra.Core as Core+import qualified Hydra.Lib.Maps as Maps+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.annotations functions+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "annotations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "arbitrary annotations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set single annotation #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set single annotation #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "myKey"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17))))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "myKey"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17))))}}))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set single annotation #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "hello"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}}))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "hello"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing annotation #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "value"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "value"))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing annotation #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString ""))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString ""))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing annotation #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "key"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "key"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing annotation #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 42)))}}))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing annotation #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "nonexistent"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "hello"))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing annotation #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k2"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set multiple annotations #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k2"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.fromList [+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}), (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))}}))}}))),+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k2"))}), (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))}}))}}))}})))]))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set multiple annotations #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "b"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "a"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.fromList [+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "a"))}), (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))}}))}}))}}))),+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "b"))}), (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}}))}}))}})))]))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer annotation overrides inner #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "outer"))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "inner"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "outer"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer annotation overrides inner #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "new"))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "old"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "new"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer annotation overrides inner #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "key"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "key"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean False))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean False))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "key"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}}))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset single annotation #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset single annotation #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))}))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "x"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset one of multiple annotations #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k2"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k1"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "k2"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200)))}}))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset one of multiple annotations #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "b"))}))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "b"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "a"))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "x"))}}))}}))}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "x"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "a"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "descriptions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set description #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "my description"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "my description"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set description #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString ""))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString ""))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set description #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "A longer description with spaces"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "A longer description with spaces"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing description #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing description #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString ""))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString ""))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get existing description #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "desc"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean False))}}))}}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "desc"))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing description #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int16"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 42)))}}))}}))}}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe Nothing)))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing description #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "no description here"))}}))}}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe Nothing)))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get missing description #3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermDescription")),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}}))}}))}}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe Nothing)))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.lexical.emptyGraph"))},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "hydra.monads.emptyTrace"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer description overrides inner #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "outer"))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "inner"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "outer"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer description overrides inner #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "new"))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "old"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "description"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "new"))}}))}}))))}]}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset description #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "desc"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int64"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 137)))}}))}}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unset description #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.setTermDescription")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "to be removed"))))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "layered annotations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get annotation from unannotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get annotation from singly annotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get inner annotation from doubly annotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))}]}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get outer annotation from doubly annotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))}]}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get non-overridden annotation from triply annotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))))}]}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "outer annotation overrides inner in layered term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.annotations.getTermAnnotation")),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "annotated"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.core.AnnotatedTerm"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "body"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))}}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "two"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}}))}}))}}))))}]}))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "annotation"),+ Core.fieldTerm = (Core.TermMap (Maps.singleton (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "one"))})) (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))))}]}))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Term"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.Literal"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "integer"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.core.IntegerValue"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int32"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))}}))}}))}}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "requiresFlowDecoding"]}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Checking/Advanced.hs view
@@ -0,0 +1,522 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Advanced type checking test cases: annotated terms and flows++module Hydra.Test.Checking.Advanced where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Advanced type checking test cases+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Advanced",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ annotatedTermsTests,+ flowsTests],+ Testing.testGroupCases = []}++annotatedTermsTests :: Testing.TestGroup+annotatedTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Annotated terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ topLevelAnnotationsTests,+ nestedAnnotationsTests,+ annotationsInComplexContextsTests],+ Testing.testGroupCases = []}++topLevelAnnotationsTests :: Testing.TestGroup+topLevelAnnotationsTests = Testing.TestGroup {+ Testing.testGroupName = "Top-level annotations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedAnnotationsTests :: Testing.TestGroup+nestedAnnotationsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested annotations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation within annotation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated terms in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.annotatedTermAnnotation = M.empty}), (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.annotatedTermAnnotation = M.empty})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.annotatedTermAnnotation = M.empty}), (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.annotatedTermAnnotation = M.empty})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated term in function application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++annotationsInComplexContextsTests :: Testing.TestGroup+annotationsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Annotations in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "world")),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "world")),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated record fields",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "Alice")),+ Core.annotatedTermAnnotation = M.empty}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "Smith")),+ Core.annotatedTermAnnotation = M.empty}))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30))),+ Core.annotatedTermAnnotation = M.empty}))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "Alice")),+ Core.annotatedTermAnnotation = M.empty}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "Smith")),+ Core.annotatedTermAnnotation = M.empty}))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30))),+ Core.annotatedTermAnnotation = M.empty}))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated function in application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "add"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "add")),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ Core.annotatedTermAnnotation = M.empty}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "add"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "add")),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Core.applicationArgument = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ Core.annotatedTermAnnotation = M.empty}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++flowsTests :: Testing.TestGroup+flowsTests = Testing.TestGroup {+ Testing.testGroupName = "Flows",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ flowsWithFailureAcrossLetBindingsTests],+ Testing.testGroupCases = []}++flowsWithFailureAcrossLetBindingsTests :: Testing.TestGroup+flowsWithFailureAcrossLetBindingsTests = Testing.TestGroup {+ Testing.testGroupName = "Flows with failure across let bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mutually referential failure functions with Flow monad",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "conditionalUnexpected"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "unexpected")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "oops"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "unexpected")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "unexpected"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.fail"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "conditionalUnexpected"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "conditionalUnexpected"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t4"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t5"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t3"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t5"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "unexpected")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t4"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t5"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "oops"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "unexpected")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t4"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t5"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t3",+ (Core.Name "t4"),+ (Core.Name "t5")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t3")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t5"))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "unexpected"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t4"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.fail"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t4"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t3",+ (Core.Name "t4")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "conditionalUnexpected")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))}))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))}))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForPython"]}]}
+ src/gen-test/haskell/Hydra/Test/Checking/AlgebraicTypes.hs view
@@ -0,0 +1,1322 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Algebraic type checking test cases: unit, pairs, eithers, optionals++module Hydra.Test.Checking.AlgebraicTypes where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Algebraic types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ unitTests,+ pairsTests,+ eithersTests,+ optionalsTests],+ Testing.testGroupCases = []}++unitTests :: Testing.TestGroup+unitTests = Testing.TestGroup {+ Testing.testGroupName = "Unit",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ unitTermTests,+ unitTermInPolymorphicContextTests],+ Testing.testGroupCases = []}++unitTermTests :: Testing.TestGroup+unitTermTests = Testing.TestGroup {+ Testing.testGroupName = "Unit term",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unit literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = Core.TermUnit,+ Testing.typeCheckingTestCaseOutputTerm = Core.TermUnit,+ Testing.typeCheckingTestCaseOutputType = Core.TypeUnit})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unitTermInPolymorphicContextTests :: Testing.TestGroup+unitTermInPolymorphicContextTests = Testing.TestGroup {+ Testing.testGroupName = "Unit term in polymorphic context",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unit from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = Core.TermUnit}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = Core.TermUnit})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = Core.TypeUnit}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++pairsTests :: Testing.TestGroup+pairsTests = Testing.TestGroup {+ Testing.testGroupName = "Pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ basicPairsTests,+ polymorphicPairsTests,+ pairsInComplexContextsTests,+ nestedPairsTests,+ pairsWithComplexTypesTests],+ Testing.testGroupCases = []}++basicPairsTests :: Testing.TestGroup+basicPairsTests = Testing.TestGroup {+ Testing.testGroupName = "Basic pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair of int and string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "hello")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "hello")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair of string and boolean",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "test"), (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralString "test"), (Core.TermLiteral (Core.LiteralBoolean True)))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair of boolean and int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean False), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean False), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100))))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicPairsTests :: Testing.TestGroup+polymorphicPairsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair from lambda (first element)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralString "constant"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralString "constant")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair from lambda (second element)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermLiteral (Core.LiteralString "constant"), (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralString "constant"), (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair from two lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair with repeated variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++pairsInComplexContextsTests :: Testing.TestGroup+pairsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Pairs in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "two"))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "two")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "answer")))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "result"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "answer")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "result"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedPairsTests :: Testing.TestGroup+nestedPairsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair of pairs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one"))), (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair with list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermLiteral (Core.LiteralString "numbers")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermLiteral (Core.LiteralString "numbers")))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of pairs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++pairsWithComplexTypesTests :: Testing.TestGroup+pairsWithComplexTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Pairs with complex types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair with record on first",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "Person"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "Person")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair with record on second",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "name"), (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralString "name"), (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "Person"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "Person"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++eithersTests :: Testing.TestGroup+eithersTests = Testing.TestGroup {+ Testing.testGroupName = "Eithers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ leftValuesTests,+ rightValuesTests,+ polymorphicEithersTests,+ eithersInComplexContextsTests,+ nestedEithersTests,+ eithersWithComplexTypesTests],+ Testing.testGroupCases = []}++leftValuesTests :: Testing.TestGroup+leftValuesTests = Testing.TestGroup {+ Testing.testGroupName = "Left values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left boolean",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralBoolean False)))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralBoolean False)))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++rightValuesTests :: Testing.TestGroup+rightValuesTests = Testing.TestGroup {+ Testing.testGroupName = "Right values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "success")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "success")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right boolean",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True)))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicEithersTests :: Testing.TestGroup+polymorphicEithersTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic eithers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t1")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either from two lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermVariable (Core.Name "x"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermVariable (Core.Name "x"))))}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.typeApplicationTermType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "x")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++eithersInComplexContextsTests :: Testing.TestGroup+eithersInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Eithers in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "result"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t1")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "result")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedEithersTests :: Testing.TestGroup+nestedEithersTests = Testing.TestGroup {+ Testing.testGroupName = "Nested eithers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either of either (left left)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})))),+ Core.typeApplicationTermType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))})),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either of either (left right)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "nested")))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "nested")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})))),+ Core.typeApplicationTermType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either of either (right)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True)))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either of list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of eithers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "b"))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "a")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "b")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++eithersWithComplexTypesTests :: Testing.TestGroup+eithersWithComplexTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Eithers with complex types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either with record on left",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Left (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Left (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either with record on right",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermEither (Right (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypePersonName)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeVariable TestTypes.testTypePersonName)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++optionalsTests :: Testing.TestGroup+optionalsTests = Testing.TestGroup {+ Testing.testGroupName = "Optionals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicOptionalsTests,+ polymorphicOptionalsTests,+ optionalsInComplexContextsTests,+ nestedOptionalsTests,+ optionalsWithComplexTypesTests],+ Testing.testGroupCases = []}++monomorphicOptionalsTests :: Testing.TestGroup+monomorphicOptionalsTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic optionals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe Nothing),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello")))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just boolean",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeBoolean))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicOptionalsTests :: Testing.TestGroup+polymorphicOptionalsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic optionals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe Nothing)}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t1")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "conditional optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.typeApplicationTermType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++optionalsInComplexContextsTests :: Testing.TestGroup+optionalsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Optionals in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "second"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "second"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "maybeValue"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "maybeValue"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "maybeValue"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "maybeValue"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedOptionalsTests :: Testing.TestGroup+nestedOptionalsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested optionals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional of optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "nested")))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "nested")))))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional of list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of optionals",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermMaybe Nothing),+ (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "b"))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "b"))))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++optionalsWithComplexTypesTests :: Testing.TestGroup+optionalsWithComplexTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Optionals with complex types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/Checking/All.hs view
@@ -0,0 +1,33 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Hydra's type checking test suite++module Hydra.Test.Checking.All where++import qualified Hydra.Test.Checking.Advanced as Advanced+import qualified Hydra.Test.Checking.AlgebraicTypes as AlgebraicTypes+import qualified Hydra.Test.Checking.Collections as Collections+import qualified Hydra.Test.Checking.Failures as Failures+import qualified Hydra.Test.Checking.Fundamentals as Fundamentals+import qualified Hydra.Test.Checking.NominalTypes as NominalTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | The group of all type checking tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "checking",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Advanced.allTests,+ AlgebraicTypes.allTests,+ Collections.allTests,+ Failures.allTests,+ Fundamentals.allTests,+ NominalTypes.allTests],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Checking/Collections.hs view
@@ -0,0 +1,1028 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Collection type checking test cases: lists, sets, maps++module Hydra.Test.Checking.Collections where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Collections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ listsTests,+ setsTests,+ mapsTests],+ Testing.testGroupCases = []}++listsTests :: Testing.TestGroup+listsTests = Testing.TestGroup {+ Testing.testGroupName = "Lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ listsOfLiteralsTests,+ emptyListsTests,+ polymorphicListsTests,+ nestedListsTests,+ listsInComplexContextsTests],+ Testing.testGroupCases = []}++listsOfLiteralsTests :: Testing.TestGroup+listsOfLiteralsTests = Testing.TestGroup {+ Testing.testGroupName = "Lists of literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed numeric types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.0)),+ (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5))),+ (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.0)),+ (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5))),+ (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++emptyListsTests :: Testing.TestGroup+emptyListsTests = Testing.TestGroup {+ Testing.testGroupName = "Empty lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList []),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pair of empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermList []))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicListsTests :: Testing.TestGroup+polymorphicListsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list with repeated var",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "x"))])}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "x"))])})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list from two lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedListsTests :: Testing.TestGroup+nestedListsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty nested lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermList [],+ (Core.TermList [])]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested polymorphic",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermList [+ Core.TermVariable (Core.Name "x")]])}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermList [+ Core.TermList [+ Core.TermVariable (Core.Name "x")]])})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++listsInComplexContextsTests :: Testing.TestGroup+listsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Lists in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple lists in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++mapsTests :: Testing.TestGroup+mapsTests = Testing.TestGroup {+ Testing.testGroupName = "Maps",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicMapsTests,+ polymorphicMapsTests,+ mapsInComplexContextsTests,+ mapsWithComplexTypesTests],+ Testing.testGroupCases = []}++monomorphicMapsTests :: Testing.TestGroup+monomorphicMapsTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic maps",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap M.empty),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMap M.empty),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int to string map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "two")))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "two")))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string to int map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "a"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermLiteral (Core.LiteralString "b"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "a"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermLiteral (Core.LiteralString "b"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single entry map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)), (Core.TermLiteral (Core.LiteralBoolean True)))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)), (Core.TermLiteral (Core.LiteralBoolean True)))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint)),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicMapsTests :: Testing.TestGroup+polymorphicMapsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic maps",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map from lambda keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermLiteral (Core.LiteralString "value")))]))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermLiteral (Core.LiteralString "value")))]))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map from lambda values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermVariable (Core.Name "v")))]))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermVariable (Core.Name "v")))]))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map from lambda both",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermVariable (Core.Name "v")))]))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermVariable (Core.Name "v")))]))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map with repeated variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x")))]))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x")))]))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++mapsInComplexContextsTests :: Testing.TestGroup+mapsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Maps in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one")))]), (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "one")))]), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested maps",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "outer"), (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralBoolean True)))])))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "outer"), (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralBoolean True)))])))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "lookup"),+ Core.bindingTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key1"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100)))),+ (Core.TermLiteral (Core.LiteralString "key2"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200))))])),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "lookup"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "lookup"),+ Core.bindingTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key1"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100)))),+ (Core.TermLiteral (Core.LiteralString "key2"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 200))))])),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "lookup"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++mapsWithComplexTypesTests :: Testing.TestGroup+mapsWithComplexTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Maps with complex types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map of records",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "person1"), (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "person1"), (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeVariable TestTypes.testTypePersonName)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map of lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "d"))]))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "d"))]))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map of tuples",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "coords"), (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))))))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "coords"), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++setsTests :: Testing.TestGroup+setsTests = Testing.TestGroup {+ Testing.testGroupName = "Sets",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicSetsTests,+ polymorphicSetsTests,+ setsInComplexContextsTests,+ nestedSetsTests,+ setsWithComplexTypesTests],+ Testing.testGroupCases = []}++monomorphicSetsTests :: Testing.TestGroup+monomorphicSetsTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic sets",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet S.empty),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermSet S.empty),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "apple"),+ (Core.TermLiteral (Core.LiteralString "banana")),+ (Core.TermLiteral (Core.LiteralString "cherry"))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "apple"),+ (Core.TermLiteral (Core.LiteralString "banana")),+ (Core.TermLiteral (Core.LiteralString "cherry"))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralBoolean True)])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralBoolean True)])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeBoolean))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicSetsTests :: Testing.TestGroup+polymorphicSetsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic sets",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x")]))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x")]))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set with repeated variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x")]))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x")]))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set from two variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))]))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))]))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++setsInComplexContextsTests :: Testing.TestGroup+setsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Sets in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]), (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "numbers"),+ Core.bindingTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))])),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "numbers"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "numbers"),+ Core.bindingTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))])),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "numbers"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedSetsTests :: Testing.TestGroup+nestedSetsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested sets",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "d"))])])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "d"))])])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of tuples",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))))])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of sets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "nested")])])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "nested")])])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeString)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++setsWithComplexTypesTests :: Testing.TestGroup+setsWithComplexTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Sets with complex types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of records",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeVariable TestTypes.testTypePersonName))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of optionals",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))),+ (Core.TermMaybe Nothing)])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of maps",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])])),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermSet (S.fromList [+ Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])])),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeSet (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/Checking/Failures.hs view
@@ -0,0 +1,37 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Type checking failure test cases++module Hydra.Test.Checking.Failures where++import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Type checking failure test cases+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Failures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ failOnUntypedTests],+ Testing.testGroupCases = []}++failOnUntypedTests :: Testing.TestGroup+failOnUntypedTests = Testing.TestGroup {+ Testing.testGroupName = "Fail on untyped (pre-inference) terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ untypedLambdasTests],+ Testing.testGroupCases = []}++untypedLambdasTests :: Testing.TestGroup+untypedLambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Untyped lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Checking/Fundamentals.hs view
@@ -0,0 +1,4054 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Fundamental type checking test cases: literals, variables, lambdas, applications, let terms, and primitives++module Hydra.Test.Checking.Fundamentals where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Fundamentals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ literalsTests,+ variablesTests,+ lambdasTests,+ applicationsTests,+ letTermsTests,+ primitivesTests],+ Testing.testGroupCases = []}++applicationsTests :: Testing.TestGroup+applicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleFunctionApplicationsTests,+ partialApplicationsTests,+ higherOrderApplicationsTests,+ polymorphicApplicationsTests,+ applicationsInComplexContextsTests,+ applicationsWithComplexArgumentsTests],+ Testing.testGroupCases = []}++simpleFunctionApplicationsTests :: Testing.TestGroup+simpleFunctionApplicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Simple function applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "primitive application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string concatenation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++partialApplicationsTests :: Testing.TestGroup+partialApplicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Partial applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partially applied add",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partially applied string cat",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "prefix"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "prefix"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++higherOrderApplicationsTests :: Testing.TestGroup+higherOrderApplicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Higher-order applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "apply function to function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "apply")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "apply")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "function composition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "compose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "add1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "mul2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "compose")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "add1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "mul2"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "compose"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "add1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "mul2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "compose")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "add1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "mul2"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicApplicationsTests :: Testing.TestGroup+polymorphicApplicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic identity",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic const",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "const"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "const")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "keep"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "const"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "const")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "keep"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic flip",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "flip"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "flip")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "flip"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "flip")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++applicationsInComplexContextsTests :: Testing.TestGroup+applicationsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Applications in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "b"))})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "b"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "John"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ny"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "John"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ny"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "result"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "result"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++applicationsWithComplexArgumentsTests :: Testing.TestGroup+applicationsWithComplexArgumentsTests = Testing.TestGroup {+ Testing.testGroupName = "Applications with complex arguments",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application with record argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "getName")),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "getName")),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application with list argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "head"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "head")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "first"),+ (Core.TermLiteral (Core.LiteralString "second"))])}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "head"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xs"),+ Core.lambdaDomain = (Just (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xs"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "head")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "first"),+ (Core.TermLiteral (Core.LiteralString "second"))])}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++lambdasTests :: Testing.TestGroup+lambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleLambdasTests,+ multiParameterLambdasTests,+ lambdasWithOperationsTests,+ nestedLambdasTests,+ lambdasInComplexContextsTests,+ higherOrderLambdasTests],+ Testing.testGroupCases = []}++simpleLambdasTests :: Testing.TestGroup+simpleLambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Simple lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "constant function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterLambdasTests :: Testing.TestGroup+multiParameterLambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two parameters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three parameters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})))})))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "parameter reuse",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++lambdasWithOperationsTests :: Testing.TestGroup+lambdasWithOperationsTests = Testing.TestGroup {+ Testing.testGroupName = "Lambdas with operations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with construction",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedLambdasTests :: Testing.TestGroup+nestedLambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Nested lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with inner lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "inner")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "inner")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))}))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++lambdasInComplexContextsTests :: Testing.TestGroup+lambdasInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Lambdas in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeVariable TestTypes.testTypePersonName)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++higherOrderLambdasTests :: Testing.TestGroup+higherOrderLambdasTests = Testing.TestGroup {+ Testing.testGroupName = "Higher-order lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "function composition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))})))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "function application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "curried function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))})))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++letTermsTests :: Testing.TestGroup+letTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Let terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleLetBindingsTests,+ letTermsWithShadowingTests,+ recursiveBindingsTests,+ mutualRecursionTests,+ nestedLetTermsTests,+ letWithComplexExpressionsTests],+ Testing.testGroupCases = []}++simpleLetBindingsTests :: Testing.TestGroup+simpleLetBindingsTests = Testing.TestGroup {+ Testing.testGroupName = "Simple let bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++letTermsWithShadowingTests :: Testing.TestGroup+letTermsWithShadowingTests = Testing.TestGroup {+ Testing.testGroupName = "Let terms with shadowing",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda parameter shadowing let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lambda shadowing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t1")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple levels of let shadowing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "second")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralBoolean True)),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "second")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralBoolean True)),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let shadowing with lambda and reference to outer binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "y")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "z"))))}))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "y")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "z")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recursiveBindingsTests :: Testing.TestGroup+recursiveBindingsTests = Testing.TestGroup {+ Testing.testGroupName = "Recursive bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple arithmetic recursion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "double")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "double")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++mutualRecursionTests :: Testing.TestGroup+mutualRecursionTests = Testing.TestGroup {+ Testing.testGroupName = "Mutual recursion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mutually recursive data",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "listA"),+ Core.bindingTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "listB"))))}]})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "listB"),+ Core.bindingTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "listA"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "listA"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "listB"))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "listB"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "listA"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "(monomorphic) mutually recursive functions",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedLetTermsTests :: Testing.TestGroup+nestedLetTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested let terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic nesting",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic nesting",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "apply")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "id"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "test"))}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "apply")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "test"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable capture avoidance",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple let in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "z")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "z")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++letWithComplexExpressionsTests :: Testing.TestGroup+letWithComplexExpressionsTests = Testing.TestGroup {+ Testing.testGroupName = "Let with complex expressions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "first"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "John")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "middle"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "Q")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "first"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "middle"))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "first"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "John")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "middle"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "Q")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "first"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "middle"))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let in function application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "composition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "compose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "add1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "compose")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "add1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "compose"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "add1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "compose")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "add1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++literalsTests :: Testing.TestGroup+literalsTests = Testing.TestGroup {+ Testing.testGroupName = "Literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ booleanLiteralsTests,+ stringLiteralsTests,+ integerLiteralsTests,+ floatLiteralsTests,+ literalsInComplexContextsTests],+ Testing.testGroupCases = []}++booleanLiteralsTests :: Testing.TestGroup+booleanLiteralsTests = Testing.TestGroup {+ Testing.testGroupName = "Boolean literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean True)),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralBoolean True)),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean False)),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralBoolean False)),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++stringLiteralsTests :: Testing.TestGroup+stringLiteralsTests = Testing.TestGroup {+ Testing.testGroupName = "String literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralString "hello")),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralString "")),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralString "")),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralString "caf\233")),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralString "caf\233")),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++integerLiteralsTests :: Testing.TestGroup+integerLiteralsTests = Testing.TestGroup {+ Testing.testGroupName = "Integer literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigint",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 127))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 127))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int16",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 32767))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 32767))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2147483647))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2147483647))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 9223372036854775807))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 9223372036854775807))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint8))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint16",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 65535))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 65535))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint16))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 4294967295))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 4294967295))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 18446744073709551615))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 18446744073709551615))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++floatLiteralsTests :: Testing.TestGroup+floatLiteralsTests = Testing.TestGroup {+ Testing.testGroupName = "Float literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigfloat",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14159))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14159))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeBigfloat))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.71828))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.71828))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.41421))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.41421))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++literalsInComplexContextsTests :: Testing.TestGroup+literalsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Literals in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "literals in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermPair (Core.TermLiteral (Core.LiteralString "test"), (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14))))))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralBoolean True), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralString "test"), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14))))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "literals in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++primitivesTests :: Testing.TestGroup+primitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ nullaryPrimitivesTests,+ unaryPrimitivesTests,+ binaryPrimitivesTests,+ ternaryPrimitivesTests,+ monomorphicVsPolymorphicTests,+ higherOrderPrimitivesTests,+ primitivesInComplexContextsTests],+ Testing.testGroupCases = []}++nullaryPrimitivesTests :: Testing.TestGroup+nullaryPrimitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Nullary primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unaryPrimitivesTests :: Testing.TestGroup+unaryPrimitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Unary primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists head",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "math neg",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "logic not",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++binaryPrimitivesTests :: Testing.TestGroup+binaryPrimitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Binary primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "math add",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists cons",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "maps insert",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++ternaryPrimitivesTests :: Testing.TestGroup+ternaryPrimitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Ternary primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "logic ifElse",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists foldl",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t1"))),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++monomorphicVsPolymorphicTests :: Testing.TestGroup+monomorphicVsPolymorphicTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic vs polymorphic",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic math",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic identity",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.identity"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.identity"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++higherOrderPrimitivesTests :: Testing.TestGroup+higherOrderPrimitivesTests = Testing.TestGroup {+ Testing.testGroupName = "Higher-order primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists map function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists filter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optionals maybe",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t1"))),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++primitivesInComplexContextsTests :: Testing.TestGroup+primitivesInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Primitives in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "primitive composition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "increment"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "increment"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "double"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "increment"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "double"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "increment"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested higher-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++variablesTests :: Testing.TestGroup+variablesTests = Testing.TestGroup {+ Testing.testGroupName = "Variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleVariableLookupTests,+ variableScopingTests,+ polymorphicVariablesTests,+ variablesInComplexContextsTests,+ recursiveVariablesTests],+ Testing.testGroupCases = []}++simpleVariableLookupTests :: Testing.TestGroup+simpleVariableLookupTests = Testing.TestGroup {+ Testing.testGroupName = "Simple variable lookup",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y")))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++variableScopingTests :: Testing.TestGroup+variableScopingTests = Testing.TestGroup {+ Testing.testGroupName = "Variable scoping",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let binding scope",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable shadowing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested scoping",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermPair (Core.TermVariable (Core.Name "y"), (Core.TermVariable (Core.Name "z"))))))})))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermVariable (Core.Name "y"), (Core.TermVariable (Core.Name "z")))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))})))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicVariablesTests :: Testing.TestGroup+polymorphicVariablesTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "id"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "test"))}))))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "test"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "higher order polymorphic",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "apply"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "apply"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t2",+ (Core.Name "t3")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "apply")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++variablesInComplexContextsTests :: Testing.TestGroup+variablesInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Variables in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeVariable TestTypes.testTypePersonName)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "x"))])}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "x"))])})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "key"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "value"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "key"), (Core.TermVariable (Core.Name "value")))]))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "key"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "value"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "key"), (Core.TermVariable (Core.Name "value")))]))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "x"))))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recursiveVariablesTests :: Testing.TestGroup+recursiveVariablesTests = Testing.TestGroup {+ Testing.testGroupName = "Recursive variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple recursion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mutual recursion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/Checking/NominalTypes.hs view
@@ -0,0 +1,6294 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Nominal type checking test cases: records, unions, field access, injection, projection++module Hydra.Test.Checking.NominalTypes where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Nominal types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ recordsTests,+ unionsTests,+ wrappedTermsTests,+ eliminationsTests],+ Testing.testGroupCases = []}++recordsTests :: Testing.TestGroup+recordsTests = Testing.TestGroup {+ Testing.testGroupName = "Records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicRecordsTests,+ polymorphicRecordsTests,+ recordsInComplexContextsTests,+ multiParameterPolymorphicRecordsTests],+ Testing.testGroupCases = []}++monomorphicRecordsTests :: Testing.TestGroup+monomorphicRecordsTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latlon record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-155.6659))))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-155.6659))))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable (Core.Name "LatLon"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latlon with variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "LatLon"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable (Core.Name "Person"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Unit"),+ Core.recordFields = []})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Unit"),+ Core.recordFields = []})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable (Core.Name "Unit"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person with variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "age"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "age"))}]}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "name"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "age"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "name"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "age"))}]}))})))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "Person"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicRecordsTests :: Testing.TestGroup+polymorphicRecordsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latlon poly float",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-155.6659))))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 19.5429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-155.6659))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latlon poly int64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 195429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1556659))))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 195429)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1556659))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latlon poly variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "buddylist string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "first"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListB")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "buddylist variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListB")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordsInComplexContextsTests :: Testing.TestGroup+recordsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Records in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "records in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}), (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.0)))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}), (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.0)))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "Person"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "LatLon"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "Person")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "LatLon"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "poly records in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}]}), (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListB")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})))),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "recursive record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "IntList"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "IntList"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "IntList"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "IntList"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "IntList"))}))}]}))))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable (Core.Name "IntList"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicRecordsTests :: Testing.TestGroup+multiParameterPolymorphicRecordsTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "triple with three monomorphic types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Triple"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Triple"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "Triple")),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "triple with PersonOrSomething containing map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Triple"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "prefix"))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermVariable (Core.Name "v")))]))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}]}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Triple"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "prefix"))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "k"), (Core.TermVariable (Core.Name "v")))]))}})),+ Core.typeApplicationTermType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "PersonOrSomething")),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "Triple")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "PersonOrSomething")),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordEliminationsTests :: Testing.TestGroup+recordEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Record eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleRecordProjectionsTests,+ recordProjectionsAppliedToRecordsTests,+ polymorphicRecordProjectionsTests,+ polymorphicRecordProjectionsAppliedTests,+ recordProjectionsWithVariablesTests,+ recordProjectionsInComplexContextsTests,+ multiParameterPolymorphicProjectionsTests,+ higherOrderRecordProjectionsTests,+ recursiveRecordProjectionsTests,+ recordProjectionsWithMutualRecursionTests,+ projectionsWithVariablesTests],+ Testing.testGroupCases = []}++simpleRecordProjectionsTests :: Testing.TestGroup+simpleRecordProjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Simple record projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project firstName from Person",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lastName from Person",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project age from Person",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lat from LatLon",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lat")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lat")})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "LatLon")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lon from LatLon",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lon")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lon")})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "LatLon")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordProjectionsAppliedToRecordsTests :: Testing.TestGroup+recordProjectionsAppliedToRecordsTests = Testing.TestGroup {+ Testing.testGroupName = "Record projections applied to records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project firstName applied to person record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project age applied to person record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lat applied to LatLon record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 40.7128)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-74.006))))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLon"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 40.7128)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-74.006))))}]}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicRecordProjectionsTests :: Testing.TestGroup+polymorphicRecordProjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic record projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lat from polymorphic LatLonPoly",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lon from polymorphic LatLonPoly",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lon")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lon")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project head from BuddyListA",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project tail from BuddyListA",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListA")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListB")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicRecordProjectionsAppliedTests :: Testing.TestGroup+polymorphicRecordProjectionsAppliedTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic record projections applied",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lat from LatLonPoly with int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project lon from LatLonPoly with float64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lon")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 40.7128)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-74.006))))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lon")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "LatLonPoly"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 40.7128)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-74.006))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project head from BuddyListA with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "BuddyListA"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "BuddyListB")),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordProjectionsWithVariablesTests :: Testing.TestGroup+recordProjectionsWithVariablesTests = Testing.TestGroup {+ Testing.testGroupName = "Record projections with variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project from lambda parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "Person"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project from polymorphic lambda parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple projections from same record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "Person"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordProjectionsInComplexContextsTests :: Testing.TestGroup+recordProjectionsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Record projections in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "person"),+ Core.bindingTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Charlie"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Brown"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 35)))}]})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "getName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "getName")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "person"),+ Core.bindingTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Charlie"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Brown"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 35)))}]})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "Person")),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "getName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "getName")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))), (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))), (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))),+ (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")}))))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))),+ (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")}))))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicProjectionsTests :: Testing.TestGroup+multiParameterPolymorphicProjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project first from Triple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project second from Triple applied",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project from Triple and use second field, which is another polymorphic record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triple"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "key"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe Nothing)})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "key"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))})))}]})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triple"))}))}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triple"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t1")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t2"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "key"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = (Just (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t1")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t2"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "key"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t1")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t2"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t1")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t2"))}))}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triple"))}))}))})))})))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t3"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t1")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t2"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t2")))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++higherOrderRecordProjectionsTests :: Testing.TestGroup+higherOrderRecordProjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Higher-order record projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map projection over list of records",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map polymorphic projection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")}))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 34)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-118))))}]}))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 34)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-118))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter using projection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 35)))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 35)))}]}),+ (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeVariable TestTypes.testTypePersonName))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recursiveRecordProjectionsTests :: Testing.TestGroup+recursiveRecordProjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Recursive record projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested projection from recursive record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "intList"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeIntListName,+ Core.projectionField = (Core.Name "head")}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeIntListName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "intList"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "intList"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeIntListName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypeIntListName)})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeIntListName,+ Core.projectionField = (Core.Name "head")}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeIntListName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "intList"))}))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeIntListName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recordProjectionsWithMutualRecursionTests :: Testing.TestGroup+recordProjectionsWithMutualRecursionTests = Testing.TestGroup {+ Testing.testGroupName = "Record projections with mutual recursion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project head from BuddyListA",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "head")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project tail from BuddyListB",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListBName,+ Core.projectionField = (Core.Name "tail")})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListBName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "chained projections across mutual recursion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listA"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listB"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListBName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listB"))}))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listA"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listA"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.typeApplicationTermType = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listB"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.typeApplicationTermType = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListBName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listB"))}))}))})))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeBuddyListAName,+ Core.projectionField = (Core.Name "tail")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listA"))}))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionsTests :: Testing.TestGroup+unionsTests = Testing.TestGroup {+ Testing.testGroupName = "Unions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleUnionInjectionsTests,+ unionInjectionsWithDataTests,+ polymorphicUnionInjectionsTests,+ polymorphicRecursiveUnionInjectionsTests,+ polymorphicUnionsFromLambdaTests,+ unionsInComplexContextsTests,+ multiParameterPolymorphicInjectionsTests],+ Testing.testGroupCases = []}++simpleUnionInjectionsTests :: Testing.TestGroup+simpleUnionInjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Simple union injections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Comparison lessThan variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeComparisonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Comparison equalTo variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeComparisonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Comparison greaterThan variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeComparisonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionInjectionsWithDataTests :: Testing.TestGroup+unionInjectionsWithDataTests = Testing.TestGroup {+ Testing.testGroupName = "Union injections with data",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Number int variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeNumberName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Number float variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeNumberName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Timestamp unixTimeMillis variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeTimestampName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unixTimeMillis"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1609459200000)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeTimestampName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unixTimeMillis"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1609459200000)))}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeTimestampName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject into Timestamp date variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeTimestampName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "date"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "2021-01-01"))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeTimestampName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "date"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "2021-01-01"))}})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeTimestampName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicUnionInjectionsTests :: Testing.TestGroup+polymorphicUnionInjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic union injections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject person into PersonOrSomething",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject string into PersonOrSomething other variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "something else"))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "something else"))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject int into PersonOrSomething other variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicRecursiveUnionInjectionsTests :: Testing.TestGroup+polymorphicRecursiveUnionInjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic recursive union injections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject boolean into UnionPolymorphicRecursive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject string value into UnionPolymorphicRecursive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inject int value into UnionPolymorphicRecursive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicUnionsFromLambdaTests :: Testing.TestGroup+polymorphicUnionsFromLambdaTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic unions from lambda",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda creating PersonOrSomething other variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda creating UnionPolymorphicRecursive value variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionsInComplexContextsTests :: Testing.TestGroup+unionsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Unions in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}), (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypeNumberName)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable TestTypes.testTypeNumberName),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}),+ (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5)))}}))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}),+ (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5)))}}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeVariable TestTypes.testTypeNumberName))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic union in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "value"),+ Core.bindingTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "value"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "value"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "value"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicInjectionsTests :: Testing.TestGroup+multiParameterPolymorphicInjectionsTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic injections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either left with int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either right with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "hello"))}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "hello"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either containing LatLonPoly in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]})])}})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 40)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-74))))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})])}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeList (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "either in triple in map with shared type variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x0"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x0"))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x0"))}}))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x1"))}}))}]})))]))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t4"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t5"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x0"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x1"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x0"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x0"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t4"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x1"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t5"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))}]})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))}))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t5"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})))]))})))})))})))}))}))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t3"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t4"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t5"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))}))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t5"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionEliminationsTests :: Testing.TestGroup+unionEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Union eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simpleUnitVariantEliminationsTests,+ unionEliminationsWithDataTests,+ polymorphicUnionEliminationsTests,+ unionEliminationsWithDefaultsTests,+ nestedUnionEliminationsTests,+ unionEliminationsInComplexContextsTests,+ multiParameterPolymorphicCaseStatementsTests,+ higherOrderUnionEliminationsTests,+ recursiveUnionEliminationsTests],+ Testing.testGroupCases = []}++simpleUnitVariantEliminationsTests :: Testing.TestGroup+simpleUnitVariantEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Simple unit inject eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Comparison with all cases",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Comparison returning int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match applied to Comparison variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionEliminationsWithDataTests :: Testing.TestGroup+unionEliminationsWithDataTests = Testing.TestGroup {+ Testing.testGroupName = "Union eliminations with data",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Number extracting int values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "i"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "i"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeNumberName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Number converting to string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeNumberName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Number applied to int variant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Timestamp with mixed data types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeTimestampName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "unixTimeMillis"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "millis"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint64"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "millis"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "date"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dateStr"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "dateStr"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeTimestampName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "unixTimeMillis"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "millis"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint64"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "millis"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "date"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dateStr"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "dateStr"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeTimestampName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicUnionEliminationsTests :: Testing.TestGroup+polymorphicUnionEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic union eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ simplePolymorphicUnionTests,+ usingUnionPolymorphicRecursiveTests,+ usingKernelTypesTests],+ Testing.testGroupCases = []}++simplePolymorphicUnionTests :: Testing.TestGroup+simplePolymorphicUnionTests = Testing.TestGroup {+ Testing.testGroupName = "Simple polymorphic unions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match PersonOrSomething with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match PersonOrSomething instantiated with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "test"))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++usingUnionPolymorphicRecursiveTests :: Testing.TestGroup+usingUnionPolymorphicRecursiveTests = Testing.TestGroup {+ Testing.testGroupName = "using UnionPolymorphicRecursive",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-applied UnionPolymorphicRecursive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied UnionPolymorphicRecursive with int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied UnionPolymorphicRecursive with int32 in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied generic UnionPolymorphicRecursive in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "test")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++usingKernelTypesTests :: Testing.TestGroup+usingKernelTypesTests = Testing.TestGroup {+ Testing.testGroupName = "Using kernel types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case statement on CoderDirection applied to argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dir"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coder"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "encode")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "decode")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "dir"))}))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dir"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "hydra.coders.CoderDirection"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coder"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "encode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "decode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "dir"))}))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.coders.CoderDirection")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Flow")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionEliminationsWithDefaultsTests :: Testing.TestGroup+unionEliminationsWithDefaultsTests = Testing.TestGroup {+ Testing.testGroupName = "Union eliminations with defaults",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Comparison with default case",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "unknown"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "unknown"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match Number with default case",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "i"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "i"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeNumberName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match UnionMonomorphic with default",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "fallback"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "fallback"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedUnionEliminationsTests :: Testing.TestGroup+nestedUnionEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested union eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested match statements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeNumberName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypeNumberName)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePersonOrSomethingName),+ Core.applicationTypeArgument = (Core.TypeVariable TestTypes.testTypeNumberName)})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})))}]}))), (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})))}]}))), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unionEliminationsInComplexContextsTests :: Testing.TestGroup+unionEliminationsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Union eliminations in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "matcher"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "matcher"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "matcher"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "matcher"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))}}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))}))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match with polymorphic result in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}}))}),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypePersonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "age")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicCaseStatementsTests :: Testing.TestGroup+multiParameterPolymorphicCaseStatementsTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic case statements",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case Either converting both to string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case Either applied to injection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case Either with Triple and nested projections",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triple"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))}]})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triple"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t4"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triple"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t4"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triple"))}))}))})))}))}))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t2"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t3"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t4"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationTypeArgument = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t4"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case Either with polymorphic let bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "makeLeft"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "makeRight"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "y"))}}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "makeRight")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "makeLeft")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))}))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "makeLeft"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "makeRight"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeEitherName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "y"))}})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "flag"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeEitherName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "left"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "makeRight")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "right"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "makeLeft")),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "flag"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeEitherName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++higherOrderUnionEliminationsTests :: Testing.TestGroup+higherOrderUnionEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Higher-order union eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map match over list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]}))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}),+ (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypeComparisonName)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]}))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}),+ (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeComparisonName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))])})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "compose match with other functions",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "comp"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "comp"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "comp"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeComparisonName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeComparisonName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "less"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "equal"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "greater"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "comp"))}))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeComparisonName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match in lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "unionValue"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "unionValue"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "unionValue"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeNumberName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "unionValue"))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeNumberName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++recursiveUnionEliminationsTests :: Testing.TestGroup+recursiveUnionEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Recursive union eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "match HydraType recursively",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeHydraTypeName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lit"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeHydraLiteralTypeName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lit"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nested"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "list"))})))}]})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeHydraTypeName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "literal"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lit"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeHydraLiteralTypeName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeHydraLiteralTypeName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "boolean"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lit"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "list"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nested"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeHydraTypeName)),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "list"))})))}]})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeHydraTypeName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++wrappedTermsTests :: Testing.TestGroup+wrappedTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Wrapped terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicWrappedTermsTests,+ polymorphicWrappedTermsTests,+ wrappedTermsInComplexContextsTests,+ nestedWrappedTermsTests,+ multipleWrappingLevelsTests,+ multiParameterPolymorphicWrappersTests],+ Testing.testGroupCases = []}++monomorphicWrappedTermsTests :: Testing.TestGroup+monomorphicWrappedTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic wrapped terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string alias",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeStringAliasName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrapped"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrapped"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeStringAliasName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "first"))}), (Core.TermLiteral (Core.LiteralString "second")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "first"))}), (Core.TermLiteral (Core.LiteralString "second")))),+ Core.typeApplicationTermType = (Core.TypeVariable TestTypes.testTypeStringAliasName)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicWrappedTermsTests :: Testing.TestGroup+polymorphicWrappedTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic wrapped terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic wrapper with int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic wrapper with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic wrapper from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++wrappedTermsInComplexContextsTests :: Testing.TestGroup+wrappedTermsInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Wrapped terms in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped in record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypePersonName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "alias"),+ Core.bindingTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "test"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "alias"))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "alias"),+ Core.bindingTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "test"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "alias"))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeVariable TestTypes.testTypeStringAliasName)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "first"))}),+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "second"))}))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "first"))}),+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "second"))}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeVariable TestTypes.testTypeStringAliasName))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++nestedWrappedTermsTests :: Testing.TestGroup+nestedWrappedTermsTests = Testing.TestGroup {+ Testing.testGroupName = "Nested wrapped terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})])})),+ Core.typeApplicationTermType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])})),+ Core.typeApplicationTermType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])])})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "key"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))])])})),+ Core.typeApplicationTermType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multipleWrappingLevelsTests :: Testing.TestGroup+multipleWrappingLevelsTests = Testing.TestGroup {+ Testing.testGroupName = "Multiple wrapping levels",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wrapped in optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermMaybe (Just (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrapped"))})))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermMaybe (Just (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "wrapped"))})))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeMaybe (Core.TypeVariable TestTypes.testTypeStringAliasName))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of wrapped polymorphic",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermList [+ Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])}),+ (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])}))]),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermList [+ Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}),+ (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))]),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicWrappersTests :: Testing.TestGroup+multiParameterPolymorphicWrappersTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic wrappers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "symmetric triple wrapping simple types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "edge"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}]}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "edge"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "symmetric triple from lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "v1"))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "e"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "v2"))}]}))}))})))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "v1"))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "e"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "v2"))}]})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})))})))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))}))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "symmetric triple with nested polymorphic types and foldl",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sumList"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lst"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "acc"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "acc"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lst"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nums1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nums2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sumList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "nums1"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermList [+ Core.TermVariable (Core.Name "nums1"),+ (Core.TermVariable (Core.Name "nums2"))])},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sumList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "nums2"))}))}]}))}))})))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sumList"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lst"),+ Core.lambdaDomain = (Just (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "acc"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "acc"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lst"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nums1"),+ Core.lambdaDomain = (Just (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "nums2"),+ Core.lambdaDomain = (Just (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeSymmetricTripleName,+ Core.wrappedTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sumList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "nums1"))}))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermList [+ Core.TermVariable (Core.Name "nums1"),+ (Core.TermVariable (Core.Name "nums2"))])},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sumList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "nums2"))}))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))}))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++wrapEliminationsTests :: Testing.TestGroup+wrapEliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Wrap eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ monomorphicUnwrappingTests,+ polymorphicUnwrappingTests,+ unwrapEliminationsInApplicationsTests,+ unwrapInComplexContextsTests,+ multiParameterPolymorphicUnwrappersTests,+ chainedUnwrappingTests,+ multipleUnwrapOperationsTests],+ Testing.testGroupCases = []}++monomorphicUnwrappingTests :: Testing.TestGroup+monomorphicUnwrappingTests = Testing.TestGroup {+ Testing.testGroupName = "Monomorphic unwrapping",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap string alias",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++polymorphicUnwrappingTests :: Testing.TestGroup+polymorphicUnwrappingTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphic unwrapping",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap polymorphic wrapper",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unwrapEliminationsInApplicationsTests :: Testing.TestGroup+unwrapEliminationsInApplicationsTests = Testing.TestGroup {+ Testing.testGroupName = "Unwrap eliminations in applications",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap applied to wrapped term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap polymorphic applied",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypePolymorphicWrapperName,+ Core.wrappedTermBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++unwrapInComplexContextsTests :: Testing.TestGroup+unwrapInComplexContextsTests = Testing.TestGroup {+ Testing.testGroupName = "Unwrap in complex contexts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "unwrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapped"),+ Core.bindingTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "test"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "unwrapper")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "unwrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapped"),+ Core.bindingTerm = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "test"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "unwrapper")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap in tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName)), (Core.TermLiteral (Core.LiteralString "context")))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName)), (Core.TermLiteral (Core.LiteralString "context")))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrapped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrapped"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeStringAliasName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multiParameterPolymorphicUnwrappersTests :: Testing.TestGroup+multiParameterPolymorphicUnwrappersTests = Testing.TestGroup {+ Testing.testGroupName = "Multi-parameter polymorphic unwrappers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap symmetric triple to tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "third")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "third")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap and collect edges in set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getEdge"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triples"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "getEdge"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triples"))}))})))})),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getEdge"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t3"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t2"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t3"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t2",+ (Core.Name "t3")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t2"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t3"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "triples"),+ Core.lambdaDomain = (Just (Core.TypeSet (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "getEdge")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "triples"))}))})))}))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeSet (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeVariable (Core.Name "t1")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap with maybe to handle optional symmetric triple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "mst"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}))))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "mst"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "mst"),+ Core.lambdaDomain = (Just (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.typeApplicationTermType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t1")))})),+ Core.typeApplicationTermType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermMaybe Nothing),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "st"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "second")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeSymmetricTripleName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "st"))}))}))))})))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "mst"))}))})))}))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t1"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeSymmetricTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t1")))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++chainedUnwrappingTests :: Testing.TestGroup+chainedUnwrappingTests = Testing.TestGroup {+ Testing.testGroupName = "Chained unwrapping",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap then process",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrapped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " suffix"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrapped"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeStringAliasName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrapped"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " suffix"))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap polymorphic then map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedList"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedList"))}))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "wrappedList"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "wrappedList"))}))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++multipleUnwrapOperationsTests :: Testing.TestGroup+multipleUnwrapOperationsTests = Testing.TestGroup {+ Testing.testGroupName = "Multiple unwrap operations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unwrap different types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stringWrapped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listWrapped"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stringWrapped"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listWrapped"))}))))})))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "stringWrapped"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeStringAliasName)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "listWrapped"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stringWrapped"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypePolymorphicWrapperName))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "listWrapped"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))})))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypePolymorphicWrapperName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++eliminationsTests :: Testing.TestGroup+eliminationsTests = Testing.TestGroup {+ Testing.testGroupName = "Eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ recordEliminationsTests,+ unionEliminationsTests,+ wrapEliminationsTests],+ Testing.testGroupCases = []}++projectionsWithVariablesTests :: Testing.TestGroup+projectionsWithVariablesTests = Testing.TestGroup {+ Testing.testGroupName = "Projections with variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project from lambda parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "Person"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "project from polymorphic lambda parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coords"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeLatLonPolyName,+ Core.projectionField = (Core.Name "lat")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coords"))}))})))})),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t0"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "LatLonPoly")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple projections from same record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeChecking (Testing.TypeCheckingTestCase {+ Testing.typeCheckingTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))))}))),+ Testing.typeCheckingTestCaseOutputTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "Person"))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "lastName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))})))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))}))),+ Testing.typeCheckingTestCaseOutputType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/EtaExpansion.hs view
@@ -0,0 +1,2255 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for eta expansion of terms++module Hydra.Test.EtaExpansion where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for eta expansion of terms+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "eta expansion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Partial application of primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Bare primitives are not expanded",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "binary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Partially applied primitives expand with lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "binary primitive with one argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ternary primitive with one argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v2"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Fully applied primitives are not expanded",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "FOO"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "FOO"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "binary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a,b,c"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a,b,c"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Record projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Bare projections expand with a lambda",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection without argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Applied projections are not expanded",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection with argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "person"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection applied to a record",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))}]}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "John"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Doe"))}]}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Projections nested in other structures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in a list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))),+ (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))]),+ Testing.etaExpansionTestCaseOutput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})),+ (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in a tuple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))), (Core.TermLiteral (Core.LiteralString "default")))),+ Testing.etaExpansionTestCaseOutput = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})), (Core.TermLiteral (Core.LiteralString "default"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "getter"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "getter"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection in lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Function-valued projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection of function-valued field applied to arguments should not be expanded",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "last"))}]})),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "DATA"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "first")})))),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "middle"))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "last"))}]})),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "DATA"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic terms (System F)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Type lambdas in let bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic identity function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "id"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "id"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic partially applied primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "partial"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "partial"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "partial"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "partial"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic projection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "getter"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "getter"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "Person")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "getter"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Type applications of polymorphic bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic variable with type application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application of identity applied to binary function with no arguments",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application of identity applied to partially applied binary function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))}))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application of identity applied to fully applied binary function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo,bar"))}))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo,bar"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application of identity applied to binary function, then applied to one argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application of identity applied to binary function, then fully applied to two arguments",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo,bar"))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "id")),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo,bar"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "Higher-Order Functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Functions that return functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning bare binary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning bare unary primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning partially applied primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))}))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning fully applied primitive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning bare projection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")}))))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "person"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lambdas with partial application in body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning lambda returning partial application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "Let terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "partial application of a let-bound function",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v2"))}))})))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "in a fold",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "bar"),+ (Core.TermLiteral (Core.LiteralString "baz"))])}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v2"))}))})))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "bar"),+ (Core.TermLiteral (Core.LiteralString "baz"))])}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "within another let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tryme"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = Core.TermUnit})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "tryme"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "arg3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "arg1"),+ (Core.TermVariable (Core.Name "arg2")),+ (Core.TermVariable (Core.Name "arg3"))])}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v2"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = Core.TermUnit}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "Case statements",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "monomorphic at top level",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-applied case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied case statement in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "monomorphic in let binding",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-applied case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied case statement in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermVariable (Core.Name "s"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "ignored"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "polymorphic in let binding",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-applied UnionPolymorphicRecursive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied UnionPolymorphicRecursive with int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied UnionPolymorphicRecursive with int32 in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "i"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "i"))}))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "test"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied generic UnionPolymorphicRecursive in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "test")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "test"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "other"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))}]})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "test")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Forced expansion in case statement branches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable reference in case branch is expanded",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "boolean value"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "handler"))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "unit value"))})))}]}))))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "boolean value"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "handler")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "unit value"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare primitive in case branch is expanded",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "boolean value"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "unit value"))})))}]})))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "boolean value"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ignored"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "unit value"))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable reference outside case branch is not expanded",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "handler"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "handler"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare primitive outside case branch is not expanded",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "Non-expansion of eliminations which produce functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dir"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "hydra.coders.CoderDirection"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coder"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "encode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "decode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "dir"))}))})))})))}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "dir"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "hydra.coders.CoderDirection"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "coder"),+ Core.lambdaDomain = (Just (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable (Core.Name "hydra.compute.Coder")),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t1"))}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.coders.CoderDirection"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "encode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "encode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "decode"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = (Just Core.TypeUnit),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v12"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.compute.Coder"),+ Core.projectionField = (Core.Name "decode")})))),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "coder"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v12"))}))})))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "dir"))}))})))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "applied projection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "third")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))}]}))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypeTripleName,+ Core.projectionField = (Core.Name "third")})))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeApplicationTermType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeTripleName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "first"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "second"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))},+ Core.Field {+ Core.fieldName = (Core.Name "third"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))}]}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Formatting.hs view
@@ -0,0 +1,175 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for string formatting and case conversion++module Hydra.Test.Formatting where++import qualified Hydra.Testing as Testing+import qualified Hydra.Util as Util+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.formatting+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "formatting",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ caseConversionTests],+ Testing.testGroupCases = []}++-- | Test cases for case conversion+caseConversionTests :: Testing.TestGroup+caseConversionTests = Testing.TestGroup {+ Testing.testGroupName = "case conversion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1 (lower_snake_case -> UPPER_SNAKE_CASE)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",+ Testing.caseConversionTestCaseToString = "A_HELLO_WORLD_42_A42_42A_B"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2 (lower_snake_case -> camelCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",+ Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3 (lower_snake_case -> PascalCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",+ Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4 (lower_snake_case -> lower_snake_case)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",+ Testing.caseConversionTestCaseToString = "a_hello_world_42_a42_42a_b"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5 (UPPER_SNAKE_CASE -> lower_snake_case)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",+ Testing.caseConversionTestCaseToString = "a_hello_world_42_a42_42a_b"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6 (UPPER_SNAKE_CASE -> camelCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",+ Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#7 (UPPER_SNAKE_CASE -> PascalCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",+ Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#8 (UPPER_SNAKE_CASE -> UPPER_SNAKE_CASE)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",+ Testing.caseConversionTestCaseToString = "A_HELLO_WORLD_42_A42_42A_B"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#9 (camelCase -> lower_snake_case)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "a_hello_world42_a4242a_b"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#10 (camelCase -> UPPER_SNAKE_CASE)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "A_HELLO_WORLD42_A4242A_B"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#11 (camelCase -> PascalCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#12 (camelCase -> camelCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#13 (PascalCase -> lower_snake_case)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionLowerSnake,+ Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "a_hello_world42_a4242a_b"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#14 (PascalCase -> UPPER_SNAKE_CASE)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionUpperSnake,+ Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "A_HELLO_WORLD42_A4242A_B"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#15 (PascalCase -> camelCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionCamel,+ Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#16 (PascalCase -> PascalCase)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {+ Testing.caseConversionTestCaseFromConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseToConvention = Util.CaseConventionPascal,+ Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",+ Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/Hoisting.hs view
@@ -0,0 +1,5843 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hoisting transformations++module Hydra.Test.Hoisting where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hoisting transformations+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hoisting",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "hoistSubterms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistNothing: simple let unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateNothing,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistNothing: let with list in body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateNothing,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistNothing: let with application in body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateNothing,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "g")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "g")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: list in body is hoisted into local let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: multiple lists in body are hoisted together",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_2"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_2"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: list in binding value is hoisted into local let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_x_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_x_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: nested lists hoisted from inside out",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_2"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist__body_1"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_2"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistApplications: application in list element is hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateApplications,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}),+ (Core.TermVariable (Core.Name "y"))])})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist__body_1"),+ (Core.TermVariable (Core.Name "y"))])}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistApplications: application in record field is hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateApplications,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Data"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}]}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Data"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "_hoist__body_1"))}]}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistApplications: nested applications hoisted from inside out",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateApplications,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})])})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_2"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist__body_2")])}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistCaseStatements: case in application argument is hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateCaseStatements,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistCaseStatements: case in list element is hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateCaseStatements,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))])})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist__body_1")])}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: nested let - inner let processed independently",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])}))}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: non-let term is unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistApplications: bare application unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateApplications,+ Testing.hoistSubtermsTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: term referring to let-bound variable needs no capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: term referring to lambda above let needs no capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "y"),+ (Core.TermVariable (Core.Name "x"))])}))}))}))),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "y"),+ (Core.TermVariable (Core.Name "x"))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: lambda-bound var not free in hoisted term needs no capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])}))})))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: lambda-bound var free in hoisted term requires capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])}))})))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist__body_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: only free lambda-bound vars are captured",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "b"))])}))})))})))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "b"))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist__body_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))})))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: stable naming for binding and body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_x_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_x_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: stable naming for multiple bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_x_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_x_1"))}))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_y_1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_y_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "hoistLists: polymorphic binding with self-reference below hoisted term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistSubterms (Testing.HoistSubtermsTestCase {+ Testing.hoistSubtermsTestCasePredicate = Testing.HoistPredicateLists,+ Testing.hoistSubtermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.hoistSubtermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "hoistCaseStatements",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case at top level of let body is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in let binding value is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside lambda body is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))}))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside nested lambdas is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "b"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "b"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case as LHS of one application is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case wrapped in annotation is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in lambda with one application is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case as RHS of application IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_f_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in nested application LHS IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside list element IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist_f_1")])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside lambda inside list IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list inside lambda is NOT hoisted (only case statements)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in binding is not hoisted, case in arg position is hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "w"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "w"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in nested let body is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "z"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "w"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "z"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "w"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in let inside lambda is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in lambda inside let body is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case with let+lambda+app is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in triple application LHS IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "c"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "c"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "c"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))})))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "c"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})))})))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case as second argument IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_f_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in both arguments - both hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_f_1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_f_2"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in second list element IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermVariable (Core.Name "_hoist_f_1"))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple cases in list - all hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermList [+ Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))),+ (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]}))))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "_hoist_f_1"),+ (Core.TermVariable (Core.Name "_hoist_f_2"))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in pair first element IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermPair (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "_hoist_f_1"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in pair second element IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermVariable (Core.Name "_hoist_f_1"))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in child let binding hoisted into child",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_inner_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_inner_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in child let body hoisted into child",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist__body_1"))}))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case at top level of child let NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cases in both outer and child - each hoisted locally",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.applicationArgument = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_outer_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_outer_1"))})),+ Core.applicationArgument = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inner"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_inner_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "b"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "_hoist_inner_1"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "inner"))}))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda after app LHS takes us out of top level",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside case branch is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case inside case default branch is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "y"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in arg position inside case branch IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "a"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = (Just (Core.TermVariable (Core.Name "x"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]}))))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in let body inside applied case default IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "a"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist__body_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))}))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case in let body inside applied case branch IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist__body_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist__body_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))}))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case application at top level of binding is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case application in arg position IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case application inside immediately-applied lambda IS hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "_hoist_f_1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "_hoist_f_1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "case application in lambda body is NOT hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistCaseStatements (Testing.HoistCaseStatementsTestCase {+ Testing.hoistCaseStatementsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.hoistCaseStatementsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Optional"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "hoistLetBindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested let inside lambda: binding hoisted with lambda capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistLetBindings (Testing.HoistLetBindingsTestCase {+ Testing.hoistLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))},+ Testing.hoistLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type application: nested let outside lambda CAN be hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistLetBindings (Testing.HoistLetBindingsTestCase {+ Testing.hoistLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))},+ Testing.hoistLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f_y"))}))}))),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f_y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "hoistPolymorphicLetBindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no polymorphic bindings: simple let unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no polymorphic bindings: multiple monomorphic bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hi")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hi")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single polymorphic binding: already at top level",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding inside lambda: no capture",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_id"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding captures lambda variable: wrapped in lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding captures multiple lambda variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "triple")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "c"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "c")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "c"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "c"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "triple")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "c"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "c")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "c"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding captures some but not all lambda variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "c"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "c")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "c"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "c"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "c"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "c")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "c"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding captures both lambda-bound and let-bound variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sibling polymorphic bindings inside lambda: one calls the other",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "h"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_h")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_h"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sibling polymorphic bindings inside lambda: h passes its own args to g",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "h"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_h")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))}))})))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_h"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "untyped binding: not hoisted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no name collision: distinct names after unshadowing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_id2")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_id2"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested polymorphic binding calls enclosing polymorphic binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inner"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "h"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inner"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_h"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding captures monomorphic sibling in same let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "left"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "right"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sleft"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "left"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "sright"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "right"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "cannotUnify"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sright"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cannotUnify")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "left"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "right"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sleft"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "left"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "sright"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "right"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_cannotUnify")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sright"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_cannotUnify"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "sleft"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "sright"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sright"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lets: poly binding references poly sibling from outer let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "left"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sleft"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "left")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "cannotUnify"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "joinList"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cannotUnify")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "joinList")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "left"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sleft"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "left")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_joinList")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_cannotUnify"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "sleft"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "wrapper_joinList"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "sleft"),+ Core.lambdaDomain = (Just (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper_cannotUnify")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "sleft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "wrapper")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding with pair: type applications preserved",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "init"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeApplicationTermType = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "init"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "name_x"))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_init")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_init"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = (Just (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermPair (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermList []),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "t0"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})))),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeApplicationTermType = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeSet (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)})))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "name_x"))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic binding captures type vars: replacement includes type applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "q"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "q")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a",+ (Core.Name "b")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermVariable (Core.Name "f_q")),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeApplicationTermType = (Core.TypeVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a",+ (Core.Name "b")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_q"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a",+ (Core.Name "b")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "hoistPolymorphicTypeParameters",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested function types: all type variables must be declared",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "choose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forLeft"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forRight"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forLeft")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "choose"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "f_choose")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_choose"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forLeft"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forRight"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forLeft")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type variable in return position only",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "returnT"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "unit"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = Core.TypeUnit,+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "returnT"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = Core.TypeUnit,+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "f_returnT")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = Core.TypeUnit,+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_returnT"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "unit"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = Core.TypeUnit,+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "type variables in deeply nested generics",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "nested"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))})),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t2"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "nested"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "f_nested")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_nested"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))})),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t2"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple bindings with overlapping type variable names",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "id1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "id2"))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "outer"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer_id1"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "outer_id2"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "outer_id1"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "outer_id2"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "outer"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "captured variable with type parameters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f_g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = (Just (Core.TypeLiteral Core.LiteralTypeString)),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "pair")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "short type variable names are treated as type parameters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "s",+ (Core.Name "t"),+ (Core.Name "v")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "s")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "v"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "g"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "f_g")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "s"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "v"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "s",+ (Core.Name "t"),+ (Core.Name "v")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "s")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "v"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "numbered type variables like t0 t1 t2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "g"))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "f_g")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "f_g"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "undefined"))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "choose pattern from mutateTrace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseHoistPolymorphicLetBindings (Testing.HoistPolymorphicLetBindingsTestCase {+ Testing.hoistPolymorphicLetBindingsTestCaseInput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "mutateTrace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "mutate"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "restore"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "choose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forLeft"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forRight"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forLeft")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "choose")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "forLeft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "forRight"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "mutateTrace"))},+ Testing.hoistPolymorphicLetBindingsTestCaseOutput = Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "mutateTrace"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "mutate"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "restore"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "mutateTrace_choose")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "forLeft"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "forRight"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))})))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Core.typeSchemeConstraints = Nothing}))},+ Core.Binding {+ Core.bindingName = (Core.Name "mutateTrace_choose"),+ Core.bindingTerm = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t0"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t1"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "t2"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forLeft"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forRight"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forLeft")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))})))})))})))}))}))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermVariable (Core.Name "mutateTrace"))}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Inference/AlgebraicTypes.hs view
@@ -0,0 +1,1227 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Inference tests for algebraic data types++module Hydra.Test.Inference.AlgebraicTypes where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Algebraic data type tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Algebraic terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ testGroupForCollectionPrimitives,+ testGroupForEithers,+ testGroupForFolds,+ testGroupForLists,+ testGroupForMaps,+ testGroupForOptionals,+ testGroupForPairs,+ testGroupForSets],+ Testing.testGroupCases = []}++testGroupForCollectionPrimitives :: Testing.TestGroup+testGroupForCollectionPrimitives = Testing.TestGroup {+ Testing.testGroupName = "Collection primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "maps.map applied to a function",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeSet (Core.TypeVariable (Core.Name "t1")))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "sets.map applied to a function",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeSet (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.functionTypeCodomain = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Composing collection primitives in let",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList")))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeSet (Core.TypeVariable (Core.Name "t1")))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList")))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))]))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "g"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Map operations in lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length")))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "m"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "m"))}))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t2")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t2")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Fully applied collection conversions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))])}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))])}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForEithers :: Testing.TestGroup+testGroupForEithers = Testing.TestGroup {+ Testing.testGroupName = "Either terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Left values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error")))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Right values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error"))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic either values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermEither (Left (Core.TermList []))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermEither (Right (Core.TermList []))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested either values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermEither (Left (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))))),+ (Core.TermEither (Left (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "nested")))))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeBoolean)}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermEither (Right (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))),+ (Core.TermEither (Right (Core.TermEither (Right (Core.TermLiteral (Core.LiteralBoolean True)))))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "foo"))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Either in lambda",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Left (Core.TermVariable (Core.Name "x"))))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t0")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermEither (Right (Core.TermVariable (Core.Name "x"))))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "t1")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Either in data structures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "error"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))], (Core.TermList []))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForFolds :: Testing.TestGroup+testGroupForFolds = Testing.TestGroup {+ Testing.testGroupName = "Eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "List eliminations (folds)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Optional eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.pure")))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForLists :: Testing.TestGroup+testGroupForLists = Testing.TestGroup {+ Testing.testGroupName = "List terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "List of strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "bar"))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "List of lists of strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")],+ (Core.TermList [])]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Empty list",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList []),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "List containing an empty list",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermList []]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Lambda producing a polymorphic list",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Lambda producing a list of integers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "List with repeated variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralString "foo")),+ (Core.TermVariable (Core.Name "x"))])}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForMaps :: Testing.TestGroup+testGroupForMaps = Testing.TestGroup {+ Testing.testGroupName = "Map terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "firstName"), (Core.TermLiteral (Core.LiteralString "Arthur"))),+ (Core.TermLiteral (Core.LiteralString "lastName"), (Core.TermLiteral (Core.LiteralString "Dent")))])),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMap M.empty),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMap (M.fromList [+ (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.1)))),+ (Core.TermVariable (Core.Name "y"), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.2))))]))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}++testGroupForOptionals :: Testing.TestGroup+testGroupForOptionals = Testing.TestGroup {+ Testing.testGroupName = "Optional terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMaybe Nothing),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0"))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}++testGroupForPairs :: Testing.TestGroup+testGroupForPairs = Testing.TestGroup {+ Testing.testGroupName = "Pair terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Monotyped pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "foo"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "foo"), (Core.TermList [+ Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0)),+ (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 137.0)))]))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polytyped pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermLiteral (Core.LiteralString "foo")))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermList []))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested pairs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "nested"))), (Core.TermLiteral (Core.LiteralBoolean True)))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "foo"), (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermList [+ Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0))]))))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Pairs in lambda",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralString "constant"))))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "p"), (Core.TermVariable (Core.Name "p"))))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Pairs in data structures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralString "b"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermPair (Core.TermList [], (Core.TermLiteral (Core.LiteralString "foo")))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Additional cases",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "foo")))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermLiteral (Core.LiteralString "foo")))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermPair (Core.TermList [], (Core.TermList []))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeVariable (Core.Name "t1")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForSets :: Testing.TestGroup+testGroupForSets = Testing.TestGroup {+ Testing.testGroupName = "Set terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralBoolean True)])),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeBoolean)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermSet S.empty])),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeSet (Core.TypeSet (Core.TypeVariable (Core.Name "t0")))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}
+ src/gen-test/haskell/Hydra/Test/Inference/AlgorithmW.hs view
@@ -0,0 +1,437 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Algorithm W inference tests++module Hydra.Test.Inference.AlgorithmW where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Algorithm W test cases+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Algorithm W test cases",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ testGroupForSystemF],+ Testing.testGroupCases = []}++testGroupForSystemF :: Testing.TestGroup+testGroupForSystemF = Testing.TestGroup {+ Testing.testGroupName = "STLC to System F",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sng"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "sng"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sng"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "alice"))}))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#7",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "+"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "+")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "+")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#9",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#10",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "xx"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "yy"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "xx"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#11",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "u"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2"),+ (Core.Name "t3")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#12",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "u"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#13",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "u"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}
+ src/gen-test/haskell/Hydra/Test/Inference/All.hs view
@@ -0,0 +1,33 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Hydra's inference test suite++module Hydra.Test.Inference.All where++import qualified Hydra.Test.Inference.AlgebraicTypes as AlgebraicTypes+import qualified Hydra.Test.Inference.AlgorithmW as AlgorithmW+import qualified Hydra.Test.Inference.Failures as Failures+import qualified Hydra.Test.Inference.Fundamentals as Fundamentals+import qualified Hydra.Test.Inference.KernelExamples as KernelExamples+import qualified Hydra.Test.Inference.NominalTypes as NominalTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | The group of all inference tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "inference",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ AlgebraicTypes.allTests,+ AlgorithmW.allTests,+ Failures.allTests,+ Fundamentals.allTests,+ KernelExamples.allTests,+ NominalTypes.allTests],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Inference/Failures.hs view
@@ -0,0 +1,2182 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Inference tests for expected failures++module Hydra.Test.Inference.Failures where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Expected failure tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Expected failures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ undefinedVariableTests,+ unificationFailureTests,+ invalidApplicationTests,+ selfApplicationTests,+ arityMismatchTests,+ recursiveTypeTests,+ occurCheckTests,+ typeConstructorMisuseTests,+ polymorphismViolationTests,+ letBindingMismatchTests,+ constraintSolverEdgeCaseTests,+ primitiveTypeErrorTests,+ complexConstraintFailureTests],+ Testing.testGroupCases = []}++undefinedVariableTests :: Testing.TestGroup+undefinedVariableTests = Testing.TestGroup {+ Testing.testGroupName = "Undefined variable",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Basic unbound variables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermVariable (Core.Name "x"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Unbound in let expressions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "y")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "y")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "z")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Shadowing scope errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++unificationFailureTests :: Testing.TestGroup+unificationFailureTests = Testing.TestGroup {+ Testing.testGroupName = "Unification failure",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Basic type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermLiteral (Core.LiteralString "foo"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],+ (Core.TermLiteral (Core.LiteralString "foo"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "foo")))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Collection type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))], (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")]))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Conditional type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic instantiation conflicts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "cons"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cons")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cons")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++invalidApplicationTests :: Testing.TestGroup+invalidApplicationTests = Testing.TestGroup {+ Testing.testGroupName = "Invalid application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Non-function application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermLiteral (Core.LiteralBoolean True)),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Collection application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "foo")))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermList []),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))))))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "index"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Primitive misapplication",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermMaybe Nothing),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "value"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermList []),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++selfApplicationTests :: Testing.TestGroup+selfApplicationTests = Testing.TestGroup {+ Testing.testGroupName = "Self-application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Direct self-application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Indirect self-application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "y")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "b")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "a"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "cycle"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cycle"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cycle")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cycle"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++arityMismatchTests :: Testing.TestGroup+arityMismatchTests = Testing.TestGroup {+ Testing.testGroupName = "Arity mismatch",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Too many arguments",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))])})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Wrong argument types with extra args",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "arg"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++recursiveTypeTests :: Testing.TestGroup+recursiveTypeTests = Testing.TestGroup {+ Testing.testGroupName = "Recursive type construction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Direct recursive types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "x")]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x")))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursive function types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "f"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "f")])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Mutually recursive types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "y")]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "b"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "a")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "a"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "g")]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "f")))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++occurCheckTests :: Testing.TestGroup+occurCheckTests = Testing.TestGroup {+ Testing.testGroupName = "Occur check failures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Function occur checks",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "h"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "h"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "g"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Mutual occur checks",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "b")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "a")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "a"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "cycle1"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cycle2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "cycle1"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "cycle2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "cycle1")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "cycle1"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Complex occur checks",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "omega"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "omega"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "omega"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "loop"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "loop")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "loop"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "loop"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++typeConstructorMisuseTests :: Testing.TestGroup+typeConstructorMisuseTests = Testing.TestGroup {+ Testing.testGroupName = "Type constructor misuse",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "List constructor errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "String constructor errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Math constructor errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++polymorphismViolationTests :: Testing.TestGroup+polymorphismViolationTests = Testing.TestGroup {+ Testing.testGroupName = "Polymorphism violations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Identity function violations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Constrained polymorphism violations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralString "constant"))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "h"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "incompatible"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Higher-order polymorphism violations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))}))])})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "h"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "error"))}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++letBindingMismatchTests :: Testing.TestGroup+letBindingMismatchTests = Testing.TestGroup {+ Testing.testGroupName = "Let binding type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Application type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "result"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "g"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "num"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "num")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "num"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Collection type mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "list1"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "list2"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "list1"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "list2"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "nums"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "mixed"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "nums"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "mixed"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "pair1"),+ Core.bindingTerm = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "foo")))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "pair2"),+ Core.bindingTerm = (Core.TermPair (Core.TermLiteral (Core.LiteralString "bar"), (Core.TermVariable (Core.Name "pair1")))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "pair2"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Function binding mismatches",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "add"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "badCall"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "add")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "badCall"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++constraintSolverEdgeCaseTests :: Testing.TestGroup+constraintSolverEdgeCaseTests = Testing.TestGroup {+ Testing.testGroupName = "Constraint solver edge cases",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Complex constraint propagation",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "complex"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "complex")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Fixed point combinators",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fix"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "fix")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "y")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "rec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "rec"))}))})))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "omega"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "omega")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "omega"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Constraint cycles",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "b")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "c"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "c")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "c"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "a")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "a")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "circular"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "circular"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "circular")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "circular"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++primitiveTypeErrorTests :: Testing.TestGroup+primitiveTypeErrorTests = Testing.TestGroup {+ Testing.testGroupName = "Primitive function type errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Logic primitive errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not boolean"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Collection primitive errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a map"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.fromMaybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not optional"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Math primitive errors",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++complexConstraintFailureTests :: Testing.TestGroup+complexConstraintFailureTests = Testing.TestGroup {+ Testing.testGroupName = "Complex constraint failures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Multi-level constraint conflicts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "h"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "h")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "weird"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "weird")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "y"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "nested"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "int_f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "str_g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "s"),+ (Core.TermLiteral (Core.LiteralString "!"))])}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "nested")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "int_f"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "str_g"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Function composition failures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "triple"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "increment"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "stringify"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "s"),+ (Core.TermLiteral (Core.LiteralString "!"))])}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "triple")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "increment"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "stringify"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {+ Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "compose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "reverse_compose"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bad"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "compose")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "reverse_compose"))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length")))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bad"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Inference/Fundamentals.hs view
@@ -0,0 +1,2637 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Inference tests for fundamental language features++module Hydra.Test.Inference.Fundamentals where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Fundamental language feature tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Fundamentals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ testGroupForLambdas,+ testGroupForLet,+ testGroupForLiterals,+ testGroupForPathologicalTerms,+ testGroupForPolymorphism,+ testGroupForPrimitives],+ Testing.testGroupCases = []}++testGroupForLambdas :: Testing.TestGroup+testGroupForLambdas = Testing.TestGroup {+ Testing.testGroupName = "Lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Simple lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 137)))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))])}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested lambdas with shadowing",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForLet :: Testing.TestGroup+testGroupForLet = Testing.TestGroup {+ Testing.testGroupName = "Let terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Simple",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Empty let",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Trivial let",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "foo"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "foo"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Multiple references to a let-bound term",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "foo"),+ (Core.TermVariable (Core.Name "bar")),+ (Core.TermVariable (Core.Name "foo"))])})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested let",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "foo"),+ (Core.TermVariable (Core.Name "bar"))])}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermPair (Core.TermVariable (Core.Name "foo"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "bar"))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "sng"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "quux"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "foo"), (Core.TermPair (Core.TermVariable (Core.Name "bar"), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "quux")),+ Core.applicationArgument = (Core.TermList [])}))))))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Nested let with shadowing",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "foo"))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "bar"), (Core.TermVariable (Core.Name "foo"))))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Let-polymorphism",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "square"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "square")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))})))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})])}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})])}))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#7",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "list"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "list")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "list")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.pairTypeSecond = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "singleton"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabled"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#9",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "fortytwo"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "fortytwo"), (Core.TermVariable (Core.Name "foo"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#10",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fortytwo"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "fortytwo"), (Core.TermVariable (Core.Name "foo"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursive and mutually recursive let (@wisnesky's test cases)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "y")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "u"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "v0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabled"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "plus"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "plus")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "plus")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "p0"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p0"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "p0"))}))))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "z"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#7",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "w"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "z")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermPair (Core.TermVariable (Core.Name "w"), (Core.TermVariable (Core.Name "z"))))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursive and mutually recursive let with polymorphism",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "f")])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "f")])}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "f")])}))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "f"), (Core.TermVariable (Core.Name "g"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursion involving polymorphic functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermVariable (Core.Name "x")]])})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermVariable (Core.Name "x")]])}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inst"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "rec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b0"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b0"))}))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "inst"), (Core.TermVariable (Core.Name "rec"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inst"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "rec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "inst"), (Core.TermVariable (Core.Name "rec"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "inst1"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "inst2"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "rec"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "inst1"), (Core.TermPair (Core.TermVariable (Core.Name "inst2"), (Core.TermVariable (Core.Name "rec"))))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.pairTypeSecond = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "bar"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "foo"), (Core.TermVariable (Core.Name "bar"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Over-generalization of hoisted let-bindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "r"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "r"))}))}))}))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "g"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))}))}))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "forField"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "rec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "r"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "r"))}), (Core.TermVariable (Core.Name "x"))))}))})))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "main"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "rec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forField")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "rec"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "main"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1"),+ (Core.Name "t2"),+ (Core.Name "t3")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t2")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t3"))}))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t2")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "helper"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "main"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "helper")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermVariable (Core.Name "val"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "main"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "forField"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "rec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "r"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "r"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "r"))}))))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "main"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "rec"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forField")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "rec"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermVariable (Core.Name "val"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "main"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "rcases"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forFields"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "forFields")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "r"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "forFields"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "val"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "rcases")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "forFields"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "val"))}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermVariable (Core.Name "val"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "r"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForLiterals :: Testing.TestGroup+testGroupForLiterals = Testing.TestGroup {+ Testing.testGroupName = "Literals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralString "foo")),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean False)),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 42.0))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}++testGroupForPathologicalTerms :: Testing.TestGroup+testGroupForPathologicalTerms = Testing.TestGroup {+ Testing.testGroupName = "Pathological terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Recursion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "x")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0")),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "weird"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "id"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "id"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "weird"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "paradox"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "paradox")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "paradox"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "g"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Infinite lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "self"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "self"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "self"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "self"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "self"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "self"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "self"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "e"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "self")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "self")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabled"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "build"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "build")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "build")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForPolymorphism :: Testing.TestGroup+testGroupForPolymorphism = Testing.TestGroup {+ Testing.testGroupName = "Polymorphism",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Simple lists and optionals",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList []),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMaybe Nothing),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "t0"))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Lambdas, lists, and products",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "x"))))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x")])}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "y"), (Core.TermVariable (Core.Name "x"))))})))}))]),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t1")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t0"))}))}))}))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Lambdas and application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Primitives and application",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],+ (Core.TermList [])])})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Lambdas and primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Mixed expressions with lambdas, constants, and primitive functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Application terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}++testGroupForPrimitives :: Testing.TestGroup+testGroupForPrimitives = Testing.TestGroup {+ Testing.testGroupName = "Primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Monomorphic primitive functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic primitive functions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "el"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "el")])}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "el"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "el"))])}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lists"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lists"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "list"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "list"),+ (Core.TermList [])])}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#7",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "list"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "list"),+ (Core.TermList [])])}))}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lists"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Inference/KernelExamples.hs view
@@ -0,0 +1,281 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Inference tests for examples from the Hydra kernel++module Hydra.Test.Inference.KernelExamples where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Examples from the Hydra kernel+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Examples from the Hydra kernel",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ testGroupForNestedLet],+ Testing.testGroupCases = []}++testGroupForNestedLet :: Testing.TestGroup+testGroupForNestedLet = Testing.TestGroup {+ Testing.testGroupName = "Nested let",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "hydra.formatting.mapFirstLetter",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "mapping"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "firstLetter"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "mapping")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "list"))}))}))}))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "list"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "firstLetter"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "list"))}))}))}))}))}))})))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursive let with pair return (ifElse)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "input"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "go"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "depth"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "subst"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),+ Core.applicationArgument = (Core.TermPair (Core.TermVariable (Core.Name "subst"), (Core.TermVariable (Core.Name "s"))))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "go")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "depth"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "key"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "val"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "subst"))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "go")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty")))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "input"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "subst"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "result"))})),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "body"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "result"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "subst"), (Core.TermVariable (Core.Name "body"))))}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Recursive let with pair return (case on Type)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "typ"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "go"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "depth"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "subst"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "t"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "hydra.core.Type"),+ Core.caseStatementDefault = (Just (Core.TermPair (Core.TermVariable (Core.Name "subst"), (Core.TermVariable (Core.Name "t"))))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "forall"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "ft"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "go")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "depth"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ForallType"),+ Core.projectionField = (Core.Name "parameter")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "ft"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "_"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "depth"))}))}))}))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "subst"))}))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "hydra.core.ForallType"),+ Core.projectionField = (Core.Name "body")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "ft"))}))}))})))}]})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "t"))}))})))})))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "result"),+ Core.bindingTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "go")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty")))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "typ"))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "result"))}), (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "result"))}))))}))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "hydra.core.Type")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "hydra.core.Name")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "hydra.core.Name"))})),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "hydra.core.Type"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Inference/NominalTypes.hs view
@@ -0,0 +1,697 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Inference tests for nominal types++module Hydra.Test.Inference.NominalTypes where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTerms as TestTerms+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Nominal type tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "Nominal terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ testGroupForCaseStatements,+ testGroupForProjections,+ testGroupForRecords,+ testGroupForVariants,+ testGroupForWrappers],+ Testing.testGroupCases = []}++testGroupForCaseStatements :: Testing.TestGroup+testGroupForCaseStatements = Testing.TestGroup {+ Testing.testGroupName = "Case statements",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeSimpleNumberName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))}]})))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeSimpleNumberName),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean True))})))},+ Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))},+ Core.Field {+ Core.fieldName = (Core.Name "unit"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "_"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))}]})))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}++testGroupForProjections :: Testing.TestGroup+testGroupForProjections = Testing.TestGroup {+ Testing.testGroupName = "Projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Record eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Pair projections",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))})),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "foo"))))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForRecords :: Testing.TestGroup+testGroupForRecords = Testing.TestGroup {+ Testing.testGroupName = "Records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Simple records",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-122.4194))))}]})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeLatLonName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-122.4194))))}]})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "lon"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "lon"))}]}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "latlon"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "latlon"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "latlon"))}]}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeLatLonPolyName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = TestTerms.testDataArthur,+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Record instances of simply recursive record types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeIntListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeIntListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeIntListName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeIntListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeIntListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]}))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeIntListName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeListName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]}))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeListName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeListName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeListName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Record instances of mutually recursive record types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]}))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListAName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeBuddyListBName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "head"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},+ Core.Field {+ Core.fieldName = (Core.Name "tail"),+ Core.fieldTerm = (Core.TermMaybe Nothing)}]}))))}]}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForVariants :: Testing.TestGroup+testGroupForVariants = Testing.TestGroup {+ Testing.testGroupName = "Variant terms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Variants",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeTimestampName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "unixTimeMillis"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1638200308368)))}})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeTimestampName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionMonomorphicName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "string"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeUnionMonomorphicName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic and recursive variants",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "bool"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "other"),+ Core.bindingTerm = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeUnionPolymorphicRecursiveName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "other"))}}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable TestTypes.testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}++testGroupForWrappers :: Testing.TestGroup+testGroupForWrappers = Testing.TestGroup {+ Testing.testGroupName = "Wrapper introductions and eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Wrapper introductions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermVariable (Core.Name "v"))}))}))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeVariable TestTypes.testTypeStringAliasName)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]},+ Testing.TestGroup {+ Testing.testGroupName = "Wrapper eliminations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypeStringAliasName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "#2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {+ Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestTypes.testTypeStringAliasName))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = TestTypes.testTypeStringAliasName,+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.inferenceTestCaseOutput = Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForMinimalInference"]}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Json/Coder.hs view
@@ -0,0 +1,311 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for the type-directed JSON coder (Hydra Term <-> JSON Value)++module Hydra.Test.Json.Coder where++import qualified Hydra.Core as Core+import qualified Hydra.Json.Model as Model+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for the type-directed JSON coder+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "JSON coder",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "literal types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralBoolean True)),+ Testing.jsonCoderTestCaseJson = (Model.ValueBoolean True)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralBoolean False)),+ Testing.jsonCoderTestCaseJson = (Model.ValueBoolean False)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 42.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17)))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber (-17.0))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 0.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.5))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 1.5)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.718))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 2.718)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string simple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Testing.jsonCoderTestCaseJson = (Model.ValueString "hello")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralString "")),+ Testing.jsonCoderTestCaseJson = (Model.ValueString "")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with spaces",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralString "hello world")),+ Testing.jsonCoderTestCaseJson = (Model.ValueString "hello world")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "integer types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int8 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 127))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 127.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int8 negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-128)))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber (-128.0))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int16 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 1000.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int16 negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (-1000)))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber (-1000.0))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint8 max",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint8)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 255.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint8 zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint8)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 0))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 0.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint16 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint16)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 60000))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 60000.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint32 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint32)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 4000000000))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 4.0e9)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint64 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1000000))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 1000000.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigint positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 123456789012345))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 1.23456789012345e14)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigint negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeBigint)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-999999999999)))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber (-9.99999999999e11))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "float types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigfloat positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeBigfloat)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14159265359))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 3.14159265359)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigfloat negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeBigfloat)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-2.71828)))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber (-2.71828))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bigfloat zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeBigfloat)),+ Testing.jsonCoderTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 0.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "collection types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonCoderTestCaseTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),+ Testing.jsonCoderTestCaseJson = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0),+ (Model.ValueNumber 3.0)])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonCoderTestCaseTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]),+ Testing.jsonCoderTestCaseJson = (Model.ValueArray [+ Model.ValueString "a",+ (Model.ValueString "b")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonCoderTestCaseTerm = (Core.TermList []),+ Testing.jsonCoderTestCaseJson = (Model.ValueArray [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "optional types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional string with value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonCoderTestCaseTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello")))),+ Testing.jsonCoderTestCaseJson = (Model.ValueString "hello")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional string nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonCoderTestCaseTerm = (Core.TermMaybe Nothing),+ Testing.jsonCoderTestCaseJson = Model.ValueNull})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional int with value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonCoderTestCaseTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.jsonCoderTestCaseJson = (Model.ValueNumber 42.0)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional int nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonCoder (Testing.JsonCoderTestCase {+ Testing.jsonCoderTestCaseType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonCoderTestCaseTerm = (Core.TermMaybe Nothing),+ Testing.jsonCoderTestCaseJson = Model.ValueNull})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "record types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = []}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Json/Parser.hs view
@@ -0,0 +1,450 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for JSON parsing++module Hydra.Test.Json.Parser where++import qualified Hydra.Json.Model as Model+import qualified Hydra.Parsing as Parsing+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for JSON parsing+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "JSON parsing",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "null",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = Model.ValueNull,+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "true",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueBoolean True),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "false",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueBoolean False),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "0",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 0.0),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "42",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 42.0),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "-17",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber (-17.0)),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "large integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "1000000",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 1000000.0),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "3.14",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 3.14),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "-2.5",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber (-2.5)),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "scientific notation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "1e3",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 1000.0),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "scientific with decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "1.5e2",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 150.0),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative exponent",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "1e-2",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueNumber 1.0e-2),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString ""),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"hello\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "hello"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with spaces",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"hello world\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "hello world"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped double quote",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"say \\\"hi\\\"\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "say \"hi\""),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped backslash",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"path\\\\to\\\\file\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "path\\to\\file"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"line1\\nline2\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "line1\nline2"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped carriage return",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"line1\\rline2\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "line1\rline2"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped tab",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"col1\\tcol2\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "col1\tcol2"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "escaped forward slash",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "\"a\\/b\"",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueString "a/b"),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "arrays",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty array",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray []),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[1]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueNumber 1.0]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[1, 2, 3]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0),+ (Model.ValueNumber 3.0)]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[\"a\", \"b\"]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueString "a",+ (Model.ValueString "b")]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[1, \"two\", true, null]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueString "two"),+ (Model.ValueBoolean True),+ Model.ValueNull]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "objects",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty object",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject M.empty),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single key-value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{\"name\": \"Alice\"}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("name", (Model.ValueString "Alice"))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{\"a\": 1, \"b\": 2}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("a", (Model.ValueNumber 1.0)),+ ("b", (Model.ValueNumber 2.0))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed value types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{\"active\": true, \"count\": 42, \"name\": \"test\"}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("active", (Model.ValueBoolean True)),+ ("count", (Model.ValueNumber 42.0)),+ ("name", (Model.ValueString "test"))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "nested structures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested arrays",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[[1, 2], [3, 4]]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0)],+ (Model.ValueArray [+ Model.ValueNumber 3.0,+ (Model.ValueNumber 4.0)])]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "object with array",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{\"items\": [1, 2]}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("items", (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0)]))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "array of objects",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[{\"id\": 1}, {\"id\": 2}]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueObject (M.fromList [+ ("id", (Model.ValueNumber 1.0))]),+ (Model.ValueObject (M.fromList [+ ("id", (Model.ValueNumber 2.0))]))]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested object",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{\"user\": {\"name\": \"Bob\"}}",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("user", (Model.ValueObject (M.fromList [+ ("name", (Model.ValueString "Bob"))])))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "whitespace handling",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "leading whitespace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = " null",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = Model.ValueNull,+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "trailing whitespace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "null ",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = Model.ValueNull,+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both whitespace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = " null ",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = Model.ValueNull,+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "array with whitespace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[ 1 , 2 , 3 ]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0),+ (Model.ValueNumber 3.0)]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "object with whitespace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "{ \"a\" : 1 }",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueObject (M.fromList [+ ("a", (Model.ValueNumber 1.0))])),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiline array",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonParser (Testing.ParserTestCase {+ Testing.parserTestCaseInput = "[\n 1,\n 2\n]",+ Testing.parserTestCaseOutput = (Parsing.ParseResultSuccess (Parsing.ParseSuccess {+ Parsing.parseSuccessValue = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0)]),+ Parsing.parseSuccessRemainder = ""}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Json/Roundtrip.hs view
@@ -0,0 +1,217 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Round-trip test cases for JSON encoding and decoding++module Hydra.Test.Json.Roundtrip where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Round-trip test cases for JSON encoding and decoding+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "JSON round-trip",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "literal types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral Core.LiteralTypeBoolean),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int8 positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int8 negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-17))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int16",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint8)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 200)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint16",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint16)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 50000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 1000000000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uint32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint32)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 4000000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14159)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string simple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with spaces",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermLiteral (Core.LiteralString "hello world"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "collection types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeList (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "set of strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "optional types",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional string with value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional string nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional int with value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonRoundtrip (Testing.JsonRoundtripTestCase {+ Testing.jsonRoundtripTestCaseType = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.jsonRoundtripTestCaseTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Json/Writer.hs view
@@ -0,0 +1,302 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for JSON serialization++module Hydra.Test.Json.Writer where++import qualified Hydra.Json.Model as Model+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for JSON serialization (writer)+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "JSON serialization",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = Model.ValueNull,+ Testing.writerTestCaseOutput = "null"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueBoolean True),+ Testing.writerTestCaseOutput = "true"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueBoolean False),+ Testing.writerTestCaseOutput = "false"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber 0.0),+ Testing.writerTestCaseOutput = "0"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber 42.0),+ Testing.writerTestCaseOutput = "42"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber (-17.0)),+ Testing.writerTestCaseOutput = "-17"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "large integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber 1000000.0),+ Testing.writerTestCaseOutput = "1000000"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber 3.14),+ Testing.writerTestCaseOutput = "3.14"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber (-2.5)),+ Testing.writerTestCaseOutput = "-2.5"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueNumber 1.0e-3),+ Testing.writerTestCaseOutput = "1.0e-3"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString ""),+ Testing.writerTestCaseOutput = "\"\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "hello"),+ Testing.writerTestCaseOutput = "\"hello\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with spaces",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "hello world"),+ Testing.writerTestCaseOutput = "\"hello world\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with double quote",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "say \"hi\""),+ Testing.writerTestCaseOutput = "\"say \\\"hi\\\"\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with backslash",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "path\\to\\file"),+ Testing.writerTestCaseOutput = "\"path\\\\to\\\\file\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "line1\nline2"),+ Testing.writerTestCaseOutput = "\"line1\\nline2\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with carriage return",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "line1\rline2"),+ Testing.writerTestCaseOutput = "\"line1\\rline2\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with tab",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "col1\tcol2"),+ Testing.writerTestCaseOutput = "\"col1\\tcol2\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with mixed escapes",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueString "a\"b\\c\nd"),+ Testing.writerTestCaseOutput = "\"a\\\"b\\\\c\\nd\""})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "arrays",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty array",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray []),+ Testing.writerTestCaseOutput = "[]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueNumber 1.0]),+ Testing.writerTestCaseOutput = "[1]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0),+ (Model.ValueNumber 3.0)]),+ Testing.writerTestCaseOutput = "[1, 2, 3]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueString "a",+ (Model.ValueString "b")]),+ Testing.writerTestCaseOutput = "[\"a\", \"b\"]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueString "two"),+ (Model.ValueBoolean True),+ Model.ValueNull]),+ Testing.writerTestCaseOutput = "[1, \"two\", true, null]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "objects",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty object",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject M.empty),+ Testing.writerTestCaseOutput = "{}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single key-value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject (M.fromList [+ ("name", (Model.ValueString "Alice"))])),+ Testing.writerTestCaseOutput = "{\"name\": \"Alice\"}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject (M.fromList [+ ("a", (Model.ValueNumber 1.0)),+ ("b", (Model.ValueNumber 2.0))])),+ Testing.writerTestCaseOutput = "{\"a\": 1, \"b\": 2}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed value types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject (M.fromList [+ ("active", (Model.ValueBoolean True)),+ ("count", (Model.ValueNumber 42.0)),+ ("name", (Model.ValueString "test"))])),+ Testing.writerTestCaseOutput = "{\"active\": true, \"count\": 42, \"name\": \"test\"}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "nested structures",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested arrays",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0)],+ (Model.ValueArray [+ Model.ValueNumber 3.0,+ (Model.ValueNumber 4.0)])]),+ Testing.writerTestCaseOutput = "[[1, 2], [3, 4]]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "object with array",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject (M.fromList [+ ("items", (Model.ValueArray [+ Model.ValueNumber 1.0,+ (Model.ValueNumber 2.0)]))])),+ Testing.writerTestCaseOutput = "{\"items\": [1, 2]}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "array of objects",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueArray [+ Model.ValueObject (M.fromList [+ ("id", (Model.ValueNumber 1.0))]),+ (Model.ValueObject (M.fromList [+ ("id", (Model.ValueNumber 2.0))]))]),+ Testing.writerTestCaseOutput = "[{\"id\": 1}, {\"id\": 2}]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested object",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJsonWriter (Testing.WriterTestCase {+ Testing.writerTestCaseInput = (Model.ValueObject (M.fromList [+ ("user", (Model.ValueObject (M.fromList [+ ("name", (Model.ValueString "Bob"))])))])),+ Testing.writerTestCaseOutput = "{\"user\": {\"name\": \"Bob\"}}"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Chars.hs view
@@ -0,0 +1,252 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.chars primitives++module Hydra.Test.Lib.Chars where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.chars primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.chars primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "isAlphaNum",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "letter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isAlphaNum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "digit",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isAlphaNum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "space",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isAlphaNum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "punctuation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isAlphaNum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 46)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isLower",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "digit",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isSpace",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "space",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isSpace"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tab",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isSpace"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isSpace"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "letter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isSpace"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isUpper",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "digit",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.isUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toLower",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "digit",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toUpper",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 65)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "digit",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.chars.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 53)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Eithers.hs view
@@ -0,0 +1,735 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.eithers primitives++module Hydra.Test.Lib.Eithers where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.eithers primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.eithers primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "bind",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind Right with success",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "ab"))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind Right with failure",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString ""))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind Left returns Left unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bind"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bimap",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map left value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map right value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "ab"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isLeft",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.isLeft"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.isLeft"))),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isRight",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.isRight"))),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "left value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.isRight"))),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromLeft",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "extract left",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.fromLeft"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "use default for right",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.fromLeft"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromRight",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "extract right",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.fromRight"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "default"))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "test"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "use default for left",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.fromRight"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "default"))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "default"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "either",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "apply left function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "apply right function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.either"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "ab"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lefts",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter left values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.lefts"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a")))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all lefts",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.lefts"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all rights",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.lefts"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.lefts"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "rights",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter right values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.rights"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a")))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all rights",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.rights"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all lefts",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.rights"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.rights"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "partitionEithers",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partition mixed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.partitionEithers"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a")))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all lefts",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.partitionEithers"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all rights",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.partitionEithers"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermEither (Right (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.partitionEithers"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map right value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "preserve left",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all succeed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapList"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first fails",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapList"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapList"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapMaybe",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just succeeds",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just fails",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.eithers.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermEither (Left (Core.TermLiteral (Core.LiteralString "zero"))))})),+ Core.applicationArgument = (Core.TermEither (Right (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))}))})))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermEither (Right (Core.TermMaybe Nothing)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Equality.hs view
@@ -0,0 +1,765 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.equality primitives++module Hydra.Test.Lib.Equality where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.equality primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.equality primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "compare",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "equal",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unequal integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "gt",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "gte",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "identity",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.identity"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lt",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lte",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "max",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "min",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "compare strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less than (lexicographic)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "banana"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater than (lexicographic)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty vs non-empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "prefix vs longer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ab"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lt strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less (lexicographic)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "banana"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "gt strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater (lexicographic)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "banana"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "max strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "min strings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "zebra"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "apple"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "compare floats",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 5.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative vs positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lt floats",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 5.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "gt floats",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greater",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 5.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "less",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Flows.hs view
@@ -0,0 +1,1373 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.flows primitives++module Hydra.Test.Lib.Flows where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.flows primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.flows primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "apply",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "apply add",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bind",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind add",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind multiply",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))}))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 12)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fail",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail with message",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.fail")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "test error message"))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe Nothing)},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "Error: test error message ()")])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "foldl",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "foldl sum",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a0"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a0"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a1"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "a2"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))}))})))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map negate",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map abs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapElems",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapElems add one",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermVariable (Core.Name "v1"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralString "b"), (Core.TermVariable (Core.Name "v2"))))])}))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralString "a"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))),+ (Core.TermLiteral (Core.LiteralString "b"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))))]))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapKeys",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapKeys add one",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermVariable (Core.Name "k1"), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermVariable (Core.Name "k2"), (Core.TermLiteral (Core.LiteralString "b"))))])}))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "b")))]))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapList add one",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "y1"),+ (Core.TermVariable (Core.Name "y2")),+ (Core.TermVariable (Core.Name "y3"))])}))})))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapMaybe",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapMaybe just",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermVariable (Core.Name "y"))))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapMaybe nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermMaybe Nothing)))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapSet",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mapSet add one",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "y1"),+ (Core.TermVariable (Core.Name "y2")),+ (Core.TermVariable (Core.Name "y3"))])}))}))})))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pure",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pure integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pure zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pure negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pure string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sequence",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sequence pure list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermList [+ Core.TermVariable (Core.Name "x1"),+ (Core.TermVariable (Core.Name "x2")),+ (Core.TermVariable (Core.Name "x3"))])}))})))}))})))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "withDefault",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "withDefault on success returns original",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.withDefault"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "withDefault on failure returns fallback",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.flows.withDefault"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.fail")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "error"))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Lists.hs view
@@ -0,0 +1,3200 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.lists primitives++module Hydra.Test.Lib.Lists where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.lists primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.lists primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "apply",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "string transformations",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string transformations",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")),+ (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "One"),+ (Core.TermLiteral (Core.LiteralString "Two")),+ (Core.TermLiteral (Core.LiteralString "Three"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "ONE"),+ (Core.TermLiteral (Core.LiteralString "TWO")),+ (Core.TermLiteral (Core.LiteralString "THREE")),+ (Core.TermLiteral (Core.LiteralString "one")),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "edge cases",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty function list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty input list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "HELLO")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single input",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")),+ (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "Test")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "TEST"),+ (Core.TermLiteral (Core.LiteralString "test"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "at",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "middle element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "last element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list access",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bind",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negation function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))])})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "duplicate elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "concat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple non-empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty lists included",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ (Core.TermList []),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [],+ (Core.TermList []),+ (Core.TermList [])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list of lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "concat2",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two non-empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first list empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second list empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both lists empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "d"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c")),+ (Core.TermLiteral (Core.LiteralString "d"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cons",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cons to non-empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cons to empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cons negative number",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cons string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "world")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "drop",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop from beginning",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop zero elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop more than length",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop from empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop negative amount",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "dropWhile",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop while less than 3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.dropWhile"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.dropWhile"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "drop no elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.dropWhile"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.dropWhile"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "elem",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "element present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "element not present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element not present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "duplicate elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string element present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "world"),+ (Core.TermLiteral (Core.LiteralString "hello")),+ (Core.TermLiteral (Core.LiteralString "test"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string element not present",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "missing"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "world"),+ (Core.TermLiteral (Core.LiteralString "hello"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "filter",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter positive numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter no elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "find",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find existing element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.find"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find first matching",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.find"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find no match",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.find"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find in empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.find"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.find"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "foldl",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sum with addition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "product with multiplication",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 24)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "subtraction fold",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub")))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "group",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "consecutive duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all same",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))]])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "head",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "init",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "intercalate",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "double zero separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list of lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lists with empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]),+ (Core.TermList [])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "intersperse",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string interspersion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "and"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "and")),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "and")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "only")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "only")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "+"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "+")),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "number interspersion",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "last",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "length",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "many elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string to uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "ONE"),+ (Core.TermLiteral (Core.LiteralString "TWO"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "HELLO")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "number negation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.identity")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "nub",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "remove duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "a")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "null",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty int list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a")])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "partition",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partition greater than 3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.partition"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partition all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.partition"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partition no elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.partition"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partition even numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.partition"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.partition"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pure",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "number element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative number",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "replicate",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "replicate three times",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "replicate zero times",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "replicate once",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "replicate string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "hello"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "reverse",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "c"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "a"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "safeHead",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-empty int list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty int list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "singleton",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "number element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative number",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sort",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unsorted numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "already sorted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "reverse sorted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "duplicates",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string sort",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "zebra"),+ (Core.TermLiteral (Core.LiteralString "apple")),+ (Core.TermLiteral (Core.LiteralString "banana"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "apple"),+ (Core.TermLiteral (Core.LiteralString "banana")),+ (Core.TermLiteral (Core.LiteralString "zebra"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sortOn",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sort by string length",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sortOn"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "hi")),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hi"),+ (Core.TermLiteral (Core.LiteralString "hello")),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sortOn"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length")))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single string element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sortOn"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "test")])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "test")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sort by negation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sortOn"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sort by absolute value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sortOn"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "span",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "span less than 3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))], (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "span all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "span no elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.span"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermList [], (Core.TermList [])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "tail",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "b"),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "take",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take from beginning",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take zero elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take more than length",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take from empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "take negative amount",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "transpose",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "square matrix",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single row",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single column",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ragged matrix",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6))])])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "zip",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal length lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c"))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first list shorter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second list shorter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty first list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty second list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both empty lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "zipWith",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "addition",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first list shorter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second list shorter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty first list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty second list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string concatenation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zipWith"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2")))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "1"),+ (Core.TermLiteral (Core.LiteralString "2"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a1"),+ (Core.TermLiteral (Core.LiteralString "b2"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Literals.hs view
@@ -0,0 +1,1973 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.literals primitives++module Hydra.Test.Lib.Literals where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Hydra.Lib.Literals as Literals++-- | Test cases for hydra.lib.literals primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.literals primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "bigintToInt8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-42))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToInt16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-1000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (-1000))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToInt32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-42))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToInt64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 1000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-1000000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1000000))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToUint8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 100)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 100)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToUint16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 1000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToUint32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 100000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 100000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToUint64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "int8ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "max value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 127)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 127)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "min value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-128))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-128))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "int16ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int16ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int16ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (-1000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-1000))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "int32ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int32ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int32ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int32ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "int64ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int64ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.int64ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1000000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-1000000))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "uint8ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "max value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint8ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 255)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "uint16ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint16ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint16ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "uint32ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint32ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint32ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 100000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 100000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "uint64ToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint64ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.uint64ToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 1000000)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "float32ToBigfloat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float32ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 2.5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float32ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-2.5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-2.5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float32ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "float64ToBigfloat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float64ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14159)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14159)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float64ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-2.71828))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-2.71828))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.float64ToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigfloatToFloat32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-2.5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-2.5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigfloatToFloat64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14159)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14159)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-2.71828))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-2.71828))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigintToBigfloat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 42.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-42.0))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigintToBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bigfloatToBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 42.7)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 43)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat (-42.7))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-43))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round down",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 42.3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "half even up",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 42.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "half even down",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.bigfloatToBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 43.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 44)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showInt8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showInt16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (-1000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-1000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showInt32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showInt64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1000000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1000000))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-1000000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showUint8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "max value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "255"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showUint16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 1000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showUint32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 100000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "100000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showUint64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1000000)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1000000"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showFloat32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.14"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-2.5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "-2.5"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 5.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "5.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive 2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "very small",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.0e-3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1.0e-3"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "normal decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 0.1)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.1"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showFloat64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14159)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.14159"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 5.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "5.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive 2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "very small",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0e-3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1.0e-3"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "normal decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.1)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.1"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showBigfloat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.14"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.0"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 5.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "5.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "small positive 2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.0e-2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "3.0e-2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "very small",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 1.0e-3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "1.0e-3"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "normal decimal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 0.1)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "0.1"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showBoolean",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "true"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showBoolean"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "false"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "showString",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"hello\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latin accented",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "caf\233"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"caf\\233\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "greek lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\955"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\955\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed ascii and non-ascii",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "A\233B"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"A\\233B\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tab",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\t"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\t\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\n\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "carriage return",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\r"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\r\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "backslash",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\\"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\\\\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "double quote",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\\"\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\NUL"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\NUL\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bell",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\a\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "backspace",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\b"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\b\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "form feed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\f"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\f\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "vertical tab",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\v"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\v\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "delete",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.showString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\DEL"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\"\\DEL\""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readInt8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-42))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "max value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "127"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 127)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "min value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-128"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt8 (-128))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "overflow",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "128"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readInt16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "1000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 1000)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 (-1000))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readInt32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-42))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readInt64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "1000000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 1000000)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1000000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt64 (-1000000))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readInt64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readUint8",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "100"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 100)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "max value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "255"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint8 255)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint8"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readUint16",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "1000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint16 1000)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint16"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readUint32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "100000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint32 100000)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readUint64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "typical",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "1000000"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1000000)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readUint64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-1"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readBigint",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-42"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-42))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "0"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 0)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "large",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "123456789012345678901234567890"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 123456789012345678901234567890)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigint"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readFloat32",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "3.14"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 3.14)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-2.5"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (-2.5))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat32"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readFloat64",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "3.14159"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14159)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "-2.71828"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-2.71828))))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readFloat64"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readBigfloat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "3.14"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueBigfloat 3.14)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBigfloat"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readBoolean",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBoolean"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "true"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralBoolean True))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBoolean"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "false"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralBoolean False))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "invalid",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readBoolean"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "yes"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "readString",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "quoted string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\"hello\""))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty quoted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\"\""))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString ""))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unquoted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.readString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "stringToBinary",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple base64",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.stringToBinary"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aGVsbG8="))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBinary (Literals.stringToBinary "aGVsbG8=")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.stringToBinary"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBinary (Literals.stringToBinary "")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "binaryToString",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple binary",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.binaryToString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBinary (Literals.stringToBinary "aGVsbG8=")))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "aGVsbG8="))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty binary",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.literals.binaryToString"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBinary (Literals.stringToBinary "")))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Logic.hs view
@@ -0,0 +1,257 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.logic primitives++module Hydra.Test.Lib.Logic where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.logic primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.logic primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "and",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true and true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true and false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false and true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false and false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "ifElse",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "boolean values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true condition returns then",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false condition returns else",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "integer values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true selects first int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false selects second int",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "string values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true selects first string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "yes"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "no"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "yes"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false selects second string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "yes"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "no"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "no"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []},+ Testing.TestGroup {+ Testing.testGroupName = "not",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "not true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "not false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "or",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true or true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "true or false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false or true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "false or false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Maps.hs view
@@ -0,0 +1,960 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.maps primitives++module Hydra.Test.Lib.Maps where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.maps primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.maps primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "alter",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert new key",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.alter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "new"))))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "new")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "update existing key",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.alter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "updated"))))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "updated")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "delete key",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.alter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "opt"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe Nothing)})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bimap",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "transform both",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "A"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)), (Core.TermLiteral (Core.LiteralString "B")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "elems",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get all elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.elems"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unsorted keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.elems"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.elems"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "empty",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty"))),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "filter",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter values starting with a",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))}))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "ab")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "ab")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter all",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))}))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filter"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v"))}))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))}))})))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "filterWithKey",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter by key > 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filterWithKey"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter all",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filterWithKey"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.filterWithKey"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))})))})))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "findWithDefault",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.findWithDefault"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "default"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "b"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "use default",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.findWithDefault"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "default"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "default"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "create from pairs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "duplicate keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.fromList"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "insert",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert new key",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "c"))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "update existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "updated"))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "updated")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert into empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "x")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "keys",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "get all keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.keys"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unsorted keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.keys"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.keys"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lookup",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "find existing key",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "b"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "key not found",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lookup in empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map over values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "A"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "B")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapKeys",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "double keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.mapKeys"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.mapKeys"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "k"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "k"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "member",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "key exists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "key missing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "null",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.null"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.null"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "remove",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "remove existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "remove non-existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "remove from empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap M.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "singleton",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single entry",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "hello")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "size",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three entries",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.size"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single entry",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.size"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "test")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.size"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "convert to pairs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.toList"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unsorted keys",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.toList"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))),+ (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c"))))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.toList"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "union",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union two maps",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.union"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b")))]))})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "x"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)), (Core.TermLiteral (Core.LiteralString "b"))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)), (Core.TermLiteral (Core.LiteralString "c")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union with empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.union"))),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty with map",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.union"))),+ Core.applicationArgument = (Core.TermMap M.empty)})),+ Core.applicationArgument = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermMap (M.fromList [+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)), (Core.TermLiteral (Core.LiteralString "a")))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Math.hs view
@@ -0,0 +1,1653 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.math primitives++module Hydra.Test.Lib.Math where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.math primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.math primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "abs",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "add",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-8))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed sign",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "div",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exact division",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "truncates toward negative infinity",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative dividend",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-10))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative divisor",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "even",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "even positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "odd positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "even negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "odd negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.even"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "max",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first is larger",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second is larger",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed sign",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.max"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "min",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first is smaller",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second is smaller",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "equal values",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed sign",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.min"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mod",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic modulo",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exact division",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative dividend",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-10))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative divisor",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mul",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed sign",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-15))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with one",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "negate",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "odd",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "odd positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.odd"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "even positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.odd"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "odd negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.odd"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "even negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.odd"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.odd"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pred",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pred"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pred"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pred"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-6))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "range",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ascending range",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.range"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.range"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.range"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative start",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.range"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1)))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "rem",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic remainder",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.rem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exact division",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.rem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative dividend",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.rem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-10))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative divisor",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.rem"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "signum",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.signum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.signum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-1))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.signum"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sub",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative numbers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-10))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-7))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed sign",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 13)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "succ",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.succ"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.succ"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.succ"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-4))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "e",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Euler's number",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.e"))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.718281828459045)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pi",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "pi constant",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pi"))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.141592653589793)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sin",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sin 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sin pi/2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5707963267948966)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sin pi",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.141592653589793)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.2246467991473532e-16)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cos",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cos 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.cos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cos pi/2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.cos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5707963267948966)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 6.123233995736766e-17)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cos pi",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.cos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.141592653589793)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "tan",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tan 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.tan"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tan pi/4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.tan"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.7853981633974483)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.9999999999999999)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "asin",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "asin 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.asin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "asin 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.asin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5707963267948966)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "asin -1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.asin"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.5707963267948966))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "acos",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "acos 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.acos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "acos 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.acos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5707963267948966)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "acos -1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.acos"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.141592653589793)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "atan",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atan 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atan"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atan 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atan"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.7853981633974483)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "atan2",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atan2 1 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atan2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.7853981633974483)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atan2 1 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atan2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5707963267948966)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atan2 0 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atan2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sinh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sinh 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sinh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sinh 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sinh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.1752011936438014)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cosh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cosh 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.cosh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cosh 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.cosh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.5430806348152437)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "tanh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tanh 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.tanh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tanh 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.tanh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.7615941559557649)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "asinh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "asinh 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.asinh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "asinh 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.asinh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.881373587019543)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "acosh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "acosh 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.acosh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "acosh 2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.acosh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.3169578969248166)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "atanh",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atanh 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atanh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "atanh 0.5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.atanh"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.5493061443340549)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "exp",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exp 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.exp"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exp 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.exp"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.718281828459045)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "exp -1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.exp"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.36787944117144233)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "log",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.log"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log e",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.log"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.718281828459045)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "logBase",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log10 1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.logBase"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 10.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log10 10",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.logBase"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 10.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 10.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log10 100",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.logBase"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 10.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 100.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "log2 8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.logBase"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 8.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pow",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "2^3",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pow"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 8.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "10^0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pow"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 10.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "2^-1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.pow"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-1.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "sqrt",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sqrt 4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sqrt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 4.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sqrt 9",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sqrt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 9.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sqrt 2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sqrt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 2.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 1.4142135623730951)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sqrt 0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sqrt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "ceiling",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ceiling 3.2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.ceiling"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 4)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ceiling 3.0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.ceiling"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ceiling -3.2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.ceiling"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.2))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "ceiling -3.0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.ceiling"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "floor",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "floor 3.8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.floor"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.8)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "floor 3.0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.floor"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "floor -3.2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.floor"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.2))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-4))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "floor -3.0",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.floor"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.0))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "round",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round 3.4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.round"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.4)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round 3.5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.round"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 4)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round 3.6",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.round"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.6)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 4)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round -3.4",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.round"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.4))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "round -3.5",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.round"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.5))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-4))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "truncate",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "truncate 3.8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.truncate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.8)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "truncate 3.2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.truncate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "truncate -3.8",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.truncate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.8))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "truncate -3.2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.truncate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-3.2))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueBigint (-3))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Maybes.hs view
@@ -0,0 +1,673 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.maybes primitives++module Hydra.Test.Lib.Maybes where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.maybes primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.maybes primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "apply",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both just",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.apply"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.apply"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.apply"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bind",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just to just",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.bind"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing to nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.bind"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cases",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just applies function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cases"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing returns default",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cases"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filters nothings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermMaybe Nothing),+ (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all justs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))),+ (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all nothings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermMaybe Nothing,+ (Core.TermMaybe Nothing)])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.cat"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "compose",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both succeed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.compose"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 12)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first fails",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.compose"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second fails",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.compose"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.lte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gte"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromJust",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "extract from just",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.fromJust"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromMaybe",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.fromMaybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing with default",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.fromMaybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isJust",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.isJust"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.isJust"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "isNothing",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.isNothing"))),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.isNothing"))),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "maps just value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "mapMaybe",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "filter and transform",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty result",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty input",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.mapMaybe"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.gt"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)}))})))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "maybe",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just value applies function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing returns default",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.maybe"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermMaybe Nothing)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "pure",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wraps integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "wraps string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maybes.pure"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Pairs.hs view
@@ -0,0 +1,149 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.pairs primitives++module Hydra.Test.Lib.Pairs where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.pairs primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.pairs primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "bimap",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "transform both elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)), (Core.TermLiteral (Core.LiteralString "ab"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.bimap"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "s"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})))})),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)), (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "first",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "extract first element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)), (Core.TermLiteral (Core.LiteralString "world"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative number",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.first"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))), (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "second",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "extract second element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)), (Core.TermLiteral (Core.LiteralString "hello"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)), (Core.TermLiteral (Core.LiteralString ""))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "long string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.pairs.second"))),+ Core.applicationArgument = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 123)), (Core.TermLiteral (Core.LiteralString "testing"))))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "testing"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Sets.hs view
@@ -0,0 +1,658 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.sets primitives++module Hydra.Test.Lib.Sets where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.sets primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.sets primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "empty",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty"))),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "singleton",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.singleton"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "create from list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "duplicates removed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.fromList"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "convert to list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.toList"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unsorted input",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.toList"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.toList"))),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "insert",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert new element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert existing element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "insert into empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.insert"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "delete",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "delete existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "delete non-existing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "delete from empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.delete"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "member",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "element exists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "element missing",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.member"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "size",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.size"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.size"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.size"))),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "null",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.null"))),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.null"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "union",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union two sets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.union"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union with empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.union"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty with non-empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.union"))),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "unions",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union of multiple sets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.unions"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])),+ (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "union with empty sets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.unions"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ (Core.TermSet S.empty),+ (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))]))])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list of sets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.unions"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.unions"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])])})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "intersection",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "common elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.intersection"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no common elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.intersection"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "intersection with empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.intersection"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "difference",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "remove elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.difference"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no overlap",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.difference"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "difference with empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.difference"))),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]))})),+ Testing.evaluationTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map on empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.map"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})))})),+ Core.applicationArgument = (Core.TermSet S.empty)})),+ Testing.evaluationTestCaseOutput = (Core.TermSet S.empty)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Lib/Strings.hs view
@@ -0,0 +1,1374 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.lib.strings primitives++module Hydra.Test.Lib.Strings where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.lib.strings primitives+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "hydra.lib.strings primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "cat",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic concatenation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "onetwothree"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with empty strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "one")),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all empty strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "\241"),+ (Core.TermLiteral (Core.LiteralString "\19990")),+ (Core.TermLiteral (Core.LiteralString "\127757"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "combining characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "e"),+ (Core.TermLiteral (Core.LiteralString "\769"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "e\769"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "control characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "\n"),+ (Core.TermLiteral (Core.LiteralString "\t")),+ (Core.TermLiteral (Core.LiteralString "\r"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "\NUL")),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\NULworld"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "cat2",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic concatenation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "helloworld"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty first string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty second string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both empty strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\19990"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "special characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\t"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\NUL"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\NULworld"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "charAt",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "first character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "middle character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "last character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single character string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multi-byte unicode",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\19990"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 19990)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "second of combining pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "e\769"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 769)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "fromList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic ascii string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty code point list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 19990))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 127757)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "combining character sequence",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 769)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "e\769"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "special characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 13)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 105)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "h\NULi"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "intercalate",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "comma separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one,two,three"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multi-character separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " | "))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "A"),+ (Core.TermLiteral (Core.LiteralString "B")),+ (Core.TermLiteral (Core.LiteralString "C"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "A | B | C"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single item list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "only")])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "only"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty strings in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "a")),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ",a,"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\127757"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "link1"),+ (Core.TermLiteral (Core.LiteralString "link2"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "link1\127757link2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "newline separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "line1"),+ (Core.TermLiteral (Core.LiteralString "line2"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "line1\nline2"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "length",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic word",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "combining character sequence",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "e\769"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "special characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lines",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single line",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello world")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two lines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\nworld"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "three lines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one\ntwo\nthree"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "trailing newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\n"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "leading newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\nhello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "hello"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple consecutive newlines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a\n\nb"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode content",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\n\19990"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "\241"),+ (Core.TermLiteral (Core.LiteralString "\19990"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "tabs not split",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a\tb\nc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a\tb"),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "null",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "space",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode space",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\160"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "newline",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\NUL"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multi-character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "splitOn",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ss"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "Mi"),+ (Core.TermLiteral (Core.LiteralString "i")),+ (Core.TermLiteral (Core.LiteralString "ippi"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single char separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one two three"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multi-char separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a b c"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "separator not found",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "separator at start",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "h"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "ello"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "separator at end",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "o"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hell"),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "leading and trailing separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " one two "))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "one")),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "whole string as separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "consecutive separators",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a b"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple occurrences",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "l"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "he"),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString "o"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "overlapping pattern",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aa"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aaa"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "a"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "a")),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "separator on empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "both empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single char both",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\19990"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\19990world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode content",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241,\19990,\127757"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "\241"),+ (Core.TermLiteral (Core.LiteralString "\19990")),+ (Core.TermLiteral (Core.LiteralString "\127757"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "newline separator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "line1\nline2\nline3"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "line1"),+ (Core.TermLiteral (Core.LiteralString "line2")),+ (Core.TermLiteral (Core.LiteralString "line3"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toList",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "basic word",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 19990))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 127757)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "combining character sequence",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "e\769"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 769)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "control characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 13)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "null character",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "h\NULi"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 105)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toLower",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed case",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Hello World"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello world"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with numbers and punctuation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Abc123, XYZ!"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "abc123, xyz!"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "control characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode accented chars",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\209\193\201\205\211\218"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\225\233\237\243\250"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "toUpper",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed case",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello World"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO WORLD"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with numbers and punctuation",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc123, xyz!"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "ABC123, XYZ!"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "control characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode accented chars",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\225\233\237\243\250"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\209\193\201\205\211\218"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "unlines",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple lines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "one"),+ (Core.TermLiteral (Core.LiteralString "two")),+ (Core.TermLiteral (Core.LiteralString "three"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one\ntwo\nthree\n"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single line",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello")])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\n"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "with empty lines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "hello"),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString "world"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\n\nworld\n"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "all empty lines",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString ""),+ (Core.TermLiteral (Core.LiteralString "")),+ (Core.TermLiteral (Core.LiteralString ""))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\n\n"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unicode content",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "\241o\241o"),+ (Core.TermLiteral (Core.LiteralString "\19990\30028"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241o\241o\n\19990\30028\n"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Monads.hs view
@@ -0,0 +1,429 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for hydra.monads functions++module Hydra.Test.Monads where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for hydra.monads functions+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "monads",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "pure",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "integer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "hello"))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "map",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map negate",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.map")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.negate")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-5))))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "map absolute",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.map")),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.abs")))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-3))))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "bind",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind add",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bind multiply",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.bind")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))}))})),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "n"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.pure")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))}))}))})))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 12)))))},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "error traces",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Error traces are in the right order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap (Core.Name "hydra.compute.Flow")))),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.withTrace")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.withTrace")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "two"))})),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "hydra.monads.fail")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "oops"))}))}))}))})),+ Core.applicationArgument = Core.TermUnit})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.FlowState"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermMaybe Nothing)},+ Core.Field {+ Core.fieldName = (Core.Name "state"),+ Core.fieldTerm = Core.TermUnit},+ Core.Field {+ Core.fieldName = (Core.Name "trace"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "hydra.compute.Trace"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "stack"),+ Core.fieldTerm = (Core.TermList [])},+ Core.Field {+ Core.fieldName = (Core.Name "messages"),+ Core.fieldTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "Error: oops (one > two)")])},+ Core.Field {+ Core.fieldName = (Core.Name "other"),+ Core.fieldTerm = (Core.TermMap M.empty)}]}))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = [+ Testing.Tag "disabledForPython"]}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Ordering.hs view
@@ -0,0 +1,1076 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for Ord instance comparisons on complex Hydra types++module Hydra.Test.Ordering where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for Ord instance comparisons on complex Hydra types+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "ordering",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "Name comparison",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "name less than (alphabetic)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "apple"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "banana"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "name equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hello"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "name greater than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "zebra"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "apple"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "greaterThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "qualified name less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Type"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "qualified name equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "hydra.core.Term"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "name equality true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "name equality false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "hydra.core.Name"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Literal comparison",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 literal less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 literal equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string literal less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aaa"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bbb"))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean false < true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean true == true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Record comparison (monomorphic)",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person less than by firstName",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person less than by lastName",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Jones"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person less than by age",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latLon less than by lat",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 10.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 20.0)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 15.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 20.0)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latLon less than by lon",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 10.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 20.0)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 10.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 25.0)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "latLon equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 10.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 20.0)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 10.0)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 20.0)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person equality true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "person equality false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Core.applicationArgument = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Polymorphic type comparison",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly Int32 less than by lat",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly Int32 less than by lon",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly Int32 equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly String less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "10N"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "20W"))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "15N"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "20W"))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly String equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "10N"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "20W"))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "10N"))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "20W"))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "PersonOrSomething person vs person",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable TestTypes.testTypePersonName))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Bob"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable TestTypes.testTypePersonName))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "PersonOrSomething person equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable TestTypes.testTypePersonName))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypePersonOrSomethingName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "person"),+ Core.fieldTerm = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Alice"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Smith"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))}]}))}})),+ Core.typeApplicationTermType = (Core.TypeList (Core.TypeVariable TestTypes.testTypePersonName))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly Int32 equality true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "LatLonPoly Int32 equality false",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Core.applicationArgument = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonPolyName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))}]})),+ Core.typeApplicationTermType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "Union comparison",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number int variant less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number int variant equal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "equalTo"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number float variant less than",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 1.5)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 2.5)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number float vs int (variant name comparison)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.compare"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 100.0)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "hydra.util.Comparison"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "lessThan"),+ Core.fieldTerm = Core.TermUnit}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number int equality true",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number int equality false (different value)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "Number equality false (different variant)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.equal"))),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "int"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}}))})),+ Core.applicationArgument = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = TestTypes.testTypeNumberName,+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "float"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0)))}}))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Reduction.hs view
@@ -0,0 +1,843 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for term reduction/evaluation mechanics++module Hydra.Test.Reduction where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for term reduction mechanics+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "reduction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "beta reduction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity function applied to literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "constant function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "monomorphic primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "toUpper on lowercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "toUpper on mixed case",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Hello World"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO WORLD"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "toUpper on empty string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "toLower on uppercase",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "HELLO"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string length",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string length of empty",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "add two positive integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "add negative and positive",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-10))))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-7))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "add with zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "subtract integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiply integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiply by zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "divide integers",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "modulo",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 17)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "splitOn basic",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a,b,c"))})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cat2 strings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "helloworld"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "polymorphic primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "length of integer list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "length of string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "length of empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "length of single element list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralBoolean True)])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "head of integer list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "head of string list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "first"),+ (Core.TermLiteral (Core.LiteralString "second"))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "first"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "last of integer list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "concat two integer lists",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "concat with empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),+ Core.applicationArgument = (Core.TermList [])})),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "reverse integer list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "reverse empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),+ Core.applicationArgument = (Core.TermList [])})),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "nullary primitives",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set has size zero",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.size"))),+ Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty")))})),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "literals as values",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "integer literal is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative integer literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17)))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (-17))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero integer literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string literal is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralString "hello")),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty string literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralString "")),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string with special characters",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralString "hello\nworld\ttab")),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\nworld\ttab"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean true is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean True)),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "boolean false is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean False)),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "float literal is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "negative float literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-2.718)))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 (-2.718))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "zero float literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0))),+ Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.0)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "list reduction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermList []),+ Testing.evaluationTestCaseOutput = (Core.TermList [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of literals is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list with reducible element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermList [+ Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})]),+ Testing.evaluationTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "optional reduction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nothing is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermMaybe Nothing),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe Nothing)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just literal is a value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "just with reducible content",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {+ Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,+ Testing.evaluationTestCaseInput = (Core.TermMaybe (Just (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))),+ Testing.evaluationTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "alpha conversion",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable at top level",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermVariable (Core.Name "x")),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermVariable (Core.Name "y"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "x"))]),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "y"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with different variable is transparent",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "x")),+ (Core.TermVariable (Core.Name "z"))])}))),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "y")),+ (Core.TermVariable (Core.Name "z"))])})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with same variable is opaque",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "x")),+ (Core.TermVariable (Core.Name "z"))])}))),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermVariable (Core.Name "x")),+ (Core.TermVariable (Core.Name "z"))])})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lambda outer variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "b"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lambda shadows outer",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "z"),+ Testing.alphaConversionTestCaseResult = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application with variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application with both variables same",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseAlphaConversion (Testing.AlphaConversionTestCase {+ Testing.alphaConversionTestCaseTerm = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Testing.alphaConversionTestCaseOldVariable = (Core.Name "x"),+ Testing.alphaConversionTestCaseNewVariable = (Core.Name "y"),+ Testing.alphaConversionTestCaseResult = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "y")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "type reduction",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unit type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = Core.TypeUnit,+ Testing.typeReductionTestCaseOutput = Core.TypeUnit})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.typeReductionTestCaseOutput = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "int32 type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.typeReductionTestCaseOutput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity type applied to string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "t"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t"))}))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeReductionTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "constant type ignores argument",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "x"),+ Core.forallTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeBoolean)})),+ Testing.typeReductionTestCaseOutput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested forall first application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "x"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "y"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "x")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "y"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeReductionTestCaseOutput = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "y"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "y"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested forall both applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "x"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "y"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "x")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "y"))}))}))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeReductionTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list type applied",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "a")))})),+ Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.typeReductionTestCaseOutput = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "optional type applied",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTypeReduction (Testing.TypeReductionTestCase {+ Testing.typeReductionTestCaseInput = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a")))})),+ Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.typeReductionTestCaseOutput = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Rewriting.hs view
@@ -0,0 +1,3973 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for term rewriting operations++module Hydra.Test.Rewriting where++import qualified Hydra.Coders as Coders+import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for term rewriting operations+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "rewriting",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "freeVariables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string literal has no free variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermLiteral (Core.LiteralString "foo")),+ Testing.freeVariablesTestCaseOutput = S.empty})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermVariable (Core.Name "x")),+ Testing.freeVariablesTestCaseOutput = (S.fromList [+ Core.Name "x"])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bound variable is not free",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Testing.freeVariablesTestCaseOutput = S.empty})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unbound variable in lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.freeVariablesTestCaseOutput = (S.fromList [+ Core.Name "x"])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed free and bound variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))]),+ Testing.freeVariablesTestCaseOutput = (S.fromList [+ Core.Name "x"])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple free variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFreeVariables (Testing.FreeVariablesTestCase {+ Testing.freeVariablesTestCaseInput = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))]),+ Testing.freeVariablesTestCaseOutput = (S.fromList [+ Core.Name "x",+ (Core.Name "y")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "simplifyTerm",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "const application with literal",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSimplifyTerm (Testing.SimplifyTermTestCase {+ Testing.simplifyTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.simplifyTermTestCaseOutput = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "identity application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSimplifyTerm (Testing.SimplifyTermTestCase {+ Testing.simplifyTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "x"))])}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Testing.simplifyTermTestCaseOutput = (Core.TermList [+ Core.TermVariable (Core.Name "y"),+ (Core.TermVariable (Core.Name "y"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unused parameter",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSimplifyTerm (Testing.SimplifyTermTestCase {+ Testing.simplifyTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Testing.simplifyTermTestCaseOutput = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lambda applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSimplifyTerm (Testing.SimplifyTermTestCase {+ Testing.simplifyTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "a"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermVariable (Core.Name "a"))])}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))})),+ Testing.simplifyTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermVariable (Core.Name "y"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "flattenLetTerms",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-let term unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFlattenLetTerms (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.flattenLetTermsTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list term unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFlattenLetTerms (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")]),+ Testing.flattenLetTermsTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sequential lets in body are flattened",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFlattenLetTerms (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])}))})),+ Testing.flattenLetTermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested binding in let value is flattened",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFlattenLetTerms (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "b"))])})),+ Testing.flattenLetTermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "b_x"),+ (Core.TermVariable (Core.Name "b_y"))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "b"))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple levels of nesting are flattened",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFlattenLetTerms (Testing.FlattenLetTermsTestCase {+ Testing.flattenLetTermsTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "p"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "q"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "q"))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "b"))])})),+ Testing.flattenLetTermsTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_y_p"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_y_q"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "b_x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b_y"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "b_y_q"))]),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermList [+ Core.TermVariable (Core.Name "b_x"),+ (Core.TermVariable (Core.Name "b_y"))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "b"))])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "liftLambdaAboveLet",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple let with lambda in body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare lambda unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare let unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with let in body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with two nested lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda inside let body already above let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))}))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let without lambda in body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermPair (Core.TermVariable (Core.Name "x"), (Core.TermVariable (Core.Name "y"))))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple let bindings with lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested lets with lambda at innermost level",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda between two lets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "hello")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple lambdas between nested lets",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "a"))}))})))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "a"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "b"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "a"))}))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple lambdas already above let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))}))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation above let containing lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation above lambda in let body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Core.annotatedTermAnnotation = M.empty}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation between two lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty}))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Core.annotatedTermAnnotation = M.empty}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation on the body of lambda in let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermVariable (Core.Name "x")),+ Core.annotatedTermAnnotation = M.empty}))})))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermVariable (Core.Name "x")),+ Core.annotatedTermAnnotation = M.empty}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotation on lambda already above let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda inside a list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda in multiple list elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermList [+ Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}),+ (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))}))]),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda in a let binding value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))})),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "f"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda inside a pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermPair (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}), (Core.TermLiteral (Core.LiteralString "test")))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})), (Core.TermLiteral (Core.LiteralString "test"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda in both elements of a pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermPair (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}), (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))})))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})), (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "w"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "z"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "z"))}))})))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let-lambda inside lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseLiftLambdaAboveLet (Testing.LiftLambdaAboveLetTestCase {+ Testing.liftLambdaAboveLetTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inner"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))}))),+ Testing.liftLambdaAboveLetTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "outer"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "inner"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "deannotateTerm",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated literal unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.deannotateTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated variable unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermVariable (Core.Name "x")),+ Testing.deannotateTermTestCaseOutput = (Core.TermVariable (Core.Name "x"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated lambda unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.deannotateTermTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single annotation stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.deannotateTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested annotations stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Core.annotatedTermAnnotation = M.empty})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.deannotateTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated lambda stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.deannotateTermTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated application stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateTerm (Testing.DeannotateTermTestCase {+ Testing.deannotateTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.deannotateTermTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "deannotateType",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated primitive type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated string type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unannotated function type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single annotation stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.annotatedTypeAnnotation = M.empty})),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested annotations stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeLiteral Core.LiteralTypeString),+ Core.annotatedTypeAnnotation = M.empty})),+ Core.annotatedTypeAnnotation = M.empty})),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated list type stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.annotatedTypeAnnotation = M.empty})),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "annotated function type stripped",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseDeannotateType (Testing.DeannotateTypeTestCase {+ Testing.deannotateTypeTestCaseInput = (Core.TypeAnnotated (Core.AnnotatedType {+ Core.annotatedTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.annotatedTypeAnnotation = M.empty})),+ Testing.deannotateTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "topologicalSortBindings",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "isolated bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortBindings (Testing.TopologicalSortBindingsTestCase {+ Testing.topologicalSortBindingsTestCaseBindings = [+ (Core.Name "a", (Core.TermLiteral (Core.LiteralString "foo"))),+ (Core.Name "b", (Core.TermLiteral (Core.LiteralString "bar")))],+ Testing.topologicalSortBindingsTestCaseExpected = [+ [+ (Core.Name "a", (Core.TermLiteral (Core.LiteralString "foo")))],+ [+ (Core.Name "b", (Core.TermLiteral (Core.LiteralString "bar")))]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single recursive binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortBindings (Testing.TopologicalSortBindingsTestCase {+ Testing.topologicalSortBindingsTestCaseBindings = [+ (Core.Name "a", (Core.TermList [+ Core.TermVariable (Core.Name "a")]))],+ Testing.topologicalSortBindingsTestCaseExpected = [+ [+ (Core.Name "a", (Core.TermList [+ Core.TermVariable (Core.Name "a")]))]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mutually recursive bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortBindings (Testing.TopologicalSortBindingsTestCase {+ Testing.topologicalSortBindingsTestCaseBindings = [+ (Core.Name "a", (Core.TermList [+ Core.TermVariable (Core.Name "b")])),+ (Core.Name "b", (Core.TermList [+ Core.TermVariable (Core.Name "a")]))],+ Testing.topologicalSortBindingsTestCaseExpected = [+ [+ (Core.Name "a", (Core.TermList [+ Core.TermVariable (Core.Name "b")])),+ (Core.Name "b", (Core.TermList [+ Core.TermVariable (Core.Name "a")]))]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "mixed bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortBindings (Testing.TopologicalSortBindingsTestCase {+ Testing.topologicalSortBindingsTestCaseBindings = [+ (Core.Name "a", (Core.TermVariable (Core.Name "b"))),+ (Core.Name "b", (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "c"))])),+ (Core.Name "c", (Core.TermLiteral (Core.LiteralString "foo"))),+ (Core.Name "d", (Core.TermLiteral (Core.LiteralString "bar")))],+ Testing.topologicalSortBindingsTestCaseExpected = [+ [+ (Core.Name "c", (Core.TermLiteral (Core.LiteralString "foo")))],+ [+ (Core.Name "a", (Core.TermVariable (Core.Name "b"))),+ (Core.Name "b", (Core.TermList [+ Core.TermVariable (Core.Name "a"),+ (Core.TermVariable (Core.Name "c"))]))],+ [+ (Core.Name "d", (Core.TermLiteral (Core.LiteralString "bar")))]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "normalizeTypeVariables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "literal without type variables unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple let without type annotations unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with monomorphic type scheme unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with monomorphic binding referencing string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding with free type variable unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "a")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "a")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "monomorphic binding with typed lambda unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic binding with typed lambda in body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "a")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable (Core.Name "a")),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic identity function normalized",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "polymorphic const function normalized",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "const"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a",+ (Core.Name "b")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "const")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "const"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "const")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "binding rewriting does not affect body with typed lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))),+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested polymorphic lets normalized",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested same substitution in bindings and environment",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "parent type variable shadows child variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "no shadowing distinct type variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "b"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "b"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id"),+ Core.bindingTerm = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "id2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t1"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))})),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "id")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "locally free type variable in nested binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseNormalizeTypeVariables (Testing.NormalizeTypeVariablesTestCase {+ Testing.normalizeTypeVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fun1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "a"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "b"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fun2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "c"))),+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "z"), (Core.TermVariable (Core.Name "y"))))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "c"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "c")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "c")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "fun2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "a",+ (Core.Name "b")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "fun1")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.normalizeTypeVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fun1"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t0"))),+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t1"))),+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "fun2"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "z"),+ Core.lambdaDomain = (Just (Core.TypeVariable (Core.Name "t2"))),+ Core.lambdaBody = (Core.TermPair (Core.TermVariable (Core.Name "z"), (Core.TermVariable (Core.Name "y"))))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t2"],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t2")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "fun2")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [+ Core.Name "t0",+ (Core.Name "t1")],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),+ Core.functionTypeCodomain = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "t0")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "t1"))}))}))})),+ Core.typeSchemeConstraints = Nothing}))}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "fun1")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "etaExpandTerm",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "integer literal unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.etaExpansionTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string list unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "bar"))]),+ Testing.etaExpansionTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "bar"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fully applied binary function unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with fully applied primitive unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda returning constant unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare unary primitive unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "bare binary primitive unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn")))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partially applied binary primitive expands to one lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "foo"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "foo"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "projection expands to lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "Person"),+ Core.projectionField = (Core.Name "firstName")})))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = (Core.Name "Person"),+ Core.projectionField = (Core.Name "firstName")})))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partial application inside lambda expands",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),+ Testing.etaExpansionTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with constant body unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with bare primitive value unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "foo"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "foo"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "foo"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fully applied unary unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "FOO"))})),+ Testing.etaExpansionTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "FOO"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "partial application in list expands",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseEtaExpansion (Testing.EtaExpansionTestCase {+ Testing.etaExpansionTestCaseInput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])})),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))]),+ Testing.etaExpansionTestCaseOutput = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo")])})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "v1"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))})),+ Core.applicationArgument = (Core.TermVariable (Core.Name "v1"))}))})))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "foldOverTerm",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect labels from single node - pre-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList []))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectLabels,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect labels from tree - pre-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "b"), (Core.TermList [])),+ (Core.TermPair (Core.TermLiteral (Core.LiteralString "c"), (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "d"), (Core.TermList []))])))]))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectLabels,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a"),+ (Core.TermLiteral (Core.LiteralString "b")),+ (Core.TermLiteral (Core.LiteralString "c")),+ (Core.TermLiteral (Core.LiteralString "d"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect labels from single node - post-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList []))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPost,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectLabels,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "a")])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect labels from tree - post-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "a"), (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "b"), (Core.TermList [])),+ (Core.TermPair (Core.TermLiteral (Core.LiteralString "c"), (Core.TermList [+ Core.TermPair (Core.TermLiteral (Core.LiteralString "d"), (Core.TermList []))])))]))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPost,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectLabels,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "b"),+ (Core.TermLiteral (Core.LiteralString "d")),+ (Core.TermLiteral (Core.LiteralString "c")),+ (Core.TermLiteral (Core.LiteralString "a"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "sum int32 literals",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))}))]),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 52)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect list lengths - pre-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "bar"))],+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "quux")])}))]),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectListLengths,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect list lengths - post-order",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "bar"))],+ (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "quux")])}))]),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPost,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectListLengths,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "rewriteType",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String type in left side of either is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String type in right side of either is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String types in both sides of either are replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String type in nested either (left of left) is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String type in nested either (right of right) is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Core.eitherTypeRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Core.eitherTypeRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String types in complex nested either are all replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.eitherTypeRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))}))})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Core.eitherTypeRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String in list type is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String in function domain is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String in function codomain is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt64)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "String in optional type is replaced",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteType (Testing.RewriteTypeTestCase {+ Testing.rewriteTypeTestCaseInput = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.rewriteTypeTestCaseRewriter = Testing.TypeRewriterReplaceStringWithInt32,+ Testing.rewriteTypeTestCaseOutput = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "rewriteTerm",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string literal foo replaced with bar",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLiteral (Core.LiteralString "foo")),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLiteral (Core.LiteralString "bar"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in variable not changed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermVariable (Core.Name "x")),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermVariable (Core.Name "x"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "baz"))]),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "bar"),+ (Core.TermLiteral (Core.LiteralString "baz"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple strings in list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "foo"),+ (Core.TermLiteral (Core.LiteralString "foo")),+ (Core.TermLiteral (Core.LiteralString "baz"))]),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralString "bar"),+ (Core.TermLiteral (Core.LiteralString "bar")),+ (Core.TermLiteral (Core.LiteralString "baz"))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in optional (just)",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "foo")))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralString "bar"))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in function application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "print")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "print")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))}))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "bar"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in nested applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "g")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in record field",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}]})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Person"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "strings in multiple record fields",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Data"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "a"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))},+ Core.Field {+ Core.fieldName = (Core.Name "b"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "c"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}]})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Data"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "a"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))},+ Core.Field {+ Core.fieldName = (Core.Name "b"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "c"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "foo"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermPair (Core.TermLiteral (Core.LiteralString "bar"), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in let binding value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in let body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in first case branch",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]})))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in second case branch",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}]})))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}]}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in default branch",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "foo"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]})))),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = (Just (Core.TermLiteral (Core.LiteralString "bar"))),+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))},+ Core.Field {+ Core.fieldName = (Core.Name "error"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]}))))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string deeply nested in record in list in application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "process")),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Item"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}]})])})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "process")),+ Core.applicationArgument = (Core.TermList [+ Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Item"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "value"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}]})])}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in union inject value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "Result"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "Result"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "success"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in wrapped term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "Email"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "Email"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in annotated term body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in first of multiple let bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "baz")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "baz")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in second of multiple let bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "baz")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "baz")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "y"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in all let bindings and body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "baz"),+ (Core.TermLiteral (Core.LiteralString "foo"))])),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralString "bar"),+ (Core.TermLiteral (Core.LiteralString "baz"))]))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in type lambda body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermLiteral (Core.LiteralString "bar"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in type application body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermLiteral (Core.LiteralString "foo")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermLiteral (Core.LiteralString "bar")),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in nested type lambdas",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))}))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "b"),+ Core.typeLambdaBody = (Core.TermLiteral (Core.LiteralString "bar"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in case branch within let binding",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "handler"))})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "handler"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "baz"))}]})))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "handler"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "string in annotated wrapped record field",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseRewriteTerm (Testing.RewriteTermTestCase {+ Testing.rewriteTermTestCaseInput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "User"),+ Core.wrappedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "UserData"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}]}))})),+ Core.annotatedTermAnnotation = M.empty})),+ Testing.rewriteTermTestCaseRewriter = Testing.TermRewriterReplaceFooWithBar,+ Testing.rewriteTermTestCaseOutput = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "User"),+ Core.wrappedTermBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "UserData"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "name"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}]}))})),+ Core.annotatedTermAnnotation = M.empty}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "rewriteAndFoldTermWithPath",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through application - sum literals",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through nested applications",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))}))),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through let bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)))])})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through record fields",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Point"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "x"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "y"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 30)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through case branches",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Result"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))},+ Core.Field {+ Core.fieldName = (Core.Name "err"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}]})))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermPair (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)), (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7))))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 12)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermMaybe (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through wrapped term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "Age"),+ Core.wrappedTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 25)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through type lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100)))})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 100)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through type application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 50))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 50)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "path tracking through set elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermSet (S.fromList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "deep nesting - application in lambda in let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "f"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "x")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))}))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationSumInt32Literals,+ Testing.foldOverTermTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 15)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect list lengths in nested structure",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermList [+ Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],+ (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])]),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectListLengths,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "collect list lengths in let body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseFoldOverTerm (Testing.FoldOverTermTestCase {+ Testing.foldOverTermTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "xs"),+ Core.bindingTerm = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.foldOverTermTestCaseTraversalOrder = Coders.TraversalOrderPre,+ Testing.foldOverTermTestCaseOperation = Testing.FoldOperationCollectListLengths,+ Testing.foldOverTermTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "unshadowVariables",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "literal unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermVariable (Core.Name "x")),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermVariable (Core.Name "x"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single lambda unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "distinct lambda parameters unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let with no shadowing unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermVariable (Core.Name "x"))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let and lambda with distinct names unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inner lambda shadows outer lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inner lambda shadows outer - body references both",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))])}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))])})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "triple nested lambda same name",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x3"))})))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two parameters shadow sequentially",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})))})))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x2"),+ (Core.TermVariable (Core.Name "y2"))])})))})))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda shadows let-bound variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda shadows one of multiple let bindings",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing},+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x2"),+ (Core.TermVariable (Core.Name "y"))])})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "inner let body with lambda shadowing outer let",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda in function position of application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "f"))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "f2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "f2"))}))),+ Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambdas in list elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))])}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})),+ (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))])})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda in record field",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Pair"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "fst"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "snd"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Pair"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "fst"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))},+ Core.Field {+ Core.fieldName = (Core.Name "snd"),+ Core.fieldTerm = (Core.TermVariable (Core.Name "x"))}]}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda in case branch",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Maybe"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))},+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}]}))))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {+ Core.caseStatementTypeName = (Core.Name "Maybe"),+ Core.caseStatementDefault = Nothing,+ Core.caseStatementCases = [+ Core.Field {+ Core.fieldName = (Core.Name "nothing"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))},+ Core.Field {+ Core.fieldName = (Core.Name "just"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}]}))))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda in pair",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})), (Core.TermVariable (Core.Name "x"))))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermPair (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})), (Core.TermVariable (Core.Name "x"))))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside optional",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermMaybe (Just (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside set element",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))]))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermSet (S.fromList [+ Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))}))]))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda in union injection",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "Result"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermUnion (Core.Injection {+ Core.injectionTypeName = (Core.Name "Result"),+ Core.injectionField = Core.Field {+ Core.fieldName = (Core.Name "ok"),+ Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside wrapped term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "Age"),+ Core.wrappedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {+ Core.wrappedTermTypeName = (Core.Name "Age"),+ Core.wrappedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside type lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermTypeLambda (Core.TypeLambda {+ Core.typeLambdaParameter = (Core.Name "a"),+ Core.typeLambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))})))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside type application",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermTypeApplication (Core.TypeApplicationTerm {+ Core.typeApplicationTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))}))),+ Core.typeApplicationTermType = (Core.TypeLiteral Core.LiteralTypeString)}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowed lambda inside annotated term",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.annotatedTermAnnotation = M.empty}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermAnnotated (Core.AnnotatedTerm {+ Core.annotatedTermBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))}))),+ Core.annotatedTermAnnotation = M.empty}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "shadowing at multiple depths",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x"),+ (Core.TermVariable (Core.Name "y"))])})))})))})))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "y2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermList [+ Core.TermVariable (Core.Name "x2"),+ (Core.TermVariable (Core.Name "y2"))])})))})))})))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "let then lambda then lambda all same name",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "x"),+ Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x3"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x3"))})))})))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "lambda with shadowing in let binding value",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "y")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermLet (Core.Let {+ Core.letBindings = [+ Core.Binding {+ Core.bindingName = (Core.Name "y"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {+ Core.lambdaParameter = (Core.Name "x2"),+ Core.lambdaDomain = Nothing,+ Core.lambdaBody = (Core.TermVariable (Core.Name "x2"))}))),+ Core.bindingType = Nothing}],+ Core.letBody = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "y")),+ Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "application without shadowing unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermApplication (Core.Application {+ Core.applicationFunction = (Core.TermVariable (Core.Name "f")),+ Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list of literals unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermList [+ Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))),+ (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested record unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnshadowVariables (Testing.UnshadowVariablesTestCase {+ Testing.unshadowVariablesTestCaseInput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Point"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "x"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "y"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]})),+ Testing.unshadowVariablesTestCaseOutput = (Core.TermRecord (Core.Record {+ Core.recordTypeName = (Core.Name "Point"),+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "x"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))},+ Core.Field {+ Core.fieldName = (Core.Name "y"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 20)))}]}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Serialization.hs view
@@ -0,0 +1,174 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for AST serialization++module Hydra.Test.Serialization where++import qualified Hydra.Ast as Ast+import qualified Hydra.Ext.Haskell.Operators as Operators+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for AST serialization+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "serialization",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "associativity",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "right-associative operator",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.arrowOp (Serialization.ifx Operators.arrowOp (Serialization.cst "a") (Serialization.cst "b")) (Serialization.ifx Operators.arrowOp (Serialization.cst "c") (Serialization.cst "d"))),+ Testing.serializationTestCaseOutput = "(a -> b) -> c -> d"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "case statements",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx (Ast.Op {+ Ast.opSymbol = (Ast.Symbol "of"),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsSpace,+ Ast.paddingRight = (Ast.WsBreakAndIndent " ")},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}) (Serialization.spaceSep [+ Serialization.cst "case",+ (Serialization.ifx Operators.gtOp (Serialization.cst "x") (Serialization.num 42))]) (Serialization.newlineSep [+ Serialization.ifx Operators.caseOp (Serialization.cst "False") (Serialization.cst "Big"),+ (Serialization.ifx Operators.caseOp (Serialization.cst "True") (Serialization.cst "Small"))])),+ Testing.serializationTestCaseOutput = "case x > 42 of\n False -> Big\n True -> Small"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested case statement",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx (Ast.Op {+ Ast.opSymbol = (Ast.Symbol "of"),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsSpace,+ Ast.paddingRight = (Ast.WsBreakAndIndent " ")},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}) (Serialization.spaceSep [+ Serialization.cst "case",+ (Serialization.ifx Operators.gtOp (Serialization.cst "x") (Serialization.num 42))]) (Serialization.newlineSep [+ Serialization.ifx Operators.caseOp (Serialization.cst "True") (Serialization.ifx (Ast.Op {+ Ast.opSymbol = (Ast.Symbol "of"),+ Ast.opPadding = Ast.Padding {+ Ast.paddingLeft = Ast.WsSpace,+ Ast.paddingRight = (Ast.WsBreakAndIndent " ")},+ Ast.opPrecedence = (Ast.Precedence 0),+ Ast.opAssociativity = Ast.AssociativityNone}) (Serialization.spaceSep [+ Serialization.cst "case",+ (Serialization.ifx Operators.gtOp (Serialization.cst "x") (Serialization.num 100))]) (Serialization.newlineSep [+ Serialization.ifx Operators.caseOp (Serialization.cst "True") (Serialization.cst "ReallyBig"),+ (Serialization.ifx Operators.caseOp (Serialization.cst "False") (Serialization.cst "Big"))])),+ (Serialization.ifx Operators.caseOp (Serialization.cst "False") (Serialization.cst "Small"))])),+ Testing.serializationTestCaseOutput = "case x > 42 of\n True -> case x > 100 of\n True -> ReallyBig\n False -> Big\n False -> Small"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lambdas",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple lambda",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.lambdaOp (Serialization.cst "\\x y") (Serialization.ifx Operators.plusOp (Serialization.cst "x") (Serialization.cst "y"))),+ Testing.serializationTestCaseOutput = "\\x y -> x + y"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "lists",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.bracketList Serialization.inlineStyle []),+ Testing.serializationTestCaseOutput = "[]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "simple non-empty list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.bracketList Serialization.inlineStyle [+ Serialization.num 1,+ (Serialization.num 2),+ (Serialization.num 3)]),+ Testing.serializationTestCaseOutput = "[1, 2, 3]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.bracketList Serialization.inlineStyle [+ Serialization.bracketList Serialization.inlineStyle [+ Serialization.num 1,+ (Serialization.num 3)],+ (Serialization.num 2)]),+ Testing.serializationTestCaseOutput = "[[1, 3], 2]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "list with parenthesized expression inside",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.bracketList Serialization.inlineStyle [+ Serialization.bracketList Serialization.inlineStyle [+ Serialization.num 1,+ (Serialization.ifx Operators.multOp (Serialization.ifx Operators.plusOp (Serialization.num 2) (Serialization.num 3)) (Serialization.ifx Operators.plusOp (Serialization.num 1) (Serialization.num 10)))],+ (Serialization.num 2)]),+ Testing.serializationTestCaseOutput = "[[1, (2 + 3) * (1 + 10)], 2]"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "precedence",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "operators with different precedence - no parens needed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.plusOp (Serialization.ifx Operators.multOp (Serialization.num 2) (Serialization.num 3)) (Serialization.ifx Operators.multOp (Serialization.num 1) (Serialization.num 10))),+ Testing.serializationTestCaseOutput = "2 * 3 + 1 * 10"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "operators with different precedence - parens needed",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.multOp (Serialization.ifx Operators.plusOp (Serialization.num 2) (Serialization.num 3)) (Serialization.ifx Operators.plusOp (Serialization.num 1) (Serialization.num 10))),+ Testing.serializationTestCaseOutput = "(2 + 3) * (1 + 10)"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "associative operator left nesting",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.multOp (Serialization.cst "x") (Serialization.ifx Operators.multOp (Serialization.cst "y") (Serialization.cst "z"))),+ Testing.serializationTestCaseOutput = "x * y * z"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "associative operator right nesting",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSerialization (Testing.SerializationTestCase {+ Testing.serializationTestCaseInput = (Serialization.ifx Operators.multOp (Serialization.ifx Operators.multOp (Serialization.cst "x") (Serialization.cst "y")) (Serialization.cst "z")),+ Testing.serializationTestCaseOutput = "x * y * z"})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Sorting.hs view
@@ -0,0 +1,452 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for topological sorting algorithms++module Hydra.Test.Sorting where++import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for topological sorting+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "sorting",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "topological sort",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [],+ Testing.topologicalSortTestCaseExpected = (Right [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "singleton set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (1, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 1])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "discrete set with multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (3, []),+ (1, []),+ (2, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 1,+ 2,+ 3])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "linked list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (3, [+ 1]),+ (2, [+ 3]),+ (1, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 1,+ 3,+ 2])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "binary tree",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (3, [+ 1,+ 4]),+ (4, [+ 6,+ 2]),+ (1, [+ 5]),+ (2, []),+ (6, []),+ (5, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 5,+ 1,+ 2,+ 6,+ 4,+ 3])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two trees",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (3, [+ 1,+ 4]),+ (5, [+ 6,+ 2]),+ (2, [+ 7]),+ (1, []),+ (4, []),+ (6, []),+ (7, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 1,+ 7,+ 2,+ 4,+ 3,+ 6,+ 5])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "diamond DAG",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (1, [+ 3,+ 4]),+ (3, [+ 2]),+ (4, [+ 2]),+ (2, [+ 5]),+ (5, [])],+ Testing.topologicalSortTestCaseExpected = (Right [+ 5,+ 2,+ 3,+ 4,+ 1])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "two-node cycle",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (1, [+ 2]),+ (2, [+ 1])],+ Testing.topologicalSortTestCaseExpected = (Left [+ [+ 1,+ 2]])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cycle with incoming and outgoing edges",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSort (Testing.TopologicalSortTestCase {+ Testing.topologicalSortTestCaseAdjacencyList = [+ (1, [+ 3]),+ (3, [+ 2]),+ (2, [+ 3,+ 4]),+ (4, [+ 5]),+ (5, [])],+ Testing.topologicalSortTestCaseExpected = (Left [+ [+ 2,+ 3]])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "topological sort SCC",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [],+ Testing.topologicalSortSCCTestCaseExpected = []})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "singleton set",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "discrete set with multiple elements",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (3, []),+ (1, []),+ (2, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1],+ [+ 2],+ [+ 3]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single two-element component #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2]),+ (2, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 2],+ [+ 1]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "single two-element component #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (2, [+ 1]),+ (1, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1],+ [+ 2]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple-element component",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (2, [+ 1,+ 3]),+ (1, [+ 3]),+ (3, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 3],+ [+ 1],+ [+ 2]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cycle of two nodes #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2]),+ (2, [+ 1])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cycle of two nodes #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (2, [+ 1]),+ (1, [+ 2])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cycle of three nodes #1",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2]),+ (2, [+ 3]),+ (3, [+ 1])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2,+ 3]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "cycle of three nodes #2",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (2, [+ 1]),+ (3, [+ 2]),+ (1, [+ 3])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2,+ 3]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple disconnected cycles",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (200, []),+ (100, []),+ (300, []),+ (10, [+ 20]),+ (20, [+ 10]),+ (1, [+ 2]),+ (2, [+ 3]),+ (3, [+ 1])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2,+ 3],+ [+ 10,+ 20],+ [+ 100],+ [+ 200],+ [+ 300]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "complex cycles",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2,+ 3]),+ (2, [+ 3]),+ (3, [+ 1])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 1,+ 2,+ 3]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "chain of three SCCs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2,+ 10]),+ (2, [+ 3]),+ (3, [+ 1]),+ (10, [+ 20]),+ (20, [+ 100,+ 10]),+ (100, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 100],+ [+ 10,+ 20],+ [+ 1,+ 2,+ 3]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "SCCs with dependencies to/from non-SCC nodes",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseTopologicalSortSCC (Testing.TopologicalSortSCCTestCase {+ Testing.topologicalSortSCCTestCaseAdjacencyList = [+ (1, [+ 2,+ 3,+ 10]),+ (2, [+ 3]),+ (3, [+ 1]),+ (10, [+ 20,+ 30]),+ (20, [+ 30]),+ (30, []),+ (100, [+ 200,+ 2]),+ (200, []),+ (300, [+ 100]),+ (1000, []),+ (2000, [])],+ Testing.topologicalSortSCCTestCaseExpected = [+ [+ 30],+ [+ 20],+ [+ 10],+ [+ 1,+ 2,+ 3],+ [+ 200],+ [+ 100],+ [+ 300],+ [+ 1000],+ [+ 2000]]})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/Substitution.hs view
@@ -0,0 +1,206 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for type and term substitution operations++module Hydra.Test.Substitution where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for type and term substitution operations+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "substitution",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "substInType",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "empty substitution returns type unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [],+ Testing.substInTypeTestCaseInput = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.substInTypeTestCaseOutput = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute type variable with int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeVariable (Core.Name "a")),+ Testing.substInTypeTestCaseOutput = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "non-matching variable unchanged",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeVariable (Core.Name "b")),+ Testing.substInTypeTestCaseOutput = (Core.TypeVariable (Core.Name "b"))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in function domain",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.substInTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in function codomain",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Testing.substInTypeTestCaseOutput = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in list element type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeList (Core.TypeVariable (Core.Name "a"))),+ Testing.substInTypeTestCaseOutput = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in optional type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a"))),+ Testing.substInTypeTestCaseOutput = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in pair type both sides",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "a"))})),+ Testing.substInTypeTestCaseOutput = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in either type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "a")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.substInTypeTestCaseOutput = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in map key type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "k", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "k")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.substInTypeTestCaseOutput = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "substitute in set type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeSet (Core.TypeVariable (Core.Name "a"))),+ Testing.substInTypeTestCaseOutput = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "nested substitution in list of pairs",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))),+ Testing.substInTypeTestCaseOutput = (Core.TypeList (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "multiple substitutions",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ (Core.Name "b", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))})),+ Testing.substInTypeTestCaseOutput = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "forAll bound variable not substituted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))],+ Testing.substInTypeTestCaseInput = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Testing.substInTypeTestCaseOutput = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "forAll free variable substituted",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseSubstInType (Testing.SubstInTypeTestCase {+ Testing.substInTypeTestCaseSubstitution = [+ (Core.Name "b", (Core.TypeLiteral Core.LiteralTypeString))],+ Testing.substInTypeTestCaseInput = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))}))})),+ Testing.substInTypeTestCaseOutput = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
src/gen-test/haskell/Hydra/Test/TestGraph.hs view
@@ -1,344 +1,55 @@+-- Note: this is an automatically generated file. Do not edit.+ -- | A module defining the graph used in the test suite. module Hydra.Test.TestGraph where import qualified Hydra.Core as Core+import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Module as Module-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)+import qualified Hydra.Test.TestTerms as TestTerms+import qualified Hydra.Test.TestTypes as TestTypes+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B import qualified Data.Int as I import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S -testTypeLatLonName :: Core.Name-testTypeLatLonName = (Core.Name "LatLon")--testTypeLatLonPolyName :: Core.Name-testTypeLatLonPolyName = (Core.Name "LatLonPoly")--latlonRecord :: (Float -> Float -> Core.Term)-latlonRecord lat lon = (Core.TermRecord (Core.Record {- Core.recordTypeName = testTypeLatLonName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "lat"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 lat)))},- Core.Field {- Core.fieldName = (Core.Name "lon"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 lon)))}]}))--testTypeLatLon :: Core.Type-testTypeLatLon = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeLatLonName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "lat"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "lon"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))--testTypeLatLonPoly :: Core.Type-testTypeLatLonPoly = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeLatLonPolyName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "lat"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "lon"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))}]}))}))--testTypeStringAlias :: Core.Type-testTypeStringAlias = (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = testTypeStringAliasName,- Core.wrappedTypeObject = (Core.TypeLiteral Core.LiteralTypeString)}))--testTypeStringAliasName :: Core.Name-testTypeStringAliasName = (Core.Name "StringTypeAlias")--testTypePolymorphicWrapper :: Core.Type-testTypePolymorphicWrapper = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeWrap (Core.WrappedType {- Core.wrappedTypeTypeName = testTypePolymorphicWrapperName,- Core.wrappedTypeObject = (Core.TypeList (Core.TypeVariable (Core.Name "a")))}))}))--testTypePolymorphicWrapperName :: Core.Name-testTypePolymorphicWrapperName = (Core.Name "PolymorphicWrapper")--testElementArthur :: Core.Binding-testElementArthur = Core.Binding {- Core.bindingName = (Core.Name "firstName"),- Core.bindingTerm = testDataArthur,- Core.bindingType = (Just (Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable testTypePersonName)}))}+testTerms :: (M.Map Core.Name Core.Term)+testTerms = (Maps.fromList [+ (Core.Name "testDataArthur", TestTerms.testDataArthur)]) -testElementFirstName :: Core.Binding-testElementFirstName = Core.Binding {- Core.bindingName = (Core.Name "firstName"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {- Core.projectionTypeName = testTypePersonName,- Core.projectionField = (Core.Name "firstName")})))),- Core.bindingType = (Just (Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable testTypePersonName),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))}+testTypes :: (M.Map Core.Name Core.Type)+testTypes = (Maps.fromList [+ (TestTypes.testTypeBuddyListAName, TestTypes.testTypeBuddyListA),+ (TestTypes.testTypeBuddyListBName, TestTypes.testTypeBuddyListB),+ (TestTypes.testTypeComparisonName, TestTypes.testTypeComparison),+ (TestTypes.testTypeEitherName, TestTypes.testTypeEither),+ (TestTypes.testTypeFlowName, TestTypes.testTypeFlow),+ (TestTypes.testTypeFlowStateName, TestTypes.testTypeFlowState),+ (TestTypes.testTypeHydraLiteralTypeName, TestTypes.testTypeHydraLiteralType),+ (TestTypes.testTypeHydraTypeName, TestTypes.testTypeHydraType),+ (TestTypes.testTypeIntListName, TestTypes.testTypeIntList),+ (TestTypes.testTypeLatLonName, TestTypes.testTypeLatLon),+ (TestTypes.testTypeLatLonPolyName, TestTypes.testTypeLatLonPoly),+ (TestTypes.testTypeListName, TestTypes.testTypeList),+ (TestTypes.testTypeNumberName, TestTypes.testTypeNumber),+ (TestTypes.testTypePersonName, TestTypes.testTypePerson),+ (TestTypes.testTypePersonOrSomethingName, TestTypes.testTypePersonOrSomething),+ (TestTypes.testTypePolymorphicWrapperName, TestTypes.testTypePolymorphicWrapper),+ (TestTypes.testTypeSimpleNumberName, TestTypes.testTypeSimpleNumber),+ (TestTypes.testTypeStringAliasName, TestTypes.testTypeStringAlias),+ (TestTypes.testTypeSymmetricTripleName, TestTypes.testTypeSymmetricTriple),+ (TestTypes.testTypeTimestampName, TestTypes.testTypeTimestamp),+ (TestTypes.testTypeTraceName, TestTypes.testTypeTrace),+ (TestTypes.testTypeTripleName, TestTypes.testTypeTriple),+ (TestTypes.testTypeUnionMonomorphicName, TestTypes.testTypeUnionMonomorphic),+ (TestTypes.testTypeUnionPolymorphicRecursiveName, TestTypes.testTypeUnionPolymorphicRecursive),+ (TestTypes.testTypeUnitName, TestTypes.testTypeUnit)]) testNamespace :: Module.Namespace testNamespace = (Module.Namespace "testGraph") testSchemaNamespace :: Module.Namespace testSchemaNamespace = (Module.Namespace "testSchemaGraph")--testDataArthur :: Core.Term-testDataArthur = (Core.TermRecord (Core.Record {- Core.recordTypeName = testTypePersonName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "firstName"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Arthur"))},- Core.Field {- Core.fieldName = (Core.Name "lastName"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Dent"))},- Core.Field {- Core.fieldName = (Core.Name "age"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}]}))--testTypeBuddyListA :: Core.Type-testTypeBuddyListA = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeBuddyListAName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "head"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "tail"),- Core.fieldTypeType = (Core.TypeOptional (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable testTypeBuddyListBName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))--testTypeBuddyListAName :: Core.Name-testTypeBuddyListAName = (Core.Name "BuddyListA")--testTypeBuddyListB :: Core.Type-testTypeBuddyListB = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeBuddyListBName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "head"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "tail"),- Core.fieldTypeType = (Core.TypeOptional (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable testTypeBuddyListAName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))--testTypeBuddyListBName :: Core.Name-testTypeBuddyListBName = (Core.Name "BuddyListB")--testTypeComparison :: Core.Type-testTypeComparison = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeComparisonName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "lessThan"),- Core.fieldTypeType = Core.TypeUnit},- Core.FieldType {- Core.fieldTypeName = (Core.Name "equalTo"),- Core.fieldTypeType = Core.TypeUnit},- Core.FieldType {- Core.fieldTypeName = (Core.Name "greaterThan"),- Core.fieldTypeType = Core.TypeUnit}]}))--testTypeComparisonName :: Core.Name-testTypeComparisonName = (Core.Name "Comparison")--testTypeIntList :: Core.Type-testTypeIntList = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeIntListName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "head"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "tail"),- Core.fieldTypeType = (Core.TypeOptional (Core.TypeVariable testTypeIntListName))}]}))--testTypeIntListName :: Core.Name-testTypeIntListName = (Core.Name "IntList")--testTypeHydraLiteralType :: Core.Type-testTypeHydraLiteralType = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeHydraLiteralTypeName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "boolean"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "string"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))--testTypeHydraLiteralTypeName :: Core.Name-testTypeHydraLiteralTypeName = (Core.Name "HydraLiteralType")--testTypeHydraType :: Core.Type-testTypeHydraType = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeHydraTypeName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "literal"),- Core.fieldTypeType = (Core.TypeVariable testTypeHydraLiteralTypeName)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "list"),- Core.fieldTypeType = (Core.TypeVariable testTypeHydraTypeName)}]}))--testTypeHydraTypeName :: Core.Name-testTypeHydraTypeName = (Core.Name "HydraType")--testTypeList :: Core.Type-testTypeList = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeListName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "head"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "tail"),- Core.fieldTypeType = (Core.TypeOptional (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable testTypeListName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))--testTypeListName :: Core.Name-testTypeListName = (Core.Name "List")--testTypeNumber :: Core.Type-testTypeNumber = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeNumberName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "int"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "float"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))--testTypeNumberName :: Core.Name-testTypeNumberName = (Core.Name "Number")--testTypePerson :: Core.Type-testTypePerson = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypePersonName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "firstName"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "lastName"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "age"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}]}))--testTypePersonName :: Core.Name-testTypePersonName = (Core.Name "Person")--testTypePersonOrSomething :: Core.Type-testTypePersonOrSomething = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypePersonOrSomethingName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "person"),- Core.fieldTypeType = (Core.TypeVariable testTypePersonName)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "other"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))}]}))}))--testTypePersonOrSomethingName :: Core.Name-testTypePersonOrSomethingName = (Core.Name "PersonOrSomething")--testTypeSimpleNumber :: Core.Type-testTypeSimpleNumber = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeSimpleNumberName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "int"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "float"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))--testTypeSimpleNumberName :: Core.Name-testTypeSimpleNumberName = (Core.Name "SimpleNumber")--testTypeTimestamp :: Core.Type-testTypeTimestamp = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeTimestampName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "unixTimeMillis"),- Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "date"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))--testTypeTimestampName :: Core.Name-testTypeTimestampName = (Core.Name "Timestamp")--testTypeUnionMonomorphic :: Core.Type-testTypeUnionMonomorphic = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeUnionMonomorphicName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "bool"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "string"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "unit"),- Core.fieldTypeType = Core.TypeUnit}]}))--testTypeUnionMonomorphicName :: Core.Name-testTypeUnionMonomorphicName = (Core.Name "UnionMonomorphic")--testTypeUnionPolymorphicRecursive :: Core.Type-testTypeUnionPolymorphicRecursive = (Core.TypeForall (Core.ForallType {- Core.forallTypeParameter = (Core.Name "a"),- Core.forallTypeBody = (Core.TypeUnion (Core.RowType {- Core.rowTypeTypeName = testTypeUnionPolymorphicRecursiveName,- Core.rowTypeFields = [- Core.FieldType {- Core.fieldTypeName = (Core.Name "bool"),- Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},- Core.FieldType {- Core.fieldTypeName = (Core.Name "value"),- Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},- Core.FieldType {- Core.fieldTypeName = (Core.Name "other"),- Core.fieldTypeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable testTypeUnionPolymorphicRecursiveName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}]}))}))--testTypeUnionPolymorphicRecursiveName :: Core.Name-testTypeUnionPolymorphicRecursiveName = (Core.Name "UnionPolymorphicRecursive")--testTypeUnit :: Core.Type-testTypeUnit = (Core.TypeRecord (Core.RowType {- Core.rowTypeTypeName = testTypeUnitName,- Core.rowTypeFields = []}))--testTypeUnitName :: Core.Name-testTypeUnitName = (Core.Name "Unit")
src/gen-test/haskell/Hydra/Test/TestSuite.hs view
@@ -1,10840 +1,81 @@--- | Test cases for primitive functions--module Hydra.Test.TestSuite where--import qualified Hydra.Core as Core-import qualified Hydra.Lib.Maps as Maps-import qualified Hydra.Mantle as Mantle-import qualified Hydra.Test.TestGraph as TestGraph-import qualified Hydra.Testing as Testing-import Prelude hiding (Enum, Ordering, fail, map, pure, sum)-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S--allTests :: Testing.TestGroup-allTests = Testing.TestGroup {- Testing.testGroupName = "All tests",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- formattingTests,- inferenceTests,- primitiveTests],- Testing.testGroupCases = []}--formattingTests :: Testing.TestGroup-formattingTests = Testing.TestGroup {- Testing.testGroupName = "formatting tests",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1 (lower_snake_case -> UPPER_SNAKE_CASE)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",- Testing.caseConversionTestCaseToString = "A_HELLO_WORLD_42_A42_42A_B"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2 (lower_snake_case -> camelCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",- Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3 (lower_snake_case -> PascalCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",- Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4 (lower_snake_case -> lower_snake_case)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseFromString = "a_hello_world_42_a42_42a_b",- Testing.caseConversionTestCaseToString = "a_hello_world_42_a42_42a_b"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5 (UPPER_SNAKE_CASE -> lower_snake_case)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",- Testing.caseConversionTestCaseToString = "a_hello_world_42_a42_42a_b"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6 (UPPER_SNAKE_CASE -> camelCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",- Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#7 (UPPER_SNAKE_CASE -> PascalCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",- Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#8 (UPPER_SNAKE_CASE -> UPPER_SNAKE_CASE)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseFromString = "A_HELLO_WORLD_42_A42_42A_B",- Testing.caseConversionTestCaseToString = "A_HELLO_WORLD_42_A42_42A_B"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#9 (camelCase -> lower_snake_case)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "a_hello_world42_a4242a_b"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#10 (camelCase -> UPPER_SNAKE_CASE)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "A_HELLO_WORLD42_A4242A_B"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#11 (camelCase -> PascalCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#12 (camelCase -> camelCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseFromString = "aHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#13 (PascalCase -> lower_snake_case)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionLowerSnake,- Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "a_hello_world42_a4242a_b"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#14 (PascalCase -> UPPER_SNAKE_CASE)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionUpperSnake,- Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "A_HELLO_WORLD42_A4242A_B"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#15 (PascalCase -> camelCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionCamel,- Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "aHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#16 (PascalCase -> PascalCase)",- Testing.testCaseWithMetadataCase = (Testing.TestCaseCaseConversion (Testing.CaseConversionTestCase {- Testing.caseConversionTestCaseFromConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseToConvention = Mantle.CaseConventionPascal,- Testing.caseConversionTestCaseFromString = "AHelloWorld42A4242aB",- Testing.caseConversionTestCaseToString = "AHelloWorld42A4242aB"})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}--inferenceTests :: Testing.TestGroup-inferenceTests = Testing.TestGroup {- Testing.testGroupName = "Inference tests",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Algebraic terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "List eliminations (folds)",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "List terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "List of strings",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermLiteral (Core.LiteralString "bar"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List of lists of strings",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")],- (Core.TermList [])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Empty list",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List containing an empty list",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermList []]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Lambda producing a polymorphic list",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Lambda producing a list of integers",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List with repeated variables",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x"),- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermVariable (Core.Name "x"))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Map terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermMap (M.fromList [- (Core.TermLiteral (Core.LiteralString "firstName"), (Core.TermLiteral (Core.LiteralString "Arthur"))),- (Core.TermLiteral (Core.LiteralString "lastName"), (Core.TermLiteral (Core.LiteralString "Dent")))])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),- Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermMap (M.fromList [])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),- Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Optional terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional Nothing),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Product terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Empty products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Non-empty, monotyped products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermList [- Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0)),- (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 137.0)))])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "foo"),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermList [- Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0)),- (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 137.0)))])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Polytyped products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermList [],- (Core.TermLiteral (Core.LiteralString "foo"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeVariable (Core.Name "t0")),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermList [])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeList (Core.TypeVariable (Core.Name "t0")))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Pairs",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermList [],- (Core.TermLiteral (Core.LiteralString "foo"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeVariable (Core.Name "t0")),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermList [],- (Core.TermList [])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeVariable (Core.Name "t0")),- (Core.TypeList (Core.TypeVariable (Core.Name "t1")))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Set terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [- Core.TermLiteral (Core.LiteralBoolean True)])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeBoolean))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [- Core.TermSet (S.fromList [])])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSet (Core.TypeSet (Core.TypeVariable (Core.Name "t0"))))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Singleton sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 1,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeLiteral Core.LiteralTypeString])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 1,- Core.sumTerm = (Core.TermList [])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeList (Core.TypeVariable (Core.Name "t0"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Non-singleton sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 2,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeVariable (Core.Name "t0"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 1,- Core.sumSize = 2,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Algorithm W test cases",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "STLC to System F",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "sng"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "sng"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "sng"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "alice"))}))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#7",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "+"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "+")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "+")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#9",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#10",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "xx"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "yy"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "xx"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#11",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "u"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "v"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- Core.Name "t1",- Core.Name "t2",- (Core.Name "t3")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t3"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#12",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "u"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "v"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#13",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "u"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "v"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Expected failures",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Undefined variable",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Basic unbound variables",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermVariable (Core.Name "x"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "y"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Unbound in let expressions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermVariable (Core.Name "y")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermVariable (Core.Name "y")),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "z"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermVariable (Core.Name "z")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "y"))])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Shadowing scope errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "z"))}))})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "z"))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "z"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Unification failure",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Basic type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],- (Core.TermLiteral (Core.LiteralString "foo"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Collection type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],- (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")])]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],- (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")])])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Conditional type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Polymorphic instantiation conflicts",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "cons"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "cons")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "cons")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Invalid application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Non-function application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermLiteral (Core.LiteralString "foo")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermLiteral (Core.LiteralBoolean True)),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 3.14))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Collection application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermList []),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "index"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Primitive misapplication",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.empty"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.empty"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermOptional Nothing),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "value"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermList []),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Self-application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Direct self-application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Indirect self-application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "y")),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "a"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "b")),- Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "b"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "a"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "cycle"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "cycle"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "cycle")),- Core.applicationArgument = (Core.TermVariable (Core.Name "cycle"))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Arity mismatch",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Too many arguments",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 999)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))])})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Wrong argument types with extra args",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.not"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "arg"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Recursive type construction",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Direct recursive types",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermList [- Core.TermVariable (Core.Name "x")]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "x"))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Recursive function types",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "f"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "f")])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Mutually recursive types",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermList [- Core.TermVariable (Core.Name "y")]),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "a"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "b"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "b"),- Core.bindingTerm = (Core.TermVariable (Core.Name "a")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "a"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermList [- Core.TermVariable (Core.Name "g")]),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "f"))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Occur check failures",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Function occur checks",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "h"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "h"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "g"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Mutual occur checks",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "a"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "b")),- Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "b"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "a")),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "a"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "cycle1"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "cycle2")),- Core.applicationArgument = (Core.TermVariable (Core.Name "cycle1"))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "cycle2"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "cycle1")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "cycle1"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Complex occur checks",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "omega"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "omega"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "omega"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "loop"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "loop")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "loop"))}))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "loop"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Type constructor misuse",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "List constructor errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "String constructor errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Math constructor errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Polymorphism violations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Identity function violations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))]),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Constrained polymorphism violations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralString "constant"))])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 2,- Core.tupleProjectionIndex = 0,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 2,- Core.tupleProjectionIndex = 0,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))}))}))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "h"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "h")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "incompatible"))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Higher-order polymorphism violations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "g"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))}))])})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "h"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "h")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "h")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "error"))}))}))})))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Let binding type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Application type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "y"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "result"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "extra"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "g"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "num"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "num")),- Core.applicationArgument = (Core.TermVariable (Core.Name "num"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Collection type mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "list1"),- Core.bindingTerm = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))]),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "list2"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "list1"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "list2"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "nums"),- Core.bindingTerm = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))]),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "mixed"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bad"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "nums"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "mixed"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "pair1"),- Core.bindingTerm = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))]),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "pair2"),- Core.bindingTerm = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "bar"),- (Core.TermVariable (Core.Name "pair1"))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 2,- Core.tupleProjectionIndex = 0,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermVariable (Core.Name "pair2"))}))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Function binding mismatches",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "add"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "badCall"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "add")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "badCall"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Constraint solver edge cases",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Complex constraint propagation",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "complex"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "g"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))})))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "complex")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "a"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "b"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralString "foo"))})))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Fixed point combinators",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "fix"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "fix")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "y")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "rec"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "n"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermVariable (Core.Name "rec"))}))})))})))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "omega"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "omega")),- Core.applicationArgument = (Core.TermVariable (Core.Name "omega"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Constraint cycles",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "a"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "b")),- Core.applicationArgument = (Core.TermVariable (Core.Name "c"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "b"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "c")),- Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "c"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "a")),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "a")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "circular"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "circular"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "circular")),- Core.applicationArgument = (Core.TermVariable (Core.Name "circular"))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Primitive function type errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Logic primitive errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.and"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.or"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not boolean"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Collection primitive errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.maps.lookup"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a map"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.sets.member"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a list"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.fromMaybe"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not optional"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Math primitive errors",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean True))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.div"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mod"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "not a number"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Complex constraint failures",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Multi-level constraint conflicts",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "y"))])})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "a"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "a"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "a"))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "h"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "z"))})))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "h")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "weird"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "weird")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermVariable (Core.Name "y"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])})))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "nested"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "g"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))}))})))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "int_f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "n"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "str_g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "s"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "s"),- (Core.TermLiteral (Core.LiteralString "!"))])}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "nested")),- Core.applicationArgument = (Core.TermVariable (Core.Name "int_f"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "str_g"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Function composition failures",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "triple"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "increment"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "n"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "n"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "stringify"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "s"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "s"),- (Core.TermLiteral (Core.LiteralString "!"))])}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "triple")),- Core.applicationArgument = (Core.TermVariable (Core.Name "increment"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "stringify"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInferenceFailure (Testing.InferenceFailureTestCase {- Testing.inferenceFailureTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "compose"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "g"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "reverse_compose"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "g"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bad"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "compose")),- Core.applicationArgument = (Core.TermVariable (Core.Name "reverse_compose"))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length")))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bad"))}))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Fundamentals",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Lambdas",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Simple lambdas",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 137)))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Nested lambdas",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Nested lambdas with shadowing",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))})))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Let terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Simple",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Empty let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [],- Core.letEnvironment = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Trivial let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Multiple references to a let-bound term",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermList [- Core.TermVariable (Core.Name "foo"),- Core.TermVariable (Core.Name "bar"),- (Core.TermVariable (Core.Name "foo"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Nested let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermList [- Core.TermVariable (Core.Name "foo"),- (Core.TermVariable (Core.Name "bar"))])}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermProduct [- Core.TermVariable (Core.Name "foo"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))]),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "bar"))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "sng"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "bar"))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "quux"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "sng")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "foo"),- (Core.TermProduct [- Core.TermVariable (Core.Name "bar"),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "quux")),- Core.applicationArgument = (Core.TermList [])}))])])}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- (Core.TypeProduct [- Core.TypeList (Core.TypeLiteral Core.LiteralTypeString),- (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))])])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Nested let with shadowing",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "foo"))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralString "foo")),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermVariable (Core.Name "foo")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "bar"),- (Core.TermVariable (Core.Name "foo"))])}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Let-polymorphism",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})])}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermList [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})])}))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "list"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "list")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "list")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))}))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "singleton"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "singleton")),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))])})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeVariable (Core.Name "t0"))]))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabled"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#7",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "fortytwo"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "fortytwo"),- (Core.TermVariable (Core.Name "foo"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#8",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "fortytwo"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "fortytwo"),- (Core.TermVariable (Core.Name "foo"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Recursive and mutually recursive let (@wisnesky's test cases)",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermVariable (Core.Name "y")),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "y"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "y"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeVariable (Core.Name "t1"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "u"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "v"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "v"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "v0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabled"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "plus"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "plus")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "plus")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "z"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "p0"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermVariable (Core.Name "p0"))}),- (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermVariable (Core.Name "p0"))}))])}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "z"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "z"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#7",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "y"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "z"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "w"),- Core.bindingTerm = (Core.TermVariable (Core.Name "z")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermProduct [- Core.TermVariable (Core.Name "w"),- (Core.TermVariable (Core.Name "z"))])])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- Core.Name "t1",- (Core.Name "t2")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}),- (Core.TypeProduct [- Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t2")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t2"))}))])])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Recursive and mutually recursive let with polymorphism",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "g"))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "f")])})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "f")])}))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "g"))}))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "f")])}))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "f"),- (Core.TermVariable (Core.Name "g"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Recursion involving polymorphic functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "b"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermVariable (Core.Name "x")]])})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))})))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "b"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "b"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermVariable (Core.Name "x")]])}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "inst"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralBoolean False))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "rec"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "b0"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "b0"))}))}))})))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "inst"),- (Core.TermVariable (Core.Name "rec"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeBoolean,- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "inst"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "rec"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "inst"),- (Core.TermVariable (Core.Name "rec"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeBoolean,- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "inst1"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "inst2"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "rec"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "rec")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "inst1"),- Core.TermVariable (Core.Name "inst2"),- (Core.TermVariable (Core.Name "rec"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeBoolean,- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermVariable (Core.Name "bar")),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "bar"),- Core.bindingTerm = (Core.TermVariable (Core.Name "foo")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermProduct [- Core.TermVariable (Core.Name "foo"),- (Core.TermVariable (Core.Name "bar"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeVariable (Core.Name "t1"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Literals",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralString "foo")),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean False)),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeBoolean)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 42.0))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Pathological terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Recursion",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermVariable (Core.Name "x")),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeVariable (Core.Name "t0"))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "id"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "weird"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "id")),- Core.applicationArgument = (Core.TermVariable (Core.Name "id"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "id"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "weird"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "f"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "x")),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "x"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t1"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "paradox"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "paradox")),- Core.applicationArgument = (Core.TermVariable (Core.Name "f"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "paradox"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "f"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))}))),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "g"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "g")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Infinite lists",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "self"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "self"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "self"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "self"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "self"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "self"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "self"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "e"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "e"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "self")),- Core.applicationArgument = (Core.TermVariable (Core.Name "e"))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "self")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabled"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "build"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "build")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "build")),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Polymorphism",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Simple lists and optionals",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional Nothing),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Lambdas, lists, and products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- (Core.TermVariable (Core.Name "x"))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeProduct [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeVariable (Core.Name "t0"))])}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})),- (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "y"))})))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))})))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermProduct [- Core.TermVariable (Core.Name "y"),- (Core.TermVariable (Core.Name "x"))])})))}))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeProduct [- Core.TypeVariable (Core.Name "t1"),- (Core.TypeVariable (Core.Name "t0"))])}))})))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Lambdas and application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Primitives and application",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))],- (Core.TermList [])])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Lambdas and primitives",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Mixed expressions with lambdas, constants, and primitive functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Primitives",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Monomorphic primitive functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Polymorphic primitive functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "el"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "el")])}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "el"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermVariable (Core.Name "el"))])}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "lists"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "lists"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#6",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "list"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "list"),- (Core.TermList [])])}))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#7",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "list"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermVariable (Core.Name "list"),- (Core.TermList [])])}))}))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0"))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#8",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "lists"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "lists"))}))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Examples from the Hydra kernel",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Nested let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "hydra.formatting.mapFirstLetter",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "mapping"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "s"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "firstLetter"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "mapping")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "list"))}))}))}))})),- Core.bindingType = Nothing},- Core.Binding {- Core.bindingName = (Core.Name "list"),- Core.bindingTerm = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "s"))}))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "s"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "firstLetter"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "list"))}))}))}))}))}))})))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Nominal terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Case statements",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = TestGraph.testTypeSimpleNumberName,- Core.caseStatementDefault = Nothing,- Core.caseStatementCases = [- Core.Field {- Core.fieldName = (Core.Name "int"),- Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))},- Core.Field {- Core.fieldName = (Core.Name "float"),- Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})))}]})))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable TestGraph.testTypeSimpleNumberName),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationUnion (Core.CaseStatement {- Core.caseStatementTypeName = TestGraph.testTypeUnionMonomorphicName,- Core.caseStatementDefault = Nothing,- Core.caseStatementCases = [- Core.Field {- Core.fieldName = (Core.Name "bool"),- Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean True))})))},- Core.Field {- Core.fieldName = (Core.Name "string"),- Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))},- Core.Field {- Core.fieldName = (Core.Name "unit"),- Core.fieldTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralBoolean False))})))}]})))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable TestGraph.testTypeUnionMonomorphicName),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Projections",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Record eliminations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {- Core.projectionTypeName = TestGraph.testTypePersonName,- Core.projectionField = (Core.Name "firstName")})))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable TestGraph.testTypePersonName),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Records",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Simple records",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeLatLonName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "lat"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},- Core.Field {- Core.fieldName = (Core.Name "lon"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (0-122.4194))))}]})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeLatLonName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeLatLonPolyName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "lat"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},- Core.Field {- Core.fieldName = (Core.Name "lon"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 (0-122.4194))))}]})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeLatLonPolyName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "lon"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeLatLonPolyName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "lat"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 37.7749)))},- Core.Field {- Core.fieldName = (Core.Name "lon"),- Core.fieldTerm = (Core.TermVariable (Core.Name "lon"))}]}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)),- Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeLatLonPolyName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "latlon"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeLatLonPolyName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "lat"),- Core.fieldTerm = (Core.TermVariable (Core.Name "latlon"))},- Core.Field {- Core.fieldName = (Core.Name "lon"),- Core.fieldTerm = (Core.TermVariable (Core.Name "latlon"))}]}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeLatLonPolyName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = TestGraph.testDataArthur,- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypePersonName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Record instances of simply recursive record types",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeIntListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeIntListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeIntListName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeIntListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeIntListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]}))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeIntListName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 43)))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeListName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]}))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeListName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeListName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeListName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Record instances of mutually recursive record types",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeBuddyListAName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeBuddyListBName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]}))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeBuddyListAName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeBuddyListAName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional (Just (Core.TermRecord (Core.Record {- Core.recordTypeName = TestGraph.testTypeBuddyListBName,- Core.recordFields = [- Core.Field {- Core.fieldName = (Core.Name "head"),- Core.fieldTerm = (Core.TermVariable (Core.Name "x"))},- Core.Field {- Core.fieldName = (Core.Name "tail"),- Core.fieldTerm = (Core.TermOptional Nothing)}]}))))}]}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeBuddyListAName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Variant terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Variants",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeTimestampName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "unixTimeMillis"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueUint64 1638200308368)))}})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeTimestampName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeUnionMonomorphicName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "string"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "bar"))}})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeUnionMonomorphicName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Polymorphic and recursive variants",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeUnionPolymorphicRecursiveName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "bool"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralBoolean True))}})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeUnionPolymorphicRecursiveName),- Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeUnionPolymorphicRecursiveName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "value"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "foo"))}})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeUnionPolymorphicRecursiveName),- Core.applicationTypeArgument = (Core.TypeLiteral Core.LiteralTypeString)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "other"),- Core.bindingTerm = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeUnionPolymorphicRecursiveName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "value"),- Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}})),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermUnion (Core.Injection {- Core.injectionTypeName = TestGraph.testTypeUnionPolymorphicRecursiveName,- Core.injectionField = Core.Field {- Core.fieldName = (Core.Name "other"),- Core.fieldTerm = (Core.TermVariable (Core.Name "other"))}}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeApplication (Core.ApplicationType {- Core.applicationTypeFunction = (Core.TypeVariable TestGraph.testTypeUnionPolymorphicRecursiveName),- Core.applicationTypeArgument = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Wrapper introductions and eliminations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Wrapper introductions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = TestGraph.testTypeStringAliasName,- Core.wrappedTermObject = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeVariable TestGraph.testTypeStringAliasName)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "v"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = TestGraph.testTypeStringAliasName,- Core.wrappedTermObject = (Core.TermVariable (Core.Name "v"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeVariable TestGraph.testTypeStringAliasName)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Wrapper eliminations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestGraph.testTypeStringAliasName))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable TestGraph.testTypeStringAliasName),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationWrap TestGraph.testTypeStringAliasName))),- Core.applicationArgument = (Core.TermWrap (Core.WrappedTerm {- Core.wrappedTermTypeName = TestGraph.testTypeStringAliasName,- Core.wrappedTermObject = (Core.TermLiteral (Core.LiteralString "foo"))}))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Simple terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Application terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Function terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Lambdas",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt16 137)))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List eliminations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.foldl"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.add")))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Optional eliminations",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.maybe"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg")))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeOptional (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.maybe"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg")))})),- Core.applicationArgument = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 137)))))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.maybe"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg")))})),- Core.applicationArgument = (Core.TermOptional Nothing)})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.maybe"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.pure")))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0"))),- Core.functionTypeCodomain = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#5",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.optionals.maybe"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x")])})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0"))),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Tuple projections",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 2,- Core.tupleProjectionIndex = 0,- Core.tupleProjectionDomain = Nothing})))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeProduct [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeVariable (Core.Name "t1"))]),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 2,- Core.tupleProjectionIndex = 1,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 1,- Core.tupleProjectionIndex = 0,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermProduct [- Core.TermVariable (Core.Name "x")])}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "t0"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionElimination (Core.EliminationProduct (Core.TupleProjection {- Core.tupleProjectionArity = 3,- Core.tupleProjectionIndex = 2,- Core.tupleProjectionDomain = Nothing})))),- Core.applicationArgument = (Core.TermProduct [- Core.TermVariable (Core.Name "x"),- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Individual terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Literal values",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralString "foo")),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeString)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralBoolean False)),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral Core.LiteralTypeBoolean)}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#4",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 42.0))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Let terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "x"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermVariable (Core.Name "x"))})))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t1")),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "square"),- Core.bindingTerm = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "z"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.mul"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "z"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "z"))}))}))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "f"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.logic.ifElse"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "square")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))}))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermVariable (Core.Name "f")),- Core.applicationArgument = (Core.TermVariable (Core.Name "x"))})),- Core.applicationArgument = (Core.TermVariable (Core.Name "y"))}))}))})))})))})))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))})),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeBoolean),- Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeBoolean)}))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Optionals",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermOptional Nothing),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeOptional (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralString "foo"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Sets",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [- Core.TermLiteral (Core.LiteralBoolean True)])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeBoolean))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSet (S.fromList [- Core.TermSet (S.fromList [])])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSet (Core.TypeSet (Core.TypeVariable (Core.Name "t0"))))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Maps",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermMap (M.fromList [- (Core.TermLiteral (Core.LiteralString "firstName"), (Core.TermLiteral (Core.LiteralString "Arthur"))),- (Core.TermLiteral (Core.LiteralString "lastName"), (Core.TermLiteral (Core.LiteralString "Dent")))])),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),- Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermMap Maps.empty),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0",- (Core.Name "t1")],- Core.typeSchemeType = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),- Core.mapTypeValues = (Core.TypeVariable (Core.Name "t1"))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#3",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "y"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermMap (M.fromList [- (Core.TermVariable (Core.Name "x"), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.1)))),- (Core.TermVariable (Core.Name "y"), (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat64 0.2))))]))})))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeVariable (Core.Name "t0")),- Core.functionTypeCodomain = (Core.TypeMap (Core.MapType {- Core.mapTypeKeys = (Core.TypeVariable (Core.Name "t0")),- Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat64))}))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Let terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Empty let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [],- Core.letEnvironment = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Trivial let",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermLet (Core.Let {- Core.letBindings = [- Core.Binding {- Core.bindingName = (Core.Name "foo"),- Core.bindingTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))),- Core.bindingType = Nothing}],- Core.letEnvironment = (Core.TermVariable (Core.Name "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "List terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "List of strings",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermLiteral (Core.LiteralString "bar"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List of lists of strings",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralString "foo")],- (Core.TermList [])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Empty list",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeVariable (Core.Name "t0")))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List containing an empty list",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermList [- Core.TermList []]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0"))))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Lambda producing a list of integers",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "List with bound variables",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "x"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermList [- Core.TermVariable (Core.Name "x"),- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermVariable (Core.Name "x"))])}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Primitive terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Monomorphic primitive functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.sub"))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Polymorphic primitive functions",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "els"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "els"))}))}))}))),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {- Core.functionTypeDomain = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "t0")))),- Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Product terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Empty product",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct []),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Non-empty monotyped products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermLiteral (Core.LiteralString "foo"),- (Core.TermList [- Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 42.0)),- (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 137.0)))])]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32)))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "Polytyped products",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermProduct [- Core.TermList [],- (Core.TermLiteral (Core.LiteralString "foo"))]),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeProduct [- Core.TypeList (Core.TypeVariable (Core.Name "t0")),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []},- Testing.TestGroup {- Testing.testGroupName = "Sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "Singleton sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 1,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeLiteral Core.LiteralTypeString])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 1,- Core.sumTerm = (Core.TermList [])})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeList (Core.TypeVariable (Core.Name "t0"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]},- Testing.TestGroup {- Testing.testGroupName = "Non-singleton sum terms",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#1",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 0,- Core.sumSize = 2,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeLiteral Core.LiteralTypeString,- (Core.TypeVariable (Core.Name "t0"))])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "#2",- Testing.testCaseWithMetadataCase = (Testing.TestCaseInference (Testing.InferenceTestCase {- Testing.inferenceTestCaseInput = (Core.TermSum (Core.Sum {- Core.sumIndex = 1,- Core.sumSize = 2,- Core.sumTerm = (Core.TermLiteral (Core.LiteralString "foo"))})),- Testing.inferenceTestCaseOutput = Core.TypeScheme {- Core.typeSchemeVariables = [- Core.Name "t0"],- Core.typeSchemeType = (Core.TypeSum [- Core.TypeVariable (Core.Name "t0"),- (Core.TypeLiteral Core.LiteralTypeString)])}})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = [- Testing.Tag "disabledForMinimalInference"]}]}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []}],- Testing.testGroupCases = []}--listPrimitiveTests :: Testing.TestGroup-listPrimitiveTests = Testing.TestGroup {- Testing.testGroupName = "hydra.lib.lists primitives",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "apply",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string transformations",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),- Core.applicationArgument = (Core.TermList [- Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")),- (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "One"),- Core.TermLiteral (Core.LiteralString "Two"),- (Core.TermLiteral (Core.LiteralString "Three"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "ONE"),- Core.TermLiteral (Core.LiteralString "TWO"),- Core.TermLiteral (Core.LiteralString "THREE"),- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty function list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty input list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),- Core.applicationArgument = (Core.TermList [- Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single function",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),- Core.applicationArgument = (Core.TermList [- Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "HELLO")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single input",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.apply"))),- Core.applicationArgument = (Core.TermList [- Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")),- (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower")))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "Test")])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "TEST"),- (Core.TermLiteral (Core.LiteralString "test"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "at",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "first element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "middle element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "last element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list access",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.at"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "bind",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "negation function",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "arg_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "arg_"))}))}))})))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-2))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-3))),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-4))))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "arg_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "arg_"))}))}))})))})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5))])})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "arg_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "arg_"))}))}))})))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-5)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "duplicate elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.bind"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Core.applicationArgument = (Core.TermFunction (Core.FunctionLambda (Core.Lambda {- Core.lambdaParameter = (Core.Name "arg_"),- Core.lambdaDomain = Nothing,- Core.lambdaBody = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg"))),- Core.applicationArgument = (Core.TermVariable (Core.Name "arg_"))}))}))})))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-2))))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "concat",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple non-empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty lists included",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],- Core.TermList [],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [],- Core.TermList [],- (Core.TermList [])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list of lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "concat2",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two non-empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "first list empty",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "second list empty",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "both lists empty",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.concat2"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "c"),- (Core.TermLiteral (Core.LiteralString "d"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- Core.TermLiteral (Core.LiteralString "c"),- (Core.TermLiteral (Core.LiteralString "d"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "cons",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "cons to non-empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "cons to empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "cons negative number",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "cons string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.cons"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "world")])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "drop",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop from beginning",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop zero elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop all elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop more than length",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop from empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "drop negative amount",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.drop"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "elem",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "element present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "element not present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element not present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "duplicate elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string element present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "world"),- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "test"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string element not present",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.elem"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "missing"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "world"),- (Core.TermLiteral (Core.LiteralString "hello"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "group",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "consecutive duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "no duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all same",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))]])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.group"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))]])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "head",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "three element list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "negative numbers",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-2))),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-3))))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.head"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "init",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.init"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "intercalate",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "double zero separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))])})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))])})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list of lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "lists with empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intercalate"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),- Core.applicationArgument = (Core.TermList [- Core.TermList [],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],- (Core.TermList [])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "intersperse",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string interspersion",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "and"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "and"),- Core.TermLiteral (Core.LiteralString "two"),- Core.TermLiteral (Core.LiteralString "and"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "only")])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "only")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "+"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "+"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "number interspersion",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.intersperse"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "last",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "three element list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "negative numbers",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-2))),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-3))))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-3))))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.last"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "length",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "three elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "many elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 7)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 8)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.length"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "map",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string to uppercase",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- (Core.TermLiteral (Core.LiteralString "two"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "ONE"),- (Core.TermLiteral (Core.LiteralString "TWO"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper")))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "HELLO")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "number negation",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.math.neg")))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-2))),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-3))))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "identity function",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.map"))),- Core.applicationArgument = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.equality.identity")))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "nub",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "remove duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "no duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.nub"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "null",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty int list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "non-empty string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.null"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a")])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "pure",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "number element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "negative number",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.pure"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-5))))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-5)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "replicate",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "replicate three times",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "replicate zero times",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "replicate once",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 99))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "replicate string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.replicate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "hello"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "reverse",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.reverse"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "c"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "a"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "safeHead",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "non-empty int list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty int list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermOptional Nothing)})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.evaluationTestCaseOutput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "non-empty string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermOptional (Just (Core.TermLiteral (Core.LiteralString "hello"))))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.safeHead"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermOptional Nothing)})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "singleton",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "number element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "negative number",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "zero",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.singleton"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "sort",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unsorted numbers",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "already sorted",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "reverse sorted",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "duplicates",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string sort",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.sort"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "zebra"),- Core.TermLiteral (Core.LiteralString "apple"),- (Core.TermLiteral (Core.LiteralString "banana"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "apple"),- Core.TermLiteral (Core.LiteralString "banana"),- (Core.TermLiteral (Core.LiteralString "zebra"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "tail",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single element",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.tail"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "take",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take from beginning",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take zero elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take all elements",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take more than length",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take from empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "take negative amount",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.take"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 (0-1))))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "transpose",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "square matrix",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single row",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single column",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))]])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "ragged matrix",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.transpose"))),- Core.applicationArgument = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6)))])])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))],- Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))],- (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 6))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "zip",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "equal length lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralString "a"))],- Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralString "b"))],- (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)),- (Core.TermLiteral (Core.LiteralString "c"))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "first list shorter",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralString "a"))],- (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralString "b"))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "second list shorter",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralString "a"))],- (Core.TermProduct [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)),- (Core.TermLiteral (Core.LiteralString "b"))])])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty first list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty second list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "both empty lists",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.lists.zip"))),- Core.applicationArgument = (Core.TermList [])})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],- Testing.testGroupCases = []}--primitiveTests :: Testing.TestGroup-primitiveTests = Testing.TestGroup {- Testing.testGroupName = "Primitive functions",- Testing.testGroupDescription = (Just "Test cases for primitive functions"),- Testing.testGroupSubgroups = [- listPrimitiveTests,- stringPrimitiveTests],- Testing.testGroupCases = []}--stringPrimitiveTests :: Testing.TestGroup-stringPrimitiveTests = Testing.TestGroup {- Testing.testGroupName = "hydra.lib.strings primitives",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [- Testing.TestGroup {- Testing.testGroupName = "cat",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic concatenation",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "onetwothree"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with empty strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "many empty strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "\241"),- Core.TermLiteral (Core.LiteralString "\19990"),- (Core.TermLiteral (Core.LiteralString "\127757"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "\n"),- Core.TermLiteral (Core.LiteralString "\t"),- (Core.TermLiteral (Core.LiteralString "\r"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numbers as strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "1"),- Core.TermLiteral (Core.LiteralString "2"),- (Core.TermLiteral (Core.LiteralString "3"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "123"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString " "),- Core.TermLiteral (Core.LiteralString " "),- (Core.TermLiteral (Core.LiteralString " "))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString " "))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "mixed content",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "Hello"),- Core.TermLiteral (Core.LiteralString " "),- Core.TermLiteral (Core.LiteralString "World"),- (Core.TermLiteral (Core.LiteralString "!"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "Hello World!"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "cat2",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic concatenation",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "helloworld"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty first string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty second string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "both empty strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello "))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "world"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\19990"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numeric strings",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "123"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "456"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "123456"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.cat2"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\t"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "charAt",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "first character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "middle character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 2)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "last character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 4)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "space character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "newline character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "tab character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.charAt"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\t"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "fromList",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic ascii string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty code point list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 105)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "h i"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 19990)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 127757)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numeric characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 49)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 50)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 51)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "123"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.fromList"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 13)))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "intercalate",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "comma separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one,two,three"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "space separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "abc"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multi-character separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " | "))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "A"),- Core.TermLiteral (Core.LiteralString "B"),- (Core.TermLiteral (Core.LiteralString "C"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "A | B | C"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single item list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "only")])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "only"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty strings in list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ","))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString "a"),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ",a,"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.intercalate"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\128279"))})),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "link1"),- (Core.TermLiteral (Core.LiteralString "link2"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "link1\128279link2"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "length",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 0)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 1)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic word",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "string with spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 11)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 3)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numeric string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "12345"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 5)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "long string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.length"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "this is a longer string for testing"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 35)))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "lines",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single line",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello world")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "two lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\nworld"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "three lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one\ntwo\nthree"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "just newline",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "trailing newline",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\n"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "leading newline",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\nhello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "hello"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple consecutive newlines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.lines"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a\n\nb"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "b"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "null",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean True))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "space only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic word",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "newline only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "tab only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.null"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\t"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralBoolean False))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "splitOn",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "double s in Mississippi",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ss"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "Mi"),- Core.TermLiteral (Core.LiteralString "i"),- (Core.TermLiteral (Core.LiteralString "ippi"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "whole string as separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Mississippi"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "space separated words",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "one two three"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "leading and trailing spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " one two three "))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- Core.TermLiteral (Core.LiteralString "three"),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple consecutive spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " one two three"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "double space separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " "))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString " one two three"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "one two three"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "overlapping pattern aa in aaa",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aa"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "aaa"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "a"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "separator on empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty separator on abc",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "abc"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString "a"),- Core.TermLiteral (Core.LiteralString "b"),- (Core.TermLiteral (Core.LiteralString "c"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "both separator and string empty",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "separator not found",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "x"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "separator at start",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "h"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "ello"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "separator at end",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "o"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hell"),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multiple same separators",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "l"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "he"),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "o"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character string and separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\19990"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello\19990world\19990!"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- Core.TermLiteral (Core.LiteralString "world"),- (Core.TermLiteral (Core.LiteralString "!"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "multi-character separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "ab"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "cabbage"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "c"),- (Core.TermLiteral (Core.LiteralString "bage"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "newline separator",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.splitOn"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n"))})),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "line1\nline2\nline3"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralString "line1"),- Core.TermLiteral (Core.LiteralString "line2"),- (Core.TermLiteral (Core.LiteralString "line3"))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "toList",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermList [])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single character",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 97))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic word",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 101)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 108)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 111)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with space",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "h i"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 104)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 32)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 105)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\19990\127757"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 241)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 19990)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 127757)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numeric string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "123"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 49)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 50)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 51)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toList"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.evaluationTestCaseOutput = (Core.TermList [- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 10)),- Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 9)),- (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 13)))])})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "toLower",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "mixed case sentence",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "One TWO threE"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one two three"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "alphanumeric mixed case",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Abc123"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "abc123"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all uppercase",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "HELLO"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all lowercase",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single uppercase char",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "A"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single lowercase char",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Hello World"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with punctuation",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Hello, World!"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello, world!"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode accented chars",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\209\193\201\205\211\218"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241\225\233\237\243\250"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numbers only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "12345"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "12345"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toLower"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "toUpper",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "mixed case sentence",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "One TWO threE"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "ONE TWO THREE"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "alphanumeric mixed case",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "Abc123"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "ABC123"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all lowercase",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all uppercase",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "HELLO"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty string",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single lowercase char",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "a"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "A"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single uppercase char",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "A"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "A"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with spaces",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello world"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO WORLD"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with punctuation",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "hello, world!"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "HELLO, WORLD!"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode accented chars",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\241\225\233\237\243\250"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\209\193\201\205\211\218"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "numbers only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "12345"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "12345"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "special characters only",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.toUpper"))),- Core.applicationArgument = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\t\r"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]},- Testing.TestGroup {- Testing.testGroupName = "unlines",- Testing.testGroupDescription = Nothing,- Testing.testGroupSubgroups = [],- Testing.testGroupCases = [- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "basic two lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\nworld\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "single line",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello")])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "empty list",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString ""))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "three lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "one"),- Core.TermLiteral (Core.LiteralString "two"),- (Core.TermLiteral (Core.LiteralString "three"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "one\ntwo\nthree\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "with empty lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "hello"),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString "world"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "hello\n\nworld\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "all empty lines",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString ""),- Core.TermLiteral (Core.LiteralString ""),- (Core.TermLiteral (Core.LiteralString ""))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\n\n\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []},- Testing.TestCaseWithMetadata {- Testing.testCaseWithMetadataName = "unicode content",- Testing.testCaseWithMetadataCase = (Testing.TestCaseEvaluation (Testing.EvaluationTestCase {- Testing.evaluationTestCaseEvaluationStyle = Testing.EvaluationStyleEager,- Testing.evaluationTestCaseInput = (Core.TermApplication (Core.Application {- Core.applicationFunction = (Core.TermFunction (Core.FunctionPrimitive (Core.Name "hydra.lib.strings.unlines"))),- Core.applicationArgument = (Core.TermList [- Core.TermLiteral (Core.LiteralString "\241o\241o"),- (Core.TermLiteral (Core.LiteralString "\19990\30028"))])})),- Testing.evaluationTestCaseOutput = (Core.TermLiteral (Core.LiteralString "\241o\241o\n\19990\30028\n"))})),- Testing.testCaseWithMetadataDescription = Nothing,- Testing.testCaseWithMetadataTags = []}]}],+-- Note: this is an automatically generated file. Do not edit.++-- | Hydra's common test suite, which is designed to run identically in each Hydra implementation; the criterion for a true Hydra implementation is that all test cases pass.++module Hydra.Test.TestSuite where++import qualified Hydra.Test.Annotations as Annotations+import qualified Hydra.Test.Checking.All as All+import qualified Hydra.Test.EtaExpansion as EtaExpansion+import qualified Hydra.Test.Formatting as Formatting+import qualified Hydra.Test.Hoisting as Hoisting+import qualified Hydra.Test.Inference.All as All_+import qualified Hydra.Test.Json.Coder as Coder+import qualified Hydra.Test.Json.Parser as Parser+import qualified Hydra.Test.Json.Roundtrip as Roundtrip+import qualified Hydra.Test.Json.Writer as Writer+import qualified Hydra.Test.Lib.Chars as Chars+import qualified Hydra.Test.Lib.Eithers as Eithers+import qualified Hydra.Test.Lib.Equality as Equality+import qualified Hydra.Test.Lib.Flows as Flows+import qualified Hydra.Test.Lib.Lists as Lists+import qualified Hydra.Test.Lib.Literals as Literals+import qualified Hydra.Test.Lib.Logic as Logic+import qualified Hydra.Test.Lib.Maps as Maps+import qualified Hydra.Test.Lib.Math as Math+import qualified Hydra.Test.Lib.Maybes as Maybes+import qualified Hydra.Test.Lib.Pairs as Pairs+import qualified Hydra.Test.Lib.Sets as Sets+import qualified Hydra.Test.Lib.Strings as Strings+import qualified Hydra.Test.Monads as Monads+import qualified Hydra.Test.Reduction as Reduction+import qualified Hydra.Test.Rewriting as Rewriting+import qualified Hydra.Test.Serialization as Serialization+import qualified Hydra.Test.Sorting as Sorting+import qualified Hydra.Test.Substitution as Substitution+import qualified Hydra.Test.Unification as Unification+import qualified Hydra.Testing as Testing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | The group of all common tests+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "common",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Chars.allTests,+ Eithers.allTests,+ Equality.allTests,+ Flows.allTests,+ Lists.allTests,+ Literals.allTests,+ Logic.allTests,+ Maps.allTests,+ Math.allTests,+ Maybes.allTests,+ Pairs.allTests,+ Sets.allTests,+ Strings.allTests,+ Annotations.allTests,+ All.allTests,+ EtaExpansion.allTests,+ Formatting.allTests,+ Hoisting.allTests,+ All_.allTests,+ Coder.allTests,+ Parser.allTests,+ Roundtrip.allTests,+ Writer.allTests,+ Monads.allTests,+ Reduction.allTests,+ Rewriting.allTests,+ Serialization.allTests,+ Sorting.allTests,+ Substitution.allTests,+ Unification.allTests], Testing.testGroupCases = []}
+ src/gen-test/haskell/Hydra/Test/TestTerms.hs view
@@ -0,0 +1,61 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Term definitions for the test suite++module Hydra.Test.TestTerms where++import qualified Hydra.Core as Core+import qualified Hydra.Test.TestTypes as TestTypes+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++latlonRecord :: (Float -> Float -> Core.Term)+latlonRecord lat lon = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypeLatLonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "lat"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 lat)))},+ Core.Field {+ Core.fieldName = (Core.Name "lon"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralFloat (Core.FloatValueFloat32 lon)))}]}))++testDataArthur :: Core.Term+testDataArthur = (Core.TermRecord (Core.Record {+ Core.recordTypeName = TestTypes.testTypePersonName,+ Core.recordFields = [+ Core.Field {+ Core.fieldName = (Core.Name "firstName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Arthur"))},+ Core.Field {+ Core.fieldName = (Core.Name "lastName"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralString "Dent"))},+ Core.Field {+ Core.fieldName = (Core.Name "age"),+ Core.fieldTerm = (Core.TermLiteral (Core.LiteralInteger (Core.IntegerValueInt32 42)))}]}))++testElementArthur :: Core.Binding+testElementArthur = Core.Binding {+ Core.bindingName = (Core.Name "firstName"),+ Core.bindingTerm = testDataArthur,+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.typeSchemeConstraints = Nothing}))}++testElementFirstName :: Core.Binding+testElementFirstName = Core.Binding {+ Core.bindingName = (Core.Name "firstName"),+ Core.bindingTerm = (Core.TermFunction (Core.FunctionElimination (Core.EliminationRecord (Core.Projection {+ Core.projectionTypeName = TestTypes.testTypePersonName,+ Core.projectionField = (Core.Name "firstName")})))),+ Core.bindingType = (Just (Core.TypeScheme {+ Core.typeSchemeVariables = [],+ Core.typeSchemeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable TestTypes.testTypePersonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Core.typeSchemeConstraints = Nothing}))}
+ src/gen-test/haskell/Hydra/Test/TestTypes.hs view
@@ -0,0 +1,496 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Type definitions for the test suite++module Hydra.Test.TestTypes where++import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++testTypeBuddyListA :: Core.Type+testTypeBuddyListA = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeBuddyListAName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "head"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "tail"),+ Core.fieldTypeType = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeBuddyListBName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))++testTypeBuddyListAName :: Core.Name+testTypeBuddyListAName = (Core.Name "BuddyListA")++testTypeBuddyListB :: Core.Type+testTypeBuddyListB = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeBuddyListBName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "head"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "tail"),+ Core.fieldTypeType = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeBuddyListAName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))++testTypeBuddyListBName :: Core.Name+testTypeBuddyListBName = (Core.Name "BuddyListB")++testTypeComparison :: Core.Type+testTypeComparison = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeComparisonName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lessThan"),+ Core.fieldTypeType = Core.TypeUnit},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "equalTo"),+ Core.fieldTypeType = Core.TypeUnit},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "greaterThan"),+ Core.fieldTypeType = Core.TypeUnit}]}))++testTypeComparisonName :: Core.Name+testTypeComparisonName = (Core.Name "Comparison")++testTypeEither :: Core.Type+testTypeEither = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "b"),+ Core.forallTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeEitherName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "left"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "right"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "b"))}]}))}))}))++testTypeEitherName :: Core.Name+testTypeEitherName = (Core.Name "Either")++testTypeFlow :: Core.Type+testTypeFlow = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeFlowName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "value"),+ Core.fieldTypeType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "s")),+ Core.functionTypeCodomain = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeFlowStateName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "s"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}))}]}))}))}))++testTypeFlowName :: Core.Name+testTypeFlowName = (Core.Name "hydra.compute.Flow")++testTypeFlowState :: Core.Type+testTypeFlowState = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "s"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeFlowStateName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "value"),+ Core.fieldTypeType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a")))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "state"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "s"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "trace"),+ Core.fieldTypeType = (Core.TypeVariable testTypeTraceName)}]}))}))}))++testTypeFlowStateName :: Core.Name+testTypeFlowStateName = (Core.Name "hydra.compute.FlowState")++testTypeHydraLiteralType :: Core.Type+testTypeHydraLiteralType = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeHydraLiteralTypeName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "boolean"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "string"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))++testTypeHydraLiteralTypeName :: Core.Name+testTypeHydraLiteralTypeName = (Core.Name "HydraLiteralType")++testTypeHydraType :: Core.Type+testTypeHydraType = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeHydraTypeName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "literal"),+ Core.fieldTypeType = (Core.TypeVariable testTypeHydraLiteralTypeName)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "list"),+ Core.fieldTypeType = (Core.TypeVariable testTypeHydraTypeName)}]}))++testTypeHydraTypeName :: Core.Name+testTypeHydraTypeName = (Core.Name "HydraType")++testTypeIntList :: Core.Type+testTypeIntList = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeIntListName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "head"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "tail"),+ Core.fieldTypeType = (Core.TypeMaybe (Core.TypeVariable testTypeIntListName))}]}))++testTypeIntListName :: Core.Name+testTypeIntListName = (Core.Name "IntList")++testTypeLatLon :: Core.Type+testTypeLatLon = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeLatLonName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lat"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lon"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))++testTypeLatLonName :: Core.Name+testTypeLatLonName = (Core.Name "LatLon")++testTypeLatLonPoly :: Core.Type+testTypeLatLonPoly = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeLatLonPolyName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lat"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lon"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))}]}))}))++testTypeLatLonPolyName :: Core.Name+testTypeLatLonPolyName = (Core.Name "LatLonPoly")++testTypeList :: Core.Type+testTypeList = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeListName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "head"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "tail"),+ Core.fieldTypeType = (Core.TypeMaybe (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeListName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))})))}]}))}))++testTypeListName :: Core.Name+testTypeListName = (Core.Name "List")++testTypeNumber :: Core.Type+testTypeNumber = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeNumberName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))++testTypeNumberName :: Core.Name+testTypeNumberName = (Core.Name "Number")++testTypePerson :: Core.Type+testTypePerson = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypePersonName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "firstName"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "lastName"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "age"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}]}))++testTypePersonName :: Core.Name+testTypePersonName = (Core.Name "Person")++testTypePersonOrSomething :: Core.Type+testTypePersonOrSomething = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypePersonOrSomethingName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "person"),+ Core.fieldTypeType = (Core.TypeVariable testTypePersonName)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "other"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))}]}))}))++testTypePersonOrSomethingName :: Core.Name+testTypePersonOrSomethingName = (Core.Name "PersonOrSomething")++testTypePolymorphicWrapper :: Core.Type+testTypePolymorphicWrapper = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = testTypePolymorphicWrapperName,+ Core.wrappedTypeBody = (Core.TypeList (Core.TypeVariable (Core.Name "a")))}))}))++testTypePolymorphicWrapperName :: Core.Name+testTypePolymorphicWrapperName = (Core.Name "PolymorphicWrapper")++testTypeSimpleNumber :: Core.Type+testTypeSimpleNumber = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeSimpleNumberName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "int"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "float"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeFloat Core.FloatTypeFloat32))}]}))++testTypeSimpleNumberName :: Core.Name+testTypeSimpleNumberName = (Core.Name "SimpleNumber")++testTypeStringAlias :: Core.Type+testTypeStringAlias = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = testTypeStringAliasName,+ Core.wrappedTypeBody = (Core.TypeLiteral Core.LiteralTypeString)}))++testTypeStringAliasName :: Core.Name+testTypeStringAliasName = (Core.Name "StringAlias")++testTypeSymmetricTriple :: Core.Type+testTypeSymmetricTriple = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "v"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "e"),+ Core.forallTypeBody = (Core.TypeWrap (Core.WrappedType {+ Core.wrappedTypeTypeName = testTypeSymmetricTripleName,+ Core.wrappedTypeBody = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeTripleName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "e"))})),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "v"))}))}))}))}))++testTypeSymmetricTripleName :: Core.Name+testTypeSymmetricTripleName = (Core.Name "SymmetricTriple")++testTypeTimestamp :: Core.Type+testTypeTimestamp = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeTimestampName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "unixTimeMillis"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeUint64))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "date"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)}]}))++testTypeTimestampName :: Core.Name+testTypeTimestampName = (Core.Name "Timestamp")++testTypeTrace :: Core.Type+testTypeTrace = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeTraceName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "stack"),+ Core.fieldTypeType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "messages"),+ Core.fieldTypeType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "other"),+ Core.fieldTypeType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral Core.LiteralTypeString)}))}]}))++testTypeTraceName :: Core.Name+testTypeTraceName = (Core.Name "hydra.compute.Trace")++testTypeTriple :: Core.Type+testTypeTriple = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "b"),+ Core.forallTypeBody = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "c"),+ Core.forallTypeBody = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeTripleName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "first"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "second"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "b"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "third"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "c"))}]}))}))}))}))++testTypeTripleName :: Core.Name+testTypeTripleName = (Core.Name "Triple")++testTypeUnionMonomorphic :: Core.Type+testTypeUnionMonomorphic = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeUnionMonomorphicName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bool"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "string"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "unit"),+ Core.fieldTypeType = Core.TypeUnit}]}))++testTypeUnionMonomorphicName :: Core.Name+testTypeUnionMonomorphicName = (Core.Name "UnionMonomorphic")++testTypeUnionPolymorphicRecursive :: Core.Type+testTypeUnionPolymorphicRecursive = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = testTypeUnionPolymorphicRecursiveName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "bool"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeBoolean)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "value"),+ Core.fieldTypeType = (Core.TypeVariable (Core.Name "a"))},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "other"),+ Core.fieldTypeType = (Core.TypeApplication (Core.ApplicationType {+ Core.applicationTypeFunction = (Core.TypeVariable testTypeUnionPolymorphicRecursiveName),+ Core.applicationTypeArgument = (Core.TypeVariable (Core.Name "a"))}))}]}))}))++testTypeUnionPolymorphicRecursiveName :: Core.Name+testTypeUnionPolymorphicRecursiveName = (Core.Name "UnionPolymorphicRecursive")++testTypeUnit :: Core.Type+testTypeUnit = (Core.TypeRecord (Core.RowType {+ Core.rowTypeTypeName = testTypeUnitName,+ Core.rowTypeFields = []}))++testTypeUnitName :: Core.Name+testTypeUnitName = (Core.Name "Unit")++concatType :: Core.Type+concatType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))}))++compareStringsType :: Core.Type+compareStringsType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral Core.LiteralTypeString),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))++eitherStringOrInt8TypeName :: Core.Name+eitherStringOrInt8TypeName = (Core.Name "EitherStringOrInt8")++eitherStringOrInt8Type :: Core.Type+eitherStringOrInt8Type = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = eitherStringOrInt8TypeName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "left"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "right"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8))}]}))++exampleProjectionType :: Core.Type+exampleProjectionType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable testTypePersonName),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)}))++listOfInt8sType :: Core.Type+listOfInt8sType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)))++listOfInt16sType :: Core.Type+listOfInt16sType = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)))++listOfListsOfStringsType :: Core.Type+listOfListsOfStringsType = (Core.TypeList (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)))++listOfSetOfStringsType :: Core.Type+listOfSetOfStringsType = (Core.TypeList (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeString)))++listOfStringsType :: Core.Type+listOfStringsType = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString))++mapOfStringsToIntsType :: Core.Type+mapOfStringsToIntsType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}))++optionalInt8Type :: Core.Type+optionalInt8Type = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt8)))++optionalInt16Type :: Core.Type+optionalInt16Type = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt16)))++optionalStringType :: Core.Type+optionalStringType = (Core.TypeMaybe (Core.TypeLiteral Core.LiteralTypeString))++setOfStringsType :: Core.Type+setOfStringsType = (Core.TypeSet (Core.TypeLiteral Core.LiteralTypeString))++stringOrIntName :: Core.Name+stringOrIntName = (Core.Name "StringOrInt")++stringOrIntType :: Core.Type+stringOrIntType = (Core.TypeUnion (Core.RowType {+ Core.rowTypeTypeName = stringOrIntName,+ Core.rowTypeFields = [+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "left"),+ Core.fieldTypeType = (Core.TypeLiteral Core.LiteralTypeString)},+ Core.FieldType {+ Core.fieldTypeName = (Core.Name "right"),+ Core.fieldTypeType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))}]}))++testTypeName :: Core.Name+testTypeName = (Core.Name "Test")
+ src/gen-test/haskell/Hydra/Test/Unification.hs view
@@ -0,0 +1,635 @@+-- Note: this is an automatically generated file. Do not edit.++-- | Test cases for type unification operations++module Hydra.Test.Unification where++import qualified Hydra.Core as Core+import qualified Hydra.Testing as Testing+import qualified Hydra.Typing as Typing+import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)+import qualified Data.ByteString as B+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++-- | Test cases for type unification operations+allTests :: Testing.TestGroup+allTests = Testing.TestGroup {+ Testing.testGroupName = "unification",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [+ Testing.TestGroup {+ Testing.testGroupName = "variableOccursInType",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in itself",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeVariable (Core.Name "a")),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in different variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeVariable (Core.Name "b")),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in list element type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeList (Core.TypeVariable (Core.Name "a"))),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in list of different type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeList (Core.TypeVariable (Core.Name "b"))),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in function domain",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in function codomain",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in function with different vars",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "c"))})),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in optional type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a"))),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in pair first",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in pair second",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "a"))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in either left",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "a")),+ Core.eitherTypeRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in either right",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "a"))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in map key type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "a")),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in map value type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "a"))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in set type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeSet (Core.TypeVariable (Core.Name "a"))),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in nested list",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeList (Core.TypeList (Core.TypeVariable (Core.Name "a")))),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in list of functions",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeList (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable does not occur in complex type without it",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))})))})),+ Testing.variableOccursInTypeTestCaseExpected = False})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs deep in complex type",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Core.functionTypeCodomain = (Core.TypeMaybe (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral Core.LiteralTypeString),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "a"))})))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in forAll body",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "b"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "b")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "variable occurs in forAll bound position",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseVariableOccursInType (Testing.VariableOccursInTypeTestCase {+ Testing.variableOccursInTypeTestCaseVariable = (Core.Name "a"),+ Testing.variableOccursInTypeTestCaseType = (Core.TypeForall (Core.ForallType {+ Core.forallTypeParameter = (Core.Name "a"),+ Core.forallTypeBody = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "a"))}))})),+ Testing.variableOccursInTypeTestCaseExpected = True})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "unifyTypes",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify identical int32 types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.unifyTypesTestCaseRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify identical string types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.unifyTypesTestCaseRight = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify identical variable types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseRight = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify variable with int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify int32 with variable",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.unifyTypesTestCaseRight = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify two different variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseRight = (Core.TypeVariable (Core.Name "b")),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeVariable (Core.Name "b")))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify list of variables with list of int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeList (Core.TypeVariable (Core.Name "a"))),+ Testing.unifyTypesTestCaseRight = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify identical list types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.unifyTypesTestCaseRight = (Core.TypeList (Core.TypeLiteral Core.LiteralTypeString)),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify function types with variables",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Testing.unifyTypesTestCaseRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ (Core.Name "b", (Core.TypeLiteral Core.LiteralTypeString))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify identical function types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.unifyTypesTestCaseRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify optional types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a"))),+ Testing.unifyTypesTestCaseRight = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify pair types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))})),+ Testing.unifyTypesTestCaseRight = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ (Core.Name "b", (Core.TypeLiteral Core.LiteralTypeString))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify either types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "a")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "b"))})),+ Testing.unifyTypesTestCaseRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ (Core.Name "b", (Core.TypeLiteral Core.LiteralTypeString))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify map types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "k")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "v"))})),+ Testing.unifyTypesTestCaseRight = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "k", (Core.TypeLiteral Core.LiteralTypeString)),+ (Core.Name "v", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify set types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeSet (Core.TypeVariable (Core.Name "a"))),+ Testing.unifyTypesTestCaseRight = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst (M.fromList [+ (Core.Name "a", (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)))])))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "unify unit types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = Core.TypeUnit,+ Testing.unifyTypesTestCaseRight = Core.TypeUnit,+ Testing.unifyTypesTestCaseExpected = (Right (Typing.TypeSubst M.empty))})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail to unify int32 with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.unifyTypesTestCaseRight = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.unifyTypesTestCaseExpected = (Left "cannot unify")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail to unify list with function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.unifyTypesTestCaseRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.unifyTypesTestCaseExpected = (Left "cannot unify")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "occur check: variable with list containing it",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseUnifyTypes (Testing.UnifyTypesTestCase {+ Testing.unifyTypesTestCaseSchemaTypes = [],+ Testing.unifyTypesTestCaseLeft = (Core.TypeVariable (Core.Name "a")),+ Testing.unifyTypesTestCaseRight = (Core.TypeList (Core.TypeVariable (Core.Name "a"))),+ Testing.unifyTypesTestCaseExpected = (Left "appears free")})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]},+ Testing.TestGroup {+ Testing.testGroupName = "joinTypes",+ Testing.testGroupDescription = Nothing,+ Testing.testGroupSubgroups = [],+ Testing.testGroupCases = [+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join identical int32",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.joinTypesTestCaseRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.joinTypesTestCaseExpected = (Right [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join identical string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.joinTypesTestCaseRight = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.joinTypesTestCaseExpected = (Right [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join list types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeList (Core.TypeVariable (Core.Name "a"))),+ Testing.joinTypesTestCaseRight = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join function types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeVariable (Core.Name "a")),+ Core.functionTypeCodomain = (Core.TypeVariable (Core.Name "b"))})),+ Testing.joinTypesTestCaseRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"},+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "b")),+ Typing.typeConstraintRight = (Core.TypeLiteral Core.LiteralTypeString),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join optional types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeMaybe (Core.TypeVariable (Core.Name "a"))),+ Testing.joinTypesTestCaseRight = (Core.TypeMaybe (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join pair types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeVariable (Core.Name "a")),+ Core.pairTypeSecond = (Core.TypeVariable (Core.Name "b"))})),+ Testing.joinTypesTestCaseRight = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"},+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "b")),+ Typing.typeConstraintRight = (Core.TypeLiteral Core.LiteralTypeString),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join either types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeVariable (Core.Name "a")),+ Core.eitherTypeRight = (Core.TypeVariable (Core.Name "b"))})),+ Testing.joinTypesTestCaseRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"},+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "b")),+ Typing.typeConstraintRight = (Core.TypeLiteral Core.LiteralTypeString),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join map types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeVariable (Core.Name "k")),+ Core.mapTypeValues = (Core.TypeVariable (Core.Name "v"))})),+ Testing.joinTypesTestCaseRight = (Core.TypeMap (Core.MapType {+ Core.mapTypeKeys = (Core.TypeLiteral Core.LiteralTypeString),+ Core.mapTypeValues = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "k")),+ Typing.typeConstraintRight = (Core.TypeLiteral Core.LiteralTypeString),+ Typing.typeConstraintComment = "join types; test"},+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "v")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join set types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeSet (Core.TypeVariable (Core.Name "a"))),+ Testing.joinTypesTestCaseRight = (Core.TypeSet (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.joinTypesTestCaseExpected = (Right [+ Typing.TypeConstraint {+ Typing.typeConstraintLeft = (Core.TypeVariable (Core.Name "a")),+ Typing.typeConstraintRight = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Typing.typeConstraintComment = "join types; test"}])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "join unit types",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = Core.TypeUnit,+ Testing.joinTypesTestCaseRight = Core.TypeUnit,+ Testing.joinTypesTestCaseExpected = (Right [])})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail to join int32 with string",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Testing.joinTypesTestCaseRight = (Core.TypeLiteral Core.LiteralTypeString),+ Testing.joinTypesTestCaseExpected = (Left ())})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail to join list with function",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypeList (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))),+ Testing.joinTypesTestCaseRight = (Core.TypeFunction (Core.FunctionType {+ Core.functionTypeDomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.functionTypeCodomain = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32))})),+ Testing.joinTypesTestCaseExpected = (Left ())})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []},+ Testing.TestCaseWithMetadata {+ Testing.testCaseWithMetadataName = "fail to join pair with either",+ Testing.testCaseWithMetadataCase = (Testing.TestCaseJoinTypes (Testing.JoinTypesTestCase {+ Testing.joinTypesTestCaseLeft = (Core.TypePair (Core.PairType {+ Core.pairTypeFirst = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.pairTypeSecond = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.joinTypesTestCaseRight = (Core.TypeEither (Core.EitherType {+ Core.eitherTypeLeft = (Core.TypeLiteral (Core.LiteralTypeInteger Core.IntegerTypeInt32)),+ Core.eitherTypeRight = (Core.TypeLiteral Core.LiteralTypeString)})),+ Testing.joinTypesTestCaseExpected = (Left ())})),+ Testing.testCaseWithMetadataDescription = Nothing,+ Testing.testCaseWithMetadataTags = []}]}],+ Testing.testGroupCases = []}
− src/main/haskell/Hydra/Dsl/Accessors.hs
@@ -1,103 +0,0 @@-module Hydra.Dsl.Accessors where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import Hydra.Accessors--import qualified Data.Map as M-import qualified Data.Maybe as Y---accessorEdge :: TTerm AccessorNode -> TTerm AccessorPath -> TTerm AccessorNode -> TTerm AccessorEdge-accessorEdge source path target = record _AccessorEdge [- _AccessorEdge_source>>: source,- _AccessorEdge_path>>: path,- _AccessorEdge_target>>: target]--accessorEdgeSource = unitVariant _AccessorEdge _AccessorEdge_source-accessorEdgePath = unitVariant _AccessorEdge _AccessorEdge_path-accessorEdgeTarget = unitVariant _AccessorEdge _AccessorEdge_target--accessorGraph :: TTerm [AccessorNode] -> TTerm [AccessorEdge] -> TTerm AccessorGraph-accessorGraph nodes edges = record _AccessorGraph [- _AccessorGraph_nodes>>: nodes,- _AccessorGraph_edges>>: edges]--accessorGraphNodes = unitVariant _AccessorGraph _AccessorGraph_nodes-accessorGraphEdges = unitVariant _AccessorGraph _AccessorGraph_edges--accessorNode :: TTerm Name -> TTerm String -> TTerm String -> TTerm AccessorNode-accessorNode name label id = record _AccessorNode [- _AccessorNode_name>>: name,- _AccessorNode_label>>: label,- _AccessorNode_id>>: id]--accessorNodeName = unitVariant _AccessorNode _AccessorNode_name-accessorNodeLabel = unitVariant _AccessorNode _AccessorNode_label-accessorNodeId = unitVariant _AccessorNode _AccessorNode_id--accessorPath :: TTerm [TermAccessor] -> TTerm AccessorPath-accessorPath path = wrap _AccessorPath path--termAccessorAnnotatedSubject :: TTerm TermAccessor-termAccessorAnnotatedSubject = unitVariant _TermAccessor _TermAccessor_annotatedSubject--termAccessorApplicationFunction :: TTerm TermAccessor-termAccessorApplicationFunction = unitVariant _TermAccessor _TermAccessor_applicationFunction--termAccessorApplicationArgument :: TTerm TermAccessor-termAccessorApplicationArgument = unitVariant _TermAccessor _TermAccessor_applicationArgument--termAccessorLambdaBody :: TTerm TermAccessor-termAccessorLambdaBody = unitVariant _TermAccessor _TermAccessor_lambdaBody--termAccessorUnionCasesDefault :: TTerm TermAccessor-termAccessorUnionCasesDefault = unitVariant _TermAccessor _TermAccessor_unionCasesDefault--termAccessorUnionCasesBranch :: TTerm Name -> TTerm TermAccessor-termAccessorUnionCasesBranch = variant _TermAccessor _TermAccessor_unionCasesBranch--termAccessorLetEnvironment :: TTerm TermAccessor-termAccessorLetEnvironment = unitVariant _TermAccessor _TermAccessor_letEnvironment--termAccessorLetBinding :: TTerm Name -> TTerm TermAccessor-termAccessorLetBinding = variant _TermAccessor _TermAccessor_letBinding--termAccessorListElement :: TTerm Int -> TTerm TermAccessor-termAccessorListElement = variant _TermAccessor _TermAccessor_listElement--termAccessorMapKey :: TTerm Int -> TTerm TermAccessor-termAccessorMapKey = variant _TermAccessor _TermAccessor_mapKey--termAccessorMapValue :: TTerm Int -> TTerm TermAccessor-termAccessorMapValue = variant _TermAccessor _TermAccessor_mapValue--termAccessorOptionalTerm :: TTerm TermAccessor-termAccessorOptionalTerm = unitVariant _TermAccessor _TermAccessor_optionalTerm--termAccessorProductTerm :: TTerm Int -> TTerm TermAccessor-termAccessorProductTerm = variant _TermAccessor _TermAccessor_productTerm--termAccessorRecordField :: TTerm Name -> TTerm TermAccessor-termAccessorRecordField = variant _TermAccessor _TermAccessor_recordField--termAccessorSetElement :: TTerm Int -> TTerm TermAccessor-termAccessorSetElement = variant _TermAccessor _TermAccessor_setElement--termAccessorSumTerm :: TTerm TermAccessor-termAccessorSumTerm = unitVariant _TermAccessor _TermAccessor_sumTerm--termAccessorTypeLambdaBody :: TTerm TermAccessor-termAccessorTypeLambdaBody = unitVariant _TermAccessor _TermAccessor_typeLambdaBody--termAccessorTypeApplicationTerm :: TTerm TermAccessor-termAccessorTypeApplicationTerm = unitVariant _TermAccessor _TermAccessor_typeApplicationTerm--termAccessorInjectionTerm :: TTerm TermAccessor-termAccessorInjectionTerm = unitVariant _TermAccessor _TermAccessor_injectionTerm--termAccessorWrappedTerm :: TTerm TermAccessor-termAccessorWrappedTerm = unitVariant _TermAccessor _TermAccessor_wrappedTerm--unAccessorPath :: TTerm AccessorPath -> TTerm [TermAccessor]-unAccessorPath path = unwrap _AccessorPath @@ path
src/main/haskell/Hydra/Dsl/Annotations.hs view
@@ -6,6 +6,7 @@ import Hydra.Compute import Hydra.Constants import Hydra.Annotations+import Hydra.Dsl.AsType import Hydra.Formatting import Hydra.Dsl.Terms as Terms import qualified Hydra.Dsl.Types as Types@@ -26,52 +27,52 @@ annotMax t = Y.maybe t (`setMaxLength` t) max annotMin t = Y.maybe t (`setMinLength` t) max -boundedList :: Maybe Int -> Maybe Int -> Type -> Type-boundedList min max et = bounded min max $ Types.list et+boundedList :: AsType a => Maybe Int -> Maybe Int -> a -> Type+boundedList min max et = bounded min max $ Types.list (asType et) -boundedMap :: Maybe Int -> Maybe Int -> Type -> Type -> Type-boundedMap min max kt vt = bounded min max $ Types.map kt vt+boundedMap :: (AsType a, AsType b) => Maybe Int -> Maybe Int -> a -> b -> Type+boundedMap min max kt vt = bounded min max $ Types.map (asType kt) (asType vt) -boundedSet :: Maybe Int -> Maybe Int -> Type -> Type-boundedSet min max et = bounded min max $ Types.set et+boundedSet :: AsType a => Maybe Int -> Maybe Int -> a -> Type+boundedSet min max et = bounded min max $ Types.set (asType et) boundedString :: Maybe Int -> Maybe Int -> Type boundedString min max = bounded min max Types.string -deprecated :: Type -> Type-deprecated = setTypeAnnotation key_deprecated (Just $ Terms.boolean True)+deprecated :: AsType a => a -> Type+deprecated = setTypeAnnotation key_deprecated (Just $ Terms.boolean True) . asType -doc :: String -> Type -> Type-doc s = setTypeDescription (Just s)+doc :: AsType a => String -> a -> Type+doc s = setTypeDescription (Just s) . asType -doc70 :: String -> Type -> Type+doc70 :: AsType a => String -> a -> Type doc70 = doc . wrapLine 70 -doc80 :: String -> Type -> Type+doc80 :: AsType a => String -> a -> Type doc80 = doc . wrapLine 80 dataDoc :: String -> Term -> Term dataDoc s = setTermDescription (Just s) -exclude :: Type -> Type-exclude = setTypeAnnotation key_exclude $ Just $ Terms.boolean True+exclude :: AsType a => a -> Type+exclude = setTypeAnnotation key_exclude (Just $ Terms.boolean True) . asType -minLengthList :: Int -> Type -> Type+minLengthList :: AsType a => Int -> a -> Type minLengthList len = boundedList (Just len) Nothing -nonemptyList :: Type -> Type+nonemptyList :: AsType a => a -> Type nonemptyList = minLengthList 1 -nonemptyMap :: Type -> Type -> Type+nonemptyMap :: (AsType a, AsType b) => a -> b -> Type nonemptyMap = boundedMap (Just 1) Nothing -note :: String -> Type -> Type+note :: AsType a => String -> a -> Type note s = doc $ "Note: " ++ s -preserveFieldName :: Type -> Type-preserveFieldName = setTypeAnnotation key_preserveFieldName (Just $ Terms.boolean True)+preserveFieldName :: AsType a => a -> Type+preserveFieldName = setTypeAnnotation key_preserveFieldName (Just $ Terms.boolean True) . asType -see :: String -> Type -> Type+see :: AsType a => String -> a -> Type see s = doc $ "See " ++ s setMaxLength :: Int -> Type -> Type@@ -80,5 +81,5 @@ setMinLength :: Int -> Type -> Type setMinLength m = setTypeAnnotation key_minLength (Just $ Terms.int32 m) -twoOrMoreList :: Type -> Type+twoOrMoreList :: AsType a => a -> Type twoOrMoreList = boundedList (Just 2) Nothing
+ src/main/haskell/Hydra/Dsl/AsTerm.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}++-- | Type class for implicit coercion to TTerm+-- This allows TTerm, TBinding, and String to be used where a TTerm is expected,+-- while preserving phantom type information.++module Hydra.Dsl.AsTerm where++import Hydra.Core+import Hydra.Module+import Hydra.Phantoms+++-- | Type class for implicit coercion to TTerm, preserving phantom types+-- TTerm passes through unchanged, TBinding becomes a variable reference+-- The functional dependency ensures that the input type determines the phantom type+class AsTerm f a | f -> a where+ asTerm :: f -> TTerm a++instance AsTerm (TTerm a) a where+ asTerm = id++instance AsTerm (TBinding a) a where+ asTerm (TBinding name _) = TTerm (TermVariable name)++instance AsTerm String String where+ asTerm s = TTerm $ TermLiteral $ LiteralString s++instance AsTerm Int Int where+ asTerm i = TTerm $ TermLiteral $ LiteralInteger $ IntegerValueInt32 i
+ src/main/haskell/Hydra/Dsl/AsType.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE FlexibleInstances #-}++-- | Type class for implicit coercion to Type+-- This allows Type, Binding, and String to be used where a Type is expected++module Hydra.Dsl.AsType where++import Hydra.Core+import Hydra.Module+++-- | Type class for implicit coercion to Type+-- This allows Type, Binding, and String to be used where a Type is expected+class AsType a where+ asType :: a -> Type++instance AsType Type where+ asType = id++instance AsType Binding where+ asType b = TypeVariable (bindingName b)++instance AsType String where+ asType s = TypeVariable (Name s)
− src/main/haskell/Hydra/Dsl/Ast.hs
@@ -1,189 +0,0 @@-module Hydra.Dsl.Ast where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import Hydra.Ast--import qualified Data.Map as M-import qualified Data.Int as I----- Associativity--associativityNone :: TTerm Associativity-associativityNone = unitVariant _Associativity _Associativity_none--associativityLeft :: TTerm Associativity-associativityLeft = unitVariant _Associativity _Associativity_left--associativityRight :: TTerm Associativity-associativityRight = unitVariant _Associativity _Associativity_right--associativityBoth :: TTerm Associativity-associativityBoth = unitVariant _Associativity _Associativity_both---- BlockStyle--blockStyle :: TTerm (Maybe String) -> TTerm Bool -> TTerm Bool -> TTerm BlockStyle-blockStyle indent newlineBefore newlineAfter = record _BlockStyle [- _BlockStyle_indent >>: indent,- _BlockStyle_newlineBeforeContent >>: newlineBefore,- _BlockStyle_newlineAfterContent >>: newlineAfter]--blockStyleIndent :: TTerm BlockStyle -> TTerm (Maybe String)-blockStyleIndent bs = project _BlockStyle _BlockStyle_indent @@ bs--blockStyleNewlineBeforeContent :: TTerm BlockStyle -> TTerm Bool-blockStyleNewlineBeforeContent bs = project _BlockStyle _BlockStyle_newlineBeforeContent @@ bs--blockStyleNewlineAfterContent :: TTerm BlockStyle -> TTerm Bool-blockStyleNewlineAfterContent bs = project _BlockStyle _BlockStyle_newlineAfterContent @@ bs---- BracketExpr--bracketExpr :: TTerm Brackets -> TTerm Expr -> TTerm BlockStyle -> TTerm BracketExpr-bracketExpr brackets enclosed style = record _BracketExpr [- _BracketExpr_brackets >>: brackets,- _BracketExpr_enclosed >>: enclosed,- _BracketExpr_style >>: style]--bracketExprBrackets :: TTerm BracketExpr -> TTerm Brackets-bracketExprBrackets be = project _BracketExpr _BracketExpr_brackets @@ be--bracketExprEnclosed :: TTerm BracketExpr -> TTerm Expr-bracketExprEnclosed be = project _BracketExpr _BracketExpr_enclosed @@ be--bracketExprStyle :: TTerm BracketExpr -> TTerm BlockStyle-bracketExprStyle be = project _BracketExpr _BracketExpr_style @@ be---- Brackets--brackets :: TTerm Symbol -> TTerm Symbol -> TTerm Brackets-brackets open close = record _Brackets [- _Brackets_open >>: open,- _Brackets_close >>: close]--bracketsOpen :: TTerm Brackets -> TTerm Symbol-bracketsOpen b = project _Brackets _Brackets_open @@ b--bracketsClose :: TTerm Brackets -> TTerm Symbol-bracketsClose b = project _Brackets _Brackets_close @@ b---- Expr (sum type)--exprConst :: TTerm Symbol -> TTerm Expr-exprConst sym = variant _Expr _Expr_const sym--exprIndent :: TTerm IndentedExpression -> TTerm Expr-exprIndent ind = variant _Expr _Expr_indent ind--exprOp :: TTerm OpExpr -> TTerm Expr-exprOp op = variant _Expr _Expr_op op--exprBrackets :: TTerm BracketExpr -> TTerm Expr-exprBrackets be = variant _Expr _Expr_brackets be---- IndentedExpression--indentedExpression :: TTerm IndentStyle -> TTerm Expr -> TTerm IndentedExpression-indentedExpression style expr = record _IndentedExpression [- _IndentedExpression_style >>: style,- _IndentedExpression_expr >>: expr]--indentedExpressionStyle :: TTerm IndentedExpression -> TTerm IndentStyle-indentedExpressionStyle ie = project _IndentedExpression _IndentedExpression_style @@ ie--indentedExpressionExpr :: TTerm IndentedExpression -> TTerm Expr-indentedExpressionExpr ie = project _IndentedExpression _IndentedExpression_expr @@ ie---- IndentStyle (sum type)--indentStyleAllLines :: TTerm String -> TTerm IndentStyle-indentStyleAllLines s = variant _IndentStyle _IndentStyle_allLines s--indentStyleSubsequentLines :: TTerm String -> TTerm IndentStyle-indentStyleSubsequentLines s = variant _IndentStyle _IndentStyle_subsequentLines s---- Op--op :: TTerm Symbol -> TTerm Padding -> TTerm Precedence -> TTerm Associativity -> TTerm Op-op symbol padding precedence associativity = record _Op [- _Op_symbol >>: symbol,- _Op_padding >>: padding,- _Op_precedence >>: precedence,- _Op_associativity >>: associativity]--opSymbol :: TTerm Op -> TTerm Symbol-opSymbol o = project _Op _Op_symbol @@ o--opPadding :: TTerm Op -> TTerm Padding-opPadding o = project _Op _Op_padding @@ o--opPrecedence :: TTerm Op -> TTerm Precedence-opPrecedence o = project _Op _Op_precedence @@ o--opAssociativity :: TTerm Op -> TTerm Associativity-opAssociativity o = project _Op _Op_associativity @@ o---- OpExpr--opExpr :: TTerm Op -> TTerm Expr -> TTerm Expr -> TTerm OpExpr-opExpr op lhs rhs = record _OpExpr [- _OpExpr_op >>: op,- _OpExpr_lhs >>: lhs,- _OpExpr_rhs >>: rhs]--opExprOp :: TTerm OpExpr -> TTerm Op-opExprOp oe = project _OpExpr _OpExpr_op @@ oe--opExprLhs :: TTerm OpExpr -> TTerm Expr-opExprLhs oe = project _OpExpr _OpExpr_lhs @@ oe--opExprRhs :: TTerm OpExpr -> TTerm Expr-opExprRhs oe = project _OpExpr _OpExpr_rhs @@ oe---- Padding--padding :: TTerm Ws -> TTerm Ws -> TTerm Padding-padding left right = record _Padding [- _Padding_left >>: left,- _Padding_right >>: right]--paddingLeft :: TTerm Padding -> TTerm Ws-paddingLeft p = project _Padding _Padding_left @@ p--paddingRight :: TTerm Padding -> TTerm Ws-paddingRight p = project _Padding _Padding_right @@ p---- Precedence (newtype wrapping Int)--precedence :: TTerm I.Int -> TTerm Precedence-precedence = wrap _Precedence--unPrecedence :: TTerm Precedence -> TTerm I.Int-unPrecedence p = unwrap _Precedence @@ p---- Symbol (newtype wrapping String)--symbol :: TTerm String -> TTerm Symbol-symbol = wrap _Symbol--unSymbol :: TTerm Symbol -> TTerm String-unSymbol s = unwrap _Symbol @@ s---- Ws (sum type)--wsNone :: TTerm Ws-wsNone = unitVariant _Ws _Ws_none--wsSpace :: TTerm Ws-wsSpace = unitVariant _Ws _Ws_space--wsBreak :: TTerm Ws-wsBreak = unitVariant _Ws _Ws_break--wsBreakAndIndent :: TTerm String -> TTerm Ws-wsBreakAndIndent s = variant _Ws _Ws_breakAndIndent s--wsDoubleBreak :: TTerm Ws-wsDoubleBreak = unitVariant _Ws _Ws_doubleBreak
src/main/haskell/Hydra/Dsl/Bootstrap.hs view
@@ -1,10 +1,20 @@ -- | A bootstrapping DSL, used for Hydra's inner core models -module Hydra.Dsl.Bootstrap where+module Hydra.Dsl.Bootstrap (+ module Hydra.Dsl.AsType,+ bootstrapGraph,+ datatype,+ qualify,+ typeref,+ defineType,+ use,+ useType,+) where import Hydra.Compute import Hydra.Constants import Hydra.Core+import Hydra.Dsl.AsType import qualified Hydra.Encode.Core as EncodeCore import Hydra.Graph import Hydra.Lexical@@ -50,3 +60,17 @@ typeref :: Namespace -> String -> Type typeref ns = TypeVariable . qualify ns . Name++-- | New DSL helpers (Option 1 from dsl-redesign-options.md)++-- | Define a type in a namespace+defineType :: Namespace -> String -> Type -> Binding+defineType = datatype++-- | Reference a type by its binding+use :: Binding -> Type+use b = TypeVariable (bindingName b)++-- | Reference a type in a namespace (old style, for migration)+useType :: Namespace -> String -> Type+useType = typeref
− src/main/haskell/Hydra/Dsl/Coders.hs
@@ -1,105 +0,0 @@-module Hydra.Dsl.Coders where--import Hydra.Kernel-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.TTypes as T--import qualified Data.Map as M-import qualified Data.Set as S---adapterContext :: TTerm Graph -> TTerm Language -> TTerm (M.Map Name (Adapter AdapterContext AdapterContext Type Type Term Term)) -> TTerm AdapterContext-adapterContext graph language adapters = Phantoms.record _AdapterContext [- _AdapterContext_graph>>: graph,- _AdapterContext_language>>: language,- _AdapterContext_adapters>>: adapters]--adapterContextGraph :: TTerm AdapterContext -> TTerm Graph-adapterContextGraph c = project _AdapterContext _AdapterContext_graph @@ c--adapterContextLanguage :: TTerm AdapterContext -> TTerm Language-adapterContextLanguage c = project _AdapterContext _AdapterContext_language @@ c--adapterContextAdapters :: TTerm AdapterContext -> TTerm (M.Map Name (Adapter AdapterContext AdapterContext Type Type Term Term))-adapterContextAdapters c = project _AdapterContext _AdapterContext_adapters @@ c--coderDirectionEncode :: TTerm CoderDirection-coderDirectionEncode = unitVariant _CoderDirection _CoderDirection_encode--coderDirectionDecode :: TTerm CoderDirection-coderDirectionDecode = unitVariant _CoderDirection _CoderDirection_decode--language :: TTerm LanguageName -> TTerm LanguageConstraints -> TTerm Language-language name constraints = record _Language [- _Language_name>>: name,- _Language_constraints>>: constraints]--languageName :: TTerm String -> TTerm LanguageName-languageName = wrap _LanguageName--unLanguageName :: TTerm LanguageName -> TTerm String-unLanguageName n = unwrap _LanguageName @@ n---- TODO: resolve _Language_name/_LanguageName conflict-languageNameProjection :: TTerm Language -> TTerm LanguageName-languageNameProjection c = project _Language _Language_name @@ c---- TODO: resolve _Language_constraints/LanguageConstraints conflict-languageConstraintsProjection :: TTerm Language -> TTerm LanguageConstraints-languageConstraintsProjection c = project _Language _Language_constraints @@ c--languageConstraints :: TTerm (S.Set EliminationVariant)- -> TTerm (S.Set LiteralVariant)- -> TTerm (S.Set FloatType)- -> TTerm (S.Set FunctionVariant)- -> TTerm (S.Set IntegerType)- -> TTerm (S.Set TermVariant)- -> TTerm (S.Set TypeVariant)- -> TTerm (Type -> Bool)- -> TTerm LanguageConstraints-languageConstraints eliminationVariants- literalVariants- floatTypes- functionVariants- integerTypes- termVariants- typeVariants- types = record _LanguageConstraints [- _LanguageConstraints_eliminationVariants>>: eliminationVariants,- _LanguageConstraints_literalVariants>>: literalVariants,- _LanguageConstraints_floatTypes>>: floatTypes,- _LanguageConstraints_functionVariants>>: functionVariants,- _LanguageConstraints_integerTypes>>: integerTypes,- _LanguageConstraints_termVariants>>: termVariants,- _LanguageConstraints_typeVariants>>: typeVariants,- _LanguageConstraints_types>>: types]--languageConstraintsEliminationVariants :: TTerm LanguageConstraints -> TTerm (S.Set EliminationVariant)-languageConstraintsEliminationVariants lc = project _LanguageConstraints _LanguageConstraints_eliminationVariants @@ lc--languageConstraintsLiteralVariants :: TTerm LanguageConstraints -> TTerm (S.Set LiteralVariant)-languageConstraintsLiteralVariants lc = project _LanguageConstraints _LanguageConstraints_literalVariants @@ lc--languageConstraintsFloatTypes :: TTerm LanguageConstraints -> TTerm (S.Set FloatType)-languageConstraintsFloatTypes lc = project _LanguageConstraints _LanguageConstraints_floatTypes @@ lc--languageConstraintsFunctionVariants :: TTerm LanguageConstraints -> TTerm (S.Set FunctionVariant)-languageConstraintsFunctionVariants lc = project _LanguageConstraints _LanguageConstraints_functionVariants @@ lc--languageConstraintsIntegerTypes :: TTerm LanguageConstraints -> TTerm (S.Set IntegerType)-languageConstraintsIntegerTypes lc = project _LanguageConstraints _LanguageConstraints_integerTypes @@ lc--languageConstraintsTermVariants :: TTerm LanguageConstraints -> TTerm (S.Set TermVariant)-languageConstraintsTermVariants lc = project _LanguageConstraints _LanguageConstraints_termVariants @@ lc--languageConstraintsTypeVariants :: TTerm LanguageConstraints -> TTerm (S.Set TypeVariant)-languageConstraintsTypeVariants lc = project _LanguageConstraints _LanguageConstraints_typeVariants @@ lc--languageConstraintsTypes :: TTerm LanguageConstraints -> TTerm (Type -> Bool)-languageConstraintsTypes lc = project _LanguageConstraints _LanguageConstraints_types @@ lc--traversalOrderPre = unitVariant _TraversalOrder _TraversalOrder_pre-traversalOrderPost = unitVariant _TraversalOrder _TraversalOrder_post
− src/main/haskell/Hydra/Dsl/Common.hs
@@ -1,13 +0,0 @@-{-# LANGUAGE FlexibleInstances #-}--module Hydra.Dsl.Common where--import Hydra.Core-import Hydra.Phantoms--import Data.String(IsString(..))---instance IsString Type where fromString = TypeVariable . Name-instance IsString Term where fromString = TermLiteral . LiteralString-instance IsString (TTerm a) where fromString = TTerm . TermLiteral . LiteralString
− src/main/haskell/Hydra/Dsl/Compute.hs
@@ -1,95 +0,0 @@-module Hydra.Dsl.Compute where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import qualified Hydra.Dsl.Core as Core--import qualified Data.Map as M-import qualified Data.Maybe as Y---adapter :: TTerm Bool -> TTerm t1 -> TTerm t2 -> TTerm (Coder s1 s2 v1 v2) -> TTerm (Adapter s1 s2 t1 t2 v1 v2)-adapter isLossy source target coder = record _Adapter [- _Adapter_isLossy>>: isLossy,- _Adapter_source>>: source,- _Adapter_target>>: target,- _Adapter_coder>>: coder]--adapterIsLossy :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm Bool-adapterIsLossy a = project _Adapter _Adapter_isLossy @@ a--adapterSource :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t1-adapterSource a = project _Adapter _Adapter_source @@ a--adapterTarget :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t2-adapterTarget a = project _Adapter _Adapter_target @@ a--adapterCoder :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm (Coder s1 s2 v1 v2)-adapterCoder a = project _Adapter _Adapter_coder @@ a--adapterWithCoder :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm (Coder s1 s2 v1 v2) -> TTerm (Adapter s1 s2 t1 t2 v1 v2)-adapterWithCoder a coder = adapter- (Hydra.Dsl.Compute.adapterIsLossy a)- (Hydra.Dsl.Compute.adapterSource a)- (Hydra.Dsl.Compute.adapterTarget a)- coder--adapterWithTarget :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t2 -> TTerm (Adapter s1 s2 t1 t2 v1 v2)-adapterWithTarget a target = adapter- (Hydra.Dsl.Compute.adapterIsLossy a)- (Hydra.Dsl.Compute.adapterSource a)- target- (Hydra.Dsl.Compute.adapterCoder a)--coder :: TTerm (v1 -> Flow s1 v2) -> TTerm (v2 -> Flow s2 v1) -> TTerm (Coder s1 s2 v1 v2)-coder encode decode = record _Coder [- _Coder_encode>>: encode,- _Coder_decode>>: decode]--coderEncode :: TTerm (Coder s1 s2 v1 v2) -> TTerm (v1 -> Flow s1 v2)-coderEncode c = project _Coder _Coder_encode @@ c--coderDecode :: TTerm (Coder s1 s2 v1 v2) -> TTerm (v2 -> Flow s2 v1)-coderDecode c = project _Coder _Coder_decode @@ c--flow :: TTerm (s -> Trace -> FlowState s v) -> TTerm (Flow s v)-flow = wrap _Flow--flowState :: TTerm (Maybe x) -> TTerm s -> TTerm Trace -> TTerm (FlowState s x)-flowState value state trace = record _FlowState [- _FlowState_value>>: value,- _FlowState_state>>: state,- _FlowState_trace>>: trace]--flowStateState :: TTerm (FlowState s x) -> TTerm s-flowStateState fs = project _FlowState _FlowState_state @@ fs--flowStateTrace :: TTerm (FlowState s x) -> TTerm Trace-flowStateTrace fs = project _FlowState _FlowState_trace @@ fs--flowStateValue :: TTerm (FlowState s x) -> TTerm (Maybe x)-flowStateValue fs = project _FlowState _FlowState_value @@ fs--trace :: TTerm [String] -> TTerm [String] -> TTerm (M.Map Name Term) -> TTerm Trace-trace stack messages other = record _Trace [- _Trace_stack>>: stack,- _Trace_messages>>: messages,- _Trace_other>>: other]--traceStack :: TTerm Trace -> TTerm [String]-traceStack t = project _Trace _Trace_stack @@ t--traceMessages :: TTerm Trace -> TTerm [String]-traceMessages t = project _Trace _Trace_messages @@ t--traceOther :: TTerm Trace -> TTerm (M.Map Name Term)-traceOther t = project _Trace _Trace_other @@ t--traceWithOther :: TTerm Trace -> TTerm (M.Map Name Term) -> TTerm Trace-traceWithOther t other = record _Trace [- _Trace_stack>>: Hydra.Dsl.Compute.traceStack t,- _Trace_messages>>: Hydra.Dsl.Compute.traceMessages t,- _Trace_other>>: other]--unFlow :: TTerm (Flow s x) -> TTerm s -> TTerm Trace -> TTerm (FlowState s x)-unFlow f s t = unwrap _Flow @@ f @@ s @@ t
− src/main/haskell/Hydra/Dsl/Core.hs
@@ -1,575 +0,0 @@-module Hydra.Dsl.Core where--import Hydra.Kernel-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Terms as Terms---- For helpers-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Logic as Logic-import Hydra.Sources.Libraries--import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y-import Data.Int-import Prelude hiding (map, product, sum)---annotatedTerm :: TTerm Term -> TTerm (M.Map Name Term) -> TTerm AnnotatedTerm-annotatedTerm subject annotation = Phantoms.record _AnnotatedTerm [- _AnnotatedTerm_subject>>: subject,- _AnnotatedTerm_annotation>>: annotation]--annotatedTermSubject :: TTerm AnnotatedTerm -> TTerm Term-annotatedTermSubject at = Phantoms.project _AnnotatedTerm _AnnotatedTerm_subject @@ at--annotatedTermAnnotation :: TTerm AnnotatedTerm -> TTerm (M.Map Name Term)-annotatedTermAnnotation at = Phantoms.project _AnnotatedTerm _AnnotatedTerm_annotation @@ at--annotatedType :: TTerm Type -> TTerm (M.Map Name Term) -> TTerm AnnotatedType-annotatedType subject annotation = Phantoms.record _AnnotatedType [- _AnnotatedType_subject>>: subject,- _AnnotatedType_annotation>>: annotation]--annotatedTypeSubject :: TTerm AnnotatedType -> TTerm Type-annotatedTypeSubject at = Phantoms.project _AnnotatedType _AnnotatedType_subject @@ at--annotatedTypeAnnotation :: TTerm AnnotatedType -> TTerm (M.Map Name Term)-annotatedTypeAnnotation at = Phantoms.project _AnnotatedType _AnnotatedType_annotation @@ at--application :: TTerm Term -> TTerm Term -> TTerm Application-application function argument = Phantoms.record _Application [- _Application_function>>: function,- _Application_argument>>: argument]--applicationFunction :: TTerm Application -> TTerm Term-applicationFunction app = Phantoms.project _Application _Application_function @@ app--applicationArgument :: TTerm Application -> TTerm Term-applicationArgument app = Phantoms.project _Application _Application_argument @@ app--applicationType :: TTerm Type -> TTerm Type -> TTerm ApplicationType-applicationType function argument = Phantoms.record _ApplicationType [- _ApplicationType_function>>: function,- _ApplicationType_argument>>: argument]--applicationTypeFunction :: TTerm ApplicationType -> TTerm Type-applicationTypeFunction app = Phantoms.project _ApplicationType _ApplicationType_function @@ app--applicationTypeArgument :: TTerm ApplicationType -> TTerm Type-applicationTypeArgument app = Phantoms.project _ApplicationType _ApplicationType_argument @@ app--caseStatement :: TTerm Name -> TTerm (Maybe Term) -> TTerm [Field] -> TTerm CaseStatement-caseStatement typeName defaultTerm cases = Phantoms.record _CaseStatement [- _CaseStatement_typeName>>: typeName,- _CaseStatement_default>>: defaultTerm,- _CaseStatement_cases>>: cases]--caseStatementTypeName :: TTerm CaseStatement -> TTerm Name-caseStatementTypeName cs = Phantoms.project _CaseStatement _CaseStatement_typeName @@ cs--caseStatementDefault :: TTerm CaseStatement -> TTerm (Maybe Term)-caseStatementDefault cs = Phantoms.project _CaseStatement _CaseStatement_default @@ cs--caseStatementCases :: TTerm CaseStatement -> TTerm [Field]-caseStatementCases cs = Phantoms.project _CaseStatement _CaseStatement_cases @@ cs--eliminationProduct :: TTerm TupleProjection -> TTerm Elimination-eliminationProduct = variant _Elimination _Elimination_product--eliminationRecord :: TTerm Projection -> TTerm Elimination-eliminationRecord = variant _Elimination _Elimination_record--eliminationUnion :: TTerm CaseStatement -> TTerm Elimination-eliminationUnion = variant _Elimination _Elimination_union--eliminationWrap :: TTerm Name -> TTerm Elimination-eliminationWrap = variant _Elimination _Elimination_wrap--field :: TTerm Name -> TTerm Term -> TTerm Field-field name term = Phantoms.record _Field [- _Field_name>>: name,- _Field_term>>: term]--fieldName :: TTerm Field -> TTerm Name-fieldName f = Phantoms.project _Field _Field_name @@ f--fieldTerm :: TTerm Field -> TTerm Term-fieldTerm f = Phantoms.project _Field _Field_term @@ f--fieldType :: TTerm Name -> TTerm Type -> TTerm FieldType-fieldType name typ = Phantoms.record _FieldType [- _FieldType_name>>: name,- _FieldType_type>>: typ]--fieldTypeName :: TTerm FieldType -> TTerm Name-fieldTypeName ft = Phantoms.project _FieldType _FieldType_name @@ ft--fieldTypeType :: TTerm FieldType -> TTerm Type-fieldTypeType ft = Phantoms.project _FieldType _FieldType_type @@ ft--floatTypeBigfloat :: TTerm FloatType-floatTypeBigfloat = unitVariant _FloatType _FloatType_bigfloat--floatTypeFloat32 :: TTerm FloatType-floatTypeFloat32 = unitVariant _FloatType _FloatType_float32--floatTypeFloat64 :: TTerm FloatType-floatTypeFloat64 = unitVariant _FloatType _FloatType_float64--floatValueBigfloat :: TTerm Double -> TTerm FloatValue-floatValueBigfloat = inject _FloatValue _FloatValue_bigfloat--floatValueFloat32 :: TTerm Float -> TTerm FloatValue-floatValueFloat32 = inject _FloatValue _FloatValue_float32--floatValueFloat64 :: TTerm Double -> TTerm FloatValue-floatValueFloat64 = inject _FloatValue _FloatValue_float64--forallType :: TTerm Name -> TTerm Type -> TTerm ForallType-forallType parameter body = Phantoms.record _ForallType [- _ForallType_parameter>>: parameter,- _ForallType_body>>: body]--forallTypeParameter :: TTerm ForallType -> TTerm Name-forallTypeParameter ft = Phantoms.project _ForallType _ForallType_parameter @@ ft--forallTypeBody :: TTerm ForallType -> TTerm Type-forallTypeBody ft = Phantoms.project _ForallType _ForallType_body @@ ft--functionElimination :: TTerm Elimination -> TTerm Function-functionElimination = variant _Function _Function_elimination--functionLambda :: TTerm Lambda -> TTerm Function-functionLambda = variant _Function _Function_lambda--functionPrimitive :: TTerm Name -> TTerm Function-functionPrimitive = variant _Function _Function_primitive--functionType :: TTerm Type -> TTerm Type -> TTerm FunctionType-functionType domain codomain = Phantoms.record _FunctionType [- _FunctionType_domain>>: domain,- _FunctionType_codomain>>: codomain]--functionTypeDomain :: TTerm FunctionType -> TTerm Type-functionTypeDomain ft = Phantoms.project _FunctionType _FunctionType_domain @@ ft--functionTypeCodomain :: TTerm FunctionType -> TTerm Type-functionTypeCodomain ft = Phantoms.project _FunctionType _FunctionType_codomain @@ ft--injection :: TTerm Name -> TTerm Field -> TTerm Injection-injection typeName field = Phantoms.record _Injection [- _Injection_typeName>>: typeName,- _Injection_field>>: field]--injectionTypeName :: TTerm Injection -> TTerm Name-injectionTypeName inj = Phantoms.project _Injection _Injection_typeName @@ inj--injectionField :: TTerm Injection -> TTerm Field-injectionField inj = Phantoms.project _Injection _Injection_field @@ inj--integerTypeBigint :: TTerm IntegerType-integerTypeBigint = unitVariant _IntegerType _IntegerType_bigint--integerTypeInt8 :: TTerm IntegerType-integerTypeInt8 = unitVariant _IntegerType _IntegerType_int8--integerTypeInt16 :: TTerm IntegerType-integerTypeInt16 = unitVariant _IntegerType _IntegerType_int16--integerTypeInt32 :: TTerm IntegerType-integerTypeInt32 = unitVariant _IntegerType _IntegerType_int32--integerTypeInt64 :: TTerm IntegerType-integerTypeInt64 = unitVariant _IntegerType _IntegerType_int64--integerTypeUint8 :: TTerm IntegerType-integerTypeUint8 = unitVariant _IntegerType _IntegerType_uint8--integerTypeUint16 :: TTerm IntegerType-integerTypeUint16 = unitVariant _IntegerType _IntegerType_uint16--integerTypeUint32 :: TTerm IntegerType-integerTypeUint32 = unitVariant _IntegerType _IntegerType_uint32--integerTypeUint64 :: TTerm IntegerType-integerTypeUint64 = unitVariant _IntegerType _IntegerType_uint64--integerValueBigint :: TTerm Integer -> TTerm IntegerValue-integerValueBigint = inject _IntegerValue _IntegerValue_bigint--integerValueInt8 :: TTerm Int8 -> TTerm IntegerValue-integerValueInt8 = inject _IntegerValue _IntegerValue_int8--integerValueInt16 :: TTerm Int16 -> TTerm IntegerValue-integerValueInt16 = inject _IntegerValue _IntegerValue_int16--integerValueInt32 :: TTerm Int -> TTerm IntegerValue-integerValueInt32 = inject _IntegerValue _IntegerValue_int32--integerValueInt64 :: TTerm Int64 -> TTerm IntegerValue-integerValueInt64 = inject _IntegerValue _IntegerValue_int64--integerValueUint8 :: TTerm Int16 -> TTerm IntegerValue-integerValueUint8 = inject _IntegerValue _IntegerValue_uint8--integerValueUint16 :: TTerm Int -> TTerm IntegerValue-integerValueUint16 = inject _IntegerValue _IntegerValue_uint16--integerValueUint32 :: TTerm Int64 -> TTerm IntegerValue-integerValueUint32 = inject _IntegerValue _IntegerValue_uint32--integerValueUint64 :: TTerm Integer -> TTerm IntegerValue-integerValueUint64 = inject _IntegerValue _IntegerValue_uint64--lambda :: TTerm Name -> TTerm (Maybe Type) -> TTerm Term -> TTerm Lambda-lambda parameter mdom body = Phantoms.record _Lambda [- _Lambda_parameter>>: parameter,- _Lambda_domain>>: mdom,- _Lambda_body>>: body]--lambdaParameter :: TTerm Lambda -> TTerm Name-lambdaParameter l = Phantoms.project _Lambda _Lambda_parameter @@ l--lambdaBody :: TTerm Lambda -> TTerm Term-lambdaBody l = Phantoms.project _Lambda _Lambda_body @@ l--lambdaDomain :: TTerm Lambda -> TTerm (Maybe Type)-lambdaDomain l = Phantoms.project _Lambda _Lambda_domain @@ l--let_ :: TTerm [Binding] -> TTerm Term -> TTerm Let-let_ bindings environment = Phantoms.record _Let [- _Let_bindings>>: bindings,- _Let_environment>>: environment]--binding :: TTerm Name -> TTerm Term -> TTerm (Maybe TypeScheme) -> TTerm Binding-binding name term mtype = Phantoms.record _Binding [- _Binding_name>>: name,- _Binding_term>>: term,- _Binding_type>>: mtype]--letBindings :: TTerm Let -> TTerm [Binding]-letBindings l = Phantoms.project _Let _Let_bindings @@ l--bindingName :: TTerm Binding -> TTerm Name-bindingName lb = Phantoms.project _Binding _Binding_name @@ lb--bindingTerm :: TTerm Binding -> TTerm Term-bindingTerm lb = Phantoms.project _Binding _Binding_term @@ lb--bindingType :: TTerm Binding -> TTerm (Y.Maybe TypeScheme)-bindingType lb = Phantoms.project _Binding _Binding_type @@ lb--letEnvironment :: TTerm Let -> TTerm Term-letEnvironment l = Phantoms.project _Let _Let_environment @@ l--literalBinary :: TTerm String -> TTerm Literal-literalBinary = variant _Literal _Literal_binary--literalBoolean :: TTerm Bool -> TTerm Literal-literalBoolean = variant _Literal _Literal_boolean--literalFloat :: TTerm FloatValue -> TTerm Literal-literalFloat = variant _Literal _Literal_float--literalInteger :: TTerm IntegerValue -> TTerm Literal-literalInteger = variant _Literal _Literal_integer--literalString :: TTerm String -> TTerm Literal-literalString = variant _Literal _Literal_string--literalTypeBinary :: TTerm LiteralType-literalTypeBinary = unitVariant _LiteralType _LiteralType_binary--literalTypeBoolean :: TTerm LiteralType-literalTypeBoolean = unitVariant _LiteralType _LiteralType_boolean--literalTypeFloat :: TTerm FloatType -> TTerm LiteralType-literalTypeFloat = variant _LiteralType _LiteralType_float--literalTypeInteger :: TTerm IntegerType -> TTerm LiteralType-literalTypeInteger = variant _LiteralType _LiteralType_integer--literalTypeString :: TTerm LiteralType-literalTypeString = unitVariant _LiteralType _LiteralType_string--mapType :: TTerm Type -> TTerm Type -> TTerm MapType-mapType keys values = Phantoms.record _MapType [- _MapType_keys>>: keys,- _MapType_values>>: values]--mapTypeKeys :: TTerm MapType -> TTerm Type-mapTypeKeys mt = Phantoms.project _MapType _MapType_keys @@ mt--mapTypeValues :: TTerm MapType -> TTerm Type-mapTypeValues mt = Phantoms.project _MapType _MapType_values @@ mt--name :: TTerm String -> TTerm Name-name = wrap _Name--nameLift :: Name -> TTerm Name-nameLift (Name n) = wrap _Name $ Phantoms.string n--projection :: TTerm Name -> TTerm Name -> TTerm Projection-projection tname fname = Phantoms.record _Projection [- _Projection_typeName>>: tname,- _Projection_field>>: fname]--projectionTypeName :: TTerm Projection -> TTerm Name-projectionTypeName p = Phantoms.project _Projection _Projection_typeName @@ p--projectionField :: TTerm Projection -> TTerm Name-projectionField p = Phantoms.project _Projection _Projection_field @@ p--record :: TTerm Name -> TTerm [Field] -> TTerm Record-record typeName fields = Phantoms.record _Record [- _Record_typeName>>: typeName,- _Record_fields>>: fields]--recordTypeName :: TTerm Record -> TTerm Name-recordTypeName r = Phantoms.project _Record _Record_typeName @@ r--recordFields :: TTerm Record -> TTerm [Field]-recordFields r = Phantoms.project _Record _Record_fields @@ r--rowType :: TTerm Name -> TTerm [FieldType] -> TTerm (RowType)-rowType typeName fields = Phantoms.record _RowType [- _RowType_typeName>>: typeName,- _RowType_fields>>: fields]--rowTypeTypeName :: TTerm RowType -> TTerm Name-rowTypeTypeName rt = Phantoms.project _RowType _RowType_typeName @@ rt--rowTypeFields :: TTerm RowType -> TTerm [FieldType]-rowTypeFields rt = Phantoms.project _RowType _RowType_fields @@ rt--sum :: TTerm Int -> TTerm Int -> TTerm Term -> TTerm Sum-sum index size term = Phantoms.record _Sum [- _Sum_index>>: index,- _Sum_size>>: size,- _Sum_term>>: term]--sumIndex :: TTerm Sum -> TTerm Int-sumIndex s = Phantoms.project _Sum _Sum_index @@ s--sumSize :: TTerm Sum -> TTerm Int-sumSize s = Phantoms.project _Sum _Sum_size @@ s--sumTerm :: TTerm Sum -> TTerm Term-sumTerm s = Phantoms.project _Sum _Sum_term @@ s--termAnnotated :: TTerm AnnotatedTerm -> TTerm Term-termAnnotated = variant _Term _Term_annotated--termApplication :: TTerm Application -> TTerm Term-termApplication = variant _Term _Term_application--termFunction :: TTerm Function -> TTerm Term-termFunction = variant _Term _Term_function--termLet :: TTerm Let -> TTerm Term-termLet = variant _Term _Term_let--termList :: TTerm [Term] -> TTerm Term-termList = variant _Term _Term_list--termLiteral :: TTerm Literal -> TTerm Term-termLiteral = variant _Term _Term_literal--termMap :: TTerm (M.Map Term Term) -> TTerm Term-termMap = variant _Term _Term_map--termOptional :: TTerm (Maybe Term) -> TTerm Term-termOptional = variant _Term _Term_optional--termProduct :: TTerm [Term] -> TTerm Term-termProduct = variant _Term _Term_product--termRecord :: TTerm Record -> TTerm Term-termRecord = variant _Term _Term_record--termSet :: TTerm (S.Set Term) -> TTerm Term-termSet = variant _Term _Term_set--termSum :: TTerm Sum -> TTerm Term-termSum = variant _Term _Term_sum--termTypeLambda :: TTerm TypeLambda -> TTerm Term-termTypeLambda = variant _Term _Term_typeLambda--termTypeApplication :: TTerm TypedTerm -> TTerm Term-termTypeApplication = variant _Term _Term_typeApplication--termUnion :: TTerm Injection -> TTerm Term-termUnion = variant _Term _Term_union--termUnit :: TTerm Term-termUnit = unitVariant _Term _Term_unit--termVariable :: TTerm Name -> TTerm Term-termVariable = variant _Term _Term_variable--termWrap :: TTerm WrappedTerm -> TTerm Term-termWrap = variant _Term _Term_wrap--tupleProjection :: TTerm Int -> TTerm Int -> TTerm (Maybe [Type]) -> TTerm TupleProjection-tupleProjection arity idx mdom = Phantoms.record _TupleProjection [- _TupleProjection_arity>>: arity,- _TupleProjection_index>>: idx,- _TupleProjection_domain>>: mdom]--tupleProjectionArity :: TTerm TupleProjection -> TTerm Int-tupleProjectionArity tp = Phantoms.project _TupleProjection _TupleProjection_arity @@ tp--tupleProjectionIndex :: TTerm TupleProjection -> TTerm Int-tupleProjectionIndex tp = Phantoms.project _TupleProjection _TupleProjection_index @@ tp--tupleProjectionDomain :: TTerm TupleProjection -> TTerm (Maybe [Type])-tupleProjectionDomain tp = Phantoms.project _TupleProjection _TupleProjection_domain @@ tp--typeLambda :: TTerm Name -> TTerm Term -> TTerm TypeLambda-typeLambda parameter body = Phantoms.record _TypeLambda [- _TypeLambda_parameter>>: parameter,- _TypeLambda_body>>: body]--typeLambdaParameter :: TTerm TypeLambda -> TTerm Name-typeLambdaParameter ta = Phantoms.project _TypeLambda _TypeLambda_parameter @@ ta--typeLambdaBody :: TTerm TypeLambda -> TTerm Term-typeLambdaBody ta = Phantoms.project _TypeLambda _TypeLambda_body @@ ta--typeAnnotated :: TTerm AnnotatedType -> TTerm Type-typeAnnotated = variant _Type _Type_annotated--typeApplication :: TTerm ApplicationType -> TTerm Type-typeApplication = variant _Type _Type_application--typeForall :: TTerm ForallType -> TTerm Type-typeForall = variant _Type _Type_forall--typeFunction :: TTerm FunctionType -> TTerm Type-typeFunction = variant _Type _Type_function--typeList :: TTerm Type -> TTerm Type-typeList = variant _Type _Type_list--typeLiteral :: TTerm LiteralType -> TTerm Type-typeLiteral = variant _Type _Type_literal--typeMap :: TTerm MapType -> TTerm Type-typeMap = variant _Type _Type_map--typeOptional :: TTerm Type -> TTerm Type-typeOptional = variant _Type _Type_optional--typeProduct :: TTerm [Type] -> TTerm Type-typeProduct = variant _Type _Type_product--typeRecord :: TTerm RowType -> TTerm Type-typeRecord = variant _Type _Type_record--typeScheme :: TTerm [Name] -> TTerm Type -> TTerm TypeScheme-typeScheme variables body = Phantoms.record _TypeScheme [- _TypeScheme_variables>>: variables,- _TypeScheme_type>>: body]--typeSchemeVariables :: TTerm TypeScheme -> TTerm [Name]-typeSchemeVariables ts = Phantoms.project _TypeScheme _TypeScheme_variables @@ ts--typeSchemeType :: TTerm TypeScheme -> TTerm Type-typeSchemeType ts = Phantoms.project _TypeScheme _TypeScheme_type @@ ts--typeSet :: TTerm Type -> TTerm Type-typeSet = variant _Type _Type_set--typeSum :: TTerm [Type] -> TTerm Type-typeSum = variant _Type _Type_sum--typeUnion :: TTerm RowType -> TTerm Type-typeUnion = variant _Type _Type_union--typeUnit :: TTerm Type-typeUnit = unitVariant _Type _Type_unit--typeVariable :: TTerm Name -> TTerm Type-typeVariable = variant _Type _Type_variable--typeWrap :: TTerm WrappedType -> TTerm Type-typeWrap = variant _Type _Type_wrap--typedTerm :: TTerm Term -> TTerm Type -> TTerm TypedTerm-typedTerm term type_ = Phantoms.record _TypedTerm [- _TypedTerm_term>>: term,- _TypedTerm_type>>: type_]--typedTermTerm :: TTerm TypedTerm -> TTerm Term-typedTermTerm tt = Phantoms.project _TypedTerm _TypedTerm_term @@ tt--typedTermType :: TTerm TypedTerm -> TTerm Type-typedTermType tt = Phantoms.project _TypedTerm _TypedTerm_type @@ tt--unName :: TTerm Name -> TTerm String-unName n = unwrap _Name @@ n--unNamespace :: TTerm Namespace -> TTerm String-unNamespace ns = unwrap _Namespace @@ ns--wrappedTerm :: TTerm Name -> TTerm Term -> TTerm WrappedTerm-wrappedTerm typeName object = Phantoms.record _WrappedTerm [- _WrappedTerm_typeName>>: typeName,- _WrappedTerm_object>>: object]--wrappedTermTypeName :: TTerm WrappedTerm -> TTerm Name-wrappedTermTypeName wt = Phantoms.project _WrappedTerm _WrappedTerm_typeName @@ wt--wrappedTermObject :: TTerm WrappedTerm -> TTerm Term-wrappedTermObject wt = Phantoms.project _WrappedTerm _WrappedTerm_object @@ wt--wrappedType :: TTerm Name -> TTerm Type -> TTerm WrappedType-wrappedType typeName object = Phantoms.record _WrappedType [- _WrappedType_typeName>>: typeName,- _WrappedType_object>>: object]--wrappedTypeTypeName :: TTerm WrappedType -> TTerm Name-wrappedTypeTypeName wt = Phantoms.project _WrappedType _WrappedType_typeName @@ wt--wrappedTypeObject :: TTerm WrappedType -> TTerm Type-wrappedTypeObject wt = Phantoms.project _WrappedType _WrappedType_object @@ wt--------------------------------------------- Non-schema helpers--equalName :: TTerm (Name -> Name -> Bool)-equalName = lambdas ["left", "right"] $ primitive _equality_equal- @@ (Hydra.Dsl.Core.unName $ var "left")- @@ (Hydra.Dsl.Core.unName $ var "right")--equalName_ :: TTerm Name -> TTerm Name -> TTerm Bool-equalName_ left right = Equality.equal (Hydra.Dsl.Core.unName left) (Hydra.Dsl.Core.unName right)--equalNameList :: TTerm ([Name] -> [Name] -> Bool)-equalNameList = lambdas ["lefts", "rights"] $ Logic.and- (Equality.equal (Lists.length (var "lefts")) (Lists.length (var "rights")))- (Logic.ands $ Lists.zipWith equalName (var "lefts") (var "rights"))--equalNameList_ :: TTerm [Name] -> TTerm [Name] -> TTerm Bool-equalNameList_ lefts rights = Logic.and- (Equality.equal (Lists.length lefts) (Lists.length rights))- (Logic.ands $ Lists.zipWith equalName lefts rights)--fieldWithTerm :: TTerm Term -> TTerm Field -> TTerm Field-fieldWithTerm t ft = Hydra.Dsl.Core.field (Hydra.Dsl.Core.fieldName ft) t--fieldTypeWithType :: TTerm FieldType -> TTerm Type -> TTerm FieldType-fieldTypeWithType ft t = Hydra.Dsl.Core.fieldType (Hydra.Dsl.Core.fieldTypeName ft) t--false :: TTerm Term-false = termLiteral $ literalBoolean $ Phantoms.false--int32 :: Int -> TTerm Term-int32 = termLiteral . literalInteger . integerValueInt32 . Phantoms.int32--string :: String -> TTerm Term-string = termLiteral . literalString . Phantoms.string
− src/main/haskell/Hydra/Dsl/Grammar.hs
@@ -1,38 +0,0 @@-module Hydra.Dsl.Grammar where--import Hydra.Kernel hiding (Pattern)-import Hydra.Dsl.Phantoms-import Hydra.Grammar--import qualified Data.Map as M-import qualified Data.Maybe as Y---labeledPatternLabel :: TTerm LabeledPattern -> TTerm Label-labeledPatternLabel lp = project _LabeledPattern _LabeledPattern_label @@ lp--labeledPatternPattern :: TTerm LabeledPattern -> TTerm Pattern-labeledPatternPattern lp = project _LabeledPattern _LabeledPattern_pattern @@ lp--production :: TTerm Symbol -> TTerm Pattern -> TTerm Production-production sym pat = record _Production [- _Production_symbol>>: sym,- _Production_pattern>>: pat]--productionSymbol :: TTerm Production -> TTerm Symbol-productionSymbol p = project _Production _Production_symbol @@ p--productionPattern :: TTerm Production -> TTerm Pattern-productionPattern p = project _Production _Production_pattern @@ p--unConstant :: TTerm Constant -> TTerm String-unConstant c = unwrap _Constant @@ c--unGrammar :: TTerm Grammar -> TTerm [Production]-unGrammar g = unwrap _Grammar @@ g--unLabel :: TTerm Label -> TTerm String-unLabel l = unwrap _Label @@ l--unSymbol :: TTerm Symbol -> TTerm String-unSymbol s = unwrap _Symbol @@ s
src/main/haskell/Hydra/Dsl/Grammars.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE OverloadedStrings #-}+ -- | A DSL for building BNF grammars module Hydra.Dsl.Grammars where
− src/main/haskell/Hydra/Dsl/Graph.hs
@@ -1,133 +0,0 @@-module Hydra.Dsl.Graph where--import Hydra.Kernel-import Hydra.Dsl.Phantoms--import qualified Data.Map as M---comparisonLessThan :: TTerm Comparison-comparisonLessThan = unitVariant _Comparison _Comparison_lessThan--comparisonEqualTo :: TTerm Comparison-comparisonEqualTo = unitVariant _Comparison _Comparison_equalTo--comparisonGreaterThan :: TTerm Comparison-comparisonGreaterThan = unitVariant _Comparison _Comparison_greaterThan--graph :: TTerm (M.Map Name Binding)- -> TTerm (M.Map Name (Maybe Term))- -> TTerm (M.Map Name TypeScheme)- -> TTerm Term- -> TTerm (M.Map Name Primitive)- -> TTerm (Maybe Graph)- -> TTerm Graph-graph elements environment types body primitives schema = record _Graph [- _Graph_elements>>: elements,- _Graph_environment>>: environment,- _Graph_types>>: types,- _Graph_body>>: body,- _Graph_primitives>>: primitives,- _Graph_schema>>: schema]--graphElements :: TTerm Graph -> TTerm (M.Map Name Binding)-graphElements g = project _Graph _Graph_elements @@ g--graphEnvironment :: TTerm Graph -> TTerm (M.Map Name (Maybe Term))-graphEnvironment g = project _Graph _Graph_environment @@ g--graphTypes :: TTerm Graph -> TTerm (M.Map Name TypeScheme)-graphTypes g = project _Graph _Graph_types @@ g--graphBody :: TTerm Graph -> TTerm Term-graphBody g = project _Graph _Graph_body @@ g--graphPrimitives :: TTerm Graph -> TTerm (M.Map Name Primitive)-graphPrimitives g = project _Graph _Graph_primitives @@ g--graphSchema :: TTerm Graph -> TTerm (Maybe Graph)-graphSchema g = project _Graph _Graph_schema @@ g--graphWithElements :: TTerm Graph -> TTerm (M.Map Name Binding) -> TTerm Graph-graphWithElements g newElements = graph- newElements- (Hydra.Dsl.Graph.graphEnvironment g)- (Hydra.Dsl.Graph.graphTypes g)- (Hydra.Dsl.Graph.graphBody g)- (Hydra.Dsl.Graph.graphPrimitives g)- (Hydra.Dsl.Graph.graphSchema g)--graphWithEnvironment :: TTerm Graph -> TTerm (M.Map Name (Maybe Term)) -> TTerm Graph-graphWithEnvironment g newEnvironment = graph- (Hydra.Dsl.Graph.graphElements g)- newEnvironment- (Hydra.Dsl.Graph.graphTypes g)- (Hydra.Dsl.Graph.graphBody g)- (Hydra.Dsl.Graph.graphPrimitives g)- (Hydra.Dsl.Graph.graphSchema g)--graphWithTypes :: TTerm Graph -> TTerm (M.Map Name TypeScheme) -> TTerm Graph-graphWithTypes g newTypes = graph- (Hydra.Dsl.Graph.graphElements g)- (Hydra.Dsl.Graph.graphEnvironment g)- newTypes- (Hydra.Dsl.Graph.graphBody g)- (Hydra.Dsl.Graph.graphPrimitives g)- (Hydra.Dsl.Graph.graphSchema g)--graphWithBody :: TTerm Graph -> TTerm Term -> TTerm Graph-graphWithBody g newBody = graph- (Hydra.Dsl.Graph.graphElements g)- (Hydra.Dsl.Graph.graphEnvironment g)- (Hydra.Dsl.Graph.graphTypes g)- newBody- (Hydra.Dsl.Graph.graphPrimitives g)- (Hydra.Dsl.Graph.graphSchema g)--graphWithPrimitives :: TTerm Graph -> TTerm (M.Map Name Primitive) -> TTerm Graph-graphWithPrimitives g newPrimitives = graph- (Hydra.Dsl.Graph.graphElements g)- (Hydra.Dsl.Graph.graphEnvironment g)- (Hydra.Dsl.Graph.graphTypes g)- (Hydra.Dsl.Graph.graphBody g)- newPrimitives- (Hydra.Dsl.Graph.graphSchema g)--graphWithSchema :: TTerm Graph -> TTerm (Maybe Graph) -> TTerm Graph-graphWithSchema g newSchema = graph- (Hydra.Dsl.Graph.graphElements g)- (Hydra.Dsl.Graph.graphEnvironment g)- (Hydra.Dsl.Graph.graphTypes g)- (Hydra.Dsl.Graph.graphBody g)- (Hydra.Dsl.Graph.graphPrimitives g)- newSchema--primitive :: TTerm Name- -> TTerm TypeScheme- -> TTerm ([Term] -> Flow Graph Term)- -> TTerm Primitive-primitive name typ implementation = record _Primitive [- _Primitive_name>>: name,- _Primitive_type>>: typ,- _Primitive_implementation>>: implementation]--primitiveName :: TTerm Primitive -> TTerm Name-primitiveName p = project _Primitive _Primitive_name @@ p--primitiveType :: TTerm Primitive -> TTerm TypeScheme-primitiveType p = project _Primitive _Primitive_type @@ p--primitiveImplementation :: TTerm Primitive -> TTerm ([Term] -> Flow Graph Term)-primitiveImplementation p = project _Primitive _Primitive_implementation @@ p--primitiveWithType :: TTerm Primitive -> TTerm TypeScheme -> TTerm Primitive-primitiveWithType p newType = Hydra.Dsl.Graph.primitive- (Hydra.Dsl.Graph.primitiveName p)- newType- (Hydra.Dsl.Graph.primitiveImplementation p)--typeClassEquality :: TTerm TypeClass-typeClassEquality = unitVariant _TypeClass _TypeClass_equality--typeClassOrdering :: TTerm TypeClass-typeClassOrdering = unitVariant _TypeClass _TypeClass_ordering
− src/main/haskell/Hydra/Dsl/Json.hs
@@ -1,26 +0,0 @@-module Hydra.Dsl.Json where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import Hydra.Json--import qualified Data.Map as M---valueArray :: TTerm [Value] -> TTerm Value-valueArray = variant _Value _Value_array--valueBoolean :: TTerm Bool -> TTerm Value-valueBoolean = variant _Value _Value_boolean--valueNull :: TTerm Value-valueNull = unitVariant _Value _Value_null--valueNumber :: TTerm Double -> TTerm Value-valueNumber = variant _Value _Value_number--valueObject :: TTerm (M.Map String Value) -> TTerm Value-valueObject = variant _Value _Value_object--valueString :: TTerm String -> TTerm Value-valueString = variant _Value _Value_string
− src/main/haskell/Hydra/Dsl/Lib/Chars.hs
@@ -1,31 +0,0 @@-module Hydra.Dsl.Lib.Chars where--import Hydra.Dsl.Phantoms-import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms----- Follow's GHC.s Data.Char.isAlphaNum-isAlphaNum :: TTerm Int -> TTerm Bool-isAlphaNum = primitive1 _chars_isAlphaNum---- Follows GHC's Data.Char.isLower (GHC.Internal.Unicode.isLower)-isLower :: TTerm Int -> TTerm Bool-isLower = primitive1 _chars_isLower---- Follow's GHC.s Data.Char.isSpace-isSpace :: TTerm Int -> TTerm Bool-isSpace = primitive1 _chars_isSpace---- Follows GHC's Data.Char.isUpper (GHC.Internal.Unicode.isUpper)-isUpper :: TTerm Int -> TTerm Bool-isUpper = primitive1 _chars_isUpper---- Follows GHC's toLower (GHC.Internal.Unicode.Char.UnicodeData.SimpleLowerCaseMapping.toSimpleLowerCase)-toLower :: TTerm Int -> TTerm Int-toLower = primitive1 _chars_toLower---- Follows GHC's toUpper (GHC.Internal.Unicode.Char.UnicodeData.SimpleUpperCaseMapping.toSimpleUpperCase)-toUpper :: TTerm Int -> TTerm Int-toUpper = primitive1 _chars_toUpper
− src/main/haskell/Hydra/Dsl/Lib/Equality.hs
@@ -1,38 +0,0 @@-module Hydra.Dsl.Lib.Equality where--import Hydra.Core-import Hydra.Mantle-import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms--import Data.Int---compare :: TTerm a -> TTerm a -> TTerm Comparison-compare = primitive2 _equality_compare--equal :: TTerm a -> TTerm a -> TTerm Bool-equal = primitive2 _equality_equal--gt :: TTerm a -> TTerm a -> TTerm Bool-gt = primitive2 _equality_gt--gte :: TTerm a -> TTerm a -> TTerm Bool-gte = primitive2 _equality_gte--identity :: TTerm a -> TTerm a-identity = primitive1 _equality_identity--lt :: TTerm a -> TTerm a -> TTerm Bool-lt = primitive2 _equality_lt--lte :: TTerm a -> TTerm a -> TTerm Bool-lte = primitive2 _equality_lte--max :: TTerm a -> TTerm a -> TTerm a-max = primitive2 _equality_max--min :: TTerm a -> TTerm a -> TTerm a-min = primitive2 _equality_min
− src/main/haskell/Hydra/Dsl/Lib/Flows.hs
@@ -1,46 +0,0 @@-module Hydra.Dsl.Lib.Flows where--import Hydra.Dsl.Phantoms-import Hydra.Core-import Hydra.Compute-import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types--import qualified Data.Map as M-import qualified Data.Set as S---apply :: TTerm (Flow s (x -> y)) -> TTerm (Flow s x) -> TTerm (Flow s y)-apply = primitive2 _flows_apply--bind :: TTerm (Flow s x) -> TTerm (x -> Flow s y) -> TTerm (Flow s y)-bind = primitive2 _flows_bind--fail :: TTerm String -> TTerm (Flow s x)-fail = primitive1 _flows_fail--map :: TTerm (x -> y) -> TTerm (Flow s x) -> TTerm (Flow s y)-map = primitive2 _flows_map--mapElems :: TTerm (v1 -> Flow s v2) -> TTerm (M.Map k v1) -> TTerm (Flow s (M.Map k v2))-mapElems = primitive2 _flows_mapElems--mapKeys :: TTerm (k1 -> Flow s k2) -> TTerm (M.Map k1 v) -> TTerm (Flow s (M.Map k2 v))-mapKeys = primitive2 _flows_mapKeys--mapList :: TTerm (x -> Flow s y) -> TTerm [x] -> TTerm (Flow s [y])-mapList = primitive2 _flows_mapList--mapOptional :: TTerm (x -> Flow s y) -> TTerm (Maybe x) -> TTerm (Flow s (Maybe y))-mapOptional = primitive2 _flows_mapOptional--mapSet :: TTerm (x -> Flow s y) -> TTerm (S.Set x) -> TTerm (Flow s (S.Set y))-mapSet = primitive2 _flows_mapSet--pure :: TTerm x -> TTerm (Flow s x)-pure = primitive1 _flows_pure--sequence :: TTerm [Flow s a] -> TTerm (Flow s [a])-sequence = primitive1 _flows_sequence
− src/main/haskell/Hydra/Dsl/Lib/Lists.hs
@@ -1,109 +0,0 @@-module Hydra.Dsl.Lib.Lists where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms---apply :: TTerm [a -> b] -> TTerm [a] -> TTerm [b]-apply = primitive2 _lists_apply--at :: TTerm Int -> TTerm [a] -> TTerm a-at = primitive2 _lists_at--bind :: TTerm [a] -> TTerm (a -> [b]) -> TTerm [b]-bind = primitive2 _lists_bind--concat :: TTerm [[a]] -> TTerm [a]-concat = primitive1 _lists_concat--concat2 :: TTerm [a] -> TTerm [a] -> TTerm [a]-concat2 = primitive2 _lists_concat2--cons :: TTerm a -> TTerm [a] -> TTerm [a]-cons = primitive2 _lists_cons--drop :: TTerm Int -> TTerm [a] -> TTerm [a]-drop = primitive2 _lists_drop--dropWhile :: TTerm (a -> Bool) -> TTerm [a] -> TTerm [a]-dropWhile = primitive2 _lists_dropWhile--elem :: Eq a => TTerm a -> TTerm [a] -> TTerm Bool-elem = primitive2 _lists_elem--filter :: TTerm (a -> Bool) -> TTerm [a] -> TTerm [a]-filter = primitive2 _lists_filter--foldl :: TTerm (b -> a -> b) -> TTerm b -> TTerm [a] -> TTerm b-foldl = primitive3 _lists_foldl--group :: Eq a => TTerm [a] -> TTerm [[a]]-group = primitive1 _lists_group--head :: TTerm [a] -> TTerm a-head = primitive1 _lists_head--init :: TTerm [a] -> TTerm [a]-init = primitive1 _lists_init--intercalate :: TTerm [a] -> TTerm [[a]] -> TTerm [a]-intercalate = primitive2 _lists_intercalate--intersperse :: TTerm a -> TTerm [a] -> TTerm [a]-intersperse = primitive2 _lists_intersperse--last :: TTerm [a] -> TTerm a-last = primitive1 _lists_last--length :: TTerm [a] -> TTerm Int-length = primitive1 _lists_length--map :: TTerm (a -> b) -> TTerm [a] -> TTerm [b]-map = primitive2 _lists_map--nub :: Eq a => TTerm [a] -> TTerm [a]-nub = primitive1 _lists_nub--null :: TTerm [a] -> TTerm Bool-null = primitive1 _lists_null--pure :: TTerm a -> TTerm [a]-pure = primitive1 _lists_pure--replicate :: TTerm Int -> TTerm a -> TTerm [a]-replicate = primitive2 _lists_replicate--reverse :: TTerm [a] -> TTerm [a]-reverse = primitive1 _lists_reverse--safeHead :: TTerm [a] -> TTerm (Maybe a)-safeHead = primitive1 _lists_safeHead--singleton :: TTerm a -> TTerm [a]-singleton = primitive1 _lists_singleton--sort :: TTerm [a] -> TTerm [a]-sort = primitive1 _lists_sort--sortOn :: TTerm (a -> b) -> TTerm [a] -> TTerm [a]-sortOn = primitive2 _lists_sortOn--span :: TTerm (a -> Bool) -> TTerm [a] -> TTerm ([a], [a])-span = primitive2 _lists_span--tail :: TTerm [a] -> TTerm [a]-tail = primitive1 _lists_tail--take :: TTerm Int -> TTerm [a] -> TTerm [a]-take = primitive2 _lists_take--transpose :: TTerm [[a]] -> TTerm [[a]]-transpose = primitive1 _lists_transpose--zip :: TTerm [a] -> TTerm [b] -> TTerm [(a, b)]-zip = primitive2 _lists_zip--zipWith :: TTerm (a -> b -> c) -> TTerm [a] -> TTerm [b] -> TTerm [c]-zipWith = primitive3 _lists_zipWith
− src/main/haskell/Hydra/Dsl/Lib/Literals.hs
@@ -1,144 +0,0 @@-module Hydra.Dsl.Lib.Literals where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms--import Data.Int---bigfloatToBigint :: TTerm Double -> TTerm Double-bigfloatToBigint = primitive1 _literals_bigfloatToBigint--bigfloatToFloat32 :: TTerm Double -> TTerm Float-bigfloatToFloat32 = primitive1 _literals_bigfloatToFloat32--bigfloatToFloat64 :: TTerm Double -> TTerm Double-bigfloatToFloat64 = primitive1 _literals_bigfloatToFloat64--bigintToBigfloat :: TTerm Integer -> TTerm Double-bigintToBigfloat = primitive1 _literals_bigintToBigfloat--bigintToInt8 :: TTerm Integer -> TTerm Int8-bigintToInt8 = primitive1 _literals_bigintToInt8--bigintToInt16 :: TTerm Integer -> TTerm Int16-bigintToInt16 = primitive1 _literals_bigintToInt16--bigintToInt32 :: TTerm Integer -> TTerm Int-bigintToInt32 = primitive1 _literals_bigintToInt32--bigintToInt64 :: TTerm Integer -> TTerm Int64-bigintToInt64 = primitive1 _literals_bigintToInt64--bigintToUint8 :: TTerm Integer -> TTerm Int16-bigintToUint8 = primitive1 _literals_bigintToUint8--bigintToUint16 :: TTerm Integer -> TTerm Int-bigintToUint16 = primitive1 _literals_bigintToUint16--bigintToUint32 :: TTerm Integer -> TTerm Int64-bigintToUint32 = primitive1 _literals_bigintToUint32--bigintToUint64 :: TTerm Integer -> TTerm Integer-bigintToUint64 = primitive1 _literals_bigintToUint64--binaryToString :: TTerm String -> TTerm String-binaryToString = primitive1 _literals_binaryToString--float32ToBigfloat :: TTerm Float -> TTerm Double-float32ToBigfloat = primitive1 _literals_float32ToBigfloat--float64ToBigfloat :: TTerm Double -> TTerm Double-float64ToBigfloat = primitive1 _literals_float64ToBigfloat--int8ToBigint :: TTerm Int8 -> TTerm Integer-int8ToBigint = primitive1 _literals_int8ToBigint--int16ToBigint :: TTerm Int16 -> TTerm Integer-int16ToBigint = primitive1 _literals_int16ToBigint--int32ToBigint :: TTerm Int -> TTerm Integer-int32ToBigint = primitive1 _literals_int32ToBigint--int64ToBigint :: TTerm Int64 -> TTerm Integer-int64ToBigint = primitive1 _literals_int64ToBigint--readBigfloat :: TTerm String -> TTerm (Maybe Double)-readBigfloat = primitive1 _literals_readBigfloat--readBoolean :: TTerm String -> TTerm (Maybe Bool)-readBoolean = primitive1 _literals_readBoolean--readFloat32 :: TTerm String -> TTerm (Maybe Float)-readFloat32 = primitive1 _literals_readFloat32--readFloat64 :: TTerm String -> TTerm (Maybe Double)-readFloat64 = primitive1 _literals_readFloat64--readInt32 :: TTerm String -> TTerm (Maybe Int)-readInt32 = primitive1 _literals_readInt32--readInt64 :: TTerm String -> TTerm (Maybe Int64)-readInt64 = primitive1 _literals_readInt64--readString :: TTerm String -> TTerm (Maybe String)-readString = primitive1 _literals_readString--showBigfloat :: TTerm Double -> TTerm String-showBigfloat = primitive1 _literals_showBigfloat--showBigint :: TTerm Integer -> TTerm String-showBigint = primitive1 _literals_showBigint--showBoolean :: TTerm Bool -> TTerm String-showBoolean = primitive1 _literals_showBoolean--showFloat32 :: TTerm Float -> TTerm String-showFloat32 = primitive1 _literals_showFloat32--showFloat64 :: TTerm Double -> TTerm String-showFloat64 = primitive1 _literals_showFloat64--showInt8 :: TTerm Int8 -> TTerm String-showInt8 = primitive1 _literals_showInt8--showInt16 :: TTerm Int16 -> TTerm String-showInt16 = primitive1 _literals_showInt16--showInt32 :: TTerm Int -> TTerm String-showInt32 = primitive1 _literals_showInt32--showInt64 :: TTerm Int64 -> TTerm String-showInt64 = primitive1 _literals_showInt64--showUint8 :: TTerm Int16 -> TTerm String-showUint8 = primitive1 _literals_showUint8--showUint16 :: TTerm Int -> TTerm String-showUint16 = primitive1 _literals_showUint16--showUint32 :: TTerm Int64 -> TTerm String-showUint32 = primitive1 _literals_showUint32--showUint64 :: TTerm Integer -> TTerm String-showUint64 = primitive1 _literals_showUint64--showString :: TTerm String -> TTerm String-showString = primitive1 _literals_showString--stringToBinary :: TTerm String -> TTerm String-stringToBinary = primitive1 _literals_stringToBinary--uint8ToBigint :: TTerm Int16 -> TTerm Integer-uint8ToBigint = primitive1 _literals_uint8ToBigint--uint16ToBigint :: TTerm Int -> TTerm Integer-uint16ToBigint = primitive1 _literals_uint16ToBigint--uint32ToBigint :: TTerm Int64 -> TTerm Integer-uint32ToBigint = primitive1 _literals_uint32ToBigint--uint64ToBigint :: TTerm Integer -> TTerm Integer-uint64ToBigint = primitive1 _literals_uint64ToBigint
− src/main/haskell/Hydra/Dsl/Lib/Logic.hs
@@ -1,29 +0,0 @@-module Hydra.Dsl.Lib.Logic where--import Hydra.Core-import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms as Phantoms---and :: TTerm Bool -> TTerm Bool -> TTerm Bool-and = primitive2 _logic_and--ifElse :: TTerm Bool -> TTerm a -> TTerm a -> TTerm a-ifElse = primitive3 _logic_ifElse--not :: TTerm Bool -> TTerm Bool-not = primitive1 _logic_not--or :: TTerm Bool -> TTerm Bool -> TTerm Bool-or = primitive2 _logic_or--------------------------------------------- Helpers which are not primitives--ands :: TTerm [Bool] -> TTerm Bool-ands terms = Phantoms.fold (primitive _logic_and) @@ true @@ terms--ors :: TTerm [Bool] -> TTerm Bool-ors terms = Phantoms.fold (primitive _logic_or) @@ false @@ terms
− src/main/haskell/Hydra/Dsl/Lib/Maps.hs
@@ -1,69 +0,0 @@-module Hydra.Dsl.Lib.Maps where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms--import Data.Map---alter :: TTerm (Maybe v -> Maybe v) -> TTerm k -> TTerm (Map k v) -> TTerm (Map k v)-alter = primitive3 _maps_alter--bimap :: TTerm (k1 -> k2) -> TTerm (v1 -> v2) -> TTerm (Map k1 v1) -> TTerm (Map k2 v2)-bimap = primitive3 _maps_bimap--elems :: TTerm (Map k v) -> TTerm [v]-elems = primitive1 _maps_elems--empty :: TTerm (Map k v)-empty = primitive _maps_empty--filter :: TTerm (v -> Bool) -> TTerm (Map k v) -> TTerm (Map k v)-filter = primitive2 _maps_filter--filterWithKey :: TTerm (k -> v -> Bool) -> TTerm (Map k v) -> TTerm (Map k v)-filterWithKey = primitive2 _maps_filterWithKey--findWithDefault :: TTerm v -> TTerm k -> TTerm (Map k v) -> TTerm v-findWithDefault = primitive3 _maps_findWithDefault--fromList :: TTerm [(k, v)] -> TTerm (Map k v)-fromList = primitive1 _maps_fromList--insert :: TTerm k -> TTerm v -> TTerm (Map k v) -> TTerm (Map k v)-insert = primitive3 _maps_insert--keys :: TTerm (Map k v) -> TTerm [k]-keys = primitive1 _maps_keys--lookup :: TTerm k -> TTerm (Map k v) -> TTerm (Maybe v)-lookup = primitive2 _maps_lookup--map :: TTerm (v1 -> v2) -> TTerm (Map k v1) -> TTerm (Map k v2)-map = primitive2 _maps_map--mapKeys :: TTerm (k1 -> k2) -> TTerm (Map k1 v) -> TTerm (Map k2 v)-mapKeys = primitive2 _maps_mapKeys--member :: TTerm k -> TTerm (Map k v) -> TTerm Bool-member = primitive2 _maps_member--null :: TTerm (Map k v) -> TTerm Bool-null = primitive1 _maps_null--remove :: TTerm k -> TTerm (Map k v) -> TTerm (Map k v)-remove = primitive2 _maps_remove--singleton :: TTerm k -> TTerm v -> TTerm (Map k v)-singleton = primitive2 _maps_singleton--size :: TTerm (Map k v) -> TTerm Int-size = primitive1 _maps_size--toList :: TTerm (Map k v) -> TTerm [(k, v)]-toList = primitive1 _maps_toList--union :: TTerm (Map k v) -> TTerm (Map k v) -> TTerm (Map k v)-union = primitive2 _maps_union
− src/main/haskell/Hydra/Dsl/Lib/Math.hs
@@ -1,31 +0,0 @@-module Hydra.Dsl.Lib.Math where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms---add :: TTerm a -> TTerm a -> TTerm a-add = primitive2 _math_add--div :: TTerm a -> TTerm a -> TTerm a-div = primitive2 _math_div--mod :: TTerm a -> TTerm a -> TTerm a-mod = primitive2 _math_mod--mul :: TTerm a -> TTerm a -> TTerm a-mul = primitive2 _math_mul--neg :: TTerm a -> TTerm a-neg = primitive1 _math_neg--range :: TTerm a -> TTerm a -> TTerm [a]-range start end = primitive2 _math_range start end--rem :: TTerm a -> TTerm a -> TTerm a-rem = primitive2 _math_rem--sub :: TTerm a -> TTerm a -> TTerm a-sub = primitive2 _math_sub
− src/main/haskell/Hydra/Dsl/Lib/Optionals.hs
@@ -1,46 +0,0 @@-module Hydra.Dsl.Lib.Optionals where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms---apply :: TTerm (Maybe (a -> b)) -> TTerm (Maybe a) -> TTerm (Maybe b)-apply = primitive2 _optionals_apply--bind :: TTerm (Maybe a) -> TTerm (a -> Maybe b) -> TTerm (Maybe b)-bind = primitive2 _optionals_bind--cases :: TTerm (Maybe a) -> TTerm b -> TTerm (a -> b) -> TTerm b-cases = primitive3 _optionals_cases--cat :: TTerm [Maybe a] -> TTerm [a]-cat = primitive1 _optionals_cat--compose :: TTerm (a -> Maybe b) -> TTerm (b -> Maybe c) -> TTerm (a -> Maybe c)-compose = primitive2 _optionals_compose--fromJust :: TTerm (Maybe a) -> TTerm a-fromJust = primitive1 _optionals_fromJust--fromMaybe :: TTerm a -> TTerm (Maybe a) -> TTerm a-fromMaybe = primitive2 _optionals_fromMaybe--isJust :: TTerm (Maybe a) -> TTerm Bool-isJust = primitive1 _optionals_isJust--isNothing :: TTerm (Maybe a) -> TTerm Bool-isNothing = primitive1 _optionals_isNothing--map :: TTerm (a -> b) -> TTerm (Maybe a) -> TTerm (Maybe b)-map = primitive2 _optionals_map--mapMaybe :: TTerm (a -> Maybe b) -> TTerm [a] -> TTerm [b]-mapMaybe = primitive2 _optionals_mapMaybe--maybe :: TTerm b -> TTerm (a -> b) -> TTerm (Maybe a) -> TTerm b-maybe = primitive3 _optionals_maybe--pure :: TTerm a -> TTerm (Maybe a)-pure = primitive1 _optionals_pure
− src/main/haskell/Hydra/Dsl/Lib/Sets.hs
@@ -1,51 +0,0 @@-module Hydra.Dsl.Lib.Sets where--import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms--import Data.Set---delete :: TTerm a -> TTerm (Set a) -> TTerm (Set a)-delete = primitive2 _sets_delete--difference :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)-difference = primitive2 _sets_difference--empty :: TTerm (Set a)-empty = primitive _sets_empty--fromList :: TTerm [a] -> TTerm (Set a)-fromList = primitive1 _sets_fromList--insert :: TTerm a -> TTerm (Set a) -> TTerm (Set a)-insert = primitive2 _sets_insert--intersection :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)-intersection = primitive2 _sets_intersection--map :: TTerm (a -> b) -> TTerm (Set a) -> TTerm (Set b)-map = primitive2 _sets_map--member :: TTerm a -> TTerm (Set a) -> TTerm Bool-member = primitive2 _sets_member--null :: TTerm (Set a) -> TTerm Bool-null = primitive1 _sets_null--singleton :: TTerm a -> TTerm (Set a)-singleton = primitive1 _sets_singleton--size :: TTerm (Set a) -> TTerm Int-size = primitive1 _sets_size--toList :: TTerm (Set a) -> TTerm [a]-toList = primitive1 _sets_toList--union :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)-union = primitive2 _sets_union--unions :: TTerm [Set a] -> TTerm (Set a)-unions = primitive1 _sets_unions
− src/main/haskell/Hydra/Dsl/Lib/Strings.hs
@@ -1,55 +0,0 @@-module Hydra.Dsl.Lib.Strings where--import Hydra.Dsl.Phantoms-import Hydra.Phantoms-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Phantoms---(++) :: TTerm String -> TTerm String -> TTerm String-l ++ r = (primitive _strings_cat) @@ (list [l, r])--cat :: TTerm [String] -> TTerm String-cat = primitive1 _strings_cat--cat2 :: TTerm String -> TTerm String -> TTerm String-cat2 = primitive2 _strings_cat2--charAt :: TTerm Int -> TTerm String -> TTerm Int-charAt = primitive2 _strings_charAt--fromList :: TTerm [Int] -> TTerm String-fromList = primitive1 _strings_fromList--intercalate :: TTerm String -> TTerm [String] -> TTerm String-intercalate = primitive2 _strings_intercalate--length :: TTerm String -> TTerm Int-length = primitive1 _strings_length--lines :: TTerm String -> TTerm [String]-lines = primitive1 _strings_lines--null :: TTerm String -> TTerm Bool-null = primitive1 _strings_null--splitOn :: TTerm String -> TTerm String -> TTerm [String]-splitOn = primitive2 _strings_splitOn--toList :: TTerm String -> TTerm [Int]-toList = primitive1 _strings_toList--toLower :: TTerm String -> TTerm String-toLower = primitive1 _strings_toLower--toUpper :: TTerm String -> TTerm String-toUpper = primitive1 _strings_toUpper--unlines :: TTerm [String] -> TTerm String-unlines = primitive1 _strings_unlines---- Helpers--concat :: [TTerm String] -> TTerm String-concat strings = primitive _strings_cat @@ list strings
src/main/haskell/Hydra/Dsl/Literals.hs view
@@ -5,6 +5,7 @@ import Hydra.Core import Data.Int+import qualified Data.ByteString as B -- | Create an arbitrary-precision floating point literal@@ -18,8 +19,8 @@ bigint = integer . IntegerValueBigint . fromIntegral -- | Create a binary data literal--- Example: binary "\x48\x65\x6C\x6C\x6F"-binary :: String -> Literal+-- Example: binary (B.pack [0x48, 0x65, 0x6C, 0x6C, 0x6F])+binary :: B.ByteString -> Literal binary = LiteralBinary -- | Create a boolean literal
− src/main/haskell/Hydra/Dsl/Mantle.hs
@@ -1,318 +0,0 @@-module Hydra.Dsl.Mantle where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import Hydra.Mantle--import qualified Data.Map as M-import qualified Data.Maybe as Y---accessorEdge :: TTerm AccessorNode -> TTerm AccessorPath -> TTerm AccessorNode -> TTerm AccessorEdge-accessorEdge source path target = record _AccessorEdge [- _AccessorEdge_source>>: source,- _AccessorEdge_path>>: path,- _AccessorEdge_target>>: target]--accessorEdgeSource = unitVariant _AccessorEdge _AccessorEdge_source-accessorEdgePath = unitVariant _AccessorEdge _AccessorEdge_path-accessorEdgeTarget = unitVariant _AccessorEdge _AccessorEdge_target--accessorGraph :: TTerm [AccessorNode] -> TTerm [AccessorEdge] -> TTerm AccessorGraph-accessorGraph nodes edges = record _AccessorGraph [- _AccessorGraph_nodes>>: nodes,- _AccessorGraph_edges>>: edges]--accessorGraphNodes = unitVariant _AccessorGraph _AccessorGraph_nodes-accessorGraphEdges = unitVariant _AccessorGraph _AccessorGraph_edges--accessorNode :: TTerm Name -> TTerm String -> TTerm String -> TTerm AccessorNode-accessorNode name label id = record _AccessorNode [- _AccessorNode_name>>: name,- _AccessorNode_label>>: label,- _AccessorNode_id>>: id]--accessorNodeName = unitVariant _AccessorNode _AccessorNode_name-accessorNodeLabel = unitVariant _AccessorNode _AccessorNode_label-accessorNodeId = unitVariant _AccessorNode _AccessorNode_id--accessorPath :: TTerm [TermAccessor] -> TTerm AccessorPath-accessorPath path = wrap _AccessorPath path--caseConventionCamel = unitVariant _CaseConvention _CaseConvention_camel-caseConventionPascal = unitVariant _CaseConvention _CaseConvention_pascal-caseConventionLowerSnake = unitVariant _CaseConvention _CaseConvention_lowerSnake-caseConventionUpperSnake = unitVariant _CaseConvention _CaseConvention_upperSnake--eitherLeft :: TTerm a -> TTerm (Hydra.Mantle.Either a b)-eitherLeft = variant _Either _Either_left--eitherRight :: TTerm b -> TTerm (Hydra.Mantle.Either a b)-eitherRight = variant _Either _Either_right--eliminationVariant :: EliminationVariant -> TTerm EliminationVariant-eliminationVariant v = unitVariant _EliminationVariant $ case v of- EliminationVariantProduct -> _EliminationVariant_product- EliminationVariantRecord -> _EliminationVariant_record- EliminationVariantUnion -> _EliminationVariant_union- EliminationVariantWrap -> _EliminationVariant_wrap--eliminationVariantProduct :: TTerm EliminationVariant-eliminationVariantProduct = unitVariant _EliminationVariant _EliminationVariant_product--eliminationVariantRecord :: TTerm EliminationVariant-eliminationVariantRecord = unitVariant _EliminationVariant _EliminationVariant_record--eliminationVariantUnion :: TTerm EliminationVariant-eliminationVariantUnion = unitVariant _EliminationVariant _EliminationVariant_union--eliminationVariantWrap :: TTerm EliminationVariant-eliminationVariantWrap = unitVariant _EliminationVariant _EliminationVariant_wrap--functionVariant :: FunctionVariant -> TTerm FunctionVariant-functionVariant v = unitVariant _FunctionVariant $ case v of- FunctionVariantElimination -> _FunctionVariant_elimination- FunctionVariantLambda -> _FunctionVariant_lambda- FunctionVariantPrimitive -> _FunctionVariant_primitive--functionVariantElimination :: TTerm FunctionVariant-functionVariantElimination = unitVariant _FunctionVariant _FunctionVariant_elimination--functionVariantLambda :: TTerm FunctionVariant-functionVariantLambda = unitVariant _FunctionVariant _FunctionVariant_lambda--functionVariantPrimitive :: TTerm FunctionVariant-functionVariantPrimitive = unitVariant _FunctionVariant _FunctionVariant_primitive--literalVariant :: LiteralVariant -> TTerm LiteralVariant-literalVariant v = unitVariant _LiteralVariant $ case v of- LiteralVariantBinary -> _LiteralVariant_binary- LiteralVariantBoolean -> _LiteralVariant_boolean- LiteralVariantFloat -> _LiteralVariant_float- LiteralVariantInteger -> _LiteralVariant_integer- LiteralVariantString -> _LiteralVariant_string--literalVariantBinary :: TTerm LiteralVariant-literalVariantBinary = unitVariant _LiteralVariant _LiteralVariant_binary--literalVariantBoolean :: TTerm LiteralVariant-literalVariantBoolean = unitVariant _LiteralVariant _LiteralVariant_boolean--literalVariantFloat :: TTerm LiteralVariant-literalVariantFloat = unitVariant _LiteralVariant _LiteralVariant_float--literalVariantInteger :: TTerm LiteralVariant-literalVariantInteger = unitVariant _LiteralVariant _LiteralVariant_integer--literalVariantString :: TTerm LiteralVariant-literalVariantString = unitVariant _LiteralVariant _LiteralVariant_string--precisionArbitrary :: TTerm Precision-precisionArbitrary = unitVariant _Precision _Precision_arbitrary--precisionBits :: TTerm Int -> TTerm Precision-precisionBits = variant _Precision _Precision_bits--termAccessorAnnotatedSubject :: TTerm TermAccessor-termAccessorAnnotatedSubject = unitVariant _TermAccessor _TermAccessor_annotatedSubject--termAccessorApplicationFunction :: TTerm TermAccessor-termAccessorApplicationFunction = unitVariant _TermAccessor _TermAccessor_applicationFunction--termAccessorApplicationArgument :: TTerm TermAccessor-termAccessorApplicationArgument = unitVariant _TermAccessor _TermAccessor_applicationArgument--termAccessorLambdaBody :: TTerm TermAccessor-termAccessorLambdaBody = unitVariant _TermAccessor _TermAccessor_lambdaBody--termAccessorUnionCasesDefault :: TTerm TermAccessor-termAccessorUnionCasesDefault = unitVariant _TermAccessor _TermAccessor_unionCasesDefault--termAccessorUnionCasesBranch :: TTerm Name -> TTerm TermAccessor-termAccessorUnionCasesBranch = variant _TermAccessor _TermAccessor_unionCasesBranch--termAccessorLetEnvironment :: TTerm TermAccessor-termAccessorLetEnvironment = unitVariant _TermAccessor _TermAccessor_letEnvironment--termAccessorLetBinding :: TTerm Name -> TTerm TermAccessor-termAccessorLetBinding = variant _TermAccessor _TermAccessor_letBinding--termAccessorListElement :: TTerm Int -> TTerm TermAccessor-termAccessorListElement = variant _TermAccessor _TermAccessor_listElement--termAccessorMapKey :: TTerm Int -> TTerm TermAccessor-termAccessorMapKey = variant _TermAccessor _TermAccessor_mapKey--termAccessorMapValue :: TTerm Int -> TTerm TermAccessor-termAccessorMapValue = variant _TermAccessor _TermAccessor_mapValue--termAccessorOptionalTerm :: TTerm TermAccessor-termAccessorOptionalTerm = unitVariant _TermAccessor _TermAccessor_optionalTerm--termAccessorProductTerm :: TTerm Int -> TTerm TermAccessor-termAccessorProductTerm = variant _TermAccessor _TermAccessor_productTerm--termAccessorRecordField :: TTerm Name -> TTerm TermAccessor-termAccessorRecordField = variant _TermAccessor _TermAccessor_recordField--termAccessorSetElement :: TTerm Int -> TTerm TermAccessor-termAccessorSetElement = variant _TermAccessor _TermAccessor_setElement--termAccessorSumTerm :: TTerm TermAccessor-termAccessorSumTerm = unitVariant _TermAccessor _TermAccessor_sumTerm--termAccessorTypeLambdaBody :: TTerm TermAccessor-termAccessorTypeLambdaBody = unitVariant _TermAccessor _TermAccessor_typeLambdaBody--termAccessorTypeApplicationTerm :: TTerm TermAccessor-termAccessorTypeApplicationTerm = unitVariant _TermAccessor _TermAccessor_typeApplicationTerm--termAccessorInjectionTerm :: TTerm TermAccessor-termAccessorInjectionTerm = unitVariant _TermAccessor _TermAccessor_injectionTerm--termAccessorWrappedTerm :: TTerm TermAccessor-termAccessorWrappedTerm = unitVariant _TermAccessor _TermAccessor_wrappedTerm--termVariant :: TermVariant -> TTerm TermVariant-termVariant v = unitVariant _TermVariant $ case v of- TermVariantAnnotated -> _TermVariant_annotated- TermVariantApplication -> _TermVariant_application- TermVariantFunction -> _TermVariant_function- TermVariantLet -> _TermVariant_let- TermVariantList -> _TermVariant_list- TermVariantLiteral -> _TermVariant_literal- TermVariantMap -> _TermVariant_map- TermVariantOptional -> _TermVariant_optional- TermVariantProduct -> _TermVariant_product- TermVariantRecord -> _TermVariant_record- TermVariantSet -> _TermVariant_set- TermVariantSum -> _TermVariant_sum- TermVariantTypeLambda -> _TermVariant_typeLambda- TermVariantTypeApplication -> _TermVariant_typeApplication- TermVariantUnion -> _TermVariant_union- TermVariantUnit -> _TermVariant_unit- TermVariantVariable -> _TermVariant_variable- TermVariantWrap -> _TermVariant_wrap--termVariantAnnotated :: TTerm TermVariant-termVariantAnnotated = unitVariant _TermVariant _TermVariant_annotated--termVariantApplication :: TTerm TermVariant-termVariantApplication = unitVariant _TermVariant _TermVariant_application--termVariantFunction :: TTerm TermVariant-termVariantFunction = unitVariant _TermVariant _TermVariant_function--termVariantLet :: TTerm TermVariant-termVariantLet = unitVariant _TermVariant _TermVariant_let--termVariantList :: TTerm TermVariant-termVariantList = unitVariant _TermVariant _TermVariant_list--termVariantLiteral :: TTerm TermVariant-termVariantLiteral = unitVariant _TermVariant _TermVariant_literal--termVariantMap :: TTerm TermVariant-termVariantMap = unitVariant _TermVariant _TermVariant_map--termVariantOptional :: TTerm TermVariant-termVariantOptional = unitVariant _TermVariant _TermVariant_optional--termVariantProduct :: TTerm TermVariant-termVariantProduct = unitVariant _TermVariant _TermVariant_product--termVariantRecord :: TTerm TermVariant-termVariantRecord = unitVariant _TermVariant _TermVariant_record--termVariantSet :: TTerm TermVariant-termVariantSet = unitVariant _TermVariant _TermVariant_set--termVariantSum :: TTerm TermVariant-termVariantSum = unitVariant _TermVariant _TermVariant_sum--termVariantTypeLambda :: TTerm TermVariant-termVariantTypeLambda = unitVariant _TermVariant _TermVariant_typeLambda--termVariantTypeApplication :: TTerm TermVariant-termVariantTypeApplication = unitVariant _TermVariant _TermVariant_typeApplication--termVariantUnion :: TTerm TermVariant-termVariantUnion = unitVariant _TermVariant _TermVariant_union--termVariantUnit :: TTerm TermVariant-termVariantUnit = unitVariant _TermVariant _TermVariant_unit--termVariantVariable :: TTerm TermVariant-termVariantVariable = unitVariant _TermVariant _TermVariant_variable--termVariantWrap :: TTerm TermVariant-termVariantWrap = unitVariant _TermVariant _TermVariant_wrap--typeVariant :: TypeVariant -> TTerm TypeVariant-typeVariant v = unitVariant _TypeVariant $ case v of- TypeVariantAnnotated -> _TypeVariant_annotated- TypeVariantApplication -> _TypeVariant_application- TypeVariantFunction -> _TypeVariant_function- TypeVariantForall -> _TypeVariant_forall- TypeVariantList -> _TypeVariant_list- TypeVariantLiteral -> _TypeVariant_literal- TypeVariantMap -> _TypeVariant_map- TypeVariantOptional -> _TypeVariant_optional- TypeVariantProduct -> _TypeVariant_product- TypeVariantRecord -> _TypeVariant_record- TypeVariantSet -> _TypeVariant_set- TypeVariantUnion -> _TypeVariant_union- TypeVariantUnit -> _TypeVariant_unit- TypeVariantVariable -> _TypeVariant_variable- TypeVariantWrap -> _TypeVariant_wrap--typeVariantAnnotated :: TTerm TypeVariant-typeVariantAnnotated = unitVariant _TypeVariant _TypeVariant_annotated--typeVariantApplication :: TTerm TypeVariant-typeVariantApplication = unitVariant _TypeVariant _TypeVariant_application--typeVariantFunction :: TTerm TypeVariant-typeVariantFunction = unitVariant _TypeVariant _TypeVariant_function--typeVariantForall :: TTerm TypeVariant-typeVariantForall = unitVariant _TypeVariant _TypeVariant_forall--typeVariantList :: TTerm TypeVariant-typeVariantList = unitVariant _TypeVariant _TypeVariant_list--typeVariantLiteral :: TTerm TypeVariant-typeVariantLiteral = unitVariant _TypeVariant _TypeVariant_literal--typeVariantMap :: TTerm TypeVariant-typeVariantMap = unitVariant _TypeVariant _TypeVariant_map--typeVariantOptional :: TTerm TypeVariant-typeVariantOptional = unitVariant _TypeVariant _TypeVariant_optional--typeVariantProduct :: TTerm TypeVariant-typeVariantProduct = unitVariant _TypeVariant _TypeVariant_product--typeVariantRecord :: TTerm TypeVariant-typeVariantRecord = unitVariant _TypeVariant _TypeVariant_record--typeVariantSet :: TTerm TypeVariant-typeVariantSet = unitVariant _TypeVariant _TypeVariant_set--typeVariantSum :: TTerm TypeVariant-typeVariantSum = unitVariant _TypeVariant _TypeVariant_sum--typeVariantUnion :: TTerm TypeVariant-typeVariantUnion = unitVariant _TypeVariant _TypeVariant_union--typeVariantUnit :: TTerm TypeVariant-typeVariantUnit = unitVariant _TypeVariant _TypeVariant_unit--typeVariantVariable :: TTerm TypeVariant-typeVariantVariable = unitVariant _TypeVariant _TypeVariant_variable--typeVariantWrap :: TTerm TypeVariant-typeVariantWrap = unitVariant _TypeVariant _TypeVariant_wrap--unAccessorPath :: TTerm AccessorPath -> TTerm [TermAccessor]-unAccessorPath path = unwrap _AccessorPath @@ path
+ src/main/haskell/Hydra/Dsl/Meta/Accessors.hs view
@@ -0,0 +1,105 @@+-- | Meta-DSL functions for accessing term and type metadata++module Hydra.Dsl.Meta.Accessors where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Accessors++import qualified Data.Map as M+import qualified Data.Maybe as Y+++accessorEdge :: TTerm AccessorNode -> TTerm AccessorPath -> TTerm AccessorNode -> TTerm AccessorEdge+accessorEdge source path target = record _AccessorEdge [+ _AccessorEdge_source>>: source,+ _AccessorEdge_path>>: path,+ _AccessorEdge_target>>: target]++accessorEdgeSource = injectUnit _AccessorEdge _AccessorEdge_source+accessorEdgePath = injectUnit _AccessorEdge _AccessorEdge_path+accessorEdgeTarget = injectUnit _AccessorEdge _AccessorEdge_target++accessorGraph :: TTerm [AccessorNode] -> TTerm [AccessorEdge] -> TTerm AccessorGraph+accessorGraph nodes edges = record _AccessorGraph [+ _AccessorGraph_nodes>>: nodes,+ _AccessorGraph_edges>>: edges]++accessorGraphNodes = injectUnit _AccessorGraph _AccessorGraph_nodes+accessorGraphEdges = injectUnit _AccessorGraph _AccessorGraph_edges++accessorNode :: TTerm Name -> TTerm String -> TTerm String -> TTerm AccessorNode+accessorNode name label id = record _AccessorNode [+ _AccessorNode_name>>: name,+ _AccessorNode_label>>: label,+ _AccessorNode_id>>: id]++accessorNodeName = injectUnit _AccessorNode _AccessorNode_name+accessorNodeLabel = injectUnit _AccessorNode _AccessorNode_label+accessorNodeId = injectUnit _AccessorNode _AccessorNode_id++accessorPath :: TTerm [TermAccessor] -> TTerm AccessorPath+accessorPath path = wrap _AccessorPath path++termAccessorAnnotatedBody :: TTerm TermAccessor+termAccessorAnnotatedBody = injectUnit _TermAccessor _TermAccessor_annotatedBody++termAccessorApplicationFunction :: TTerm TermAccessor+termAccessorApplicationFunction = injectUnit _TermAccessor _TermAccessor_applicationFunction++termAccessorApplicationArgument :: TTerm TermAccessor+termAccessorApplicationArgument = injectUnit _TermAccessor _TermAccessor_applicationArgument++termAccessorLambdaBody :: TTerm TermAccessor+termAccessorLambdaBody = injectUnit _TermAccessor _TermAccessor_lambdaBody++termAccessorUnionCasesDefault :: TTerm TermAccessor+termAccessorUnionCasesDefault = injectUnit _TermAccessor _TermAccessor_unionCasesDefault++termAccessorUnionCasesBranch :: TTerm Name -> TTerm TermAccessor+termAccessorUnionCasesBranch = inject _TermAccessor _TermAccessor_unionCasesBranch++termAccessorLetEnvironment :: TTerm TermAccessor+termAccessorLetEnvironment = injectUnit _TermAccessor _TermAccessor_letBody++termAccessorLetBinding :: TTerm Name -> TTerm TermAccessor+termAccessorLetBinding = inject _TermAccessor _TermAccessor_letBinding++termAccessorListElement :: TTerm Int -> TTerm TermAccessor+termAccessorListElement = inject _TermAccessor _TermAccessor_listElement++termAccessorMapKey :: TTerm Int -> TTerm TermAccessor+termAccessorMapKey = inject _TermAccessor _TermAccessor_mapKey++termAccessorMapValue :: TTerm Int -> TTerm TermAccessor+termAccessorMapValue = inject _TermAccessor _TermAccessor_mapValue++termAccessorOptionalTerm :: TTerm TermAccessor+termAccessorOptionalTerm = injectUnit _TermAccessor _TermAccessor_maybeTerm++termAccessorProductTerm :: TTerm Int -> TTerm TermAccessor+termAccessorProductTerm = inject _TermAccessor _TermAccessor_productTerm++termAccessorRecordField :: TTerm Name -> TTerm TermAccessor+termAccessorRecordField = inject _TermAccessor _TermAccessor_recordField++termAccessorSetElement :: TTerm Int -> TTerm TermAccessor+termAccessorSetElement = inject _TermAccessor _TermAccessor_setElement++termAccessorSumTerm :: TTerm TermAccessor+termAccessorSumTerm = injectUnit _TermAccessor _TermAccessor_sumTerm++termAccessorTypeLambdaBody :: TTerm TermAccessor+termAccessorTypeLambdaBody = injectUnit _TermAccessor _TermAccessor_typeLambdaBody++termAccessorTypeApplicationTerm :: TTerm TermAccessor+termAccessorTypeApplicationTerm = injectUnit _TermAccessor _TermAccessor_typeApplicationTerm++termAccessorInjectionTerm :: TTerm TermAccessor+termAccessorInjectionTerm = injectUnit _TermAccessor _TermAccessor_injectionTerm++termAccessorWrappedTerm :: TTerm TermAccessor+termAccessorWrappedTerm = injectUnit _TermAccessor _TermAccessor_wrappedTerm++unAccessorPath :: TTerm AccessorPath -> TTerm [TermAccessor]+unAccessorPath path = unwrap _AccessorPath @@ path
+ src/main/haskell/Hydra/Dsl/Meta/Ast.hs view
@@ -0,0 +1,191 @@+-- | Meta-DSL for constructing abstract syntax tree nodes++module Hydra.Dsl.Meta.Ast where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Ast++import qualified Data.Map as M+import qualified Data.Int as I+++-- Associativity++associativityNone :: TTerm Associativity+associativityNone = injectUnit _Associativity _Associativity_none++associativityLeft :: TTerm Associativity+associativityLeft = injectUnit _Associativity _Associativity_left++associativityRight :: TTerm Associativity+associativityRight = injectUnit _Associativity _Associativity_right++associativityBoth :: TTerm Associativity+associativityBoth = injectUnit _Associativity _Associativity_both++-- BlockStyle++blockStyle :: TTerm (Maybe String) -> TTerm Bool -> TTerm Bool -> TTerm BlockStyle+blockStyle indent newlineBefore newlineAfter = record _BlockStyle [+ _BlockStyle_indent >>: indent,+ _BlockStyle_newlineBeforeContent >>: newlineBefore,+ _BlockStyle_newlineAfterContent >>: newlineAfter]++blockStyleIndent :: TTerm BlockStyle -> TTerm (Maybe String)+blockStyleIndent bs = project _BlockStyle _BlockStyle_indent @@ bs++blockStyleNewlineBeforeContent :: TTerm BlockStyle -> TTerm Bool+blockStyleNewlineBeforeContent bs = project _BlockStyle _BlockStyle_newlineBeforeContent @@ bs++blockStyleNewlineAfterContent :: TTerm BlockStyle -> TTerm Bool+blockStyleNewlineAfterContent bs = project _BlockStyle _BlockStyle_newlineAfterContent @@ bs++-- BracketExpr++bracketExpr :: TTerm Brackets -> TTerm Expr -> TTerm BlockStyle -> TTerm BracketExpr+bracketExpr brackets enclosed style = record _BracketExpr [+ _BracketExpr_brackets >>: brackets,+ _BracketExpr_enclosed >>: enclosed,+ _BracketExpr_style >>: style]++bracketExprBrackets :: TTerm BracketExpr -> TTerm Brackets+bracketExprBrackets be = project _BracketExpr _BracketExpr_brackets @@ be++bracketExprEnclosed :: TTerm BracketExpr -> TTerm Expr+bracketExprEnclosed be = project _BracketExpr _BracketExpr_enclosed @@ be++bracketExprStyle :: TTerm BracketExpr -> TTerm BlockStyle+bracketExprStyle be = project _BracketExpr _BracketExpr_style @@ be++-- Brackets++brackets :: TTerm Symbol -> TTerm Symbol -> TTerm Brackets+brackets open close = record _Brackets [+ _Brackets_open >>: open,+ _Brackets_close >>: close]++bracketsOpen :: TTerm Brackets -> TTerm Symbol+bracketsOpen b = project _Brackets _Brackets_open @@ b++bracketsClose :: TTerm Brackets -> TTerm Symbol+bracketsClose b = project _Brackets _Brackets_close @@ b++-- Expr (sum type)++exprConst :: TTerm Symbol -> TTerm Expr+exprConst sym = inject _Expr _Expr_const sym++exprIndent :: TTerm IndentedExpression -> TTerm Expr+exprIndent ind = inject _Expr _Expr_indent ind++exprOp :: TTerm OpExpr -> TTerm Expr+exprOp op = inject _Expr _Expr_op op++exprBrackets :: TTerm BracketExpr -> TTerm Expr+exprBrackets be = inject _Expr _Expr_brackets be++-- IndentedExpression++indentedExpression :: TTerm IndentStyle -> TTerm Expr -> TTerm IndentedExpression+indentedExpression style expr = record _IndentedExpression [+ _IndentedExpression_style >>: style,+ _IndentedExpression_expr >>: expr]++indentedExpressionStyle :: TTerm IndentedExpression -> TTerm IndentStyle+indentedExpressionStyle ie = project _IndentedExpression _IndentedExpression_style @@ ie++indentedExpressionExpr :: TTerm IndentedExpression -> TTerm Expr+indentedExpressionExpr ie = project _IndentedExpression _IndentedExpression_expr @@ ie++-- IndentStyle (sum type)++indentStyleAllLines :: TTerm String -> TTerm IndentStyle+indentStyleAllLines s = inject _IndentStyle _IndentStyle_allLines s++indentStyleSubsequentLines :: TTerm String -> TTerm IndentStyle+indentStyleSubsequentLines s = inject _IndentStyle _IndentStyle_subsequentLines s++-- Op++op :: TTerm Symbol -> TTerm Padding -> TTerm Precedence -> TTerm Associativity -> TTerm Op+op symbol padding precedence associativity = record _Op [+ _Op_symbol >>: symbol,+ _Op_padding >>: padding,+ _Op_precedence >>: precedence,+ _Op_associativity >>: associativity]++opSymbol :: TTerm Op -> TTerm Symbol+opSymbol o = project _Op _Op_symbol @@ o++opPadding :: TTerm Op -> TTerm Padding+opPadding o = project _Op _Op_padding @@ o++opPrecedence :: TTerm Op -> TTerm Precedence+opPrecedence o = project _Op _Op_precedence @@ o++opAssociativity :: TTerm Op -> TTerm Associativity+opAssociativity o = project _Op _Op_associativity @@ o++-- OpExpr++opExpr :: TTerm Op -> TTerm Expr -> TTerm Expr -> TTerm OpExpr+opExpr op lhs rhs = record _OpExpr [+ _OpExpr_op >>: op,+ _OpExpr_lhs >>: lhs,+ _OpExpr_rhs >>: rhs]++opExprOp :: TTerm OpExpr -> TTerm Op+opExprOp oe = project _OpExpr _OpExpr_op @@ oe++opExprLhs :: TTerm OpExpr -> TTerm Expr+opExprLhs oe = project _OpExpr _OpExpr_lhs @@ oe++opExprRhs :: TTerm OpExpr -> TTerm Expr+opExprRhs oe = project _OpExpr _OpExpr_rhs @@ oe++-- Padding++padding :: TTerm Ws -> TTerm Ws -> TTerm Padding+padding left right = record _Padding [+ _Padding_left >>: left,+ _Padding_right >>: right]++paddingLeft :: TTerm Padding -> TTerm Ws+paddingLeft p = project _Padding _Padding_left @@ p++paddingRight :: TTerm Padding -> TTerm Ws+paddingRight p = project _Padding _Padding_right @@ p++-- Precedence (newtype wrapping Int)++precedence :: TTerm I.Int -> TTerm Precedence+precedence = wrap _Precedence++unPrecedence :: TTerm Precedence -> TTerm I.Int+unPrecedence p = unwrap _Precedence @@ p++-- Symbol (newtype wrapping String)++symbol :: TTerm String -> TTerm Symbol+symbol = wrap _Symbol++unSymbol :: TTerm Symbol -> TTerm String+unSymbol s = unwrap _Symbol @@ s++-- Ws (sum type)++wsNone :: TTerm Ws+wsNone = injectUnit _Ws _Ws_none++wsSpace :: TTerm Ws+wsSpace = injectUnit _Ws _Ws_space++wsBreak :: TTerm Ws+wsBreak = injectUnit _Ws _Ws_break++wsBreakAndIndent :: TTerm String -> TTerm Ws+wsBreakAndIndent s = inject _Ws _Ws_breakAndIndent s++wsDoubleBreak :: TTerm Ws+wsDoubleBreak = injectUnit _Ws _Ws_doubleBreak
+ src/main/haskell/Hydra/Dsl/Meta/Base.hs view
@@ -0,0 +1,28 @@+-- | A basis for other DSLs which deal with term-encoded expressions.++module Hydra.Dsl.Meta.Base (+ module Hydra.Dsl.Meta.Phantoms,+ module Hydra.Dsl.Meta.Base,+ module Hydra.Sources.Libraries,+) where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms(asTerm, AsTerm(..), definitionInModule, el, firstClassType, opt)+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Meta.Core as Core+import Hydra.Sources.Libraries++import qualified Data.Map as M+import qualified Data.Maybe as Y+++infixr 0 >:+(>:) :: String -> a -> (TTerm Name, a)+n >: d = (name n, d)++infixr 0 >>:+(>>:) :: Name -> a -> (TTerm Name, a)+n >>: d = (Core.nameLift n, d)++name :: String -> TTerm Name+name s = Core.nameLift $ Name s
+ src/main/haskell/Hydra/Dsl/Meta/Coders.hs view
@@ -0,0 +1,111 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Meta-DSL for constructing coder-related terms++module Hydra.Dsl.Meta.Coders where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Core as Core+import Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Types as T++import qualified Data.Map as M+import qualified Data.Set as S+++adapterContext :: TTerm Graph -> TTerm Language -> TTerm (M.Map Name (Adapter AdapterContext AdapterContext Type Type Term Term)) -> TTerm AdapterContext+adapterContext graph language adapters = Phantoms.record _AdapterContext [+ _AdapterContext_graph>>: graph,+ _AdapterContext_language>>: language,+ _AdapterContext_adapters>>: adapters]++adapterContextGraph :: TTerm AdapterContext -> TTerm Graph+adapterContextGraph c = project _AdapterContext _AdapterContext_graph @@ c++adapterContextLanguage :: TTerm AdapterContext -> TTerm Language+adapterContextLanguage c = project _AdapterContext _AdapterContext_language @@ c++adapterContextAdapters :: TTerm AdapterContext -> TTerm (M.Map Name (Adapter AdapterContext AdapterContext Type Type Term Term))+adapterContextAdapters c = project _AdapterContext _AdapterContext_adapters @@ c++coderDirectionEncode :: TTerm CoderDirection+coderDirectionEncode = injectUnit _CoderDirection _CoderDirection_encode++coderDirectionDecode :: TTerm CoderDirection+coderDirectionDecode = injectUnit _CoderDirection _CoderDirection_decode++language :: TTerm LanguageName -> TTerm LanguageConstraints -> TTerm Language+language name constraints = record _Language [+ _Language_name>>: name,+ _Language_constraints>>: constraints]+++--binding :: AsTerm t Term => TTerm Name -> t -> TTerm (Maybe TypeScheme) -> TTerm Binding++languageName :: AsTerm t String => t -> TTerm LanguageName+languageName = wrap _LanguageName . asTerm++unLanguageName :: TTerm LanguageName -> TTerm String+unLanguageName n = unwrap _LanguageName @@ n++-- TODO: resolve _Language_name/_LanguageName conflict+languageNameProjection :: TTerm Language -> TTerm LanguageName+languageNameProjection c = project _Language _Language_name @@ c++-- TODO: resolve _Language_constraints/LanguageConstraints conflict+languageConstraintsProjection :: TTerm Language -> TTerm LanguageConstraints+languageConstraintsProjection c = project _Language _Language_constraints @@ c++languageConstraints :: TTerm (S.Set EliminationVariant)+ -> TTerm (S.Set LiteralVariant)+ -> TTerm (S.Set FloatType)+ -> TTerm (S.Set FunctionVariant)+ -> TTerm (S.Set IntegerType)+ -> TTerm (S.Set TermVariant)+ -> TTerm (S.Set TypeVariant)+ -> TTerm (Type -> Bool)+ -> TTerm LanguageConstraints+languageConstraints eliminationVariants+ literalVariants+ floatTypes+ functionVariants+ integerTypes+ termVariants+ typeVariants+ types = record _LanguageConstraints [+ _LanguageConstraints_eliminationVariants>>: eliminationVariants,+ _LanguageConstraints_literalVariants>>: literalVariants,+ _LanguageConstraints_floatTypes>>: floatTypes,+ _LanguageConstraints_functionVariants>>: functionVariants,+ _LanguageConstraints_integerTypes>>: integerTypes,+ _LanguageConstraints_termVariants>>: termVariants,+ _LanguageConstraints_typeVariants>>: typeVariants,+ _LanguageConstraints_types>>: types]++languageConstraintsEliminationVariants :: TTerm LanguageConstraints -> TTerm (S.Set EliminationVariant)+languageConstraintsEliminationVariants lc = project _LanguageConstraints _LanguageConstraints_eliminationVariants @@ lc++languageConstraintsLiteralVariants :: TTerm LanguageConstraints -> TTerm (S.Set LiteralVariant)+languageConstraintsLiteralVariants lc = project _LanguageConstraints _LanguageConstraints_literalVariants @@ lc++languageConstraintsFloatTypes :: TTerm LanguageConstraints -> TTerm (S.Set FloatType)+languageConstraintsFloatTypes lc = project _LanguageConstraints _LanguageConstraints_floatTypes @@ lc++languageConstraintsFunctionVariants :: TTerm LanguageConstraints -> TTerm (S.Set FunctionVariant)+languageConstraintsFunctionVariants lc = project _LanguageConstraints _LanguageConstraints_functionVariants @@ lc++languageConstraintsIntegerTypes :: TTerm LanguageConstraints -> TTerm (S.Set IntegerType)+languageConstraintsIntegerTypes lc = project _LanguageConstraints _LanguageConstraints_integerTypes @@ lc++languageConstraintsTermVariants :: TTerm LanguageConstraints -> TTerm (S.Set TermVariant)+languageConstraintsTermVariants lc = project _LanguageConstraints _LanguageConstraints_termVariants @@ lc++languageConstraintsTypeVariants :: TTerm LanguageConstraints -> TTerm (S.Set TypeVariant)+languageConstraintsTypeVariants lc = project _LanguageConstraints _LanguageConstraints_typeVariants @@ lc++languageConstraintsTypes :: TTerm LanguageConstraints -> TTerm (Type -> Bool)+languageConstraintsTypes lc = project _LanguageConstraints _LanguageConstraints_types @@ lc++traversalOrderPre = injectUnit _TraversalOrder _TraversalOrder_pre+traversalOrderPost = injectUnit _TraversalOrder _TraversalOrder_post
+ src/main/haskell/Hydra/Dsl/Meta/Common.hs view
@@ -0,0 +1,15 @@+{-# LANGUAGE FlexibleInstances #-}++-- | Common IsString instances for Term and Type, enabling OverloadedStrings++module Hydra.Dsl.Meta.Common where++import Hydra.Core+import Hydra.Phantoms++import Data.String(IsString(..))+++instance IsString Type where fromString = TypeVariable . Name+instance IsString Term where fromString = TermLiteral . LiteralString+instance IsString (TTerm a) where fromString = TTerm . TermLiteral . LiteralString
+ src/main/haskell/Hydra/Dsl/Meta/Compute.hs view
@@ -0,0 +1,100 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Meta-DSL for constructing compute-related terms (Flow, Trace, etc.)++module Hydra.Dsl.Meta.Compute where++import Hydra.Kernel+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Meta.Core as Core++import qualified Data.Map as M+import qualified Data.Maybe as Y+++adapter :: AsTerm c (Coder s1 s2 v1 v2) => TTerm Bool -> TTerm t1 -> TTerm t2 -> c -> TTerm (Adapter s1 s2 t1 t2 v1 v2)+adapter isLossy source target coderArg = record _Adapter [+ _Adapter_isLossy>>: isLossy,+ _Adapter_source>>: source,+ _Adapter_target>>: target,+ _Adapter_coder>>: asTerm coderArg]++adapterIsLossy :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm Bool+adapterIsLossy a = project _Adapter _Adapter_isLossy @@ a++adapterSource :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t1+adapterSource a = project _Adapter _Adapter_source @@ a++adapterTarget :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t2+adapterTarget a = project _Adapter _Adapter_target @@ a++adapterCoder :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm (Coder s1 s2 v1 v2)+adapterCoder a = project _Adapter _Adapter_coder @@ a++adapterWithCoder :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm (Coder s1 s2 v1 v2) -> TTerm (Adapter s1 s2 t1 t2 v1 v2)+adapterWithCoder a coder = adapter+ (Hydra.Dsl.Meta.Compute.adapterIsLossy a)+ (Hydra.Dsl.Meta.Compute.adapterSource a)+ (Hydra.Dsl.Meta.Compute.adapterTarget a)+ coder++adapterWithTarget :: TTerm (Adapter s1 s2 t1 t2 v1 v2) -> TTerm t2 -> TTerm (Adapter s1 s2 t1 t2 v1 v2)+adapterWithTarget a target = adapter+ (Hydra.Dsl.Meta.Compute.adapterIsLossy a)+ (Hydra.Dsl.Meta.Compute.adapterSource a)+ target+ (Hydra.Dsl.Meta.Compute.adapterCoder a)++coder :: TTerm (v1 -> Flow s1 v2) -> TTerm (v2 -> Flow s2 v1) -> TTerm (Coder s1 s2 v1 v2)+coder encode decode = record _Coder [+ _Coder_encode>>: encode,+ _Coder_decode>>: decode]++coderEncode :: TTerm (Coder s1 s2 v1 v2) -> TTerm (v1 -> Flow s1 v2)+coderEncode c = project _Coder _Coder_encode @@ c++coderDecode :: TTerm (Coder s1 s2 v1 v2) -> TTerm (v2 -> Flow s2 v1)+coderDecode c = project _Coder _Coder_decode @@ c++flow :: TTerm (s -> Trace -> FlowState s v) -> TTerm (Flow s v)+flow = wrap _Flow++flowState :: TTerm (Maybe x) -> TTerm s -> TTerm Trace -> TTerm (FlowState s x)+flowState value state trace = record _FlowState [+ _FlowState_value>>: value,+ _FlowState_state>>: state,+ _FlowState_trace>>: trace]++flowStateState :: TTerm (FlowState s x) -> TTerm s+flowStateState fs = project _FlowState _FlowState_state @@ fs++flowStateTrace :: TTerm (FlowState s x) -> TTerm Trace+flowStateTrace fs = project _FlowState _FlowState_trace @@ fs++flowStateValue :: TTerm (FlowState s x) -> TTerm (Maybe x)+flowStateValue fs = project _FlowState _FlowState_value @@ fs++trace :: TTerm [String] -> TTerm [String] -> TTerm (M.Map Name Term) -> TTerm Trace+trace stack messages other = record _Trace [+ _Trace_stack>>: stack,+ _Trace_messages>>: messages,+ _Trace_other>>: other]++traceStack :: TTerm Trace -> TTerm [String]+traceStack t = project _Trace _Trace_stack @@ t++traceMessages :: TTerm Trace -> TTerm [String]+traceMessages t = project _Trace _Trace_messages @@ t++traceOther :: TTerm Trace -> TTerm (M.Map Name Term)+traceOther t = project _Trace _Trace_other @@ t++traceWithOther :: TTerm Trace -> TTerm (M.Map Name Term) -> TTerm Trace+traceWithOther t other = record _Trace [+ _Trace_stack>>: Hydra.Dsl.Meta.Compute.traceStack t,+ _Trace_messages>>: Hydra.Dsl.Meta.Compute.traceMessages t,+ _Trace_other>>: other]++unFlow :: AsTerm t Trace => TTerm (Flow s x) -> TTerm s -> t -> TTerm (FlowState s x)+unFlow f s t = unwrap _Flow @@ f @@ s @@ asTerm t
+ src/main/haskell/Hydra/Dsl/Meta/Core.hs view
@@ -0,0 +1,596 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Meta-DSL for constructing Hydra core terms and types as first-class values++module Hydra.Dsl.Meta.Core where++import Hydra.Kernel+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Terms as Terms++-- For helpers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import Hydra.Sources.Libraries++import qualified Data.ByteString as B+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import Data.Int+import Prelude hiding (map, product)+++annotatedTerm :: TTerm Term -> TTerm (M.Map Name Term) -> TTerm AnnotatedTerm+annotatedTerm body annotation = Phantoms.record _AnnotatedTerm [+ _AnnotatedTerm_body>>: body,+ _AnnotatedTerm_annotation>>: annotation]++annotatedTermBody :: TTerm AnnotatedTerm -> TTerm Term+annotatedTermBody at = Phantoms.project _AnnotatedTerm _AnnotatedTerm_body @@ at++annotatedTermAnnotation :: TTerm AnnotatedTerm -> TTerm (M.Map Name Term)+annotatedTermAnnotation at = Phantoms.project _AnnotatedTerm _AnnotatedTerm_annotation @@ at++annotatedTermWithBody :: TTerm AnnotatedTerm -> TTerm Term -> TTerm AnnotatedTerm+annotatedTermWithBody at body = annotatedTerm body (Hydra.Dsl.Meta.Core.annotatedTermAnnotation at)++annotatedType :: TTerm Type -> TTerm (M.Map Name Term) -> TTerm AnnotatedType+annotatedType body annotation = Phantoms.record _AnnotatedType [+ _AnnotatedType_body>>: body,+ _AnnotatedType_annotation>>: annotation]++annotatedTypeBody :: TTerm AnnotatedType -> TTerm Type+annotatedTypeBody at = Phantoms.project _AnnotatedType _AnnotatedType_body @@ at++annotatedTypeAnnotation :: TTerm AnnotatedType -> TTerm (M.Map Name Term)+annotatedTypeAnnotation at = Phantoms.project _AnnotatedType _AnnotatedType_annotation @@ at++application :: TTerm Term -> TTerm Term -> TTerm Application+application function argument = Phantoms.record _Application [+ _Application_function>>: function,+ _Application_argument>>: argument]++applicationFunction :: TTerm Application -> TTerm Term+applicationFunction app = Phantoms.project _Application _Application_function @@ app++applicationArgument :: TTerm Application -> TTerm Term+applicationArgument app = Phantoms.project _Application _Application_argument @@ app++applicationType :: TTerm Type -> TTerm Type -> TTerm ApplicationType+applicationType function argument = Phantoms.record _ApplicationType [+ _ApplicationType_function>>: function,+ _ApplicationType_argument>>: argument]++applicationTypeFunction :: TTerm ApplicationType -> TTerm Type+applicationTypeFunction app = Phantoms.project _ApplicationType _ApplicationType_function @@ app++applicationTypeArgument :: TTerm ApplicationType -> TTerm Type+applicationTypeArgument app = Phantoms.project _ApplicationType _ApplicationType_argument @@ app++eitherType :: TTerm Type -> TTerm Type -> TTerm EitherType+eitherType left right = Phantoms.record _EitherType [+ _EitherType_left>>: left,+ _EitherType_right>>: right]++eitherTypeLeft :: TTerm EitherType -> TTerm Type+eitherTypeLeft et = Phantoms.project _EitherType _EitherType_left @@ et++eitherTypeRight :: TTerm EitherType -> TTerm Type+eitherTypeRight et = Phantoms.project _EitherType _EitherType_right @@ et++pairType :: TTerm Type -> TTerm Type -> TTerm PairType+pairType first second = Phantoms.record _PairType [+ _PairType_first>>: first,+ _PairType_second>>: second]++pairTypeFirst :: TTerm PairType -> TTerm Type+pairTypeFirst pt = Phantoms.project _PairType _PairType_first @@ pt++pairTypeSecond :: TTerm PairType -> TTerm Type+pairTypeSecond pt = Phantoms.project _PairType _PairType_second @@ pt++binding :: AsTerm t Term => TTerm Name -> t -> TTerm (Maybe TypeScheme) -> TTerm Binding+binding nameTerm termArg mtype = Phantoms.record _Binding [+ _Binding_name>>: nameTerm,+ _Binding_term>>: asTerm termArg,+ _Binding_type>>: mtype]++bindingName :: TTerm Binding -> TTerm Name+bindingName lb = Phantoms.project _Binding _Binding_name @@ lb++bindingTerm :: TTerm Binding -> TTerm Term+bindingTerm lb = Phantoms.project _Binding _Binding_term @@ lb++bindingType :: TTerm Binding -> TTerm (Y.Maybe TypeScheme)+bindingType lb = Phantoms.project _Binding _Binding_type @@ lb++bindingWithTerm :: TTerm Binding -> TTerm Term -> TTerm Binding+bindingWithTerm b term = binding (Hydra.Dsl.Meta.Core.bindingName b) term (Hydra.Dsl.Meta.Core.bindingType b)++caseStatement :: TTerm Name -> TTerm (Maybe Term) -> TTerm [Field] -> TTerm CaseStatement+caseStatement typeName defaultTerm cases = Phantoms.record _CaseStatement [+ _CaseStatement_typeName>>: typeName,+ _CaseStatement_default>>: defaultTerm,+ _CaseStatement_cases>>: cases]++caseStatementTypeName :: TTerm CaseStatement -> TTerm Name+caseStatementTypeName cs = Phantoms.project _CaseStatement _CaseStatement_typeName @@ cs++caseStatementDefault :: TTerm CaseStatement -> TTerm (Maybe Term)+caseStatementDefault cs = Phantoms.project _CaseStatement _CaseStatement_default @@ cs++caseStatementCases :: TTerm CaseStatement -> TTerm [Field]+caseStatementCases cs = Phantoms.project _CaseStatement _CaseStatement_cases @@ cs++eliminationRecord :: TTerm Projection -> TTerm Elimination+eliminationRecord = inject _Elimination _Elimination_record++eliminationUnion :: TTerm CaseStatement -> TTerm Elimination+eliminationUnion = inject _Elimination _Elimination_union++eliminationWrap :: TTerm Name -> TTerm Elimination+eliminationWrap = inject _Elimination _Elimination_wrap++field :: TTerm Name -> TTerm Term -> TTerm Field+field name term = Phantoms.record _Field [+ _Field_name>>: name,+ _Field_term>>: term]++fieldName :: TTerm Field -> TTerm Name+fieldName f = Phantoms.project _Field _Field_name @@ f++fieldTerm :: TTerm Field -> TTerm Term+fieldTerm f = Phantoms.project _Field _Field_term @@ f++fieldType :: TTerm Name -> TTerm Type -> TTerm FieldType+fieldType name typ = Phantoms.record _FieldType [+ _FieldType_name>>: name,+ _FieldType_type>>: typ]++fieldTypeName :: TTerm FieldType -> TTerm Name+fieldTypeName ft = Phantoms.project _FieldType _FieldType_name @@ ft++fieldTypeType :: TTerm FieldType -> TTerm Type+fieldTypeType ft = Phantoms.project _FieldType _FieldType_type @@ ft++floatTypeBigfloat :: TTerm FloatType+floatTypeBigfloat = injectUnit _FloatType _FloatType_bigfloat++floatTypeFloat32 :: TTerm FloatType+floatTypeFloat32 = injectUnit _FloatType _FloatType_float32++floatTypeFloat64 :: TTerm FloatType+floatTypeFloat64 = injectUnit _FloatType _FloatType_float64++floatValueBigfloat :: TTerm Double -> TTerm FloatValue+floatValueBigfloat = inject _FloatValue _FloatValue_bigfloat++floatValueFloat32 :: TTerm Float -> TTerm FloatValue+floatValueFloat32 = inject _FloatValue _FloatValue_float32++floatValueFloat64 :: TTerm Double -> TTerm FloatValue+floatValueFloat64 = inject _FloatValue _FloatValue_float64++forallType :: TTerm Name -> TTerm Type -> TTerm ForallType+forallType parameter body = Phantoms.record _ForallType [+ _ForallType_parameter>>: parameter,+ _ForallType_body>>: body]++forallTypeParameter :: TTerm ForallType -> TTerm Name+forallTypeParameter ft = Phantoms.project _ForallType _ForallType_parameter @@ ft++forallTypeBody :: TTerm ForallType -> TTerm Type+forallTypeBody ft = Phantoms.project _ForallType _ForallType_body @@ ft++functionElimination :: TTerm Elimination -> TTerm Function+functionElimination = inject _Function _Function_elimination++functionLambda :: TTerm Lambda -> TTerm Function+functionLambda = inject _Function _Function_lambda++functionPrimitive :: TTerm Name -> TTerm Function+functionPrimitive = inject _Function _Function_primitive++functionType :: TTerm Type -> TTerm Type -> TTerm FunctionType+functionType domain codomain = Phantoms.record _FunctionType [+ _FunctionType_domain>>: domain,+ _FunctionType_codomain>>: codomain]++functionTypeDomain :: TTerm FunctionType -> TTerm Type+functionTypeDomain ft = Phantoms.project _FunctionType _FunctionType_domain @@ ft++functionTypeCodomain :: TTerm FunctionType -> TTerm Type+functionTypeCodomain ft = Phantoms.project _FunctionType _FunctionType_codomain @@ ft++injection :: AsTerm t Name => t -> TTerm Field -> TTerm Injection+injection typeName field = Phantoms.record _Injection [+ _Injection_typeName>>: asTerm typeName,+ _Injection_field>>: field]++injectionTypeName :: TTerm Injection -> TTerm Name+injectionTypeName inj = Phantoms.project _Injection _Injection_typeName @@ inj++injectionField :: TTerm Injection -> TTerm Field+injectionField inj = Phantoms.project _Injection _Injection_field @@ inj++integerTypeBigint :: TTerm IntegerType+integerTypeBigint = injectUnit _IntegerType _IntegerType_bigint++integerTypeInt8 :: TTerm IntegerType+integerTypeInt8 = injectUnit _IntegerType _IntegerType_int8++integerTypeInt16 :: TTerm IntegerType+integerTypeInt16 = injectUnit _IntegerType _IntegerType_int16++integerTypeInt32 :: TTerm IntegerType+integerTypeInt32 = injectUnit _IntegerType _IntegerType_int32++integerTypeInt64 :: TTerm IntegerType+integerTypeInt64 = injectUnit _IntegerType _IntegerType_int64++integerTypeUint8 :: TTerm IntegerType+integerTypeUint8 = injectUnit _IntegerType _IntegerType_uint8++integerTypeUint16 :: TTerm IntegerType+integerTypeUint16 = injectUnit _IntegerType _IntegerType_uint16++integerTypeUint32 :: TTerm IntegerType+integerTypeUint32 = injectUnit _IntegerType _IntegerType_uint32++integerTypeUint64 :: TTerm IntegerType+integerTypeUint64 = injectUnit _IntegerType _IntegerType_uint64++integerValueBigint :: TTerm Integer -> TTerm IntegerValue+integerValueBigint = inject _IntegerValue _IntegerValue_bigint++integerValueInt8 :: TTerm Int8 -> TTerm IntegerValue+integerValueInt8 = inject _IntegerValue _IntegerValue_int8++integerValueInt16 :: TTerm Int16 -> TTerm IntegerValue+integerValueInt16 = inject _IntegerValue _IntegerValue_int16++integerValueInt32 :: TTerm Int -> TTerm IntegerValue+integerValueInt32 = inject _IntegerValue _IntegerValue_int32++integerValueInt64 :: TTerm Int64 -> TTerm IntegerValue+integerValueInt64 = inject _IntegerValue _IntegerValue_int64++integerValueUint8 :: TTerm Int16 -> TTerm IntegerValue+integerValueUint8 = inject _IntegerValue _IntegerValue_uint8++integerValueUint16 :: TTerm Int -> TTerm IntegerValue+integerValueUint16 = inject _IntegerValue _IntegerValue_uint16++integerValueUint32 :: TTerm Int64 -> TTerm IntegerValue+integerValueUint32 = inject _IntegerValue _IntegerValue_uint32++integerValueUint64 :: TTerm Integer -> TTerm IntegerValue+integerValueUint64 = inject _IntegerValue _IntegerValue_uint64++lambda :: TTerm Name -> TTerm (Maybe Type) -> TTerm Term -> TTerm Lambda+lambda parameter mdom body = Phantoms.record _Lambda [+ _Lambda_parameter>>: parameter,+ _Lambda_domain>>: mdom,+ _Lambda_body>>: body]++lambdaParameter :: TTerm Lambda -> TTerm Name+lambdaParameter l = Phantoms.project _Lambda _Lambda_parameter @@ l++lambdaBody :: TTerm Lambda -> TTerm Term+lambdaBody l = Phantoms.project _Lambda _Lambda_body @@ l++lambdaDomain :: TTerm Lambda -> TTerm (Maybe Type)+lambdaDomain l = Phantoms.project _Lambda _Lambda_domain @@ l++lambdaWithBody :: TTerm Lambda -> TTerm Term -> TTerm Lambda+lambdaWithBody l body = Hydra.Dsl.Meta.Core.lambda (Hydra.Dsl.Meta.Core.lambdaParameter l) (Hydra.Dsl.Meta.Core.lambdaDomain l) body++let_ :: TTerm [Binding] -> TTerm Term -> TTerm Let+let_ bindings body = Phantoms.record _Let [+ _Let_bindings>>: bindings,+ _Let_body>>: body]++letBindings :: TTerm Let -> TTerm [Binding]+letBindings l = Phantoms.project _Let _Let_bindings @@ l++letBody :: TTerm Let -> TTerm Term+letBody l = Phantoms.project _Let _Let_body @@ l++letWithBody :: TTerm Let -> TTerm Term -> TTerm Let+letWithBody l body = let_ (Hydra.Dsl.Meta.Core.letBindings l) body++literalBinary :: TTerm B.ByteString -> TTerm Literal+literalBinary = inject _Literal _Literal_binary++literalBoolean :: TTerm Bool -> TTerm Literal+literalBoolean = inject _Literal _Literal_boolean++literalFloat :: TTerm FloatValue -> TTerm Literal+literalFloat = inject _Literal _Literal_float++literalInteger :: TTerm IntegerValue -> TTerm Literal+literalInteger = inject _Literal _Literal_integer++literalString :: TTerm String -> TTerm Literal+literalString = inject _Literal _Literal_string++literalTypeBinary :: TTerm LiteralType+literalTypeBinary = injectUnit _LiteralType _LiteralType_binary++literalTypeBoolean :: TTerm LiteralType+literalTypeBoolean = injectUnit _LiteralType _LiteralType_boolean++literalTypeFloat :: TTerm FloatType -> TTerm LiteralType+literalTypeFloat = inject _LiteralType _LiteralType_float++literalTypeInteger :: TTerm IntegerType -> TTerm LiteralType+literalTypeInteger = inject _LiteralType _LiteralType_integer++literalTypeString :: TTerm LiteralType+literalTypeString = injectUnit _LiteralType _LiteralType_string++mapType :: TTerm Type -> TTerm Type -> TTerm MapType+mapType keys values = Phantoms.record _MapType [+ _MapType_keys>>: keys,+ _MapType_values>>: values]++mapTypeKeys :: TTerm MapType -> TTerm Type+mapTypeKeys mt = Phantoms.project _MapType _MapType_keys @@ mt++mapTypeValues :: TTerm MapType -> TTerm Type+mapTypeValues mt = Phantoms.project _MapType _MapType_values @@ mt++name :: TTerm String -> TTerm Name+name = wrap _Name++nameLift :: Name -> TTerm Name+nameLift (Name n) = wrap _Name $ Phantoms.string n++projection :: TTerm Name -> TTerm Name -> TTerm Projection+projection tname fname = Phantoms.record _Projection [+ _Projection_typeName>>: tname,+ _Projection_field>>: fname]++projectionTypeName :: TTerm Projection -> TTerm Name+projectionTypeName p = Phantoms.project _Projection _Projection_typeName @@ p++projectionField :: TTerm Projection -> TTerm Name+projectionField p = Phantoms.project _Projection _Projection_field @@ p++record :: TTerm Name -> TTerm [Field] -> TTerm Record+record typeName fields = Phantoms.record _Record [+ _Record_typeName>>: typeName,+ _Record_fields>>: fields]++recordTypeName :: TTerm Record -> TTerm Name+recordTypeName r = Phantoms.project _Record _Record_typeName @@ r++recordFields :: TTerm Record -> TTerm [Field]+recordFields r = Phantoms.project _Record _Record_fields @@ r++rowType :: AsTerm t Name => t -> TTerm [FieldType] -> TTerm (RowType)+rowType typeName fields = Phantoms.record _RowType [+ _RowType_typeName>>: asTerm typeName,+ _RowType_fields>>: fields]++rowTypeTypeName :: TTerm RowType -> TTerm Name+rowTypeTypeName rt = Phantoms.project _RowType _RowType_typeName @@ rt++rowTypeFields :: TTerm RowType -> TTerm [FieldType]+rowTypeFields rt = Phantoms.project _RowType _RowType_fields @@ rt++termAnnotated :: TTerm AnnotatedTerm -> TTerm Term+termAnnotated = inject _Term _Term_annotated++termApplication :: TTerm Application -> TTerm Term+termApplication = inject _Term _Term_application++termEither :: TTerm (Either Term Term) -> TTerm Term+termEither = inject _Term _Term_either++termFunction :: TTerm Function -> TTerm Term+termFunction = inject _Term _Term_function++termLet :: TTerm Let -> TTerm Term+termLet = inject _Term _Term_let++termList :: TTerm [Term] -> TTerm Term+termList = inject _Term _Term_list++termLiteral :: TTerm Literal -> TTerm Term+termLiteral = inject _Term _Term_literal++termMap :: TTerm (M.Map Term Term) -> TTerm Term+termMap = inject _Term _Term_map++termMaybe :: TTerm (Maybe Term) -> TTerm Term+termMaybe = inject _Term _Term_maybe++termPair :: TTerm (Term, Term) -> TTerm Term+termPair = inject _Term _Term_pair++termRecord :: TTerm Record -> TTerm Term+termRecord = inject _Term _Term_record++termSet :: TTerm (S.Set Term) -> TTerm Term+termSet = inject _Term _Term_set++termTypeLambda :: TTerm TypeLambda -> TTerm Term+termTypeLambda = inject _Term _Term_typeLambda++termTypeApplication :: TTerm TypeApplicationTerm -> TTerm Term+termTypeApplication = inject _Term _Term_typeApplication++termUnion :: TTerm Injection -> TTerm Term+termUnion = inject _Term _Term_union++termUnit :: TTerm Term+termUnit = injectUnit _Term _Term_unit++termVariable :: TTerm Name -> TTerm Term+termVariable = inject _Term _Term_variable++termWrap :: TTerm WrappedTerm -> TTerm Term+termWrap = inject _Term _Term_wrap++typeLambda :: TTerm Name -> TTerm Term -> TTerm TypeLambda+typeLambda parameter body = Phantoms.record _TypeLambda [+ _TypeLambda_parameter>>: parameter,+ _TypeLambda_body>>: body]++typeLambdaParameter :: TTerm TypeLambda -> TTerm Name+typeLambdaParameter ta = Phantoms.project _TypeLambda _TypeLambda_parameter @@ ta++typeLambdaBody :: TTerm TypeLambda -> TTerm Term+typeLambdaBody ta = Phantoms.project _TypeLambda _TypeLambda_body @@ ta++typeLambdaWithBody :: TTerm TypeLambda -> TTerm Term -> TTerm TypeLambda+typeLambdaWithBody tl body = typeLambda (Phantoms.project _TypeLambda _TypeLambda_parameter @@ tl) body++typeAnnotated :: TTerm AnnotatedType -> TTerm Type+typeAnnotated = inject _Type _Type_annotated++typeApplication :: TTerm ApplicationType -> TTerm Type+typeApplication = inject _Type _Type_application++typeEither :: TTerm EitherType -> TTerm Type+typeEither = inject _Type _Type_either++typeForall :: TTerm ForallType -> TTerm Type+typeForall = inject _Type _Type_forall++typeFunction :: TTerm FunctionType -> TTerm Type+typeFunction = inject _Type _Type_function++typeList :: TTerm Type -> TTerm Type+typeList = inject _Type _Type_list++typeLiteral :: TTerm LiteralType -> TTerm Type+typeLiteral = inject _Type _Type_literal++typeMap :: TTerm MapType -> TTerm Type+typeMap = inject _Type _Type_map++typeMaybe :: TTerm Type -> TTerm Type+typeMaybe = inject _Type _Type_maybe++typePair :: TTerm PairType -> TTerm Type+typePair = inject _Type _Type_pair++typeRecord :: TTerm RowType -> TTerm Type+typeRecord = inject _Type _Type_record++typeScheme :: TTerm [Name] -> TTerm Type -> TTerm (Maybe (M.Map Name TypeVariableMetadata)) -> TTerm TypeScheme+typeScheme variables body constraints = Phantoms.record _TypeScheme [+ _TypeScheme_variables>>: variables,+ _TypeScheme_type>>: body,+ _TypeScheme_constraints>>: constraints]++typeVariableMetadata :: TTerm (S.Set Name) -> TTerm TypeVariableMetadata+typeVariableMetadata classes = Phantoms.record _TypeVariableMetadata [+ _TypeVariableMetadata_classes>>: classes]++typeVariableMetadataClasses :: TTerm TypeVariableMetadata -> TTerm (S.Set Name)+typeVariableMetadataClasses meta = Phantoms.project _TypeVariableMetadata _TypeVariableMetadata_classes @@ meta++typeSchemeVariables :: TTerm TypeScheme -> TTerm [Name]+typeSchemeVariables ts = Phantoms.project _TypeScheme _TypeScheme_variables @@ ts++typeSchemeType :: TTerm TypeScheme -> TTerm Type+typeSchemeType ts = Phantoms.project _TypeScheme _TypeScheme_type @@ ts++typeSchemeConstraints :: TTerm TypeScheme -> TTerm (Maybe (M.Map Name TypeVariableMetadata))+typeSchemeConstraints ts = Phantoms.project _TypeScheme _TypeScheme_constraints @@ ts++typeSet :: TTerm Type -> TTerm Type+typeSet = inject _Type _Type_set++typeUnion :: TTerm RowType -> TTerm Type+typeUnion = inject _Type _Type_union++typeUnit :: TTerm Type+typeUnit = injectUnit _Type _Type_unit++typeVariable :: AsTerm t Name => t -> TTerm Type+typeVariable n = inject _Type _Type_variable (asTerm n)++typeWrap :: TTerm WrappedType -> TTerm Type+typeWrap = inject _Type _Type_wrap++typeApplicationTerm :: TTerm Term -> TTerm Type -> TTerm TypeApplicationTerm+typeApplicationTerm body type_ = Phantoms.record _TypeApplicationTerm [+ _TypeApplicationTerm_body>>: body,+ _TypeApplicationTerm_type>>: type_]++typeApplicationTermBody :: TTerm TypeApplicationTerm -> TTerm Term+typeApplicationTermBody tt = Phantoms.project _TypeApplicationTerm _TypeApplicationTerm_body @@ tt++typeApplicationTermType :: TTerm TypeApplicationTerm -> TTerm Type+typeApplicationTermType tt = Phantoms.project _TypeApplicationTerm _TypeApplicationTerm_type @@ tt++unName :: TTerm Name -> TTerm String+unName n = unwrap _Name @@ n++unNamespace :: TTerm Namespace -> TTerm String+unNamespace ns = unwrap _Namespace @@ ns++wrappedTerm :: TTerm Name -> TTerm Term -> TTerm WrappedTerm+wrappedTerm typeName object = Phantoms.record _WrappedTerm [+ _WrappedTerm_typeName>>: typeName,+ _WrappedTerm_body>>: object]++wrappedTermTypeName :: TTerm WrappedTerm -> TTerm Name+wrappedTermTypeName wt = Phantoms.project _WrappedTerm _WrappedTerm_typeName @@ wt++wrappedTermBody :: TTerm WrappedTerm -> TTerm Term+wrappedTermBody wt = Phantoms.project _WrappedTerm _WrappedTerm_body @@ wt++wrappedType :: AsTerm t Name => t -> TTerm Type -> TTerm WrappedType+wrappedType typeName object = Phantoms.record _WrappedType [+ _WrappedType_typeName>>: asTerm typeName,+ _WrappedType_body>>: object]++wrappedTypeTypeName :: TTerm WrappedType -> TTerm Name+wrappedTypeTypeName wt = Phantoms.project _WrappedType _WrappedType_typeName @@ wt++wrappedTypeBody :: TTerm WrappedType -> TTerm Type+wrappedTypeBody wt = Phantoms.project _WrappedType _WrappedType_body @@ wt++----------------------------------------+-- Non-schema helpers++equalName :: TTerm (Name -> Name -> Bool)+equalName = lambdas ["left", "right"] $ primitive _equality_equal+ @@ (Hydra.Dsl.Meta.Core.unName $ var "left")+ @@ (Hydra.Dsl.Meta.Core.unName $ var "right")++equalName_ :: TTerm Name -> TTerm Name -> TTerm Bool+equalName_ left right = Equality.equal (Hydra.Dsl.Meta.Core.unName left) (Hydra.Dsl.Meta.Core.unName right)++equalNameList :: TTerm ([Name] -> [Name] -> Bool)+equalNameList = lambdas ["lefts", "rights"] $ Logic.and+ (Equality.equal (Lists.length (var "lefts")) (Lists.length (var "rights")))+ (Logic.ands $ Lists.zipWith equalName (var "lefts") (var "rights"))++equalNameList_ :: TTerm [Name] -> TTerm [Name] -> TTerm Bool+equalNameList_ lefts rights = Logic.and+ (Equality.equal (Lists.length lefts) (Lists.length rights))+ (Logic.ands $ Lists.zipWith equalName lefts rights)++fieldWithTerm :: TTerm Term -> TTerm Field -> TTerm Field+fieldWithTerm t ft = Hydra.Dsl.Meta.Core.field (Hydra.Dsl.Meta.Core.fieldName ft) t++fieldTypeWithType :: TTerm FieldType -> TTerm Type -> TTerm FieldType+fieldTypeWithType ft t = Hydra.Dsl.Meta.Core.fieldType (Hydra.Dsl.Meta.Core.fieldTypeName ft) t++false :: TTerm Term+false = termLiteral $ literalBoolean $ Phantoms.false++int32 :: Int -> TTerm Term+int32 = termLiteral . literalInteger . integerValueInt32 . Phantoms.int32++string :: String -> TTerm Term+string = termLiteral . literalString . Phantoms.string
+ src/main/haskell/Hydra/Dsl/Meta/DeepCore.hs view
@@ -0,0 +1,162 @@+-- | A domain-specific language for constructing Hydra terms in Haskell.+--+-- This DSL provides helpers for constructing "deep" terms - i.e., terms that+-- represent Hydra terms as data (Term values), as opposed to the shallow DSL+-- that works at the Haskell level.+module Hydra.Dsl.Meta.DeepCore where++import Hydra.Kernel+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as P++import qualified Data.Char as C+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+++--------------------------------------------------------------------------------+-- Application operators+--------------------------------------------------------------------------------++-- | Apply a function term to an argument term (infix operator, alias)+(@@@) :: TTerm Term -> TTerm Term -> TTerm Term+fun @@@ arg = apply fun arg++-- | Apply a function term to an argument term+apply :: TTerm Term -> TTerm Term -> TTerm Term+apply lhs rhs = Core.termApplication $ Core.application lhs rhs++--------------------------------------------------------------------------------+-- Case statements and pattern matching+--------------------------------------------------------------------------------++cases :: Name -> TTerm Term -> TTerm (Maybe Term) -> [TTerm Field] -> TTerm Term+cases tname arg dflt fields = match tname dflt fields @@@ arg++-- | Create a union case statement with optional default case+match :: Name -> TTerm (Maybe Term) -> [TTerm Field] -> TTerm Term+match tname dflt fields = Core.termFunction $ Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement+ (Core.nameLift tname)+ dflt+ (P.list fields)++-- | Create a field for case matching+field :: Name -> TTerm Term -> TTerm Field+field fname body = Core.field (Core.nameLift fname) body++--------------------------------------------------------------------------------+-- Functions and lambdas+--------------------------------------------------------------------------------++-- | Create a lambda term with a variable name and body+lambda :: String -> TTerm Term -> TTerm Term+lambda v body = Core.termFunction $ Core.functionLambda $ Core.lambda (Core.name (P.string v)) P.nothing $ body++constant :: TTerm Term -> TTerm Term+constant = lambda ignoredVariable++-- | Create a reference to a primitive function+primitive :: Name -> TTerm Term+primitive name = Core.termFunction $ Core.functionPrimitive $ Core.nameLift name++-- TODO: this is probably equivalent to `primitive`.+-- | Create a reference to a primitive function using encodedName+-- (for primitives that need namespace encoding)+primitiveEncoded :: Name -> TTerm Term+primitiveEncoded name = Core.termFunction $ Core.functionPrimitive $ P.encodedName name++--------------------------------------------------------------------------------+-- Projections and eliminations+--------------------------------------------------------------------------------++-- | Create a record field projection+project :: Name -> Name -> TTerm Term+project tname fname = Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $+ Core.projection (Core.nameLift tname) (Core.nameLift fname)++unwrap :: Name -> TTerm Term+unwrap name = unwrapDynamic (Core.nameLift name)++-- | Create an unwrap elimination for a wrapped type+unwrapDynamic :: TTerm Name -> TTerm Term+unwrapDynamic tname = Core.termFunction $ Core.functionElimination $ Core.eliminationWrap tname++--------------------------------------------------------------------------------+-- Literals and basic terms+--------------------------------------------------------------------------------++-- | Create a string literal term+string :: TTerm String -> TTerm Term+string s = Core.termLiteral $ Core.literalString s++-- | Create a variable reference term+var :: String -> TTerm Term+var s = Core.termVariable $ Core.name $ P.string s++-- | Create a unit term+unit :: TTerm Term+unit = Core.termUnit++--------------------------------------------------------------------------------+-- Compound terms (records, unions, wraps, lists)+--------------------------------------------------------------------------------++-- | Create a union injection term+injection :: Name -> TTerm Field -> TTerm Term+injection tname fld = Core.termUnion $ Core.injection (Core.nameLift tname) fld++-- | Create a record term with a type name and fields+record :: Name -> [TTerm Field] -> TTerm Term+record tname fields = Core.termRecord $ Core.record (Core.nameLift tname) (P.list fields)++-- | Create a list term from a list of terms+list :: TTerm [Term] -> TTerm Term+list terms = Core.termList terms++map :: TTerm (M.Map Term Term) -> TTerm Term+map terms = Core.termMap terms++-- | Create an Either term (left or right)+either :: TTerm (Either Term Term) -> TTerm Term+either e = Core.termEither e++left :: TTerm Term -> TTerm Term+left (TTerm t) = Core.termEither $ TTerm $ TermEither $ Left t++right :: TTerm Term -> TTerm Term+right (TTerm t) = Core.termEither $ TTerm $ TermEither $ Right t++-- | Create a let expression with bindings and a body+-- Each binding is a (name, term) pair+lets :: [(String, TTerm Term)] -> TTerm Term -> TTerm Term+lets bindings body = Core.termLet $ Core.let_+ (P.list [Core.binding (Core.name (P.string n)) t P.nothing | (n, t) <- bindings])+ body++-- | Create a single let binding+letn :: String -> TTerm Term -> TTerm Term -> TTerm Term+letn name value body = lets [(name, value)] body++pair :: TTerm Term -> TTerm Term -> TTerm Term+pair (TTerm first) (TTerm second) = Core.termPair $ TTerm $ TermPair (first, second)++-- | Create a Nothing term+nothing :: TTerm Term+nothing = TTerm $ TermMaybe Nothing++-- | Create a Just term+just :: TTerm Term -> TTerm Term+just (TTerm t) = TTerm $ TermMaybe $ Just t++ref :: TBinding a -> TTerm Term+ref (TBinding name _) = Core.termVariable $ Core.nameLift name++-- | Create a wrap term with a type name and body+wrap :: Name -> TTerm Term -> TTerm Term+wrap tname body = Core.termWrap $ Core.wrappedTerm (Core.nameLift tname) body++-- | Create a wrap term with a dynamic type name (TTerm Name)+wrapDynamic :: TTerm Name -> TTerm Term -> TTerm Term+wrapDynamic tname body = Core.termWrap $ Core.wrappedTerm tname body
+ src/main/haskell/Hydra/Dsl/Meta/Grammar.hs view
@@ -0,0 +1,40 @@+-- | Meta-DSL for constructing grammar-related terms (patterns, productions)++module Hydra.Dsl.Meta.Grammar where++import Hydra.Kernel hiding (Pattern)+import Hydra.Dsl.Meta.Phantoms+import Hydra.Grammar++import qualified Data.Map as M+import qualified Data.Maybe as Y+++labeledPatternLabel :: TTerm LabeledPattern -> TTerm Label+labeledPatternLabel lp = project _LabeledPattern _LabeledPattern_label @@ lp++labeledPatternPattern :: TTerm LabeledPattern -> TTerm Pattern+labeledPatternPattern lp = project _LabeledPattern _LabeledPattern_pattern @@ lp++production :: TTerm Symbol -> TTerm Pattern -> TTerm Production+production sym pat = record _Production [+ _Production_symbol>>: sym,+ _Production_pattern>>: pat]++productionSymbol :: TTerm Production -> TTerm Symbol+productionSymbol p = project _Production _Production_symbol @@ p++productionPattern :: TTerm Production -> TTerm Pattern+productionPattern p = project _Production _Production_pattern @@ p++unConstant :: TTerm Constant -> TTerm String+unConstant c = unwrap _Constant @@ c++unGrammar :: TTerm Grammar -> TTerm [Production]+unGrammar g = unwrap _Grammar @@ g++unLabel :: TTerm Label -> TTerm String+unLabel l = unwrap _Label @@ l++unSymbol :: TTerm Symbol -> TTerm String+unSymbol s = unwrap _Symbol @@ s
+ src/main/haskell/Hydra/Dsl/Meta/Graph.hs view
@@ -0,0 +1,135 @@+-- | Meta-DSL for constructing graph-related terms (Comparison, Primitive, etc.)++module Hydra.Dsl.Meta.Graph where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms++import qualified Data.Map as M+++comparisonLessThan :: TTerm Comparison+comparisonLessThan = injectUnit _Comparison _Comparison_lessThan++comparisonEqualTo :: TTerm Comparison+comparisonEqualTo = injectUnit _Comparison _Comparison_equalTo++comparisonGreaterThan :: TTerm Comparison+comparisonGreaterThan = injectUnit _Comparison _Comparison_greaterThan++graph :: TTerm [Binding]+ -> TTerm (M.Map Name (Maybe Term))+ -> TTerm (M.Map Name TypeScheme)+ -> TTerm Term+ -> TTerm (M.Map Name Primitive)+ -> TTerm (Maybe Graph)+ -> TTerm Graph+graph elements environment types body primitives schema = record _Graph [+ _Graph_elements>>: elements,+ _Graph_environment>>: environment,+ _Graph_types>>: types,+ _Graph_body>>: body,+ _Graph_primitives>>: primitives,+ _Graph_schema>>: schema]++graphElements :: TTerm Graph -> TTerm [Binding]+graphElements g = project _Graph _Graph_elements @@ g++graphEnvironment :: TTerm Graph -> TTerm (M.Map Name (Maybe Term))+graphEnvironment g = project _Graph _Graph_environment @@ g++graphTypes :: TTerm Graph -> TTerm (M.Map Name TypeScheme)+graphTypes g = project _Graph _Graph_types @@ g++graphBody :: TTerm Graph -> TTerm Term+graphBody g = project _Graph _Graph_body @@ g++graphPrimitives :: TTerm Graph -> TTerm (M.Map Name Primitive)+graphPrimitives g = project _Graph _Graph_primitives @@ g++graphSchema :: TTerm Graph -> TTerm (Maybe Graph)+graphSchema g = project _Graph _Graph_schema @@ g++graphWithElements :: TTerm Graph -> TTerm [Binding] -> TTerm Graph+graphWithElements g newElements = graph+ newElements+ (Hydra.Dsl.Meta.Graph.graphEnvironment g)+ (Hydra.Dsl.Meta.Graph.graphTypes g)+ (Hydra.Dsl.Meta.Graph.graphBody g)+ (Hydra.Dsl.Meta.Graph.graphPrimitives g)+ (Hydra.Dsl.Meta.Graph.graphSchema g)++graphWithEnvironment :: TTerm Graph -> TTerm (M.Map Name (Maybe Term)) -> TTerm Graph+graphWithEnvironment g newEnvironment = graph+ (Hydra.Dsl.Meta.Graph.graphElements g)+ newEnvironment+ (Hydra.Dsl.Meta.Graph.graphTypes g)+ (Hydra.Dsl.Meta.Graph.graphBody g)+ (Hydra.Dsl.Meta.Graph.graphPrimitives g)+ (Hydra.Dsl.Meta.Graph.graphSchema g)++graphWithTypes :: TTerm Graph -> TTerm (M.Map Name TypeScheme) -> TTerm Graph+graphWithTypes g newTypes = graph+ (Hydra.Dsl.Meta.Graph.graphElements g)+ (Hydra.Dsl.Meta.Graph.graphEnvironment g)+ newTypes+ (Hydra.Dsl.Meta.Graph.graphBody g)+ (Hydra.Dsl.Meta.Graph.graphPrimitives g)+ (Hydra.Dsl.Meta.Graph.graphSchema g)++graphWithBody :: TTerm Graph -> TTerm Term -> TTerm Graph+graphWithBody g newBody = graph+ (Hydra.Dsl.Meta.Graph.graphElements g)+ (Hydra.Dsl.Meta.Graph.graphEnvironment g)+ (Hydra.Dsl.Meta.Graph.graphTypes g)+ newBody+ (Hydra.Dsl.Meta.Graph.graphPrimitives g)+ (Hydra.Dsl.Meta.Graph.graphSchema g)++graphWithPrimitives :: TTerm Graph -> TTerm (M.Map Name Primitive) -> TTerm Graph+graphWithPrimitives g newPrimitives = graph+ (Hydra.Dsl.Meta.Graph.graphElements g)+ (Hydra.Dsl.Meta.Graph.graphEnvironment g)+ (Hydra.Dsl.Meta.Graph.graphTypes g)+ (Hydra.Dsl.Meta.Graph.graphBody g)+ newPrimitives+ (Hydra.Dsl.Meta.Graph.graphSchema g)++graphWithSchema :: TTerm Graph -> TTerm (Maybe Graph) -> TTerm Graph+graphWithSchema g newSchema = graph+ (Hydra.Dsl.Meta.Graph.graphElements g)+ (Hydra.Dsl.Meta.Graph.graphEnvironment g)+ (Hydra.Dsl.Meta.Graph.graphTypes g)+ (Hydra.Dsl.Meta.Graph.graphBody g)+ (Hydra.Dsl.Meta.Graph.graphPrimitives g)+ newSchema++primitive :: TTerm Name+ -> TTerm TypeScheme+ -> TTerm ([Term] -> Flow Graph Term)+ -> TTerm Primitive+primitive name typ implementation = record _Primitive [+ _Primitive_name>>: name,+ _Primitive_type>>: typ,+ _Primitive_implementation>>: implementation]++primitiveName :: TTerm Primitive -> TTerm Name+primitiveName p = project _Primitive _Primitive_name @@ p++primitiveType :: TTerm Primitive -> TTerm TypeScheme+primitiveType p = project _Primitive _Primitive_type @@ p++primitiveImplementation :: TTerm Primitive -> TTerm ([Term] -> Flow Graph Term)+primitiveImplementation p = project _Primitive _Primitive_implementation @@ p++primitiveWithType :: TTerm Primitive -> TTerm TypeScheme -> TTerm Primitive+primitiveWithType p newType = Hydra.Dsl.Meta.Graph.primitive+ (Hydra.Dsl.Meta.Graph.primitiveName p)+ newType+ (Hydra.Dsl.Meta.Graph.primitiveImplementation p)++typeClassEquality :: TTerm TypeClass+typeClassEquality = injectUnit _TypeClass _TypeClass_equality++typeClassOrdering :: TTerm TypeClass+typeClassOrdering = injectUnit _TypeClass _TypeClass_ordering
+ src/main/haskell/Hydra/Dsl/Meta/Json.hs view
@@ -0,0 +1,28 @@+-- | Meta-DSL for constructing JSON value terms++module Hydra.Dsl.Meta.Json where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Json.Model++import qualified Data.Map as M+++valueArray :: TTerm [Value] -> TTerm Value+valueArray = inject _Value _Value_array++valueBoolean :: TTerm Bool -> TTerm Value+valueBoolean = inject _Value _Value_boolean++valueNull :: TTerm Value+valueNull = injectUnit _Value _Value_null++valueNumber :: TTerm Double -> TTerm Value+valueNumber = inject _Value _Value_number++valueObject :: TTerm (M.Map String Value) -> TTerm Value+valueObject = inject _Value _Value_object++valueString :: TTerm String -> TTerm Value+valueString = inject _Value _Value_string
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Chars.hs view
@@ -0,0 +1,33 @@+-- | Phantom-typed term DSL for the hydra.lib.chars library++module Hydra.Dsl.Meta.Lib.Chars where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++-- Follow's GHC.s Data.Char.isAlphaNum+isAlphaNum :: TTerm Int -> TTerm Bool+isAlphaNum = primitive1 _chars_isAlphaNum++-- Follows GHC's Data.Char.isLower (GHC.Internal.Unicode.isLower)+isLower :: TTerm Int -> TTerm Bool+isLower = primitive1 _chars_isLower++-- Follow's GHC.s Data.Char.isSpace+isSpace :: TTerm Int -> TTerm Bool+isSpace = primitive1 _chars_isSpace++-- Follows GHC's Data.Char.isUpper (GHC.Internal.Unicode.isUpper)+isUpper :: TTerm Int -> TTerm Bool+isUpper = primitive1 _chars_isUpper++-- Follows GHC's toLower (GHC.Internal.Unicode.Char.UnicodeData.SimpleLowerCaseMapping.toSimpleLowerCase)+toLower :: TTerm Int -> TTerm Int+toLower = primitive1 _chars_toLower++-- Follows GHC's toUpper (GHC.Internal.Unicode.Char.UnicodeData.SimpleUpperCaseMapping.toSimpleUpperCase)+toUpper :: TTerm Int -> TTerm Int+toUpper = primitive1 _chars_toUpper
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Eithers.hs view
@@ -0,0 +1,48 @@+-- | Phantom-typed term DSL for the hydra.lib.eithers library++module Hydra.Dsl.Meta.Lib.Eithers where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++bind :: TTerm (Either a b) -> TTerm (b -> Either a c) -> TTerm (Either a c)+bind = primitive2 _eithers_bind++bimap :: TTerm (a -> c) -> TTerm (b -> d) -> TTerm (Either a b) -> TTerm (Either c d)+bimap = primitive3 _eithers_bimap++either_ :: TTerm (a -> c) -> TTerm (b -> c) -> TTerm (Either a b) -> TTerm c+either_ = primitive3 _eithers_either++fromLeft :: TTerm a -> TTerm (Either a b) -> TTerm a+fromLeft = primitive2 _eithers_fromLeft++fromRight :: TTerm b -> TTerm (Either a b) -> TTerm b+fromRight = primitive2 _eithers_fromRight++isLeft :: TTerm (Either a b) -> TTerm Bool+isLeft = primitive1 _eithers_isLeft++isRight :: TTerm (Either a b) -> TTerm Bool+isRight = primitive1 _eithers_isRight++lefts :: TTerm [Either a b] -> TTerm [a]+lefts = primitive1 _eithers_lefts++map :: TTerm (a -> b) -> TTerm (Either c a) -> TTerm (Either c b)+map = primitive2 _eithers_map++mapList :: TTerm (a -> Either e b) -> TTerm [a] -> TTerm (Either e [b])+mapList = primitive2 _eithers_mapList++mapMaybe :: TTerm (a -> Either c b) -> TTerm (Maybe a) -> TTerm (Either c (Maybe b))+mapMaybe = primitive2 _eithers_mapMaybe++partitionEithers :: TTerm [Either a b] -> TTerm ([a], [b])+partitionEithers = primitive1 _eithers_partitionEithers++rights :: TTerm [Either a b] -> TTerm [b]+rights = primitive1 _eithers_rights
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Equality.hs view
@@ -0,0 +1,42 @@+-- | Phantom-typed term DSL for the hydra.lib.equality library++{-# LANGUAGE FlexibleContexts #-}++module Hydra.Dsl.Meta.Lib.Equality where++import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import Hydra.Phantoms+import Hydra.Util+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries++import Data.Int+++compare :: AsTerm t2 a => TTerm a -> t2 -> TTerm Comparison+compare t1 t2 = primitive2 _equality_compare t1 (asTerm t2)++equal :: AsTerm t2 a => TTerm a -> t2 -> TTerm Bool+equal t1 t2 = primitive2 _equality_equal t1 (asTerm t2)++gt :: AsTerm t2 a => TTerm a -> t2 -> TTerm Bool+gt t1 t2 = primitive2 _equality_gt t1 (asTerm t2)++gte :: AsTerm t2 a => TTerm a -> t2 -> TTerm Bool+gte t1 t2 = primitive2 _equality_gte t1 (asTerm t2)++identity :: TTerm a -> TTerm a+identity = primitive1 _equality_identity++lt :: AsTerm t2 a => TTerm a -> t2 -> TTerm Bool+lt t1 t2 = primitive2 _equality_lt t1 (asTerm t2)++lte :: AsTerm t2 a => TTerm a -> t2 -> TTerm Bool+lte t1 t2 = primitive2 _equality_lte t1 (asTerm t2)++max :: AsTerm t2 a => TTerm a -> t2 -> TTerm a+max t1 t2 = primitive2 _equality_max t1 (asTerm t2)++min :: AsTerm t2 a => TTerm a -> t2 -> TTerm a+min t1 t2 = primitive2 _equality_min t1 (asTerm t2)
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Flows.hs view
@@ -0,0 +1,56 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Phantom-typed term DSL for the hydra.lib.flows library++module Hydra.Dsl.Meta.Lib.Flows where++import Hydra.Compute+import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Types as Types+import Hydra.Sources.Libraries++import qualified Data.Map as M+import qualified Data.Set as S+++apply :: TTerm (Flow s (x -> y)) -> TTerm (Flow s x) -> TTerm (Flow s y)+apply = primitive2 _flows_apply++bind :: (AsTerm t (Flow s x), AsTerm f (x -> Flow s y)) => t -> f -> TTerm (Flow s y)+bind fx f = primitive2 _flows_bind (asTerm fx) (asTerm f)++fail :: AsTerm f String => f -> TTerm (Flow s x)+fail = primitive1 _flows_fail . asTerm++foldl :: TTerm (x -> y -> Flow s x) -> TTerm x -> TTerm [y] -> TTerm (Flow s x)+foldl = primitive3 _flows_foldl++map :: (AsTerm f (x -> y), AsTerm t (Flow s x)) => f -> t -> TTerm (Flow s y)+map f fx = primitive2 _flows_map (asTerm f) (asTerm fx)++mapElems :: TTerm (v1 -> Flow s v2) -> TTerm (M.Map k v1) -> TTerm (Flow s (M.Map k v2))+mapElems = primitive2 _flows_mapElems++mapKeys :: TTerm (k1 -> Flow s k2) -> TTerm (M.Map k1 v) -> TTerm (Flow s (M.Map k2 v))+mapKeys = primitive2 _flows_mapKeys++mapList :: AsTerm f (x -> Flow s y) => f -> TTerm [x] -> TTerm (Flow s [y])+mapList f = primitive2 _flows_mapList (asTerm f)++mapMaybe :: AsTerm f (x -> Flow s y) => f -> TTerm (Maybe x) -> TTerm (Flow s (Maybe y))+mapMaybe f = primitive2 _flows_mapMaybe (asTerm f)++mapSet :: TTerm (x -> Flow s y) -> TTerm (S.Set x) -> TTerm (Flow s (S.Set y))+mapSet = primitive2 _flows_mapSet++pure :: AsTerm t x => t -> TTerm (Flow s x)+pure x = primitive1 _flows_pure (asTerm x)++sequence :: TTerm [Flow s a] -> TTerm (Flow s [a])+sequence = primitive1 _flows_sequence++withDefault :: AsTerm t x => t -> TTerm (Flow s x) -> TTerm (Flow s x)+withDefault fallback flow = primitive2 _flows_withDefault (asTerm fallback) flow
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Lists.hs view
@@ -0,0 +1,122 @@+-- | Phantom-typed term DSL for the hydra.lib.lists library++{-# LANGUAGE FlexibleContexts #-}++module Hydra.Dsl.Meta.Lib.Lists where++import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++apply :: TTerm [a -> b] -> TTerm [a] -> TTerm [b]+apply = primitive2 _lists_apply++at :: TTerm Int -> TTerm [a] -> TTerm a+at = primitive2 _lists_at++bind :: TTerm [a] -> TTerm (a -> [b]) -> TTerm [b]+bind = primitive2 _lists_bind++concat :: TTerm [[a]] -> TTerm [a]+concat = primitive1 _lists_concat++concat2 :: TTerm [a] -> TTerm [a] -> TTerm [a]+concat2 = primitive2 _lists_concat2++cons :: TTerm a -> TTerm [a] -> TTerm [a]+cons = primitive2 _lists_cons++drop :: TTerm Int -> TTerm [a] -> TTerm [a]+drop = primitive2 _lists_drop++dropWhile :: TTerm (a -> Bool) -> TTerm [a] -> TTerm [a]+dropWhile = primitive2 _lists_dropWhile++elem :: Eq a => TTerm a -> TTerm [a] -> TTerm Bool+elem = primitive2 _lists_elem++filter :: AsTerm t [a] => TTerm (a -> Bool) -> t -> TTerm [a]+filter p xs = primitive2 _lists_filter p (asTerm xs)++find :: TTerm (a -> Bool) -> TTerm [a] -> TTerm (Maybe a)+find = primitive2 _lists_find++foldl :: AsTerm f (b -> a -> b) => f -> TTerm b -> TTerm [a] -> TTerm b+foldl f = primitive3 _lists_foldl (asTerm f)++group :: Eq a => TTerm [a] -> TTerm [[a]]+group = primitive1 _lists_group++head :: TTerm [a] -> TTerm a+head = primitive1 _lists_head++init :: TTerm [a] -> TTerm [a]+init = primitive1 _lists_init++intercalate :: TTerm [a] -> TTerm [[a]] -> TTerm [a]+intercalate = primitive2 _lists_intercalate++intersperse :: TTerm a -> TTerm [a] -> TTerm [a]+intersperse = primitive2 _lists_intersperse++last :: TTerm [a] -> TTerm a+last = primitive1 _lists_last++length :: TTerm [a] -> TTerm Int+length = primitive1 _lists_length++-- | Map a function over a list+-- Accepts TTerm or TBinding for both arguments (via AsTerm)+map :: (AsTerm f (a -> b), AsTerm t [a]) => f -> t -> TTerm [b]+map f l = primitive2 _lists_map (asTerm f) (asTerm l)++nub :: Eq a => TTerm [a] -> TTerm [a]+nub = primitive1 _lists_nub++null :: TTerm [a] -> TTerm Bool+null = primitive1 _lists_null++partition :: TTerm (a -> Bool) -> TTerm [a] -> TTerm ([a], [a])+partition = primitive2 _lists_partition++pure :: TTerm a -> TTerm [a]+pure = primitive1 _lists_pure++replicate :: AsTerm t a => TTerm Int -> t -> TTerm [a]+replicate n x = primitive2 _lists_replicate n (asTerm x)++reverse :: TTerm [a] -> TTerm [a]+reverse = primitive1 _lists_reverse++safeHead :: TTerm [a] -> TTerm (Maybe a)+safeHead = primitive1 _lists_safeHead++singleton :: TTerm a -> TTerm [a]+singleton = primitive1 _lists_singleton++sort :: TTerm [a] -> TTerm [a]+sort = primitive1 _lists_sort++sortOn :: TTerm (a -> b) -> TTerm [a] -> TTerm [a]+sortOn = primitive2 _lists_sortOn++span :: TTerm (a -> Bool) -> TTerm [a] -> TTerm ([a], [a])+span = primitive2 _lists_span++tail :: TTerm [a] -> TTerm [a]+tail = primitive1 _lists_tail++take :: TTerm Int -> TTerm [a] -> TTerm [a]+take = primitive2 _lists_take++transpose :: TTerm [[a]] -> TTerm [[a]]+transpose = primitive1 _lists_transpose++zip :: TTerm [a] -> TTerm [b] -> TTerm [(a, b)]+zip = primitive2 _lists_zip++zipWith :: TTerm (a -> b -> c) -> TTerm [a] -> TTerm [b] -> TTerm [c]+zipWith = primitive3 _lists_zipWith
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Literals.hs view
@@ -0,0 +1,173 @@+-- | Phantom-typed term DSL for the hydra.lib.literals library++module Hydra.Dsl.Meta.Lib.Literals where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries++import qualified Data.ByteString as B+import Data.Int+++bigfloatToBigint :: TTerm Double -> TTerm Integer+bigfloatToBigint = primitive1 _literals_bigfloatToBigint++bigfloatToFloat32 :: TTerm Double -> TTerm Float+bigfloatToFloat32 = primitive1 _literals_bigfloatToFloat32++bigfloatToFloat64 :: TTerm Double -> TTerm Double+bigfloatToFloat64 = primitive1 _literals_bigfloatToFloat64++bigintToBigfloat :: TTerm Integer -> TTerm Double+bigintToBigfloat = primitive1 _literals_bigintToBigfloat++bigintToInt8 :: TTerm Integer -> TTerm Int8+bigintToInt8 = primitive1 _literals_bigintToInt8++bigintToInt16 :: TTerm Integer -> TTerm Int16+bigintToInt16 = primitive1 _literals_bigintToInt16++bigintToInt32 :: TTerm Integer -> TTerm Int+bigintToInt32 = primitive1 _literals_bigintToInt32++bigintToInt64 :: TTerm Integer -> TTerm Int64+bigintToInt64 = primitive1 _literals_bigintToInt64++bigintToUint8 :: TTerm Integer -> TTerm Int16+bigintToUint8 = primitive1 _literals_bigintToUint8++bigintToUint16 :: TTerm Integer -> TTerm Int+bigintToUint16 = primitive1 _literals_bigintToUint16++bigintToUint32 :: TTerm Integer -> TTerm Int64+bigintToUint32 = primitive1 _literals_bigintToUint32++bigintToUint64 :: TTerm Integer -> TTerm Integer+bigintToUint64 = primitive1 _literals_bigintToUint64++binaryToBytes :: TTerm B.ByteString -> TTerm [Int]+binaryToBytes = primitive1 _literals_binaryToBytes++binaryToString :: TTerm B.ByteString -> TTerm String+binaryToString = primitive1 _literals_binaryToString++float32ToBigfloat :: TTerm Float -> TTerm Double+float32ToBigfloat = primitive1 _literals_float32ToBigfloat++float64ToBigfloat :: TTerm Double -> TTerm Double+float64ToBigfloat = primitive1 _literals_float64ToBigfloat++int8ToBigint :: TTerm Int8 -> TTerm Integer+int8ToBigint = primitive1 _literals_int8ToBigint++int16ToBigint :: TTerm Int16 -> TTerm Integer+int16ToBigint = primitive1 _literals_int16ToBigint++int32ToBigint :: TTerm Int -> TTerm Integer+int32ToBigint = primitive1 _literals_int32ToBigint++int64ToBigint :: TTerm Int64 -> TTerm Integer+int64ToBigint = primitive1 _literals_int64ToBigint++readBigfloat :: TTerm String -> TTerm (Maybe Double)+readBigfloat = primitive1 _literals_readBigfloat++readBigint :: TTerm String -> TTerm (Maybe Integer)+readBigint = primitive1 _literals_readBigint++readBoolean :: TTerm String -> TTerm (Maybe Bool)+readBoolean = primitive1 _literals_readBoolean++readFloat32 :: TTerm String -> TTerm (Maybe Float)+readFloat32 = primitive1 _literals_readFloat32++readFloat64 :: TTerm String -> TTerm (Maybe Double)+readFloat64 = primitive1 _literals_readFloat64++readInt8 :: TTerm String -> TTerm (Maybe Int8)+readInt8 = primitive1 _literals_readInt8++readInt16 :: TTerm String -> TTerm (Maybe Int16)+readInt16 = primitive1 _literals_readInt16++readInt32 :: TTerm String -> TTerm (Maybe Int)+readInt32 = primitive1 _literals_readInt32++readInt64 :: TTerm String -> TTerm (Maybe Int64)+readInt64 = primitive1 _literals_readInt64++readString :: TTerm String -> TTerm (Maybe String)+readString = primitive1 _literals_readString++-- Note: Hydra uses wider signed types to represent unsigned values+-- Uint8 -> Int16, Uint16 -> Int, Uint32 -> Int64, Uint64 -> Integer+readUint8 :: TTerm String -> TTerm (Maybe Int16)+readUint8 = primitive1 _literals_readUint8++readUint16 :: TTerm String -> TTerm (Maybe Int)+readUint16 = primitive1 _literals_readUint16++readUint32 :: TTerm String -> TTerm (Maybe Int64)+readUint32 = primitive1 _literals_readUint32++readUint64 :: TTerm String -> TTerm (Maybe Integer)+readUint64 = primitive1 _literals_readUint64++showBigfloat :: TTerm Double -> TTerm String+showBigfloat = primitive1 _literals_showBigfloat++showBigint :: TTerm Integer -> TTerm String+showBigint = primitive1 _literals_showBigint++showBoolean :: TTerm Bool -> TTerm String+showBoolean = primitive1 _literals_showBoolean++showFloat32 :: TTerm Float -> TTerm String+showFloat32 = primitive1 _literals_showFloat32++showFloat64 :: TTerm Double -> TTerm String+showFloat64 = primitive1 _literals_showFloat64++showInt8 :: TTerm Int8 -> TTerm String+showInt8 = primitive1 _literals_showInt8++showInt16 :: TTerm Int16 -> TTerm String+showInt16 = primitive1 _literals_showInt16++showInt32 :: TTerm Int -> TTerm String+showInt32 = primitive1 _literals_showInt32++showInt64 :: TTerm Int64 -> TTerm String+showInt64 = primitive1 _literals_showInt64++showUint8 :: TTerm Int16 -> TTerm String+showUint8 = primitive1 _literals_showUint8++showUint16 :: TTerm Int -> TTerm String+showUint16 = primitive1 _literals_showUint16++showUint32 :: TTerm Int64 -> TTerm String+showUint32 = primitive1 _literals_showUint32++showUint64 :: TTerm Integer -> TTerm String+showUint64 = primitive1 _literals_showUint64++showString :: TTerm String -> TTerm String+showString = primitive1 _literals_showString++stringToBinary :: TTerm String -> TTerm B.ByteString+stringToBinary = primitive1 _literals_stringToBinary++uint8ToBigint :: TTerm Int16 -> TTerm Integer+uint8ToBigint = primitive1 _literals_uint8ToBigint++uint16ToBigint :: TTerm Int -> TTerm Integer+uint16ToBigint = primitive1 _literals_uint16ToBigint++uint32ToBigint :: TTerm Int64 -> TTerm Integer+uint32ToBigint = primitive1 _literals_uint32ToBigint++uint64ToBigint :: TTerm Integer -> TTerm Integer+uint64ToBigint = primitive1 _literals_uint64ToBigint
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Logic.hs view
@@ -0,0 +1,35 @@+-- | Phantom-typed term DSL for the hydra.lib.logic library++{-# LANGUAGE FlexibleContexts #-}++module Hydra.Dsl.Meta.Lib.Logic where++import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++and :: TTerm Bool -> TTerm Bool -> TTerm Bool+and = primitive2 _logic_and++-- | Conditional expression: ifElse condition thenBranch elseBranch+-- Accepts TTerm or TBinding for condition and branches (via AsTerm)+ifElse :: (AsTerm c Bool, AsTerm t a, AsTerm e a) => c -> t -> e -> TTerm a+ifElse cond t e = primitive3 _logic_ifElse (asTerm cond) (asTerm t) (asTerm e)++not :: TTerm Bool -> TTerm Bool+not = primitive1 _logic_not++or :: TTerm Bool -> TTerm Bool -> TTerm Bool+or = primitive2 _logic_or++----------------------------------------+-- Helpers which are not primitives++ands :: TTerm [Bool] -> TTerm Bool+ands terms = fold (primitive _logic_and) @@ true @@ terms++ors :: TTerm [Bool] -> TTerm Bool+ors terms = fold (primitive _logic_or) @@ false @@ terms
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Maps.hs view
@@ -0,0 +1,74 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Phantom-typed term DSL for the hydra.lib.maps library++module Hydra.Dsl.Meta.Lib.Maps where++import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries++import Data.Map+++alter :: TTerm (Maybe v -> Maybe v) -> TTerm k -> TTerm (Map k v) -> TTerm (Map k v)+alter = primitive3 _maps_alter++bimap :: TTerm (k1 -> k2) -> TTerm (v1 -> v2) -> TTerm (Map k1 v1) -> TTerm (Map k2 v2)+bimap = primitive3 _maps_bimap++delete :: TTerm k -> TTerm (Map k v) -> TTerm (Map k v)+delete = primitive2 _maps_delete++elems :: TTerm (Map k v) -> TTerm [v]+elems = primitive1 _maps_elems++empty :: TTerm (Map k v)+empty = primitive _maps_empty++filter :: TTerm (v -> Bool) -> TTerm (Map k v) -> TTerm (Map k v)+filter = primitive2 _maps_filter++filterWithKey :: TTerm (k -> v -> Bool) -> TTerm (Map k v) -> TTerm (Map k v)+filterWithKey = primitive2 _maps_filterWithKey++findWithDefault :: AsTerm t v => t -> TTerm k -> TTerm (Map k v) -> TTerm v+findWithDefault def = primitive3 _maps_findWithDefault (asTerm def)++fromList :: TTerm [(k, v)] -> TTerm (Map k v)+fromList = primitive1 _maps_fromList++insert :: TTerm k -> TTerm v -> TTerm (Map k v) -> TTerm (Map k v)+insert = primitive3 _maps_insert++keys :: TTerm (Map k v) -> TTerm [k]+keys = primitive1 _maps_keys++lookup :: AsTerm t k => t -> TTerm (Map k v) -> TTerm (Maybe v)+lookup k = primitive2 _maps_lookup (asTerm k)++map :: AsTerm f (v1 -> v2) => f -> TTerm (Map k v1) -> TTerm (Map k v2)+map f = primitive2 _maps_map (asTerm f)++mapKeys :: TTerm (k1 -> k2) -> TTerm (Map k1 v) -> TTerm (Map k2 v)+mapKeys = primitive2 _maps_mapKeys++member :: TTerm k -> TTerm (Map k v) -> TTerm Bool+member = primitive2 _maps_member++null :: TTerm (Map k v) -> TTerm Bool+null = primitive1 _maps_null++singleton :: TTerm k -> TTerm v -> TTerm (Map k v)+singleton = primitive2 _maps_singleton++size :: TTerm (Map k v) -> TTerm Int+size = primitive1 _maps_size++toList :: TTerm (Map k v) -> TTerm [(k, v)]+toList = primitive1 _maps_toList++union :: TTerm (Map k v) -> TTerm (Map k v) -> TTerm (Map k v)+union = primitive2 _maps_union
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Math.hs view
@@ -0,0 +1,129 @@+-- | Phantom-typed term DSL for the hydra.lib.math library++module Hydra.Dsl.Meta.Lib.Math where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++abs :: Num a => TTerm a -> TTerm a+abs = primitive1 _math_abs++acos :: TTerm Double -> TTerm Double+acos = primitive1 _math_acos++acosh :: TTerm Double -> TTerm Double+acosh = primitive1 _math_acosh++add :: Num a => TTerm a -> TTerm a -> TTerm a+add = primitive2 _math_add++asin :: TTerm Double -> TTerm Double+asin = primitive1 _math_asin++asinh :: TTerm Double -> TTerm Double+asinh = primitive1 _math_asinh++atan :: TTerm Double -> TTerm Double+atan = primitive1 _math_atan++atan2 :: TTerm Double -> TTerm Double -> TTerm Double+atan2 = primitive2 _math_atan2++atanh :: TTerm Double -> TTerm Double+atanh = primitive1 _math_atanh++ceiling :: TTerm Double -> TTerm Integer+ceiling = primitive1 _math_ceiling++cos :: TTerm Double -> TTerm Double+cos = primitive1 _math_cos++cosh :: TTerm Double -> TTerm Double+cosh = primitive1 _math_cosh++div :: Integral a => TTerm a -> TTerm a -> TTerm a+div = primitive2 _math_div++e :: TTerm Double+e = primitive _math_e++even :: Integral a => TTerm a -> TTerm Bool+even = primitive1 _math_even++exp :: TTerm Double -> TTerm Double+exp = primitive1 _math_exp++floor :: TTerm Double -> TTerm Integer+floor = primitive1 _math_floor++log :: TTerm Double -> TTerm Double+log = primitive1 _math_log++logBase :: TTerm Double -> TTerm Double -> TTerm Double+logBase = primitive2 _math_logBase++max :: Ord a => TTerm a -> TTerm a -> TTerm a+max = primitive2 _math_max++min :: Ord a => TTerm a -> TTerm a -> TTerm a+min = primitive2 _math_min++mod :: Integral a => TTerm a -> TTerm a -> TTerm a+mod = primitive2 _math_mod++mul :: Num a => TTerm a -> TTerm a -> TTerm a+mul = primitive2 _math_mul++negate :: Num a => TTerm a -> TTerm a+negate = primitive1 _math_negate++odd :: Integral a => TTerm a -> TTerm Bool+odd = primitive1 _math_odd++pi :: TTerm Double+pi = primitive _math_pi++pow :: TTerm Double -> TTerm Double -> TTerm Double+pow = primitive2 _math_pow++pred :: Enum a => TTerm a -> TTerm a+pred = primitive1 _math_pred++range :: Enum a => TTerm a -> TTerm a -> TTerm [a]+range start end = primitive2 _math_range start end++rem :: Integral a => TTerm a -> TTerm a -> TTerm a+rem = primitive2 _math_rem++round :: TTerm Double -> TTerm Integer+round = primitive1 _math_round++signum :: Num a => TTerm a -> TTerm a+signum = primitive1 _math_signum++sin :: TTerm Double -> TTerm Double+sin = primitive1 _math_sin++sinh :: TTerm Double -> TTerm Double+sinh = primitive1 _math_sinh++sqrt :: TTerm Double -> TTerm Double+sqrt = primitive1 _math_sqrt++sub :: Num a => TTerm a -> TTerm a -> TTerm a+sub = primitive2 _math_sub++succ :: Enum a => TTerm a -> TTerm a+succ = primitive1 _math_succ++tan :: TTerm Double -> TTerm Double+tan = primitive1 _math_tan++tanh :: TTerm Double -> TTerm Double+tanh = primitive1 _math_tanh++truncate :: TTerm Double -> TTerm Integer+truncate = primitive1 _math_truncate
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Maybes.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Phantom-typed term DSL for the hydra.lib.maybes library++module Hydra.Dsl.Meta.Lib.Maybes where++import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++apply :: TTerm (Maybe (a -> b)) -> TTerm (Maybe a) -> TTerm (Maybe b)+apply = primitive2 _maybes_apply++bind :: TTerm (Maybe a) -> TTerm (a -> Maybe b) -> TTerm (Maybe b)+bind = primitive2 _maybes_bind++cases :: TTerm (Maybe a) -> TTerm b -> TTerm (a -> b) -> TTerm b+cases = primitive3 _maybes_cases++cat :: TTerm [Maybe a] -> TTerm [a]+cat = primitive1 _maybes_cat++compose :: TTerm (a -> Maybe b) -> TTerm (b -> Maybe c) -> TTerm (a -> Maybe c)+compose = primitive2 _maybes_compose++fromJust :: TTerm (Maybe a) -> TTerm a+fromJust = primitive1 _maybes_fromJust++fromMaybe :: TTerm a -> TTerm (Maybe a) -> TTerm a+fromMaybe = primitive2 _maybes_fromMaybe++isJust :: TTerm (Maybe a) -> TTerm Bool+isJust = primitive1 _maybes_isJust++isNothing :: TTerm (Maybe a) -> TTerm Bool+isNothing = primitive1 _maybes_isNothing++map :: AsTerm f (a -> b) => f -> TTerm (Maybe a) -> TTerm (Maybe b)+map f = primitive2 _maybes_map (asTerm f)++mapMaybe :: TTerm (a -> Maybe b) -> TTerm [a] -> TTerm [b]+mapMaybe = primitive2 _maybes_mapMaybe++maybe :: (AsTerm t1 b, AsTerm t2 (a -> b)) => t1 -> t2 -> TTerm (Maybe a) -> TTerm b+maybe def f = primitive3 _maybes_maybe (asTerm def) (asTerm f)++pure :: TTerm a -> TTerm (Maybe a)+pure = primitive1 _maybes_pure
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Pairs.hs view
@@ -0,0 +1,18 @@+-- | Phantom-typed term DSL for the hydra.lib.pairs library++module Hydra.Dsl.Meta.Lib.Pairs where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++bimap :: TTerm (a -> c) -> TTerm (b -> d) -> TTerm (a, b) -> TTerm (c, d)+bimap = primitive3 _pairs_bimap++first :: TTerm (a, b) -> TTerm a+first = primitive1 _pairs_first++second :: TTerm (a, b) -> TTerm b+second = primitive1 _pairs_second
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Sets.hs view
@@ -0,0 +1,56 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Phantom-typed term DSL for the hydra.lib.sets library++module Hydra.Dsl.Meta.Lib.Sets where++import Hydra.Phantoms+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries++import Data.Set+++delete :: AsTerm t a => t -> TTerm (Set a) -> TTerm (Set a)+delete x = primitive2 _sets_delete (asTerm x)++difference :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)+difference = primitive2 _sets_difference++empty :: TTerm (Set a)+empty = primitive _sets_empty++fromList :: AsTerm t [a] => t -> TTerm (Set a)+fromList xs = primitive1 _sets_fromList (asTerm xs)++insert :: TTerm a -> TTerm (Set a) -> TTerm (Set a)+insert = primitive2 _sets_insert++intersection :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)+intersection = primitive2 _sets_intersection++map :: TTerm (a -> b) -> TTerm (Set a) -> TTerm (Set b)+map = primitive2 _sets_map++member :: TTerm a -> TTerm (Set a) -> TTerm Bool+member = primitive2 _sets_member++null :: TTerm (Set a) -> TTerm Bool+null = primitive1 _sets_null++singleton :: TTerm a -> TTerm (Set a)+singleton = primitive1 _sets_singleton++size :: TTerm (Set a) -> TTerm Int+size = primitive1 _sets_size++toList :: TTerm (Set a) -> TTerm [a]+toList = primitive1 _sets_toList++union :: TTerm (Set a) -> TTerm (Set a) -> TTerm (Set a)+union = primitive2 _sets_union++unions :: TTerm [Set a] -> TTerm (Set a)+unions = primitive1 _sets_unions
+ src/main/haskell/Hydra/Dsl/Meta/Lib/Strings.hs view
@@ -0,0 +1,56 @@+-- | Phantom-typed term DSL for the hydra.lib.strings library++module Hydra.Dsl.Meta.Lib.Strings where++import Hydra.Phantoms+import Hydra.Dsl.Meta.Phantoms+import qualified Hydra.Dsl.Terms as Terms+import Hydra.Sources.Libraries+++--(++) :: TTerm String -> TTerm String -> TTerm String+--l ++ r = (primitive _strings_cat) @@ (list [l, r])++cat :: TTerm [String] -> TTerm String+cat = primitive1 _strings_cat++cat2 :: TTerm String -> TTerm String -> TTerm String+cat2 = primitive2 _strings_cat2++charAt :: TTerm Int -> TTerm String -> TTerm Int+charAt = primitive2 _strings_charAt++fromList :: TTerm [Int] -> TTerm String+fromList = primitive1 _strings_fromList++intercalate :: TTerm String -> TTerm [String] -> TTerm String+intercalate = primitive2 _strings_intercalate++length :: TTerm String -> TTerm Int+length = primitive1 _strings_length++lines :: TTerm String -> TTerm [String]+lines = primitive1 _strings_lines++null :: TTerm String -> TTerm Bool+null = primitive1 _strings_null++splitOn :: TTerm String -> TTerm String -> TTerm [String]+splitOn = primitive2 _strings_splitOn++toList :: TTerm String -> TTerm [Int]+toList = primitive1 _strings_toList++toLower :: TTerm String -> TTerm String+toLower = primitive1 _strings_toLower++toUpper :: TTerm String -> TTerm String+toUpper = primitive1 _strings_toUpper++unlines :: TTerm [String] -> TTerm String+unlines = primitive1 _strings_unlines++-- Helpers++concat :: [TTerm String] -> TTerm String+concat strings = primitive _strings_cat @@ list strings
+ src/main/haskell/Hydra/Dsl/Meta/Literals.hs view
@@ -0,0 +1,83 @@+-- | A DSL for constructing literal terms using Haskell's built-in datatypes++module Hydra.Dsl.Meta.Literals where++import Hydra.Phantoms+import qualified Hydra.Dsl.Terms as Terms++import Data.Int+import qualified Data.ByteString as B+++-- Note: does not yet properly capture arbitrary-precision floating-point numbers,+-- because code generation does not.+type Bigfloat = Double++-- Binary is now properly represented as ByteString+type Binary = B.ByteString++bigfloat :: Bigfloat -> TTerm Bigfloat+bigfloat = TTerm . Terms.bigfloat++bigint :: Integer -> TTerm Integer+bigint = TTerm . Terms.bigint++binary :: Binary -> TTerm Binary+binary = TTerm . Terms.binary++bool :: Bool -> TTerm Bool+bool = TTerm . Terms.boolean++boolean :: Bool -> TTerm Bool+boolean = bool++char :: Char -> TTerm Int+char = TTerm . Terms.char++double :: Double -> TTerm Double+double = float64++false :: TTerm Bool+false = bool False++float :: Float -> TTerm Float+float = float32++float32 :: Float -> TTerm Float+float32 = TTerm . Terms.float32++float64 :: Double -> TTerm Double+float64 = TTerm . Terms.float64++int :: Int -> TTerm Int+int = int32++int8 :: Int8 -> TTerm Int8+int8 = TTerm . Terms.int8++int16 :: Int16 -> TTerm Int16+int16 = TTerm . Terms.int16++int32 :: Int -> TTerm Int+int32 = TTerm . Terms.int32++int64 :: Int64 -> TTerm Int64+int64 = TTerm . Terms.int64++string :: String -> TTerm String+string = TTerm . Terms.string++true :: TTerm Bool+true = bool True++uint8 :: Int16 -> TTerm Int16+uint8 = TTerm . Terms.uint8++uint16 :: Int -> TTerm Int+uint16 = TTerm . Terms.uint16++uint32 :: Int64 -> TTerm Int64+uint32 = TTerm . Terms.uint32++uint64 :: Integer -> TTerm Integer+uint64 = TTerm . Terms.uint64
+ src/main/haskell/Hydra/Dsl/Meta/Module.hs view
@@ -0,0 +1,101 @@+-- | Meta-DSL for constructing module-related terms (definitions, namespaces)++module Hydra.Dsl.Meta.Module where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms++import qualified Data.Map as M+++definitionTerm :: TTerm TermDefinition -> TTerm Definition+definitionTerm = inject _Definition _Definition_term++definitionType :: TTerm TypeDefinition -> TTerm Definition+definitionType = inject _Definition _Definition_type++module_ :: TTerm Namespace -> TTerm [Binding] -> TTerm [Namespace] -> TTerm [Namespace] -> TTerm (Maybe String) -> TTerm Module+module_ ns elems termDeps typeDeps desc = record _Module [+ _Module_namespace>>: ns,+ _Module_elements>>: elems,+ _Module_termDependencies>>: termDeps,+ _Module_typeDependencies>>: typeDeps,+ _Module_description>>: desc]++moduleNamespace :: TTerm Module -> TTerm Namespace+moduleNamespace m = project _Module _Module_namespace @@ m++moduleElements :: TTerm Module -> TTerm [Binding]+moduleElements m = project _Module _Module_elements @@ m++moduleTermDependencies :: TTerm Module -> TTerm [Namespace]+moduleTermDependencies m = project _Module _Module_termDependencies @@ m++moduleTypeDependencies :: TTerm Module -> TTerm [Namespace]+moduleTypeDependencies m = project _Module _Module_typeDependencies @@ m++moduleDescription :: TTerm Module -> TTerm (Maybe String)+moduleDescription m = project _Module _Module_description @@ m++namespace :: TTerm String -> TTerm Namespace+namespace ns = wrap _Namespace ns++namespaces :: TTerm (Namespace, n) -> TTerm (M.Map Namespace n) -> TTerm (Namespaces n)+namespaces focus mapping = record _Namespaces [+ _Namespaces_focus>>: focus,+ _Namespaces_mapping>>: mapping]++namespacesFocus :: TTerm (Namespaces n) -> TTerm (Namespace, n)+namespacesFocus ns = project _Namespaces _Namespaces_focus @@ ns++namespacesMapping :: TTerm (Namespaces n) -> TTerm (M.Map Namespace n)+namespacesMapping ns = project _Namespaces _Namespaces_mapping @@ ns++namespacesWithFocus :: TTerm (Namespaces n) -> TTerm (Namespace, n) -> TTerm (Namespaces n)+namespacesWithFocus ns focus = namespaces focus (Hydra.Dsl.Meta.Module.namespacesMapping ns)++namespacesWithMapping :: TTerm (Namespaces n) -> TTerm (M.Map Namespace n) -> TTerm (Namespaces n)+namespacesWithMapping ns mapping = namespaces (Hydra.Dsl.Meta.Module.namespacesFocus ns) mapping++qualifiedName :: TTerm (Maybe Namespace) -> TTerm String -> TTerm QualifiedName+qualifiedName ns local = record _QualifiedName [+ _QualifiedName_namespace>>: ns,+ _QualifiedName_local>>: local]++qualifiedNameLocal :: TTerm QualifiedName -> TTerm String+qualifiedNameLocal qn = project _QualifiedName _QualifiedName_local @@ qn++qualifiedNameNamespace :: TTerm QualifiedName -> TTerm (Maybe Namespace)+qualifiedNameNamespace qn = project _QualifiedName _QualifiedName_namespace @@ qn++termDefinition :: TTerm Name -> TTerm Term -> TTerm TypeScheme -> TTerm TermDefinition+termDefinition name term typeScheme = record _TermDefinition [+ _TermDefinition_name>>: name,+ _TermDefinition_term>>: term,+ _TermDefinition_type>>: typeScheme]++termDefinitionName :: TTerm TermDefinition -> TTerm Name+termDefinitionName td = project _TermDefinition _TermDefinition_name @@ td++termDefinitionTerm :: TTerm TermDefinition -> TTerm Term+termDefinitionTerm td = project _TermDefinition _TermDefinition_term @@ td++termDefinitionType :: TTerm TermDefinition -> TTerm TypeScheme+termDefinitionType td = project _TermDefinition _TermDefinition_type @@ td++typeDefinition :: TTerm Name -> TTerm Type -> TTerm TypeDefinition+typeDefinition name typ = record _TypeDefinition [+ _TypeDefinition_name>>: name,+ _TypeDefinition_type>>: typ]++typeDefinitionName :: TTerm TypeDefinition -> TTerm Name+typeDefinitionName td = project _TypeDefinition _TypeDefinition_name @@ td++typeDefinitionType :: TTerm TypeDefinition -> TTerm Type+typeDefinitionType td = project _TypeDefinition _TypeDefinition_type @@ td++unFileExtension :: TTerm FileExtension -> TTerm String+unFileExtension fe = unwrap _FileExtension @@ fe++unNamespace :: TTerm Namespace -> TTerm String+unNamespace ns = unwrap _Namespace @@ ns
+ src/main/haskell/Hydra/Dsl/Meta/Parsing.hs view
@@ -0,0 +1,53 @@+-- | Phantom-typed term DSL for the hydra.parsing types++module Hydra.Dsl.Meta.Parsing where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms++import qualified Data.Map as M+++-- | Construct a ParseError+parseError :: TTerm String -> TTerm String -> TTerm ParseError+parseError message remainder = record _ParseError [+ _ParseError_message>>: message,+ _ParseError_remainder>>: remainder]++-- | Get the message from a ParseError+parseErrorMessage :: TTerm ParseError -> TTerm String+parseErrorMessage e = project _ParseError _ParseError_message @@ e++-- | Get the remainder from a ParseError+parseErrorRemainder :: TTerm ParseError -> TTerm String+parseErrorRemainder e = project _ParseError _ParseError_remainder @@ e++-- | Construct a successful ParseResult+parseResultSuccess :: TTerm (ParseSuccess a) -> TTerm (ParseResult a)+parseResultSuccess = inject _ParseResult _ParseResult_success++-- | Construct a failed ParseResult+parseResultFailure :: TTerm ParseError -> TTerm (ParseResult a)+parseResultFailure = inject _ParseResult _ParseResult_failure++-- | Construct a ParseSuccess+parseSuccess :: TTerm a -> TTerm String -> TTerm (ParseSuccess a)+parseSuccess value remainder = record _ParseSuccess [+ _ParseSuccess_value>>: value,+ _ParseSuccess_remainder>>: remainder]++-- | Get the value from a ParseSuccess+parseSuccessValue :: TTerm (ParseSuccess a) -> TTerm a+parseSuccessValue s = project _ParseSuccess _ParseSuccess_value @@ s++-- | Get the remainder from a ParseSuccess+parseSuccessRemainder :: TTerm (ParseSuccess a) -> TTerm String+parseSuccessRemainder s = project _ParseSuccess _ParseSuccess_remainder @@ s++-- | Wrap a function as a Parser+parser :: TTerm (String -> ParseResult a) -> TTerm (Parser a)+parser = wrap _Parser++-- | Unwrap a Parser to get its function+runParser :: TTerm (Parser a) -> TTerm String -> TTerm (ParseResult a)+runParser p input = unwrap _Parser @@ p @@ input
+ src/main/haskell/Hydra/Dsl/Meta/Phantoms.hs view
@@ -0,0 +1,437 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Term-level DSL which makes use of phantom types. Use this DSL for defining programs as opposed to data type definitions.+-- The phantom types provide static type checking in Haskell prior to Hydra's runtime type checking.+module Hydra.Dsl.Meta.Phantoms (+ module Hydra.Dsl.Meta.Phantoms,+ module Hydra.Dsl.Meta.Literals,+ module Hydra.Dsl.AsTerm,+) where++import Hydra.Kernel+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Common+import Hydra.Dsl.Meta.Literals+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Annotations as Ann+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Show.Core as ShowCore+import Hydra.Encoding (encodeBindingName)+import Hydra.Decoding (decodeBindingName)++import Prelude hiding ((++))+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+++-- Operators++infixr 0 ~>+(~>) :: String -> TTerm x -> TTerm (a -> b)+name ~> body = lambda name body++infixl 1 <~+(<~) :: String -> TTerm a -> TTerm b -> TTerm b+name <~ value = let1 name value++infixl 1 <<~+(<<~) :: AsTerm t (Flow s a) => String -> t -> TTerm (Flow s b) -> TTerm (Flow s b)+name <<~ def = bind name (asTerm def)++-- | Function composition operator: f <.> g creates a function that applies g then f+-- Example: toString <.> increment+-- Accepts TTerm or TBinding for both operands (via AsTerm)+(<.>) :: (AsTerm f (b -> c), AsTerm g (a -> b)) => f -> g -> TTerm (a -> c)+f <.> g = compose (asTerm f) (asTerm g)++-- | Function application operator: function @@ argument+-- Example: add @@ int32 1+-- Accepts TTerm or TBinding for both operands (via AsTerm)+(@@) :: (AsTerm f (a -> b), AsTerm g a) => f -> g -> TTerm b+fun @@ arg = apply (asTerm fun) (asTerm arg)++(++) :: (AsTerm f String, AsTerm g String) => f -> g -> TTerm String+f ++ g = primitive2 _strings_cat2 (asTerm f) (asTerm g)++-- | Field definition operator for records: name>: value+-- Example: "name">: string "John"+-- Accepts TTerm or TBinding (via AsTerm)+infixr 0 >:+(>:) :: AsTerm t a => String -> t -> Field+name>: term = Field (Name name) (unTTerm $ asTerm term)++-- | Field definition operator with pre-constructed name: fname>>: value+-- Example: _Person_name>>: string "John"+-- Accepts TTerm or TBinding (via AsTerm)+infixr 0 >>:+(>>:) :: AsTerm t a => Name -> t -> Field+fname >>: d = field fname (asTerm d)++-- | Add an annotation to a term+-- Example: annot (Name "deprecated") (Just (boolean True)) myFunction+annot :: Name -> Maybe Term -> TTerm a -> TTerm a+annot key mvalue (TTerm term) = TTerm $ Ann.annotateTerm key mvalue term++-- | Apply a function to an argument+-- Example: apply (var "add") (int32 1)+apply :: TTerm (a -> b) -> TTerm a -> TTerm b+apply (TTerm lhs) (TTerm rhs) = TTerm $ Terms.apply lhs rhs++bind :: AsTerm t (Flow s a) => String -> t -> TTerm (Flow s b) -> TTerm (Flow s b)+bind v def body = primitive2 _flows_bind (asTerm def) $ lambda v $ body++binaryFunction :: (TTerm a -> TTerm b -> TTerm c) -> TTerm (a -> b -> c)+binaryFunction f = case (unTTerm $ f (var "x") (var "y")) of+ TermApplication (Application (TermApplication (Application lhs _)) _) -> TTerm lhs+ t -> TTerm $ Terms.string $ "unexpected term as binary function: " <> ShowCore.term t++binds :: [Field] -> TTerm (Flow s a) -> TTerm (Flow s a)+binds fields rhs = L.foldr withField rhs fields+ where+ withField (Field (Name fname) fterm) b = bind fname (TTerm fterm) b++-- | Apply a named case match to an argument+-- Example: cases resultTypeName myResult Nothing [onSuccess, onError]+-- See also: 'match'+cases :: Name -> TTerm a -> Maybe (TTerm b) -> [Field] -> TTerm b+cases name arg dflt fields = TTerm $ Terms.apply (Terms.match name (unTTerm <$> dflt) fields) (unTTerm arg)++-- | Compose two functions (g then f)+-- Example: compose (var "stringLength") (var "toString")+-- Accepts TTerm or TBinding for both operands (via AsTerm)+compose :: (AsTerm f (b -> c), AsTerm g (a -> b)) => f -> g -> TTerm (a -> c)+compose f g = TTerm $ Terms.compose (unTTerm $ asTerm f) (unTTerm $ asTerm g)++-- | Create a constant function that always returns the same value+-- Example: constant true+-- Accepts TTerm or TBinding (via AsTerm)+constant :: AsTerm t a => t -> TTerm (b -> a)+constant t = TTerm $ Terms.constant (unTTerm $ asTerm t)++-- | Create a definition in a module+-- Example: definitionInModule myModule "addInts" (lambda "x" (lambda "y" (add @@ var "x" @@ var "y")))+definitionInModule :: Module -> String -> TTerm a -> TBinding a+definitionInModule mod = definitionInNamespace $ moduleNamespace mod++-- | Create a definition in a namespace+-- Example: definitionInNamespace (Namespace "com.example") "addInts" myFunction+definitionInNamespace :: Namespace -> String -> TTerm a -> TBinding a+definitionInNamespace ns lname = TBinding $ unqualifyName $ QualifiedName (Just ns) lname++-- | Add documentation to a term+-- Example: doc "Adds two integers" addFunction+-- Accepts TTerm or TBinding (via AsTerm)+doc :: AsTerm t a => String -> t -> TTerm a+doc s t = TTerm $ setTermDescription (Just s) (unTTerm $ asTerm t)++-- | Add documentation with line wrapping at the specified width+-- Example: docWrapped 80 "This is a long documentation string that will be wrapped..." myFunction+docWrapped :: Int -> String -> TTerm a -> TTerm a+docWrapped len = doc . wrapLine len++encodedBinary :: TTerm String -> TTerm Term+encodedBinary = encodedLiteral . inject _Literal _Literal_binary++encodedBoolean :: TTerm Bool -> TTerm Term+encodedBoolean = encodedLiteral . inject _Literal _Literal_boolean++encodedCase :: AsTerm t (a -> Term) => Name -> Name -> t -> Field+encodedCase tname fname enc = field fname $ "v" ~> encodedVariant tname fname (enc @@ var "v")++encodedEither :: TTerm (Prelude.Either a b) -> TTerm Term+encodedEither = inject _Term _Term_either++encodedField :: Name -> TTerm Term -> TTerm Term+encodedField fname term = encodedFieldRaw (encodedName fname) term++encodedFieldRaw :: TTerm Name -> TTerm Term -> TTerm Term+encodedFieldRaw (TTerm fname) (TTerm term) = TTerm $ Terms.record _Field [+ Field _Field_name fname,+ Field _Field_term term]++encodedFloatValue :: TTerm FloatValue -> TTerm Term+encodedFloatValue = encodedLiteral . inject _Literal _Literal_float++encodedInjection :: Name -> Name -> TTerm Term -> TTerm Term+encodedInjection tname fname term = TTerm $ Terms.record _Injection [+ field _Injection_typeName $ encodedName tname,+ field _Injection_field $ encodedField fname term]++encodedInt32 :: TTerm Int -> TTerm Term+encodedInt32 v = encodedIntegerValue $ inject _IntegerValue _IntegerValue_int32 v++encodedIntegerValue :: TTerm IntegerValue -> TTerm Term+encodedIntegerValue = encodedLiteral . inject _Literal _Literal_integer++encodedList :: TTerm [a] -> TTerm Term+encodedList = inject _Term _Term_list++encodedLiteral :: TTerm Literal -> TTerm Term+encodedLiteral = inject _Term _Term_literal++encodedMap :: TTerm (M.Map k v) -> TTerm Term+encodedMap = inject _Term _Term_map++encodedName :: Name -> TTerm Name+encodedName = wrap _Name . string . unName++encodedUnit :: TTerm Term+encodedUnit = injectUnit _Term _Term_unit++encodedWrappedTerm :: Name -> TTerm Term -> TTerm Term+encodedWrappedTerm name = encodedWrappedTermRaw (encodedName name)++encodedWrappedTermRaw :: TTerm Name -> TTerm Term -> TTerm Term+encodedWrappedTermRaw (TTerm name) (TTerm term) = TTerm $ Terms.inject _Term _Term_wrap $ Terms.record _WrappedTerm [+ Field _WrappedTerm_typeName name,+ Field _WrappedTerm_body term]++encodedOptional :: TTerm (Maybe a) -> TTerm Term+encodedOptional = inject _Term _Term_maybe++encodedPair :: TTerm (a, b) -> TTerm Term+encodedPair = inject _Term _Term_pair++encodedRecord :: Name -> [Field] -> TTerm Term+encodedRecord tname fields = TTerm $ Terms.inject _Term _Term_record $ Terms.record _Record [+ field _Record_typeName $ encodedName tname,+ field _Record_fields $ list (encField <$> fields)]+ where+ encField (Field fname term) = encodedField fname $ TTerm term++encodedSet :: TTerm (S.Set a) -> TTerm Term+encodedSet = inject _Term _Term_set++encodedString :: TTerm String -> TTerm Term+encodedString = encodedLiteral . inject _Literal _Literal_string++encodedUnion :: TTerm Term -> TTerm Term+encodedUnion = inject _Term _Term_union++encodedVariant :: Name -> Name -> TTerm Term -> TTerm Term+encodedVariant tname fname term = encodedUnion $ encodedInjection tname fname term++-- | Get a reference to a decoder function in hydra.decode.core for a given type name+-- The decoder takes a graph context and a term, returning either a decoding error or the decoded value+decoderFor :: Name -> TTerm (Graph -> Term -> Prelude.Either DecodingError a)+decoderFor typeName = var $ unName $ decodeBindingName typeName++-- | Get a reference to an encoder function in hydra.encode.core for a given type name+encoderFor :: Name -> TTerm (a -> Term)+encoderFor typeName = var $ unName $ encodeBindingName typeName++-- | Convert a typed element to an untyped element (legacy name, prefer 'toBinding')+-- Example: el (definitionInModule myModule "addInts" myFunction)+el :: TBinding a -> Binding+el = toBinding++exec :: TTerm (Flow s a) -> TTerm (Flow s b) -> TTerm (Flow s b)+exec f b = primitive2 _flows_bind f (lambda ignoredVariable b)++-- | Create a field with the given name and value+-- Example: field (Name "age") (int32 30)+field :: Name -> TTerm a -> Field+field fname (TTerm val) = Field fname val++-- | Mark a type as first-class+-- Example: firstClassType (record ...)+firstClassType :: TTerm Type -> TTerm Type+firstClassType typ = annot key_firstClassType (Just $ Terms.boolean True) typ++-- | Create a fold function to process lists+-- Example: fold (lambda "acc" (lambda "x" (add @@ var "acc" @@ var "x")))+fold :: AsTerm t (b -> a -> b) => t -> TTerm (b -> [a] -> b)+fold f = (primitive _lists_foldl) @@ asTerm f++-- | Identity function that returns its argument unchanged+-- Example: identity+identity :: TTerm (a -> a)+identity = TTerm Terms.identity++-- | Create a union injection+-- Example: inject (Name "Result") (Name "success") (string "ok")+inject :: Name -> Name -> TTerm a -> TTerm b+inject name fname (TTerm term) = TTerm $ Terms.inject name fname term++-- | Create a function that injects its argument into a union variant+-- Example: injectLambda (Name "Result") (Name "success")+injectLambda :: Name -> Name -> TTerm (a -> b)+injectLambda name fname = lambda "injected_" $ inject name fname $ var "injected_"++-- | Create a 'Just' optional value+-- Example: just (string "found")+-- Accepts TTerm or TBinding (via AsTerm)+just :: AsTerm t a => t -> TTerm (Maybe a)+just t = TTerm $ Terms.just (unTTerm $ asTerm t)++-- | Function that wraps a value in 'Just'+-- Example: just_ @@ myValue+just_ :: TTerm (a -> Maybe a)+just_ = TTerm $ Terms.lambda "just_" $ Terms.just $ Terms.var "just_"++-- | Create a 'Left' either value+-- Example: left (string "error")+left :: TTerm a -> TTerm (Either a b)+left (TTerm term) = TTerm $ Terms.left term++-- | Function that wraps a value in 'Left'+-- Example: left_ @@ myValue+left_ :: TTerm (a -> Either a b)+left_ = TTerm $ Terms.lambda "left_" $ Terms.left $ Terms.var "left_"++-- | Create a 'Right' either value+-- Example: right (int32 42)+right :: TTerm b -> TTerm (Either a b)+right (TTerm term) = TTerm $ Terms.right term++-- | Function that wraps a value in 'Right'+-- Example: right_ @@ myValue+right_ :: TTerm (b -> Either a b)+right_ = TTerm $ Terms.lambda "right_" $ Terms.right $ Terms.var "right_"++-- | Create a lambda function with one parameter+-- Example: lambda "x" (var "add" @@ var "x" @@ int32 1)+lambda :: String -> TTerm x -> TTerm (a -> b)+lambda v (TTerm body) = TTerm $ Terms.lambda v body++-- | Create a multi-parameter lambda function+-- Example: lambdas ["x", "y"] (add @@ var "x" @@ var "y")+lambdas :: [String] -> TTerm x -> TTerm (a -> b)+lambdas params (TTerm body) = TTerm $ Terms.lambdas params body++let1 :: String -> TTerm a -> TTerm b -> TTerm b+let1 name (TTerm value) (TTerm env) = TTerm $ TermLet $ Let [Binding (Name name) value Nothing] env++-- | Create a let expression with multiple bindings+-- Example: lets ["x">: int32 1, "y">: int32 2] (var "add" @@ var "x" @@ var "y")+lets :: [Field] -> TTerm a -> TTerm a+lets fields (TTerm env) = TTerm $ TermLet $ Let (toBinding <$> fields) env+ where+ toBinding (Field name value) = Binding name value Nothing++-- | Create a list of terms+-- Example: list [int32 1, int32 2, int32 3]+-- Accepts TTerm or TBinding elements (via AsTerm)+list :: AsTerm t a => [t] -> TTerm [a]+list els = TTerm $ Terms.list (unTTerm . asTerm <$> els)++-- | Create a map/dictionary term+-- Example: map (M.fromList [(string "a", int32 1), (string "b", int32 2)])+map :: M.Map (TTerm a) (TTerm b) -> TTerm (M.Map a b)+map = TTerm . Terms.map . M.fromList . fmap fromTTerm . M.toList+ where+ fromTTerm (TTerm k, TTerm v) = (k, v)++-- | Create a pattern match on a union term+-- Example: match (Name "Result") (Just $ string "what?") ["success">: string "yay", "error">: string "boo"]+match :: Name -> Maybe (TTerm b) -> [Field] -> TTerm (a -> b)+match name dflt fields = TTerm $ Terms.match name (unTTerm <$> dflt) fields++-- | Create a 'Nothing' optional value+-- Example: nothing+nothing :: TTerm (Maybe a)+nothing = TTerm Terms.nothing++-- | Create an optional value from a Maybe+-- Example: opt (Just myValue)+opt :: Maybe (TTerm a) -> TTerm (Maybe a)+opt mc = TTerm $ Terms.optional (unTTerm <$> mc)++optCases :: AsTerm f (a -> b) => TTerm (Maybe a) -> TTerm b -> f -> TTerm b+optCases arg ifNothing ifJust = primitive3 (Name "hydra.lib.maybes.maybe") ifNothing (asTerm ifJust) arg++-- | Create a pair+-- Example: pair (string "age") (int32 32)+-- Accepts TTerm or TBinding (via AsTerm)+pair :: (AsTerm t1 a, AsTerm t2 b) => t1 -> t2 -> TTerm (a, b)+pair l r = TTerm $ Terms.pair (unTTerm $ asTerm l) (unTTerm $ asTerm r)++-- | Primitive function by name+-- Example: primitive (Name "hydra.lib.strings.length")+primitive :: Name -> TTerm a+primitive = TTerm . Terms.primitive++-- | Apply a primitive function to one argument+-- Example: primitive1 _math_abs (int32 (-5))+primitive1 :: Name -> TTerm a -> TTerm b+primitive1 primName (TTerm a) = TTerm $ Terms.primitive primName Terms.@@ a++-- | Apply a primitive function to two arguments+-- Example: primitive2 _math_add (int32 2) (int32 3)+primitive2 :: Name -> TTerm a -> TTerm b -> TTerm c+primitive2 primName (TTerm a) (TTerm b) = TTerm $ Terms.primitive primName Terms.@@ a Terms.@@ b++-- | Apply a primitive function to three arguments+-- Example: primitive3 _string_replace (string "hello") (string "e") (string "a")+primitive3 :: Name -> TTerm a -> TTerm b -> TTerm c -> TTerm d+primitive3 primName (TTerm a) (TTerm b) (TTerm c) = TTerm $ Terms.primitive primName Terms.@@ a Terms.@@ b Terms.@@ c++produce :: AsTerm t a => t -> TTerm (Flow s a)+produce x = primitive1 _flows_pure (asTerm x)++-- | Extract a field from a record+-- Example: project (Name "Person") (Name "name")+project :: Name -> Name -> TTerm (a -> b)+project name fname = TTerm $ Terms.project name fname++-- | Create a record with named fields+-- Example: record (Name "Person") [field (Name "name") (string "John"), field (Name "age") (int32 30)]+record :: Name -> [Field] -> TTerm a+record name fields = TTerm $ Terms.record name fields++-- | Create a set of terms+-- Example: set [string "a", string "b", string "c"]+set :: [TTerm a] -> TTerm (S.Set a)+set = TTerm . Terms.set . S.fromList . fmap unTTerm++-- | Convert a typed binding to an untyped Binding for use in module element lists+-- Example: toBinding functionArity+toBinding :: TBinding a -> Binding+toBinding (TBinding name (TTerm term)) = Binding name term Nothing++trace :: TTerm String -> TTerm (Flow s a) -> TTerm (Flow s a)+trace msg flow = var "hydra.monads.withTrace" @@ msg @@ flow++triple :: TTerm a -> TTerm b -> TTerm c -> TTerm (a, b, c)+triple (TTerm a) (TTerm b) (TTerm c) = TTerm $ Terms.triple a b c++tuple4 :: TTerm a -> TTerm b -> TTerm c -> TTerm d -> TTerm (a, b, c, d)+tuple4 (TTerm a) (TTerm b) (TTerm c) (TTerm d) = TTerm $ Terms.tuple4 a b c d++tuple5 :: TTerm a -> TTerm b -> TTerm c -> TTerm d -> TTerm e -> TTerm (a, b, c, d, e)+tuple5 (TTerm a) (TTerm b) (TTerm c) (TTerm d) (TTerm e) = TTerm $ Terms.tuple5 a b c d e++unaryFunction :: (TTerm a -> TTerm b) -> TTerm (a -> b)+unaryFunction f = case (unTTerm $ f $ var "x") of+ TermApplication (Application lhs _) -> TTerm lhs+ TermEither (Prelude.Left _) -> lambda "x" $ TTerm $ TermEither $ Prelude.Left $ Terms.var "x"+ TermEither (Prelude.Right _) -> lambda "x" $ TTerm $ TermEither $ Prelude.Right $ Terms.var "x"+ TermMaybe (Just _) -> primitive _maybes_pure+ TermUnion (Injection tname (Field fname _)) -> lambda "x" $ inject tname fname $ var "x"+ TermWrap (WrappedTerm tname _) -> lambda "x" $ wrap tname $ var "x"++-- | Unit value (empty record)+unit :: TTerm a+unit = TTerm Terms.unit++-- | Create a unit variant of a union+-- Example: injectUnit (Name "Result") (Name "success")+injectUnit :: Name -> Name -> TTerm a+injectUnit name fname = TTerm $ Terms.inject name fname Terms.unit++-- | Create an unwrap function for a wrapped type+-- Example: unwrap (Name "Email")+unwrap :: Name -> TTerm (a -> b)+unwrap = TTerm . Terms.unwrap++-- | Create a variable reference+-- Example: var "x"+var :: String -> TTerm a+var v = TTerm $ Terms.var v++-- | Create a wrapped term (instance of a newtype)+-- Example: wrap (Name "Email") (string "user@example.com")+-- Note: the phantom types provide no guarantee of type safety in this case+wrap :: Name -> TTerm a -> TTerm b+wrap name (TTerm term) = TTerm $ Terms.wrap name term
+ src/main/haskell/Hydra/Dsl/Meta/Terms.hs view
@@ -0,0 +1,534 @@+{-# LANGUAGE FlexibleContexts #-}++-- | A domain-specific language for constructing term-encoded Hydra terms in Haskell;+-- these functions enable you to build terms (programs) which build terms.+module Hydra.Dsl.Meta.Terms (+ module Hydra.Dsl.Meta.Base,+ module Hydra.Dsl.Meta.Terms,+) where++import Hydra.Kernel+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Encode.Core as EncodeCore+import Hydra.Dsl.Meta.Base+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms++import qualified Data.ByteString as B+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import Data.Int+import Prelude hiding (map, product, sum)+++-- Operators++-- | Function composition operator for term-encoded terms: f <.> g creates a function that applies g then f+-- Example: var "stringLength" <.> var "toString"+(<.>) :: TTerm Term -> TTerm Term -> TTerm Term+f <.> g = compose f g++-- | Function application operator for term-encoded terms+-- Example: fun @@ arg+(@@) :: TTerm Term -> TTerm Term -> TTerm Term+f @@ x = apply f x++-- | Attach an annotation to a term-encoded term+-- Example: annot (Phantoms.map M.empty) (int32 42)+annot :: TTerm (M.Map Name Term) -> TTerm Term -> TTerm Term+annot annMap term = Core.termAnnotated $ Core.annotatedTerm term annMap++-- | Create a term-encoded annotated term (term with type annotations)+-- Example: annotated (int32 42) (Phantoms.map M.empty)+annotated :: TTerm Term -> TTerm (M.Map Name Term) -> TTerm Term+annotated term annMap = Core.termAnnotated $ Core.annotatedTerm term annMap++annotatedTerm :: TTerm Term -> TTerm Term -> TTerm Term+annotatedTerm body ann = inject (Core.nameLift _Term) "annotated" $ record (Core.nameLift _AnnotatedTerm) [+ _AnnotatedTerm_body>>: body,+ _AnnotatedTerm_annotation>>: ann]++-- | Apply a term-encoded function to a term-encoded argument+-- Example: apply (var "add") (int32 1)+apply :: TTerm Term -> TTerm Term -> TTerm Term+apply func arg = Core.termApplication $ Core.application func arg++-- | Create a term-encoded unlimited precision floating point literal+-- Example: bigfloat 3.14159+bigfloat :: Double -> TTerm Term+bigfloat = bigfloatLift . TTerm . Terms.bigfloat++-- | Lift a TTerm Double to a term-encoded bigfloat literal+bigfloatLift :: TTerm Double -> TTerm Term+bigfloatLift = Core.termLiteral . Core.literalFloat . Core.floatValueBigfloat++-- | Create a term-encoded unlimited precision integer+-- Example: bigint 42+bigint :: Integer -> TTerm Term+bigint = bigintLift . TTerm . Terms.bigint++-- | Lift a TTerm Integer to a term-encoded bigint literal+-- Example: bigintLift (varPhantom "x" :: TTerm Integer)+bigintLift :: TTerm Integer -> TTerm Term+bigintLift = Core.termLiteral . Core.literalInteger . Core.integerValueBigint++-- | Create a term-encoded boolean literal+-- Example: boolean True+boolean :: Bool -> TTerm Term+boolean = booleanLift . TTerm . Terms.boolean++-- | Lift a TTerm Bool to a term-encoded boolean literal+-- Example: booleanLift $ Phantoms.true+booleanLift :: TTerm Bool -> TTerm Term+booleanLift = Core.termLiteral . Core.literalBoolean++-- | Create a term-encoded binary (byte string) literal+-- Example: binary (B.pack [0x48, 0x65, 0x6C, 0x6C, 0x6F])+binary :: B.ByteString -> TTerm Term+binary = binaryLift . TTerm . Terms.binary++-- | Lift a TTerm ByteString to a term-encoded binary literal+binaryLift :: TTerm B.ByteString -> TTerm Term+binaryLift = Core.termLiteral . Core.literalBinary++-- | Create a term-encoded constant function that always returns the same term-encoded value+-- Example: constant (int32 42)+constant :: TTerm Term -> TTerm Term+constant = lambda ignoredVariable++-- | Term-encoded boolean false literal+false :: TTerm Term+false = boolean False++-- | Create a term-encoded field with the given name and term-encoded value+-- Example: field "age" (int32 30)+field :: String -> TTerm Term -> TTerm Field+field s = Core.field (name s)++-- | Create a term-encoded 32-bit floating point literal+-- Example: float32 3.14+float32 :: Float -> TTerm Term+float32 = float32Lift . TTerm . Terms.float32++-- | Lift a TTerm Float to a term-encoded float32 literal+-- Example: float32Lift (varPhantom "x" :: TTerm Float)+float32Lift :: TTerm Float -> TTerm Term+float32Lift = Core.termLiteral . Core.literalFloat . Core.floatValueFloat32++-- | Create a term-encoded 64-bit floating point literal+-- Example: float64 3.14159+float64 :: Double -> TTerm Term+float64 = float64Lift . TTerm . Terms.float64++-- | Lift a TTerm Float to a term-encoded float64 literal+-- Example: float64Lift (varPhantom "x" :: TTerm Float)+float64Lift :: TTerm Double -> TTerm Term+float64Lift = Core.termLiteral . Core.literalFloat . Core.floatValueFloat64++-- | Create a term-encoded floating-point literal with specified precision+-- Example: float (FloatValueFloat32 3.14)+float :: TTerm FloatValue -> TTerm Term+float = Core.termLiteral . Core.literalFloat++-- | Create a term-encoded union injection+-- Example: inject (name "Result") "success" (int32 42)+inject :: AsTerm t Name => t -> String -> TTerm Term -> TTerm Term+inject tname fname = Core.termUnion . Core.injection (asTerm tname) . Core.field (name fname)++injectUnit :: AsTerm t Name => t -> String -> TTerm Term+injectUnit tname fname = inject tname fname unit++-- | Create a term-encoded 8-bit signed integer literal+-- Example: int8 127+int8 :: Int8 -> TTerm Term+int8 = int8Lift . TTerm . Terms.int8++-- | Lift a TTerm Int8 to a term-encoded int8 literal+-- Example: int8Lift (varPhantom "x" :: TTerm Int8)+int8Lift :: TTerm Int8 -> TTerm Term+int8Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt8++-- | Create a term-encoded 16-bit signed integer literal+-- Example: int16 32767+int16 :: Int16 -> TTerm Term+int16 = int16Lift . TTerm . Terms.int16++-- | Lift a TTerm Int16 to a term-encoded int16 literal+-- Example: int16Lift (varPhantom "x" :: TTerm Int16)+int16Lift :: TTerm Int16 -> TTerm Term+int16Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt16++-- | Create a term-encoded 32-bit signed integer literal+-- Example: int32 42+int32 :: Int -> TTerm Term+int32 = int32Lift . TTerm . Terms.int32++-- | Lift a TTerm Int to a term-encoded int32 literal+-- Example: int32Lift (varPhantom "x" :: TTerm Int)+int32Lift :: TTerm Int -> TTerm Term+int32Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt32++-- | Create a term-encoded 64-bit signed integer literal+-- Example: int64 9223372036854775807+int64 :: Int64 -> TTerm Term+int64 = int64Lift . TTerm . Terms.int64++-- | Lift a TTerm Int64 to a term-encoded int64 literal+-- Example: int64Lift (varPhantom "x" :: TTerm Int64)+int64Lift :: TTerm Int64 -> TTerm Term+int64Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt64++-- | Create a term-encoded integer literal with specified bit width+-- Example: integer (IntegerValueInt32 42)+integer :: TTerm IntegerValue -> TTerm Term+integer = Core.termLiteral . Core.literalInteger++-- | Create a term-encoded 'Just' optional value+-- Example: just (string "found")+just :: TTerm Term -> TTerm (Maybe Term)+just = Phantoms.just++-- | Create a term-encoded lambda function with one parameter+-- Example: lambda "x" (var "add" @@ var "x" @@ int32 1)+lambda :: String -> TTerm Term -> TTerm Term+lambda var body = Core.termFunction $ Core.functionLambda $ Core.lambda (name var) Phantoms.nothing body++-- | Create a term-encoded multi-parameter lambda function (curried form)+-- Example: lambdas ["x", "y"] (var "add" @@ var "x" @@ var "y")+lambdas :: [String] -> TTerm Term -> TTerm Term+lambdas params body = case params of+ [] -> body+ (h:rest) -> Core.termFunction $ Core.functionLambda $ Core.lambda (name h) Phantoms.nothing $ lambdas rest body++-- | Create a term-encoded let expression with multiple bindings+-- Example: lets ["x">: int32 1, "y">: int32 2] (var "add" @@ var "x" @@ var "y")+lets :: [(TTerm Name, TTerm Term)] -> TTerm Term -> TTerm Term+lets pairs body = Core.termLet $ Core.let_ (Phantoms.list $ toBinding pairs) body+ where+ toBinding = fmap (\(n, t) -> Core.binding n t Phantoms.nothing)++-- | Create a term-encoded left either value+-- Example: left (string "error")+left :: TTerm Term -> TTerm Term+left t = Core.termEither $ Phantoms.left t++-- | Create a term-encoded list+-- Example: list [int32 1, int32 2, int32 3]+list :: [TTerm Term] -> TTerm Term+list = Core.termList . Phantoms.list++-- | Create a term-encoded map/dictionary+-- Example: map (fromList [(string "key", int32 42)])+map :: TTerm (M.Map Term Term) -> TTerm Term+map = Core.termMap++mapTerm1 :: TTerm (M.Map Term Term) -> TTerm Term+mapTerm1 m = inject (Core.nameLift _Term) "map" $ Core.termMap m++-- | Create a term-encoded pattern match on a union+-- Example: match (name "Result") nothing ["success">: int32 42, "error">: string "fail"]+match :: AsTerm t Name => t -> TTerm (Maybe Term) -> [(TTerm Name, TTerm Term)] -> TTerm Term+match tname def pairs = Core.termFunction $ Core.functionElimination $ Core.eliminationUnion+ $ Core.caseStatement (asTerm tname) def $ Phantoms.list $ toField pairs+ where+ toField = fmap (\(n, t) -> Core.field n t)++--meta :: TTerm a -> TTerm Term+--meta (TTerm term) = TTerm $ EncodeCore.term term++metaref :: TBinding a -> TTerm Term+metaref (TBinding name _) = Core.termVariable $ Core.nameLift name++-- | Create a term-encoded 'Nothing' optional value+nothing :: TTerm (Maybe Term)+nothing = Phantoms.nothing++-- | Create a term-encoded optional value from a Maybe+-- Example: optional (just (int32 42))+optional :: TTerm (Maybe Term) -> TTerm Term+optional = Core.termMaybe++-- | Create a term-encoded pair+-- Example: pair (string "name") (int32 42)+pair :: TTerm Term -> TTerm Term -> TTerm Term+pair t1 t2 = Core.termPair $ Phantoms.pair t1 t2++-- | Create a term-encoded primitive function reference+-- Example: primitive (Name "hydra.lib.strings.length")+primitive :: Name -> TTerm Term+primitive = primitiveLift . TTerm . EncodeCore.name++primitiveLift :: TTerm Name -> TTerm Term+primitiveLift = Core.termFunction . Core.functionPrimitive++-- | Create a term-encoded field projection function+-- Example: project (name "Person") (name "firstName")+project :: (AsTerm t Name, AsTerm f Name) => t -> f -> TTerm Term+project tname fname = Core.termFunction $ Core.functionElimination $ Core.eliminationRecord+ $ Core.projection (asTerm tname) (asTerm fname)++-- | Create a term-encoded record with named fields+-- Example: record (name "Person") ["name">: string "John", "age">: int32 30]+record :: AsTerm t Name => t -> [(TTerm Name, TTerm Term)] -> TTerm Term+record name pairs = Core.termRecord $ Core.record (asTerm name) $ Phantoms.list (toField <$> pairs)+ where+ toField (n, t) = Core.field n t++recordLift :: Name -> [(TTerm Name, TTerm Term)] -> TTerm Term+recordLift name pairs = record (TTerm $ EncodeCore.name name) pairs++-- | Create a term-encoded right either value+-- Example: right (int32 42)+right :: TTerm Term -> TTerm Term+right t = Core.termEither $ Phantoms.right t++-- | Create a term-encoded set+-- Example: set [string "a", string "b", string "c"]+set :: [TTerm Term] -> TTerm Term+set els = Core.termSet $ TTerm $ TermSet $ S.fromList (unTTerm <$> els)++-- | Create a term-encoded string literal+-- Example: string "hello world"+string :: String -> TTerm Term+string = stringLift . TTerm . Terms.string++-- | Lift a TTerm String to a term-encoded string literal+-- Example: stringLift $ Phantoms.string "hello world"+stringLift :: TTerm String -> TTerm Term+stringLift = Core.termLiteral . Core.literalString++stringTerm :: String -> TTerm Term+stringTerm s = inject (Core.nameLift _Term) "literal" $ inject (Core.nameLift _Literal) "string" $ string s++-- | Create a meta-level term encoding a 16-bit signed integer literal+-- Example: int16Term 100 creates a term that *represents* the int16 literal 100+int16Term :: Int16 -> TTerm Term+int16Term n = inject (Core.nameLift _Term) "literal" $+ inject (Core.nameLift _Literal) "integer" $+ inject (Core.nameLift _IntegerValue) "int16" $ int16 n++-- | Create a meta-level term encoding a 32-bit signed integer literal+-- Example: int32Term 42 creates a term that *represents* the int32 literal 42+int32Term :: Int -> TTerm Term+int32Term n = inject (Core.nameLift _Term) "literal" $+ inject (Core.nameLift _Literal) "integer" $+ inject (Core.nameLift _IntegerValue) "int32" $ int32 n++-- | Create a meta-level term encoding a 64-bit signed integer literal+-- Example: int64Term 137 creates a term that *represents* the int64 literal 137+int64Term :: Int64 -> TTerm Term+int64Term n = inject (Core.nameLift _Term) "literal" $+ inject (Core.nameLift _Literal) "integer" $+ inject (Core.nameLift _IntegerValue) "int64" $ int64 n++-- | Create a meta-level term encoding a boolean literal+-- Example: booleanTerm True creates a term that *represents* the boolean True+booleanTerm :: Bool -> TTerm Term+booleanTerm b = inject (Core.nameLift _Term) "literal" $ inject (Core.nameLift _Literal) "boolean" $ boolean b++-- | Create a meta-level term encoding a Name+-- Example: nameTerm "foo" creates a term that *represents* the name "foo"+nameTerm :: String -> TTerm Term+nameTerm s = wrap (Core.nameLift _Name) $ string s++-- | Term-encoded boolean true literal+true :: TTerm Term+true = boolean True++-- | Create a term-encoded tuple with multiple components using nested pairs+-- Example: tuple [string "name", int32 42, boolean True]+tuple :: [TTerm Term] -> TTerm Term+tuple [] = unit+tuple [a] = a+tuple [a, b] = pair a b+tuple (a:rest) = pair a (tuple rest)++-- | Create a term-encoded 2-tuple (same as pair)+-- Example: tuple2 (string "name") (int32 42)+tuple2 :: TTerm Term -> TTerm Term -> TTerm Term+tuple2 = pair++-- | Create a term-encoded 8-bit unsigned integer literal+-- Example: uint8 255+uint8 :: Int16 -> TTerm Term+uint8 = uint8Lift . TTerm . Terms.uint8++uint8Lift :: TTerm Int16 -> TTerm Term+uint8Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint8++-- | Create a term-encoded 16-bit unsigned integer literal+-- Example: uint16 65535+uint16 :: Int -> TTerm Term+uint16 = uint16Lift . TTerm . Terms.uint16++-- | Lift a TTerm Int to a term-encoded uint16 literal+-- Example: uint16Lift (varPhantom "x" :: TTerm Int)+uint16Lift :: TTerm Int -> TTerm Term+uint16Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint16++-- | Create a term-encoded 32-bit unsigned integer literal+-- Example: uint32 4294967295+uint32 :: Int64 -> TTerm Term+uint32 = uint32Lift . TTerm . Terms.uint32++-- | Lift a TTerm Int64 to a term-encoded uint32 literal+uint32Lift :: TTerm Int64 -> TTerm Term+uint32Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint32++-- | Create a term-encoded 64-bit unsigned integer literal+-- Example: uint64 18446744073709551615+uint64 :: Integer -> TTerm Term+uint64 = uint64Lift . TTerm . Terms.uint64++-- | Lift a TTerm Integer to a term-encoded uint64 literal+-- Example: uint64Lift (varPhantom "x" :: TTerm Integer)+uint64Lift :: TTerm Integer -> TTerm Term+uint64Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint64++-- | Create a term-encoded unit value+-- Example: unit+unit :: TTerm Term+unit = Core.termUnit++injectUnitPhantom :: Name -> Name -> TTerm Term+injectUnitPhantom tname fname = injectPhantom tname fname Core.termUnit++-- | Create a term-encoded unwrap function for a wrapped type+-- Example: unwrap (name "Email")+unwrap :: AsTerm t Name => t -> TTerm Term+unwrap = Core.termFunction . Core.functionElimination . Core.eliminationWrap . asTerm++-- | Create a term-encoded variable reference from a string+-- Example: var "x"+var :: String -> TTerm Term+var = Core.termVariable . name++-- | Create a term-encoded variable reference from a Name+-- Example: varName (Name "x")+varName :: Name -> TTerm Term+varName (Name n) = Core.termVariable $ TTerm $ Terms.string n++-- | Create a phantom-typed variable reference from a Name+-- Example: varNamePhantom (Name "x") :: TTerm Int+varNamePhantom :: Name -> TTerm a+varNamePhantom = TTerm . TermVariable++-- | Maps a string to a phantom-typed variable term+-- Example: varPhantom "x" :: TTerm Int+varPhantom :: String -> TTerm a+varPhantom = TTerm . TermVariable . Name++injectPhantom :: Name -> Name -> TTerm Term -> TTerm Term+injectPhantom tname fname term = Core.termUnion $ Core.injection (Core.nameLift tname) $ Core.field (Core.nameLift fname) term++-- | Create a term-encoded wrapped term (newtype)+-- Example: wrap (name "Email") (string "user@example.com")+wrap :: AsTerm t Name => t -> TTerm Term -> TTerm Term+wrap n = Core.termWrap . Core.wrappedTerm (asTerm n)++-- | Create a term-encoded lambda with a type annotation+-- Example: lambdaTyped "x" T.int32 (var "x")+lambdaTyped :: String -> TTerm Type -> TTerm Term -> TTerm Term+lambdaTyped param dom body = Core.termFunction $ Core.functionLambda $ Core.lambda (name param) (Phantoms.just dom) body++-- | Create a term-encoded type application+-- Example: tyapp (list []) T.int32+tyapp :: TTerm Term -> TTerm Type -> TTerm Term+tyapp term typ = Core.termTypeApplication $ Core.typeApplicationTerm term typ++-- | Apply multiple type arguments to a term+-- Example: tyapps (pair (int32 1) (string "a")) [T.int32, T.string]+tyapps :: TTerm Term -> [TTerm Type] -> TTerm Term+tyapps = L.foldl tyapp++-- | Apply type arguments to a polymorphic term (same as tyapps)+-- Example: typeApplication (list []) [T.int32]+typeApplication :: TTerm Term -> [TTerm Type] -> TTerm Term+typeApplication = tyapps++-- | Create a term-encoded type lambda (System F)+-- Example: tylam "t0" (lambda "x" $ var "x")+tylam :: String -> TTerm Term -> TTerm Term+tylam var body = Core.termTypeLambda $ Core.typeLambda (name var) body++-- | Create multiple term-encoded type lambdas+-- Example: tylams ["t0", "t1"] (lambda "x" $ var "x")+tylams :: [String] -> TTerm Term -> TTerm Term+tylams vars body = L.foldl (\b v -> Core.termTypeLambda $ Core.typeLambda (name v) b) body $ L.reverse vars++-- | Create term-encoded type lambda(s) (same as tylams)+-- Example: typeLambda ["t0"] (lambda "x" $ var "x")+typeLambda :: [String] -> TTerm Term -> TTerm Term+typeLambda = tylams++-- | Create a term-encoded let expression with type annotations on bindings+-- Example: letsTyped [("x", int32 1, T.mono T.int32)] (var "x")+letsTyped :: [(String, TTerm Term, TTerm TypeScheme)] -> TTerm Term -> TTerm Term+letsTyped bindings body = Core.termLet $ Core.let_ (Phantoms.list $ toBinding bindings) body+ where+ toBinding = fmap (\(n, t, ts) -> Core.binding (name n) t (Phantoms.just ts))++-- | Create a term-encoded literal from a Literal value+-- Example: literal (LiteralInteger (IntegerValueInt32 42))+literal :: TTerm Literal -> TTerm Term+literal = Core.termLiteral++-- | Create a term-encoded character literal via int32+-- Example: char 'A'+char :: Char -> TTerm Term+char = int32 . ord+ where+ ord = fromEnum++-- | Term-encoded function composition (apply g then f)+-- Example: compose f g creates a function that applies g then f+compose :: TTerm Term -> TTerm Term -> TTerm Term+compose f g = lambda "arg_" $ f @@ (g @@ var "arg_")++-- | Term-encoded identity function+-- Example: identity+identity :: TTerm Term+identity = lambda "x_" $ var "x_"++-- | Create a term-encoded 3-tuple using nested pairs+-- Example: triple (int32 1) (string "test") (boolean True)+triple :: TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term+triple t1 t2 t3 = pair t1 (pair t2 t3)++-- | Create a term-encoded 4-tuple using nested pairs+-- Example: tuple4 (int32 1) (string "test") (boolean True) (float32 3.14)+tuple4 :: TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term+tuple4 t1 t2 t3 t4 = pair t1 (pair t2 (pair t3 t4))++-- | Create a term-encoded 5-tuple using nested pairs+-- Example: tuple5 (int32 1) (string "a") (boolean True) (float32 3.14) (int32 42)+tuple5 :: TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term+tuple5 t1 t2 t3 t4 t5 = pair t1 (pair t2 (pair t3 (pair t4 t5)))++-- | Convert a Comparison enum value to a term-encoded term+-- Example: comparison ComparisonEqualTo+comparison :: Comparison -> TTerm Term+comparison t = case t of+ ComparisonEqualTo -> Phantoms.injectUnit _Comparison _Comparison_equalTo+ ComparisonLessThan -> Phantoms.injectUnit _Comparison _Comparison_lessThan+ ComparisonGreaterThan -> Phantoms.injectUnit _Comparison _Comparison_greaterThan++-- hydra.compute at the `TTerm Term` level++flowStateTerm :: TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term+flowStateTerm value state trace = recordLift _FlowState [+ _FlowState_value>>: value,+ _FlowState_state>>: state,+ _FlowState_trace>>: trace]++-- | Build a trace term at the meta level with custom stack, messages, and other+traceTerm :: TTerm Term -> TTerm Term -> TTerm Term -> TTerm Term+traceTerm stack messages other = recordLift _Trace [+ _Trace_stack>>: stack,+ _Trace_messages>>: messages,+ _Trace_other>>: other]++unFlowTerm :: TTerm Term+unFlowTerm = unwrap $ Core.nameLift _Flow
+ src/main/haskell/Hydra/Dsl/Meta/Testing.hs view
@@ -0,0 +1,780 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Meta-DSL for constructing test-related terms+-- TODO: merge with Hydra.Dsl.Tests++module Hydra.Dsl.Meta.Testing where++import Hydra.Kernel+import Hydra.Ast (Expr)+import Hydra.Json.Model (Value)+import Hydra.Parsing (ParseResult)+import Hydra.Testing as Testing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding ((++))+import qualified Hydra.Encode.Core as EncodeCore+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as T++import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S++type Int32 = I.Int32+++tag_disabled = Tag "disabled"+tag_disabledForMinimalInference = Tag "disabledForMinimalInference"+tag_disabledForPython = Tag "disabledForPython"+tag_requiresFlowDecoding = Tag "requiresFlowDecoding"++noTags :: TTerm [Tag]+noTags = Phantoms.list ([] :: [TTerm Tag])++expectFailure :: AsTerm t Term => Int -> [Tag] -> t -> TTerm TestCaseWithMetadata+expectFailure i tags term = infFailureTest ("#" ++ show i) tags (asTerm term)++expectMono :: AsTerm t Term => Int -> [Tag] -> t -> TTerm Type -> TTerm TestCaseWithMetadata+expectMono i tags term typ = infTest ("#" ++ show i) tags (asTerm term) $ T.mono typ++expectPoly :: AsTerm t Term => Int -> [Tag] -> t -> [String] -> TTerm Type -> TTerm TestCaseWithMetadata+expectPoly i tags term params typ = infTest ("#" ++ show i) tags (asTerm term) $ T.poly params typ++groupRef = MetaTerms.varNamePhantom . bindingName++primCase :: String -> Name -> [TTerm Term] -> TTerm Term -> TTerm TestCaseWithMetadata+primCase cname primName args output = primCaseWithTags cname [] primName args output++primCaseWithTags :: String -> [Tag] -> Name -> [TTerm Term] -> TTerm Term -> TTerm TestCaseWithMetadata+primCaseWithTags cname tags primName args output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseEvaluation $ evaluationTestCase evaluationStyleEager input output)+ nothing (Phantoms.list $ tag . unTag <$> tags)+ where+ input = L.foldl (MetaTerms.@@) (MetaTerms.primitive primName) args++evalCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+evalCase cname input output = evalCaseWithTags cname [] input output++evalCaseWithTags :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+evalCaseWithTags cname tags input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseEvaluation $ evaluationTestCase evaluationStyleEager input output)+ nothing (Phantoms.list $ tag . unTag <$> tags)++infFailureTest :: String -> [Tag] -> TTerm Term -> TTerm TestCaseWithMetadata+infFailureTest name tags term = testCaseWithMetadata (Phantoms.string name)+ (testCaseInferenceFailure $ inferenceFailureTestCase term) nothing (Phantoms.list $ tag . unTag <$> tags)++infTest :: String -> [Tag] -> TTerm Term -> TTerm TypeScheme -> TTerm TestCaseWithMetadata+infTest name tags term ts = testCaseWithMetadata (Phantoms.string name)+ (testCaseInference $ inferenceTestCase term ts) nothing (Phantoms.list $ tag . unTag <$> tags)++isDisabled tcase = tag_disabled `L.elem` Testing.testCaseWithMetadataTags tcase+isDisabledForMinimalInference tcase = tag_disabledForMinimalInference `L.elem` Testing.testCaseWithMetadataTags tcase+isDisabledForPython tcase = tag_disabledForPython `L.elem` Testing.testCaseWithMetadataTags tcase+isRequiresFlowDecoding tcase = tag_requiresFlowDecoding `L.elem` Testing.testCaseWithMetadataTags tcase++mapTerm :: [(TTerm Term, TTerm Term)] -> TTerm Term+mapTerm pairs = TTerm $ TermUnion $ Injection _Term $ Field _Term_map $ TermMap $ M.fromList [(unTTerm k, unTTerm v) | (k, v) <- pairs]++mapTermEmpty :: TTerm (M.Map k v)+mapTermEmpty = TTerm $ TermMap M.empty++subgroup :: AsTerm t TestCaseWithMetadata => String -> [t] -> TTerm TestGroup+subgroup name cases = tgroup name Nothing [] (asTerm <$> cases)++supergroup :: AsTerm t TestGroup => String -> [t] -> TTerm TestGroup+supergroup name subgroups = tgroup name Nothing (asTerm <$> subgroups) []++tag :: String -> TTerm Tag+tag = Phantoms.wrap _Tag . Phantoms.string++tgroup :: String -> Maybe String -> [TTerm TestGroup] -> [TTerm TestCaseWithMetadata] -> TTerm TestGroup+tgroup name mdesc subgroups cases = testGroup (Phantoms.string name) (opt (Phantoms.string <$> mdesc)) (Phantoms.list subgroups) (Phantoms.list cases)++----------------------------------------++encodeGroup (TestGroup name desc groups cases) = Terms.record _TestGroup [+ Field _TestGroup_name $ Terms.string name,+ Field _TestGroup_description $ Terms.optional (Terms.string <$> desc),+ Field _TestGroup_subgroups $ Terms.list (encodeGroup <$> groups),+ Field _TestGroup_cases $ Terms.list (encodeCaseWithMetadata <$> cases)]+encodeCaseWithMetadata (TestCaseWithMetadata name tcase mdesc tags) = Terms.record _TestCaseWithMetadata [+ Field _TestCaseWithMetadata_name $ Terms.string name,+ Field _TestCaseWithMetadata_case $ encodeCase tcase,+ Field _TestCaseWithMetadata_description $ Terms.optional (Terms.string <$> mdesc),+ Field _TestCaseWithMetadata_tags $ Terms.list (Terms.string . unTag <$> tags)]+encodeCase tcase = case tcase of+ TestCaseCaseConversion ccase -> Terms.inject _TestCase _TestCase_caseConversion $ encodeCaseConversionTestCase ccase+ TestCaseEtaExpansion ecase -> Terms.inject _TestCase _TestCase_etaExpansion $ encodeEtaExpansionTestCase ecase+ TestCaseEvaluation ecase -> Terms.inject _TestCase _TestCase_evaluation $ encodeEvaluationTestCase ecase+ TestCaseInference icase -> Terms.inject _TestCase _TestCase_inference $ encodeInferenceTestCase icase+encodeCaseConvention c = Terms.injectUnit _CaseConvention $ case c of+ CaseConventionLowerSnake -> _CaseConvention_lowerSnake+ CaseConventionUpperSnake -> _CaseConvention_upperSnake+ CaseConventionCamel -> _CaseConvention_camel+ CaseConventionPascal -> _CaseConvention_pascal+encodeCaseConversionTestCase (CaseConversionTestCase fromConvention toConvention fromString toString) = Terms.record _CaseConversionTestCase [+ Field _CaseConversionTestCase_fromConvention $ encodeCaseConvention fromConvention,+ Field _CaseConversionTestCase_toConvention $ encodeCaseConvention toConvention,+ Field _CaseConversionTestCase_fromString $ Terms.string fromString,+ Field _CaseConversionTestCase_toString $ Terms.string toString]+encodeEtaExpansionTestCase (EtaExpansionTestCase input output) = Terms.record _EtaExpansionTestCase [+ Field _EtaExpansionTestCase_input $ EncodeCore.term input,+ Field _EtaExpansionTestCase_output $ EncodeCore.term output]+encodeEvaluationTestCase (EvaluationTestCase style input output) = Terms.record _EvaluationTestCase [+ Field _EvaluationTestCase_evaluationStyle $ Terms.inject _EvaluationStyle (case style of+ EvaluationStyleEager -> _EvaluationStyle_eager+ EvaluationStyleLazy -> _EvaluationStyle_lazy) Terms.unit,+ Field _EvaluationTestCase_input $ EncodeCore.term input,+ Field _EvaluationTestCase_output $ EncodeCore.term output]+encodeInferenceTestCase (InferenceTestCase input output) = Terms.record _InferenceTestCase [+ Field _InferenceTestCase_input $ EncodeCore.term input,+ Field _InferenceTestCase_output $ EncodeCore.typeScheme output]++----------------------------------------++caseConversionTestCase :: TTerm CaseConvention -> TTerm CaseConvention -> TTerm String -> TTerm String -> TTerm CaseConversionTestCase+caseConversionTestCase fromConvention toConvention fromString toString =+ Phantoms.record _CaseConversionTestCase [+ _CaseConversionTestCase_fromConvention>>: fromConvention,+ _CaseConversionTestCase_toConvention>>: toConvention,+ _CaseConversionTestCase_fromString>>: fromString,+ _CaseConversionTestCase_toString>>: toString]++encodedTestGroupToBinding :: Namespace -> String -> TTerm TestGroup -> Binding+encodedTestGroupToBinding ns lname group = Binding name (unTTerm group)+ $ Just $ TypeScheme [] typ Nothing+ where+ name = unqualifyName $ QualifiedName (Just ns) lname+ typ = TypeVariable _TestGroup++inferenceFailureTestCase :: TTerm Term -> TTerm InferenceFailureTestCase+inferenceFailureTestCase input = Phantoms.record _InferenceFailureTestCase [+ _InferenceFailureTestCase_input>>: input]++etaExpansionTestCase :: TTerm Term -> TTerm Term -> TTerm EtaExpansionTestCase+etaExpansionTestCase input output = Phantoms.record _EtaExpansionTestCase [+ _EtaExpansionTestCase_input>>: input,+ _EtaExpansionTestCase_output>>: output]++inferenceTestCase :: TTerm Term -> TTerm TypeScheme -> TTerm InferenceTestCase+inferenceTestCase input output = Phantoms.record _InferenceTestCase [+ _InferenceTestCase_input>>: input,+ _InferenceTestCase_output>>: output]++evaluationStyleEager :: TTerm EvaluationStyle+evaluationStyleEager = Phantoms.injectUnit _EvaluationStyle _EvaluationStyle_eager++evaluationStyleLazy :: TTerm EvaluationStyle+evaluationStyleLazy = Phantoms.injectUnit _EvaluationStyle _EvaluationStyle_lazy++evaluationTestCase :: TTerm EvaluationStyle -> TTerm Term -> TTerm Term -> TTerm EvaluationTestCase+evaluationTestCase style input output = Phantoms.record _EvaluationTestCase [+ _EvaluationTestCase_evaluationStyle>>: style,+ _EvaluationTestCase_input>>: input,+ _EvaluationTestCase_output>>: output]++delegatedEvaluationTestCase :: TTerm Term -> TTerm Term -> TTerm DelegatedEvaluationTestCase+delegatedEvaluationTestCase input output = Phantoms.record _DelegatedEvaluationTestCase [+ _DelegatedEvaluationTestCase_input>>: input,+ _DelegatedEvaluationTestCase_output>>: output]++testCaseCaseConversion :: TTerm CaseConversionTestCase -> TTerm TestCase+testCaseCaseConversion = inject _TestCase _TestCase_caseConversion++testCaseDelegatedEvaluation :: TTerm DelegatedEvaluationTestCase -> TTerm TestCase+testCaseDelegatedEvaluation = inject _TestCase _TestCase_delegatedEvaluation++testCaseEtaExpansion :: TTerm EtaExpansionTestCase -> TTerm TestCase+testCaseEtaExpansion = inject _TestCase _TestCase_etaExpansion++testCaseEvaluation :: TTerm EvaluationTestCase -> TTerm TestCase+testCaseEvaluation = inject _TestCase _TestCase_evaluation++testCaseInference :: TTerm InferenceTestCase -> TTerm TestCase+testCaseInference = inject _TestCase _TestCase_inference++testCaseInferenceFailure :: TTerm InferenceFailureTestCase -> TTerm TestCase+testCaseInferenceFailure = inject _TestCase _TestCase_inferenceFailure++testCaseJsonCoder :: TTerm JsonCoderTestCase -> TTerm TestCase+testCaseJsonCoder = inject _TestCase _TestCase_jsonCoder++testCaseJsonDecode :: TTerm JsonDecodeTestCase -> TTerm TestCase+testCaseJsonDecode = inject _TestCase _TestCase_jsonDecode++testCaseJsonEncode :: TTerm JsonEncodeTestCase -> TTerm TestCase+testCaseJsonEncode = inject _TestCase _TestCase_jsonEncode++testCaseJsonParser :: TTerm JsonParserTestCase -> TTerm TestCase+testCaseJsonParser = inject _TestCase _TestCase_jsonParser++testCaseJsonRoundtrip :: TTerm JsonRoundtripTestCase -> TTerm TestCase+testCaseJsonRoundtrip = inject _TestCase _TestCase_jsonRoundtrip++testCaseJsonWriter :: TTerm JsonWriterTestCase -> TTerm TestCase+testCaseJsonWriter = inject _TestCase _TestCase_jsonWriter++testCaseAlphaConversion :: TTerm AlphaConversionTestCase -> TTerm TestCase+testCaseAlphaConversion = inject _TestCase _TestCase_alphaConversion++testCaseTypeReduction :: TTerm TypeReductionTestCase -> TTerm TestCase+testCaseTypeReduction = inject _TestCase _TestCase_typeReduction++alphaConversionTestCase :: TTerm Term -> TTerm Name -> TTerm Name -> TTerm Term -> TTerm AlphaConversionTestCase+alphaConversionTestCase term oldVar newVar result = Phantoms.record _AlphaConversionTestCase [+ _AlphaConversionTestCase_term>>: term,+ _AlphaConversionTestCase_oldVariable>>: oldVar,+ _AlphaConversionTestCase_newVariable>>: newVar,+ _AlphaConversionTestCase_result>>: result]++typeReductionTestCase :: TTerm Type -> TTerm Type -> TTerm TypeReductionTestCase+typeReductionTestCase input output = Phantoms.record _TypeReductionTestCase [+ _TypeReductionTestCase_input>>: input,+ _TypeReductionTestCase_output>>: output]++-- | Convenience function for creating alpha conversion test cases+alphaCase :: String -> TTerm Term -> TTerm Name -> TTerm Name -> TTerm Term -> TTerm TestCaseWithMetadata+alphaCase cname term oldVar newVar result = testCaseWithMetadata (Phantoms.string cname)+ (testCaseAlphaConversion $ alphaConversionTestCase term oldVar newVar result)+ nothing noTags++-- | Convenience function for creating type reduction test cases+typeRedCase :: String -> TTerm Type -> TTerm Type -> TTerm TestCaseWithMetadata+typeRedCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseTypeReduction $ typeReductionTestCase input output)+ nothing noTags++writerTestCase :: TTerm a -> TTerm String -> TTerm (WriterTestCase a)+writerTestCase input output = Phantoms.record _WriterTestCase [+ _WriterTestCase_input>>: input,+ _WriterTestCase_output>>: output]++jsonWriterTestCase :: TTerm Value -> TTerm String -> TTerm JsonWriterTestCase+jsonWriterTestCase = writerTestCase++parserTestCase :: TTerm String -> TTerm (ParseResult a) -> TTerm (ParserTestCase a)+parserTestCase input output = Phantoms.record _ParserTestCase [+ _ParserTestCase_input>>: input,+ _ParserTestCase_output>>: output]++jsonParserTestCase :: TTerm String -> TTerm (ParseResult Value) -> TTerm JsonParserTestCase+jsonParserTestCase = parserTestCase++jsonCoderTestCase :: TTerm Type -> TTerm Term -> TTerm Value -> TTerm JsonCoderTestCase+jsonCoderTestCase typ term json = Phantoms.record _JsonCoderTestCase [+ _JsonCoderTestCase_type>>: typ,+ _JsonCoderTestCase_term>>: term,+ _JsonCoderTestCase_json>>: json]++-- | Convenience function for creating JSON coder test cases+coderCase :: String -> TTerm Type -> TTerm Term -> TTerm Value -> TTerm TestCaseWithMetadata+coderCase cname typ term json = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJsonCoder $ jsonCoderTestCase typ term json)+ nothing noTags++----------------------------------------+-- JSON encode/decode/roundtrip test case helpers (Either-based)++jsonDecodeTestCase :: TTerm Type -> TTerm Value -> TTerm (Either String Term) -> TTerm JsonDecodeTestCase+jsonDecodeTestCase typ json expected = Phantoms.record _JsonDecodeTestCase [+ _JsonDecodeTestCase_type>>: typ,+ _JsonDecodeTestCase_json>>: json,+ _JsonDecodeTestCase_expected>>: expected]++jsonEncodeTestCase :: TTerm Term -> TTerm (Either String Value) -> TTerm JsonEncodeTestCase+jsonEncodeTestCase term expected = Phantoms.record _JsonEncodeTestCase [+ _JsonEncodeTestCase_term>>: term,+ _JsonEncodeTestCase_expected>>: expected]++jsonRoundtripTestCase :: TTerm Type -> TTerm Term -> TTerm JsonRoundtripTestCase+jsonRoundtripTestCase typ term = Phantoms.record _JsonRoundtripTestCase [+ _JsonRoundtripTestCase_type>>: typ,+ _JsonRoundtripTestCase_term>>: term]++-- | Convenience function for creating JSON decode test cases (Either-based)+jsonDecodeCase :: String -> TTerm Type -> TTerm Value -> TTerm (Either String Term) -> TTerm TestCaseWithMetadata+jsonDecodeCase cname typ json expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJsonDecode $ jsonDecodeTestCase typ json expected)+ nothing noTags++-- | Convenience function for creating JSON encode test cases (Either-based)+jsonEncodeCase :: String -> TTerm Term -> TTerm (Either String Value) -> TTerm TestCaseWithMetadata+jsonEncodeCase cname term expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJsonEncode $ jsonEncodeTestCase term expected)+ nothing noTags++-- | Convenience function for creating JSON round-trip test cases (Either-based)+jsonRoundtripCase :: String -> TTerm Type -> TTerm Term -> TTerm TestCaseWithMetadata+jsonRoundtripCase cname typ term = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJsonRoundtrip $ jsonRoundtripTestCase typ term)+ nothing noTags++testCaseTopologicalSort :: TTerm TopologicalSortTestCase -> TTerm TestCase+testCaseTopologicalSort = inject _TestCase _TestCase_topologicalSort++testCaseTopologicalSortSCC :: TTerm TopologicalSortSCCTestCase -> TTerm TestCase+testCaseTopologicalSortSCC = inject _TestCase _TestCase_topologicalSortSCC++topologicalSortTestCase :: TTerm [(Int, [Int])] -> TTerm (Either [[Int]] [Int]) -> TTerm TopologicalSortTestCase+topologicalSortTestCase adj expected = Phantoms.record _TopologicalSortTestCase [+ _TopologicalSortTestCase_adjacencyList>>: adj,+ _TopologicalSortTestCase_expected>>: expected]++topologicalSortSCCTestCase :: TTerm [(Int, [Int])] -> TTerm [[Int]] -> TTerm TopologicalSortSCCTestCase+topologicalSortSCCTestCase adj expected = Phantoms.record _TopologicalSortSCCTestCase [+ _TopologicalSortSCCTestCase_adjacencyList>>: adj,+ _TopologicalSortSCCTestCase_expected>>: expected]++-- | Convenience function for creating topological sort test cases+sortCase :: String -> TTerm [(Int, [Int])] -> TTerm (Either [[Int]] [Int]) -> TTerm TestCaseWithMetadata+sortCase cname adj expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseTopologicalSort $ topologicalSortTestCase adj expected)+ nothing noTags++-- | Convenience function for creating topological sort SCC test cases+sortSCCCase :: String -> TTerm [(Int, [Int])] -> TTerm [[Int]] -> TTerm TestCaseWithMetadata+sortSCCCase cname adj expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseTopologicalSortSCC $ topologicalSortSCCTestCase adj expected)+ nothing noTags++testCaseWithMetadata :: TTerm String -> TTerm TestCase -> TTerm (Maybe String) -> TTerm [Tag] -> TTerm TestCaseWithMetadata+testCaseWithMetadata name tcase description tags = Phantoms.record _TestCaseWithMetadata [+ _TestCaseWithMetadata_name>>: name,+ _TestCaseWithMetadata_case>>: tcase,+ _TestCaseWithMetadata_description>>: description,+ _TestCaseWithMetadata_tags>>: tags]++testCaseWithMetadataName :: TTerm (TestCaseWithMetadata -> String)+testCaseWithMetadataName = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_name++testCaseWithMetadataCase :: TTerm (TestCaseWithMetadata -> TestCase)+testCaseWithMetadataCase = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_case++testCaseWithMetadataDescription :: TTerm (TestCaseWithMetadata -> Maybe String)+testCaseWithMetadataDescription = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_description++testCaseWithMetadataTags :: TTerm (TestCaseWithMetadata -> [Tag])+testCaseWithMetadataTags = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_tags++testGroup :: TTerm String -> TTerm (Maybe String) -> TTerm [TestGroup] -> TTerm [TestCaseWithMetadata] -> TTerm TestGroup+testGroup name description subgroups cases = Phantoms.record _TestGroup [+ _TestGroup_name>>: name,+ _TestGroup_description>>: description,+ _TestGroup_subgroups>>: subgroups,+ _TestGroup_cases>>: cases]++testGroupToBinding :: Namespace -> String -> TestGroup -> Binding+testGroupToBinding ns lname group = encodedTestGroupToBinding ns lname (TTerm $ encodeGroup group)++testCaseSerialization :: TTerm SerializationTestCase -> TTerm TestCase+testCaseSerialization = inject _TestCase _TestCase_serialization++serializationTestCase :: TTerm Expr -> TTerm String -> TTerm SerializationTestCase+serializationTestCase input output = Phantoms.record _SerializationTestCase [+ _SerializationTestCase_input>>: input,+ _SerializationTestCase_output>>: output]++-- | Convenience function for creating serialization test cases+serCase :: String -> TTerm Expr -> TTerm String -> TTerm TestCaseWithMetadata+serCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseSerialization $ serializationTestCase input output)+ nothing noTags++----------------------------------------+-- Rewriting test case helpers++testCaseFlattenLetTerms :: TTerm FlattenLetTermsTestCase -> TTerm TestCase+testCaseFlattenLetTerms = inject _TestCase _TestCase_flattenLetTerms++testCaseFreeVariables :: TTerm FreeVariablesTestCase -> TTerm TestCase+testCaseFreeVariables = inject _TestCase _TestCase_freeVariables++testCaseLiftLambdaAboveLet :: TTerm LiftLambdaAboveLetTestCase -> TTerm TestCase+testCaseLiftLambdaAboveLet = inject _TestCase _TestCase_liftLambdaAboveLet++testCaseSimplifyTerm :: TTerm SimplifyTermTestCase -> TTerm TestCase+testCaseSimplifyTerm = inject _TestCase _TestCase_simplifyTerm++flattenLetTermsTestCase :: TTerm Term -> TTerm Term -> TTerm FlattenLetTermsTestCase+flattenLetTermsTestCase input output = Phantoms.record _FlattenLetTermsTestCase [+ _FlattenLetTermsTestCase_input>>: input,+ _FlattenLetTermsTestCase_output>>: output]++freeVariablesTestCase :: TTerm Term -> TTerm (S.Set Name) -> TTerm FreeVariablesTestCase+freeVariablesTestCase input output = Phantoms.record _FreeVariablesTestCase [+ _FreeVariablesTestCase_input>>: input,+ _FreeVariablesTestCase_output>>: output]++liftLambdaAboveLetTestCase :: TTerm Term -> TTerm Term -> TTerm LiftLambdaAboveLetTestCase+liftLambdaAboveLetTestCase input output = Phantoms.record _LiftLambdaAboveLetTestCase [+ _LiftLambdaAboveLetTestCase_input>>: input,+ _LiftLambdaAboveLetTestCase_output>>: output]++simplifyTermTestCase :: TTerm Term -> TTerm Term -> TTerm SimplifyTermTestCase+simplifyTermTestCase input output = Phantoms.record _SimplifyTermTestCase [+ _SimplifyTermTestCase_input>>: input,+ _SimplifyTermTestCase_output>>: output]++-- | Convenience function for creating flatten let terms test cases+flattenCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+flattenCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseFlattenLetTerms $ flattenLetTermsTestCase input output)+ nothing noTags++-- | Convenience function for creating free variables test cases+freeVarsCase :: String -> TTerm Term -> TTerm (S.Set Name) -> TTerm TestCaseWithMetadata+freeVarsCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseFreeVariables $ freeVariablesTestCase input output)+ nothing noTags++-- | Convenience function for creating lift lambda above let test cases+liftLambdaCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+liftLambdaCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseLiftLambdaAboveLet $ liftLambdaAboveLetTestCase input output)+ nothing noTags++-- | Convenience function for creating simplify term test cases+simplifyCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+simplifyCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseSimplifyTerm $ simplifyTermTestCase input output)+ nothing noTags++----------------------------------------+-- Deannotate test case helpers++testCaseDeannotateTerm :: TTerm DeannotateTermTestCase -> TTerm TestCase+testCaseDeannotateTerm = inject _TestCase _TestCase_deannotateTerm++testCaseDeannotateType :: TTerm DeannotateTypeTestCase -> TTerm TestCase+testCaseDeannotateType = inject _TestCase _TestCase_deannotateType++deannotateTermTestCase :: TTerm Term -> TTerm Term -> TTerm DeannotateTermTestCase+deannotateTermTestCase input output = Phantoms.record _DeannotateTermTestCase [+ _DeannotateTermTestCase_input>>: input,+ _DeannotateTermTestCase_output>>: output]++deannotateTypeTestCase :: TTerm Type -> TTerm Type -> TTerm DeannotateTypeTestCase+deannotateTypeTestCase input output = Phantoms.record _DeannotateTypeTestCase [+ _DeannotateTypeTestCase_input>>: input,+ _DeannotateTypeTestCase_output>>: output]++-- | Convenience function for creating deannotate term test cases+deannotateTermCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+deannotateTermCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseDeannotateTerm $ deannotateTermTestCase input output)+ nothing noTags++-- | Convenience function for creating deannotate type test cases+deannotateTypeCase :: String -> TTerm Type -> TTerm Type -> TTerm TestCaseWithMetadata+deannotateTypeCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseDeannotateType $ deannotateTypeTestCase input output)+ nothing noTags++----------------------------------------+-- Topological sort bindings test case helpers++testCaseTopologicalSortBindings :: TTerm TopologicalSortBindingsTestCase -> TTerm TestCase+testCaseTopologicalSortBindings = inject _TestCase _TestCase_topologicalSortBindings++topologicalSortBindingsTestCase :: TTerm [(Name, Term)] -> TTerm [[(Name, Term)]] -> TTerm TopologicalSortBindingsTestCase+topologicalSortBindingsTestCase bindings expected = Phantoms.record _TopologicalSortBindingsTestCase [+ _TopologicalSortBindingsTestCase_bindings>>: bindings,+ _TopologicalSortBindingsTestCase_expected>>: expected]++-- | Convenience function for creating topological sort bindings test cases+sortBindingsCase :: String -> TTerm [(Name, Term)] -> TTerm [[(Name, Term)]] -> TTerm TestCaseWithMetadata+sortBindingsCase cname bindings expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseTopologicalSortBindings $ topologicalSortBindingsTestCase bindings expected)+ nothing noTags++----------------------------------------+-- Normalize type variables test case helpers++testCaseNormalizeTypeVariables :: TTerm NormalizeTypeVariablesTestCase -> TTerm TestCase+testCaseNormalizeTypeVariables = inject _TestCase _TestCase_normalizeTypeVariables++normalizeTypeVariablesTestCase :: TTerm Term -> TTerm Term -> TTerm NormalizeTypeVariablesTestCase+normalizeTypeVariablesTestCase input output = Phantoms.record _NormalizeTypeVariablesTestCase [+ _NormalizeTypeVariablesTestCase_input>>: input,+ _NormalizeTypeVariablesTestCase_output>>: output]++-- | Convenience function for creating normalize type variables test cases+normalizeTypeVarsCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+normalizeTypeVarsCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseNormalizeTypeVariables $ normalizeTypeVariablesTestCase input output)+ nothing noTags++----------------------------------------+-- Fold over term test case helpers++testCaseFoldOverTerm :: TTerm FoldOverTermTestCase -> TTerm TestCase+testCaseFoldOverTerm = inject _TestCase _TestCase_foldOverTerm++foldOverTermTestCase :: TTerm Term -> TTerm TraversalOrder -> TTerm FoldOperation -> TTerm Term -> TTerm FoldOverTermTestCase+foldOverTermTestCase input order op output = Phantoms.record _FoldOverTermTestCase [+ _FoldOverTermTestCase_input>>: input,+ _FoldOverTermTestCase_traversalOrder>>: order,+ _FoldOverTermTestCase_operation>>: op,+ _FoldOverTermTestCase_output>>: output]++-- Fold operation constructors+foldOpSumInt32Literals :: TTerm FoldOperation+foldOpSumInt32Literals = inject _FoldOperation _FoldOperation_sumInt32Literals $ Phantoms.unit++foldOpCollectListLengths :: TTerm FoldOperation+foldOpCollectListLengths = inject _FoldOperation _FoldOperation_collectListLengths $ Phantoms.unit++foldOpCollectLabels :: TTerm FoldOperation+foldOpCollectLabels = inject _FoldOperation _FoldOperation_collectLabels $ Phantoms.unit++-- | Convenience function for creating fold over term test cases+foldOverTermCase :: String -> TTerm Term -> TTerm TraversalOrder -> TTerm FoldOperation -> TTerm Term -> TTerm TestCaseWithMetadata+foldOverTermCase cname input order op output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseFoldOverTerm $ foldOverTermTestCase input order op output)+ nothing noTags++----------------------------------------+-- Rewrite term test case helpers++testCaseRewriteTerm :: TTerm RewriteTermTestCase -> TTerm TestCase+testCaseRewriteTerm = inject _TestCase _TestCase_rewriteTerm++rewriteTermTestCase :: TTerm Term -> TTerm TermRewriter -> TTerm Term -> TTerm RewriteTermTestCase+rewriteTermTestCase input rewriter output = Phantoms.record _RewriteTermTestCase [+ _RewriteTermTestCase_input>>: input,+ _RewriteTermTestCase_rewriter>>: rewriter,+ _RewriteTermTestCase_output>>: output]++-- Term rewriter constructors+termRewriterReplaceFooWithBar :: TTerm TermRewriter+termRewriterReplaceFooWithBar = inject _TermRewriter _TermRewriter_replaceFooWithBar $ Phantoms.unit++termRewriterReplaceInt32WithInt64 :: TTerm TermRewriter+termRewriterReplaceInt32WithInt64 = inject _TermRewriter _TermRewriter_replaceInt32WithInt64 $ Phantoms.unit++-- | Convenience function for creating rewrite term test cases (replaceFooWithBar)+rewriteTermCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+rewriteTermCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseRewriteTerm $ rewriteTermTestCase input termRewriterReplaceFooWithBar output)+ nothing noTags++----------------------------------------+-- Rewrite type test case helpers++testCaseRewriteType :: TTerm RewriteTypeTestCase -> TTerm TestCase+testCaseRewriteType = inject _TestCase _TestCase_rewriteType++rewriteTypeTestCase :: TTerm Type -> TTerm TypeRewriter -> TTerm Type -> TTerm RewriteTypeTestCase+rewriteTypeTestCase input rewriter output = Phantoms.record _RewriteTypeTestCase [+ _RewriteTypeTestCase_input>>: input,+ _RewriteTypeTestCase_rewriter>>: rewriter,+ _RewriteTypeTestCase_output>>: output]++-- Type rewriter constructors+typeRewriterReplaceStringWithInt32 :: TTerm TypeRewriter+typeRewriterReplaceStringWithInt32 = inject _TypeRewriter _TypeRewriter_replaceStringWithInt32 $ Phantoms.unit++-- | Convenience function for creating rewrite type test cases (replaceStringWithInt32)+rewriteTypeCase :: String -> TTerm Type -> TTerm Type -> TTerm TestCaseWithMetadata+rewriteTypeCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseRewriteType $ rewriteTypeTestCase input typeRewriterReplaceStringWithInt32 output)+ nothing noTags++-- | Convenience function for creating eta expansion test cases+etaCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+etaCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseEtaExpansion $ etaExpansionTestCase input output)+ nothing noTags++----------------------------------------+-- Hoist subterms test case helpers++testCaseHoistSubterms :: TTerm HoistSubtermsTestCase -> TTerm TestCase+testCaseHoistSubterms = inject _TestCase _TestCase_hoistSubterms++hoistSubtermsTestCase :: TTerm HoistPredicate -> TTerm Term -> TTerm Term -> TTerm HoistSubtermsTestCase+hoistSubtermsTestCase predicate input output = Phantoms.record _HoistSubtermsTestCase [+ _HoistSubtermsTestCase_predicate>>: predicate,+ _HoistSubtermsTestCase_input>>: input,+ _HoistSubtermsTestCase_output>>: output]++-- Hoist predicate constructors++-- | Hoist case statements (elimination unions) at non-top-level positions+hoistPredicateCaseStatements :: TTerm HoistPredicate+hoistPredicateCaseStatements = inject _HoistPredicate _HoistPredicate_caseStatements $ Phantoms.unit++-- | Hoist function applications at non-top-level positions+hoistPredicateApplications :: TTerm HoistPredicate+hoistPredicateApplications = inject _HoistPredicate _HoistPredicate_applications $ Phantoms.unit++-- | Hoist list terms at non-top-level positions+hoistPredicateLists :: TTerm HoistPredicate+hoistPredicateLists = inject _HoistPredicate _HoistPredicate_lists $ Phantoms.unit++-- | Never hoist anything (identity transformation)+hoistPredicateNothing :: TTerm HoistPredicate+hoistPredicateNothing = inject _HoistPredicate _HoistPredicate_nothing $ Phantoms.unit++-- | Convenience function for creating hoist subterms test cases+hoistCase :: String -> TTerm HoistPredicate -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+hoistCase cname predicate input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseHoistSubterms $ hoistSubtermsTestCase predicate input output)+ nothing noTags++----------------------------------------+-- Hoist case statements test case helpers++testCaseHoistCaseStatements :: TTerm HoistCaseStatementsTestCase -> TTerm TestCase+testCaseHoistCaseStatements = inject _TestCase _TestCase_hoistCaseStatements++hoistCaseStatementsTestCase :: TTerm Term -> TTerm Term -> TTerm HoistCaseStatementsTestCase+hoistCaseStatementsTestCase input output = Phantoms.record _HoistCaseStatementsTestCase [+ _HoistCaseStatementsTestCase_input>>: input,+ _HoistCaseStatementsTestCase_output>>: output]++-- | Convenience function for creating hoist case statements test cases+hoistCaseStatementsCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+hoistCaseStatementsCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseHoistCaseStatements $ hoistCaseStatementsTestCase input output)+ nothing noTags++-----------------------------------------+-- Hoist let bindings test case helpers (hoistAll=True, for Java)++testCaseHoistLetBindings :: TTerm HoistLetBindingsTestCase -> TTerm TestCase+testCaseHoistLetBindings = inject _TestCase _TestCase_hoistLetBindings++hoistLetBindingsTestCase :: TTerm Let -> TTerm Let -> TTerm HoistLetBindingsTestCase+hoistLetBindingsTestCase input output = Phantoms.record _HoistLetBindingsTestCase [+ _HoistLetBindingsTestCase_input>>: input,+ _HoistLetBindingsTestCase_output>>: output]++-- | Convenience function for creating hoist let bindings test cases+hoistLetBindingsCase :: String -> TTerm Let -> TTerm Let -> TTerm TestCaseWithMetadata+hoistLetBindingsCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseHoistLetBindings $ hoistLetBindingsTestCase input output)+ nothing noTags++-----------------------------------------+-- Hoist polymorphic let bindings test case helpers++testCaseHoistPolymorphicLetBindings :: TTerm HoistPolymorphicLetBindingsTestCase -> TTerm TestCase+testCaseHoistPolymorphicLetBindings = inject _TestCase _TestCase_hoistPolymorphicLetBindings++hoistPolymorphicLetBindingsTestCase :: TTerm Let -> TTerm Let -> TTerm HoistPolymorphicLetBindingsTestCase+hoistPolymorphicLetBindingsTestCase input output = Phantoms.record _HoistPolymorphicLetBindingsTestCase [+ _HoistPolymorphicLetBindingsTestCase_input>>: input,+ _HoistPolymorphicLetBindingsTestCase_output>>: output]++-- | Convenience function for creating hoist polymorphic let bindings test cases+hoistPolymorphicLetBindingsCase :: String -> TTerm Let -> TTerm Let -> TTerm TestCaseWithMetadata+hoistPolymorphicLetBindingsCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseHoistPolymorphicLetBindings $ hoistPolymorphicLetBindingsTestCase input output)+ nothing noTags++----------------------------------------+-- Type substitution test case helpers++testCaseSubstInType :: TTerm SubstInTypeTestCase -> TTerm TestCase+testCaseSubstInType = inject _TestCase _TestCase_substInType++substInTypeTestCase :: TTerm [(Name, Type)] -> TTerm Type -> TTerm Type -> TTerm SubstInTypeTestCase+substInTypeTestCase subst input output = Phantoms.record _SubstInTypeTestCase [+ _SubstInTypeTestCase_substitution>>: subst,+ _SubstInTypeTestCase_input>>: input,+ _SubstInTypeTestCase_output>>: output]++-- | Convenience function for creating type substitution test cases+substInTypeCase :: String -> TTerm [(Name, Type)] -> TTerm Type -> TTerm Type -> TTerm TestCaseWithMetadata+substInTypeCase cname subst input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseSubstInType $ substInTypeTestCase subst input output)+ nothing noTags++----------------------------------------+-- Variable occurs in type test case helpers++testCaseVariableOccursInType :: TTerm VariableOccursInTypeTestCase -> TTerm TestCase+testCaseVariableOccursInType = inject _TestCase _TestCase_variableOccursInType++variableOccursInTypeTestCase :: TTerm Name -> TTerm Type -> TTerm Bool -> TTerm VariableOccursInTypeTestCase+variableOccursInTypeTestCase variable typ expected = Phantoms.record _VariableOccursInTypeTestCase [+ _VariableOccursInTypeTestCase_variable>>: variable,+ _VariableOccursInTypeTestCase_type>>: typ,+ _VariableOccursInTypeTestCase_expected>>: expected]++-- | Convenience function for creating variable occurs in type test cases+variableOccursCase :: String -> TTerm Name -> TTerm Type -> TTerm Bool -> TTerm TestCaseWithMetadata+variableOccursCase cname variable typ expected = testCaseWithMetadata (Phantoms.string cname)+ (testCaseVariableOccursInType $ variableOccursInTypeTestCase variable typ expected)+ nothing noTags++----------------------------------------+-- Unify types test case helpers++testCaseUnifyTypes :: TTerm UnifyTypesTestCase -> TTerm TestCase+testCaseUnifyTypes = inject _TestCase _TestCase_unifyTypes++unifyTypesTestCase :: TTerm [Name] -> TTerm Type -> TTerm Type -> TTerm (Either String TypeSubst) -> TTerm UnifyTypesTestCase+unifyTypesTestCase schemaTypes left right expected = Phantoms.record _UnifyTypesTestCase [+ _UnifyTypesTestCase_schemaTypes>>: schemaTypes,+ _UnifyTypesTestCase_left>>: left,+ _UnifyTypesTestCase_right>>: right,+ _UnifyTypesTestCase_expected>>: expected]++-- | Convenience function for creating unify types test cases (expecting success)+-- The substitution is provided as a list of (name, type) pairs+unifyTypesCase :: String -> TTerm [Name] -> TTerm Type -> TTerm Type -> [(TTerm Name, TTerm Type)] -> TTerm TestCaseWithMetadata+unifyTypesCase cname schemaTypes left right substPairs = testCaseWithMetadata (Phantoms.string cname)+ (testCaseUnifyTypes $ unifyTypesTestCase schemaTypes left right (Phantoms.right (Phantoms.wrap _TypeSubst (Phantoms.map (M.fromList substPairs)))))+ nothing noTags++-- | Convenience function for creating unify types test cases (expecting failure)+unifyTypesFailCase :: String -> TTerm [Name] -> TTerm Type -> TTerm Type -> String -> TTerm TestCaseWithMetadata+unifyTypesFailCase cname schemaTypes left right errSubstring = testCaseWithMetadata (Phantoms.string cname)+ (testCaseUnifyTypes $ unifyTypesTestCase schemaTypes left right (Phantoms.left (Phantoms.string errSubstring)))+ nothing noTags++----------------------------------------+-- Join types test case helpers++testCaseJoinTypes :: TTerm JoinTypesTestCase -> TTerm TestCase+testCaseJoinTypes = inject _TestCase _TestCase_joinTypes++joinTypesTestCase :: TTerm Type -> TTerm Type -> TTerm (Either () [TypeConstraint]) -> TTerm JoinTypesTestCase+joinTypesTestCase left right expected = Phantoms.record _JoinTypesTestCase [+ _JoinTypesTestCase_left>>: left,+ _JoinTypesTestCase_right>>: right,+ _JoinTypesTestCase_expected>>: expected]++-- | Convenience function for creating join types test cases (expecting success)+joinTypesCase :: String -> TTerm Type -> TTerm Type -> TTerm [TypeConstraint] -> TTerm TestCaseWithMetadata+joinTypesCase cname left right constraints = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJoinTypes $ joinTypesTestCase left right (Phantoms.right constraints))+ nothing noTags++-- | Convenience function for creating join types test cases (expecting failure)+joinTypesFailCase :: String -> TTerm Type -> TTerm Type -> TTerm TestCaseWithMetadata+joinTypesFailCase cname left right = testCaseWithMetadata (Phantoms.string cname)+ (testCaseJoinTypes $ joinTypesTestCase left right (Phantoms.left Phantoms.unit))+ nothing noTags++----------------------------------------+-- Unshadow variables test case helpers++testCaseUnshadowVariables :: TTerm UnshadowVariablesTestCase -> TTerm TestCase+testCaseUnshadowVariables = inject _TestCase _TestCase_unshadowVariables++unshadowVariablesTestCase :: TTerm Term -> TTerm Term -> TTerm UnshadowVariablesTestCase+unshadowVariablesTestCase input output = Phantoms.record _UnshadowVariablesTestCase [+ _UnshadowVariablesTestCase_input>>: input,+ _UnshadowVariablesTestCase_output>>: output]++-- | Convenience function for creating unshadow variables test cases+unshadowCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+unshadowCase cname input output = testCaseWithMetadata (Phantoms.string cname)+ (testCaseUnshadowVariables $ unshadowVariablesTestCase input output)+ nothing noTags
+ src/main/haskell/Hydra/Dsl/Meta/Topology.hs view
@@ -0,0 +1,105 @@+-- | Meta-DSL for constructing topology-related terms (type and term accessors)++module Hydra.Dsl.Meta.Topology where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Topology as Topology++import qualified Data.Map as M+import qualified Data.Set as S+++orderingIsomorphism :: TTerm ([a] -> [a])+ -> TTerm ([a] -> [a])+ -> TTerm (Topology.OrderingIsomorphism a)+orderingIsomorphism encode decode = record _OrderingIsomorphism [+ _OrderingIsomorphism_encode>>: encode,+ _OrderingIsomorphism_decode>>: decode]++tarjanState :: TTerm Int+ -> TTerm (M.Map Vertex Int)+ -> TTerm (M.Map Vertex Int)+ -> TTerm [Vertex]+ -> TTerm (S.Set Vertex)+ -> TTerm [[Vertex]]+ -> TTerm TarjanState+tarjanState counter indices lowLinks stack onStack sccs = record _TarjanState [+ _TarjanState_counter>>: counter,+ _TarjanState_indices>>: indices,+ _TarjanState_lowLinks>>: lowLinks,+ _TarjanState_stack>>: stack,+ _TarjanState_onStack>>: onStack,+ _TarjanState_sccs>>: sccs]++tarjanStateCounter :: TTerm TarjanState -> TTerm Int+tarjanStateCounter ts = project _TarjanState _TarjanState_counter @@ ts++tarjanStateIndices :: TTerm TarjanState -> TTerm (M.Map Vertex Int)+tarjanStateIndices ts = project _TarjanState _TarjanState_indices @@ ts++tarjanStateLowLinks :: TTerm TarjanState -> TTerm (M.Map Vertex Int)+tarjanStateLowLinks ts = project _TarjanState _TarjanState_lowLinks @@ ts++tarjanStateStack :: TTerm TarjanState -> TTerm [Vertex]+tarjanStateStack ts = project _TarjanState _TarjanState_stack @@ ts++tarjanStateOnStack :: TTerm TarjanState -> TTerm (S.Set Vertex)+tarjanStateOnStack ts = project _TarjanState _TarjanState_onStack @@ ts++tarjanStateSccs :: TTerm TarjanState -> TTerm [[Vertex]]+tarjanStateSccs ts = project _TarjanState _TarjanState_sccs @@ ts++tarjanStateWithCounter :: TTerm TarjanState -> TTerm Int -> TTerm TarjanState+tarjanStateWithCounter ts counter = tarjanState+ counter+ (Hydra.Dsl.Meta.Topology.tarjanStateIndices ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateLowLinks ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateOnStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateSccs ts)++tarjanStateWithIndices :: TTerm TarjanState -> TTerm (M.Map Vertex Int) -> TTerm TarjanState+tarjanStateWithIndices ts indices = tarjanState+ (Hydra.Dsl.Meta.Topology.tarjanStateCounter ts)+ indices+ (Hydra.Dsl.Meta.Topology.tarjanStateLowLinks ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateOnStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateSccs ts)++tarjanStateWithLowLinks :: TTerm TarjanState -> TTerm (M.Map Vertex Int) -> TTerm TarjanState+tarjanStateWithLowLinks ts lowLinks = tarjanState+ (Hydra.Dsl.Meta.Topology.tarjanStateCounter ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateIndices ts)+ lowLinks+ (Hydra.Dsl.Meta.Topology.tarjanStateStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateOnStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateSccs ts)++tarjanStateWithStack :: TTerm TarjanState -> TTerm [Vertex] -> TTerm TarjanState+tarjanStateWithStack ts stack = tarjanState+ (Hydra.Dsl.Meta.Topology.tarjanStateCounter ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateIndices ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateLowLinks ts)+ stack+ (Hydra.Dsl.Meta.Topology.tarjanStateOnStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateSccs ts)++tarjanStateWithOnStack :: TTerm TarjanState -> TTerm (S.Set Vertex) -> TTerm TarjanState+tarjanStateWithOnStack ts onStack = tarjanState+ (Hydra.Dsl.Meta.Topology.tarjanStateCounter ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateIndices ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateLowLinks ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateStack ts)+ onStack+ (Hydra.Dsl.Meta.Topology.tarjanStateSccs ts)++tarjanStateWithSccs :: TTerm TarjanState -> TTerm [[Vertex]] -> TTerm TarjanState+tarjanStateWithSccs ts sccs = tarjanState+ (Hydra.Dsl.Meta.Topology.tarjanStateCounter ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateIndices ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateLowLinks ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateStack ts)+ (Hydra.Dsl.Meta.Topology.tarjanStateOnStack ts)+ sccs
+ src/main/haskell/Hydra/Dsl/Meta/Types.hs view
@@ -0,0 +1,282 @@+-- | A domain-specific language for constructing term-encoded Hydra types in Haskell;+-- these functions enable you to build terms (programs) which build types.++{-# LANGUAGE FlexibleContexts #-}++module Hydra.Dsl.Meta.Types (+ module Hydra.Dsl.Meta.Base,+ module Hydra.Dsl.Meta.Types,+) where++import Hydra.Kernel+import Hydra.Dsl.AsTerm+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import Hydra.Dsl.Meta.Core as Core hiding (name, unName)+import Hydra.Dsl.Meta.Base++import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Maybe as Y+import Prelude hiding (either, map, maybe, product, sum)+++-- Operators++-- | Type application operator+-- Example: typeConstructor @@ typeArg+(@@) :: TTerm Type -> TTerm Type -> TTerm Type+(@@) = apply++-- | Function type constructor operator+-- Example: int32 --> string+(-->) :: TTerm Type -> TTerm Type -> TTerm Type+(-->) = function+++-- | Apply a term-encoded type to a type argument+-- Example: apply (var "Maybe") int32+apply :: TTerm Type -> TTerm Type -> TTerm Type+apply l r = typeApplication $ applicationType l r++applys :: TTerm Type -> [TTerm Type] -> TTerm Type+applys t ts = L.foldl apply t ts++-- | Create a term-encoded binary type+-- Example: binary+binary :: TTerm Type+binary = typeLiteral literalTypeBinary++-- | Create a term-encoded boolean type+-- Example: boolean+boolean :: TTerm Type+boolean = typeLiteral literalTypeBoolean++-- | Create a term-encoded field with the given name and type+-- Example: field "age" int32+field :: String -> TTerm Type -> TTerm FieldType+field s = fieldType (name s)++-- | Create a term-encoded FloatType representation+-- Example: float FloatTypeFloat64+float :: FloatType -> TTerm FloatType+float t = Phantoms.injectUnit _FloatType $ case t of+ FloatTypeBigfloat -> _FloatType_bigfloat+ FloatTypeFloat32 -> _FloatType_float32+ FloatTypeFloat64 -> _FloatType_float64++-- | Create a term-encoded 32-bit floating point type+-- Example: float32+float32 :: TTerm Type+float32 = typeLiteral $ literalTypeFloat $ float FloatTypeFloat32++-- | Create a term-encoded 64-bit floating point type+-- Example: float64+float64 :: TTerm Type+float64 = typeLiteral $ literalTypeFloat $ float FloatTypeFloat64++-- | Create a term-encoded arbitrary-precision floating point type+-- Example: bigfloat+bigfloat :: TTerm Type+bigfloat = typeLiteral $ literalTypeFloat $ float FloatTypeBigfloat++-- | Create a term-encoded either type+-- Example: either_ string int32+either_ :: TTerm Type -> TTerm Type -> TTerm Type+either_ l r = typeEither $ eitherType l r++-- | Create a term-encoded universal quantification (polymorphic type)+-- Example: forAll "a" (var "a" --> var "a")+forAll :: String -> TTerm Type -> TTerm Type+forAll var body = typeForall $ forallType (name var) body++forAlls :: [String] -> TTerm Type -> TTerm Type+forAlls vs body = L.foldr forAll body vs++-- | Create a term-encoded function type+-- Example: function int32 string+function :: TTerm Type -> TTerm Type -> TTerm Type+function dom cod = typeFunction $ functionType dom cod++-- | Create a term-encoded multi-parameter function type+-- Example: functionMany [int32, string, boolean]+functionMany :: [TTerm Type] -> TTerm Type+functionMany types = case types of+ [t] -> t+ t:ts -> function t $ functionMany ts++-- | Create a term-encoded arbitrary-precision integer type+-- Example: bigint+bigint :: TTerm Type+bigint = typeLiteral $ literalTypeInteger integerTypeBigint++-- | Create a term-encoded 8-bit signed integer type+-- Example: int8+int8 :: TTerm Type+int8 = typeLiteral $ literalTypeInteger integerTypeInt8++-- | Create a term-encoded 16-bit signed integer type+-- Example: int16+int16 :: TTerm Type+int16 = typeLiteral $ literalTypeInteger integerTypeInt16++-- | Create a term-encoded 32-bit signed integer type+-- Example: int32+int32 :: TTerm Type+int32 = typeLiteral $ literalTypeInteger integerTypeInt32++-- | Create a term-encoded 64-bit signed integer type+-- Example: int64+int64 :: TTerm Type+int64 = typeLiteral $ literalTypeInteger integerTypeInt64++-- | Create a term-encoded IntegerType representation+-- Example: integer IntegerTypeInt32+integer :: IntegerType -> TTerm IntegerType+integer t = Phantoms.injectUnit _IntegerType $ case t of+ IntegerTypeBigint -> _IntegerType_bigint+ IntegerTypeInt8 -> _IntegerType_int8+ IntegerTypeInt16 -> _IntegerType_int16+ IntegerTypeInt32 -> _IntegerType_int32+ IntegerTypeInt64 -> _IntegerType_int64+ IntegerTypeUint8 -> _IntegerType_uint8+ IntegerTypeUint16 -> _IntegerType_uint16+ IntegerTypeUint32 -> _IntegerType_uint32+ IntegerTypeUint64 -> _IntegerType_uint64++-- | Create a term-encoded list type+-- Example: list string+list :: TTerm Type -> TTerm Type+list = typeList++-- | Create a term-encoded literal type from a LiteralType value+-- Example: literal (literalTypeInteger integerTypeInt32)+literal :: TTerm LiteralType -> TTerm Type+literal = typeLiteral++-- | Create a term-encoded map/dictionary type+-- Example: map string int32+map :: TTerm Type -> TTerm Type -> TTerm Type+map k v = typeMap $ mapType k v++-- | Create a term-encoded monomorphic type scheme+-- Example: mono int32+mono :: TTerm Type -> TTerm TypeScheme+mono t = Phantoms.record _TypeScheme [+ Phantoms.field _TypeScheme_variables $ Phantoms.list ([] :: [TTerm Name]),+ Phantoms.field _TypeScheme_type t,+ Phantoms.field _TypeScheme_constraints Phantoms.nothing]++-- | Create a term-encoded maybe (optional/nullable) type+-- Example: maybe string+maybe :: TTerm Type -> TTerm Type+maybe = typeMaybe++-- | Create a term-encoded optional (nullable) type (alias for 'maybe')+-- Example: optional string+optional :: TTerm Type -> TTerm Type+optional = maybe++-- | Create a term-encoded pair type+-- Example: pair string int32+pair :: TTerm Type -> TTerm Type -> TTerm Type+pair first second = Core.typePair $ Core.pairType first second++-- | Create a term-encoded polymorphic type scheme+-- Example: poly ["a", "b"] (var "a" --> var "b")+poly :: [String] -> TTerm Type -> TTerm TypeScheme+poly params t = Phantoms.record _TypeScheme [+ Phantoms.field _TypeScheme_variables (Phantoms.list (name <$> params)),+ Phantoms.field _TypeScheme_type t,+ Phantoms.field _TypeScheme_constraints Phantoms.nothing]++-- | Create a term-encoded product type (tuple) with multiple components using nested pairs+-- Example: product [string, int32, boolean]+product :: [TTerm Type] -> TTerm Type+product [] = unit+product [a] = a+product [a, b] = pair a b+product (a:rest) = pair a (product rest)++-- | Create a term-encoded record type with named fields+-- Example: record (name "Person") ["name">: string, "age">: int32]+-- Accepts TTerm Name or TBinding Name (via AsTerm)+record :: AsTerm t Name => t -> [(TTerm Name, TTerm Type)] -> TTerm Type+record n pairs = typeRecord $ rowType (asTerm n) $ Phantoms.list (toField <$> pairs)+ where+ toField (fn, t) = fieldType fn t++-- | Create a term-encoded set type+-- Example: set string+set :: TTerm Type -> TTerm Type+set = typeSet++-- | Create a term-encoded string type+-- Example: string+string :: TTerm Type+string = typeLiteral literalTypeString++-- | Create a term-encoded 8-bit unsigned integer type+-- Example: uint8+uint8 :: TTerm Type+uint8 = typeLiteral $ literalTypeInteger integerTypeUint8++-- | Create a term-encoded 16-bit unsigned integer type+-- Example: uint16+uint16 :: TTerm Type+uint16 = typeLiteral $ literalTypeInteger integerTypeUint16++-- | Create a term-encoded 32-bit unsigned integer type+-- Example: uint32+uint32 :: TTerm Type+uint32 = typeLiteral $ literalTypeInteger integerTypeUint32++-- | Create a term-encoded 64-bit unsigned integer type+-- Example: uint64+uint64 :: TTerm Type+uint64 = typeLiteral $ literalTypeInteger integerTypeUint64++-- | Create a term-encoded union type with named variants+-- Example: union (name "Result") ["success">: int32, "error">: string]+-- Accepts TTerm Name or TBinding Name (via AsTerm)+union :: AsTerm t Name => t -> [(TTerm Name, TTerm Type)] -> TTerm Type+union n pairs = typeUnion $ rowType (asTerm n) $ Phantoms.list (toField <$> pairs)+ where+ toField (fn, ft) = fieldType fn ft++-- | Term-encoded unit type (empty record type)+-- Example: unit+unit :: TTerm Type+unit = typeUnit++-- | Create a term-encoded type variable+-- Example: variable "a"+variable :: String -> TTerm Type+variable = typeVariable . name++-- | Create a term-encoded type variable (alias for 'variable')+-- Example: var "a"+var :: String -> TTerm Type+var = variable++-- | Create a term-encoded wrapped type (newtype)+-- Accepts TTerm Name or TBinding Name (via AsTerm)+wrap :: AsTerm t Name => t -> TTerm Type -> TTerm Type+wrap n t = typeWrap $ wrappedType (asTerm n) t++-- | Create a term-encoded enum type with the given variant names (conventionally in camelCase)+-- Example: enum (name "Color") ["red", "green", "blue"]+-- Accepts TTerm Name or TBinding Name (via AsTerm)+enum :: AsTerm t Name => t -> [String] -> TTerm Type+enum tname names = union tname $ (\n -> (name n, unit)) <$> names++-- | Term-encoded non-negative 32-bit integer type+-- Currently an alias for int32; intended for semantic annotation+-- In future versions, this may include validation constraints+-- Example: nonNegativeInt32+nonNegativeInt32 :: TTerm Type+nonNegativeInt32 = Hydra.Dsl.Meta.Types.int32++-- | Attach an annotation to a term-encoded type+-- Example: annot annotationMap myType+annot :: TTerm (M.Map Name Term) -> TTerm Type -> TTerm Type+annot ann typ = typeAnnotated $ annotatedType typ ann
+ src/main/haskell/Hydra/Dsl/Meta/Typing.hs view
@@ -0,0 +1,180 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Meta-DSL for constructing typing-related terms (TypeScheme, TypeConstraints)++module Hydra.Dsl.Meta.Typing where++import Hydra.Kernel+import Hydra.Dsl.AsTerm+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Terms as Terms++import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+import Data.Int+import Prelude hiding (map, product, sum)+++inferenceContext+ :: TTerm (M.Map Name TypeScheme)+ -> TTerm (M.Map Name TypeScheme)+ -> TTerm (M.Map Name TypeScheme)+ -> TTerm (M.Map Name TypeVariableMetadata)+ -> TTerm Bool+ -> TTerm InferenceContext+inferenceContext schemaTypes primitiveTypes dataTypes classConstraints debug = Phantoms.record _InferenceContext [+ _InferenceContext_schemaTypes>>: schemaTypes,+ _InferenceContext_primitiveTypes>>: primitiveTypes,+ _InferenceContext_dataTypes>>: dataTypes,+ _InferenceContext_classConstraints>>: classConstraints,+ _InferenceContext_debug>>: debug]++inferenceContextSchemaTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)+inferenceContextSchemaTypes ic = Phantoms.project _InferenceContext _InferenceContext_schemaTypes @@ ic++inferenceContextPrimitiveTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)+inferenceContextPrimitiveTypes ic = Phantoms.project _InferenceContext _InferenceContext_primitiveTypes @@ ic++inferenceContextDataTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)+inferenceContextDataTypes ic = Phantoms.project _InferenceContext _InferenceContext_dataTypes @@ ic++inferenceContextClassConstraints :: TTerm InferenceContext -> TTerm (M.Map Name TypeVariableMetadata)+inferenceContextClassConstraints ic = Phantoms.project _InferenceContext _InferenceContext_classConstraints @@ ic++inferenceContextDebug :: TTerm InferenceContext -> TTerm Bool+inferenceContextDebug ic = Phantoms.project _InferenceContext _InferenceContext_debug @@ ic++inferenceContextWithDataTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme) -> TTerm InferenceContext+inferenceContextWithDataTypes ctx dataTypes = inferenceContext+ (Hydra.Dsl.Meta.Typing.inferenceContextSchemaTypes ctx)+ (Hydra.Dsl.Meta.Typing.inferenceContextPrimitiveTypes ctx)+ dataTypes+ (Hydra.Dsl.Meta.Typing.inferenceContextClassConstraints ctx)+ (Hydra.Dsl.Meta.Typing.inferenceContextDebug ctx)++inferenceContextWithClassConstraints :: TTerm InferenceContext -> TTerm (M.Map Name TypeVariableMetadata) -> TTerm InferenceContext+inferenceContextWithClassConstraints ctx classConstraints = inferenceContext+ (Hydra.Dsl.Meta.Typing.inferenceContextSchemaTypes ctx)+ (Hydra.Dsl.Meta.Typing.inferenceContextPrimitiveTypes ctx)+ (Hydra.Dsl.Meta.Typing.inferenceContextDataTypes ctx)+ classConstraints+ (Hydra.Dsl.Meta.Typing.inferenceContextDebug ctx)++inferenceResult :: AsTerm t TypeSubst => TTerm Term -> TTerm Type -> t -> TTerm (M.Map Name TypeVariableMetadata) -> TTerm InferenceResult+inferenceResult term type_ subst classConstraints = Phantoms.record _InferenceResult [+ _InferenceResult_term>>: term,+ _InferenceResult_type>>: type_,+ _InferenceResult_subst>>: asTerm subst,+ _InferenceResult_classConstraints>>: classConstraints]++inferenceResultTerm :: TTerm InferenceResult -> TTerm Term+inferenceResultTerm ir = Phantoms.project _InferenceResult _InferenceResult_term @@ ir++inferenceResultType :: TTerm InferenceResult -> TTerm Type+inferenceResultType ir = Phantoms.project _InferenceResult _InferenceResult_type @@ ir++inferenceResultSubst :: TTerm InferenceResult -> TTerm TypeSubst+inferenceResultSubst ir = Phantoms.project _InferenceResult _InferenceResult_subst @@ ir++inferenceResultClassConstraints :: TTerm InferenceResult -> TTerm (M.Map Name TypeVariableMetadata)+inferenceResultClassConstraints ir = Phantoms.project _InferenceResult _InferenceResult_classConstraints @@ ir++termSubst :: TTerm (M.Map Name Term) -> TTerm TermSubst+termSubst = Phantoms.wrap _TermSubst++typeConstraint :: TTerm Type -> TTerm Type -> TTerm String -> TTerm TypeConstraint+typeConstraint t1 t2 comment = Phantoms.record _TypeConstraint [+ _TypeConstraint_left>>: t1,+ _TypeConstraint_right>>: t2,+ _TypeConstraint_comment>>: comment]++typeConstraintLeft :: TTerm TypeConstraint -> TTerm Type+typeConstraintLeft tc = Phantoms.project _TypeConstraint _TypeConstraint_left @@ tc++typeConstraintRight :: TTerm TypeConstraint -> TTerm Type+typeConstraintRight tc = Phantoms.project _TypeConstraint _TypeConstraint_right @@ tc++typeConstraintComment :: TTerm TypeConstraint -> TTerm String+typeConstraintComment tc = Phantoms.project _TypeConstraint _TypeConstraint_comment @@ tc++typeContext :: TTerm (M.Map Name Type) -> TTerm (M.Map Name Term) -> TTerm (S.Set Name) -> TTerm (S.Set Name) -> TTerm (S.Set Name) -> TTerm InferenceContext -> TTerm TypeContext+typeContext types metadata typeVariables lambdaVariables letVariables inferenceContext = Phantoms.record _TypeContext [+ _TypeContext_types>>: types,+ _TypeContext_metadata>>: metadata,+ _TypeContext_typeVariables>>: typeVariables,+ _TypeContext_lambdaVariables>>: lambdaVariables,+ _TypeContext_letVariables>>: letVariables,+ _TypeContext_inferenceContext>>: inferenceContext]++typeContextTypes :: TTerm TypeContext -> TTerm (M.Map Name Type)+typeContextTypes tc = Phantoms.project _TypeContext _TypeContext_types @@ tc++typeContextMetadata :: TTerm TypeContext -> TTerm (M.Map Name Term)+typeContextMetadata tc = Phantoms.project _TypeContext _TypeContext_metadata @@ tc++typeContextTypeVariables :: TTerm TypeContext -> TTerm (S.Set Name)+typeContextTypeVariables tc = Phantoms.project _TypeContext _TypeContext_typeVariables @@ tc++typeContextLambdaVariables :: TTerm TypeContext -> TTerm (S.Set Name)+typeContextLambdaVariables tc = Phantoms.project _TypeContext _TypeContext_lambdaVariables @@ tc++typeContextLetVariables :: TTerm TypeContext -> TTerm (S.Set Name)+typeContextLetVariables tc = Phantoms.project _TypeContext _TypeContext_letVariables @@ tc++typeContextInferenceContext :: TTerm TypeContext -> TTerm InferenceContext+typeContextInferenceContext tc = Phantoms.project _TypeContext _TypeContext_inferenceContext @@ tc++typeContextWithTypes :: TTerm TypeContext -> TTerm (M.Map Name Type) -> TTerm TypeContext+typeContextWithTypes ctx types = typeContext+ types+ (Hydra.Dsl.Meta.Typing.typeContextMetadata ctx)+ (Hydra.Dsl.Meta.Typing.typeContextTypeVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLambdaVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLetVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextInferenceContext ctx)++typeContextWithMetadata :: TTerm TypeContext -> TTerm (M.Map Name Term) -> TTerm TypeContext+typeContextWithMetadata ctx metadata = typeContext+ (Hydra.Dsl.Meta.Typing.typeContextTypes ctx)+ metadata+ (Hydra.Dsl.Meta.Typing.typeContextTypeVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLambdaVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLetVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextInferenceContext ctx)++typeContextWithTypeVariables :: TTerm TypeContext -> TTerm (S.Set Name) -> TTerm TypeContext+typeContextWithTypeVariables ctx typeVariables = typeContext+ (Hydra.Dsl.Meta.Typing.typeContextTypes ctx)+ (Hydra.Dsl.Meta.Typing.typeContextMetadata ctx)+ typeVariables+ (Hydra.Dsl.Meta.Typing.typeContextLambdaVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLetVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextInferenceContext ctx)++typeContextWithLambdaVariables :: TTerm TypeContext -> TTerm (S.Set Name) -> TTerm TypeContext+typeContextWithLambdaVariables ctx lambdaVariables = typeContext+ (Hydra.Dsl.Meta.Typing.typeContextTypes ctx)+ (Hydra.Dsl.Meta.Typing.typeContextMetadata ctx)+ (Hydra.Dsl.Meta.Typing.typeContextTypeVariables ctx)+ lambdaVariables+ (Hydra.Dsl.Meta.Typing.typeContextLetVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextInferenceContext ctx)++typeContextWithLetVariables :: TTerm TypeContext -> TTerm (S.Set Name) -> TTerm TypeContext+typeContextWithLetVariables ctx letVariables = typeContext+ (Hydra.Dsl.Meta.Typing.typeContextTypes ctx)+ (Hydra.Dsl.Meta.Typing.typeContextMetadata ctx)+ (Hydra.Dsl.Meta.Typing.typeContextTypeVariables ctx)+ (Hydra.Dsl.Meta.Typing.typeContextLambdaVariables ctx)+ letVariables+ (Hydra.Dsl.Meta.Typing.typeContextInferenceContext ctx)++typeSubst :: TTerm (M.Map Name Type) -> TTerm TypeSubst+typeSubst = Phantoms.wrap _TypeSubst++unTermSubst :: TTerm TermSubst -> TTerm (M.Map Name Term)+unTermSubst ts = unwrap _TermSubst @@ ts++unTypeSubst :: TTerm TypeSubst -> TTerm (M.Map Name Type)+unTypeSubst ts = unwrap _TypeSubst @@ ts
+ src/main/haskell/Hydra/Dsl/Meta/Util.hs view
@@ -0,0 +1,28 @@+-- | Meta-DSL for constructing utility-related terms (CaseConvention, etc.)++module Hydra.Dsl.Meta.Util where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Util++import qualified Data.Map as M+import qualified Data.Maybe as Y+++caseConventionCamel = injectUnit _CaseConvention _CaseConvention_camel+caseConventionPascal = injectUnit _CaseConvention _CaseConvention_pascal+caseConventionLowerSnake = injectUnit _CaseConvention _CaseConvention_lowerSnake+caseConventionUpperSnake = injectUnit _CaseConvention _CaseConvention_upperSnake++decodingError :: TTerm String -> TTerm DecodingError+decodingError = wrap _DecodingError++unDecodingError :: TTerm (DecodingError -> String)+unDecodingError = unwrap _DecodingError++precisionArbitrary :: TTerm Precision+precisionArbitrary = injectUnit _Precision _Precision_arbitrary++precisionBits :: TTerm Int -> TTerm Precision+precisionBits = inject _Precision _Precision_bits
+ src/main/haskell/Hydra/Dsl/Meta/Variants.hs view
@@ -0,0 +1,206 @@+-- | Meta-DSL for constructing variant-related terms (field accessors, etc.)++module Hydra.Dsl.Meta.Variants where++import Hydra.Kernel+import Hydra.Dsl.Meta.Phantoms+import Hydra.Variants++import qualified Data.Map as M+import qualified Data.Maybe as Y+++eliminationVariant :: EliminationVariant -> TTerm EliminationVariant+eliminationVariant v = injectUnit _EliminationVariant $ case v of+ EliminationVariantRecord -> _EliminationVariant_record+ EliminationVariantUnion -> _EliminationVariant_union+ EliminationVariantWrap -> _EliminationVariant_wrap++eliminationVariantRecord :: TTerm EliminationVariant+eliminationVariantRecord = injectUnit _EliminationVariant _EliminationVariant_record++eliminationVariantUnion :: TTerm EliminationVariant+eliminationVariantUnion = injectUnit _EliminationVariant _EliminationVariant_union++eliminationVariantWrap :: TTerm EliminationVariant+eliminationVariantWrap = injectUnit _EliminationVariant _EliminationVariant_wrap++functionVariant :: FunctionVariant -> TTerm FunctionVariant+functionVariant v = injectUnit _FunctionVariant $ case v of+ FunctionVariantElimination -> _FunctionVariant_elimination+ FunctionVariantLambda -> _FunctionVariant_lambda+ FunctionVariantPrimitive -> _FunctionVariant_primitive++functionVariantElimination :: TTerm FunctionVariant+functionVariantElimination = injectUnit _FunctionVariant _FunctionVariant_elimination++functionVariantLambda :: TTerm FunctionVariant+functionVariantLambda = injectUnit _FunctionVariant _FunctionVariant_lambda++functionVariantPrimitive :: TTerm FunctionVariant+functionVariantPrimitive = injectUnit _FunctionVariant _FunctionVariant_primitive++literalVariant :: LiteralVariant -> TTerm LiteralVariant+literalVariant v = injectUnit _LiteralVariant $ case v of+ LiteralVariantBinary -> _LiteralVariant_binary+ LiteralVariantBoolean -> _LiteralVariant_boolean+ LiteralVariantFloat -> _LiteralVariant_float+ LiteralVariantInteger -> _LiteralVariant_integer+ LiteralVariantString -> _LiteralVariant_string++literalVariantBinary :: TTerm LiteralVariant+literalVariantBinary = injectUnit _LiteralVariant _LiteralVariant_binary++literalVariantBoolean :: TTerm LiteralVariant+literalVariantBoolean = injectUnit _LiteralVariant _LiteralVariant_boolean++literalVariantFloat :: TTerm LiteralVariant+literalVariantFloat = injectUnit _LiteralVariant _LiteralVariant_float++literalVariantInteger :: TTerm LiteralVariant+literalVariantInteger = injectUnit _LiteralVariant _LiteralVariant_integer++literalVariantString :: TTerm LiteralVariant+literalVariantString = injectUnit _LiteralVariant _LiteralVariant_string++termVariant :: TermVariant -> TTerm TermVariant+termVariant v = injectUnit _TermVariant $ case v of+ TermVariantAnnotated -> _TermVariant_annotated+ TermVariantApplication -> _TermVariant_application+ TermVariantEither -> _TermVariant_either+ TermVariantFunction -> _TermVariant_function+ TermVariantLet -> _TermVariant_let+ TermVariantList -> _TermVariant_list+ TermVariantLiteral -> _TermVariant_literal+ TermVariantMap -> _TermVariant_map+ TermVariantMaybe -> _TermVariant_maybe+ TermVariantPair -> _TermVariant_pair+ TermVariantRecord -> _TermVariant_record+ TermVariantSet -> _TermVariant_set+ TermVariantTypeLambda -> _TermVariant_typeLambda+ TermVariantTypeApplication -> _TermVariant_typeApplication+ TermVariantUnion -> _TermVariant_union+ TermVariantUnit -> _TermVariant_unit+ TermVariantVariable -> _TermVariant_variable+ TermVariantWrap -> _TermVariant_wrap++termVariantAnnotated :: TTerm TermVariant+termVariantAnnotated = injectUnit _TermVariant _TermVariant_annotated++termVariantApplication :: TTerm TermVariant+termVariantApplication = injectUnit _TermVariant _TermVariant_application++termVariantEither :: TTerm TermVariant+termVariantEither = injectUnit _TermVariant _TermVariant_either++termVariantFunction :: TTerm TermVariant+termVariantFunction = injectUnit _TermVariant _TermVariant_function++termVariantLet :: TTerm TermVariant+termVariantLet = injectUnit _TermVariant _TermVariant_let++termVariantList :: TTerm TermVariant+termVariantList = injectUnit _TermVariant _TermVariant_list++termVariantLiteral :: TTerm TermVariant+termVariantLiteral = injectUnit _TermVariant _TermVariant_literal++termVariantMap :: TTerm TermVariant+termVariantMap = injectUnit _TermVariant _TermVariant_map++termVariantMaybe :: TTerm TermVariant+termVariantMaybe = injectUnit _TermVariant _TermVariant_maybe++termVariantPair :: TTerm TermVariant+termVariantPair = injectUnit _TermVariant _TermVariant_pair++termVariantRecord :: TTerm TermVariant+termVariantRecord = injectUnit _TermVariant _TermVariant_record++termVariantSet :: TTerm TermVariant+termVariantSet = injectUnit _TermVariant _TermVariant_set++termVariantTypeLambda :: TTerm TermVariant+termVariantTypeLambda = injectUnit _TermVariant _TermVariant_typeLambda++termVariantTypeApplication :: TTerm TermVariant+termVariantTypeApplication = injectUnit _TermVariant _TermVariant_typeApplication++termVariantUnion :: TTerm TermVariant+termVariantUnion = injectUnit _TermVariant _TermVariant_union++termVariantUnit :: TTerm TermVariant+termVariantUnit = injectUnit _TermVariant _TermVariant_unit++termVariantVariable :: TTerm TermVariant+termVariantVariable = injectUnit _TermVariant _TermVariant_variable++termVariantWrap :: TTerm TermVariant+termVariantWrap = injectUnit _TermVariant _TermVariant_wrap++typeVariant :: TypeVariant -> TTerm TypeVariant+typeVariant v = injectUnit _TypeVariant $ case v of+ TypeVariantAnnotated -> _TypeVariant_annotated+ TypeVariantApplication -> _TypeVariant_application+ TypeVariantEither -> _TypeVariant_either+ TypeVariantFunction -> _TypeVariant_function+ TypeVariantForall -> _TypeVariant_forall+ TypeVariantList -> _TypeVariant_list+ TypeVariantLiteral -> _TypeVariant_literal+ TypeVariantMap -> _TypeVariant_map+ TypeVariantMaybe -> _TypeVariant_maybe+ TypeVariantPair -> _TypeVariant_pair+ TypeVariantRecord -> _TypeVariant_record+ TypeVariantSet -> _TypeVariant_set+ TypeVariantUnion -> _TypeVariant_union+ TypeVariantUnit -> _TypeVariant_unit+ TypeVariantVariable -> _TypeVariant_variable+ TypeVariantWrap -> _TypeVariant_wrap++typeVariantAnnotated :: TTerm TypeVariant+typeVariantAnnotated = injectUnit _TypeVariant _TypeVariant_annotated++typeVariantApplication :: TTerm TypeVariant+typeVariantApplication = injectUnit _TypeVariant _TypeVariant_application++typeVariantEither :: TTerm TypeVariant+typeVariantEither = injectUnit _TypeVariant _TypeVariant_either++typeVariantFunction :: TTerm TypeVariant+typeVariantFunction = injectUnit _TypeVariant _TypeVariant_function++typeVariantForall :: TTerm TypeVariant+typeVariantForall = injectUnit _TypeVariant _TypeVariant_forall++typeVariantList :: TTerm TypeVariant+typeVariantList = injectUnit _TypeVariant _TypeVariant_list++typeVariantLiteral :: TTerm TypeVariant+typeVariantLiteral = injectUnit _TypeVariant _TypeVariant_literal++typeVariantMap :: TTerm TypeVariant+typeVariantMap = injectUnit _TypeVariant _TypeVariant_map++typeVariantMaybe :: TTerm TypeVariant+typeVariantMaybe = injectUnit _TypeVariant _TypeVariant_maybe++typeVariantPair :: TTerm TypeVariant+typeVariantPair = injectUnit _TypeVariant _TypeVariant_pair++typeVariantRecord :: TTerm TypeVariant+typeVariantRecord = injectUnit _TypeVariant _TypeVariant_record++typeVariantSet :: TTerm TypeVariant+typeVariantSet = injectUnit _TypeVariant _TypeVariant_set++typeVariantUnion :: TTerm TypeVariant+typeVariantUnion = injectUnit _TypeVariant _TypeVariant_union++typeVariantUnit :: TTerm TypeVariant+typeVariantUnit = injectUnit _TypeVariant _TypeVariant_unit++typeVariantVariable :: TTerm TypeVariant+typeVariantVariable = injectUnit _TypeVariant _TypeVariant_variable++typeVariantWrap :: TTerm TypeVariant+typeVariantWrap = injectUnit _TypeVariant _TypeVariant_wrap
− src/main/haskell/Hydra/Dsl/Module.hs
@@ -1,93 +0,0 @@-module Hydra.Dsl.Module where--import Hydra.Kernel-import Hydra.Dsl.Phantoms--import qualified Data.Map as M---definitionTerm :: TTerm TermDefinition -> TTerm Definition-definitionTerm = variant _Definition _Definition_term--definitionType :: TTerm TypeDefinition -> TTerm Definition-definitionType = variant _Definition _Definition_type--module_ :: TTerm Namespace -> TTerm [Binding] -> TTerm [Module] -> TTerm [Module] -> TTerm (Maybe String) -> TTerm Module-module_ ns elems termDeps typeDeps desc = record _Module [- _Module_namespace>>: ns,- _Module_elements>>: elems,- _Module_termDependencies>>: termDeps,- _Module_typeDependencies>>: typeDeps,- _Module_description>>: desc]--moduleNamespace :: TTerm Module -> TTerm Namespace-moduleNamespace m = project _Module _Module_namespace @@ m--moduleElements :: TTerm Module -> TTerm [Binding]-moduleElements m = project _Module _Module_elements @@ m--moduleTermDependencies :: TTerm Module -> TTerm [Module]-moduleTermDependencies m = project _Module _Module_termDependencies @@ m--moduleTypeDependencies :: TTerm Module -> TTerm [Module]-moduleTypeDependencies m = project _Module _Module_typeDependencies @@ m--moduleDescription :: TTerm Module -> TTerm (Maybe String)-moduleDescription m = project _Module _Module_description @@ m--namespace :: TTerm String -> TTerm Namespace-namespace ns = wrap _Namespace ns--namespaces :: TTerm (Namespace, n) -> TTerm (M.Map Namespace n) -> TTerm (Namespaces n)-namespaces focus mapping = record _Namespaces [- _Namespaces_focus>>: focus,- _Namespaces_mapping>>: mapping]--namespacesFocus :: TTerm (Namespaces n) -> TTerm (Namespace, n)-namespacesFocus ns = project _Namespaces _Namespaces_focus @@ ns--namespacesMapping :: TTerm (Namespaces n) -> TTerm (M.Map Namespace n)-namespacesMapping ns = project _Namespaces _Namespaces_mapping @@ ns--qualifiedName :: TTerm (Maybe Namespace) -> TTerm String -> TTerm QualifiedName-qualifiedName ns local = record _QualifiedName [- _QualifiedName_namespace>>: ns,- _QualifiedName_local>>: local]--qualifiedNameLocal :: TTerm QualifiedName -> TTerm String-qualifiedNameLocal qn = project _QualifiedName _QualifiedName_local @@ qn--qualifiedNameNamespace :: TTerm QualifiedName -> TTerm (Maybe Namespace)-qualifiedNameNamespace qn = project _QualifiedName _QualifiedName_namespace @@ qn--termDefinition :: TTerm Name -> TTerm Term -> TTerm Type -> TTerm TermDefinition-termDefinition name term type_ = record _TermDefinition [- _TermDefinition_name>>: name,- _TermDefinition_term>>: term,- _TermDefinition_type>>: type_]--termDefinitionName :: TTerm TermDefinition -> TTerm Name-termDefinitionName td = project _TermDefinition _TermDefinition_name @@ td--termDefinitionTerm :: TTerm TermDefinition -> TTerm Term-termDefinitionTerm td = project _TermDefinition _TermDefinition_term @@ td--termDefinitionType :: TTerm TermDefinition -> TTerm Type-termDefinitionType td = project _TermDefinition _TermDefinition_type @@ td--typeDefinition :: TTerm Name -> TTerm Type -> TTerm TypeDefinition-typeDefinition name typ = record _TypeDefinition [- _TypeDefinition_name>>: name,- _TypeDefinition_type>>: typ]--typeDefinitionName :: TTerm TypeDefinition -> TTerm Name-typeDefinitionName td = project _TypeDefinition _TypeDefinition_name @@ td--typeDefinitionType :: TTerm TypeDefinition -> TTerm Type-typeDefinitionType td = project _TypeDefinition _TypeDefinition_type @@ td--unFileExtension :: TTerm FileExtension -> TTerm String-unFileExtension fe = unwrap _FileExtension @@ fe--unNamespace :: TTerm Namespace -> TTerm String-unNamespace ns = unwrap _Namespace @@ ns
− src/main/haskell/Hydra/Dsl/PhantomLiterals.hs
@@ -1,82 +0,0 @@--- | A DSL for constructing literal terms using Haskell's built-in datatypes--module Hydra.Dsl.PhantomLiterals where--import Hydra.Phantoms-import qualified Hydra.Dsl.Terms as Terms--import Data.Int----- Note: does not yet properly capture arbitrary-precision floating-point numbers,--- because code generation does not.-type Bigfloat = Double---- Note: does not distinguish Binary from String, because code generation does not.-type Binary = String--bigfloat :: Bigfloat -> TTerm Bigfloat-bigfloat = TTerm . Terms.bigfloat--bigint :: Integer -> TTerm Integer-bigint = TTerm . Terms.bigint--binary :: Binary -> TTerm Binary-binary = TTerm . Terms.binary--bool :: Bool -> TTerm Bool-bool = TTerm . Terms.boolean--boolean :: Bool -> TTerm Bool-boolean = bool--char :: Char -> TTerm Int-char = TTerm . Terms.char--double :: Double -> TTerm Double-double = float64--false :: TTerm Bool-false = bool False--float :: Float -> TTerm Float-float = float32--float32 :: Float -> TTerm Float-float32 = TTerm . Terms.float32--float64 :: Double -> TTerm Double-float64 = TTerm . Terms.float64--int :: Int -> TTerm Int-int = int32--int8 :: Int8 -> TTerm Int8-int8 = TTerm . Terms.int8--int16 :: Int16 -> TTerm Int16-int16 = TTerm . Terms.int16--int32 :: Int -> TTerm Int-int32 = TTerm . Terms.int32--int64 :: Int64 -> TTerm Int64-int64 = TTerm . Terms.int64--string :: String -> TTerm String-string = TTerm . Terms.string--true :: TTerm Bool-true = bool True--uint8 :: Int16 -> TTerm Int16-uint8 = TTerm . Terms.uint8--uint16 :: Int -> TTerm Int-uint16 = TTerm . Terms.uint16--uint32 :: Int64 -> TTerm Int64-uint32 = TTerm . Terms.uint32--uint64 :: Integer -> TTerm Integer-uint64 = TTerm . Terms.uint64
− src/main/haskell/Hydra/Dsl/Phantoms.hs
@@ -1,351 +0,0 @@--- | Term-level DSL which makes use of phantom types. Use this DSL for defining programs as opposed to data type definitions.--- The phantom types provide static type checking in Haskell prior to Hydra's runtime type checking.-module Hydra.Dsl.Phantoms (- module Hydra.Dsl.Phantoms,- module Hydra.Dsl.PhantomLiterals,-) where--import Hydra.Kernel-import Hydra.Dsl.Common-import Hydra.Dsl.PhantomLiterals-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Annotations as Ann-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Show.Core as ShowCore--import Prelude hiding ((++))-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S----- * Operators--infixr 0 ~>-(~>) :: String -> TTerm x -> TTerm (a -> b)-name ~> body = lambda name body--infixl 1 <~-(<~) :: String -> TTerm a -> TTerm b -> TTerm b-name <~ value = let1 name value--infixl 1 <<~-(<<~) :: String -> TTerm (Flow s a) -> TTerm (Flow s b) -> TTerm (Flow s b)-name <<~ def = bind name def---- | Function composition operator: f <.> g creates a function that applies g then f--- Example: toString <.> increment-(<.>) :: TTerm (b -> c) -> TTerm (a -> b) -> TTerm (a -> c)-f <.> g = compose f g---- | Function application operator: function @@ argument--- Example: add @@ int32 1-(@@) :: TTerm (a -> b) -> TTerm a -> TTerm b-fun @@ arg = apply fun arg---- | Field definition operator for records: name>: value--- Example: "name">: string "John"-infixr 0 >:-(>:) :: String -> TTerm a -> Field-name>: term = Field (Name name) (unTTerm term)---- | Field definition operator with pre-constructed name: fname>>: value--- Example: _Person_name>>: string "John"-infixr 0 >>:-(>>:) :: Name -> TTerm a -> Field-fname >>: d = Field fname (unTTerm d)---- * Fundamentals---- | Apply a function to an argument--- Example: apply (var "add") (int32 1)-apply :: TTerm (a -> b) -> TTerm a -> TTerm b-apply (TTerm lhs) (TTerm rhs) = TTerm $ Terms.apply lhs rhs--let1 :: String -> TTerm a -> TTerm b -> TTerm b-let1 name (TTerm value) (TTerm env) = TTerm $ TermLet $ Let [Binding (Name name) value Nothing] env---- | Create a let expression with multiple bindings--- Example: lets ["x">: int32 1, "y">: int32 2] (var "add" @@ var "x" @@ var "y")-lets :: [Field] -> TTerm a -> TTerm a-lets fields (TTerm env) = TTerm $ TermLet $ Let (toBinding <$> fields) env- where- toBinding (Field name value) = Binding name value Nothing---- | Create a variable reference--- Example: var "x"-var :: String -> TTerm a-var v = TTerm $ Terms.var v--bind :: String -> TTerm (Flow s a) -> TTerm (Flow s b) -> TTerm (Flow s b)-bind v def body = primitive2 _flows_bind def $ lambda v $ body--binds :: [Field] -> TTerm (Flow s a) -> TTerm (Flow s a)-binds fields rhs = L.foldr withField rhs fields- where- withField (Field (Name fname) fterm) b = bind fname (TTerm fterm) b--exec :: TTerm (Flow s a) -> TTerm (Flow s b) -> TTerm (Flow s b)-exec f b = primitive2 _flows_bind f (lambda ignoredVariable b)--produce :: TTerm a -> TTerm (Flow s a)-produce = primitive1 _flows_pure--trace :: TTerm String -> TTerm (Flow s a) -> TTerm (Flow s a)-trace msg flow = var "hydra.monads.withTrace" @@ msg @@ flow---- * Functions--unaryFunction :: (TTerm a -> TTerm b) -> TTerm (a -> b)-unaryFunction f = case (unTTerm $ f $ var "x") of- TermApplication (Application lhs _) -> TTerm lhs- TermOptional (Just _) -> primitive _optionals_pure- TermUnion (Injection tname (Field fname _)) -> lambda "x" $ inject tname fname $ var "x"- TermWrap (WrappedTerm tname _) -> lambda "x" $ wrap tname $ var "x"--binaryFunction :: (TTerm a -> TTerm b -> TTerm c) -> TTerm (a -> b -> c)-binaryFunction f = case (unTTerm $ f (var "x") (var "y")) of- TermApplication (Application (TermApplication (Application lhs _)) _) -> TTerm lhs- t -> TTerm $ Terms.string $ "unexpected term as binary function: " <> ShowCore.term t---- | Compose two functions (g then f)--- Example: compose (var "stringLength") (var "toString")-compose :: TTerm (b -> c) -> TTerm (a -> b) -> TTerm (a -> c)-compose (TTerm f) (TTerm g) = TTerm $ Terms.compose f g---- | Create a constant function that always returns the same value--- Example: constant true-constant :: TTerm a -> TTerm (b -> a)-constant (TTerm term) = TTerm $ Terms.constant term---- | Identity function that returns its argument unchanged--- Example: identity-identity :: TTerm (a -> a)-identity = TTerm Terms.identity---- | Create a lambda function with one parameter--- Example: lambda "x" (var "add" @@ var "x" @@ int32 1)-lambda :: String -> TTerm x -> TTerm (a -> b)-lambda v (TTerm body) = TTerm $ Terms.lambda v body---- | Create a multi-parameter lambda function--- Example: lambdas ["x", "y"] (add @@ var "x" @@ var "y")-lambdas :: [String] -> TTerm x -> TTerm (a -> b)-lambdas params (TTerm body) = TTerm $ Terms.lambdas params body---- | Primitive function by name--- Example: primitive (Name "hydra.lib.strings.length")-primitive :: Name -> TTerm a-primitive = TTerm . Terms.primitive---- | Apply a primitive function to one argument--- Example: primitive1 _math_abs (int32 (-5))-primitive1 :: Name -> TTerm a -> TTerm b-primitive1 primName (TTerm a) = TTerm $ Terms.primitive primName Terms.@@ a---- | Apply a primitive function to two arguments--- Example: primitive2 _math_add (int32 2) (int32 3)-primitive2 :: Name -> TTerm a -> TTerm b -> TTerm c-primitive2 primName (TTerm a) (TTerm b) = TTerm $ Terms.primitive primName Terms.@@ a Terms.@@ b---- | Apply a primitive function to three arguments--- Example: primitive3 _string_replace (string "hello") (string "e") (string "a")-primitive3 :: Name -> TTerm a -> TTerm b -> TTerm c -> TTerm d-primitive3 primName (TTerm a) (TTerm b) (TTerm c) = TTerm $ Terms.primitive primName Terms.@@ a Terms.@@ b Terms.@@ c---- * Collections---- | Create a fold function to process lists--- Example: fold (lambda "acc" (lambda "x" (add @@ var "acc" @@ var "x")))-fold :: TTerm (b -> a -> b) -> TTerm (b -> [a] -> b)-fold f = (primitive _lists_foldl) @@ f---- | Create a 'Just' optional value--- Example: just (string "found")-just :: TTerm a -> TTerm (Maybe a)-just (TTerm term) = TTerm $ Terms.just term---- | Function that wraps a value in 'Just'--- Example: just_ @@ myValue-just_ :: TTerm (a -> Maybe a)-just_ = TTerm $ Terms.lambda "just_" $ Terms.just $ Terms.var "just_"---- | Create a list of terms--- Example: list [int32 1, int32 2, int32 3]-list :: [TTerm a] -> TTerm [a]-list els = TTerm $ Terms.list (unTTerm <$> els)---- | Create a map/dictionary term--- Example: map (M.fromList [(string "a", int32 1), (string "b", int32 2)])-map :: M.Map (TTerm a) (TTerm b) -> TTerm (M.Map a b)-map = TTerm . Terms.map . M.fromList . fmap fromTTerm . M.toList- where- fromTTerm (TTerm k, TTerm v) = (k, v)---- | Create a 'Nothing' optional value--- Example: nothing-nothing :: TTerm (Maybe a)-nothing = TTerm Terms.nothing---- | Create an optional value from a Maybe--- Example: opt (Just myValue)-opt :: Maybe (TTerm a) -> TTerm (Maybe a)-opt mc = TTerm $ Terms.optional (unTTerm <$> mc)---- | Create a set of terms--- Example: set [string "a", string "b", string "c"]-set :: [TTerm a] -> TTerm (S.Set a)-set = TTerm . Terms.set . S.fromList . fmap unTTerm---- * Products and tuples---- | First element projection function for pairs--- Example: first $ pair (string "foo") (string "bar")-first :: TTerm (a, b) -> TTerm a-first pair = TTerm (Terms.untuple 2 0) @@ pair---- | Create a pair (2-tuple)--- Example: pair (string "age") (int32 32)-pair :: (TTerm a) -> (TTerm b) -> TTerm (a, b)-pair (TTerm l) (TTerm r) = TTerm $ Terms.pair l r---- | Second element projection function for pairs--- Example: second $ pair (string "foo") (string "bar")-second :: TTerm (a, b) -> TTerm b-second pair = TTerm (Terms.untuple 2 1) @@ pair--triple :: TTerm a -> TTerm b -> TTerm c -> TTerm (a, b, c)-triple (TTerm a) (TTerm b) (TTerm c) = TTerm $ Terms.triple a b c--tuple4 :: TTerm a -> TTerm b -> TTerm c -> TTerm d -> TTerm (a, b, c, d)-tuple4 (TTerm a) (TTerm b) (TTerm c) (TTerm d) = TTerm $ Terms.tuple4 a b c d--tuple5 :: TTerm a -> TTerm b -> TTerm c -> TTerm d -> TTerm e -> TTerm (a, b, c, d, e)-tuple5 (TTerm a) (TTerm b) (TTerm c) (TTerm d) (TTerm e) = TTerm $ Terms.tuple5 a b c d e---- | Create a tuple projection function--- Example: untuple 3 1 extracts the second element of a 3-tuple-untuple :: Int -> Int -> TTerm (a -> b)-untuple arity idx = TTerm $ Terms.untuple arity idx---- * Records, unions and newtypes---- | Create a field with the given name and value--- Example: field (Name "age") (int32 30)-field :: Name -> TTerm a -> Field-field fname (TTerm val) = Field fname val---- | Create a union injection--- Example: inject (Name "Result") (Name "success") (string "ok")-inject :: Name -> Name -> TTerm a -> TTerm b-inject name fname (TTerm term) = TTerm $ Terms.inject name (Field fname term)---- | Create a function that injects its argument into a union variant--- Example: injectLambda (Name "Result") (Name "success")-injectLambda :: Name -> Name -> TTerm (a -> b)-injectLambda name fname = lambda "injected_" $ inject name fname $ var "injected_"---- | Extract a field from a record--- Example: project (Name "Person") (Name "name")-project :: Name -> Name -> TTerm (a -> b)-project name fname = TTerm $ Terms.project name fname---- | Create a record with named fields--- Example: record (Name "Person") [field (Name "name") (string "John"), field (Name "age") (int32 30)]-record :: Name -> [Field] -> TTerm a-record name fields = TTerm $ Terms.record name fields---- | Unit value (empty record)-unit :: TTerm a-unit = TTerm Terms.unit---- | Create a unit variant of a union--- Example: unitVariant (Name "Result") (Name "success")-unitVariant :: Name -> Name -> TTerm a-unitVariant name fname = TTerm $ Terms.inject name $ Field fname Terms.unit---- | Create an unwrap function for a wrapped type--- Example: unwrap (Name "Email")-unwrap :: Name -> TTerm (a -> b)-unwrap = TTerm . Terms.unwrap---- | Create a union variant--- Example: variant (Name "Result") (Name "success") (string "ok")-variant :: Name -> Name -> TTerm a -> TTerm b-variant name fname (TTerm term) = TTerm $ Terms.inject name $ Field fname term---- | Create a wrapped term (instance of a newtype)--- Example: wrap (Name "Email") (string "user@example.com")--- Note: the phantom types provide no guarantee of type safety in this case-wrap :: Name -> TTerm a -> TTerm b-wrap name (TTerm term) = TTerm $ Terms.wrap name term---- * Pattern matching---- | Apply a named case match to an argument--- Example: cases resultTypeName myResult Nothing [onSuccess, onError]--- See also: 'match'-cases :: Name -> TTerm a -> Maybe (TTerm b) -> [Field] -> TTerm b-cases name arg dflt fields = TTerm $ Terms.apply (Terms.match name (unTTerm <$> dflt) fields) (unTTerm arg)---- | Create a pattern match on a union term--- Example: match (Name "Result") (Just $ string "what?") ["success">: string "yay", "error">: string "boo"]-match :: Name -> Maybe (TTerm b) -> [Field] -> TTerm (a -> b)-match name dflt fields = TTerm $ Terms.match name (unTTerm <$> dflt) fields--optCases :: TTerm (Maybe a) -> TTerm b -> TTerm (a -> b) -> TTerm b-optCases arg ifNothing ifJust = primitive3 (Name "hydra.lib.optionals.maybe") ifNothing ifJust arg---- * Definitions and modules---- | Create a definition in a module--- Example: definitionInModule myModule "addInts" (lambda "x" (lambda "y" (add @@ var "x" @@ var "y")))-definitionInModule :: Module -> String -> TTerm a -> TBinding a-definitionInModule mod = definitionInNamespace $ moduleNamespace mod---- | Create a definition in a namespace--- Example: definitionInNamespace (Namespace "com.example") "addInts" myFunction-definitionInNamespace :: Namespace -> String -> TTerm a -> TBinding a-definitionInNamespace ns lname = TBinding $ unqualifyName $ QualifiedName (Just ns) lname---- | Convert a typed element to an untyped element--- Example: el (definitionInModule myModule "addInts" myFunction)-el :: TBinding a -> Binding-el (TBinding name (TTerm term)) = Binding name term Nothing---- | Reference a defined element--- Example: ref (definitionInModule myModule "addInts")-ref :: TBinding a -> TTerm a-ref (TBinding name _) = TTerm (TermVariable name)---- * Metadata and annotations---- | Add an annotation to a term--- Example: annot (Name "deprecated") (Just (boolean True)) myFunction-annot :: Name -> Maybe Term -> TTerm a -> TTerm a-annot key mvalue (TTerm term) = TTerm $ Ann.annotateTerm key mvalue term---- | Add documentation to a term--- Example: doc "Adds two integers" addFunction-doc :: String -> TTerm a -> TTerm a-doc s (TTerm term) = TTerm $ setTermDescription (Just s) term---- | Add documentation with line wrapping at the specified width--- Example: docWrapped 80 "This is a long documentation string that will be wrapped..." myFunction-docWrapped :: Int -> String -> TTerm a -> TTerm a-docWrapped len = doc . wrapLine len---- | Mark a type as first-class--- Example: firstClassType (record ...)-firstClassType :: TTerm Type -> TTerm Type-firstClassType typ = annot key_firstClassType (Just $ Terms.boolean True) typ---- | Associate the Ord type class with the inferred type of a term--- Example: withOrd "t0" myTerm-withOrd :: String -> TTerm a -> TTerm a-withOrd v = withTypeClasses $ M.fromList [(Name v, S.singleton TypeClassOrdering)]---- | Associate type classes with the inferred type of a term--- Example: withTypeClasses (M.fromList [(Name "t0", S.singleton TypeClassOrdering)]) myTerm-withTypeClasses :: M.Map Name (S.Set TypeClass) -> TTerm a -> TTerm a-withTypeClasses classes (TTerm term) = TTerm $ setTypeClasses classes term
src/main/haskell/Hydra/Dsl/Prims.hs view
@@ -5,17 +5,21 @@ import Hydra.Compute import Hydra.Core+import Hydra.Classes import Hydra.Graph-import Hydra.Mantle+import Hydra.Util+import qualified Hydra.Monads as Monads import qualified Hydra.Encode.Core as EncodeCore import qualified Hydra.Decode.Core as DecodeCore import qualified Hydra.Extract.Core as ExtractCore-import qualified Hydra.Extract.Mantle as ExtractMantle+import qualified Hydra.Util as Util+import qualified Hydra.Extract.Util as ExtractUtil import qualified Hydra.Dsl.Terms as Terms import qualified Hydra.Dsl.Types as Types import qualified Hydra.Show.Core as ShowCore import Data.Int+import qualified Data.ByteString as B import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S@@ -23,6 +27,42 @@ import Hydra.Rewriting (removeTermAnnotations) import Data.String(IsString(..)) +-- | A type variable specification with optional class constraints+data TypeVar = TypeVar {+ typeVarName :: String,+ typeVarClasses :: [Name]+}++-- | Create an unconstrained type variable+v :: String -> TypeVar+v name = TypeVar name []++-- | Create a type variable with Ord constraint+vOrd :: String -> TypeVar+vOrd name = TypeVar name [_TypeClass_ordering]++-- | Create a type variable with Eq constraint+vEq :: String -> TypeVar+vEq name = TypeVar name [_TypeClass_equality]++-- | Convert a list of TypeVars to the format needed by polyConstrained+-- Filters out variables with no constraints+typeVarsToConstraints :: [TypeVar] -> [(String, [Name])]+typeVarsToConstraints = filter (not . L.null . snd) . fmap (\tv -> (typeVarName tv, typeVarClasses tv))++-- | Get just the variable names from a list of TypeVars+typeVarNames :: [TypeVar] -> [String]+typeVarNames = fmap typeVarName++-- | Build a TypeScheme from type variables and a type+-- Uses polyConstrained if there are any constraints, otherwise poly+buildTypeScheme :: [TypeVar] -> Type -> TypeScheme+buildTypeScheme vars typ =+ let constraints = typeVarsToConstraints vars+ in if L.null constraints+ then Types.poly (typeVarNames vars) typ+ else Types.polyConstrained (fmap (\tv -> (typeVarName tv, typeVarClasses tv)) vars) typ+ instance IsString (TermCoder Term) where fromString = variable bigfloat :: TermCoder Double@@ -37,7 +77,7 @@ encode = ExtractCore.bigint decode = pure . Terms.bigint -binary :: TermCoder String+binary :: TermCoder B.ByteString binary = TermCoder Types.binary $ Coder encode decode where encode = ExtractCore.binary@@ -52,13 +92,30 @@ comparison :: TermCoder Comparison comparison = TermCoder (TypeVariable _Comparison) $ Coder encode decode where- encode = ExtractMantle.comparison+ encode = ExtractUtil.comparison decode = pure . Terms.comparison +either_ :: TermCoder x -> TermCoder y -> TermCoder (Prelude.Either x y)+either_ xCoder yCoder = TermCoder (Types.either_ (termCoderType xCoder) (termCoderType yCoder)) $ Coder encode decode+ where+ encode term = case term of+ TermEither (Prelude.Left l) -> Prelude.Left <$> coderEncode (termCoderCoder xCoder) l+ TermEither (Prelude.Right r) -> Prelude.Right <$> coderEncode (termCoderCoder yCoder) r+ _ -> fail $ "expected either term, got: " ++ show term+ decode ev = case ev of+ Prelude.Left x -> do+ xTerm <- coderDecode (termCoderCoder xCoder) x+ return $ Terms.left xTerm+ Prelude.Right y -> do+ yTerm <- coderDecode (termCoderCoder yCoder) y+ return $ Terms.right yTerm+ floatType :: TermCoder FloatType floatType = TermCoder (TypeVariable _FloatType) $ Coder encode decode where- encode = DecodeCore.floatType+ encode term = do+ g <- Monads.getState+ Monads.eitherToFlow Util.unDecodingError $ DecodeCore.floatType g term decode = pure . EncodeCore.floatType floatValue :: TermCoder FloatValue@@ -92,10 +149,29 @@ encode term = fail $ "cannot encode term to a function: " ++ ShowCore.term term decode _ = fail $ "cannot decode functions to terms" +-- | A TermCoder for function types, using a reducer to bridge term-level functions to native functions.+-- The reducer is called to evaluate function application at the term level.+-- Failures in reduction or encoding/decoding will result in a runtime error.+functionWithReduce :: (Term -> Flow Graph Term) -> TermCoder x -> TermCoder y -> TermCoder (x -> y)+functionWithReduce reduce dom cod = TermCoder (Types.function (termCoderType dom) (termCoderType cod)) $ Coder encode decode+ where+ encode funTerm = do+ g <- Monads.getState+ pure $ \x ->+ let argTerm = Monads.fromFlow (error "functionWithReduce: failed to encode argument") g+ (coderDecode (termCoderCoder dom) x)+ resultTerm = Monads.fromFlow (error "functionWithReduce: failed to reduce application") g+ (reduce (TermApplication (Application funTerm argTerm)))+ in Monads.fromFlow (error "functionWithReduce: failed to decode result") g+ (coderEncode (termCoderCoder cod) resultTerm)+ decode _ = fail $ "cannot decode functions to terms"+ integerType :: TermCoder IntegerType integerType = TermCoder (TypeVariable _IntegerType) $ Coder encode decode where- encode = DecodeCore.integerType+ encode term = do+ g <- Monads.getState+ Monads.eitherToFlow Util.unDecodingError $ DecodeCore.integerType g term decode = pure . EncodeCore.integerType integerValue :: TermCoder IntegerValue@@ -143,7 +219,9 @@ literalType :: TermCoder LiteralType literalType = TermCoder (TypeVariable _LiteralType) $ Coder encode decode where- encode = DecodeCore.literalType+ encode term = do+ g <- Monads.getState+ Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literalType g term decode = pure . EncodeCore.literalType map :: Ord k => TermCoder k -> TermCoder v -> TermCoder (M.Map k v)@@ -157,36 +235,33 @@ ve <- (coderDecode $ termCoderCoder values) v return (ke, ve) -noInterpretedForm :: Name -> Flow Graph Term-noInterpretedForm name = fail $ "primitive " ++ unName name ++ " does not have an interpreted form; it can only be used in compiled code"- optional :: TermCoder x -> TermCoder (Y.Maybe x) optional mel = TermCoder (Types.optional $ termCoderType mel) $ Coder encode decode where- encode = ExtractCore.optional (coderEncode $ termCoderCoder mel)+ encode = ExtractCore.maybeTerm (coderEncode $ termCoderCoder mel) decode mv = Terms.optional <$> case mv of Nothing -> pure Nothing Just v -> Just <$> (coderDecode $ termCoderCoder mel) v -pair :: TermCoder k -> TermCoder v -> TermCoder (k, v)-pair kCoder vCoder = TermCoder (Types.product [termCoderType kCoder, termCoderType vCoder]) $ Coder encode decode+pair :: TermCoder x -> TermCoder y -> TermCoder (x, y)+pair xCoder yCoder = TermCoder (Types.pair (termCoderType xCoder) (termCoderType yCoder)) $ Coder encode decode where- encode = ExtractCore.pair (coderEncode $ termCoderCoder kCoder) (coderEncode $ termCoderCoder vCoder)- decode (k, v) = do- kTerm <- coderDecode (termCoderCoder kCoder) k- vTerm <- coderDecode (termCoderCoder vCoder) v- return $ Terms.tuple [kTerm, vTerm]+ encode = ExtractCore.pair (coderEncode $ termCoderCoder xCoder) (coderEncode $ termCoderCoder yCoder)+ decode (x, y) = do+ xTerm <- coderDecode (termCoderCoder xCoder) x+ yTerm <- coderDecode (termCoderCoder yCoder) y+ return $ Terms.pair xTerm yTerm -prim0 :: Name -> x -> [String] -> TermCoder x -> Primitive+prim0 :: Name -> x -> [TypeVar] -> TermCoder x -> Primitive prim0 name value vars output = Primitive name typ impl where- typ = Types.poly vars $ termCoderType output+ typ = buildTypeScheme vars $ termCoderType output impl _ = coderDecode (termCoderCoder output) value -prim1 :: Name -> (x -> y) -> [String] -> TermCoder x -> TermCoder y -> Primitive+prim1 :: Name -> (x -> y) -> [TypeVar] -> TermCoder x -> TermCoder y -> Primitive prim1 name compute vars input1 output = Primitive name typ impl where- typ = Types.poly vars $ Types.functionMany [+ typ = buildTypeScheme vars $ Types.functionMany [ termCoderType input1, termCoderType output] impl args = do@@ -194,10 +269,10 @@ arg1 <- coderEncode (termCoderCoder input1) (args !! 0) coderDecode (termCoderCoder output) $ compute arg1 -prim2 :: Name -> (x -> y -> z) -> [String] -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive+prim2 :: Name -> (x -> y -> z) -> [TypeVar] -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive prim2 name compute vars input1 input2 output = Primitive name typ impl where- typ = Types.poly vars $ Types.functionMany [+ typ = buildTypeScheme vars $ Types.functionMany [ termCoderType input1, termCoderType input2, termCoderType output]@@ -207,22 +282,10 @@ arg2 <- coderEncode (termCoderCoder input2) (args !! 1) coderDecode (termCoderCoder output) $ compute arg1 arg2 -prim2Interp :: Name -> Maybe (Term -> Term -> Flow Graph Term) -> [String] -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive-prim2Interp name mcompute vars input1 input2 output = Primitive name typ impl- where- compute = Y.fromMaybe (\a b -> noInterpretedForm name) mcompute- typ = Types.poly vars $ Types.functionMany [- termCoderType input1,- termCoderType input2,- termCoderType output]- impl args = do- ExtractCore.nArgs name 2 args- compute (args !! 0) (args !! 1)--prim3 :: Name -> (w -> x -> y -> z) -> [String] -> TermCoder w -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive+prim3 :: Name -> (w -> x -> y -> z) -> [TypeVar] -> TermCoder w -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive prim3 name compute vars input1 input2 input3 output = Primitive name typ impl where- typ = Types.poly vars $ Types.functionMany [+ typ = buildTypeScheme vars $ Types.functionMany [ termCoderType input1, termCoderType input2, termCoderType input3,@@ -234,13 +297,33 @@ arg3 <- coderEncode (termCoderCoder input3) (args !! 2) coderDecode (termCoderCoder output) $ compute arg1 arg2 arg3 -prim3Interp :: Name -> Maybe (Term -> Term -> Term -> Flow Graph Term) -> [String] -> TermCoder w -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive-prim3Interp name mcompute vars input1 input2 input3 output = Primitive name typ impl+prim1Eval :: Name -> (Term -> Flow Graph Term) -> [TypeVar] -> TermCoder x -> TermCoder y -> Primitive+prim1Eval name compute vars input1 output = Primitive name typ impl where- compute = Y.fromMaybe (\a b c -> noInterpretedForm name) mcompute- typ = Types.poly vars $ Types.functionMany [+ typ = buildTypeScheme vars $ Types.functionMany [ termCoderType input1,+ termCoderType output]+ impl args = do+ ExtractCore.nArgs name 1 args+ compute (args !! 0)++prim2Eval :: Name -> (Term -> Term -> Flow Graph Term) -> [TypeVar] -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive+prim2Eval name compute vars input1 input2 output = Primitive name typ impl+ where+ typ = buildTypeScheme vars $ Types.functionMany [+ termCoderType input1, termCoderType input2,+ termCoderType output]+ impl args = do+ ExtractCore.nArgs name 2 args+ compute (args !! 0) (args !! 1)++prim3Eval :: Name -> (Term -> Term -> Term -> Flow Graph Term) -> [TypeVar] -> TermCoder w -> TermCoder x -> TermCoder y -> TermCoder z -> Primitive+prim3Eval name compute vars input1 input2 input3 output = Primitive name typ impl+ where+ typ = buildTypeScheme vars $ Types.functionMany [+ termCoderType input1,+ termCoderType input2, termCoderType input3, termCoderType output] impl args = do@@ -268,7 +351,9 @@ type_ :: TermCoder Type type_ = TermCoder (TypeVariable _Type) $ Coder encode decode where- encode = DecodeCore.type_+ encode term = do+ g <- Monads.getState+ Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ g term decode = pure . EncodeCore.type_ uint8 :: TermCoder Int16
− src/main/haskell/Hydra/Dsl/ShorthandTypes.hs
@@ -1,117 +0,0 @@-module Hydra.Dsl.ShorthandTypes where--import Hydra.Accessors-import Hydra.Coders-import Hydra.Core-import Hydra.Compute-import Hydra.Graph-import Hydra.Mantle-import Hydra.Module-import qualified Hydra.Dsl.Types as Types--import qualified Data.Map as M-import qualified Data.Set as S----- Typeclass references-eqA = (M.fromList [(Name "a", S.fromList [TypeClassEquality])])-ordA = (M.fromList [(Name "a", S.fromList [TypeClassOrdering])])---- Type constructors-tA = tVar "a"-tApply = Types.apply-tApplyN = Types.applyMany-tB = tVar "b"-tBigfloat = Types.bigfloat-tBigint = Types.bigint-tBinary = Types.binary-tBoolean = Types.boolean-tC = tVar "c"-tD = tVar "d"-tE = tVar "e"-tFloat32 = Types.float32-tFloat64 = Types.float64-tFlow s x = tApplyN [flowT, s, x]-tFlowS1A = tFlow (tVar "s1") tA-tFlowS2A = tFlow (tVar "s2") tA-tFlowSA = tFlow tS tA-tFlowSS = tFlow tS tS-tFlowState s x = tApplyN [flowStateT, s, x]-tFun = Types.function-tFunN = Types.functionMany-tInt8 = Types.int8-tInt16 = Types.int16-tInt32 = Types.int32-tInt64 = Types.int64-tList = Types.list-tMap = Types.map-tMono = Types.mono-tOpt = Types.optional-tPair = Types.pair-tS = tVar "s"-tSet = TypeSet-tString = Types.string-tSum = Types.sum-tUint8 = Types.uint8-tUint16 = Types.uint16-tUint32 = Types.uint32-tUint64 = Types.uint64-tUnit = Types.unit-tVar = Types.var-tX = tVar "x"---- Type references-annotatedTermT = TypeVariable _AnnotatedTerm :: Type-annotatedTypeT = TypeVariable _AnnotatedType :: Type-applicationT = TypeVariable _Application :: Type-applicationTypeT = TypeVariable _ApplicationType :: Type-caseConventionT = TypeVariable _CaseConvention :: Type-caseStatementT = TypeVariable _CaseStatement :: Type-elementT = TypeVariable _Binding :: Type-eliminationT = TypeVariable _Elimination :: Type-eliminationVariantT = TypeVariable _EliminationVariant :: Type-fieldT = TypeVariable _Field :: Type-fieldNameT = TypeVariable _Name :: Type-fieldTypeT = TypeVariable _FieldType :: Type-fileExtensionT = TypeVariable _FileExtension :: Type-floatTypeT = TypeVariable _FloatType :: Type-floatValueT = TypeVariable _FloatValue :: Type-flowStateT = TypeVariable _FlowState :: Type-flowT = TypeVariable _Flow :: Type-functionT = TypeVariable _Function :: Type-functionTypeT = TypeVariable _FunctionType :: Type-functionVariantT = TypeVariable _FunctionVariant :: Type-graphT = TypeVariable _Graph :: Type-injectionT = TypeVariable _Injection :: Type-integerTypeT = TypeVariable _IntegerType :: Type-integerValueT = TypeVariable _IntegerValue :: Type-lambdaT = TypeVariable _Lambda :: Type-forallTypeT = TypeVariable _ForallType :: Type-languageT = TypeVariable _Language :: Type-letT = TypeVariable _Let :: Type-letBindingT = TypeVariable _Binding :: Type-literalT = TypeVariable _Literal :: Type-literalTypeT = TypeVariable _LiteralType :: Type-literalVariantT = TypeVariable _LiteralVariant :: Type-mapTypeT = TypeVariable _MapType :: Type-nameT = TypeVariable _Name-namespaceT = TypeVariable _Namespace-precisionT = TypeVariable _Precision :: Type-primitiveT = TypeVariable _Primitive :: Type-projectionT = TypeVariable _Projection :: Type-qualifiedNameT = TypeVariable _QualifiedName-recordT = TypeVariable _Record :: Type-rowTypeT = TypeVariable _RowType :: Type-sumT = TypeVariable _Sum :: Type-termT = TypeVariable _Term :: Type-termAccessorT = TypeVariable _TermAccessor :: Type-termVariantT = TypeVariable _TermVariant :: Type-traceT = TypeVariable _Trace-tupleProjectionT = TypeVariable _TupleProjection :: Type-typeT = TypeVariable _Type :: Type-typeLambdaT = TypeVariable _TypeLambda :: Type-typeSchemeT = TypeVariable _TypeScheme :: Type-typedTermT = TypeVariable _TypedTerm :: Type-typeVariantT = TypeVariable _TypeVariant :: Type-wrappedTermT = TypeVariable _WrappedTerm :: Type-wrappedTypeT = TypeVariable _WrappedType :: Type
− src/main/haskell/Hydra/Dsl/TBase.hs
@@ -1,26 +0,0 @@--- | A basis for other DSLs which deal with term-encoded expressions.--module Hydra.Dsl.TBase (- module Hydra.Dsl.Phantoms,- module Hydra.Dsl.ShorthandTypes,- module Hydra.Dsl.TBase,- module Hydra.Sources.Libraries,-) where--import Hydra.Kernel-import Hydra.Dsl.ShorthandTypes-import Hydra.Dsl.Phantoms(definitionInModule, el, firstClassType, opt, ref, variant)-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Core as Core-import Hydra.Sources.Libraries--import qualified Data.Map as M-import qualified Data.Maybe as Y---infixr 0 >:-(>:) :: String -> a -> (TTerm Name, a)-n >: d = (name n, d)--name :: String -> TTerm Name-name s = Core.nameLift $ Name s
− src/main/haskell/Hydra/Dsl/TTerms.hs
@@ -1,352 +0,0 @@--- | A domain-specific language for constructing term-encoded Hydra terms in Haskell;--- these functions enable you to build terms (programs) which build terms.-module Hydra.Dsl.TTerms (- module Hydra.Dsl.TBase,- module Hydra.Dsl.TTerms,-) where--import Hydra.Kernel-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Encode.Core as EncodeCore-import Hydra.Dsl.TBase-import qualified Hydra.Dsl.Phantoms as Phantoms--import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y-import Data.Int-import Prelude hiding (map, product, sum)----- * Operators---- | Function application operator for term-encoded terms--- Example: fun @@ arg-(@@) :: TTerm Term -> TTerm Term -> TTerm Term-f @@ x = apply f x---- * Fundamentals---- | Apply a term-encoded function to a term-encoded argument--- Example: apply (var "add") (int32 1)-apply :: TTerm Term -> TTerm Term -> TTerm Term-apply func arg = Core.termApplication $ Core.application func arg---- | Create a term-encoded field with the given name and term-encoded value--- Example: field "age" (int32 30)-field :: String -> TTerm Term -> TTerm Field-field s = Core.field (name s)---- | Create a term-encoded let expression with multiple bindings--- Example: lets ["x">: int32 1, "y">: int32 2] (var "add" @@ var "x" @@ var "y")-lets :: [(TTerm Name, TTerm Term)] -> TTerm Term -> TTerm Term-lets pairs body = Core.termLet $ Core.let_ (Phantoms.list $ toBinding pairs) body- where- toBinding = fmap (\(n, t) -> Core.binding n t Phantoms.nothing)---- | Create a term-encoded variable reference from a string--- Example: var "x"-var :: String -> TTerm Term-var = Core.termVariable . name---- | Create a term-encoded variable reference from a Name--- Example: varName (Name "x")-varName :: Name -> TTerm Term-varName (Name n) = Core.termVariable $ TTerm $ Terms.string n---- | Maps a string to a phantom-typed variable term--- Example: varPhantom "x" :: TTerm Int-varPhantom :: String -> TTerm a-varPhantom = TTerm . TermVariable . Name---- | Create a phantom-typed variable reference from a Name--- Example: varNamePhantom (Name "x") :: TTerm Int-varNamePhantom :: Name -> TTerm a-varNamePhantom = TTerm . TermVariable---- * Functions---- | Create a term-encoded constant function that always returns the same term-encoded value--- Example: constant (int32 42)-constant :: TTerm Term -> TTerm Term-constant = lambda ignoredVariable---- | Create a term-encoded lambda function with one parameter--- Example: lambda "x" (var "add" @@ var "x" @@ int32 1)-lambda :: String -> TTerm Term -> TTerm Term-lambda var body = Core.termFunction $ Core.functionLambda $ Core.lambda (name var) Phantoms.nothing body---- | Create a term-encoded multi-parameter lambda function (curried form)--- Example: lambdas ["x", "y"] (var "add" @@ var "x" @@ var "y")-lambdas :: [String] -> TTerm Term -> TTerm Term-lambdas params body = case params of- [] -> body- (h:rest) -> Core.termFunction $ Core.functionLambda $ Core.lambda (name h) Phantoms.nothing $ lambdas rest body---- | Create a term-encoded primitive function reference--- Example: primitive (Name "hydra.lib.strings.length")-primitive :: Name -> TTerm Term-primitive = primitiveLift . TTerm . EncodeCore.name--primitiveLift :: TTerm Name -> TTerm Term-primitiveLift = Core.termFunction . Core.functionPrimitive---- | Create a term-encoded field projection function--- Example: project (name "Person") (name "firstName")-project :: TTerm Name -> TTerm Name -> TTerm Term-project tname fname = Core.termFunction $ Core.functionElimination $ Core.eliminationRecord- $ Core.projection tname fname---- | Create a term-encoded unwrap function for a wrapped type--- Example: unwrap (name "Email")-unwrap :: TTerm Name -> TTerm Term-unwrap = Core.termFunction . Core.functionElimination . Core.eliminationWrap---- * Literal values---- | Create a term-encoded unlimited precision integer--- Example: bigint 42-bigint :: Integer -> TTerm Term-bigint = bigintLift . TTerm . Terms.bigint---- | Lift a TTerm Integer to a term-encoded bigint literal--- Example: bigintLift (varPhantom "x" :: TTerm Integer)-bigintLift :: TTerm Integer -> TTerm Term-bigintLift = Core.termLiteral . Core.literalInteger . Core.integerValueBigint---- | Create a term-encoded boolean literal--- Example: boolean True-boolean :: Bool -> TTerm Term-boolean = booleanLift . TTerm . Terms.boolean---- | Lift a TTerm Bool to a term-encoded boolean literal--- Example: booleanLift $ Phantoms.true-booleanLift :: TTerm Bool -> TTerm Term-booleanLift = Core.termLiteral . Core.literalBoolean---- | Term-encoded boolean false literal-false :: TTerm Term-false = boolean False---- | Create a term-encoded unlimited precision floating point literal--- Example: bigfloat 3.14159-bigfloat :: Double -> TTerm Term-bigfloat = bigfloatLift . TTerm . Terms.bigfloat---- | Lift a TTerm Double to a term-encoded bigfloat literal-bigfloatLift :: TTerm Double -> TTerm Term-bigfloatLift = Core.termLiteral . Core.literalFloat . Core.floatValueBigfloat---- | Create a term-encoded 32-bit floating point literal--- Example: float32 3.14-float32 :: Float -> TTerm Term-float32 = float32Lift . TTerm . Terms.float32---- | Lift a TTerm Float to a term-encoded float32 literal--- Example: float32Lift (varPhantom "x" :: TTerm Float)-float32Lift :: TTerm Float -> TTerm Term-float32Lift = Core.termLiteral . Core.literalFloat . Core.floatValueFloat32---- | Create a term-encoded 64-bit floating point literal--- Example: float64 3.14159-float64 :: Double -> TTerm Term-float64 = float64Lift . TTerm . Terms.float64---- | Lift a TTerm Float to a term-encoded float64 literal--- Example: float64Lift (varPhantom "x" :: TTerm Float)-float64Lift :: TTerm Double -> TTerm Term-float64Lift = Core.termLiteral . Core.literalFloat . Core.floatValueFloat64---- | Create a term-encoded 8-bit signed integer literal--- Example: int8 127-int8 :: Int8 -> TTerm Term-int8 = int8Lift . TTerm . Terms.int8---- | Lift a TTerm Int8 to a term-encoded int8 literal--- Example: int8Lift (varPhantom "x" :: TTerm Int8)-int8Lift :: TTerm Int8 -> TTerm Term-int8Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt8---- | Create a term-encoded 16-bit signed integer literal--- Example: int16 32767-int16 :: Int16 -> TTerm Term-int16 = int16Lift . TTerm . Terms.int16---- | Lift a TTerm Int16 to a term-encoded int16 literal--- Example: int16Lift (varPhantom "x" :: TTerm Int16)-int16Lift :: TTerm Int16 -> TTerm Term-int16Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt16---- | Create a term-encoded 32-bit signed integer literal--- Example: int32 42-int32 :: Int -> TTerm Term-int32 = int32Lift . TTerm . Terms.int32---- | Lift a TTerm Int to a term-encoded int32 literal--- Example: int32Lift (varPhantom "x" :: TTerm Int)-int32Lift :: TTerm Int -> TTerm Term-int32Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt32---- | Create a term-encoded 64-bit signed integer literal--- Example: int64 9223372036854775807-int64 :: Int64 -> TTerm Term-int64 = int64Lift . TTerm . Terms.int64---- | Lift a TTerm Int64 to a term-encoded int64 literal--- Example: int64Lift (varPhantom "x" :: TTerm Int64)-int64Lift :: TTerm Int64 -> TTerm Term-int64Lift = Core.termLiteral . Core.literalInteger . Core.integerValueInt64---- | Create a term-encoded string literal--- Example: string "hello world"-string :: String -> TTerm Term-string = stringLift . TTerm . Terms.string---- | Lift a TTerm String to a term-encoded string literal--- Example: stringLift $ Phantoms.string "hello world"-stringLift :: TTerm String -> TTerm Term-stringLift = Core.termLiteral . Core.literalString---- | Term-encoded boolean true literal-true :: TTerm Term-true = boolean True---- | Create a term-encoded 8-bit unsigned integer literal--- Example: uint8 255-uint8 :: Int16 -> TTerm Term-uint8 = uint8Lift . TTerm . Terms.uint8--uint8Lift :: TTerm Int16 -> TTerm Term-uint8Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint8---- | Create a term-encoded 16-bit unsigned integer literal--- Example: uint16 65535-uint16 :: Int -> TTerm Term-uint16 = uint16Lift . TTerm . Terms.uint16---- | Lift a TTerm Int to a term-encoded uint16 literal--- Example: uint16Lift (varPhantom "x" :: TTerm Int)-uint16Lift :: TTerm Int -> TTerm Term-uint16Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint16---- | Create a term-encoded 32-bit unsigned integer literal--- Example: uint32 4294967295-uint32 :: Int64 -> TTerm Term-uint32 = uint32Lift . TTerm . Terms.uint32---- | Lift a TTerm Int64 to a term-encoded uint32 literal-uint32Lift :: TTerm Int64 -> TTerm Term-uint32Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint32---- | Create a term-encoded 64-bit unsigned integer literal--- Example: uint64 18446744073709551615-uint64 :: Integer -> TTerm Term-uint64 = uint64Lift . TTerm . Terms.uint64---- | Lift a TTerm Integer to a term-encoded uint64 literal--- Example: uint64Lift (varPhantom "x" :: TTerm Integer)-uint64Lift :: TTerm Integer -> TTerm Term-uint64Lift = Core.termLiteral . Core.literalInteger . Core.integerValueUint64---- * Collections---- | Create a term-encoded 'Just' optional value--- Example: just (string "found")-just :: TTerm Term -> TTerm (Maybe Term)-just = Phantoms.just---- | Create a term-encoded list--- Example: list [int32 1, int32 2, int32 3]-list :: [TTerm Term] -> TTerm Term-list = Core.termList . Phantoms.list---- | Create a term-encoded map/dictionary--- Example: map (fromList [(string "key", int32 42)])-map :: TTerm (M.Map Term Term) -> TTerm Term-map = Core.termMap---- | Create a term-encoded 'Nothing' optional value-nothing :: TTerm (Maybe Term)-nothing = Phantoms.nothing---- | Create a term-encoded optional value from a Maybe--- Example: optional (just (int32 42))-optional :: TTerm (Maybe Term) -> TTerm Term-optional = Core.termOptional---- | Create a term-encoded set--- Example: set [string "a", string "b", string "c"]-set :: [TTerm Term] -> TTerm Term-set els = Core.termSet $ TTerm $ TermSet $ S.fromList (unTTerm <$> els)---- * Products and tuples----first :: TTerm Term -> TTerm Term---first t = Core.termFunction $ Core.functionElimination $ Core.eliminationProduct $ Core.tupleProjection 2 0 $--first :: TTerm Term -> TTerm Term-first pair = untuple 2 0 @@ pair---- | Create a term-encoded pair (2-tuple)--- Example: pair (string "name") (int32 42)-pair :: TTerm Term -> TTerm Term -> TTerm Term-pair t1 t2 = tuple [t1, t2]------ | Create a term-encoded product (tuple) with multiple components----- Example: product [string "name", int32 42, boolean True]---product :: [TTerm Term] -> TTerm Term---product terms = Core.termProduct $ TTerm $ TermList (unTTerm <$> terms)--second :: TTerm Term -> TTerm Term-second pair = untuple 2 1 @@ pair---- | Create a term-encoded tuple with multiple components--- Example: tuple [string "name", int32 42, boolean True]-tuple :: [TTerm Term] -> TTerm Term-tuple = Core.termProduct . Phantoms.list---- | Create a term-encoded tuple projection function--- Example: untuple 3 1 extracts the second element of a 3-tuple-untuple :: Int -> Int -> TTerm Term-untuple arity idx = Core.termFunction $ Core.functionElimination $ Core.eliminationProduct- $ Core.tupleProjection (Phantoms.int32 arity) (Phantoms.int32 idx) Phantoms.nothing---- * Records and unions---- | Create a term-encoded union injection--- Example: inject (name "Result") "success" (int32 42)-inject :: TTerm Name -> String -> TTerm Term -> TTerm Term-inject tname fname = Core.termUnion . Core.injection tname . Core.field (name fname)---- | Create a term-encoded pattern match on a union--- Example: match (name "Result") nothing ["success">: int32 42, "error">: string "fail"]-match :: TTerm Name -> TTerm (Maybe Term) -> [(TTerm Name, TTerm Term)] -> TTerm Term-match tname def pairs = Core.termFunction $ Core.functionElimination $ Core.eliminationUnion- $ Core.caseStatement tname def $ Phantoms.list $ toField pairs- where- toField = fmap (\(n, t) -> Core.field n t)---- | Create a term-encoded record with named fields--- Example: record (name "Person") ["name">: string "John", "age">: int32 30]-record :: TTerm Name -> [(TTerm Name, TTerm Term)] -> TTerm Term-record name pairs = Core.termRecord $ Core.record name $ Phantoms.list (toField <$> pairs)- where- toField (n, t) = Core.field n t---- | Create a term-encoded sum type instance--- Example: sum 0 3 (int32 1) represents the first element of a 3-element sum-sum :: Int -> Int -> TTerm Term -> TTerm Term-sum i s = Core.termSum . Core.sum (Phantoms.int32 i) (Phantoms.int32 s)--unitVariantPhantom :: Name -> Name -> TTerm Term-unitVariantPhantom tname fname = variantPhantom tname fname Core.termUnit--variantPhantom :: Name -> Name -> TTerm Term -> TTerm Term-variantPhantom tname fname term = Core.termUnion $ Core.injection (Core.nameLift tname) $ Core.field (Core.nameLift fname) term---- | Create a term-encoded wrapped term (newtype)--- Example: wrap (name "Email") (string "user@example.com")-wrap :: TTerm Name -> TTerm Term -> TTerm Term-wrap name = Core.termWrap . Core.wrappedTerm name
− src/main/haskell/Hydra/Dsl/TTypes.hs
@@ -1,201 +0,0 @@--- | A domain-specific language for constructing term-encoded Hydra types in Haskell;--- these functions enable you to build terms (programs) which build types.--module Hydra.Dsl.TTypes (- module Hydra.Dsl.TBase,- module Hydra.Dsl.TTypes,-) where--import Hydra.Kernel-import qualified Hydra.Dsl.Phantoms as Phantoms-import Hydra.Dsl.Core as Core hiding (name, unName)-import Hydra.Dsl.TBase--import qualified Data.Map as M-import qualified Data.Maybe as Y-import Prelude hiding (map, product, sum)----- * Operators---- | Type application operator--- Example: typeConstructor @@ typeArg-(@@) :: TTerm Type -> TTerm Type -> TTerm Type-(@@) = apply---- | Function type constructor operator--- Example: int32 --> string-(-->) :: TTerm Type -> TTerm Type -> TTerm Type-(-->) = function---- * Fundamentals---- | Apply a term-encoded type to a type argument--- Example: apply (var "Maybe") int32-apply :: TTerm Type -> TTerm Type -> TTerm Type-apply l r = typeApplication $ applicationType l r---- | Create a term-encoded field with the given name and type--- Example: field "age" int32-field :: String -> TTerm Type -> TTerm FieldType-field s = fieldType (name s)---- | Create a term-encoded universal quantification (polymorphic type)--- Example: forAll "a" (var "a" --> var "a")-forAll :: String -> TTerm Type -> TTerm Type-forAll var body = typeForall $ forallType (name var) body---- | Create a term-encoded function type--- Example: function int32 string-function :: TTerm Type -> TTerm Type -> TTerm Type-function dom cod = typeFunction $ functionType dom cod---- | Create a term-encoded multi-parameter function type--- Example: functionMany [int32, string, boolean]-functionMany :: [TTerm Type] -> TTerm Type-functionMany types = case types of- [t] -> t- t:ts -> function t $ functionMany ts---- | Create a term-encoded monomorphic type scheme--- Example: mono int32-mono :: TTerm Type -> TTerm TypeScheme-mono t = Phantoms.record _TypeScheme [- Phantoms.field _TypeScheme_variables $ Phantoms.list [],- Phantoms.field _TypeScheme_type t]---- | Create a term-encoded polymorphic type scheme--- Example: poly ["a", "b"] (var "a" --> var "b")-poly :: [String] -> TTerm Type -> TTerm TypeScheme-poly params t = Phantoms.record _TypeScheme [- Phantoms.field _TypeScheme_variables (Phantoms.list (name <$> params)),- Phantoms.field _TypeScheme_type t]---- | Create a term-encoded type variable--- Example: var "a"-var :: String -> TTerm Type-var = typeVariable . name---- * Literals---- | Create a term-encoded boolean type--- Example: boolean-boolean :: TTerm Type-boolean = typeLiteral literalTypeBoolean---- | Create a term-encoded FloatType representation--- Example: float FloatTypeFloat64-float :: FloatType -> TTerm FloatType-float t = Phantoms.unitVariant _FloatType $ case t of- FloatTypeBigfloat -> _FloatType_bigfloat- FloatTypeFloat32 -> _FloatType_float32- FloatTypeFloat64 -> _FloatType_float64---- | Create a term-encoded 32-bit floating point type--- Example: float32-float32 :: TTerm Type-float32 = typeLiteral $ literalTypeFloat $ float FloatTypeFloat32---- | Create a term-encoded 64-bit floating point type--- Example: float64-float64 :: TTerm Type-float64 = typeLiteral $ literalTypeFloat $ float FloatTypeFloat64---- | Create a term-encoded 16-bit signed integer type--- Example: int16-int16 :: TTerm Type-int16 = typeLiteral $ literalTypeInteger integerTypeInt16---- | Create a term-encoded 32-bit signed integer type--- Example: int32-int32 :: TTerm Type-int32 = typeLiteral $ literalTypeInteger integerTypeInt32---- | Create a term-encoded 64-bit signed integer type--- Example: int64-int64 :: TTerm Type-int64 = typeLiteral $ literalTypeInteger integerTypeInt64---- | Create a term-encoded IntegerType representation--- Example: integer IntegerTypeInt32-integer :: IntegerType -> TTerm IntegerType-integer t = Phantoms.unitVariant _IntegerType $ case t of- IntegerTypeBigint -> _IntegerType_bigint- IntegerTypeInt8 -> _IntegerType_int8- IntegerTypeInt16 -> _IntegerType_int16- IntegerTypeInt32 -> _IntegerType_int32- IntegerTypeInt64 -> _IntegerType_int64- IntegerTypeUint8 -> _IntegerType_uint8- IntegerTypeUint16 -> _IntegerType_uint16- IntegerTypeUint32 -> _IntegerType_uint32- IntegerTypeUint64 -> _IntegerType_uint64---- | Create a term-encoded string type--- Example: string-string :: TTerm Type-string = typeLiteral literalTypeString---- | Create a term-encoded 64-bit unsigned integer type--- Example: uint64-uint64 :: TTerm Type-uint64 = typeLiteral $ literalTypeInteger integerTypeUint64---- * Collections---- | Create a term-encoded list type--- Example: list string-list :: TTerm Type -> TTerm Type-list = typeList---- | Create a term-encoded map/dictionary type--- Example: map string int32-map :: TTerm Type -> TTerm Type -> TTerm Type-map k v = typeMap $ mapType k v---- | Create a term-encoded optional (nullable) type--- Example: optional string-optional :: TTerm Type -> TTerm Type-optional = typeOptional---- | Create a term-encoded set type--- Example: set string-set :: TTerm Type -> TTerm Type-set = typeSet---- * Records and unions---- | Create a term-encoded record type with named fields--- Example: record (name "Person") ["name">: string, "age">: int32]-record :: TTerm Name -> [(TTerm Name, TTerm Type)] -> TTerm Type-record name pairs = typeRecord $ rowType name $ Phantoms.list (toField <$> pairs)- where- toField (n, t) = fieldType n t---- | Create a term-encoded union type with named variants--- Example: union (name "Result") ["success">: int32, "error">: string]-union :: TTerm Name -> [(TTerm Name, TTerm Type)] -> TTerm Type-union name pairs = typeUnion $ rowType name $ Phantoms.list (toField <$> pairs)- where- toField (n, t) = fieldType n t---- | Term-encoded unit type (empty record type)--- Example: unit-unit :: TTerm Type-unit = typeUnit---- * Products and sums---- | Create a term-encoded pair (2-tuple) type--- Example: pair string int32-pair :: TTerm Type -> TTerm Type -> TTerm Type-pair l r = product [l, r]---- | Create a term-encoded product type (tuple) with multiple components--- Example: product [string, int32, boolean]-product :: [TTerm Type] -> TTerm Type-product types = Core.typeProduct $ TTerm $ TermList (unTTerm <$> types)---- | Create a term-encoded sum type (disjoint union) with multiple variants--- Example: sum [string, int32, boolean]-sum :: [TTerm Type] -> TTerm Type-sum types = Core.typeSum $ TTerm $ TermList (unTTerm <$> types)
src/main/haskell/Hydra/Dsl/Tabular.hs view
@@ -1,16 +1,11 @@+-- | DSL helpers for constructing tabular (relational) schemas+ module Hydra.Dsl.Tabular where import Hydra.Core import Hydra.Relational---data ColumnType = ColumnType {- columnTypeName :: ColumnName,- columnTypeType :: Type} deriving (Eq, Ord, Show)+import Hydra.Tabular -data TableType = TableType {- tableTypeName :: RelationName,- tableTypeColumns :: [ColumnType]} deriving (Eq, Ord, Show) columnType :: String -> Type -> ColumnType columnType name typ = ColumnType (ColumnName name) typ
src/main/haskell/Hydra/Dsl/Terms.hs view
@@ -4,20 +4,19 @@ import Hydra.Constants import Hydra.Core import Hydra.Graph-import Hydra.Mantle-import Hydra.Dsl.Common+import Hydra.Util+import Hydra.Dsl.Meta.Common import qualified Hydra.Dsl.Literals as Literals -import Prelude hiding (map, product, sum)+import Prelude hiding (map, product) import Data.Int+import qualified Data.ByteString as B import qualified Data.Char as C import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S --- * Operators- -- | Function composition operator: f <.> g creates a function that applies g then f -- Example: var "stringLength" <.> var "toString" (<.>) :: Term -> Term -> Term@@ -34,8 +33,6 @@ (>:) :: String -> Term -> Field name>: term = field name term --- * Fundamentals- -- | Attach an annotation to a term -- Example: annot (M.fromList [(Name "comment", string "A User ID")]) (var "userId") annot :: M.Map Name Term -> Term -> Term@@ -51,86 +48,9 @@ apply :: Term -> Term -> Term apply fun arg = TermApplication $ Application fun arg -applyAll :: Term -> [Term] -> Term-applyAll fun args = foldl apply fun args---- | Create a let term with any number of bindings--- Example: lets ["x">: int32 1, "y">: int32 2] (pair (var "x") (var "y"))-lets :: [Field] -> Term -> Term-lets bindings env = TermLet $ Let (toBinding <$> bindings) env- where- toBinding (Field name value) = Binding name value Nothing---- | Create a variable reference--- Example: var "x"-var :: String -> Term-var = TermVariable . Name---- * Functions---- | Compose two functions (apply g then f) to create a new function--- Example: compose (var "stringLength") (var "toString")--- This creates a function equivalent to \x -> stringLength(toString(x))--- Function composition applies right-to-left: (f ∘ g)(x) = f(g(x))-compose :: Term -> Term -> Term-compose f g = lambda "arg_" $ apply f (apply g $ var "arg_")---- | Create a constant function that always returns the same value--- Example: constant true-constant :: Term -> Term-constant = lambda ignoredVariable---- | Identity function-identity :: Term-identity = lambda "x_" $ var "x_"---- | Create a lambda function with one parameter--- Example: lambda "x" (var "x" @@ int32 1)-lambda :: String -> Term -> Term-lambda param body = TermFunction $ FunctionLambda $ Lambda (Name param) Nothing body---- | Create a multi-parameter lambda function (curried)--- Example: lambdas ["x", "y"] (var "add" @@ var "x" @@ var "y")--- This creates the function \x.\y.add x y-lambdas :: [String] -> Term -> Term-lambdas params body = case params of- [] -> body- (h:r) -> lambda h $ lambdas r body---- | Create a lambda function with a given domain--- Example: lambdaTyped "x" Types.int32 (list [var "x"])-lambdaTyped :: String -> Type -> Term -> Term-lambdaTyped param dom body = TermFunction $ FunctionLambda $ Lambda (Name param) (Just dom) body---- | Create a primitive function--- Example: primitive (Name "hydra.lib.strings.length")-primitive :: Name -> Term-primitive = TermFunction . FunctionPrimitive---- * Polymorphism (System F)---- | Create a type abstraction (universal quantification)--- Example: typeLambda [Name "a", Name "b"] (lambdaTyped "f" (Types.function (Types.var "a") (Types.var "b"))--- (lambdaTyped "x" (Types.var "a") (var "f" @@ var "x")))--- This creates a polymorphic term with type variables.--- The example creates a higher-order function with type 'forall a b. (a -> b) -> a -> b',--- which is the polymorphic apply function that works for any types a and b.-typeLambda :: [Name] -> Term -> Term-typeLambda vars body = L.foldl (\b v -> TermTypeLambda $ TypeLambda v b) body vars---- | Apply type arguments to a polymorphic term--- Example: typeApplication (var "map") [Types.int32, Types.string]--- This instantiates a polymorphic function with concrete types.--- For instance, if 'map' has type 'forall a b. (a -> b) -> list a -> list b',--- the example would instantiate it to '(int32 -> string) -> list int32 -> list string'.-typeApplication :: Term -> [Type] -> Term-typeApplication term types = L.foldl (\t ty -> TermTypeApplication $ TypedTerm t ty) term types---- * Literal values---- | Create a binary data literal. The encoding scheme is currently application-dependent.--- Example: binary ""\x48\x65\x00\xff\x20\x7a\x1b\x80"-binary :: String -> Term+-- | Create a binary data literal from a ByteString.+-- Example: binary (B.pack [0x48, 0x65, 0x00, 0xff, 0x20, 0x7a, 0x1b, 0x80])+binary :: B.ByteString -> Term binary = literal . Literals.binary -- | Create a bigfloat literal. Note: in practice, precision is limited to 64 bits (same as Double) in Haskell.@@ -151,10 +71,42 @@ char :: Char -> Term char = int32 . C.ord +comparison :: Comparison -> Term+comparison t = case t of+ ComparisonEqualTo -> injectUnit _Comparison _Comparison_equalTo+ ComparisonLessThan -> injectUnit _Comparison _Comparison_lessThan+ ComparisonGreaterThan -> injectUnit _Comparison _Comparison_greaterThan++-- | Compose two functions (apply g then f) to create a new function+-- Example: compose (var "stringLength") (var "toString")+-- This creates a function equivalent to \x -> stringLength(toString(x))+-- Function composition applies right-to-left: (f ∘ g)(x) = f(g(x))+compose :: Term -> Term -> Term+compose f g = lambda "arg_" $ apply f (apply g $ var "arg_")++-- | Create a constant function that always returns the same value+-- Example: constant true+constant :: Term -> Term+constant = lambda ignoredVariable+ -- | Boolean false literal false :: Term false = boolean False +-- | Create a field with the given name and value+-- Example: field "age" (int32 30)+field :: String -> Term -> Field+field n = Field (Name n)++-- | First element projection function for pairs+first :: Term+first = primitive $ Name "hydra.lib.pairs.first"++-- | Create a floating-point literal with specified precision+-- Example: float (FloatValueFloat32 3.14)+float :: FloatValue -> Term+float = literal . Literals.float+ -- | Create a float32 literal -- Example: float32 3.14 float32 :: Float -> Term@@ -165,11 +117,23 @@ float64 :: Double -> Term float64 = literal . Literals.float64 --- | Create a floating-point literal with specified precision--- Example: float (FloatValueFloat32 3.14)-float :: FloatValue -> Term-float = literal . Literals.float+-- | Identity function+identity :: Term+identity = lambda "x_" $ var "x_" +-- | Create a union value by injecting a value into a specific variant+-- Example: inject (Name "Result") (Name "success") (int32 42)+-- This creates a "Result" union with the "success" variant containing value 42+-- Use this to construct values of union types at runtime+inject :: Name -> Name -> Term -> Term+inject tname fname term = TermUnion $ Injection tname $ Field fname term++-- | Create a unit variant of a union (convenience function)+-- Example: injectUnit (Name "Result") (Name "success")+-- Equivalent to inject but automatically uses unit as the value+injectUnit :: Name -> Name -> Term+injectUnit tname fname = inject tname fname unit+ -- | Create an int8 literal -- Example: int8 127 int8 :: Int8 -> Term@@ -195,85 +159,61 @@ integer :: IntegerValue -> Term integer = literal . Literals.integer --- | Create a term from a literal value--- Example: literal (LiteralString "hello")-literal :: Literal -> Term-literal = TermLiteral---- | Create a string literal--- Example: string "hello world"-string :: String -> Term-string = TermLiteral . LiteralString---- | Boolean true literal-true :: Term-true = boolean True+-- | Create a 'Just' optional value+-- Example: just (string "found")+just :: Term -> Term+just = optional . Just --- | Create a uint8 literal--- Example: uint8 255-uint8 :: Int16 -> Term-uint8 = literal . Literals.uint8+-- | Create a 'Left' either value+-- Example: left (string "error")+left :: Term -> Term+left term = TermEither (Left term) --- | Create a uint16 literal--- Example: uint16 65535-uint16 :: Int -> Term-uint16 = literal . Literals.uint16+-- | Create a lambda function with one parameter+-- Example: lambda "x" (var "x" @@ int32 1)+lambda :: String -> Term -> Term+lambda param body = TermFunction $ FunctionLambda $ Lambda (Name param) Nothing body --- | Create a uint32 literal--- Example: uint32 4294967295-uint32 :: Int64 -> Term-uint32 = literal . Literals.uint32+-- | Create a multi-parameter lambda function (curried)+-- Example: lambdas ["x", "y"] (var "add" @@ var "x" @@ var "y")+-- This creates the function \x.\y.add x y+lambdas :: [String] -> Term -> Term+lambdas params body = case params of+ [] -> body+ (h:r) -> lambda h $ lambdas r body --- | Create a uint64 literal--- Example: uint64 18446744073709551615-uint64 :: Integer -> Term-uint64 = literal . Literals.uint64+-- | Create a lambda function with a given domain+-- Example: lambdaTyped "x" Types.int32 (list [var "x"])+lambdaTyped :: String -> Type -> Term -> Term+lambdaTyped param dom body = TermFunction $ FunctionLambda $ Lambda (Name param) (Just dom) body --- * Collections+-- | Create a let term with any number of bindings+-- Example: lets ["x">: int32 1, "y">: int32 2] (pair (var "x") (var "y"))+lets :: [Field] -> Term -> Term+lets bindings env = TermLet $ Let (toBinding <$> bindings) env+ where+ toBinding (Field name value) = Binding name value Nothing --- | Create a 'Just' optional value--- Example: just (string "found")-just :: Term -> Term-just = optional . Just+letsTyped :: [(String, Term, TypeScheme)] -> Term -> Term+letsTyped bindings env = TermLet $ Let (toBinding <$> bindings) env+ where+ toBinding (name, value, ts) = Binding (Name name) value (Just ts) -- | Create a list of terms -- Example: list [int32 1, int32 2, int32 3] list :: [Term] -> Term list = TermList +-- | Create a term from a literal value+-- Example: literal (LiteralString "hello")+literal :: Literal -> Term+literal = TermLiteral+ -- | Create a map/dictionary term -- Example: map (M.fromList [(string "January", int32 31), (string "February", int32 28)]) map :: M.Map Term Term -> Term map = TermMap --- | Create a 'Nothing' optional value-nothing :: Term-nothing = optional Nothing---- | Create an optional (nullable) term--- Example: optional (Just (string "found"))-optional :: Maybe Term -> Term-optional = TermOptional---- | Create a set of terms--- Example: set (S.fromList [string "a", string "b", string "c"])-set :: S.Set Term -> Term-set = TermSet---- * Records, unions and newtypes---- | Create a field with the given name and value--- Example: field "age" (int32 30)-field :: String -> Term -> Field-field n = Field (Name n)---- | Create a union value by injecting a value into a specific variant--- Example: inject (Name "Result") ("success">: int32 42)--- This creates a "Result" union with the "success" variant containing value 42--- Use this to construct values of union types at runtime-inject :: Name -> Field -> Term-inject tname = TermUnion . Injection tname- -- | Create a pattern match on a union type -- Example: match (Name "Result") (Just (string "unknown")) -- ["success">: lambda "s" (var "processSuccess" @@ var "s"),@@ -283,13 +223,25 @@ match :: Name -> Maybe Term -> [Field] -> Term match tname def fields = TermFunction $ FunctionElimination $ EliminationUnion $ CaseStatement tname def fields --- | Create a pattern match using variant name pairs--- Example: matchWithVariants (Name "Result") Nothing [(Name "success", Name "handleSuccess"), (Name "error", Name "handleError")]-matchWithVariants :: Name -> Maybe Term -> [(Name, Name)] -> Term-matchWithVariants tname def pairs = match tname def (toField <$> pairs)- where- toField (from, to) = Field from $ constant $ unitVariant tname to+-- | Create a 'Nothing' optional value+nothing :: Term+nothing = optional Nothing +-- | Create an optional (nullable) term+-- Example: optional (Just (string "found"))+optional :: Maybe Term -> Term+optional = TermMaybe++-- | Create a pair+-- Example: pair (string "name") (int32 42)+pair :: Term -> Term -> Term+pair a b = TermPair (a, b)++-- | Create a primitive function+-- Example: primitive (Name "hydra.lib.strings.length")+primitive :: Name -> Term+primitive = TermFunction . FunctionPrimitive+ -- | Create a field projection function -- Example: project (Name "Person") (Name "firstName") project :: Name -> Name -> Term@@ -304,78 +256,117 @@ record :: Name -> [Field] -> Term record tname fields = TermRecord $ Record tname fields --- | Unit value (empty record)-unit :: Term-unit = TermUnit+-- | Create a 'Right' either value+-- Example: right (int32 42)+right :: Term -> Term+right term = TermEither (Right term) --- | Create a unit variant of a union--- Example: unitVariant (Name "Result") (Name "success")-unitVariant :: Name -> Name -> Term-unitVariant tname fname = variant tname fname unit+-- | Second element projection function for pairs+second :: Term+second = primitive $ Name "hydra.lib.pairs.second" --- | Create a union variant--- Example: variant (Name "Result") (Name "success") (string "ok")-variant :: Name -> Name -> Term -> Term-variant tname fname term = TermUnion $ Injection tname $ Field fname term+-- | Create a set of terms+-- Example: set (S.fromList [string "a", string "b", string "c"])+set :: S.Set Term -> Term+set = TermSet --- | Create a constant function that produces a unit variant--- Example: withVariant (Name "Result") (Name "success")-withVariant :: Name -> Name -> Term-withVariant tname = constant . unitVariant tname+-- | Create a string literal+-- Example: string "hello world"+string :: String -> Term+string = TermLiteral . LiteralString --- | Create a wrapped term--- Example: wrap (Name "Email") (string "user@example.com")-wrap :: Name -> Term -> Term-wrap name term = TermWrap $ WrappedTerm name term+triple :: Term -> Term -> Term -> Term+triple a b c = pair a (pair b c) --- | Create an unwrap function for a wrapped type--- Example: unwrap (Name "Email")-unwrap :: Name -> Term-unwrap = TermFunction . FunctionElimination . EliminationWrap+-- | Boolean true literal+true :: Term+true = boolean True --- * Products and sums+-- | Create a tuple using nested pairs (deprecated: use pair directly)+-- Example: tuple2 a b creates pair a b+-- Example: tuple3 a b c creates pair a (pair b c)+tuple :: [Term] -> Term+tuple [] = unit+tuple [a] = a+tuple [a, b] = pair a b+tuple (a:rest) = pair a (tuple rest) --- | First element projection function for pairs-first :: Term-first = untuple 2 0+-- | Create a 2-tuple (same as pair)+tuple2 :: Term -> Term -> Term+tuple2 = pair --- | Create a pair (2-tuple)--- Example: pair (string "name") (int32 42)-pair :: Term -> Term -> Term-pair a b = TermProduct [a, b]+tuple3 :: Term -> Term -> Term -> Term+tuple3 a b c = pair a (pair b c) --- | Second element projection function for pairs-second :: Term-second = untuple 2 1+tuple4 :: Term -> Term -> Term -> Term -> Term+tuple4 a b c d = pair a (pair b (pair c d)) --- | Create a sum term--- Example: sum 0 3 (int32 1) represents the first element of a 3-element sum-sum :: Int -> Int -> Term -> Term-sum idx arity term = TermSum $ Sum idx arity term+tuple5 :: Term -> Term -> Term -> Term -> Term -> Term+tuple5 a b c d e = pair a (pair b (pair c (pair d e))) -triple :: Term -> Term -> Term -> Term-triple a b c = tuple [a, b, c]+tyapp :: Term -> Type -> Term+tyapp term typ = TermTypeApplication $ TypeApplicationTerm term typ --- | Create a product (tuple) with multiple components--- Example: product [string "name", int32 42, true]-tuple :: [Term] -> Term-tuple = TermProduct+tyapps = typeApplication -tuple4 :: Term -> Term -> Term -> Term -> Term-tuple4 a b c d = tuple [a, b, c, d]+tylam :: String -> Term -> Term+tylam var body = TermTypeLambda $ TypeLambda (Name var) body -tuple5 :: Term -> Term -> Term -> Term -> Term -> Term-tuple5 a b c d e = tuple [a, b, c, d, e]+tylams :: [String] -> Term -> Term+tylams vars body = L.foldl (\b v -> TermTypeLambda $ TypeLambda (Name v) b) body $ L.reverse vars --- | Create a untyped tuple projection function--- Example: untuple 3 1 Nothing extracts the second element of a 3-tuple-untuple :: Int -> Int -> Term-untuple arity idx = TermFunction $ FunctionElimination $ EliminationProduct $ TupleProjection arity idx Nothing+-- | Create a type abstraction (universal quantification)+-- Example: typeLambda [Name "a", Name "b"] (lambdaTyped "f" (Types.function (Types.var "a") (Types.var "b"))+-- (lambdaTyped "x" (Types.var "a") (var "f" @@ var "x")))+-- This creates a polymorphic term with type variables.+-- The example creates a higher-order function with type 'forall a b. (a -> b) -> a -> b',+-- which is the polymorphic apply function that works for any types a and b.+typeLambda :: [Name] -> Term -> Term+typeLambda vars body = L.foldl (\b v -> TermTypeLambda $ TypeLambda v b) body vars --- | Other+-- | Apply type arguments to a polymorphic term+-- Example: typeApplication (var "map") [Types.int32, Types.string]+-- This instantiates a polymorphic function with concrete types.+-- For instance, if 'map' has type 'forall a b. (a -> b) -> list a -> list b',+-- the example would instantiate it to '(int32 -> string) -> list int32 -> list string'.+typeApplication :: Term -> [Type] -> Term+typeApplication term types = L.foldl (\t ty -> TermTypeApplication $ TypeApplicationTerm t ty) term types -comparison :: Comparison -> Term-comparison t = case t of- ComparisonEqualTo -> unitVariant _Comparison _Comparison_equalTo- ComparisonLessThan -> unitVariant _Comparison _Comparison_lessThan- ComparisonGreaterThan -> unitVariant _Comparison _Comparison_greaterThan+-- | Create a uint8 literal+-- Example: uint8 255+uint8 :: Int16 -> Term+uint8 = literal . Literals.uint8++-- | Create a uint16 literal+-- Example: uint16 65535+uint16 :: Int -> Term+uint16 = literal . Literals.uint16++-- | Create a uint32 literal+-- Example: uint32 4294967295+uint32 :: Int64 -> Term+uint32 = literal . Literals.uint32++-- | Create a uint64 literal+-- Example: uint64 18446744073709551615+uint64 :: Integer -> Term+uint64 = literal . Literals.uint64++-- | Unit value (empty record)+unit :: Term+unit = TermUnit++-- | Create an unwrap function for a wrapped type+-- Example: unwrap (Name "Email")+unwrap :: Name -> Term+unwrap = TermFunction . FunctionElimination . EliminationWrap++-- | Create a variable reference+-- Example: var "x"+var :: String -> Term+var = TermVariable . Name++-- | Create a wrapped term+-- Example: wrap (Name "Email") (string "user@example.com")+wrap :: Name -> Term -> Term+wrap name term = TermWrap $ WrappedTerm name term
− src/main/haskell/Hydra/Dsl/Testing.hs
@@ -1,142 +0,0 @@--- TODO: merge with Hydra.Dsl.Tests-module Hydra.Dsl.Testing where--import Hydra.Kernel-import Hydra.Testing as Testing-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Encode.Core as EncodeCore-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T--import qualified Data.List as L-import qualified Data.Map as M---tag_disabled = Tag "disabled"-tag_disabledForMinimalInference = Tag "disabledForMinimalInference"--expectFailure i tags term = infFailureTest ("#" ++ show i) tags term--expectMono i tags term typ = infTest ("#" ++ show i) tags term $ T.mono typ--expectPoly i tags term params typ = infTest ("#" ++ show i) tags term $ T.poly params typ--groupRef = TTerms.varNamePhantom . bindingName--infFailureTest :: String -> [Tag] -> TTerm Term -> TTerm TestCaseWithMetadata-infFailureTest name tags term = testCaseWithMetadata (Phantoms.string name)- (testCaseInferenceFailure $ inferenceFailureTestCase term) nothing (Phantoms.list $ tag . unTag <$> tags)--infTest :: String -> [Tag] -> TTerm Term -> TTerm TypeScheme -> TTerm TestCaseWithMetadata-infTest name tags term ts = testCaseWithMetadata (Phantoms.string name)- (testCaseInference $ inferenceTestCase term ts) nothing (Phantoms.list $ tag . unTag <$> tags)--isDisabled tcase = tag_disabled `L.elem` Testing.testCaseWithMetadataTags tcase-isDisabledForMinimalInference tcase = tag_disabledForMinimalInference `L.elem` Testing.testCaseWithMetadataTags tcase---- Note: this is a cheat for an encoded map term; consider using the TTerms DSL-mapTermCheat :: [(Term, Term)] -> TTerm Term-mapTermCheat = TTerm . EncodeCore.term . Terms.map . M.fromList--subgroup :: String -> [TTerm TestCaseWithMetadata] -> TTerm TestGroup-subgroup name = tgroup name Nothing []--supergroup :: String -> [TTerm TestGroup] -> TTerm TestGroup-supergroup name subgroups = tgroup name Nothing subgroups []--tag :: String -> TTerm Tag-tag = Phantoms.wrap _Tag . Phantoms.string--tgroup :: String -> Maybe String -> [TTerm TestGroup] -> [TTerm TestCaseWithMetadata] -> TTerm TestGroup-tgroup name mdesc subgroups cases = testGroup (Phantoms.string name) (opt (Phantoms.string <$> mdesc)) (Phantoms.list subgroups) (Phantoms.list cases)--------------------------------------------encodeGroup (TestGroup name desc groups cases) = Terms.record _TestGroup [- Field _TestGroup_name $ Terms.string name,- Field _TestGroup_description $ Terms.optional (Terms.string <$> desc),- Field _TestGroup_subgroups $ Terms.list (encodeGroup <$> groups),- Field _TestGroup_cases $ Terms.list (encodeCaseWithMetadata <$> cases)]-encodeCaseWithMetadata (TestCaseWithMetadata name tcase mdesc tags) = Terms.record _TestCaseWithMetadata [- Field _TestCaseWithMetadata_name $ Terms.string name,- Field _TestCaseWithMetadata_case $ encodeCase tcase,- Field _TestCaseWithMetadata_description $ Terms.optional (Terms.string <$> mdesc),- Field _TestCaseWithMetadata_tags $ Terms.list (Terms.string . unTag <$> tags)]-encodeCase tcase = case tcase of- TestCaseCaseConversion ccase -> Terms.variant _TestCase _TestCase_caseConversion $ encodeCaseConversionTestCase ccase- TestCaseEvaluation ecase -> Terms.variant _TestCase _TestCase_evaluation $ encodeEvaluationTestCase ecase- TestCaseInference icase -> Terms.variant _TestCase _TestCase_inference $ encodeInferenceTestCase icase-encodeCaseConvention c = Terms.unitVariant _CaseConvention $ case c of- CaseConventionLowerSnake -> _CaseConvention_lowerSnake- CaseConventionUpperSnake -> _CaseConvention_upperSnake- CaseConventionCamel -> _CaseConvention_camel- CaseConventionPascal -> _CaseConvention_pascal-encodeCaseConversionTestCase (CaseConversionTestCase fromConvention toConvention fromString toString) = Terms.record _CaseConversionTestCase [- Field _CaseConversionTestCase_fromConvention $ encodeCaseConvention fromConvention,- Field _CaseConversionTestCase_toConvention $ encodeCaseConvention toConvention,- Field _CaseConversionTestCase_fromString $ Terms.string fromString,- Field _CaseConversionTestCase_toString $ Terms.string toString]-encodeEvaluationTestCase (EvaluationTestCase style input output) = Terms.record _EvaluationTestCase [- Field _EvaluationTestCase_evaluationStyle $ Terms.variant _EvaluationStyle (case style of- EvaluationStyleEager -> _EvaluationStyle_eager- EvaluationStyleLazy -> _EvaluationStyle_lazy) Terms.unit,- Field _EvaluationTestCase_input $ EncodeCore.term input,- Field _EvaluationTestCase_output $ EncodeCore.term output]-encodeInferenceTestCase (InferenceTestCase input output) = Terms.record _InferenceTestCase [- Field _InferenceTestCase_input $ EncodeCore.term input,- Field _InferenceTestCase_output $ EncodeCore.typeScheme output]--------------------------------------------encodedTestGroupToBinding :: Namespace -> String -> TTerm TestGroup -> Binding-encodedTestGroupToBinding ns lname group = Binding name (unTTerm group)- $ Just $ TypeScheme [] typ- where- name = unqualifyName $ QualifiedName (Just ns) lname- typ = TypeVariable _TestGroup--inferenceFailureTestCase :: TTerm Term -> TTerm InferenceFailureTestCase-inferenceFailureTestCase input = Phantoms.record _InferenceFailureTestCase [- _InferenceFailureTestCase_input>>: input]--inferenceTestCase :: TTerm Term -> TTerm TypeScheme -> TTerm InferenceTestCase-inferenceTestCase input output = Phantoms.record _InferenceTestCase [- _InferenceTestCase_input>>: input,- _InferenceTestCase_output>>: output]--testCaseInference :: TTerm InferenceTestCase -> TTerm TestCase-testCaseInference = variant _TestCase _TestCase_inference--testCaseInferenceFailure :: TTerm InferenceFailureTestCase -> TTerm TestCase-testCaseInferenceFailure = variant _TestCase _TestCase_inferenceFailure--testCaseWithMetadata :: TTerm String -> TTerm TestCase -> TTerm (Maybe String) -> TTerm [Tag] -> TTerm TestCaseWithMetadata-testCaseWithMetadata name tcase description tags = Phantoms.record _TestCaseWithMetadata [- _TestCaseWithMetadata_name>>: name,- _TestCaseWithMetadata_case>>: tcase,- _TestCaseWithMetadata_description>>: description,- _TestCaseWithMetadata_tags>>: tags]--testCaseWithMetadataName :: TTerm (TestCaseWithMetadata -> String)-testCaseWithMetadataName = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_name--testCaseWithMetadataCase :: TTerm (TestCaseWithMetadata -> TestCase)-testCaseWithMetadataCase = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_case--testCaseWithMetadataDescription :: TTerm (TestCaseWithMetadata -> Maybe String)-testCaseWithMetadataDescription = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_description--testCaseWithMetadataTags :: TTerm (TestCaseWithMetadata -> [Tag])-testCaseWithMetadataTags = Phantoms.project _TestCaseWithMetadata _TestCaseWithMetadata_tags--testGroup :: TTerm String -> TTerm (Maybe String) -> TTerm [TestGroup] -> TTerm [TestCaseWithMetadata] -> TTerm TestGroup-testGroup name description subgroups cases = Phantoms.record _TestGroup [- _TestGroup_name>>: name,- _TestGroup_description>>: description,- _TestGroup_subgroups>>: subgroups,- _TestGroup_cases>>: cases]--testGroupToBinding :: Namespace -> String -> TestGroup -> Binding-testGroupToBinding ns lname group = encodedTestGroupToBinding ns lname (TTerm $ encodeGroup group)
src/main/haskell/Hydra/Dsl/Tests.hs view
@@ -1,3 +1,5 @@+-- | Convenience functions for writing Hydra test cases+ module Hydra.Dsl.Tests ( module Hydra.Testing, module Hydra.Sources.Libraries,
− src/main/haskell/Hydra/Dsl/Topology.hs
@@ -1,103 +0,0 @@-module Hydra.Dsl.Topology where--import Hydra.Kernel-import Hydra.Dsl.Phantoms-import Hydra.Topology as Topology--import qualified Data.Map as M-import qualified Data.Set as S---orderingIsomorphism :: TTerm ([a] -> [a])- -> TTerm ([a] -> [a])- -> TTerm (Topology.OrderingIsomorphism a)-orderingIsomorphism encode decode = record _OrderingIsomorphism [- _OrderingIsomorphism_encode>>: encode,- _OrderingIsomorphism_decode>>: decode]--tarjanState :: TTerm Int- -> TTerm (M.Map Vertex Int)- -> TTerm (M.Map Vertex Int)- -> TTerm [Vertex]- -> TTerm (S.Set Vertex)- -> TTerm [[Vertex]]- -> TTerm TarjanState-tarjanState counter indices lowLinks stack onStack sccs = record _TarjanState [- _TarjanState_counter>>: counter,- _TarjanState_indices>>: indices,- _TarjanState_lowLinks>>: lowLinks,- _TarjanState_stack>>: stack,- _TarjanState_onStack>>: onStack,- _TarjanState_sccs>>: sccs]--tarjanStateCounter :: TTerm TarjanState -> TTerm Int-tarjanStateCounter ts = project _TarjanState _TarjanState_counter @@ ts--tarjanStateIndices :: TTerm TarjanState -> TTerm (M.Map Vertex Int)-tarjanStateIndices ts = project _TarjanState _TarjanState_indices @@ ts--tarjanStateLowLinks :: TTerm TarjanState -> TTerm (M.Map Vertex Int)-tarjanStateLowLinks ts = project _TarjanState _TarjanState_lowLinks @@ ts--tarjanStateStack :: TTerm TarjanState -> TTerm [Vertex]-tarjanStateStack ts = project _TarjanState _TarjanState_stack @@ ts--tarjanStateOnStack :: TTerm TarjanState -> TTerm (S.Set Vertex)-tarjanStateOnStack ts = project _TarjanState _TarjanState_onStack @@ ts--tarjanStateSccs :: TTerm TarjanState -> TTerm [[Vertex]]-tarjanStateSccs ts = project _TarjanState _TarjanState_sccs @@ ts--tarjanStateWithCounter :: TTerm TarjanState -> TTerm Int -> TTerm TarjanState-tarjanStateWithCounter ts counter = tarjanState- counter- (Hydra.Dsl.Topology.tarjanStateIndices ts)- (Hydra.Dsl.Topology.tarjanStateLowLinks ts)- (Hydra.Dsl.Topology.tarjanStateStack ts)- (Hydra.Dsl.Topology.tarjanStateOnStack ts)- (Hydra.Dsl.Topology.tarjanStateSccs ts)--tarjanStateWithIndices :: TTerm TarjanState -> TTerm (M.Map Vertex Int) -> TTerm TarjanState-tarjanStateWithIndices ts indices = tarjanState- (Hydra.Dsl.Topology.tarjanStateCounter ts)- indices- (Hydra.Dsl.Topology.tarjanStateLowLinks ts)- (Hydra.Dsl.Topology.tarjanStateStack ts)- (Hydra.Dsl.Topology.tarjanStateOnStack ts)- (Hydra.Dsl.Topology.tarjanStateSccs ts)--tarjanStateWithLowLinks :: TTerm TarjanState -> TTerm (M.Map Vertex Int) -> TTerm TarjanState-tarjanStateWithLowLinks ts lowLinks = tarjanState- (Hydra.Dsl.Topology.tarjanStateCounter ts)- (Hydra.Dsl.Topology.tarjanStateIndices ts)- lowLinks- (Hydra.Dsl.Topology.tarjanStateStack ts)- (Hydra.Dsl.Topology.tarjanStateOnStack ts)- (Hydra.Dsl.Topology.tarjanStateSccs ts)--tarjanStateWithStack :: TTerm TarjanState -> TTerm [Vertex] -> TTerm TarjanState-tarjanStateWithStack ts stack = tarjanState- (Hydra.Dsl.Topology.tarjanStateCounter ts)- (Hydra.Dsl.Topology.tarjanStateIndices ts)- (Hydra.Dsl.Topology.tarjanStateLowLinks ts)- stack- (Hydra.Dsl.Topology.tarjanStateOnStack ts)- (Hydra.Dsl.Topology.tarjanStateSccs ts)--tarjanStateWithOnStack :: TTerm TarjanState -> TTerm (S.Set Vertex) -> TTerm TarjanState-tarjanStateWithOnStack ts onStack = tarjanState- (Hydra.Dsl.Topology.tarjanStateCounter ts)- (Hydra.Dsl.Topology.tarjanStateIndices ts)- (Hydra.Dsl.Topology.tarjanStateLowLinks ts)- (Hydra.Dsl.Topology.tarjanStateStack ts)- onStack- (Hydra.Dsl.Topology.tarjanStateSccs ts)--tarjanStateWithSccs :: TTerm TarjanState -> TTerm [[Vertex]] -> TTerm TarjanState-tarjanStateWithSccs ts sccs = tarjanState- (Hydra.Dsl.Topology.tarjanStateCounter ts)- (Hydra.Dsl.Topology.tarjanStateIndices ts)- (Hydra.Dsl.Topology.tarjanStateLowLinks ts)- (Hydra.Dsl.Topology.tarjanStateStack ts)- (Hydra.Dsl.Topology.tarjanStateOnStack ts)- sccs
src/main/haskell/Hydra/Dsl/Types.hs view
@@ -1,96 +1,59 @@ -- | A domain-specific language for constructing Hydra types in Haskell. module Hydra.Dsl.Types where +import Prelude hiding (maybe, product)+ import Hydra.Core-import Hydra.Dsl.Common+import Hydra.Dsl.AsType+import Hydra.Dsl.Meta.Common import Hydra.Constants import qualified Data.List as L import qualified Data.Map as M+import qualified Data.Set as S --- * Operators+-- Operators -- | Function type constructor with infix syntax--- Example: int32 --> string+-- Example: int32 ~> string -- Use this for more readable function type definitions+infixr 0 ~>+(~>) :: (AsType a, AsType b) => a -> b -> Type+dom ~> cod = function (asType dom) (asType cod)++-- | Function type constructor with infix syntax (deprecated, use ~> instead)+-- Example: int32 --> string infixr 0 -->-(-->) :: Type -> Type -> Type-dom --> cod = function dom cod+(-->) :: (AsType a, AsType b) => a -> b -> Type+dom --> cod = function (asType dom) (asType cod) -- | Type application operator -- Example: list @@ int32-(@@) :: Type -> Type -> Type-fun @@ arg = apply fun arg+(@@) :: (AsType a, AsType b) => a -> b -> Type+fun @@ arg = apply (asType fun) (asType arg) -- | Field definition operator -- Example: "name">: string infixr 0 >:-(>:) :: String -> Type -> FieldType-name>: typ = field name typ+(>:) :: AsType a => String -> a -> FieldType+name>: typ = field name (asType typ) --- * Fundamentals -- | Attach an annotation to a type -- Example: annot (M.fromList [(Name "min", int32 0), (Name "max", int32 100)]) int32-annot :: M.Map Name Term -> Type -> Type-annot ann typ = TypeAnnotated $ AnnotatedType typ ann+annot :: AsType a => M.Map Name Term -> a -> Type+annot ann typ = TypeAnnotated $ AnnotatedType (asType typ) ann -- | Apply a type to a type argument -- Example: apply (var "f") int32-apply :: Type -> Type -> Type-apply lhs rhs = TypeApplication (ApplicationType lhs rhs)+apply :: (AsType a, AsType b) => a -> b -> Type+apply lhs rhs = TypeApplication (ApplicationType (asType lhs) (asType rhs)) -- | Apply a type to multiple type arguments--- Example: applyMany [var "Either", string, int32]-applyMany :: [Type] -> Type-applyMany ts = L.foldl apply (L.head ts) (L.tail ts)---- | Create a type variable with the given name--- Example: var "a"-var :: String -> Type-var = TypeVariable . Name---- * Functions---- | Create a function type--- Example: function int32 string-function :: Type -> Type -> Type-function dom cod = TypeFunction $ FunctionType dom cod---- | Create an n-ary function type--- Example: functionMany [int32, string, boolean]-functionMany :: [Type] -> Type-functionMany ts = L.foldl (\cod dom -> function dom cod) (L.head r) (L.tail r)- where- r = L.reverse ts---- * Polymorphism (System F)---- | Create a universally quantified type (polymorphic type) with a singe variable--- Example: forAll "a" (var "a" --> var "a")--- This creates the polymorphic identity function type: ∀a. a -> a--- Universal quantification introduces type variables that can be used in the body-forAll :: String -> Type -> Type-forAll v body = TypeForall $ ForallType (Name v) body---- | Universal quantification with multiple variables--- Example: forAlls ["a", "b"] (var "a" --> var "b")-forAlls :: [String] -> Type -> Type-forAlls vs body = L.foldr forAll body vs---- | Create a monomorphic type scheme--- Example: mono int32-mono :: Type -> TypeScheme-mono = TypeScheme []---- | Create a polymorphic type scheme with explicit type variables--- Example: poly ["a", "b"] (var "a" --> var "b")--- This represents a type forall a b. a -> b that can be instantiated with different types-poly :: [String] -> Type -> TypeScheme-poly vs t = TypeScheme (Name <$> vs) t---- * Literal types+-- Example: applys (var "Either") [string, int32]+applys :: AsType a => a -> [Type] -> Type+applys t ts = L.foldl apply (asType t) ts -- | Arbitrary-precision floating point type bigfloat :: Type@@ -108,6 +71,26 @@ boolean :: Type boolean = literal LiteralTypeBoolean +-- | Create an either type (a choice between two types)+-- Example: either_ string int32+either_ :: (AsType a, AsType b) => a -> b -> Type+either_ left right = TypeEither $ EitherType (asType left) (asType right)++-- | Create an enum type with the given variant names (conventionally in camelCase)+-- Example: enum ["red", "green", "blue"]+enum :: [String] -> Type+enum names = union $ (`field` unit) <$> names++-- | Create a field with the given name and type+-- Example: field "age" int32+field :: AsType a => String -> a -> FieldType+field fn t = FieldType (Name fn) (asType t)++-- | Create a floating point type with the specified precision+-- Example: float FloatTypeFloat32+float :: FloatType -> Type+float = literal . LiteralTypeFloat+ -- | 32-bit floating point type float32 :: Type float32 = float FloatTypeFloat32@@ -116,11 +99,30 @@ float64 :: Type float64 = float FloatTypeFloat64 --- | Create a floating point type with the specified precision--- Example: float FloatTypeFloat32-float :: FloatType -> Type-float = literal . LiteralTypeFloat+-- | Create a universally quantified type (polymorphic type) with a singe variable+-- Example: forAll "a" (var "a" --> var "a")+-- This creates the polymorphic identity function type: ∀a. a -> a+-- Universal quantification introduces type variables that can be used in the body+forAll :: AsType a => String -> a -> Type+forAll v body = TypeForall $ ForallType (Name v) (asType body) +-- | Universal quantification with multiple variables+-- Example: forAlls ["a", "b"] (var "a" --> var "b")+forAlls :: AsType a => [String] -> a -> Type+forAlls vs body = L.foldr forAll (asType body) vs++-- | Create a function type+-- Example: function int32 string+function :: (AsType a, AsType b) => a -> b -> Type+function dom cod = TypeFunction $ FunctionType (asType dom) (asType cod)++-- | Create an n-ary function type+-- Example: functionMany [int32, string, boolean]+functionMany :: [Type] -> Type+functionMany ts = L.foldl (\cod dom -> function dom cod) (L.head r) (L.tail r)+ where+ r = L.reverse ts+ -- | 8-bit signed integer type int8 :: Type int8 = integer IntegerTypeInt8@@ -142,17 +144,87 @@ integer :: IntegerType -> Type integer = literal . LiteralTypeInteger +-- | List type+-- Example: list string+list :: AsType a => a -> Type+list = TypeList . asType+ -- | Literal primitive type -- Example: literal LiteralTypeString literal :: LiteralType -> Type literal = TypeLiteral +-- | Map/dictionary type with key and value types+-- Example: map string int32+map :: (AsType a, AsType b) => a -> b -> Type+map keys vals = TypeMap $ MapType (asType keys) (asType vals)++-- | Create a monomorphic type scheme+-- Example: mono int32+mono :: AsType a => a -> TypeScheme+mono t = TypeScheme [] (asType t) Nothing+ -- | Non-negative 32-bit integer type -- Currently an alias for int32; intended for semantic annotation -- In future versions, this may include validation constraints nonNegativeInt32 :: Type nonNegativeInt32 = int32 +-- | Maybe (optional/nullable) type+-- Example: maybe string+maybe :: AsType a => a -> Type+maybe = TypeMaybe . asType++-- | Optional (nullable) type (alias for 'maybe')+-- Example: optional string+optional :: AsType a => a -> Type+optional = maybe++-- | Create a pair type+-- Example: pair string int32+pair :: (AsType a, AsType b) => a -> b -> Type+pair first second = TypePair $ PairType (asType first) (asType second)++-- | Create a polymorphic type scheme with explicit type variables+-- Example: poly ["a", "b"] (var "a" --> var "b")+-- This represents a type forall a b. a -> b that can be instantiated with different types+poly :: AsType a => [String] -> a -> TypeScheme+poly vs t = TypeScheme (Name <$> vs) (asType t) Nothing++-- | Create a polymorphic type scheme with explicit type variables and constraints+-- Example: polyConstrained [("a", [Name "hydra.core.Eq"])] (var "a" --> var "a" --> boolean)+-- This represents a type forall a. (Eq a) => a -> a -> Boolean+polyConstrained :: AsType a => [(String, [Name])] -> a -> TypeScheme+polyConstrained vsWithConstraints t = TypeScheme vars (asType t) (Just constraintMap)+ where+ vars = Name . fst <$> vsWithConstraints+ constraintMap = M.fromList+ [(Name v, TypeVariableMetadata $ S.fromList classes) | (v, classes) <- vsWithConstraints, not (L.null classes)]++-- | Create a product type using nested pairs (deprecated: use pair directly)+-- Example: product [string, int32, boolean] creates pair string (pair int32 boolean)+product :: [Type] -> Type+product [] = unit+product [a] = a+product [a, b] = pair a b+product (a:rest) = pair a (product rest)++-- | Create a record type with the given fields and the default type name+-- Example: record ["name">: string, "age">: int32]+-- Use 'recordWithName' to specify a custom type name+record :: [FieldType] -> Type+record = recordWithName placeholderName++-- | Create a record type with the given fields and a provided type name+-- Example: recordWithName (Name "Person") ["name" >: string, "age" >: int32]+recordWithName :: Name -> [FieldType] -> Type+recordWithName tname fields = TypeRecord $ RowType tname fields++-- | Set type+-- Example: set string+set :: AsType a => a -> Type+set = TypeSet . asType+ -- | String type string :: Type string = literal LiteralTypeString@@ -173,51 +245,6 @@ uint64 :: Type uint64 = integer IntegerTypeUint64 --- * Collections---- | List type--- Example: list string-list :: Type -> Type-list = TypeList---- | Map/dictionary type with key and value types--- Example: map string int32-map :: Type -> Type -> Type-map keys vals = TypeMap $ MapType keys vals---- | Optional (nullable) type--- Example: optional string-optional :: Type -> Type-optional = TypeOptional---- | Set type--- Example: set string-set :: Type -> Type-set = TypeSet---- * Records, unions and newtypes---- | Create an enum type with the given variant names (conventionally in camelCase)--- Example: enum ["red", "green", "blue"]-enum :: [String] -> Type-enum names = union $ (`field` unit) <$> names---- | Create a field with the given name and type--- Example: field "age" int32-field :: String -> Type -> FieldType-field fn = FieldType (Name fn)---- | Create a record type with the given fields and the default type name--- Example: record ["name">: string, "age">: int32]--- Use 'recordWithName' to specify a custom type name-record :: [FieldType] -> Type-record = recordWithName placeholderName---- | Create a record type with the given fields and a provided type name--- Example: recordWithName (Name "Person") ["name" >: string, "age" >: int32]-recordWithName :: Name -> [FieldType] -> Type-recordWithName tname fields = TypeRecord $ RowType tname fields- -- | Unit type (empty record type) unit :: Type unit = TypeUnit@@ -229,30 +256,23 @@ union :: [FieldType] -> Type union fields = TypeUnion $ RowType placeholderName fields +-- | Create a type variable with the given name+-- Example: variable "a"+variable :: String -> Type+variable = TypeVariable . Name++-- | Create a type variable with the given name (alias for 'variable')+-- Example: var "a"+var :: String -> Type+var = variable+ -- | Create a wrapped type (newtype) with a provided base type and the default type name -- Example: wrap string -- Creates a newtype with placeholder name; use 'wrapWithName' for custom names-wrap :: Type -> Type+wrap :: AsType a => a -> Type wrap = wrapWithName placeholderName -- | Create a wrapped type (newtype) with a provided base type and type name -- Example: wrapWithName (Name "Email") string-wrapWithName :: Name -> Type -> Type-wrapWithName name t = TypeWrap $ WrappedType name t---- * Products and sums---- | Create a pair (2-tuple) type--- Example: pair string int32-pair :: Type -> Type -> Type-pair a b = TypeProduct [a, b]---- | Create a product type (tuple) with multiple components--- Example: product [string, int32, boolean]-product :: [Type] -> Type-product = TypeProduct---- | Create a sum type (disjoint union) with multiple variants--- Example: sum [string, int32, boolean]-sum :: [Type] -> Type-sum = TypeSum+wrapWithName :: AsType a => Name -> a -> Type+wrapWithName name t = TypeWrap $ WrappedType name (asType t)
− src/main/haskell/Hydra/Dsl/Typing.hs
@@ -1,112 +0,0 @@-module Hydra.Dsl.Typing where--import Hydra.Kernel-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Terms as Terms--import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y-import Data.Int-import Prelude hiding (map, product, sum)---inferenceContext- :: TTerm (M.Map Name TypeScheme)- -> TTerm (M.Map Name TypeScheme)- -> TTerm (M.Map Name TypeScheme)- -> TTerm Bool- -> TTerm InferenceContext-inferenceContext schemaTypes primitiveTypes dataTypes debug = Phantoms.record _InferenceContext [- _InferenceContext_schemaTypes>>: schemaTypes,- _InferenceContext_primitiveTypes>>: primitiveTypes,- _InferenceContext_dataTypes>>: dataTypes,- _InferenceContext_debug>>: debug]--inferenceContextSchemaTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)-inferenceContextSchemaTypes ic = Phantoms.project _InferenceContext _InferenceContext_schemaTypes @@ ic--inferenceContextPrimitiveTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)-inferenceContextPrimitiveTypes ic = Phantoms.project _InferenceContext _InferenceContext_primitiveTypes @@ ic--inferenceContextDataTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme)-inferenceContextDataTypes ic = Phantoms.project _InferenceContext _InferenceContext_dataTypes @@ ic--inferenceContextDebug :: TTerm InferenceContext -> TTerm Bool-inferenceContextDebug ic = Phantoms.project _InferenceContext _InferenceContext_debug @@ ic--inferenceContextWithDataTypes :: TTerm InferenceContext -> TTerm (M.Map Name TypeScheme) -> TTerm InferenceContext-inferenceContextWithDataTypes ctx dataTypes = inferenceContext- (Hydra.Dsl.Typing.inferenceContextSchemaTypes ctx)- (Hydra.Dsl.Typing.inferenceContextPrimitiveTypes ctx)- dataTypes- (Hydra.Dsl.Typing.inferenceContextDebug ctx)--inferenceResult :: TTerm Term -> TTerm Type -> TTerm TypeSubst -> TTerm InferenceResult-inferenceResult term type_ subst = Phantoms.record _InferenceResult [- _InferenceResult_term>>: term,- _InferenceResult_type>>: type_,- _InferenceResult_subst>>: subst]--inferenceResultTerm :: TTerm InferenceResult -> TTerm Term-inferenceResultTerm ir = Phantoms.project _InferenceResult _InferenceResult_term @@ ir--inferenceResultType :: TTerm InferenceResult -> TTerm Type-inferenceResultType ir = Phantoms.project _InferenceResult _InferenceResult_type @@ ir--inferenceResultSubst :: TTerm InferenceResult -> TTerm TypeSubst-inferenceResultSubst ir = Phantoms.project _InferenceResult _InferenceResult_subst @@ ir--termSubst :: TTerm (M.Map Name Term) -> TTerm TermSubst-termSubst = Phantoms.wrap _TermSubst--typeConstraint :: TTerm Type -> TTerm Type -> TTerm String -> TTerm TypeConstraint-typeConstraint t1 t2 comment = Phantoms.record _TypeConstraint [- _TypeConstraint_left>>: t1,- _TypeConstraint_right>>: t2,- _TypeConstraint_comment>>: comment]--typeConstraintLeft :: TTerm TypeConstraint -> TTerm Type-typeConstraintLeft tc = Phantoms.project _TypeConstraint _TypeConstraint_left @@ tc--typeConstraintRight :: TTerm TypeConstraint -> TTerm Type-typeConstraintRight tc = Phantoms.project _TypeConstraint _TypeConstraint_right @@ tc--typeConstraintComment :: TTerm TypeConstraint -> TTerm String-typeConstraintComment tc = Phantoms.project _TypeConstraint _TypeConstraint_comment @@ tc--typeContext :: TTerm (M.Map Name Type) -> TTerm (S.Set Name) -> TTerm InferenceContext -> TTerm TypeContext-typeContext types variables inferenceContext = Phantoms.record _TypeContext [- _TypeContext_types>>: types,- _TypeContext_variables>>: variables,- _TypeContext_inferenceContext>>: inferenceContext]--typeContextTypes :: TTerm TypeContext -> TTerm (M.Map Name Type)-typeContextTypes tc = Phantoms.project _TypeContext _TypeContext_types @@ tc--typeContextVariables :: TTerm TypeContext -> TTerm (S.Set Name)-typeContextVariables tc = Phantoms.project _TypeContext _TypeContext_variables @@ tc--typeContextInferenceContext :: TTerm TypeContext -> TTerm InferenceContext-typeContextInferenceContext tc = Phantoms.project _TypeContext _TypeContext_inferenceContext @@ tc--typeContextWithTypes :: TTerm TypeContext -> TTerm (M.Map Name Type) -> TTerm TypeContext-typeContextWithTypes ctx types = typeContext- types- (Hydra.Dsl.Typing.typeContextVariables ctx)- (Hydra.Dsl.Typing.typeContextInferenceContext ctx)--typeContextWithVariables :: TTerm TypeContext -> TTerm (S.Set Name) -> TTerm TypeContext-typeContextWithVariables ctx variables = typeContext- (Hydra.Dsl.Typing.typeContextTypes ctx)- variables- (Hydra.Dsl.Typing.typeContextInferenceContext ctx)--typeSubst :: TTerm (M.Map Name Type) -> TTerm TypeSubst-typeSubst = Phantoms.wrap _TypeSubst--unTermSubst :: TTerm TermSubst -> TTerm (M.Map Name Term)-unTermSubst ts = unwrap _TermSubst @@ ts--unTypeSubst :: TTerm TypeSubst -> TTerm (M.Map Name Type)-unTypeSubst ts = unwrap _TypeSubst @@ ts
src/main/haskell/Hydra/Generation.hs view
@@ -6,36 +6,58 @@ import Hydra.Dsl.Annotations import Hydra.Dsl.Bootstrap import Hydra.Ext.Haskell.Coder-import Hydra.Ext.Org.Json.Coder+import Hydra.Ext.Haskell.Language+import Hydra.Module (_Module)+import qualified Hydra.Json.Model as Json+import qualified Hydra.Json.Writer as JsonWriter import Hydra.Staging.Yaml.Modules+import Hydra.Staging.Yaml.Language import Hydra.Sources.Libraries+import qualified Hydra.Decoding as Decoding+import qualified Hydra.Encoding as Encoding+import qualified Hydra.Sources.All as Sources+import qualified Hydra.Sources.Eval.Lib.All as EvalLib+import qualified Hydra.Sources.Kernel.Types.Core as CoreTypes+import qualified Hydra.CodeGeneration as CodeGeneration import qualified Control.Monad as CM+import qualified Data.Aeson as A+import qualified Data.Aeson.KeyMap as AKM+import qualified Data.Aeson.Key as AK+import qualified Data.ByteString.Lazy as BS+import qualified Data.Scientific as SC+import qualified Data.Vector as V+import Data.Word (Word8) import qualified System.FilePath as FP import qualified Data.List as L+import qualified Data.List.Split as LS import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Text as T import qualified System.Directory as SD import qualified Data.Maybe as Y --- TODO: deprecated-generateSources :: (Module -> Flow Graph (M.Map FilePath String)) -> FilePath -> [Module] -> IO ()-generateSources printModule basePath mods = do- mfiles <- runFlow bootstrapGraph generateFiles+-- | Generate source files and write them to disk.+-- This is a thin I/O wrapper around 'generateSourceFiles'.+generateSources+ :: (Module -> [Definition] -> Flow Graph (M.Map FilePath String))+ -> Language+ -> Bool -- ^ doInfer+ -> Bool -- ^ doExpand+ -> Bool -- ^ doHoistCaseStatements+ -> Bool -- ^ doHoistPolymorphicLetBindings+ -> FilePath+ -> [Module] -- ^ Universe+ -> [Module] -- ^ Modules to generate+ -> IO ()+generateSources printDefinitions lang doInfer doExpand doHoistCaseStatements doHoistPolymorphicLetBindings basePath universeModules modulesToGenerate = do+ mfiles <- runFlow bootstrapGraph $+ CodeGeneration.generateSourceFiles printDefinitions lang doInfer doExpand doHoistCaseStatements doHoistPolymorphicLetBindings bootstrapGraph universeModules modulesToGenerate case mfiles of- Nothing -> fail "Transformation failed"+ Nothing -> fail "Failed to generate source files" Just files -> mapM_ writePair files where- generateFiles = withTrace "generate files" $ withState (modulesToGraph mods) $ do- g <- getState- g1 <- inferGraphTypes g- withState g1 $ do- maps <- CM.mapM forModule $ refreshModule (graphElements g1) <$> mods- return $ L.concat (M.toList <$> maps)- where- refreshModule els mod = mod {- moduleElements = Y.catMaybes ((\e -> M.lookup (bindingName e) els) <$> moduleElements mod)}- writePair (path, s) = do let fullPath = FP.combine basePath path SD.createDirectoryIfMissing True $ FP.takeDirectory fullPath@@ -43,67 +65,10 @@ where withNewline = if L.isSuffixOf "\n" s then s else s ++ "\n" - forModule mod = withTrace ("module " ++ unNamespace (moduleNamespace mod)) $ printModule mod--generateSourcesSimple :: (Module -> [Definition] -> Flow Graph (M.Map FilePath String)) -> Language -> Bool- -> FilePath -> [Module] -> IO ()-generateSourcesSimple printDefinitions lang doExpand basePath mods = do- mschemaFiles <- runFlow bootstrapGraph generateSchemaFiles- case mschemaFiles of- Nothing -> fail "Failed to generate schema files"- Just files -> mapM_ writePair files- mdataFiles <- runFlow bootstrapGraph generateDataFiles- case mdataFiles of- Nothing -> fail "Failed to generate data files"- Just files -> mapM_ writePair files- where- constraints = languageConstraints lang- isTypeElement el = case deannotateTerm (bindingTerm el) of- TermUnion inj -> injectionTypeName inj == _Type- _ -> False- -- Note: we assume that no module contains both type-level and term-level elements- isSchemaModule mod = not $ L.null $ L.filter isTypeElement $ moduleElements mod- (schemaModules, dataModules) = L.partition isSchemaModule mods-- generateSchemaFiles = withTrace "generate schema files" $ do- (tmap, defLists) <- schemaGraphToDefinitions constraints g0 nameLists- withState g0 $ do- maps <- CM.zipWithM forEachModule schemaModules defLists- return $ L.concat (M.toList <$> maps)- where- g0 = modulesToGraph schemaModules- nameLists = fmap (fmap bindingName . moduleElements) schemaModules- forEachModule mod defs = withTrace ("schema module " ++ unNamespace (moduleNamespace mod)) $- printDefinitions mod (fmap DefinitionType defs)-- generateDataFiles = withTrace "generate data files" $ do- (g1, defLists) <- dataGraphToDefinitions constraints doExpand g0 nameLists- withState g1 $ do- maps <- CM.zipWithM forEachModule dataModules defLists- return $ L.concat (M.toList <$> maps)- where- g0 = modulesToGraph dataModules- nameLists = fmap (fmap bindingName . moduleElements) dataModules- forEachModule mod defs = withTrace ("data module " ++ unNamespace (moduleNamespace mod)) $- printDefinitions mod (fmap DefinitionTerm defs)-- writePair (path, s) = do- let fullPath = FP.combine basePath path- SD.createDirectoryIfMissing True $ FP.takeDirectory fullPath- writeFile fullPath withNewline- where- withNewline = if L.isSuffixOf "\n" s then s else s ++ "\n"---- TODO: move into the kernel-modulesToGraph :: [Module] -> Graph-modulesToGraph mods = elementsToGraph parent (Just schemaGraph) dataElements- where- parent = bootstrapGraph- dataElements = L.concat (moduleElements <$> closedMods)- schemaElements = L.concat (moduleElements <$> (L.concat (moduleTypeDependencies <$> closedMods)))- schemaGraph = elementsToGraph bootstrapGraph Nothing schemaElements- closedMods = L.concat (close <$> mods)- close mod = mod:(L.concat (close <$> moduleTermDependencies mod))+-- | Build a graph from a list of modules using the Haskell bootstrapGraph.+-- Thin wrapper around modulesToGraphWith.+modulesToGraph :: [Module] -> [Module] -> Graph+modulesToGraph = CodeGeneration.modulesToGraph bootstrapGraph printTrace :: Bool -> Trace -> IO () printTrace isError t = do@@ -118,11 +83,281 @@ where FlowState v _ t = unFlow f s emptyTrace -writeHaskell :: FilePath -> [Module] -> IO ()-writeHaskell = generateSources moduleToHaskell+-- | Generate Haskell source files from modules.+-- First argument: output directory+-- Second argument: universe modules (all modules for type/term resolution)+-- Third argument: modules to transform and generate+writeHaskell :: FilePath -> [Module] -> [Module] -> IO ()+writeHaskell = generateSources moduleToHaskell haskellLanguage True False False False -- writeJson :: FP.FilePath -> [Module] -> IO () -- writeJson = generateSources Json.printModule -writeYaml :: FP.FilePath -> [Module] -> IO ()-writeYaml = generateSources moduleToYaml+-- | YAML generation - only processes data modules (term definitions), skips schema modules+-- First argument: output directory+-- Second argument: universe modules (all modules for type/term resolution)+-- Third argument: modules to transform and generate+writeYaml :: FP.FilePath -> [Module] -> [Module] -> IO ()+writeYaml basePath universeModules modulesToGenerate = do+ mfiles <- runFlow bootstrapGraph (generateFiles modulesToGenerate)+ case mfiles of+ Nothing -> fail "Failed to generate YAML files"+ Just files -> mapM_ writePair files+ where+ constraints = languageConstraints yamlLanguage+ hasNativeTypes mod = not $ L.null $ L.filter isNativeType $ moduleElements mod++ -- Build the complete universe by computing transitive closure of dependencies+ namespaceMap = M.fromList [(moduleNamespace m, m) | m <- universeModules ++ modulesToGenerate]++ transitiveClosure :: [Module] -> S.Set Namespace+ transitiveClosure startMods = go (S.fromList $ moduleNamespace <$> startMods) S.empty+ where+ go pending visited+ | S.null pending = visited+ | otherwise =+ let newVisited = S.union visited pending+ nextDeps = S.fromList $ concat+ [moduleTermDependencies m ++ moduleTypeDependencies m+ | ns <- S.toList pending+ , Just m <- [M.lookup ns namespaceMap]]+ newPending = S.difference nextDeps newVisited+ in go newPending newVisited++ allNeededNamespaces = transitiveClosure modulesToGenerate+ completeUniverse = [m | ns <- S.toList allNeededNamespaces, Just m <- [M.lookup ns namespaceMap]]+ ++ modulesToGenerate++ generateFiles mods = do+ -- Only process data modules (modules without native types)+ let dataModules = L.filter (not . hasNativeTypes) mods+ if L.null dataModules+ then pure []+ else withTrace "generate YAML files" $ do+ let g0 = modulesToGraph completeUniverse completeUniverse -- Use complete universe for full dependency resolution+ namespaces = fmap moduleNamespace dataModules+ -- Infer types on the data graph before adaptation (eta expansion requires types)+ g0' <- inferGraphTypes g0+ (g1, defLists) <- dataGraphToDefinitions constraints True True False False g0' namespaces+ withState g1 $ do+ maps <- CM.zipWithM forEachModule dataModules defLists+ return $ L.concat (M.toList <$> maps)+ where+ forEachModule mod defs = withTrace ("data module " ++ unNamespace (moduleNamespace mod)) $+ moduleToYaml mod (fmap DefinitionTerm defs)++ writePair (path, contents) = do+ let fullPath = basePath FP.</> path+ SD.createDirectoryIfMissing True $ FP.takeDirectory fullPath+ writeFile fullPath contents++-- | Generate and write the lexicon file (IO wrapper).+writeLexicon :: FilePath -> IO ()+writeLexicon path = do+ mcontent <- runFlow bootstrapGraph+ (CodeGeneration.inferAndGenerateLexicon bootstrapGraph Sources.kernelModules)+ case mcontent of+ Nothing -> fail "Lexicon generation failed"+ Just content -> do+ writeFile path content+ putStrLn $ "Lexicon written to " ++ path++-- | Generate the lexicon to the standard location+writeLexiconToStandardPath :: IO ()+writeLexiconToStandardPath = writeLexicon "../docs/hydra-lexicon.txt"++----------------------------------------++-- | IO wrapper for generateCoderModules. Evaluates the Flow and handles errors.+generateCoderModulesIO :: (Module -> Flow Graph (Maybe Module)) -> String -> [Module] -> [Module] -> IO [Module]+generateCoderModulesIO codec label universeModules typeModules = do+ let graph = modulesToGraph universeModules universeModules+ case graphSchema graph of+ Nothing -> fail "No schema graph available"+ Just schemaGraph -> do+ mresult <- runFlow schemaGraph (CodeGeneration.generateCoderModules codec bootstrapGraph universeModules typeModules)+ case mresult of+ Nothing -> fail $ "Failed to generate " ++ label ++ " modules"+ Just results -> return results++generateDecoderModules :: [Module] -> [Module] -> IO [Module]+generateDecoderModules = generateCoderModulesIO Decoding.decodeModule "decoder"++generateEncoderModules :: [Module] -> [Module] -> IO [Module]+generateEncoderModules = generateCoderModulesIO Encoding.encodeModule "encoder"++----------------------------------------++-- | Generate encoder/decoder Source modules for a list of type modules.+-- These are Source modules that define `module_` bindings containing the encoder Modules as Terms.+generateCoderSourceModules :: ([Module] -> [Module] -> IO [Module]) -> [Module] -> [Module] -> IO [Module]+generateCoderSourceModules generate universeModules typeModules = do+ sourceMods <- generate universeModules typeModules+ return $ fmap CodeGeneration.moduleToSourceModule sourceMods++generateDecoderSourceModules :: [Module] -> [Module] -> IO [Module]+generateDecoderSourceModules = generateCoderSourceModules generateDecoderModules++generateEncoderSourceModules :: [Module] -> [Module] -> IO [Module]+generateEncoderSourceModules = generateCoderSourceModules generateEncoderModules++----------------------------------------++writeCoderSourceHaskell :: ([Module] -> [Module] -> IO [Module]) -> FilePath -> [Module] -> [Module] -> IO ()+writeCoderSourceHaskell generate basePath universeModules typeModules = do+ sourceMods <- generateCoderSourceModules generate universeModules typeModules+ -- The source modules need the Module encoder/decoder and Core types+ writeHaskell basePath (universeModules ++ sourceMods) sourceMods++-- | Write decoder Source modules as Haskell to the given path.+-- These typically go to src/gen-main/haskell/Hydra/Sources/Decode/+writeDecoderSourceHaskell :: FilePath -> [Module] -> [Module] -> IO ()+writeDecoderSourceHaskell = writeCoderSourceHaskell generateDecoderModules++-- | Write encoder Source modules as Haskell to the given path.+-- These typically go to src/gen-main/haskell/Hydra/Sources/Encode/+writeEncoderSourceHaskell :: FilePath -> [Module] -> [Module] -> IO ()+writeEncoderSourceHaskell = writeCoderSourceHaskell generateEncoderModules++----------------------------------------++-- | Write encoder/decoder modules as Haskell to the given path.+-- First argument: generator function for encoder or decoder modules+-- Second argument: output directory+-- Third argument: universe modules (all modules for type/term resolution)+-- Fourth argument: type modules to generate encoders/decoders for+-- Note: This function bypasses type inference; for efficiency, we generate type signatures directly.+writeCoderHaskell :: ([Module] -> [Module] -> IO [Module]) -> FilePath -> [Module] -> [Module] -> IO ()+writeCoderHaskell generate basePath universeModules typeModules = do+ coderMods <- generate universeModules typeModules+ -- Add core types namespace to each encoder/decoder module's type dependencies+ -- since the encoders/decoders reference hydra.core.Term, hydra.core.Injection, etc.+ let withCoreDeps = fmap addCoreDep coderMods+ writeHaskell basePath universeModules withCoreDeps+ where+ addCoreDep m = m { moduleTypeDependencies = CoreTypes.ns : moduleTypeDependencies m }++writeDecoderHaskell :: FilePath -> [Module] -> [Module] -> IO ()+writeDecoderHaskell = writeCoderHaskell generateDecoderModules++writeEncoderHaskell :: FilePath -> [Module] -> [Module] -> IO ()+writeEncoderHaskell = writeCoderHaskell generateEncoderModules++----------------------------------------+-- Module Inference+----------------------------------------++-- | IO wrapper for inferModules. Evaluates the Flow and handles errors.+inferModulesIO :: [Module] -> [Module] -> IO [Module]+inferModulesIO universeMods targetMods = do+ let g0 = modulesToGraph universeMods universeMods+ mresult <- runFlow g0 (CodeGeneration.inferModules bootstrapGraph universeMods targetMods)+ case mresult of+ Nothing -> fail "Type inference failed on modules"+ Just mods -> return mods++----------------------------------------+-- JSON Module Export+----------------------------------------++-- | Write a single module to a JSON file.+-- The file path is derived from the module namespace.+writeModuleJson :: FilePath -> Module -> IO ()+writeModuleJson basePath mod = do+ case CodeGeneration.moduleToJson mod of+ Left err -> fail $ "Failed to convert module to JSON: " ++ unNamespace (moduleNamespace mod) ++ ": " ++ err+ Right jsonStr -> do+ let filePath = basePath FP.</> CodeGeneration.namespaceToPath (moduleNamespace mod) ++ ".json"+ SD.createDirectoryIfMissing True $ FP.takeDirectory filePath+ writeFile filePath (jsonStr ++ "\n")+ putStrLn $ "Wrote: " ++ filePath++-- | Write multiple modules to JSON files.+-- Each module is written to basePath/<namespace-path>.json+-- If doInfer is True, type inference is performed on the modules first.+-- The universe modules are used for type inference context (may include more modules+-- than those being written). If not inferring, the universe is ignored.+writeModulesJson :: Bool -> FilePath -> [Module] -> [Module] -> IO ()+writeModulesJson doInfer basePath universeMods mods = do+ mods' <- if doInfer then inferModulesIO universeMods mods else return mods+ mapM_ (writeModuleJson basePath) mods'++-- | Write a manifest.json listing module namespaces for kernelModules, mainModules, and testModules.+-- This allows Java and Python hosts to load the correct set of modules without directory scanning.+writeManifestJson :: FilePath -> IO ()+writeManifestJson basePath = do+ let jsonVal = Json.ValueObject $ M.fromList [+ ("evalLibModules", namespacesJson EvalLib.evalLibModules),+ ("kernelModules", namespacesJson Sources.kernelModules),+ ("mainModules", namespacesJson Sources.mainModules),+ ("testModules", namespacesJson Sources.testModules)]+ jsonStr = JsonWriter.printJson jsonVal+ filePath = basePath FP.</> "manifest.json"+ writeFile filePath (jsonStr ++ "\n")+ putStrLn $ "Wrote manifest: " ++ filePath+ where+ namespacesJson mods = Json.ValueArray $ fmap (Json.ValueString . unNamespace . moduleNamespace) mods++----------------------------------------+-- JSON Module Import+----------------------------------------++-- | Convert an Aeson JSON value to a Hydra JSON value.+aesonToHydra :: A.Value -> Json.Value+aesonToHydra v = case v of+ A.Object km -> Json.ValueObject $ M.fromList (mapPair <$> AKM.toList km)+ where+ mapPair (k, v') = (AK.toString k, aesonToHydra v')+ A.Array a -> Json.ValueArray (aesonToHydra <$> V.toList a)+ A.String t -> Json.ValueString $ T.unpack t+ A.Number s -> Json.ValueNumber $ SC.toRealFloat s+ A.Bool b -> Json.ValueBoolean b+ A.Null -> Json.ValueNull++-- | Parse a JSON file using Aeson and convert to Hydra JSON.+-- Pre-processes the content to escape control characters that the Hydra JSON writer+-- doesn't escape (e.g. null bytes in string literals).+parseJsonFile :: FilePath -> IO (Either String Json.Value)+parseJsonFile fp = do+ content <- BS.readFile fp+ let escaped = escapeControlCharsInJson content+ return $ aesonToHydra <$> A.eitherDecode escaped++-- | Escape unescaped control characters (< 0x20) inside JSON string literals.+-- Thin ByteString wrapper around CodeGeneration.escapeControlCharsInJson (which operates on [Int]).+escapeControlCharsInJson :: BS.ByteString -> BS.ByteString+escapeControlCharsInJson input =+ BS.pack $ fmap fromIntegral $ CodeGeneration.escapeControlCharsInJson $ fmap fromIntegral $ BS.unpack input++-- | Read a field from manifest.json as a list of Namespaces.+readManifestField :: FilePath -> String -> IO [Namespace]+readManifestField basePath fieldName = do+ let manifestPath = basePath FP.</> "manifest.json"+ parseResult <- parseJsonFile manifestPath+ case parseResult of+ Left err -> fail $ "Failed to parse manifest.json: " ++ err+ Right jsonVal -> case jsonVal of+ Json.ValueObject obj -> case M.lookup fieldName obj of+ Nothing -> fail $ "manifest.json missing field: " ++ fieldName+ Just (Json.ValueArray arr) -> return $ fmap toNamespace arr+ Just _ -> fail $ "manifest.json field " ++ fieldName ++ " is not an array"+ _ -> fail "manifest.json is not a JSON object"+ where+ toNamespace (Json.ValueString s) = Namespace s+ toNamespace _ = error $ "manifest.json: expected string in " ++ fieldName++-- | Load modules from JSON files for a list of namespaces.+-- Uses the universe modules to build the graph for type resolution.+-- When doStripTypeSchemes is True, TypeSchemes are stripped from term bindings.+loadModulesFromJson :: Bool -> FilePath -> [Module] -> [Namespace] -> IO [Module]+loadModulesFromJson doStripTypeSchemes basePath universeModules namespaces = do+ CM.forM namespaces $ \ns -> do+ let filePath = basePath FP.</> CodeGeneration.namespaceToPath ns ++ ".json"+ parseResult <- parseJsonFile filePath+ case parseResult of+ Left err -> fail $ "JSON parse error for " ++ unNamespace ns ++ ": " ++ err+ Right jsonVal -> case CodeGeneration.decodeModuleFromJson bootstrapGraph universeModules doStripTypeSchemes jsonVal of+ Left err -> fail $ "Module decode error for " ++ unNamespace ns ++ ": " ++ err+ Right mod -> do+ putStrLn $ " Loaded: " ++ unNamespace ns+ return mod
src/main/haskell/Hydra/Kernel.hs view
@@ -1,13 +1,18 @@--- | A proxy for the Hydra kernel, i.e. the code which must be present in every Hydra implementation, and can be imported as a unit.+-- | A proxy for the Hydra kernel, i.e. the code which must be present in every Hydra implementation. {- Note: the following modules are part of the kernel, but they are not default imports because of name collisions: - Hydra.Ast - Hydra.Decode.Core-- Hydra.Describe.Core - Hydra.Encode.Core - Hydra.Extract.Core+- Hydra.Extract.Helpers+- Hydra.Extract.Util - Hydra.Grammar - Hydra.Grammars+- Hydra.Json.Parser+- Hydra.Json.Writer+- Hydra.Parsers+- Hydra.Show.Core - Hydra.Topology -} @@ -20,6 +25,8 @@ module Hydra.Adapt.Utils, module Hydra.Annotations, module Hydra.Arity,+ module Hydra.Checking,+ module Hydra.Classes, module Hydra.Coders, module Hydra.Compute, module Hydra.Constants,@@ -32,12 +39,13 @@ module Hydra.Inference, module Hydra.Lexical, module Hydra.Literals,- module Hydra.Mantle, module Hydra.Module,+ module Hydra.Parsing, module Hydra.Phantoms, module Hydra.Names, module Hydra.Query, module Hydra.Reduction,+ module Hydra.Reflect, module Hydra.Relational, module Hydra.Rewriting, module Hydra.Schemas,@@ -47,8 +55,10 @@ module Hydra.Substitution, module Hydra.Tabular, module Hydra.Templates,+ module Hydra.Testing, module Hydra.Typing, module Hydra.Unification,+ module Hydra.Util, module Hydra.Variants, module Hydra.Workflow, ) where@@ -57,10 +67,12 @@ import Hydra.Adapt.Literals import Hydra.Adapt.Modules import Hydra.Adapt.Simple-import Hydra.Adapt.Terms hiding (optionalToList)+import Hydra.Adapt.Terms hiding (maybeToList) import Hydra.Adapt.Utils import Hydra.Annotations import Hydra.Arity+import Hydra.Checking+import Hydra.Classes import Hydra.Coders import Hydra.Compute import Hydra.Constants@@ -73,12 +85,13 @@ import Hydra.Inference import Hydra.Lexical import Hydra.Literals-import Hydra.Mantle hiding (Either) import Hydra.Module+import Hydra.Parsing import Hydra.Phantoms import Hydra.Names import Hydra.Query import Hydra.Reduction+import Hydra.Reflect import Hydra.Relational import Hydra.Rewriting import Hydra.Schemas@@ -88,7 +101,9 @@ import Hydra.Substitution import Hydra.Tabular import Hydra.Templates+import Hydra.Testing import Hydra.Typing import Hydra.Unification+import Hydra.Util import Hydra.Variants import Hydra.Workflow
src/main/haskell/Hydra/Lib/Chars.hs view
@@ -1,24 +1,31 @@--- | Haskell implementations of hydra.lib.chars primitives+-- | Haskell implementations of hydra.lib.chars primitives.+-- All functions operate on Unicode code points (Int) rather than Char. module Hydra.Lib.Chars where import qualified Data.Char as C +-- | Check if a character (as int) is alphanumeric. isAlphaNum :: Int -> Bool isAlphaNum = C.isAlphaNum . C.chr +-- | Check if a character (as int) is lowercase. isLower :: Int -> Bool isLower = C.isLower . C.chr +-- | Check if a character (as int) is whitespace. isSpace :: Int -> Bool isSpace = C.isSpace . C.chr +-- | Check if a character (as int) is uppercase. isUpper :: Int -> Bool isUpper = C.isUpper . C.chr +-- | Convert a character (as int) to lowercase, returning the int value. toLower :: Int -> Int toLower = C.ord . C.toLower . C.chr +-- | Convert a character (as int) to uppercase, returning the int value. toUpper :: Int -> Int toUpper = C.ord . C.toUpper . C.chr
+ src/main/haskell/Hydra/Lib/Eithers.hs view
@@ -0,0 +1,60 @@+-- | Haskell implementations of hydra.lib.eithers primitives++module Hydra.Lib.Eithers where++import qualified Control.Monad as CM+import qualified Data.Bifunctor as BF+import qualified Data.Either as E+++-- | Bind (flatMap) for Either: if Right, apply the function; if Left, return unchanged.+bind :: Either a b -> (b -> Either a c) -> Either a c+bind = (>>=)++-- | Map over both sides of an Either value.+bimap :: (a -> c) -> (b -> d) -> Either a b -> Either c d+bimap = BF.bimap++-- | Eliminate an Either value by applying one of two functions.+either :: (a -> c) -> (b -> c) -> Either a b -> c+either = E.either++-- | Extract the Left value, or return a default.+fromLeft :: a -> Either a b -> a+fromLeft = E.fromLeft++-- | Extract the Right value, or return a default.+fromRight :: b -> Either a b -> b+fromRight = E.fromRight++-- | Check if an Either is a Left value.+isLeft :: Either a b -> Bool+isLeft = E.isLeft++-- | Check if an Either is a Right value.+isRight :: Either a b -> Bool+isRight = E.isRight++-- | Extract all Left values from a list of Eithers.+lefts :: [Either a b] -> [a]+lefts = E.lefts++-- | Map a function over the Right side of an Either (standard functor map).+map :: (a -> b) -> Either c a -> Either c b+map = fmap++-- | Map a function returning Either over a list, collecting results or short-circuiting on Left.+mapList :: (a -> Either c b) -> [a] -> Either c [b]+mapList = CM.mapM++-- | Map a function returning Either over a Maybe, or return Right Nothing if Nothing.+mapMaybe :: (a -> Either c b) -> Maybe a -> Either c (Maybe b)+mapMaybe = CM.mapM++-- | Partition a list of Eithers into lefts and rights.+partitionEithers :: [Either a b] -> ([a], [b])+partitionEithers = E.partitionEithers++-- | Extract all Right values from a list of Eithers.+rights :: [Either a b] -> [b]+rights = E.rights
src/main/haskell/Hydra/Lib/Equality.hs view
@@ -2,37 +2,46 @@ module Hydra.Lib.Equality where -import Hydra.Mantle+import Hydra.Util import Data.Int +-- | Compare two values and return a Comparison. compare :: Ord a => a -> a -> Comparison compare x y | x < y = ComparisonLessThan | x > y = ComparisonGreaterThan | otherwise = ComparisonEqualTo +-- | Check if two values are equal. equal :: Eq a => a -> a -> Bool equal = (==) +-- | Check if first value is greater than second. gt :: Ord a => a -> a -> Bool gt = (>) +-- | Check if first value is greater than or equal to second. gte :: Ord a => a -> a -> Bool gte = (>=) +-- | Return the identity of a value. identity :: a -> a identity = id +-- | Check if first value is less than second. lt :: Ord a => a -> a -> Bool lt = (<) +-- | Check if first value is less than or equal to second. lte :: Ord a => a -> a -> Bool lte = (<=) +-- | Return the maximum of two values. max :: Ord a => a -> a -> a max = Prelude.max +-- | Return the minimum of two values. min :: Ord a => a -> a -> a min = Prelude.min
src/main/haskell/Hydra/Lib/Flows.hs view
@@ -24,35 +24,59 @@ -- Primitive functions +-- | Apply a function in a Flow to a value in a Flow (applicative). apply :: Flow s (x -> y) -> Flow s x -> Flow s y apply = (<*>) +-- | Monadic bind for Flow. bind :: Flow s x -> (x -> Flow s y) -> Flow s y bind = Monads.bind +-- | Create a failed Flow with an error message. fail :: String -> Flow s x fail = Monads.fail +-- | Fold over a list with a monadic function.+foldl :: (a -> b -> Flow s a) -> a -> [b] -> Flow s a+foldl = CM.foldM++-- | Map a function over a Flow (functor). map :: (x -> y) -> Flow s x -> Flow s y map = Monads.map +-- | Map a monadic function over the values of a map. mapElems :: Ord k => (v1 -> Flow s v2) -> M.Map k v1 -> Flow s (M.Map k v2) mapElems f m = M.fromList <$> (CM.mapM (\(k, v) -> (,) <$> Monads.pure k <*> f v) $ M.toList m) +-- | Map a monadic function over the keys of a map. mapKeys :: Ord k2 => (k1 -> Flow s k2) -> M.Map k1 v -> Flow s (M.Map k2 v) mapKeys f m = M.fromList <$> (CM.mapM (\(k, v) -> (,) <$> f k <*> Monads.pure v) $ M.toList m) +-- | Map a monadic function over a list. mapList :: (x -> Flow s y) -> [x] -> Flow s [y] mapList = CM.mapM -mapOptional :: (x -> Flow s y) -> Maybe x -> Flow s (Maybe y)-mapOptional = traverse+-- | Map a monadic function over an optional value.+mapMaybe :: (x -> Flow s y) -> Maybe x -> Flow s (Maybe y)+mapMaybe = traverse +-- | Map a monadic function over a set. mapSet :: Ord y => (x -> Flow s y) -> S.Set x -> Flow s (S.Set y) mapSet f xs = S.fromList <$> (CM.mapM f $ S.toList xs) +-- | Lift a value into a Flow. pure :: x -> Flow s x pure = Monads.pure +-- | Sequence a list of Flows into a Flow of a list. sequence :: [Flow s x] -> Flow s [x] sequence = CM.sequence++-- | Try a Flow and use a default value if it fails.+-- This is similar to "catch" - the fallback is used only if the flow fails.+withDefault :: x -> Flow s x -> Flow s x+withDefault fallback flow = Flow $ \s t ->+ let FlowState mResult s' t' = unFlow flow s t+ in case mResult of+ Just result -> FlowState (Just result) s' t'+ Nothing -> FlowState (Just fallback) s t -- Use original state and trace on failure
src/main/haskell/Hydra/Lib/Lists.hs view
@@ -10,105 +10,154 @@ import qualified Data.List as L +-- | Apply a list of functions to a list of values (applicative style). apply :: [a -> b] -> [a] -> [b] apply = (<*>) +-- | Get the element at specified index of a list.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 at :: Int -> [a] -> a at i l = l !! i +-- | Apply a function that returns lists to each element and flatten results. bind :: [a] -> (a -> [b]) -> [b] bind = (>>=) +-- | Concatenate a list of lists. concat :: [[a]] -> [a] concat = L.concat +-- | Concatenate two lists. concat2 :: [a] -> [a] -> [a] concat2 l1 l2 = l1 ++ l2 +-- | Prepend a value to a list. cons :: a -> [a] -> [a] cons = (:) +-- | Drop the first n elements from a list. drop :: Int -> [a] -> [a] drop = L.drop +-- | Drop elements from the beginning of a list while predicate is true. dropWhile :: (a -> Bool) -> [a] -> [a] dropWhile = L.dropWhile +-- | Check if an element is in a list. elem :: Eq a => a -> [a] -> Bool elem = L.elem +-- | Filter a list based on a predicate. filter :: (a -> Bool) -> [a] -> [a] filter = L.filter +-- | Find the first element matching a predicate.+find :: (a -> Bool) -> [a] -> Maybe a+find = L.find++-- | Fold a list from the left. foldl :: (b -> a -> b) -> b -> [a] -> b foldl = L.foldl +-- | Group consecutive equal elements. group :: Eq a => [a] -> [[a]] group = L.group +-- | Get the first element of a list.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 head :: [a] -> a head = L.head +-- | Return all elements except the last one.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 init :: [a] -> [a] init = L.init +-- | Intercalate a list of lists with a separator list between each. intercalate :: [a] -> [[a]] -> [a] intercalate = L.intercalate +-- | Intersperse a value between elements of a list. intersperse :: a -> [a] -> [a] intersperse = L.intersperse +-- | Get the last element of a list.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 last :: [a] -> a last = L.last +-- | Get the length of a list. length :: [a] -> Int length = L.length +-- | Map a function over a list. map :: (a -> b) -> [a] -> [b] map = fmap +-- | Remove duplicate elements from a list. nub :: Eq a => [a] -> [a] nub = L.nub +-- | Check if a list is empty. null :: [a] -> Bool null = L.null +-- | Create a list with a single element. pure :: a -> [a] pure e = [e] +-- | Partition a list based on a predicate.+-- Returns (elements satisfying predicate, elements not satisfying predicate).+partition :: (a -> Bool) -> [a] -> ([a], [a])+partition = L.partition++-- | Create a list with n copies of a value. replicate :: Int -> a -> [a] replicate = L.replicate +-- | Reverse a list. reverse :: [a] -> [a] reverse = L.reverse +-- | Get the first element of a list, returning Nothing if the list is empty.+-- TODO: consider renaming. See https://github.com/CategoricalData/hydra/issues/201 safeHead :: [a] -> Maybe a safeHead [] = Nothing safeHead (x:_) = Just x +-- | Create a single-element list. singleton :: a -> [a] singleton e = [e] +-- | Sort a list. sort :: Ord a => [a] -> [a] sort = L.sort +-- | Sort a list based on a key function. sortOn :: Ord b => (a -> b) -> [a] -> [a] sortOn = L.sortOn +-- | Split a list at the first element where predicate fails. span :: (a -> Bool) -> [a] -> ([a], [a]) span = L.span +-- | Get all elements of a list except the first.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 tail :: [a] -> [a] tail = L.tail +-- | Take the first n elements from a list. take :: Int -> [a] -> [a] take = L.take +-- | Transpose a list of lists. transpose :: [[a]] -> [[a]] transpose = L.transpose +-- | Zip two lists into pairs. zip :: [a] -> [b] -> [(a, b)] zip = L.zip +-- | Zip two lists with a combining function. zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] zipWith = L.zipWith
src/main/haskell/Hydra/Lib/Literals.hs view
@@ -4,143 +4,251 @@ import Data.Int import Text.Read (readMaybe)+import qualified Data.ByteString as B+import qualified Data.ByteString.Base64 as B64+import qualified Data.Text as T+import qualified Data.Text.Encoding as TE +-- Note: These binary conversion functions have two versions:+-- 1. String -> String versions for backward compatibility with current generated code+-- 2. ByteString versions will be used after regenerating Core.hs ++-- | Convert a bigfloat (Double) to a bigint (Integer). bigfloatToBigint :: Double -> Integer bigfloatToBigint = round +-- | Convert a bigfloat (Double) to a float32 (Float). bigfloatToFloat32 :: Double -> Float bigfloatToFloat32 = realToFrac +-- | Convert a bigfloat (Double) to a float64 (Double). bigfloatToFloat64 :: Double -> Double bigfloatToFloat64 = id +-- | Convert a bigint (Integer) to a bigfloat (Double). bigintToBigfloat :: Integer -> Double bigintToBigfloat = fromIntegral +-- | Convert a bigint (Integer) to an int8. bigintToInt8 :: Integer -> Int8 bigintToInt8 = fromIntegral +-- | Convert a bigint (Integer) to an int16. bigintToInt16 :: Integer -> Int16 bigintToInt16 = fromIntegral +-- | Convert a bigint (Integer) to an int32. bigintToInt32 :: Integer -> Int bigintToInt32 = fromIntegral +-- | Convert a bigint (Integer) to an int64. bigintToInt64 :: Integer -> Int64 bigintToInt64 = fromIntegral +-- | Convert a bigint (Integer) to a uint8. bigintToUint8 :: Integer -> Int16 bigintToUint8 = fromIntegral +-- | Convert a bigint (Integer) to a uint16. bigintToUint16 :: Integer -> Int bigintToUint16 = fromIntegral +-- | Convert a bigint (Integer) to a uint32. bigintToUint32 :: Integer -> Int64 bigintToUint32 = fromIntegral +-- | Convert a bigint (Integer) to a uint64. bigintToUint64 :: Integer -> Integer bigintToUint64 = id -binaryToString :: String -> String-binaryToString s = s+-- | Convert binary to a list of byte values (0-255).+binaryToBytes :: B.ByteString -> [Int]+binaryToBytes = fmap fromIntegral . B.unpack +-- | Convert binary to string by base64 encoding.+binaryToString :: B.ByteString -> String+binaryToString = T.unpack . TE.decodeUtf8 . B64.encode++-- | Alias for binaryToString (for compatibility during transition).+binaryToStringBS :: B.ByteString -> String+binaryToStringBS = binaryToString++-- | Convert a float32 (Float) to a bigfloat (Double). float32ToBigfloat :: Float -> Double float32ToBigfloat = realToFrac +-- | Convert a float64 (Double) to a bigfloat (Double). float64ToBigfloat :: Double -> Double float64ToBigfloat = id +-- | Convert an int8 to a bigint (Integer). int8ToBigint :: Int8 -> Integer int8ToBigint = fromIntegral +-- | Convert an int16 to a bigint (Integer). int16ToBigint :: Int16 -> Integer int16ToBigint = fromIntegral +-- | Convert an int32 to a bigint (Integer). int32ToBigint :: Int -> Integer int32ToBigint = fromIntegral +-- | Convert an int64 to a bigint (Integer). int64ToBigint :: Int64 -> Integer int64ToBigint = fromIntegral +-- | Parse a string to a bigfloat (Double). readBigfloat :: String -> Maybe Double readBigfloat s = readMaybe s :: Maybe Double +-- | Parse a string to a bigint (Integer).+readBigint :: String -> Maybe Integer+readBigint s = readMaybe s :: Maybe Integer++-- | Parse a string to a boolean. readBoolean :: String -> Maybe Bool readBoolean s = if s == "true" then Just True else if s == "false" then Just False else Nothing +-- | Parse a string to a float32 (Float). readFloat32 :: String -> Maybe Float readFloat32 s = readMaybe s :: Maybe Float +-- | Parse a string to a float64 (Double). readFloat64 :: String -> Maybe Double readFloat64 s = readMaybe s :: Maybe Double +-- | Parse a string to an int8 (-128 to 127).+readInt8 :: String -> Maybe Int8+readInt8 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= -128 && n <= 127 then Just (fromIntegral n) else Nothing++-- | Parse a string to an int16 (-32768 to 32767).+readInt16 :: String -> Maybe Int16+readInt16 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= -32768 && n <= 32767 then Just (fromIntegral n) else Nothing++-- | Parse a string to an int32. readInt32 :: String -> Maybe Int readInt32 s = readMaybe s :: Maybe Int +-- | Parse a string to an int64. readInt64 :: String -> Maybe Int64 readInt64 s = readMaybe s :: Maybe Int64 +-- | Parse a string literal. readString :: String -> Maybe String readString s = readMaybe s :: Maybe String +-- Note: Hydra uses wider signed types to represent unsigned values without overflow+-- Uint8 -> Int16, Uint16 -> Int, Uint32 -> Int64, Uint64 -> Integer+-- The read functions parse as unsigned and validate the range++-- | Parse a string to a uint8 (0 to 255).+readUint8 :: String -> Maybe Int16+readUint8 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= 0 && n <= 255 then Just (fromIntegral n) else Nothing++-- | Parse a string to a uint16 (0 to 65535).+readUint16 :: String -> Maybe Int+readUint16 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= 0 && n <= 65535 then Just (fromIntegral n) else Nothing++-- | Parse a string to a uint32 (0 to 4294967295).+readUint32 :: String -> Maybe Int64+readUint32 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= 0 && n <= 4294967295 then Just (fromIntegral n) else Nothing++-- | Parse a string to a uint64 (0 to 18446744073709551615).+readUint64 :: String -> Maybe Integer+readUint64 s = do+ n <- readMaybe s :: Maybe Integer+ if n >= 0 && n <= 18446744073709551615 then Just n else Nothing++-- | Convert a bigfloat (Double) to string. showBigfloat :: Double -> String showBigfloat = show +-- | Convert a bigint (Integer) to string. showBigint :: Integer -> String showBigint = show +-- | Convert a boolean to string. showBoolean :: Bool -> String showBoolean b = case b of True -> "true" False -> "false" +-- | Convert a float32 (Float) to string. showFloat32 :: Float -> String showFloat32 = show +-- | Convert a float64 (Double) to string. showFloat64 :: Double -> String showFloat64 = show +-- | Convert an int8 to string. showInt8 :: Int8 -> String showInt8 = show +-- | Convert an int16 to string. showInt16 :: Int16 -> String showInt16 = show +-- | Convert an int32 to string. showInt32 :: Int -> String showInt32 = show +-- | Convert an int64 to string. showInt64 :: Int64 -> String showInt64 = show +-- | Convert a uint8 to string. showUint8 :: Int16 -> String showUint8 = show +-- | Convert a uint16 to string. showUint16 :: Int -> String showUint16 = show +-- | Convert a uint32 to string. showUint32 :: Int64 -> String showUint32 = show +-- | Convert a uint64 to string. showUint64 :: Integer -> String showUint64 = show +-- | Convert a string to a quoted string representation. showString :: String -> String showString = show -stringToBinary :: String -> String-stringToBinary s = s+-- | Convert string to binary by base64 decoding.+-- Returns an empty ByteString if decoding fails.+stringToBinary :: String -> B.ByteString+stringToBinary s = case B64.decode (TE.encodeUtf8 $ T.pack s) of+ Left _ -> B.empty+ Right bs -> bs +-- | Convert a uint8 to a bigint (Integer). uint8ToBigint :: Int16 -> Integer uint8ToBigint = fromIntegral +-- | Convert a uint16 to a bigint (Integer). uint16ToBigint :: Int -> Integer uint16ToBigint = fromIntegral +-- | Convert a uint32 to a bigint (Integer). uint32ToBigint :: Int64 -> Integer uint32ToBigint = fromIntegral +-- | Convert a uint64 to a bigint (Integer). uint64ToBigint :: Integer -> Integer uint64ToBigint = id
src/main/haskell/Hydra/Lib/Logic.hs view
@@ -7,14 +7,18 @@ import Data.Int +-- | Compute the logical AND of two boolean values. and :: Bool -> Bool -> Bool and x y = x && y +-- | Compute a conditional expression. ifElse :: Bool -> a -> a -> a ifElse b x y = if b then x else y +-- | Compute the logical NOT of a boolean value. not :: Bool -> Bool not = Prelude.not +-- | Compute the logical OR of two boolean values. or :: Bool -> Bool -> Bool or x y = x || y
src/main/haskell/Hydra/Lib/Maps.hs view
@@ -5,62 +5,83 @@ import qualified Data.Map as M +-- | Alter a value at a key using a function. The function receives Nothing if the key is absent,+-- or Just the current value if present. Return Nothing to delete, Just to insert/update. alter :: Ord k => (Maybe v -> Maybe v) -> k -> M.Map k v -> M.Map k v alter = M.alter +-- | Map a function over the keys and values of a map. bimap :: (Ord k1, Ord k2) => (k1 -> k2) -> (v1 -> v2) -> M.Map k1 v1 -> M.Map k2 v2 bimap f g = M.fromList . fmap (\(k, v) -> (f k, g v)) . M.toList +-- | Remove a key from a map.+delete :: Ord k => k -> M.Map k v -> M.Map k v+delete = M.delete++-- | Get the values of a map. elems :: M.Map k v -> [v] elems = M.elems +-- | Create an empty map. empty :: M.Map k v empty = M.empty +-- | Filter a map based on values. filter :: Ord k => (v -> Bool) -> M.Map k v -> M.Map k v filter = M.filter +-- | Filter a map based on key-value pairs. filterWithKey :: Ord k => (k -> v -> Bool) -> M.Map k v -> M.Map k v filterWithKey = M.filterWithKey +-- | Lookup a value with a default. findWithDefault :: Ord k => v -> k -> M.Map k v -> v findWithDefault = M.findWithDefault +-- | Create a map from a list of key-value pairs. fromList :: Ord k => [(k, v)] -> M.Map k v fromList = M.fromList +-- | Insert a key-value pair into a map. insert :: Ord k => k -> v -> M.Map k v -> M.Map k v insert = M.insert +-- | Get the keys of a map. keys :: M.Map k v -> [k] keys = M.keys +-- | Lookup a value in a map. lookup :: Ord k => k -> M.Map k v -> Maybe v lookup = M.lookup +-- | Map a function over a map. map :: (v1 -> v2) -> M.Map k v1 -> M.Map k v2 map = fmap +-- | Map a function over the keys of a map. mapKeys :: (Ord k1, Ord k2) => (k1 -> k2) -> M.Map k1 v -> M.Map k2 v mapKeys = M.mapKeys +-- | Check if a key is present in a map. member :: Ord k => k -> M.Map k v -> Bool member = M.member +-- | Check if a map is empty. null :: M.Map k v -> Bool null = M.null -remove :: Ord k => k -> M.Map k v -> M.Map k v-remove = M.delete-+-- | Create a map with a single key-value pair. singleton :: k -> v -> M.Map k v singleton = M.singleton +-- | Get the size of a map. size :: M.Map k v -> Int size = M.size +-- | Convert a map to a list of key-value pairs. toList :: M.Map k v -> [(k, v)] toList = M.toList +-- | Union two maps, with the first taking precedence. union :: Ord k => M.Map k v -> M.Map k v -> M.Map k v union = M.union
src/main/haskell/Hydra/Lib/Math.hs view
@@ -2,27 +2,169 @@ module Hydra.Lib.Math where +import Prelude (Num, Ord, Integral, Enum, Bool, Double, Int, Integer, Float, (.), ($), (+), (-), (*))+import qualified Prelude -neg :: Num a => a -> a-neg = negate +-- | Return the absolute value.+abs :: Num a => a -> a+abs = Prelude.abs++-- | Return the arc cosine of x in radians.+acos :: Double -> Double+acos = Prelude.acos++-- | Return the inverse hyperbolic cosine of x.+acosh :: Double -> Double+acosh = Prelude.acosh++-- | Return the arc sine of x in radians.+asin :: Double -> Double+asin = Prelude.asin++-- | Return the inverse hyperbolic sine of x.+asinh :: Double -> Double+asinh = Prelude.asinh++-- | Return the arc tangent of x in radians.+atan :: Double -> Double+atan = Prelude.atan++-- | Return the arc tangent of y/x in radians, using signs to determine quadrant.+atan2 :: Double -> Double -> Double+atan2 = Prelude.atan2++-- | Return the inverse hyperbolic tangent of x.+atanh :: Double -> Double+atanh = Prelude.atanh++-- | Return the ceiling of x as an integer.+ceiling :: Double -> Integer+ceiling = Prelude.ceiling++-- | Return the cosine of x radians.+cos :: Double -> Double+cos = Prelude.cos++-- | Return the hyperbolic cosine of x.+cosh :: Double -> Double+cosh = Prelude.cosh++-- | Add two numbers. add :: Num a => a -> a -> a add x y = x + y +-- | Divide two integers using integer division.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 div :: Integral a => a -> a -> a div = Prelude.div +-- | Euler's number (e ≈ 2.71828).+e :: Double+e = Prelude.exp 1.0++-- | Check if an integer is even.+even :: Integral a => a -> Bool+even = Prelude.even++-- | Return e raised to the power x.+exp :: Double -> Double+exp = Prelude.exp++-- | Return the floor of x as an integer.+floor :: Double -> Integer+floor = Prelude.floor++-- | Return the natural logarithm of x.+log :: Double -> Double+log = Prelude.log++-- | Return the logarithm of x to the given base.+logBase :: Double -> Double -> Double+logBase = Prelude.logBase++-- | Return the maximum of two values.+max :: Ord a => a -> a -> a+max = Prelude.max++-- | Return the minimum of two values.+min :: Ord a => a -> a -> a+min = Prelude.min++-- | Mathematical modulo.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 mod :: Integral a => a -> a -> a mod = Prelude.mod +-- | Multiply two numbers. mul :: Num a => a -> a -> a mul x y = x * y +-- | Negate a number.+negate :: Num a => a -> a+negate = Prelude.negate++-- | Check if an integer is odd.+odd :: Integral a => a -> Bool+odd = Prelude.odd++-- | Pi (π ≈ 3.14159).+pi :: Double+pi = Prelude.pi++-- | Return x raised to the power y.+pow :: Double -> Double -> Double+pow = (Prelude.**)++-- | Return the predecessor (x - 1).+pred :: Enum a => a -> a+pred = Prelude.pred++-- | Generate a range of values from start to end (inclusive). range :: Enum a => a -> a -> [a] range start end = [start .. end] +-- | Integer remainder.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 rem :: Integral a => a -> a -> a rem = Prelude.rem +-- | Return x rounded to the nearest integer.+round :: Double -> Integer+round = Prelude.round++-- | Return the sign of a number (-1, 0, or 1).+signum :: Num a => a -> a+signum = Prelude.signum++-- | Return the sine of x radians.+sin :: Double -> Double+sin = Prelude.sin++-- | Return the hyperbolic sine of x.+sinh :: Double -> Double+sinh = Prelude.sinh++-- | Return the square root of x.+sqrt :: Double -> Double+sqrt = Prelude.sqrt++-- | Subtract two numbers. sub :: Num a => a -> a -> a sub x y = x - y++-- | Return the successor (x + 1).+succ :: Enum a => a -> a+succ = Prelude.succ++-- | Return the tangent of x radians.+tan :: Double -> Double+tan = Prelude.tan++-- | Return the hyperbolic tangent of x.+tanh :: Double -> Double+tanh = Prelude.tanh++-- | Return x truncated to an integer (towards zero).+truncate :: Double -> Integer+truncate = Prelude.truncate
+ src/main/haskell/Hydra/Lib/Maybes.hs view
@@ -0,0 +1,60 @@+-- | Haskell implementations of hydra.lib.maybes primitives++module Hydra.Lib.Maybes where++import qualified Data.Maybe as Y+++-- | Apply a function to an argument (applicative).+apply :: Y.Maybe (a -> b) -> Y.Maybe a -> Y.Maybe b+apply = (<*>)++-- | Chain operations on optional values, handling Nothing cases automatically.+bind :: Y.Maybe a -> (a -> Y.Maybe b) -> Y.Maybe b+bind = (>>=)++-- | Handle an optional value with different parameter order than maybe.+-- Arguments are: the Maybe value, the default for Nothing, and the function to apply for Just.+cases :: Y.Maybe a -> b -> (a -> b) -> b+cases m n j = Y.maybe n j m++-- | Filter out Nothing values from a list.+cat :: [Y.Maybe a] -> [a]+cat = Y.catMaybes++-- | Compose two Maybe-returning functions (Kleisli composition).+compose :: (a -> Y.Maybe b) -> (b -> Y.Maybe c) -> (a -> Y.Maybe c)+compose f g = \x -> f x >>= g++-- | Extract value from Maybe, assuming it's Just (unsafe).+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201+fromJust :: Y.Maybe a -> a+fromJust = Y.fromJust++-- | Get a value from an optional value, or return a default value.+fromMaybe :: a -> Y.Maybe a -> a+fromMaybe = Y.fromMaybe++-- | Check if a value is Just.+isJust :: Y.Maybe a -> Bool+isJust = Y.isJust++-- | Check if a value is Nothing.+isNothing :: Y.Maybe a -> Bool+isNothing = Y.isNothing++-- | Map a function over an optional value.+map :: (a -> b) -> Y.Maybe a -> Y.Maybe b+map = fmap++-- | Map a function over a list and collect Just results.+mapMaybe :: (a -> Y.Maybe b) -> [a] -> [b]+mapMaybe = Y.mapMaybe++-- | Handle an optional value, with transformation.+maybe :: b -> (a -> b) -> Y.Maybe a -> b+maybe = Y.maybe++-- | Lift a value into the Maybe type.+pure :: a -> Y.Maybe a+pure = Just
− src/main/haskell/Hydra/Lib/Optionals.hs
@@ -1,45 +0,0 @@--- | Haskell implementations of hydra.lib.optionals primitives--module Hydra.Lib.Optionals where--import qualified Data.Maybe as Y---apply :: Y.Maybe (a -> b) -> Y.Maybe a -> Y.Maybe b-apply = (<*>)--bind :: Y.Maybe a -> (a -> Y.Maybe b) -> Y.Maybe b-bind = (>>=)--cases :: Y.Maybe a -> b -> (a -> b) -> b-cases m n j = Y.maybe n j m--cat :: [Y.Maybe a] -> [a]-cat = Y.catMaybes--compose :: (a -> Y.Maybe b) -> (b -> Y.Maybe c) -> (a -> Y.Maybe c)-compose f g = \x -> f x >>= g--fromJust :: Y.Maybe a -> a-fromJust = Y.fromJust--fromMaybe :: a -> Y.Maybe a -> a-fromMaybe = Y.fromMaybe--isJust :: Y.Maybe a -> Bool-isJust = Y.isJust--isNothing :: Y.Maybe a -> Bool-isNothing = Y.isNothing--map :: (a -> b) -> Y.Maybe a -> Y.Maybe b-map = fmap--mapMaybe :: (a -> Y.Maybe b) -> [a] -> [b]-mapMaybe = Y.mapMaybe--maybe :: b -> (a -> b) -> Y.Maybe a -> b-maybe = Y.maybe--pure :: a -> Y.Maybe a-pure = Just
+ src/main/haskell/Hydra/Lib/Pairs.hs view
@@ -0,0 +1,18 @@+-- | Haskell implementations of hydra.lib.pairs primitives++module Hydra.Lib.Pairs where++import qualified Data.Bifunctor as BF+++-- | Map over both elements of a pair.+bimap :: (a -> c) -> (b -> d) -> (a, b) -> (c, d)+bimap = BF.bimap++-- | Get the first element of a pair.+first :: (a, b) -> a+first (x, _) = x++-- | Get the second element of a pair.+second :: (a, b) -> b+second (_, y) = y
src/main/haskell/Hydra/Lib/Sets.hs view
@@ -5,45 +5,60 @@ import qualified Data.Set as S +-- | Delete an element from a set. delete :: Ord x => x -> S.Set x -> S.Set x delete = S.delete +-- | Compute the difference of two sets. difference :: Ord x => S.Set x -> S.Set x -> S.Set x difference = S.difference +-- | Create an empty set. empty :: S.Set x empty = S.empty +-- | Create a set from a list. fromList :: Ord x => [x] -> S.Set x fromList = S.fromList +-- | Insert an element into a set. insert :: Ord x => x -> S.Set x -> S.Set x insert = S.insert +-- | Compute the intersection of two sets. intersection :: Ord x => S.Set x -> S.Set x -> S.Set x intersection = S.intersection +-- | Map a function over a set. -- Note: the presence of a 'map' function does not imply that sets are a functor in Hydra map :: Ord y => (x -> y) -> S.Set x -> S.Set y map f = S.fromList . fmap f . S.toList +-- | Check if an element is in a set. member :: Ord x => x -> S.Set x -> Bool member = S.member +-- | Check if a set is empty. null :: S.Set x -> Bool null = S.null +-- | Create a singleton set.+-- Consider renaming this to Sets.pure, or creating an alias singleton :: x -> S.Set x singleton = S.singleton +-- | Get the size of a set. size :: S.Set x -> Int size = S.size +-- | Convert a set to a list. toList :: Ord x => S.Set x -> [x] toList = S.toList +-- | Compute the union of two sets. union :: Ord x => S.Set x -> S.Set x -> S.Set x union = S.union +-- | Compute the union of multiple sets. unions :: Ord x => [S.Set x] -> S.Set x unions = S.unions
src/main/haskell/Hydra/Lib/Strings.hs view
@@ -7,41 +7,55 @@ import qualified Data.List.Split as LS +-- | Concatenate a list of strings. cat :: [String] -> String cat = L.concat +-- | Concatenate two strings. cat2 :: String -> String -> String cat2 s1 s2 = s1 ++ s2 +-- | Get the character code at a specific index in a string.+-- TODO: partial function. See https://github.com/CategoricalData/hydra/issues/201 charAt :: Int -> String -> Int charAt i s = C.ord (s !! i) +-- | Convert a list of Unicode code points to a string. fromList :: [Int] -> String fromList = fmap C.chr +-- | Intercalate a string between a list of strings. intercalate :: String -> [String] -> String intercalate = L.intercalate +-- | Return the length of a string. length :: String -> Int length = L.length +-- | Split a string into lines. lines :: String -> [String] lines = L.lines +-- | Check if a string is null/empty. null :: String -> Bool null = L.null +-- | Split a string on a delimiter. splitOn :: String -> String -> [String] splitOn = LS.splitOn +-- | Convert a string to a list of Unicode code points. toList :: String -> [Int] toList = fmap C.ord +-- | Convert a string to lowercase. toLower :: String -> String toLower = fmap C.toLower +-- | Convert a string to uppercase. toUpper :: String -> String toUpper = fmap C.toUpper +-- | Join strings with newlines, adding trailing newline. unlines :: [String] -> String unlines = L.unlines
src/main/haskell/Hydra/Minimal.hs view
@@ -20,5 +20,5 @@ ) where import Hydra.Core-import Hydra.Variants+import Hydra.Reflect import Hydra.Dsl.Literals
src/main/haskell/Hydra/Sources/All.hs view
@@ -1,52 +1,64 @@+-- | Aggregates all Hydra source modules (kernel, test, and extension modules)+ module Hydra.Sources.All( module Hydra.Sources.All, module Hydra.Sources.Kernel.Terms.All, module Hydra.Sources.Kernel.Types.All,+ module Hydra.Sources.Test.All, ) where import Hydra.Kernel import Hydra.Sources.Kernel.Terms.All import Hydra.Sources.Kernel.Types.All+import Hydra.Sources.Test.All -import Hydra.Sources.Haskell.Ast-import Hydra.Sources.Haskell.Coder-import Hydra.Sources.Haskell.Language-import Hydra.Sources.Haskell.Operators-import Hydra.Sources.Haskell.Serde-import Hydra.Sources.Haskell.Utils+import qualified Hydra.Sources.CoderUtils as CoderUtils+import qualified Hydra.Sources.Haskell.Ast as HaskellAst+import qualified Hydra.Sources.Haskell.Coder as HaskellCoder+import qualified Hydra.Sources.Haskell.Language as HaskellLanguage+import qualified Hydra.Sources.Haskell.Operators as HaskellOperators+import qualified Hydra.Sources.Haskell.Serde as HaskellSerde+import qualified Hydra.Sources.Haskell.Utils as HaskellUtils+import qualified Hydra.Sources.Json.Bootstrap as JsonBootstrap import qualified Hydra.Sources.Json.Coder as JsonCoder+import qualified Hydra.Sources.Json.Decode as JsonDecode import qualified Hydra.Sources.Json.Decoding as JsonDecoding+import qualified Hydra.Sources.Json.Encode as JsonEncode import qualified Hydra.Sources.Json.Extract as JsonExtract import qualified Hydra.Sources.Json.Language as JsonLanguage-import Hydra.Sources.Test.TestGraph-import Hydra.Sources.Test.TestSuite-import Hydra.Sources.Yaml.Model+import qualified Hydra.Sources.Json.Parser as JsonParser+import qualified Hydra.Sources.Json.Writer as JsonWriter+import qualified Hydra.Sources.Yaml.Model as YamlModel mainModules :: [Module]-mainModules = kernelModules ++ jsonModules ++ otherModules+mainModules = kernelModules ++ haskellModules ++ jsonModules ++ otherModules +kernelModules :: [Module]+kernelModules = kernelTypesModules ++ kernelTermsModules ++ jsonModules++haskellModules :: [Module]+haskellModules = [+ HaskellAst.module_,+ HaskellCoder.module_,+ HaskellLanguage.module_,+ HaskellOperators.module_,+ HaskellSerde.module_,+ HaskellUtils.module_]+ jsonModules :: [Module] jsonModules = [+ JsonBootstrap.module_, JsonCoder.module_,+ JsonDecode.module_, JsonDecoding.module_,+ JsonEncode.module_, JsonExtract.module_,- JsonLanguage.module_]+ JsonLanguage.module_,+ JsonParser.module_,+ JsonWriter.module_] otherModules :: [Module] otherModules = [- haskellAstModule,- haskellCoderModule,- haskellLanguageModule,- haskellOperatorsModule,- haskellSerdeModule,- haskellUtilsModule,- yamlModelModule]--testModules :: [Module]-testModules = [- testGraphModule,- testSuiteModule]--kernelModules :: [Module]-kernelModules = kernelTypesModules ++ kernelTermsModules+ CoderUtils.module_,+ YamlModel.module_]
+ src/main/haskell/Hydra/Sources/CoderUtils.hs view
@@ -0,0 +1,853 @@+-- | Common utilities for language coders, providing shared patterns for term decomposition,+-- environment management, and other cross-language concerns.+--+-- This module is expressed in the Hydra DSL and generates code for all target implementations.++module Hydra.Sources.CoderUtils where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ commentsFromElement,+ commentsFromFieldType,+ gatherApplications,+ gatherArgs,+ gatherArgsWithTypeApps,+ isComplexBinding,+ isComplexTerm,+ isComplexVariable,+ isSimpleAssignment,+ isTrivialTerm,+ normalizeComment)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+++ns :: Namespace+ns = Namespace "hydra.coderUtils"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Annotations.ns, Arity.ns, Checking.ns, Lexical.ns, Monads.ns, Rewriting.ns, Schemas.ns]+ kernelTypesNamespaces $+ Just "Common utilities for language coders, providing shared patterns for term decomposition and analysis."+ where+ elements = [+ -- Simple pure functions first+ toBinding normalizeComment,+ toBinding gatherApplications,+ toBinding gatherArgs,+ toBinding gatherArgsWithTypeApps,+ -- Predicates+ toBinding isSimpleAssignment,+ toBinding isComplexTerm,+ toBinding isComplexVariable,+ toBinding isComplexBinding,+ toBinding isTrivialTerm,+ -- Tail-call optimization detection+ toBinding isSelfTailRecursive,+ toBinding isTailRecursiveInTailPosition,+ -- Flow-based utilities+ toBinding commentsFromElement,+ toBinding commentsFromFieldType,+ -- Function analysis helpers+ toBinding tryTypeOf,+ toBinding bindingMetadata,+ toBinding analyzeFunctionTermWith_finish,+ toBinding analyzeFunctionTermWith_gather,+ toBinding analyzeFunctionTermWith,+ toBinding analyzeFunctionTermNoInferWith_finish,+ toBinding analyzeFunctionTermNoInferWith_gather,+ toBinding analyzeFunctionTermNoInferWith,+ toBinding analyzeFunctionTerm,+ toBinding analyzeFunctionTermInline,+ toBinding analyzeFunctionTermNoInfer,+ -- State management helpers for coders+ toBinding updateCoderMetadata,+ toBinding withUpdatedCoderGraph,+ toBinding withGraphBindings,+ toBinding inCoderGraphContext]+++--------------------------------------------------------------------------------+-- Simple pure functions+--------------------------------------------------------------------------------++-- | Normalize a comment string for consistent output across coders.+-- Strips leading/trailing whitespace and ensures the comment ends with a period.+-- Returns empty string for whitespace-only input.+normalizeComment :: TBinding (String -> String)+normalizeComment = define "normalizeComment" $+ doc "Normalize a comment string for consistent output across coders" $+ "s" ~>+ "stripped" <~ Formatting.stripLeadingAndTrailingWhitespace @@ var "s" $+ Logic.ifElse+ (Strings.null (var "stripped"))+ (string "")+ -- Get the last character by using charAt with (length - 1)+ -- Code point 46 is '.'+ ("lastIdx" <~ Math.sub (Strings.length (var "stripped")) (int32 1) $+ "lastChar" <~ Strings.charAt (var "lastIdx") (var "stripped") $+ Logic.ifElse+ (Equality.equal (var "lastChar") (int32 46))+ (var "stripped")+ (Strings.cat2 (var "stripped") (string ".")))++-- | Recursively gather applications from a term, returning the list of arguments+-- and the base term. Applications are traversed left-to-right, with arguments+-- collected in the order they appear (leftmost first).+--+-- For example, given a term representing @f a b c@, this returns @([a, b, c], f)@.+gatherApplications :: TBinding (Term -> ([Term], Term))+gatherApplications = define "gatherApplications" $+ doc "Gather applications from a term, returning (args, baseTerm)" $+ "term" ~>+ -- Use a local recursive helper with an accumulator+ "go" <~ ("args" ~> "t" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "t")+ (Just $ pair (var "args") (var "t")) [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ var "go" @@ (Lists.cons (var "rhs") (var "args")) @@ var "lhs"]) $+ var "go" @@ (list ([] :: [TTerm Term])) @@ var "term"++-- | Recursively gather applications, type lambdas, and type applications from a term.+-- Returns a pair of (base term, argument list) where the base term has all applications,+-- type lambdas, and type applications removed.+gatherArgs :: TBinding (Term -> [Term] -> (Term, [Term]))+gatherArgs = define "gatherArgs" $+ doc "Gather term arguments, stripping type-level constructs" $+ "term" ~> "args" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just $ pair (var "term") (var "args")) [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ gatherArgs @@ var "lhs" @@ (Lists.cons (var "rhs") (var "args")),+ _Term_typeLambda>>: "tl" ~>+ "body" <~ Core.typeLambdaBody (var "tl") $+ gatherArgs @@ var "body" @@ var "args",+ _Term_typeApplication>>: "ta" ~>+ "body" <~ Core.typeApplicationTermBody (var "ta") $+ gatherArgs @@ var "body" @@ var "args"]++-- | Like gatherArgs but also collects type arguments from TermTypeApplication nodes.+-- Returns (fun, args, typeArgs) where typeArgs are in application order.+gatherArgsWithTypeApps :: TBinding (Term -> [Term] -> [Type] -> (Term, [Term], [Type]))+gatherArgsWithTypeApps = define "gatherArgsWithTypeApps" $+ doc "Gather term and type arguments from a term" $+ "term" ~> "args" ~> "tyArgs" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just $ triple (var "term") (var "args") (var "tyArgs")) [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ gatherArgsWithTypeApps @@ var "lhs" @@ (Lists.cons (var "rhs") (var "args")) @@ var "tyArgs",+ _Term_typeLambda>>: "tl" ~>+ "body" <~ Core.typeLambdaBody (var "tl") $+ gatherArgsWithTypeApps @@ var "body" @@ var "args" @@ var "tyArgs",+ _Term_typeApplication>>: "ta" ~>+ "body" <~ Core.typeApplicationTermBody (var "ta") $+ "typ" <~ Core.typeApplicationTermType (var "ta") $+ gatherArgsWithTypeApps @@ var "body" @@ var "args" @@ (Lists.cons (var "typ") (var "tyArgs"))]+++--------------------------------------------------------------------------------+-- Predicate functions+--------------------------------------------------------------------------------++-- | Determines whether a term can be encoded as a simple assignment (without type annotation).+-- A term is considered a simple assignment if:+-- - It's not a lambda, let, or type lambda+-- - It's not a type application (which introduces polymorphism requiring type signatures)+-- - When peeled of applications, it's not a case statement+isSimpleAssignment :: TBinding (Term -> Bool)+isSimpleAssignment = define "isSimpleAssignment" $+ doc "Check if a term can be encoded as a simple assignment" $+ "term" ~>+ cases _Term (var "term")+ (Just $+ -- Check if the base term (after gathering args) is a union elimination+ "baseTerm" <~ Pairs.first (gatherArgs @@ var "term" @@ list ([] :: [TTerm Term])) $+ cases _Term (var "baseTerm")+ (Just $ boolean True) [+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ boolean True) [+ _Function_elimination>>: "elim" ~>+ cases _Elimination (var "elim")+ (Just $ boolean True) [+ _Elimination_union>>: constant (boolean False)]]]) [+ _Term_annotated>>: "at" ~>+ isSimpleAssignment @@ (Core.annotatedTermBody $ var "at"),+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ boolean True) [+ _Function_lambda>>: constant (boolean False)],+ _Term_let>>: constant (boolean False),+ _Term_typeLambda>>: constant (boolean False),+ _Term_typeApplication>>: "ta" ~>+ isSimpleAssignment @@ (Core.typeApplicationTermBody $ var "ta")]++-- | Determine whether a given term needs to be treated as a (possibly nullary) function,+-- rather than a simple value. The term might be an actual function, or it may have type parameters+-- or internal let bindings, or it may reference complex variables.+isComplexTerm :: TBinding (TypeContext -> Term -> Bool)+isComplexTerm = define "isComplexTerm" $+ doc "Check if a term needs to be treated as a function rather than a simple value" $+ "tc" ~> "t" ~>+ cases _Term (var "t")+ (Just $+ -- Default: check if any subterm is complex+ Lists.foldl+ ("b" ~> "sub" ~> Logic.or (var "b") (isComplexTerm @@ var "tc" @@ var "sub"))+ (boolean False)+ (Rewriting.subterms @@ var "t")) [+ _Term_let>>: constant (boolean True),+ _Term_typeApplication>>: constant (boolean True),+ _Term_typeLambda>>: constant (boolean True),+ _Term_variable>>: "name" ~> isComplexVariable @@ var "tc" @@ var "name"]++-- | Look up a variable to see if it is bound to a complex term+isComplexVariable :: TBinding (TypeContext -> Name -> Bool)+isComplexVariable = define "isComplexVariable" $+ doc "Check if a variable is bound to a complex term" $+ "tc" ~> "name" ~>+ -- Check if there's metadata for this variable (indicates complexity)+ "metaLookup" <~ Maps.lookup (var "name") (Typing.typeContextMetadata $ var "tc") $+ Logic.ifElse+ (Maybes.isJust (var "metaLookup"))+ (boolean True)+ -- Lambda-bound variables are complex because they might be thunked+ (Logic.ifElse+ (Sets.member (var "name") (Typing.typeContextLambdaVariables $ var "tc"))+ (boolean True)+ -- If not in type context, assume mutual recursion (complex)+ ("typeLookup" <~ Maps.lookup (var "name") (Typing.typeContextTypes $ var "tc") $+ Logic.not (Maybes.isJust (var "typeLookup"))))++-- | Check if a binding is complex and needs to be treated as a function+isComplexBinding :: TBinding (TypeContext -> Binding -> Bool)+isComplexBinding = define "isComplexBinding" $+ doc "Check if a binding needs to be treated as a function" $+ "tc" ~> "b" ~>+ "term" <~ Core.bindingTerm (var "b") $+ "mts" <~ Core.bindingType (var "b") $+ -- Bindings without type schemes are complex (e.g., lifted case expressions)+ Maybes.cases (var "mts")+ (isComplexTerm @@ var "tc" @@ var "term") $+ "ts" ~>+ -- Check if polymorphic+ "isPolymorphic" <~ Logic.not (Lists.null (Core.typeSchemeVariables $ var "ts")) $+ -- Check if non-nullary+ "isNonNullary" <~ Equality.gt (Arity.typeArity @@ (Core.typeSchemeType $ var "ts")) (int32 0) $+ -- Check if complex term+ "isComplex" <~ isComplexTerm @@ var "tc" @@ var "term" $+ Logic.or (Logic.or (var "isPolymorphic") (var "isNonNullary")) (var "isComplex")++-- | Check if a term is trivially cheap to evaluate, meaning it needs no thunking.+-- Trivial terms include: literals, plain variable references, field projections+-- on trivial terms (e.g. app.function), unit values, maybe wrappers around trivial terms,+-- and type wrappers around trivial terms.+-- Field projections cause minor regressions in inference/hoisting (~200ms) but yield+-- large gains in checking/annotations/strings (~1500ms), for a net 4.2% improvement.+-- This is a conservative predicate: anything not explicitly recognized is non-trivial.+isTrivialTerm :: TBinding (Term -> Bool)+isTrivialTerm = define "isTrivialTerm" $+ doc "Check if a term is trivially cheap (no thunking needed)" $+ "t" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "t")+ (Just $ boolean False) [+ -- Literals are always trivial+ _Term_literal>>: constant (boolean True),+ -- Plain variables are trivial (the variable itself is cheap to reference)+ _Term_variable>>: constant (boolean True),+ -- Unit is trivial+ _Term_unit>>: constant (boolean True),+ -- Field projection on a trivial subterm is trivial (e.g. app.function)+ _Term_application>>: "app" ~>+ "fun" <~ Core.applicationFunction (var "app") $+ "arg" <~ Core.applicationArgument (var "app") $+ cases _Term (var "fun") (Just $ boolean False) [+ _Term_function>>: "f" ~>+ cases _Function (var "f") (Just $ boolean False) [+ _Function_elimination>>: "e" ~>+ cases _Elimination (var "e") (Just $ boolean False) [+ -- record projection: trivial if the subject is trivial+ _Elimination_record>>: constant (isTrivialTerm @@ var "arg")]]],+ -- Maybe term (just x) where x is trivial; nothing is also trivial+ _Term_maybe>>: "opt" ~>+ Maybes.maybe (boolean True) ("inner" ~> isTrivialTerm @@ var "inner") (var "opt"),+ -- Type applications/lambdas: check the inner term+ _Term_typeApplication>>: "ta" ~> isTrivialTerm @@ (Core.typeApplicationTermBody $ var "ta"),+ _Term_typeLambda>>: "tl" ~> isTrivialTerm @@ (Core.typeLambdaBody $ var "tl")]+++--------------------------------------------------------------------------------+-- Tail-call optimization detection+--------------------------------------------------------------------------------++-- | Check if a term body is self-tail-recursive with respect to a function name.+-- Returns True if the function references itself AND all self-references are in tail position.+-- Note: isFreeVariableInTerm returns True when the variable is NOT present (confusing API).+isSelfTailRecursive :: TBinding (Name -> Term -> Bool)+isSelfTailRecursive = define "isSelfTailRecursive" $+ doc "Check if a term body is self-tail-recursive with respect to a function name" $+ "funcName" ~> "body" ~>+ -- isFreeVariableInTerm returns True when v is NOT free (not present).+ -- So Logic.not means: the name IS present as a free variable.+ "callsSelf" <~ Logic.not (Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "body") $+ Logic.ifElse (var "callsSelf")+ (isTailRecursiveInTailPosition @@ var "funcName" @@ var "body")+ false++-- | Check that all occurrences of funcName in a term are in tail position.+-- Called after confirming funcName IS present in the term.+-- Returns True if the term is safe for TCO transformation.+isTailRecursiveInTailPosition :: TBinding (Name -> Term -> Bool)+isTailRecursiveInTailPosition = define "isTailRecursiveInTailPosition" $+ doc "Check that all self-references are in tail position" $+ "funcName" ~> "term" ~>+ "stripped" <~ (Rewriting.deannotateAndDetypeTerm @@ var "term") $+ cases _Term (var "stripped") (Just $+ -- Default: funcName must NOT appear free in this term (not a recognized tail position)+ Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term") [+ -- Application: check if it's a self-tail-call or a case statement application+ _Term_application>>: "app" ~>+ "gathered" <~ (gatherApplications @@ var "stripped") $+ "gatherArgs" <~ (Pairs.first $ var "gathered") $+ "gatherFun" <~ (Pairs.second $ var "gathered") $+ "strippedFun" <~ (Rewriting.deannotateAndDetypeTerm @@ var "gatherFun") $+ cases _Term (var "strippedFun") (Just $+ -- Unknown function form: funcName must not appear anywhere+ Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term") [+ -- Variable: check if self-call+ _Term_variable>>: "vname" ~>+ Logic.ifElse (Equality.equal (var "vname") (var "funcName"))+ -- Self-call in tail position: args must not contain funcName+ -- and must not contain lambdas (closures over parameters break TCO+ -- because Python closures capture by reference, not by value)+ ("argsNoFunc" <~ (Lists.foldl+ ("ok" ~> "arg" ~>+ Logic.and (var "ok")+ (Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "arg"))+ true+ (var "gatherArgs")) $+ "argsNoLambda" <~ (Lists.foldl+ ("ok" ~> "arg" ~>+ Logic.and (var "ok")+ (Logic.not $ Rewriting.foldOverTerm @@ Coders.traversalOrderPre+ @@ ("found" ~> "t" ~>+ Logic.or (var "found")+ (cases _Term (var "t") (Just false) [+ _Term_function>>: "f2" ~>+ cases _Function (var "f2") (Just false) [+ _Function_lambda>>: "lam" ~>+ -- Any lambda in an argument disqualifies from TCO+ "ignore" <~ (Core.lambdaBody $ var "lam") $+ true]]))+ @@ false+ @@ var "arg"))+ true+ (var "gatherArgs")) $+ Logic.and (var "argsNoFunc") (var "argsNoLambda"))+ -- Not a self-call: funcName must not appear anywhere in the term+ (Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term"),+ -- Function: check for case statement (union elimination)+ _Term_function>>: "f" ~>+ cases _Function (var "f") (Just $+ Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term") [+ _Function_elimination>>: "e" ~>+ cases _Elimination (var "e") (Just $+ Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term") [+ _Elimination_union>>: "cs" ~>+ "cases_" <~ (Core.caseStatementCases $ var "cs") $+ "dflt" <~ (Core.caseStatementDefault $ var "cs") $+ -- All case branches must have funcName only in tail position+ "branchesOk" <~ (Lists.foldl+ ("ok" ~> "field" ~>+ Logic.and (var "ok")+ (isTailRecursiveInTailPosition @@ var "funcName" @@ Core.fieldTerm (var "field")))+ true+ (var "cases_")) $+ -- Default branch (if present) must also be tail-recursive+ "dfltOk" <~ (Maybes.maybe true+ ("d" ~> isTailRecursiveInTailPosition @@ var "funcName" @@ var "d")+ (var "dflt")) $+ -- Arguments to the case statement must NOT contain funcName+ "argsOk" <~ (Lists.foldl+ ("ok" ~> "arg" ~>+ Logic.and (var "ok")+ (Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "arg"))+ true+ (var "gatherArgs")) $+ Logic.and (Logic.and (var "branchesOk") (var "dfltOk")) (var "argsOk")]]],+ -- Lambda: tail position is the body+ _Term_function>>: "f" ~>+ cases _Function (var "f") (Just $+ Rewriting.isFreeVariableInTerm @@ var "funcName" @@ var "term") [+ _Function_lambda>>: "lam" ~>+ isTailRecursiveInTailPosition @@ var "funcName" @@ (Core.lambdaBody $ var "lam")],+ -- Let: tail position is the body; bindings must not contain funcName+ _Term_let>>: "lt" ~>+ "bindingsOk" <~ (Lists.foldl+ ("ok" ~> "b" ~>+ Logic.and (var "ok")+ (Rewriting.isFreeVariableInTerm @@ var "funcName" @@ Core.bindingTerm (var "b")))+ true+ (Core.letBindings $ var "lt")) $+ Logic.and (var "bindingsOk")+ (isTailRecursiveInTailPosition @@ var "funcName" @@ (Core.letBody $ var "lt"))]+++--------------------------------------------------------------------------------+-- Flow-based utilities+--------------------------------------------------------------------------------++-- | Extract comments/description from a Binding (element definition).+-- This is a common pattern for coders that need to preserve documentation.+commentsFromElement :: TBinding (Binding -> Flow Graph (Maybe String))+commentsFromElement = define "commentsFromElement" $+ doc "Extract comments/description from a Binding" $+ "b" ~> Annotations.getTermDescription @@ (Core.bindingTerm $ var "b")++-- | Extract comments/description from a FieldType.+-- This is a common pattern for coders that need to preserve field documentation.+commentsFromFieldType :: TBinding (FieldType -> Flow Graph (Maybe String))+commentsFromFieldType = define "commentsFromFieldType" $+ doc "Extract comments/description from a FieldType" $+ "ft" ~> Annotations.getTypeDescription @@ (Core.fieldTypeType $ var "ft")+++--------------------------------------------------------------------------------+-- Function analysis utilities+--------------------------------------------------------------------------------++-- | Infer the type of a term using the given TypeContext.+-- This is a helper that adds tracing for debugging purposes.+tryTypeOf :: TBinding (String -> TypeContext -> Term -> Flow s Type)+tryTypeOf = define "tryTypeOf" $+ doc "Infer the type of a term with tracing" $+ "msg" ~> "tc" ~> "term" ~>+ Monads.withTrace @@ var "msg" @@ (Checking.typeOf @@ var "tc" @@ list ([] :: [TTerm Type]) @@ var "term")++-- | Produces a simple 'true' value if the binding is complex (needs to be treated as a function)+bindingMetadata :: TBinding (TypeContext -> Binding -> Maybe Term)+bindingMetadata = define "bindingMetadata" $+ doc "Produces metadata for a binding if it is complex" $+ "tc" ~> "b" ~>+ Logic.ifElse+ (isComplexBinding @@ var "tc" @@ var "b")+ (just MetaTerms.true)+ nothing++-- | Internal helper: analyze a function term with a configurable binding metadata function.+-- This is the core implementation used by all analyzeFunctionTerm variants.+--+-- The function peels off lambdas, type lambdas, lets, and type applications,+-- collecting their components into a FunctionStructure. It uses a recursive+-- gather/finish pattern with an argMode flag to track whether we're still+-- collecting lambda parameters (vs. having seen a let which stops parameter collection).+-- | Finish helper for analyzeFunctionTermWith: reapply type applications and infer return type+analyzeFunctionTermWith_finish :: TBinding (+ (env -> TypeContext) ->+ env -> [Name] -> [Name] -> [Binding] -> [Type] -> [Type] -> Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermWith_finish = define "analyzeFunctionTermWith_finish" $+ "getTC" ~> "fEnv" ~> "tparams" ~> "args" ~> "bindings" ~> "doms" ~> "tapps" ~> "body" ~>+ "bodyWithTapps" <~ Lists.foldl+ ("trm" ~> "typ" ~> Core.termTypeApplication (Core.typeApplicationTerm (var "trm") (var "typ")))+ (var "body")+ (var "tapps") $+ "mcod" <<~ Flows.withDefault (nothing :: TTerm (Maybe Type))+ (Flows.map (primitive _maybes_pure) (tryTypeOf @@ string "analyzeFunctionTermWith" @@ (var "getTC" @@ var "fEnv") @@ var "bodyWithTapps")) $+ Flows.pure $ record _FunctionStructure [+ _FunctionStructure_typeParams>>: Lists.reverse (var "tparams"),+ _FunctionStructure_params>>: Lists.reverse (var "args"),+ _FunctionStructure_bindings>>: var "bindings",+ _FunctionStructure_body>>: var "bodyWithTapps",+ _FunctionStructure_domains>>: Lists.reverse (var "doms"),+ _FunctionStructure_codomain>>: var "mcod",+ _FunctionStructure_environment>>: var "fEnv"]++-- | Gather helper for analyzeFunctionTermWith: recursively collect function components+analyzeFunctionTermWith_gather :: TBinding (+ (TypeContext -> Binding -> Maybe Term) ->+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ Bool -> env -> [Name] -> [Name] -> [Binding] -> [Type] -> [Type] -> Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermWith_gather = define "analyzeFunctionTermWith_gather" $+ "forBinding" ~> "getTC" ~> "setTC" ~>+ "argMode" ~> "gEnv" ~> "tparams" ~> "args" ~> "bindings" ~> "doms" ~> "tapps" ~> "t" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "t")+ (Just $ analyzeFunctionTermWith_finish @@ var "getTC" @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t") [+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ analyzeFunctionTermWith_finish @@ var "getTC" @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t") [+ _Function_lambda>>: "lam" ~>+ Logic.ifElse (var "argMode")+ ("v" <~ Core.lambdaParameter (var "lam") $+ "dom" <~ Maybes.maybe (Core.typeVariable (Core.name (string "_"))) identity (Core.lambdaDomain (var "lam")) $+ "body" <~ Core.lambdaBody (var "lam") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForLambda @@ (var "getTC" @@ var "gEnv") @@ var "lam") @@ var "gEnv") $+ analyzeFunctionTermWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "newEnv"+ @@ var "tparams"+ @@ (Lists.cons (var "v") (var "args"))+ @@ var "bindings"+ @@ (Lists.cons (var "dom") (var "doms"))+ @@ var "tapps"+ @@ var "body")+ (analyzeFunctionTermWith_finish @@ var "getTC" @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t")],+ _Term_let>>: "lt" ~>+ "newBindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForLet @@ var "forBinding" @@ (var "getTC" @@ var "gEnv") @@ var "lt") @@ var "gEnv") $+ analyzeFunctionTermWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ boolean False @@ var "newEnv"+ @@ var "tparams"+ @@ var "args"+ @@ (Lists.concat2 (var "bindings") (var "newBindings"))+ @@ var "doms"+ @@ var "tapps"+ @@ var "body",+ _Term_typeApplication>>: "ta" ~>+ "taBody" <~ Core.typeApplicationTermBody (var "ta") $+ "typ" <~ Core.typeApplicationTermType (var "ta") $+ analyzeFunctionTermWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "gEnv"+ @@ var "tparams"+ @@ var "args"+ @@ var "bindings"+ @@ var "doms"+ @@ (Lists.cons (var "typ") (var "tapps"))+ @@ var "taBody",+ _Term_typeLambda>>: "tl" ~>+ "tvar" <~ Core.typeLambdaParameter (var "tl") $+ "tlBody" <~ Core.typeLambdaBody (var "tl") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForTypeLambda @@ (var "getTC" @@ var "gEnv") @@ var "tl") @@ var "gEnv") $+ analyzeFunctionTermWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "newEnv"+ @@ (Lists.cons (var "tvar") (var "tparams"))+ @@ var "args"+ @@ var "bindings"+ @@ var "doms"+ @@ var "tapps"+ @@ var "tlBody"]++analyzeFunctionTermWith :: TBinding (+ (TypeContext -> Binding -> Maybe Term) ->+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ env ->+ Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermWith = define "analyzeFunctionTermWith" $+ doc "Analyze a function term with configurable binding metadata" $+ "forBinding" ~> "getTC" ~> "setTC" ~> "env" ~> "term" ~>+ analyzeFunctionTermWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ boolean True @@ var "env"+ @@ list ([] :: [TTerm Name])+ @@ list ([] :: [TTerm Name])+ @@ list ([] :: [TTerm Binding])+ @@ list ([] :: [TTerm Type])+ @@ list ([] :: [TTerm Type])+ @@ var "term"++-- | Finish helper for analyzeFunctionTermNoInferWith: reapply type applications, skip type inference+analyzeFunctionTermNoInferWith_finish :: TBinding (+ env -> [Name] -> [Name] -> [Binding] -> [Type] -> [Type] -> Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermNoInferWith_finish = define "analyzeFunctionTermNoInferWith_finish" $+ "fEnv" ~> "tparams" ~> "args" ~> "bindings" ~> "doms" ~> "tapps" ~> "body" ~>+ "bodyWithTapps" <~ Lists.foldl+ ("trm" ~> "typ" ~> Core.termTypeApplication (Core.typeApplicationTerm (var "trm") (var "typ")))+ (var "body")+ (var "tapps") $+ Flows.pure $ record _FunctionStructure [+ _FunctionStructure_typeParams>>: Lists.reverse (var "tparams"),+ _FunctionStructure_params>>: Lists.reverse (var "args"),+ _FunctionStructure_bindings>>: var "bindings",+ _FunctionStructure_body>>: var "bodyWithTapps",+ _FunctionStructure_domains>>: Lists.reverse (var "doms"),+ _FunctionStructure_codomain>>: nothing,+ _FunctionStructure_environment>>: var "fEnv"]++-- | Gather helper for analyzeFunctionTermNoInferWith: recursively collect function components+analyzeFunctionTermNoInferWith_gather :: TBinding (+ (TypeContext -> Binding -> Maybe Term) ->+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ Bool -> env -> [Name] -> [Name] -> [Binding] -> [Type] -> [Type] -> Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermNoInferWith_gather = define "analyzeFunctionTermNoInferWith_gather" $+ "forBinding" ~> "getTC" ~> "setTC" ~>+ "argMode" ~> "gEnv" ~> "tparams" ~> "args" ~> "bindings" ~> "doms" ~> "tapps" ~> "t" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "t")+ (Just $ analyzeFunctionTermNoInferWith_finish @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t") [+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ analyzeFunctionTermNoInferWith_finish @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t") [+ _Function_lambda>>: "lam" ~>+ Logic.ifElse (var "argMode")+ ("v" <~ Core.lambdaParameter (var "lam") $+ "dom" <~ Maybes.maybe (Core.typeVariable (Core.name (string "_"))) identity (Core.lambdaDomain (var "lam")) $+ "body" <~ Core.lambdaBody (var "lam") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForLambda @@ (var "getTC" @@ var "gEnv") @@ var "lam") @@ var "gEnv") $+ analyzeFunctionTermNoInferWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "newEnv"+ @@ var "tparams"+ @@ (Lists.cons (var "v") (var "args"))+ @@ var "bindings"+ @@ (Lists.cons (var "dom") (var "doms"))+ @@ var "tapps"+ @@ var "body")+ (analyzeFunctionTermNoInferWith_finish @@ var "gEnv" @@ var "tparams" @@ var "args" @@ var "bindings" @@ var "doms" @@ var "tapps" @@ var "t")],+ _Term_let>>: "lt" ~>+ "newBindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForLet @@ var "forBinding" @@ (var "getTC" @@ var "gEnv") @@ var "lt") @@ var "gEnv") $+ analyzeFunctionTermNoInferWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ boolean False @@ var "newEnv"+ @@ var "tparams"+ @@ var "args"+ @@ (Lists.concat2 (var "bindings") (var "newBindings"))+ @@ var "doms"+ @@ var "tapps"+ @@ var "body",+ _Term_typeApplication>>: "ta" ~>+ "taBody" <~ Core.typeApplicationTermBody (var "ta") $+ "typ" <~ Core.typeApplicationTermType (var "ta") $+ analyzeFunctionTermNoInferWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "gEnv"+ @@ var "tparams"+ @@ var "args"+ @@ var "bindings"+ @@ var "doms"+ @@ (Lists.cons (var "typ") (var "tapps"))+ @@ var "taBody",+ _Term_typeLambda>>: "tl" ~>+ "tvar" <~ Core.typeLambdaParameter (var "tl") $+ "tlBody" <~ Core.typeLambdaBody (var "tl") $+ "newEnv" <~ (var "setTC" @@ (Schemas.extendTypeContextForTypeLambda @@ (var "getTC" @@ var "gEnv") @@ var "tl") @@ var "gEnv") $+ analyzeFunctionTermNoInferWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ var "argMode" @@ var "newEnv"+ @@ (Lists.cons (var "tvar") (var "tparams"))+ @@ var "args"+ @@ var "bindings"+ @@ var "doms"+ @@ var "tapps"+ @@ var "tlBody"]++-- | Internal helper: analyze a function term without type inference, with configurable binding metadata.+analyzeFunctionTermNoInferWith :: TBinding (+ (TypeContext -> Binding -> Maybe Term) ->+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ env ->+ Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermNoInferWith = define "analyzeFunctionTermNoInferWith" $+ doc "Analyze a function term without type inference, with configurable binding metadata" $+ "forBinding" ~> "getTC" ~> "setTC" ~> "env" ~> "term" ~>+ analyzeFunctionTermNoInferWith_gather @@ var "forBinding" @@ var "getTC" @@ var "setTC"+ @@ boolean True @@ var "env"+ @@ list ([] :: [TTerm Name])+ @@ list ([] :: [TTerm Name])+ @@ list ([] :: [TTerm Binding])+ @@ list ([] :: [TTerm Type])+ @@ list ([] :: [TTerm Type])+ @@ var "term"++-- | Analyze a function term by recursively peeling off lambdas, type lambdas, lets, and type applications.+-- This is a common pattern across all language coders: we need to understand the structure of a function+-- to properly encode it in the target language.+analyzeFunctionTerm :: TBinding (+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ env ->+ Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTerm = define "analyzeFunctionTerm" $+ doc "Analyze a function term, collecting lambdas, type lambdas, lets, and type applications" $+ "getTC" ~> "setTC" ~> "env" ~> "term" ~>+ analyzeFunctionTermWith @@ bindingMetadata @@ var "getTC" @@ var "setTC" @@ var "env" @@ var "term"++-- | Like analyzeFunctionTerm, but without recording binding metadata. This is used for inline+-- lambda expressions where let bindings are encoded as walrus operators (which evaluate+-- immediately and share values, so don't need thunking or function call syntax).+analyzeFunctionTermInline :: TBinding (+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ env ->+ Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermInline = define "analyzeFunctionTermInline" $+ doc "Analyze a function term without recording binding metadata" $+ "getTC" ~> "setTC" ~> "env" ~> "term" ~>+ analyzeFunctionTermWith @@ (constant (constant nothing)) @@ var "getTC" @@ var "setTC" @@ var "env" @@ var "term"++-- | Analyze a function term without inferring the return type.+-- This is a performance optimization for dynamically-typed target languages (like Python)+-- where the codomain type is not needed and type inference is expensive.+analyzeFunctionTermNoInfer :: TBinding (+ (env -> TypeContext) ->+ (TypeContext -> env -> env) ->+ env ->+ Term ->+ Flow s (FunctionStructure env))+analyzeFunctionTermNoInfer = define "analyzeFunctionTermNoInfer" $+ doc "Analyze a function term without type inference (performance optimization)" $+ "getTC" ~> "setTC" ~> "env" ~> "term" ~>+ analyzeFunctionTermNoInferWith @@ bindingMetadata @@ var "getTC" @@ var "setTC" @@ var "env" @@ var "term"+++--------------------------------------------------------------------------------+-- State management helpers for coders+--------------------------------------------------------------------------------++-- | Update the metadata portion of a coder state.+-- This is useful for tracking language-specific metadata during code generation.+--+-- Parameters:+-- - getMeta: Extract metadata from state+-- - makeCoder: Construct state from Graph and metadata+-- - getGraph: Extract Graph from state+-- - f: Transformation to apply to metadata+updateCoderMetadata :: TBinding (+ (state -> metadata) ->+ (Graph -> metadata -> state) ->+ (state -> Graph) ->+ (metadata -> metadata) ->+ Flow state ())+updateCoderMetadata = define "updateCoderMetadata" $+ doc "Update the metadata portion of a coder state" $+ "getMeta" ~> "makeCoder" ~> "getGraph" ~> "f" ~>+ "st" <<~ Monads.getState $+ Monads.putState @@ (var "makeCoder" @@ (var "getGraph" @@ var "st") @@ (var "f" @@ (var "getMeta" @@ var "st")))++-- | Temporarily update the graph for a computation, then restore it.+-- The metadata remains mutable throughout the flow (any changes are preserved).+--+-- This pattern is useful when you need to:+-- - Try encoding with an extended graph but not commit the extensions+-- - Test something in a modified graph context+-- - Keep metadata changes but discard graph changes+withUpdatedCoderGraph :: TBinding (+ (state -> Graph) ->+ (state -> metadata) ->+ (Graph -> metadata -> state) ->+ (Graph -> Graph) ->+ Flow state a ->+ Flow state a)+withUpdatedCoderGraph = define "withUpdatedCoderGraph" $+ doc "Temporarily update the graph for a computation, then restore it" $+ "getGraph" ~> "getMeta" ~> "makeCoder" ~> "f" ~> "flow" ~>+ "st" <<~ Monads.getState $+ exec (Monads.putState @@ (var "makeCoder" @@ (var "f" @@ (var "getGraph" @@ var "st")) @@ (var "getMeta" @@ var "st"))) $+ "r" <<~ var "flow" $+ "st2" <<~ Monads.getState $+ exec (Monads.putState @@ (var "makeCoder" @@ (var "getGraph" @@ var "st") @@ (var "getMeta" @@ var "st2"))) $+ Flows.pure (var "r")++-- | Temporarily extend the graph with additional bindings for a computation.+-- The bindings are only visible within the provided flow action.+--+-- This is commonly used when encoding terms that introduce local bindings+-- (like let expressions), where we need those bindings available in the graph+-- for type checking and term resolution.+withGraphBindings :: TBinding (+ (state -> Graph) ->+ (Graph -> metadata -> state) ->+ (state -> metadata) ->+ [Binding] ->+ Flow state a ->+ Flow state a)+withGraphBindings = define "withGraphBindings" $+ doc "Temporarily extend the graph with additional bindings for a computation" $+ "getGraph" ~> "makeCoder" ~> "getMeta" ~> "bindings" ~> "flow" ~>+ withUpdatedCoderGraph @@ var "getGraph" @@ var "getMeta" @@ var "makeCoder"+ @@ (Lexical.extendGraphWithBindings @@ var "bindings")+ @@ var "flow"++-- | Run a Flow Graph computation within a Flow state computation.+-- This allows you to execute graph-level operations (like type inference,+-- term lookups, etc.) while maintaining a richer coder state with metadata.+--+-- The graph changes from the inner computation are preserved, but run in+-- the context of the coder's graph.+inCoderGraphContext :: TBinding (+ (state -> Graph) ->+ (state -> metadata) ->+ (Graph -> metadata -> state) ->+ Flow Graph a ->+ Flow state a)+inCoderGraphContext = define "inCoderGraphContext" $+ doc "Run a Flow Graph computation within a Flow state computation" $+ "getGraph" ~> "getMeta" ~> "makeCoder" ~> "graphFlow" ~>+ "st" <<~ Monads.getState $+ "result" <<~ Monads.withState @@ (var "getGraph" @@ var "st") @@ (+ "ret" <<~ var "graphFlow" $+ "g2" <<~ Monads.getState $+ Flows.pure (pair (var "ret") (var "g2"))) $+ exec (Monads.putState @@ (var "makeCoder" @@ (Pairs.second (var "result")) @@ (var "getMeta" @@ var "st"))) $+ Flows.pure (Pairs.first (var "result"))
+ src/main/haskell/Hydra/Sources/Eval/Lib/All.hs view
@@ -0,0 +1,92 @@++module Hydra.Sources.Eval.Lib.All where++-- Standard imports for kernel terms modules+import Hydra.Kernel+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Eval.Lib.Eithers as EvalEithers+import qualified Hydra.Sources.Eval.Lib.Flows as EvalFlows+import qualified Hydra.Sources.Eval.Lib.Lists as EvalLists+import qualified Hydra.Sources.Eval.Lib.Maps as EvalMaps+import qualified Hydra.Sources.Eval.Lib.Maybes as EvalMaybes+import qualified Hydra.Sources.Eval.Lib.Pairs as EvalPairs+import qualified Hydra.Sources.Eval.Lib.Sets as EvalSets+++ns :: Namespace+ns = Namespace "hydra.eval.lib"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++-- | All eval library modules+evalLibModules :: [Module]+evalLibModules = [+ EvalEithers.module_,+ EvalFlows.module_,+ EvalLists.module_,+ EvalMaps.module_,+ EvalMaybes.module_,+ EvalPairs.module_,+ EvalSets.module_]++-- | Namespaces of all eval library modules+evalLibNamespaces :: [Namespace]+evalLibNamespaces = Prelude.map moduleNamespace evalLibModules++module_ :: Module+module_ = Module ns elements+ evalLibNamespaces+ kernelTypesNamespaces $+ Just ("Registry of evaluation-level primitive implementations for the Hydra interpreter.")+ where+ elements = []
+ src/main/haskell/Hydra/Sources/Eval/Lib/Eithers.hs view
@@ -0,0 +1,210 @@++module Hydra.Sources.Eval.Lib.Eithers where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (either)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), either)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.eithers"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Either functions for the Hydra interpreter.")+ where+ elements = [+ toBinding bind_,+ toBinding bimap_,+ toBinding either_,+ toBinding map_,+ toBinding mapList_,+ toBinding mapMaybe_]++-- | Interpreter-friendly bind for Either terms.+-- Takes an Either term and a function term, applies the function to the Right+-- value and returns the result (which should be an Either), or returns the Left unchanged.+bind_ :: TBinding (Term -> Term -> Flow s Term)+bind_ = define "bind" $+ doc "Interpreter-friendly bind for Either terms." $+ "eitherTerm" ~> "funTerm" ~>+ cases _Term (var "eitherTerm")+ (Just (Monads.unexpected @@ string "either value" @@ (ShowCore.term @@ var "eitherTerm"))) [+ _Term_either>>: "e" ~>+ produce $ Eithers.either_+ -- If Left: return the Left unchanged+ ("val" ~> Core.termEither $ left $ var "val")+ -- If Right: apply funTerm to the value+ ("val" ~> Core.termApplication $ Core.application (var "funTerm") (var "val"))+ (var "e")]++-- | Interpreter-friendly bimap for Either terms.+-- Takes two function terms (for left and right) and an Either term, applies+-- the appropriate function to the contained value and re-wraps the result.+bimap_ :: TBinding (Term -> Term -> Term -> Flow s Term)+bimap_ = define "bimap" $+ doc "Interpreter-friendly bimap for Either terms." $+ "leftFun" ~> "rightFun" ~> "eitherTerm" ~>+ cases _Term (var "eitherTerm")+ (Just (Monads.unexpected @@ string "either value" @@ (ShowCore.term @@ var "eitherTerm"))) [+ _Term_either>>: "e" ~>+ produce $ Eithers.either_+ ("val" ~> Core.termEither $ left $ Core.termApplication $ Core.application (var "leftFun") (var "val"))+ ("val" ~> Core.termEither $ right $ Core.termApplication $ Core.application (var "rightFun") (var "val"))+ (var "e")]++-- | Interpreter-friendly case analysis for Either terms.+-- Takes two function terms and an Either term, applies the appropriate function+-- to the contained value.+either_ :: TBinding (Term -> Term -> Term -> Flow s Term)+either_ = define "either" $+ doc "Interpreter-friendly case analysis for Either terms." $+ "leftFun" ~> "rightFun" ~> "eitherTerm" ~>+ cases _Term (var "eitherTerm")+ (Just (Monads.unexpected @@ string "either value" @@ (ShowCore.term @@ var "eitherTerm"))) [+ _Term_either>>: "e" ~>+ produce $ Eithers.either_+ ("val" ~> Core.termApplication $ Core.application (var "leftFun") (var "val"))+ ("val" ~> Core.termApplication $ Core.application (var "rightFun") (var "val"))+ (var "e")]++map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly map for Either terms." $+ "rightFun" ~> "eitherTerm" ~>+ cases _Term (var "eitherTerm")+ (Just (Monads.unexpected @@ string "either value" @@ (ShowCore.term @@ var "eitherTerm"))) [+ _Term_either>>: "e" ~>+ produce $ Eithers.either_+ ("val" ~> Core.termEither $ left $ var "val")+ ("val" ~> Core.termEither $ right $ Core.termApplication $ Core.application (var "rightFun") (var "val"))+ (var "e")]++-- | Interpreter-friendly mapList for Either (traverse).+-- mapList funTerm listTerm: applies funTerm to each element, collecting results.+-- Short-circuits on first Left error.+mapList_ :: TBinding (Term -> Term -> Flow s Term)+mapList_ = define "mapList" $+ doc "Interpreter-friendly mapList for Either (traverse)." $+ "funTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Fold over reversed elements so that cons builds list in original order+ -- foldl (\acc el -> bind (f el) (\y -> map (cons y) acc)) (Right []) (reverse xs)+ produce $ Lists.foldl+ -- Accumulator function: acc -> el -> Either err [results]+ ("acc" ~> "el" ~>+ -- First apply funTerm to element: funTerm el+ -- Then bind the result to check if Left or Right+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _eithers_either)+ -- If Left: return the Left unchanged (short-circuit)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "err") nothing $+ Core.termEither $ left $ Core.termVariable $ wrap _Name $ string "err"))+ -- If Right: check acc, if acc is Right then cons, else return acc's Left+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "y") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _eithers_either)+ -- If acc is Left: return it+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "accErr") nothing $+ Core.termEither $ left $ Core.termVariable $ wrap _Name $ string "accErr"))+ -- If acc is Right: cons y onto the list using primitive+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "ys") nothing $+ Core.termEither $ right $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_cons)+ (Core.termVariable $ wrap _Name $ string "y"))+ (Core.termVariable $ wrap _Name $ string "ys")))+ (var "acc")))+ (Core.termApplication $ Core.application (var "funTerm") (var "el")))+ -- Initial accumulator: Right []+ (Core.termEither $ right $ Core.termList $ list ([] :: [TTerm Term]))+ -- Reverse elements so foldl with cons builds list in original order+ (Lists.reverse $ var "elements")++-- | Interpreter-friendly mapMaybe for Either (traverse over Maybe).+-- mapMaybe funTerm maybeTerm: if Just, applies funTerm to the value.+mapMaybe_ :: TBinding (Term -> Term -> Flow s Term)+mapMaybe_ = define "mapMaybe" $+ doc "Interpreter-friendly mapMaybe for Either (traverse over Maybe)." $+ "funTerm" ~> "maybeTerm" ~>+ cases _Term (var "maybeTerm")+ (Just (Monads.unexpected @@ string "maybe value" @@ (ShowCore.term @@ var "maybeTerm"))) [+ _Term_maybe>>: "opt" ~>+ produce $ Maybes.maybe+ -- Nothing: return Right Nothing+ (Core.termEither $ right $ Core.termMaybe nothing)+ -- Just val: apply funTerm, wrap result in Just+ ("val" ~>+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _eithers_either)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "err") nothing $+ Core.termEither $ left $ Core.termVariable $ wrap _Name $ string "err"))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "y") nothing $+ Core.termEither $ right $ Core.termMaybe $ just $ Core.termVariable $ wrap _Name $ string "y"))+ (Core.termApplication $ Core.application (var "funTerm") (var "val")))+ (var "opt")]+
+ src/main/haskell/Hydra/Sources/Eval/Lib/Flows.hs view
@@ -0,0 +1,420 @@++module Hydra.Sources.Eval.Lib.Flows where++-- Standard imports for kernel terms modules+import Hydra.Kernel+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.flows"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Flow functions for the Hydra interpreter.")+ where+ elements = [+ toBinding apply_,+ toBinding bind_,+ toBinding foldl_,+ toBinding map_,+ toBinding mapElems_,+ toBinding mapKeys_,+ toBinding mapList_,+ toBinding mapMaybe_,+ toBinding mapSet_,+ toBinding withDefault_]++-- | Interpreter-friendly applicative apply for Flow.+-- apply flowFun flowArg: applies the function inside flowFun to the value inside flowArg.+apply_ :: TBinding (Term -> Term -> Flow s Term)+apply_ = define "apply" $+ doc "Interpreter-friendly applicative apply for Flow." $+ "flowFun" ~> "flowArg" ~>+ -- Build: flowFun >>= \f -> flowArg >>= \x -> pure (f x)+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_bind)+ (var "flowFun"))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "f") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_bind)+ (var "flowArg"))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "x") nothing $+ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_pure)+ (Core.termApplication $ Core.application+ (Core.termVariable $ wrap _Name $ string "f")+ (Core.termVariable $ wrap _Name $ string "x"))))++-- | Interpreter-friendly monadic bind for Flow.+-- Pattern matches on the flow term to extract the wrapped function,+-- then builds a new Flow that sequences the computation.+bind_ :: TBinding (Term -> Term -> Flow s Term)+bind_ = define "bind" $+ doc "Interpreter-friendly monadic bind for Flow." $+ "flowTerm" ~> "funTerm" ~>+ -- Pattern match on flowTerm to see if it's a TermWrap (Flow)+ cases _Term (var "flowTerm")+ (Just (Monads.unexpected @@ string "flow term" @@ (ShowCore.term @@ var "flowTerm"))) [+ _Term_wrap>>: "wrappedTerm" ~>+ "innerFun" <~ Core.wrappedTermBody (var "wrappedTerm") $+ produce $ Core.termWrap $ Core.wrappedTerm+ (wrap _Name $ string "hydra.compute.Flow")+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "s") nothing $+ Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "t") nothing $+ -- Build: let fs = innerFun s t+ -- in maybe (FlowState Nothing fs.state fs.trace)+ -- (\v -> unwrap (funTerm v) fs.state fs.trace)+ -- fs.value+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_maybe)+ -- default (Nothing): return FlowState with Nothing+ (Core.termRecord $ Core.record (wrap _Name $ string "hydra.compute.FlowState") $+ list [+ Core.field (wrap _Name $ string "value") (Core.termMaybe nothing),+ Core.field (wrap _Name $ string "state") (projectFs (string "state")),+ Core.field (wrap _Name $ string "trace") (projectFs (string "trace"))]))+ -- Just case: \v -> unwrap (funTerm v) fs.state fs.trace+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "v") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionElimination $ Core.eliminationWrap $ wrap _Name $ string "hydra.compute.Flow")+ (Core.termApplication $ Core.application (var "funTerm") (Core.termVariable $ wrap _Name $ string "v")))+ (Core.termApplication $ Core.application+ (projectFs (string "state"))+ (projectFs (string "trace")))))+ -- fs.value+ (projectFs (string "value")))]+ where+ -- Run the inner function to get FlowState: innerFun s t+ runFlow :: TTerm Term+ runFlow = Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (var "innerFun")+ (Core.termVariable $ wrap _Name $ string "s"))+ (Core.termVariable $ wrap _Name $ string "t")+ -- Project a field from the FlowState+ projectFs :: TTerm String -> TTerm Term+ projectFs fieldName = Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $ Core.projection+ (wrap _Name $ string "hydra.compute.FlowState")+ (wrap _Name fieldName))+ runFlow++-- | Interpreter-friendly foldl for Flow.+-- foldl funTerm initTerm listTerm: folds over the list with Flow effects.+foldl_ :: TBinding (Term -> Term -> Term -> Flow s Term)+foldl_ = define "foldl" $+ doc "Interpreter-friendly foldl for Flow." $+ "funTerm" ~> "initTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build: fold over elements using bind+ -- foldl f init [e1,e2,...] = bind (f init e1) (\acc1 -> bind (f acc1 e2) (\acc2 -> ...))+ produce $ Lists.foldl+ ("acc" ~> "el" ~>+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_bind)+ (var "acc"))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "accVal") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application (var "funTerm") (Core.termVariable $ wrap _Name $ string "accVal"))+ (var "el")))+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_pure)+ (var "initTerm"))+ (var "elements")++-- | Interpreter-friendly functor map for Flow.+-- map funTerm flowTerm: applies funTerm to the value inside flowTerm.+map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly functor map for Flow." $+ "funTerm" ~> "flowTerm" ~>+ -- Pattern match on flowTerm to see if it's a TermWrap (Flow)+ cases _Term (var "flowTerm")+ (Just (Monads.unexpected @@ string "flow term" @@ (ShowCore.term @@ var "flowTerm"))) [+ _Term_wrap>>: "wrappedTerm" ~>+ "innerFun" <~ Core.wrappedTermBody (var "wrappedTerm") $+ produce $ Core.termWrap $ Core.wrappedTerm+ (wrap _Name $ string "hydra.compute.Flow")+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "s") nothing $+ Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "t") nothing $+ -- Build: let fs = innerFun s t+ -- in FlowState (map (\v -> funTerm v) fs.value) fs.state fs.trace+ Core.termRecord $ Core.record (wrap _Name $ string "hydra.compute.FlowState") $+ list [+ Core.field (wrap _Name $ string "value")+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_map)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "v") nothing $+ Core.termApplication $ Core.application (var "funTerm") (Core.termVariable $ wrap _Name $ string "v")))+ (projectFsMap (string "value"))),+ Core.field (wrap _Name $ string "state") (projectFsMap (string "state")),+ Core.field (wrap _Name $ string "trace") (projectFsMap (string "trace"))])]+ where+ -- Run the inner function to get FlowState: innerFun s t+ runFlowMap :: TTerm Term+ runFlowMap = Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (var "innerFun")+ (Core.termVariable $ wrap _Name $ string "s"))+ (Core.termVariable $ wrap _Name $ string "t")+ -- Project a field from the FlowState+ projectFsMap :: TTerm String -> TTerm Term+ projectFsMap fieldName = Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $ Core.projection+ (wrap _Name $ string "hydra.compute.FlowState")+ (wrap _Name fieldName))+ runFlowMap++-- | Interpreter-friendly mapElems for Map with Flow.+-- mapElems funTerm mapTerm: applies funTerm to each value in the map.+mapElems_ :: TBinding (Term -> Term -> Flow s Term)+mapElems_ = define "mapElems" $+ doc "Interpreter-friendly mapElems for Map with Flow." $+ "funTerm" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: sequence (map (\(k,v) -> map (\v' -> (k, v')) (funTerm v)) pairs) >>= fromList+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_bind)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_sequence)+ (Core.termList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_map)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "v'") nothing $+ Core.termPair $ pair (var "k") (Core.termVariable $ wrap _Name $ string "v'")))+ (Core.termApplication $ Core.application (var "funTerm") (var "v")))+ (var "pairs"))))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "newPairs") nothing $+ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_pure)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_fromList)+ (Core.termVariable $ wrap _Name $ string "newPairs")))]++-- | Interpreter-friendly mapKeys for Map with Flow.+-- mapKeys funTerm mapTerm: applies funTerm to each key in the map.+mapKeys_ :: TBinding (Term -> Term -> Flow s Term)+mapKeys_ = define "mapKeys" $+ doc "Interpreter-friendly mapKeys for Map with Flow." $+ "funTerm" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: sequence (map (\(k,v) -> map (\k' -> (k', v)) (funTerm k)) pairs) >>= fromList+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_bind)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_sequence)+ (Core.termList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_map)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "k'") nothing $+ Core.termPair $ pair (Core.termVariable $ wrap _Name $ string "k'") (var "v")))+ (Core.termApplication $ Core.application (var "funTerm") (var "k")))+ (var "pairs"))))+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "newPairs") nothing $+ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_pure)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_fromList)+ (Core.termVariable $ wrap _Name $ string "newPairs")))]++-- | Interpreter-friendly mapList for List with Flow (traverse).+-- mapList funTerm listTerm: applies funTerm to each element, collecting results.+mapList_ :: TBinding (Term -> Term -> Flow s Term)+mapList_ = define "mapList" $+ doc "Interpreter-friendly mapList for List with Flow." $+ "funTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build: sequence (map funTerm elements)+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_sequence)+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application (var "funTerm") (var "el"))+ (var "elements"))++-- | Interpreter-friendly mapMaybe for Maybe with Flow (traverse).+-- mapMaybe funTerm maybeTerm: applies funTerm if Just, returns Nothing otherwise.+mapMaybe_ :: TBinding (Term -> Term -> Flow s Term)+mapMaybe_ = define "mapMaybe" $+ doc "Interpreter-friendly mapMaybe for Maybe with Flow." $+ "funTerm" ~> "maybeTerm" ~>+ cases _Term (var "maybeTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "maybeTerm"))) [+ _Term_maybe>>: "m" ~>+ -- Use ifElse with term-level lambdas to delay evaluation (same pattern as Maybes)+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ -- isNothing m+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_isNothing)+ (Core.termMaybe $ var "m")))+ -- Lambda returning pure Nothing (delayed)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "_") nothing $+ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_pure)+ (Core.termMaybe nothing)))+ -- Lambda returning map Just (funTerm (fromJust m)) (delayed)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "_") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_map)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "x") nothing $+ Core.termMaybe $ just $ Core.termVariable $ wrap _Name $ string "x"))+ (Core.termApplication $ Core.application+ (var "funTerm")+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_fromJust)+ (Core.termMaybe $ var "m")))))+ Core.termUnit]++-- | Interpreter-friendly mapSet for Set with Flow (traverse).+-- mapSet funTerm setTerm: applies funTerm to each element, collecting results.+mapSet_ :: TBinding (Term -> Term -> Flow s Term)+mapSet_ = define "mapSet" $+ doc "Interpreter-friendly mapSet for Set with Flow." $+ "funTerm" ~> "setTerm" ~>+ "elements" <<~ ExtractCore.set @@ var "setTerm" $+ -- Build: map fromList (sequence (map funTerm (toList elements)))+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_map)+ (Core.termFunction $ Core.functionPrimitive $ encodedName _sets_fromList))+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _flows_sequence)+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application (var "funTerm") (var "el"))+ (Sets.toList $ var "elements")))++-- | Interpreter-friendly withDefault for Flow (try/catch).+-- withDefault fallbackTerm flowTerm: returns flowTerm's result if it succeeds,+-- otherwise returns fallbackTerm wrapped in pure.+withDefault_ :: TBinding (Term -> Term -> Flow s Term)+withDefault_ = define "withDefault" $+ doc "Interpreter-friendly withDefault for Flow." $+ "fallbackTerm" ~> "flowTerm" ~>+ -- Pattern match on flowTerm to see if it's a TermWrap (Flow)+ cases _Term (var "flowTerm")+ (Just (Monads.unexpected @@ string "flow term" @@ (ShowCore.term @@ var "flowTerm"))) [+ _Term_wrap>>: "wrappedTerm" ~>+ "innerFun" <~ Core.wrappedTermBody (var "wrappedTerm") $+ produce $ Core.termWrap $ Core.wrappedTerm+ (wrap _Name $ string "hydra.compute.Flow")+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "s") nothing $+ Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "t") nothing $+ -- Build: let fs = innerFun s t+ -- in maybe (FlowState (Just fallback) s t) -- use original s, t on failure+ -- (\_ -> fs) -- use result on success+ -- fs.value+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_maybe)+ -- default (Nothing): return FlowState with fallback, original state/trace+ (Core.termRecord $ Core.record (wrap _Name $ string "hydra.compute.FlowState") $+ list [+ Core.field (wrap _Name $ string "value") (Core.termMaybe $ just $ var "fallbackTerm"),+ Core.field (wrap _Name $ string "state") (Core.termVariable $ wrap _Name $ string "s"),+ Core.field (wrap _Name $ string "trace") (Core.termVariable $ wrap _Name $ string "t")]))+ -- Just case: \_ -> fs (return the original FlowState)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "_") nothing $+ runFlowWd))+ -- fs.value+ (projectFsWd (string "value")))]+ where+ -- Run the inner function to get FlowState: innerFun s t+ runFlowWd :: TTerm Term+ runFlowWd = Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (var "innerFun")+ (Core.termVariable $ wrap _Name $ string "s"))+ (Core.termVariable $ wrap _Name $ string "t")+ -- Project a field from the FlowState+ projectFsWd :: TTerm String -> TTerm Term+ projectFsWd fieldName = Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $ Core.projection+ (wrap _Name $ string "hydra.compute.FlowState")+ (wrap _Name fieldName))+ runFlowWd
+ src/main/haskell/Hydra/Sources/Eval/Lib/Lists.hs view
@@ -0,0 +1,387 @@++module Hydra.Sources.Eval.Lib.Lists where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (map)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Literals as MetaLiterals+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.lists"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of List functions for the Hydra interpreter.")+ where+ elements = [+ toBinding apply_,+ toBinding bind_,+ toBinding dropWhile_,+ toBinding filter_,+ toBinding find_,+ toBinding foldl_,+ toBinding map_,+ toBinding partition_,+ toBinding sortOn_,+ toBinding span_,+ toBinding zipWith_]++-- | Interpreter-friendly applicative apply for List terms.+-- Applies each function in funsTerm to each argument in argsTerm.+apply_ :: TBinding (Term -> Term -> Flow s Term)+apply_ = define "apply" $+ doc "Interpreter-friendly applicative apply for List terms." $+ "funsTerm" ~> "argsTerm" ~>+ "funs" <<~ ExtractCore.list @@ var "funsTerm" $+ "arguments" <<~ ExtractCore.list @@ var "argsTerm" $+ "applyOne" <~ ("f" ~> Lists.map+ ("arg" ~> Core.termApplication $ Core.application (var "f") (var "arg"))+ (var "arguments")) $+ produce $ Core.termList $ Lists.concat $ Lists.map (var "applyOne") (var "funs")++-- | Interpreter-friendly monadic bind for List terms.+-- Applies funTerm to each element and concatenates the results.+bind_ :: TBinding (Term -> Term -> Flow s Term)+bind_ = define "bind" $+ doc "Interpreter-friendly monadic bind for List terms." $+ "listTerm" ~> "funTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat)+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application (var "funTerm") (var "el"))+ (var "elements"))++-- | Interpreter-friendly dropWhile for List terms.+-- Drops elements from the front while predTerm returns true.+dropWhile_ :: TBinding (Term -> Term -> Flow s Term)+dropWhile_ = define "dropWhile" $+ doc "Interpreter-friendly dropWhile for List terms." $+ "predTerm" ~> "listTerm" ~>+ -- Build: snd (span predTerm listTerm) - delegate to span primitive+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_span)+ (var "predTerm"))+ (var "listTerm"))++-- | Interpreter-friendly filter for List terms.+-- Keeps elements where predTerm returns true.+filter_ :: TBinding (Term -> Term -> Flow s Term)+filter_ = define "filter" $+ doc "Interpreter-friendly filter for List terms." $+ "predTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build: concat (map (\el -> ifElse (pred el) [el] []) elements)+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat)+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ (Core.termApplication $ Core.application (var "predTerm") (var "el")))+ (Core.termList $ Lists.pure (var "el")))+ (Core.termList $ list ([] :: [TTerm Term])))+ (var "elements"))++-- | Interpreter-friendly find for List terms.+-- Returns the first element where predTerm returns true, or Nothing if none found.+find_ :: TBinding (Term -> Term -> Flow s Term)+find_ = define "find" $+ doc "Interpreter-friendly find for List terms." $+ "predTerm" ~> "listTerm" ~>+ -- Build: safeHead (filter predTerm listTerm) - delegate to filter and safeHead+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_safeHead)+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_filter)+ (var "predTerm"))+ (var "listTerm"))++-- | Interpreter-friendly left fold for List terms.+-- Folds from the left: foldl f init [e1,e2,e3] = f (f (f init e1) e2) e3+foldl_ :: TBinding (Term -> Term -> Term -> Flow s Term)+foldl_ = define "foldl" $+ doc "Interpreter-friendly left fold for List terms." $+ "funTerm" ~> "initTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build nested applications: f (f (f init e1) e2) e3+ produce $ Lists.foldl+ ("acc" ~> "el" ~> Core.termApplication $ Core.application+ (Core.termApplication $ Core.application (var "funTerm") (var "acc"))+ (var "el"))+ (var "initTerm")+ (var "elements")++-- | Interpreter-friendly map for List terms.+-- Applies funTerm to each element of listTerm.+-- Note: builds result directly using foldl to avoid recursive primitive calls.+map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly map for List terms." $+ "funTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build the mapped list by folding over elements and accumulating applications+ -- This avoids calling lists.map recursively+ produce $ Core.termList $ Lists.reverse $ Lists.foldl+ ("acc" ~> "el" ~> Lists.cons+ (Core.termApplication $ Core.application (var "funTerm") (var "el"))+ (var "acc"))+ (list ([] :: [TTerm Term]))+ (var "elements")++-- | Interpreter-friendly partition for List terms.+-- Partitions elements into (satisfying predicate, not satisfying predicate).+-- Unlike span, partition checks ALL elements, not just the prefix.+partition_ :: TBinding (Term -> Term -> Flow s Term)+partition_ = define "partition" $+ doc "Interpreter-friendly partition for List terms." $+ "predTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- State: (yeses, nos) - two accumulators+ -- Initial: ([], [])+ -- Step: ifElse (pred el) (append yeses [el], nos) (yeses, append nos [el])+ -- Result: (yeses, nos) - already in correct order due to foldl + concat2+ "initialState" <~ (Core.termPair $ pair+ (Core.termList $ list ([] :: [TTerm Term]))+ (Core.termList $ list ([] :: [TTerm Term]))) $+ "finalState" <~ (Lists.foldl+ ("acc" ~> "el" ~>+ -- Extract state components+ "yeses" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_first)+ (var "acc")) $+ "nos" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (var "acc")) $+ -- Build ifElse (pred el) trueCase falseCase+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ -- condition: pred el+ (Core.termApplication $ Core.application (var "predTerm") (var "el")))+ -- true branch: (append yeses [el], nos)+ (Core.termPair $ pair+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat2)+ (var "yeses"))+ (Core.termList $ list [var "el"]))+ (var "nos")))+ -- false branch: (yeses, append nos [el])+ (Core.termPair $ pair+ (var "yeses")+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat2)+ (var "nos"))+ (Core.termList $ list [var "el"]))))+ (var "initialState")+ (var "elements")) $+ -- Return the final state directly (it's already a pair)+ produce $ var "finalState"++-- | Interpreter-friendly sortOn for List terms.+-- Sorts elements by comparing the results of applying projTerm to each.+-- Uses insertion sort: for each element, use span to find insertion point.+sortOn_ :: TBinding (Term -> Term -> Flow s Term)+sortOn_ = define "sortOn" $+ doc "Interpreter-friendly sortOn for List terms." $+ "projTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build: foldl (\sorted x -> insert x sorted) [] elements+ -- where insert x sorted = let (before, after) = span (\y -> lte (proj y) (proj x)) sorted+ -- in concat [before, [x], after]+ produce $ Lists.foldl+ ("sorted" ~> "x" ~>+ -- Build the split using span with predicate: \y -> lte (proj y) (proj x)+ "splitResult" <~ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_span)+ -- predicate lambda: \y -> lte (proj y) (proj x) -- use lte for stable sort+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "y") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _equality_lte)+ (Core.termApplication $ Core.application+ (var "projTerm")+ (Core.termVariable $ wrap _Name $ string "y")))+ (Core.termApplication $ Core.application (var "projTerm") (var "x"))))+ (var "sorted")) $+ -- Build: concat [before, [x], after]+ "before" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_first)+ (var "splitResult")) $+ "after" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (var "splitResult")) $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat2)+ (var "before"))+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_cons)+ (var "x"))+ (var "after")))+ (Core.termList $ list ([] :: [TTerm Term]))+ (var "elements")++-- | Interpreter-friendly span for List terms.+-- Splits the list into (takeWhile pred list, dropWhile pred list).+-- Uses foldl with state ((stillTaking, left), right) to track the split point.+span_ :: TBinding (Term -> Term -> Flow s Term)+span_ = define "span" $+ doc "Interpreter-friendly span for List terms." $+ "predTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- State: ((taking, left), right) as nested pairs+ -- Initial: ((true, []), [])+ -- Step: ifElse (and taking (pred el))+ -- ((true, append left [el]), right)+ -- ((false, left), append right [el])+ -- Result: (snd (fst result), snd result)+ "initialState" <~ (Core.termPair $ pair+ (Core.termPair $ pair+ (Core.termLiteral $ Core.literalBoolean $ MetaLiterals.boolean True)+ (Core.termList $ list ([] :: [TTerm Term])))+ (Core.termList $ list ([] :: [TTerm Term]))) $+ "finalState" <~ (Lists.foldl+ ("acc" ~> "el" ~>+ -- Extract state components using term-level pairs+ "takingLeft" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_first)+ (var "acc")) $+ "right" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (var "acc")) $+ "taking" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_first)+ (var "takingLeft")) $+ "left" <~ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (var "takingLeft")) $+ -- Build ifElse (and taking (pred el)) trueCase falseCase+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ -- condition: and taking (pred el)+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_and)+ (var "taking"))+ (Core.termApplication $ Core.application (var "predTerm") (var "el"))))+ -- true branch: ((true, append left [el]), right)+ (Core.termPair $ pair+ (Core.termPair $ pair+ (Core.termLiteral $ Core.literalBoolean $ MetaLiterals.boolean True)+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat2)+ (var "left"))+ (Core.termList $ list [var "el"])))+ (var "right")))+ -- false branch: ((false, left), append right [el])+ (Core.termPair $ pair+ (Core.termPair $ pair+ (Core.termLiteral $ Core.literalBoolean $ MetaLiterals.boolean False)+ (var "left"))+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat2)+ (var "right"))+ (Core.termList $ list [var "el"]))))+ (var "initialState")+ (var "elements")) $+ -- Extract result: (snd (fst finalState), snd finalState)+ produce $ Core.termPair $ pair+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_first)+ (var "finalState")))+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _pairs_second)+ (var "finalState"))++-- | Interpreter-friendly zipWith for List terms.+-- Applies funTerm to corresponding pairs of elements.+zipWith_ :: TBinding (Term -> Term -> Term -> Flow s Term)+zipWith_ = define "zipWith" $+ doc "Interpreter-friendly zipWith for List terms." $+ "funTerm" ~> "listTerm1" ~> "listTerm2" ~>+ "elements1" <<~ ExtractCore.list @@ var "listTerm1" $+ "elements2" <<~ ExtractCore.list @@ var "listTerm2" $+ -- Build: [f a1 b1, f a2 b2, ...]+ produce $ Core.termList $ Lists.map+ ("p" ~>+ "a" <~ Pairs.first (var "p") $+ "b" <~ Pairs.second (var "p") $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application (var "funTerm") (var "a"))+ (var "b"))+ (Lists.zip (var "elements1") (var "elements2"))
+ src/main/haskell/Hydra/Sources/Eval/Lib/Maps.hs view
@@ -0,0 +1,232 @@++module Hydra.Sources.Eval.Lib.Maps where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (map)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.maps"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Map functions for the Hydra interpreter.")+ where+ elements = [+ toBinding alter_,+ toBinding bimap_,+ toBinding filter_,+ toBinding filterWithKey_,+ toBinding map_,+ toBinding mapKeys_]++-- | Interpreter-friendly alter for Map terms.+-- Applies funTerm to the current value (or Nothing) and updates accordingly.+alter_ :: TBinding (Term -> Term -> Term -> Flow s Term)+alter_ = define "alter" $+ doc "Interpreter-friendly alter for Map terms." $+ "funTerm" ~> "keyTerm" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ -- Get current value: lookup key m+ "currentVal" <~ Maps.lookup (var "keyTerm") (var "m") $+ -- Apply function to get new value: funTerm (Just v) or funTerm Nothing+ "newVal" <~ Core.termApplication (Core.application+ (var "funTerm")+ (Core.termMaybe (var "currentVal"))) $+ -- Result depends on newVal:+ -- If newVal is Nothing, delete the key+ -- If newVal is Just v', insert/update with v'+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maybes_maybe)+ -- default: delete key from map+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_delete)+ (var "keyTerm"))+ (var "mapTerm")))+ -- function: insert new value (as a term-level lambda)+ (Core.termFunction $ Core.functionLambda $ Core.lambda (wrap _Name $ string "newV") nothing $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_insert)+ (var "keyTerm"))+ (Core.termVariable $ wrap _Name $ string "newV"))+ (var "mapTerm")))+ (var "newVal")]++-- | Interpreter-friendly bimap for Map terms.+-- Applies keyFun to each key and valFun to each value.+bimap_ :: TBinding (Term -> Term -> Term -> Flow s Term)+bimap_ = define "bimap" $+ doc "Interpreter-friendly bimap for Map terms." $+ "keyFun" ~> "valFun" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ -- m is Map Term Term, convert to list of pairs+ "pairs" <~ Maps.toList (var "m") $+ -- Build: fromList (map (\(k,v) -> (keyFun k, valFun v)) pairs)+ produce $ Core.termMap $ Maps.fromList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ pair+ (Core.termApplication $ Core.application (var "keyFun") (var "k"))+ (Core.termApplication $ Core.application (var "valFun") (var "v")))+ (var "pairs")]++-- | Interpreter-friendly filter for Map terms.+-- Keeps entries where valPred returns true for the value.+filter_ :: TBinding (Term -> Term -> Flow s Term)+filter_ = define "filter" $+ doc "Interpreter-friendly filter for Map terms." $+ "valPred" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: fromList (concat (map (\(k,v) -> if valPred v then [(k,v)] else []) pairs))+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_fromList)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat)+ (Core.termList $ Lists.map+ ("p" ~>+ "v" <~ Pairs.second (var "p") $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ (Core.termApplication $ Core.application (var "valPred") (var "v")))+ (Core.termList $ Lists.pure $ Core.termPair $ pair (Pairs.first $ var "p") (var "v")))+ (Core.termList $ list ([] :: [TTerm Term])))+ (var "pairs")))]++-- | Interpreter-friendly filterWithKey for Map terms.+-- Keeps entries where pred returns true for the key and value.+filterWithKey_ :: TBinding (Term -> Term -> Flow s Term)+filterWithKey_ = define "filterWithKey" $+ doc "Interpreter-friendly filterWithKey for Map terms." $+ "pred" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: fromList (concat (map (\(k,v) -> if pred k v then [(k,v)] else []) pairs))+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _maps_fromList)+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _lists_concat)+ (Core.termList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _logic_ifElse)+ (Core.termApplication $ Core.application+ (Core.termApplication $ Core.application (var "pred") (var "k"))+ (var "v")))+ (Core.termList $ Lists.pure $ Core.termPair $ pair (var "k") (var "v")))+ (Core.termList $ list ([] :: [TTerm Term])))+ (var "pairs")))]++-- | Interpreter-friendly map for Map terms.+-- Applies valFun to each value.+map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly map for Map terms." $+ "valFun" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: fromList (map (\(k,v) -> (k, valFun v)) pairs)+ produce $ Core.termMap $ Maps.fromList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ pair (var "k") (Core.termApplication $ Core.application (var "valFun") (var "v")))+ (var "pairs")]++-- | Interpreter-friendly mapKeys for Map terms.+-- Applies keyFun to each key.+mapKeys_ :: TBinding (Term -> Term -> Flow s Term)+mapKeys_ = define "mapKeys" $+ doc "Interpreter-friendly mapKeys for Map terms." $+ "keyFun" ~> "mapTerm" ~>+ cases _Term (var "mapTerm")+ (Just (Monads.unexpected @@ string "map value" @@ (ShowCore.term @@ var "mapTerm"))) [+ _Term_map>>: "m" ~>+ "pairs" <~ Maps.toList (var "m") $+ -- Build: fromList (map (\(k,v) -> (keyFun k, v)) pairs)+ produce $ Core.termMap $ Maps.fromList $ Lists.map+ ("p" ~>+ "k" <~ Pairs.first (var "p") $+ "v" <~ Pairs.second (var "p") $+ pair (Core.termApplication $ Core.application (var "keyFun") (var "k")) (var "v"))+ (var "pairs")]
+ src/main/haskell/Hydra/Sources/Eval/Lib/Maybes.hs view
@@ -0,0 +1,185 @@++module Hydra.Sources.Eval.Lib.Maybes where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (maybe)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), maybe, map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.maybes"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Maybe functions for the Hydra interpreter.")+ where+ elements = [+ toBinding apply_,+ toBinding bind_,+ toBinding cases_,+ toBinding compose_,+ toBinding map_,+ toBinding mapMaybe_,+ toBinding maybe_]++-- | Interpreter-friendly applicative apply for Maybe terms.+-- apply (Just f) (Just x) = Just (f x); otherwise Nothing+-- We manually construct the result because the nested lambda would be flattened in Python.+-- The logic is: apply (Just f) (Just x) = Just (f x)+apply_ :: TBinding (Term -> Term -> Flow s Term)+apply_ = define "apply" $+ doc "Interpreter-friendly applicative apply for Maybe terms." $+ "funOptTerm" ~> "argOptTerm" ~>+ cases _Term (var "funOptTerm")+ (Just (Monads.unexpected @@ string "optional function" @@ (ShowCore.term @@ var "funOptTerm"))) [+ _Term_maybe>>: "mf" ~>+ cases _Term (var "argOptTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "argOptTerm"))) [+ _Term_maybe>>: "mx" ~>+ -- Manual applicative apply: for Just f, Just x => Just (f x); else Nothing+ -- We use Maybes.bind to handle the nested Maybes without requiring curried lambdas+ produce $ Core.termMaybe $+ Maybes.bind (var "mf") $+ "f" ~> Maybes.map ("x" ~> Core.termApplication $ Core.application (var "f") (var "x")) (var "mx")]]++-- | Interpreter-friendly monadic bind for Maybe terms.+-- bind (Just x) f = f x; bind Nothing f = Nothing+bind_ :: TBinding (Term -> Term -> Flow s Term)+bind_ = define "bind" $+ doc "Interpreter-friendly monadic bind for Maybe terms." $+ "optTerm" ~> "funTerm" ~>+ cases _Term (var "optTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "optTerm"))) [+ _Term_maybe>>: "m" ~>+ produce $ Maybes.maybe+ (Core.termMaybe nothing)+ ("val" ~> Core.termApplication $ Core.application (var "funTerm") (var "val"))+ (var "m")]++-- | Interpreter-friendly case analysis for Maybe terms (cases variant).+-- Takes optTerm, defaultTerm, funTerm - returns defaultTerm if Nothing,+-- or applies funTerm to the value if Just.+cases_ :: TBinding (Term -> Term -> Term -> Flow s Term)+cases_ = define "cases" $+ doc "Interpreter-friendly case analysis for Maybe terms (cases argument order)." $+ "optTerm" ~> "defaultTerm" ~> "funTerm" ~>+ cases _Term (var "optTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "optTerm"))) [+ _Term_maybe>>: "m" ~>+ produce $ Maybes.maybe+ (var "defaultTerm")+ ("val" ~> Core.termApplication $ Core.application (var "funTerm") (var "val"))+ (var "m")]++-- | Interpreter-friendly Kleisli composition for Maybe.+-- compose f g x = bind (f x) g+compose_ :: TBinding (Term -> Term -> Term -> Flow s Term)+compose_ = define "compose" $+ doc "Interpreter-friendly Kleisli composition for Maybe." $+ "funF" ~> "funG" ~> "xTerm" ~>+ -- Compute: bind (f x) g+ -- This builds the term: bind @ (funF @ xTerm) @ funG+ produce $ Core.termApplication $ Core.application+ (Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ wrap _Name $ string "hydra.lib.maybes.bind")+ (Core.termApplication $ Core.application (var "funF") (var "xTerm")))+ (var "funG")++-- | Interpreter-friendly map for Maybe terms.+-- Returns Nothing if Nothing, or Just (fun val) if Just val.+map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly map for Maybe terms." $+ "funTerm" ~> "optTerm" ~>+ cases _Term (var "optTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "optTerm"))) [+ _Term_maybe>>: "m" ~>+ produce $ Core.termMaybe $ Maybes.map+ ("val" ~> Core.termApplication $ Core.application (var "funTerm") (var "val"))+ (var "m")]++-- | Interpreter-friendly mapMaybe for List terms.+-- Applies funTerm to each element, keeping only Just results.+mapMaybe_ :: TBinding (Term -> Term -> Flow s Term)+mapMaybe_ = define "mapMaybe" $+ doc "Interpreter-friendly mapMaybe for List terms." $+ "funTerm" ~> "listTerm" ~>+ "elements" <<~ ExtractCore.list @@ var "listTerm" $+ -- Build: cat (map funTerm elements) - cat filters out Nothings and unwraps Justs+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ wrap _Name $ string "hydra.lib.maybes.cat")+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application (var "funTerm") (var "el"))+ (var "elements"))++-- | Interpreter-friendly case analysis for Maybe terms.+-- Takes defaultTerm, funTerm, optTerm - returns defaultTerm if Nothing,+-- or applies funTerm to the value if Just.+maybe_ :: TBinding (Term -> Term -> Term -> Flow s Term)+maybe_ = define "maybe" $+ doc "Interpreter-friendly case analysis for Maybe terms." $+ "defaultTerm" ~> "funTerm" ~> "optTerm" ~>+ cases _Term (var "optTerm")+ (Just (Monads.unexpected @@ string "optional value" @@ (ShowCore.term @@ var "optTerm"))) [+ _Term_maybe>>: "m" ~>+ produce $ Maybes.maybe+ (var "defaultTerm")+ ("val" ~> Core.termApplication $ Core.application (var "funTerm") (var "val"))+ (var "m")]
+ src/main/haskell/Hydra/Sources/Eval/Lib/Pairs.hs view
@@ -0,0 +1,88 @@++module Hydra.Sources.Eval.Lib.Pairs where++-- Standard imports for kernel terms modules+import Hydra.Kernel+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.pairs"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Pair functions for the Hydra interpreter.")+ where+ elements = [+ toBinding bimap_]++-- | Interpreter-friendly bimap for Pair terms.+-- Applies firstFun to the first element and secondFun to the second element.+bimap_ :: TBinding (Term -> Term -> Term -> Flow s Term)+bimap_ = define "bimap" $+ doc "Interpreter-friendly bimap for Pair terms." $+ "firstFun" ~> "secondFun" ~> "pairTerm" ~>+ cases _Term (var "pairTerm")+ (Just (Monads.unexpected @@ string "pair value" @@ (ShowCore.term @@ var "pairTerm"))) [+ _Term_pair>>: "p" ~>+ "fst" <~ Pairs.first (var "p") $+ "snd" <~ Pairs.second (var "p") $+ produce $ Core.termPair $ pair+ (Core.termApplication $ Core.application (var "firstFun") (var "fst"))+ (Core.termApplication $ Core.application (var "secondFun") (var "snd"))]
+ src/main/haskell/Hydra/Sources/Eval/Lib/Sets.hs view
@@ -0,0 +1,88 @@++module Hydra.Sources.Eval.Lib.Sets where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (map)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.eval.lib.sets"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Evaluation-level implementations of Set functions for the Hydra interpreter.")+ where+ elements = [+ toBinding map_]++-- | Interpreter-friendly map for Set terms.+-- Applies fun to each element.+map_ :: TBinding (Term -> Term -> Flow s Term)+map_ = define "map" $+ doc "Interpreter-friendly map for Set terms." $+ "fun" ~> "setTerm" ~>+ "elements" <<~ ExtractCore.set @@ var "setTerm" $+ -- Build: fromList (map fun (toList elements))+ produce $ Core.termApplication $ Core.application+ (Core.termFunction $ Core.functionPrimitive $ encodedName _sets_fromList)+ (Core.termList $ Lists.map+ ("el" ~> Core.termApplication $ Core.application (var "fun") (var "el"))+ (Sets.toList $ var "elements"))
src/main/haskell/Hydra/Sources/Haskell/Ast.hs view
@@ -1,453 +1,919 @@-module Hydra.Sources.Haskell.Ast where--import Hydra.Kernel-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.All as Tier2-import Hydra.Dsl.Annotations-import Hydra.Dsl.Bootstrap-import Hydra.Dsl.Types as Types--import qualified Hydra.Sources.Kernel.Types.Accessors as Accessors-import qualified Hydra.Sources.Kernel.Types.Ast as Ast-import qualified Hydra.Sources.Kernel.Types.Coders as Coders-import qualified Hydra.Sources.Kernel.Types.Compute as Compute-import qualified Hydra.Sources.Kernel.Types.Constraints as Constraints-import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Hydra.Sources.Kernel.Types.Grammar as Grammar-import qualified Hydra.Sources.Kernel.Types.Graph as Graph-import qualified Hydra.Sources.Kernel.Types.Json as Json-import qualified Hydra.Sources.Kernel.Types.Mantle as Mantle-import qualified Hydra.Sources.Kernel.Types.Module as Module-import qualified Hydra.Sources.Kernel.Types.Phantoms as Phantoms-import qualified Hydra.Sources.Kernel.Types.Relational as Relational-import qualified Hydra.Sources.Kernel.Types.Query as Query-import qualified Hydra.Sources.Kernel.Types.Tabular as Tabular-import qualified Hydra.Sources.Kernel.Types.Testing as Testing-import qualified Hydra.Sources.Kernel.Types.Topology as Topology-import qualified Hydra.Sources.Kernel.Types.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.Workflow as Workflow--haskellAstModule :: Module-haskellAstModule = Module ns elements [Core.module_] [Core.module_] $- Just "A Haskell syntax model, loosely based on Language.Haskell.Tools.AST"- where- ns = Namespace "hydra.ext.haskell.ast"- def = datatype ns- ast = typeref ns-- elements = [-- def "Alternative" $ -- UAlt- doc "A pattern-matching alternative" $- record [- "pattern">: ast "Pattern",- "rhs">: ast "CaseRhs",- "binds">: optional $ ast "LocalBindings"],-- def "Assertion" $ -- UAssertion (UClassAssert)- doc "A type assertion" $- union [- "class">: ast "ClassAssertion",- "tuple">: list $ ast "Assertion"],- -- omitted for now: implicit and infix assertions-- def "ClassAssertion" $ -- UClassAssert- record [- "name">: ast "Name",- "types">: list $ ast "Type"],-- def "CaseRhs" $ -- UCaseRhs'- doc "The right-hand side of a pattern-matching alternative" $- -- omitted for now: guarded- wrap $ ast "Expression",-- def "Constructor" $ -- UConDecl- doc "A data constructor" $- -- omitted for now: ordinary (positional), infix- union [- "ordinary">: ast "OrdinaryConstructor",- "record">: ast "RecordConstructor"],-- def "OrdinaryConstructor" $- doc "An ordinary (positional) data constructor" $- record [- "name">: ast "Name",- "fields">: list $ ast "Type"],-- def "RecordConstructor" $- doc "A record-style data constructor" $- record [- "name">: ast "Name",- "fields">: list $ ast "FieldWithComments"],-- def "ConstructorWithComments" $- doc "A data constructor together with any comments" $- record [- "body">: ast "Constructor",- "comments">: optional string],-- def "DataDeclaration" $ -- UDataDecl- doc "A data type declaration" $- record [- "keyword">: ast "DataOrNewtype",- "context">: list $ ast "Assertion",- "head">: ast "DeclarationHead",- "constructors">: list $ ast "ConstructorWithComments",- "deriving">: list $ ast "Deriving"],-- def "DataOrNewtype" $- doc "The 'data' versus 'newtype keyword" $- enum ["data", "newtype"],-- def "DeclarationWithComments" $- doc "A data declaration together with any comments" $- record [- "body">: ast "Declaration",- "comments">: optional string],-- def "Declaration" $ -- UDecl- doc "A data or value declaration" $- -- omitted for now: typeFamily, typeSignature, closedTypeFamily, gDataDecl, typeInst, dataInst, gDataInst, class, inst,- -- patternSynonym, deriv, fixity, default, patTypeSig, foreignImport, foreignExport, pragma,- -- role, splice- union [- "data">: ast "DataDeclaration",- "type">: ast "TypeDeclaration",- "valueBinding">: ast "ValueBinding",- "typedBinding">: ast "TypedBinding"],-- def "DeclarationHead" $ -- UDeclHead- doc "The left-hand side of a declaration" $- -- omitted for now: infix application- union [- "application">: ast "ApplicationDeclarationHead",- "parens">: ast "DeclarationHead",- "simple">: ast "Name"],-- def "ApplicationDeclarationHead" $- doc "An application-style declaration head" $- record [- "function">: ast "DeclarationHead",- "operand">: ast "Variable"],-- def "Deriving" $ -- UDeriving- doc "A 'deriving' statement" $- -- omitted for now: infix, parenthesized, and application instance heads- wrap $ list $ ast "Name",-- def "Export" $ -- UExportSpec- doc "An export statement" $- union [- "declaration">: ast "ImportExportSpec",- "module">: ast "ModuleName"],-- def "Expression" $ -- UExpr- doc "A data expression" $- -- omitted for now: multi-if, unboxed tuple, tuple section, unboxed tuple section, parallel array,- -- enum, parallel array enum, list comp, parallel array comp, type application,- -- (all Template Haskell constructors), pragma, arrow definition, arrow application,- -- lambda cases, static, unboxed sum, hole- union [- "application">: ast "ApplicationExpression",- "case">: ast "CaseExpression",- "constructRecord">: ast "ConstructRecordExpression",- "do">: list $ ast "Statement", -- omitted for now: do vs. mdo- "if">: ast "IfExpression",- "infixApplication">: ast "InfixApplicationExpression",- "literal">: ast "Literal",- "lambda">: ast "LambdaExpression",- "leftSection">: ast "SectionExpression",- "let">: ast "LetExpression",- "list">: list $ ast "Expression",- "parens">: ast "Expression",- "prefixApplication">: ast "PrefixApplicationExpression",- "rightSection">: ast "SectionExpression",- "tuple">: list $ ast "Expression",- "typeSignature">: ast "TypeSignatureExpression",- "updateRecord">: ast "UpdateRecordExpression",- "variable">: ast "Name"],-- def "ApplicationExpression" $- doc "An application expression" $- record [- "function">: ast "Expression",- "argument">: ast "Expression"],-- def "CaseExpression" $- doc "A case expression" $- record [- "case">: ast "Expression",- "alternatives">: list $ ast "Alternative"],-- def "ConstructRecordExpression" $- doc "A record constructor expression" $- record [- "name">: ast "Name",- "fields">: list $ ast "FieldUpdate"],-- def "IfExpression" $- doc "An 'if' expression" $- record [- "condition">: ast "Expression",- "then">: ast "Expression",- "else">: ast "Expression"],-- def "InfixApplicationExpression" $- doc "An infix application expression" $- record [- "lhs">: ast "Expression",- "operator">: ast "Operator",- "rhs">: ast "Expression"],-- def "LambdaExpression" $- doc "A lambda expression" $- record [- "bindings">: list $ ast "Pattern",- "inner">: ast "Expression"],-- def "LetExpression" $- doc "A 'let' expression" $- record [- "bindings">: list $ ast "LocalBinding",- "inner">: ast "Expression"],-- def "PrefixApplicationExpression" $- doc "A prefix expression" $- record [- "operator">: ast "Operator",- "rhs">: ast "Expression"],-- def "SectionExpression" $- doc "A section expression" $- record [- "operator">: ast "Operator",- "expression">: ast "Expression"],-- def "TypeSignatureExpression" $- doc "A type signature expression" $- record [- "inner">: ast "Expression",- "type">: ast "Type"],-- def "UpdateRecordExpression" $- doc "An update record expression" $- record [- "inner">: ast "Expression",- "fields">: list $ ast "FieldUpdate"],-- def "Field" $ -- UFieldDecl- doc "A field (name/type pair)" $- record [- "name">: ast "Name",- "type">: ast "Type"],-- def "FieldWithComments" $- doc "A field together with any comments" $- record [- "field">: ast "Field",- "comments">: optional string],-- def "FieldUpdate" $ -- UFieldUpdate- doc "A field name and value" $- -- omitted for now: pun, wildcard- record [- "name">: ast "Name",- "value">: ast "Expression"],-- def "Import" $ -- UImportDecl- doc "An import statement" $- -- omitted for now: source, safe, pkg- record [- "qualified">: boolean,- "module">: ast "ModuleName",- "as">: optional $ ast "ModuleName",- "spec">: optional $ ast "SpecImport"],-- def "SpecImport" $- doc "An import specification" $- union [- "list">: list $ ast "ImportExportSpec",- "hiding">: list $ ast "ImportExportSpec"],-- def "ImportModifier" $ -- UImportModifier- doc "An import modifier ('pattern' or 'type')" $- enum ["pattern", "type"],-- def "ImportExportSpec" $ -- UIESpec- doc "An import or export specification" $- record [- "modifier">: optional $ ast "ImportModifier",- "name">: ast "Name",- "subspec">: optional $ ast "SubspecImportExportSpec"],-- def "SubspecImportExportSpec" $- union [- "all">: unit,- "list">: list $ ast "Name"],-- def "Literal" $ -- ULiteral- doc "A literal value" $- -- omitted for now: frac, primChar- union [- "char">: uint16,- "double">: float64,- "float">: float32,- "int">: int32,- "integer">: bigint,- "string">: string],-- def "LocalBinding" $ -- ULocalBind- -- omitted for now: fixity, pragma- union [- "signature">: ast "TypeSignature",- "value">: ast "ValueBinding"],-- def "LocalBindings" $ -- ULocalBinds- wrap $ list $ ast "LocalBinding",-- def "Module" $ -- UModule- -- omitted for now: pragma- record [- "head">: optional $ ast "ModuleHead",- "imports">: list $ ast "Import",- "declarations">: list $ ast "DeclarationWithComments"],-- def "ModuleHead" $ -- UModuleHead- -- omitted for now: pragma- record [- "comments">: optional string,- "name">: ast "ModuleName",- "exports">: list $ ast "Export"], -- UExportSpecs-- def "ModuleName" $ -- UModuleName- wrap string,-- def "Name" $ -- UName- union [- "implicit">: ast "QualifiedName",- "normal">: ast "QualifiedName",- "parens">: ast "QualifiedName"],-- def "NamePart" $ -- UNamePart- wrap string,-- def "Operator" $ -- UOperator- union [- "backtick">: ast "QualifiedName",- "normal">: ast "QualifiedName"],-- def "Pattern" $ -- UPattern- -- omitted for now: unboxed tuples, parallel arrays, irrefutable, bang, view, splice, quasiquote, plusk, unboxed sum- union [- "application">: ast "ApplicationPattern",- "as">: ast "AsPattern",- "list">: list $ ast "Pattern",- "literal">: ast "Literal",- "name">: ast "Name",- "parens">: ast "Pattern",- "record">: ast "RecordPattern",- "tuple">: list $ ast "Pattern",- "typed">: ast "TypedPattern",- "wildcard">: unit],-- def "ApplicationPattern" $- record [- "name">: ast "Name",- "args">: list $ ast "Pattern"],-- def "AsPattern" $- record [- "name">: ast "Name",- "inner">: ast "Pattern"],-- def "RecordPattern" $- record [- "name">: ast "Name",- "fields">: list $ ast "PatternField"],-- def "TypedPattern" $- record [- "inner">: ast "Pattern",- "type">: ast "Type"],-- def "PatternField" $ -- UPatternField- -- omitted for now: puns, wildcards- record [- "name">: ast "Name",- "pattern">: ast "Pattern"],-- def "QualifiedName" $ -- UQualifiedName- record [- "qualifiers">: list $ ast "NamePart",- "unqualified">: ast "NamePart"],-- def "RightHandSide" $ -- URhs- -- omitted for now: guarded rhs- wrap $ ast "Expression",-- def "Statement" $ -- UStmt- wrap $ ast "Expression",-- def "Type" $ -- UType- -- omitted for now: forall, unboxed tuple, parallel array, kinded, promoted, splice, quasiquote, bang,- -- lazy, unpack, nounpack, wildcard, named wildcard, sum- union [- "application">: ast "ApplicationType",- "ctx">: ast "ContextType",- "function">: ast "FunctionType",- "infix">: ast "InfixType",- "list">: ast "Type",- "parens">: ast "Type",- "tuple">: list $ ast "Type",- "variable">: ast "Name"],-- def "ApplicationType" $- record [- "context">: ast "Type",- "argument">: ast "Type"],-- def "ContextType" $- record [- "ctx">: ast "Assertion", -- UContext- "type">: ast "Type"],-- def "FunctionType" $- record [- "domain">: ast "Type",- "codomain">: ast "Type"],-- def "InfixType" $- record [- "lhs">: ast "Type",- "operator">: ast "Operator",- "rhs">: ast "Operator"],-- def "TypeDeclaration" $ -- UTypeDecl- record [- "name">: ast "DeclarationHead",- "type">: ast "Type"],-- def "TypeSignature" $ -- UTypeSignature- record [- "name">: ast "Name",- "type">: ast "Type"],-- def "TypedBinding" $ -- Added for convenience- record [- "typeSignature">: ast "TypeSignature",- "valueBinding">: ast "ValueBinding"],-- def "ValueBinding" $ -- UValueBind- -- omitted for now: funBind- union [- "simple">: ast "SimpleValueBinding"],-- def "SimpleValueBinding" $- record [- "pattern">: ast "Pattern",- "rhs">: ast "RightHandSide",- "localBindings">: optional $ ast "LocalBindings"],-- def "Variable" $- -- omitted for now: kind constraints- wrap $ ast "Name"]+-- | A Haskell syntax model, loosely based on Language.Haskell.Tools.AST++module Hydra.Sources.Haskell.Ast where++-- Standard type-level imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.ext.haskell.ast"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [Core.ns] [Core.ns] $+ Just "A Haskell syntax model, loosely based on Language.Haskell.Tools.AST"+ where+ elements = [+ alternative,+ assertion,+ classAssertion,+ caseRhs,+ constructor,+ ordinaryConstructor,+ recordConstructor,+ constructorWithComments,+ dataDeclaration,+ dataOrNewtype,+ declarationWithComments,+ declaration,+ declarationHead,+ applicationDeclarationHead,+ deriving_,+ export,+ expression,+ applicationExpression,+ caseExpression,+ constructRecordExpression,+ ifExpression,+ infixApplicationExpression,+ lambdaExpression,+ letExpression,+ prefixApplicationExpression,+ sectionExpression,+ typeSignatureExpression,+ updateRecordExpression,+ field,+ fieldWithComments,+ fieldUpdate,+ import_,+ specImport,+ importModifier,+ importExportSpec,+ subspecImportExportSpec,+ literal,+ localBinding,+ localBindings,+ module',+ moduleHead,+ moduleName,+ name,+ namePart,+ operator,+ pattern,+ applicationPattern,+ asPattern,+ recordPattern,+ typedPattern,+ patternField,+ qualifiedName,+ rightHandSide,+ statement,+ type_,+ applicationType,+ contextType,+ functionType,+ infixType,+ typeDeclaration,+ typeSignature,+ typedBinding,+ valueBinding,+ simpleValueBinding,+ variable]++alternative :: Binding -- UAlt+alternative = define "Alternative" $+ doc "A pattern-matching alternative" $+ T.record [+ "pattern">:+ doc "The pattern to match"+ pattern,+ "rhs">:+ doc "The right-hand side of the alternative"+ caseRhs,+ "binds">:+ doc "Optional local bindings" $+ T.maybe localBindings]++assertion :: Binding -- UAssertion (UClassAssert)+assertion = define "Assertion" $+ doc "A type assertion" $+ T.union [+ "class">:+ doc "A class assertion"+ classAssertion,+ "tuple">:+ doc "A tuple of assertions" $+ T.list assertion]+ -- omitted for now: implicit and infix assertions++classAssertion :: Binding -- UClassAssert+classAssertion = define "ClassAssertion" $+ doc "A class assertion" $+ T.record [+ "name">:+ doc "The name of the class"+ name,+ "types">:+ doc "The types to which the class is applied" $+ T.list type_]++caseRhs :: Binding -- UCaseRhs'+caseRhs = define "CaseRhs" $+ doc "The right-hand side of a pattern-matching alternative" $+ -- omitted for now: guarded+ T.wrap expression++constructor :: Binding -- UConDecl+constructor = define "Constructor" $+ doc "A data constructor" $+ -- omitted for now: ordinary (positional), infix+ T.union [+ "ordinary">:+ doc "An ordinary (positional) constructor"+ ordinaryConstructor,+ "record">:+ doc "A record constructor"+ recordConstructor]++ordinaryConstructor :: Binding+ordinaryConstructor = define "OrdinaryConstructor" $+ doc "An ordinary (positional) data constructor" $+ T.record [+ "name">:+ doc "The name of the constructor"+ name,+ "fields">:+ doc "The types of the positional fields" $+ T.list type_]++recordConstructor :: Binding+recordConstructor = define "RecordConstructor" $+ doc "A record-style data constructor" $+ T.record [+ "name">:+ doc "The name of the constructor"+ name,+ "fields">:+ doc "The named fields of the record" $+ T.list fieldWithComments]++constructorWithComments :: Binding+constructorWithComments = define "ConstructorWithComments" $+ doc "A data constructor together with any comments" $+ T.record [+ "body">:+ doc "The constructor"+ constructor,+ "comments">:+ doc "Optional comments" $+ T.maybe T.string]++dataDeclaration :: Binding -- UDataDecl+dataDeclaration = define "DataDeclaration" $+ doc "A data type declaration" $+ T.record [+ "keyword">:+ doc "The 'data' or 'newtype' keyword"+ dataOrNewtype,+ "context">:+ doc "Type class constraints" $+ T.list assertion,+ "head">:+ doc "The declaration head"+ declarationHead,+ "constructors">:+ doc "The data constructors" $+ T.list constructorWithComments,+ "deriving">:+ doc "Derived type class instances" $+ T.list deriving_]++dataOrNewtype :: Binding+dataOrNewtype = define "DataOrNewtype" $+ doc "The 'data' versus 'newtype keyword" $+ T.enum ["data", "newtype"]++declarationWithComments :: Binding+declarationWithComments = define "DeclarationWithComments" $+ doc "A data declaration together with any comments" $+ T.record [+ "body">:+ doc "The declaration"+ declaration,+ "comments">:+ doc "Optional comments" $+ T.maybe T.string]++declaration :: Binding -- UDecl+declaration = define "Declaration" $+ doc "A data or value declaration" $+ -- omitted for now: typeFamily, typeSignature, closedTypeFamily, gDataDecl, typeInst, dataInst, gDataInst, class, inst,+ -- patternSynonym, deriv, fixity, default, patTypeSig, foreignImport, foreignExport, pragma,+ -- role, splice+ T.union [+ "data">:+ doc "A data type declaration"+ dataDeclaration,+ "type">:+ doc "A type synonym declaration"+ typeDeclaration,+ "valueBinding">:+ doc "A value binding"+ valueBinding,+ "typedBinding">:+ doc "A typed binding"+ typedBinding]++declarationHead :: Binding -- UDeclHead+declarationHead = define "DeclarationHead" $+ doc "The left-hand side of a declaration" $+ -- omitted for now: infix application+ T.union [+ "application">:+ doc "An application-style declaration head"+ applicationDeclarationHead,+ "parens">:+ doc "A parenthesized declaration head"+ declarationHead,+ "simple">:+ doc "A simple name"+ name]++applicationDeclarationHead :: Binding+applicationDeclarationHead = define "ApplicationDeclarationHead" $+ doc "An application-style declaration head" $+ T.record [+ "function">:+ doc "The function being applied"+ declarationHead,+ "operand">:+ doc "The type variable operand"+ variable]++deriving_ :: Binding -- UDeriving+deriving_ = define "Deriving" $+ doc "A 'deriving' statement" $+ -- omitted for now: infix, parenthesized, and application instance heads+ T.wrap $ T.list name++export :: Binding -- UExportSpec+export = define "Export" $+ doc "An export statement" $+ T.union [+ "declaration">:+ doc "An exported declaration"+ importExportSpec,+ "module">:+ doc "An exported module"+ moduleName]++expression :: Binding -- UExpr+expression = define "Expression" $+ doc "A data expression" $+ -- omitted for now: multi-if, unboxed tuple, tuple section, unboxed tuple section, parallel array,+ -- enum, parallel array enum, list comp, parallel array comp, type application,+ -- (all Template Haskell constructors), pragma, arrow definition, arrow application,+ -- lambda cases, static, unboxed sum, hole+ T.union [+ "application">:+ doc "A function application"+ applicationExpression,+ "case">:+ doc "A case expression"+ caseExpression,+ "constructRecord">:+ doc "A record constructor expression"+ constructRecordExpression,+ "do">:+ doc "A 'do' expression" $+ T.list statement, -- omitted for now: do vs. mdo+ "if">:+ doc "An 'if' expression"+ ifExpression,+ "infixApplication">:+ doc "An infix application"+ infixApplicationExpression,+ "literal">:+ doc "A literal value"+ literal,+ "lambda">:+ doc "A lambda expression"+ lambdaExpression,+ "leftSection">:+ doc "A left section expression"+ sectionExpression,+ "let">:+ doc "A 'let' expression"+ letExpression,+ "list">:+ doc "A list expression" $+ T.list expression,+ "parens">:+ doc "A parenthesized expression"+ expression,+ "prefixApplication">:+ doc "A prefix application"+ prefixApplicationExpression,+ "rightSection">:+ doc "A right section expression"+ sectionExpression,+ "tuple">:+ doc "A tuple expression" $+ T.list expression,+ "typeSignature">:+ doc "A type signature expression"+ typeSignatureExpression,+ "updateRecord">:+ doc "A record update expression"+ updateRecordExpression,+ "variable">:+ doc "A variable reference"+ name]++applicationExpression :: Binding+applicationExpression = define "ApplicationExpression" $+ doc "An application expression" $+ T.record [+ "function">:+ doc "The function being applied"+ expression,+ "argument">:+ doc "The argument"+ expression]++caseExpression :: Binding+caseExpression = define "CaseExpression" $+ doc "A case expression" $+ T.record [+ "case">:+ doc "The expression being matched"+ expression,+ "alternatives">:+ doc "The pattern-matching alternatives" $+ T.list alternative]++constructRecordExpression :: Binding+constructRecordExpression = define "ConstructRecordExpression" $+ doc "A record constructor expression" $+ T.record [+ "name">:+ doc "The constructor name"+ name,+ "fields">:+ doc "The field assignments" $+ T.list fieldUpdate]++ifExpression :: Binding+ifExpression = define "IfExpression" $+ doc "An 'if' expression" $+ T.record [+ "condition">:+ doc "The condition expression"+ expression,+ "then">:+ doc "The 'then' branch"+ expression,+ "else">:+ doc "The 'else' branch"+ expression]++infixApplicationExpression :: Binding+infixApplicationExpression = define "InfixApplicationExpression" $+ doc "An infix application expression" $+ T.record [+ "lhs">:+ doc "The left-hand operand"+ expression,+ "operator">:+ doc "The infix operator"+ operator,+ "rhs">:+ doc "The right-hand operand"+ expression]++lambdaExpression :: Binding+lambdaExpression = define "LambdaExpression" $+ doc "A lambda expression" $+ T.record [+ "bindings">:+ doc "The patterns binding parameters" $+ T.list pattern,+ "inner">:+ doc "The body of the lambda"+ expression]++letExpression :: Binding+letExpression = define "LetExpression" $+ doc "A 'let' expression" $+ T.record [+ "bindings">:+ doc "The local bindings" $+ T.list localBinding,+ "inner">:+ doc "The body of the let expression"+ expression]++prefixApplicationExpression :: Binding+prefixApplicationExpression = define "PrefixApplicationExpression" $+ doc "A prefix expression" $+ T.record [+ "operator">:+ doc "The prefix operator"+ operator,+ "rhs">:+ doc "The operand"+ expression]++sectionExpression :: Binding+sectionExpression = define "SectionExpression" $+ doc "A section expression" $+ T.record [+ "operator">:+ doc "The operator"+ operator,+ "expression">:+ doc "The operand"+ expression]++typeSignatureExpression :: Binding+typeSignatureExpression = define "TypeSignatureExpression" $+ doc "A type signature expression" $+ T.record [+ "inner">:+ doc "The expression being typed"+ expression,+ "type">:+ doc "The type signature"+ type_]++updateRecordExpression :: Binding+updateRecordExpression = define "UpdateRecordExpression" $+ doc "An update record expression" $+ T.record [+ "inner">:+ doc "The record being updated"+ expression,+ "fields">:+ doc "The field updates" $+ T.list fieldUpdate]++field :: Binding -- UFieldDecl+field = define "Field" $+ doc "A field (name/type pair)" $+ T.record [+ "name">:+ doc "The field name"+ name,+ "type">:+ doc "The field type"+ type_]++fieldWithComments :: Binding+fieldWithComments = define "FieldWithComments" $+ doc "A field together with any comments" $+ T.record [+ "field">:+ doc "The field"+ field,+ "comments">:+ doc "Optional comments" $+ T.maybe T.string]++fieldUpdate :: Binding -- UFieldUpdate+fieldUpdate = define "FieldUpdate" $+ doc "A field name and value" $+ -- omitted for now: pun, wildcard+ T.record [+ "name">:+ doc "The field name"+ name,+ "value">:+ doc "The field value"+ expression]++import_ :: Binding -- UImportDecl+import_ = define "Import" $+ doc "An import statement" $+ -- omitted for now: source, safe, pkg+ T.record [+ "qualified">:+ doc "Whether the import is qualified"+ T.boolean,+ "module">:+ doc "The module being imported"+ moduleName,+ "as">:+ doc "Optional alias for the module" $+ T.maybe moduleName,+ "spec">:+ doc "Optional import specification" $+ T.maybe specImport]++specImport :: Binding+specImport = define "SpecImport" $+ doc "An import specification" $+ T.union [+ "list">:+ doc "A list of imports to include" $+ T.list importExportSpec,+ "hiding">:+ doc "A list of imports to exclude" $+ T.list importExportSpec]++importModifier :: Binding -- UImportModifier+importModifier = define "ImportModifier" $+ doc "An import modifier ('pattern' or 'type')" $+ T.enum ["pattern", "type"]++importExportSpec :: Binding -- UIESpec+importExportSpec = define "ImportExportSpec" $+ doc "An import or export specification" $+ T.record [+ "modifier">:+ doc "Optional import modifier" $+ T.maybe importModifier,+ "name">:+ doc "The name being imported or exported"+ name,+ "subspec">:+ doc "Optional subspecification" $+ T.maybe subspecImportExportSpec]++subspecImportExportSpec :: Binding+subspecImportExportSpec = define "SubspecImportExportSpec" $+ doc "A subspecification within an import/export" $+ T.union [+ "all">:+ doc "Import/export all"+ T.unit,+ "list">:+ doc "Import/export specific names" $+ T.list name]++literal :: Binding -- ULiteral+literal = define "Literal" $+ doc "A literal value" $+ -- omitted for now: frac, primChar+ T.union [+ "char">:+ doc "A character literal"+ T.uint16,+ "double">:+ doc "A double-precision floating point literal"+ T.float64,+ "float">:+ doc "A single-precision floating point literal"+ T.float32,+ "int">:+ doc "A 32-bit integer literal"+ T.int32,+ "integer">:+ doc "An arbitrary-precision integer literal"+ T.bigint,+ "string">:+ doc "A string literal"+ T.string]++localBinding :: Binding -- ULocalBind+localBinding = define "LocalBinding" $+ doc "A local binding" $+ -- omitted for now: fixity, pragma+ T.union [+ "signature">:+ doc "A type signature"+ typeSignature,+ "value">:+ doc "A value binding"+ valueBinding]++localBindings :: Binding -- ULocalBinds+localBindings = define "LocalBindings" $+ doc "A collection of local bindings" $+ T.wrap $ T.list localBinding++module' :: Binding -- UModule+module' = define "Module" $+ doc "A Haskell module" $+ -- omitted for now: pragma+ T.record [+ "head">:+ doc "Optional module head" $+ T.maybe moduleHead,+ "imports">:+ doc "Import statements" $+ T.list import_,+ "declarations">:+ doc "Module declarations" $+ T.list declarationWithComments]++moduleHead :: Binding -- UModuleHead+moduleHead = define "ModuleHead" $+ doc "A module head" $+ -- omitted for now: pragma+ T.record [+ "comments">:+ doc "Optional module-level comments" $+ T.maybe T.string,+ "name">:+ doc "The module name"+ moduleName,+ "exports">:+ doc "Export list" $+ T.list export] -- UExportSpecs++moduleName :: Binding -- UModuleName+moduleName = define "ModuleName" $+ doc "A module name" $+ T.wrap T.string++name :: Binding -- UName+name = define "Name" $+ doc "A name" $+ T.union [+ "implicit">:+ doc "An implicit name"+ qualifiedName,+ "normal">:+ doc "A normal name"+ qualifiedName,+ "parens">:+ doc "A parenthesized name"+ qualifiedName]++namePart :: Binding -- UNamePart+namePart = define "NamePart" $+ doc "A component of a qualified name" $+ T.wrap T.string++operator :: Binding -- UOperator+operator = define "Operator" $+ doc "An operator" $+ T.union [+ "backtick">:+ doc "A function used as an infix operator"+ qualifiedName,+ "normal">:+ doc "A normal infix operator"+ qualifiedName]++pattern :: Binding -- UPattern+pattern = define "Pattern" $+ doc "A pattern" $+ -- omitted for now: unboxed tuples, parallel arrays, irrefutable, bang, view, splice, quasiquote, plusk, unboxed sum+ T.union [+ "application">:+ doc "An application pattern"+ applicationPattern,+ "as">:+ doc "An 'as' pattern"+ asPattern,+ "list">:+ doc "A list pattern" $+ T.list pattern,+ "literal">:+ doc "A literal pattern"+ literal,+ "name">:+ doc "A name pattern"+ name,+ "parens">:+ doc "A parenthesized pattern"+ pattern,+ "record">:+ doc "A record pattern"+ recordPattern,+ "tuple">:+ doc "A tuple pattern" $+ T.list pattern,+ "typed">:+ doc "A typed pattern"+ typedPattern,+ "wildcard">:+ doc "A wildcard pattern"+ T.unit]++applicationPattern :: Binding+applicationPattern = define "ApplicationPattern" $+ doc "An application pattern" $+ T.record [+ "name">:+ doc "The constructor name"+ name,+ "args">:+ doc "The pattern arguments" $+ T.list pattern]++asPattern :: Binding+asPattern = define "AsPattern" $+ doc "An 'as' pattern" $+ T.record [+ "name">:+ doc "The bound name"+ name,+ "inner">:+ doc "The inner pattern"+ pattern]++recordPattern :: Binding+recordPattern = define "RecordPattern" $+ doc "A record pattern" $+ T.record [+ "name">:+ doc "The constructor name"+ name,+ "fields">:+ doc "The field patterns" $+ T.list patternField]++typedPattern :: Binding+typedPattern = define "TypedPattern" $+ doc "A typed pattern" $+ T.record [+ "inner">:+ doc "The inner pattern"+ pattern,+ "type">:+ doc "The type annotation"+ type_]++patternField :: Binding -- UPatternField+patternField = define "PatternField" $+ doc "A pattern field" $+ -- omitted for now: puns, wildcards+ T.record [+ "name">:+ doc "The field name"+ name,+ "pattern">:+ doc "The field pattern"+ pattern]++qualifiedName :: Binding -- UQualifiedName+qualifiedName = define "QualifiedName" $+ doc "A qualified name" $+ T.record [+ "qualifiers">:+ doc "The qualifier parts" $+ T.list namePart,+ "unqualified">:+ doc "The unqualified name part"+ namePart]++rightHandSide :: Binding -- URhs+rightHandSide = define "RightHandSide" $+ doc "A right-hand side of a binding" $+ -- omitted for now: guarded rhs+ T.wrap expression++statement :: Binding -- UStmt+statement = define "Statement" $+ doc "A do-notation statement" $+ T.wrap expression++type_ :: Binding -- UType+type_ = define "Type" $+ doc "A type expression" $+ -- omitted for now: forall, unboxed tuple, parallel array, kinded, promoted, splice, quasiquote, bang,+ -- lazy, unpack, nounpack, wildcard, named wildcard, sum+ T.union [+ "application">:+ doc "An application type"+ applicationType,+ "ctx">:+ doc "A context type"+ contextType,+ "function">:+ doc "A function type"+ functionType,+ "infix">:+ doc "An infix type"+ infixType,+ "list">:+ doc "A list type"+ type_,+ "parens">:+ doc "A parenthesized type"+ type_,+ "tuple">:+ doc "A tuple type" $+ T.list type_,+ "variable">:+ doc "A type variable or type name"+ name]++applicationType :: Binding+applicationType = define "ApplicationType" $+ doc "An application type" $+ T.record [+ "context">:+ doc "The type being applied"+ type_,+ "argument">:+ doc "The type argument"+ type_]++contextType :: Binding+contextType = define "ContextType" $+ doc "A type with a context (type class constraints)" $+ T.record [+ "ctx">:+ doc "The type class context"+ assertion, -- UContext+ "type">:+ doc "The constrained type"+ type_]++functionType :: Binding+functionType = define "FunctionType" $+ doc "A function type" $+ T.record [+ "domain">:+ doc "The domain type"+ type_,+ "codomain">:+ doc "The codomain type"+ type_]++infixType :: Binding+infixType = define "InfixType" $+ doc "An infix type application" $+ T.record [+ "lhs">:+ doc "The left-hand type"+ type_,+ "operator">:+ doc "The type operator"+ operator,+ "rhs">:+ doc "The right-hand operator"+ operator]++typeDeclaration :: Binding -- UTypeDecl+typeDeclaration = define "TypeDeclaration" $+ doc "A type synonym declaration" $+ T.record [+ "name">:+ doc "The declaration head"+ declarationHead,+ "type">:+ doc "The type being defined"+ type_]++typeSignature :: Binding -- UTypeSignature+typeSignature = define "TypeSignature" $+ doc "A type signature" $+ T.record [+ "name">:+ doc "The name being typed"+ name,+ "type">:+ doc "The type"+ type_]++typedBinding :: Binding -- Added for convenience+typedBinding = define "TypedBinding" $+ doc "A binding with its type signature" $+ T.record [+ "typeSignature">:+ doc "The type signature"+ typeSignature,+ "valueBinding">:+ doc "The value binding"+ valueBinding]++valueBinding :: Binding -- UValueBind+valueBinding = define "ValueBinding" $+ doc "A value binding" $+ -- omitted for now: funBind+ T.union [+ "simple">:+ doc "A simple value binding"+ simpleValueBinding]++simpleValueBinding :: Binding+simpleValueBinding = define "SimpleValueBinding" $+ doc "A simple value binding" $+ T.record [+ "pattern">:+ doc "The pattern being bound"+ pattern,+ "rhs">:+ doc "The right-hand side"+ rightHandSide,+ "localBindings">:+ doc "Optional local bindings (where clause)" $+ T.maybe localBindings]++variable :: Binding+variable = define "Variable" $+ doc "A type variable" $+ -- omitted for now: kind constraints+ T.wrap name
src/main/haskell/Hydra/Sources/Haskell/Coder.hs view
@@ -1,861 +1,1097 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Haskell.Coder where---- Standard imports for term-level sources outside of the kernel-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---- Additional imports-import qualified Hydra.Ext.Haskell.Ast as H-import qualified Hydra.Sources.Haskell.Language as HaskellLanguage-import qualified Hydra.Sources.Haskell.Ast as HaskellAst-import qualified Hydra.Sources.Haskell.Serde as HaskellSerde-import qualified Hydra.Sources.Haskell.Utils as HaskellUtils---type HaskellNamespaces = Namespaces H.ModuleName--haskellCoderDefinition :: String -> TTerm a -> TBinding a-haskellCoderDefinition = definitionInModule haskellCoderModule--haskellCoderModule :: Module-haskellCoderModule = Module ns elements- [HaskellSerde.haskellSerdeModule, HaskellUtils.haskellUtilsModule,- AdaptModules.module_, Rewriting.module_, Serialization.module_]- (HaskellAst.haskellAstModule:KernelTypes.kernelTypesModules) $- Just "Functions for encoding Hydra modules as Haskell modules"- where- ns = Namespace "hydra.ext.haskell.coder"- elements = [- el includeTypeDefinitionsDef,- el useCoreImportDef,- el keyHaskellVarDef,- el adaptTypeToHaskellAndEncodeDef,- el constantForFieldNameDef,- el constantForTypeNameDef,- el constructModuleDef,- el encodeFunctionDef,- el encodeLiteralDef,- el encodeTermDef,- el encodeTypeDef,- el encodeTypeWithClassAssertionsDef,- el findOrdVariablesDef,- el getImplicitTypeClassesDef,- el moduleToHaskellModuleDef,- el moduleToHaskellDef,- el nameDeclsDef,- el toDataDeclarationDef,- el toTypeDeclarationsDef,- el typeDeclDef]---- TODO: make these settings configurable-includeTypeDefinitionsDef :: TBinding Bool-includeTypeDefinitionsDef = haskellCoderDefinition "includeTypeDefinitions" $- false-useCoreImportDef :: TBinding Bool-useCoreImportDef = haskellCoderDefinition "useCoreImport" $- true--keyHaskellVarDef :: TBinding Name-keyHaskellVarDef = haskellCoderDefinition "keyHaskellVar" $- wrap _Name $ string "haskellVar"--adaptTypeToHaskellAndEncodeDef :: TBinding (HaskellNamespaces -> Type -> Flow Graph H.Type)-adaptTypeToHaskellAndEncodeDef = haskellCoderDefinition "adaptTypeToHaskellAndEncode" $- lambda "namespaces" $- ref AdaptModules.adaptTypeToLanguageAndEncodeDef @@ (ref HaskellLanguage.haskellLanguageDef) @@ (ref encodeTypeDef @@ var "namespaces")--constantForFieldNameDef :: TBinding (Name -> Name -> String)-constantForFieldNameDef = haskellCoderDefinition "constantForFieldName" $- lambda "tname" $ lambda "fname" $- Strings.cat $ list [- string "_",- ref Names.localNameOfDef @@ var "tname",- string "_",- Core.unName $ var "fname"]--constantForTypeNameDef :: TBinding (Name -> String)-constantForTypeNameDef = haskellCoderDefinition "constantForTypeName" $- lambda "tname" $- Strings.cat2 (string "_") (ref Names.localNameOfDef @@ var "tname")--constructModuleDef :: TBinding (HaskellNamespaces -> Module -> M.Map Type (Coder Graph Graph Term H.Expression) -> [(Binding, TypedTerm)] -> Flow Graph H.Module)-constructModuleDef = haskellCoderDefinition "constructModule" $ lambdas ["namespaces", "mod", "coders", "pairs"] $ lets [- "h">: lambda "namespace" $- unwrap _Namespace @@ var "namespace",- "createDeclarations">: lambda "g" $ lambda "pair" $ lets [- "el">: first $ var "pair",- "tt">: second $ var "pair",- "term">: Core.typedTermTerm $ var "tt",- "typ">: Core.typedTermType $ var "tt"] $- Logic.ifElse (ref Annotations.isNativeTypeDef @@ var "el")- (ref toTypeDeclarationsDef @@ var "namespaces" @@ var "el" @@ var "term")- (bind "d" (ref toDataDeclarationDef @@ var "coders" @@ var "namespaces" @@ var "pair") $- Flows.pure $ list [var "d"]),- "importName">: lambda "name" $- wrap H._ModuleName $ Strings.intercalate (string ".") (Lists.map (ref Formatting.capitalizeDef) (Strings.splitOn (string ".") (var "name"))),- "imports">: Lists.concat2 (var "domainImports") (var "standardImports"),- "domainImports">: lets [- "toImport">: lambda "pair" $ lets [- "namespace">: first $ var "pair",- "alias">: second $ var "pair",- "name">: var "h" @@ var "namespace"] $- record H._Import [- H._Import_qualified>>: true,- H._Import_module>>: var "importName" @@ var "name",- H._Import_as>>: just $ var "alias",- H._Import_spec>>: nothing]] $- Lists.map (var "toImport") (Maps.toList $ Module.namespacesMapping $ var "namespaces"),- "standardImports">: lets [- "toImport">: lambda "triple" $ lets [- "name">: first $ first $ var "triple",- "malias">: second $ first $ var "triple",- "hidden">: second $ var "triple",- "spec">: Logic.ifElse (Lists.null $ var "hidden")- nothing- (just $ inject H._SpecImport H._SpecImport_hiding $ Lists.map (lambda "n" $ record H._ImportExportSpec [- H._ImportExportSpec_modifier>>: nothing,- H._ImportExportSpec_name>>: ref HaskellUtils.simpleNameDef @@ var "n",- H._ImportExportSpec_subspec>>: nothing]) (var "hidden"))] $- record H._Import [- H._Import_qualified>>: Optionals.isJust $ var "malias",- H._Import_module>>: wrap H._ModuleName $ var "name",- H._Import_as>>: Optionals.map (unaryFunction $ wrap H._ModuleName) (var "malias"),- H._Import_spec>>: var "spec"]] $- Lists.map (var "toImport") $ list [- pair (pair (string "Prelude") nothing) (list $ string <$> [- "Enum", "Ordering", "fail", "map", "pure", "sum"]),- pair (pair (string "Data.Int") (just $ string "I")) (list []),- pair (pair (string "Data.List") (just $ string "L")) (list []),- pair (pair (string "Data.Map") (just $ string "M")) (list []),- pair (pair (string "Data.Set") (just $ string "S")) (list [])]] $- bind "g" (ref Monads.getStateDef) $- bind "declLists" (Flows.mapList (var "createDeclarations" @@ var "g") (var "pairs")) $ lets [- "decls">: Lists.concat $ var "declLists",- "mc">: Module.moduleDescription $ var "mod"] $- Flows.pure $ record H._Module [- H._Module_head>>: just $ record H._ModuleHead [- H._ModuleHead_comments>>: var "mc",- H._ModuleHead_name>>: var "importName" @@ (var "h" @@ (Module.moduleNamespace $ var "mod")),- H._ModuleHead_exports>>: list []],- H._Module_imports>>: var "imports",- H._Module_declarations>>: var "decls"]--encodeFunctionDef :: TBinding (HaskellNamespaces -> Function -> Flow Graph H.Expression)-encodeFunctionDef = haskellCoderDefinition "encodeFunction" $- lambda "namespaces" $ lambda "fun" $- cases _Function (var "fun") Nothing [- _Function_elimination>>: lambda "e" $- cases _Elimination (var "e") Nothing [- _Elimination_wrap>>: lambda "name" $- Flows.pure $ inject H._Expression H._Expression_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@- (ref Names.qnameDef @@ (Optionals.fromJust $ ref Names.namespaceOfDef @@ var "name") @@ (ref HaskellUtils.newtypeAccessorNameDef @@ var "name")),- _Elimination_product>>: lambda "proj" $ lets [- "arity">: Core.tupleProjectionArity $ var "proj",- "idx">: Core.tupleProjectionIndex $ var "proj"] $- Logic.ifElse (Equality.equal (var "arity") (int32 2))- (Flows.pure $ ref HaskellUtils.hsvarDef @@ Logic.ifElse (Equality.equal (var "idx") (int32 0)) (string "fst") (string "snd"))- (Flows.fail $ string "Eliminations for tuples of arity > 2 are not supported yet in the Haskell coder"),- _Elimination_record>>: lambda "proj" $ lets [- "dn">: Core.projectionTypeName $ var "proj",- "fname">: Core.projectionField $ var "proj"] $- Flows.pure $ inject H._Expression H._Expression_variable $ ref HaskellUtils.recordFieldReferenceDef @@ var "namespaces" @@ var "dn" @@ var "fname",- _Elimination_union>>: lambda "stmt" $ lets [- "dn">: Core.caseStatementTypeName $ var "stmt",- "def">: Core.caseStatementDefault $ var "stmt",- "fields">: Core.caseStatementCases $ var "stmt",- "caseExpr">:- bind "rt" (ref Lexical.withSchemaContextDef @@ (ref Schemas.requireUnionTypeDef @@ var "dn")) $ lets [- "fieldMap">: Maps.fromList $ Lists.map (var "toFieldMapEntry") (Core.rowTypeFields $ var "rt"),- "toFieldMapEntry">: lambda "f" $- pair (Core.fieldTypeName $ var "f") (var "f")] $- bind "ecases" (Flows.mapList (var "toAlt" @@ var "fieldMap") (var "fields")) $- bind "dcases" (Optionals.cases (var "def")- (Flows.pure $ list []) $- (lambda "d" $- bind "cs" (Flows.map (unaryFunction $ wrap H._CaseRhs) $ ref encodeTermDef @@ var "namespaces" @@ var "d") $ lets [- "lhs">: inject H._Pattern H._Pattern_name $ ref HaskellUtils.rawNameDef @@ (ref Constants.ignoredVariableDef),- "alt">: record H._Alternative [- H._Alternative_pattern>>: var "lhs",- H._Alternative_rhs>>: var "cs",- H._Alternative_binds>>: nothing]] $- Flows.pure $ list [var "alt"])) $- Flows.pure $ inject H._Expression H._Expression_case $ record H._CaseExpression [- H._CaseExpression_case>>: ref HaskellUtils.hsvarDef @@ string "x",- H._CaseExpression_alternatives>>: Lists.concat2 (var "ecases") (var "dcases")],- "toAlt">: lambdas ["fieldMap", "field"] $ lets [- "fn">: Core.fieldName $ var "field",- "fun'">: Core.fieldTerm $ var "field"] $- ref Annotations.withDepthDef @@ ref keyHaskellVarDef @@ (- lambda "depth" $ lets [- "v0">: Strings.cat2 (string "v") (Literals.showInt32 $ var "depth"),- "raw">: TTerms.apply (var "fun'") (Core.termVariable $ Core.name $ var "v0"),- "rhsTerm">: ref Rewriting.simplifyTermDef @@ var "raw",- "v1">: Logic.ifElse (ref Rewriting.isFreeVariableInTermDef @@ (wrap _Name $ var "v0") @@ var "rhsTerm")- (ref Constants.ignoredVariableDef)- (var "v0"),- "hname">: ref HaskellUtils.unionFieldReferenceDef @@ var "namespaces" @@ var "dn" @@ var "fn"] $- bind "args"- (Optionals.cases (Maps.lookup (var "fn") (var "fieldMap"))- (Flows.fail $ Strings.cat $ list [string "field ", Literals.showString $ (Core.unName $ var "fn"),- string " not found in ", Literals.showString $ (Core.unName $ var "dn")])- (lambda "fieldType" $ lets [- "ft">: Core.fieldTypeType $ var "fieldType",- "noArgs">: Flows.pure $ list [],- "singleArg">: Flows.pure $ list [inject H._Pattern H._Pattern_name $ ref HaskellUtils.rawNameDef @@ var "v1"]] $- cases _Type (ref Rewriting.deannotateTypeDef @@ var "ft")- (Just $ var "singleArg") [- _Type_unit>>: constant $ var "noArgs"])) $ lets [- "lhs">: ref HaskellUtils.applicationPatternDef @@ var "hname" @@ var "args"] $- bind "rhs" (Flows.map (unaryFunction $ wrap H._CaseRhs) $ ref encodeTermDef @@ var "namespaces" @@ var "rhsTerm") $- Flows.pure $ record H._Alternative [- H._Alternative_pattern>>: var "lhs",- H._Alternative_rhs>>: var "rhs",- H._Alternative_binds>>: nothing])] $- Flows.map (ref HaskellUtils.hslambdaDef @@ (ref HaskellUtils.rawNameDef @@ string "x")) (var "caseExpr")],- _Function_lambda>>: lambda "lam" $ lets [- "v">: Core.lambdaParameter $ var "lam",- "body">: Core.lambdaBody $ var "lam"] $- Flows.bind (ref encodeTermDef @@ var "namespaces" @@ var "body") $ lambda "hbody" $- Flows.pure $ ref HaskellUtils.hslambdaDef @@ (ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "v") @@ var "hbody",- _Function_primitive>>: lambda "name" $- Flows.pure $ inject H._Expression H._Expression_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "name"]--encodeLiteralDef :: TBinding (Literal -> Flow Graph H.Expression)-encodeLiteralDef = haskellCoderDefinition "encodeLiteral" $- lambda "l" $- cases _Literal (var "l")- (Just $ Flows.fail $ Strings.cat2 (string "literal value ") (ref ShowCore.literalDef @@ var "l")) [- _Literal_boolean>>: lambda "b" $- Flows.pure $ ref HaskellUtils.hsvarDef @@ Logic.ifElse (var "b") (string "True") (string "False"),- _Literal_float>>: lambda "fv" $- cases _FloatValue (var "fv") Nothing [- _FloatValue_float32>>: lambda "f" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_float $ var "f"),- _FloatValue_float64>>: lambda "f" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_double $ var "f"),- _FloatValue_bigfloat>>: lambda "f" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_double $ Literals.bigfloatToFloat64 $ var "f")],- _Literal_integer>>: lambda "iv" $- cases _IntegerValue (var "iv") Nothing [- _IntegerValue_bigint>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ var "i"),- _IntegerValue_int8>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.int8ToBigint $ var "i"),- _IntegerValue_int16>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.int16ToBigint $ var "i"),- _IntegerValue_int32>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_int $ var "i"),- _IntegerValue_int64>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.int64ToBigint $ var "i"),- _IntegerValue_uint8>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.uint8ToBigint $ var "i"),- _IntegerValue_uint16>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.uint16ToBigint $ var "i"),- _IntegerValue_uint32>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.uint32ToBigint $ var "i"),- _IntegerValue_uint64>>: lambda "i" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_integer $ Literals.uint64ToBigint $ var "i")],- _Literal_string>>: lambda "s" $- Flows.pure $ ref HaskellUtils.hslitDef @@ (inject H._Literal H._Literal_string $ var "s")]--encodeTermDef :: TBinding (HaskellNamespaces -> Term -> Flow Graph H.Expression)-encodeTermDef = haskellCoderDefinition "encodeTerm" $- lambda "namespaces" $ lambda "term" $ lets [- "encode">: ref encodeTermDef @@ var "namespaces"] $- cases _Term (ref Rewriting.deannotateTermDef @@ var "term")- (Just $ Flows.fail $ Strings.cat2 (string "unexpected term: ") (ref ShowCore.termDef @@ var "term")) [- _Term_application>>: lambda "app" $ lets [- "fun">: Core.applicationFunction $ var "app",- "arg">: Core.applicationArgument $ var "app"] $- Flows.bind (var "encode" @@ var "fun") $ lambda "hfun" $- Flows.bind (var "encode" @@ var "arg") $ lambda "harg" $- Flows.pure $ ref HaskellUtils.hsappDef @@ var "hfun" @@ var "harg",- _Term_function>>: lambda "f" $- ref encodeFunctionDef @@ var "namespaces" @@ var "f",- _Term_let>>: lambda "letTerm" $ lets [- "bindings">: Core.letBindings $ var "letTerm",- "env">: Core.letEnvironment $ var "letTerm",- "encodeBinding">: lambda "binding" $ lets [- "name">: Core.bindingName $ var "binding",- "term'">: Core.bindingTerm $ var "binding",- "hname">: ref HaskellUtils.simpleNameDef @@ (Core.unName $ var "name")] $- bind "hexpr" (var "encode" @@ var "term'") $- Flows.pure $ inject H._LocalBinding H._LocalBinding_value $ ref HaskellUtils.simpleValueBindingDef @@ var "hname" @@ var "hexpr" @@ nothing] $- bind "hbindings" (Flows.mapList (var "encodeBinding") (var "bindings")) $- bind "hinner" (var "encode" @@ var "env") $- Flows.pure $ inject H._Expression H._Expression_let $ record H._LetExpression [- H._LetExpression_bindings>>: var "hbindings",- H._LetExpression_inner>>: var "hinner"],- _Term_list>>: lambda "els" $- Flows.bind (Flows.mapList (var "encode") (var "els")) $ lambda "helems" $- Flows.pure $ inject H._Expression H._Expression_list $ var "helems",- _Term_literal>>: lambda "v" $- ref encodeLiteralDef @@ var "v",- _Term_map>>: lambda "m" $ lets [- "lhs">: ref HaskellUtils.hsvarDef @@ string "M.fromList",- "encodePair">: lambda "pair" $ lets [- "k">: first $ var "pair",- "v">: second $ var "pair",- "hk">: var "encode" @@ var "k",- "hv">: var "encode" @@ var "v"] $- Flows.map- (unaryFunction $ inject H._Expression H._Expression_tuple)- (Flows.sequence $ list [var "hk", var "hv"])] $- bind "rhs" (Flows.map- (unaryFunction $ inject H._Expression H._Expression_list)- (Flows.mapList (var "encodePair") $ Maps.toList (var "m"))) $- Flows.pure $ ref HaskellUtils.hsappDef @@ var "lhs" @@ var "rhs",- _Term_optional>>: lambda "m" $- Optionals.cases (var "m")- (Flows.pure $ ref HaskellUtils.hsvarDef @@ string "Nothing") $- lambda "t" $- Flows.bind (var "encode" @@ var "t") $ lambda "ht" $- Flows.pure $ ref HaskellUtils.hsappDef @@ (ref HaskellUtils.hsvarDef @@ string "Just") @@ var "ht",- _Term_product>>: lambda "terms" $- Flows.bind (Flows.mapList (var "encode") (var "terms")) $ lambda "hterms" $- Flows.pure $ inject H._Expression H._Expression_tuple $ var "hterms",- _Term_record>>: lambda "record" $ lets [- "sname">: Core.recordTypeName $ var "record",- "fields">: Core.recordFields $ var "record",- "toFieldUpdate">: lambda "field" $ lets [- "fn">: Core.fieldName $ var "field",- "ft">: Core.fieldTerm $ var "field",- "fieldRef">: ref HaskellUtils.recordFieldReferenceDef @@ var "namespaces" @@ var "sname" @@ var "fn"] $- bind "hft" (var "encode" @@ var "ft") $- Flows.pure $ record H._FieldUpdate [- H._FieldUpdate_name>>: var "fieldRef",- H._FieldUpdate_value>>: var "hft"],- "typeName">: ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "sname"] $- bind "updates" (Flows.mapList (var "toFieldUpdate") (var "fields")) $- Flows.pure $ inject H._Expression H._Expression_constructRecord $ record H._ConstructRecordExpression [- H._ConstructRecordExpression_name>>: var "typeName",- H._ConstructRecordExpression_fields>>: var "updates"],- _Term_set>>: lambda "s" $ lets [- "lhs">: ref HaskellUtils.hsvarDef @@ string "S.fromList" ] $- bind "rhs" (ref encodeTermDef @@ var "namespaces" @@ (inject _Term _Term_list $ Sets.toList $ var "s")) $- Flows.pure $ ref HaskellUtils.hsappDef @@ var "lhs" @@ var "rhs",- _Term_typeLambda>>: lambda "abs" $ lets [- "term1">: Core.typeLambdaBody $ var "abs"] $- var "encode" @@ var "term1",- _Term_typeApplication>>: lambda "typed" $ lets [- "term1">: Core.typedTermTerm $ var "typed"] $- var "encode" @@ var "term1",- _Term_union>>: lambda "injection" $ lets [- "sname">: Core.injectionTypeName $ var "injection",- "field">: Core.injectionField $ var "injection",- "fn">: Core.fieldName $ var "field",- "ft">: Core.fieldTerm $ var "field",- "lhs">: inject H._Expression H._Expression_variable $ ref HaskellUtils.unionFieldReferenceDef @@ var "namespaces" @@ var "sname" @@ var "fn",- "dflt">: Flows.map (ref HaskellUtils.hsappDef @@ var "lhs") (var "encode" @@ var "ft")] $- cases _Term (ref Rewriting.deannotateTermDef @@ var "ft")- (Just $ var "dflt") [- _Term_unit>>: constant $ Flows.pure $ var "lhs"],- _Term_unit>>: constant $ Flows.pure $ inject H._Expression H._Expression_tuple $ list [],- _Term_variable>>: lambda "name" $- Flows.pure $ inject H._Expression H._Expression_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "name",- _Term_wrap>>: lambda "wrapped" $ lets [- "tname">: Core.wrappedTermTypeName $ var "wrapped",- "term'">: Core.wrappedTermObject $ var "wrapped",- "lhs">: inject H._Expression H._Expression_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "tname"] $- bind "rhs" (var "encode" @@ var "term'") $- Flows.pure $ ref HaskellUtils.hsappDef @@ var "lhs" @@ var "rhs"]--encodeTypeDef :: TBinding (HaskellNamespaces -> Type -> Flow Graph H.Type)-encodeTypeDef = haskellCoderDefinition "encodeType" $- lambda "namespaces" $- lambda "typ" $ lets [- "encode">: ref encodeTypeDef @@ var "namespaces",- "ref">: lambda "name" $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "name",- "unitTuple">: inject H._Type H._Type_tuple $ list []] $- trace "encode type" $- cases _Type (ref Rewriting.deannotateTypeDef @@ var "typ")- (Just $ Flows.fail $ Strings.cat2 (string "unexpected type: ") (ref ShowCore.typeDef @@ var "typ")) [- _Type_application>>: lambda "app" $ lets [- "lhs">: Core.applicationTypeFunction $ var "app",- "rhs">: Core.applicationTypeArgument $ var "app"] $- Flows.bind (var "encode" @@ var "lhs") $ lambda "hlhs" $- Flows.bind (var "encode" @@ var "rhs") $ lambda "hrhs" $- Flows.pure $ ref HaskellUtils.toTypeApplicationDef @@ list [var "hlhs", var "hrhs"],- _Type_function>>: lambda "funType" $ lets [- "dom">: Core.functionTypeDomain $ var "funType",- "cod">: Core.functionTypeCodomain $ var "funType"] $- Flows.bind (var "encode" @@ var "dom") $ lambda "hdom" $- Flows.bind (var "encode" @@ var "cod") $ lambda "hcod" $- Flows.pure $ inject H._Type H._Type_function $ record H._FunctionType [- H._FunctionType_domain>>: var "hdom",- H._FunctionType_codomain>>: var "hcod"],- _Type_forall>>: lambda "forallType" $ lets [- "v">: Core.forallTypeParameter $ var "forallType",- "body">: Core.forallTypeBody $ var "forallType"] $- var "encode" @@ var "body",- _Type_list>>: lambda "lt" $- Flows.bind (var "encode" @@ var "lt") $ lambda "hlt" $- Flows.pure $ inject H._Type H._Type_list $ var "hlt",- _Type_literal>>: lambda "lt" $- cases _LiteralType (var "lt")- (Just $ Flows.fail $ Strings.cat2 (string "unexpected literal type: ") (ref ShowCore.literalTypeDef @@ var "lt")) [- _LiteralType_boolean>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Bool",- _LiteralType_float>>: lambda "ft" $- cases _FloatType (var "ft") Nothing [- _FloatType_float32>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Float",- _FloatType_float64>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Double",- _FloatType_bigfloat>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Double"],- _LiteralType_integer>>: lambda "it" $- cases _IntegerType (var "it")- (Just $ Flows.fail $ Strings.cat2 (string "unexpected integer type: ") (ref ShowCore.integerTypeDef @@ var "it")) [- _IntegerType_bigint>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Integer",- _IntegerType_int8>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "I.Int8",- _IntegerType_int16>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "I.Int16",- _IntegerType_int32>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Int",- _IntegerType_int64>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "I.Int64"],- _LiteralType_string>>: constant $- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "String"],- _Type_map>>: lambda "mapType" $ lets [- "kt">: Core.mapTypeKeys $ var "mapType",- "vt">: Core.mapTypeValues $ var "mapType"] $- Flows.map- (ref HaskellUtils.toTypeApplicationDef)- (Flows.sequence $ list [- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "M.Map",- var "encode" @@ var "kt",- var "encode" @@ var "vt"]),- _Type_optional>>: lambda "ot" $- Flows.map- (ref HaskellUtils.toTypeApplicationDef)- (Flows.sequence $ list [- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "Maybe",- var "encode" @@ var "ot"]),- _Type_product>>: lambda "types" $- Flows.bind (Flows.mapList (var "encode") (var "types")) $ lambda "htypes" $- Flows.pure $ inject H._Type H._Type_tuple $ var "htypes",- _Type_record>>: lambda "rt" $ var "ref" @@ (Core.rowTypeTypeName $ var "rt"),- _Type_set>>: lambda "st" $- Flows.map- (ref HaskellUtils.toTypeApplicationDef)- (Flows.sequence $ list [- Flows.pure $ inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ string "S.Set",- var "encode" @@ var "st"]),- _Type_union>>: lambda "rt" $ lets [- "typeName">: Core.rowTypeTypeName $ var "rt"] $- var "ref" @@ var "typeName",- _Type_unit>>: constant $ Flows.pure $ var "unitTuple",- _Type_variable>>: lambda "v1" $ var "ref" @@ var "v1",- _Type_wrap>>: lambda "wrapped" $ lets [- "name">: Core.wrappedTypeTypeName $ var "wrapped"] $- var "ref" @@ var "name"]--encodeTypeWithClassAssertionsDef :: TBinding (HaskellNamespaces -> M.Map Name (S.Set TypeClass) -> Type -> Flow Graph H.Type)-encodeTypeWithClassAssertionsDef = haskellCoderDefinition "encodeTypeWithClassAssertions" $- lambda "namespaces" $ lambda "explicitClasses" $ lambda "typ" $ lets [- "classes">: Maps.union (var "explicitClasses") (ref getImplicitTypeClassesDef @@ var "typ"),- "implicitClasses">: ref getImplicitTypeClassesDef @@ var "typ",- "encodeAssertion">: lambda "pair" $ lets [- "name">: first $ var "pair",- "cls">: second $ var "pair",- "hname">: ref HaskellUtils.rawNameDef @@ cases _TypeClass (var "cls") Nothing [- _TypeClass_equality>>: constant $ string "Eq",- _TypeClass_ordering>>: constant $ string "Ord"],- "htype">: inject H._Type H._Type_variable $ ref HaskellUtils.rawNameDef @@ (Core.unName $ var "name")] $- inject H._Assertion H._Assertion_class $ record H._ClassAssertion [- H._ClassAssertion_name>>: var "hname",- H._ClassAssertion_types>>: list [var "htype"]],- "assertPairs">: Lists.concat $ Lists.map (var "toPairs") (Maps.toList $ var "classes"),- "toPairs">: lambda "mapEntry" $ lets [- "name">: first $ var "mapEntry",- "clsSet">: second $ var "mapEntry",- "toPair">: lambda "c" $- pair (var "name") (var "c")] $- Lists.map (var "toPair") (Sets.toList $ var "clsSet")] $- ref Monads.withTraceDef @@ (string "encode with assertions") @@- (bind "htyp" (ref adaptTypeToHaskellAndEncodeDef @@ var "namespaces" @@ var "typ") $- Logic.ifElse (Lists.null $ var "assertPairs")- (Flows.pure $ var "htyp") (lets [- "encoded">: Lists.map (var "encodeAssertion") (var "assertPairs"),- "hassert">: Logic.ifElse (Equality.gt (Lists.length $ var "encoded") (int32 1))- (Lists.head $ var "encoded")- (inject H._Assertion H._Assertion_tuple $ var "encoded")] $- Flows.pure $ inject H._Type H._Type_ctx $ record H._ContextType [- H._ContextType_ctx>>: var "hassert",- H._ContextType_type>>: var "htyp"]))--findOrdVariablesDef :: TBinding (Type -> S.Set Name)-findOrdVariablesDef = haskellCoderDefinition "findOrdVariables" $- lambda "typ" $ lets [- "fold">: lambda "names" $ lambda "typ'" $- cases _Type (var "typ'")- (Just $ var "names") [- _Type_map>>: lambda "mapType" $ lets [- "kt">: Core.mapTypeKeys $ var "mapType"] $- var "tryType" @@ var "names" @@ var "kt",- _Type_set>>: lambda "et" $- var "tryType" @@ var "names" @@ var "et"],- "isTypeVariable">: lambda "v" $ lets [- "nameStr">: Core.unName $ var "v",- "hasNoNamespace">: Optionals.isNothing $ ref Names.namespaceOfDef @@ var "v",- "startsWithT">: Equality.equal (Strings.charAt (int32 0) (var "nameStr")) (int32 116)] $ -- 't' character- Logic.and (var "hasNoNamespace") (var "startsWithT"),- "tryType">: lambda "names" $ lambda "t" $- cases _Type (ref Rewriting.deannotateTypeDef @@ var "t")- (Just $ var "names") [- _Type_variable>>: lambda "v" $- Logic.ifElse (var "isTypeVariable" @@ var "v")- (Sets.insert (var "v") (var "names"))- (var "names")]] $- ref Rewriting.foldOverTypeDef @@ Coders.traversalOrderPre @@ var "fold" @@ Sets.empty @@ var "typ"--getImplicitTypeClassesDef :: TBinding (Type -> M.Map Name (S.Set TypeClass))-getImplicitTypeClassesDef = haskellCoderDefinition "getImplicitTypeClasses" $- lambda "typ" $ lets [- "toPair">: lambda "name" $- pair (var "name") (Sets.fromList $ list [Graph.typeClassOrdering])] $- Maps.fromList $ Lists.map (var "toPair") (Sets.toList $ ref findOrdVariablesDef @@ var "typ")--moduleToHaskellModuleDef :: TBinding (Module -> Flow Graph H.Module)-moduleToHaskellModuleDef = haskellCoderDefinition "moduleToHaskellModule" $- lambda "mod" $- bind "namespaces" (ref HaskellUtils.namespacesForModuleDef @@ var "mod") $- ref AdaptModules.transformModuleDef @@ (ref HaskellLanguage.haskellLanguageDef) @@ (ref encodeTermDef @@ var "namespaces") @@ (ref constructModuleDef @@ var "namespaces") @@ var "mod"--moduleToHaskellDef :: TBinding (Module -> Flow Graph (M.Map String String))-moduleToHaskellDef = haskellCoderDefinition "moduleToHaskell" $ lambda "mod" $- bind "hsmod" (ref moduleToHaskellModuleDef @@ var "mod") $ lets [- "s">: ref Serialization.printExprDef @@ (ref Serialization.parenthesizeDef @@ (ref HaskellSerde.moduleToExprDef @@ var "hsmod")),- "filepath">: ref Names.namespaceToFilePathDef @@ Mantle.caseConventionPascal @@ (wrap _FileExtension $ string "hs") @@ (Module.moduleNamespace $ var "mod")] $- Flows.pure $ Maps.singleton (var "filepath") (var "s")--nameDeclsDef :: TBinding (Graph -> HaskellNamespaces -> Name -> Type -> [H.DeclarationWithComments])-nameDeclsDef = haskellCoderDefinition "nameDecls" $- lambda "g" $ lambda "namespaces" $ lambda "name" $ lambda "typ" $ lets [- "nm">: Core.unName $ var "name",- "toDecl">: lambda "n" $ lambda "pair" $ lets [- "k">: first $ var "pair",- "v">: second $ var "pair",- "decl">: inject H._Declaration H._Declaration_valueBinding $ inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [- H._SimpleValueBinding_pattern>>: ref HaskellUtils.applicationPatternDef @@ (ref HaskellUtils.simpleNameDef @@ var "k") @@ list [],- H._SimpleValueBinding_rhs>>: wrap H._RightHandSide $ inject H._Expression H._Expression_application $ record H._ApplicationExpression [- H._ApplicationExpression_function>>: inject H._Expression H._Expression_variable $ ref HaskellUtils.elementReferenceDef @@ var "namespaces" @@ var "n",- H._ApplicationExpression_argument>>: inject H._Expression H._Expression_literal $ inject H._Literal H._Literal_string $ var "v"],- H._SimpleValueBinding_localBindings>>: nothing]] $- record H._DeclarationWithComments [- H._DeclarationWithComments_body>>: var "decl",- H._DeclarationWithComments_comments>>: nothing],- "nameDecl">: pair (ref constantForTypeNameDef @@ var "name") (var "nm"),- "fieldDecls">: Lists.map (var "toConstant") (ref Lexical.fieldsOfDef @@ var "typ"),- "toConstant">: lambda "fieldType" $ lets [- "fname">: Core.fieldTypeName $ var "fieldType"] $- pair (ref constantForFieldNameDef @@ var "name" @@ var "fname") (Core.unName $ var "fname")] $- Logic.ifElse (ref useCoreImportDef)- (Lists.cons (var "toDecl" @@ Core.nameLift _Name @@ var "nameDecl") (Lists.map (var "toDecl" @@ Core.nameLift _Name) (var "fieldDecls")))- (list [])--toDataDeclarationDef :: TBinding (M.Map Type (Coder Graph Graph Term H.Expression) -> HaskellNamespaces -> (Binding, TypedTerm) -> Flow Graph H.DeclarationWithComments)-toDataDeclarationDef = haskellCoderDefinition "toDataDeclaration" $- lambdas ["coders", "namespaces", "pair"] $ lets [- "el">: first $ var "pair",- "tt">: second $ var "pair",- "term">: Core.typedTermTerm $ var "tt",- "typ">: Core.typedTermType $ var "tt",- "coder">: Optionals.fromJust $ Maps.lookup (var "typ") (var "coders"),- "hname">: ref HaskellUtils.simpleNameDef @@ (ref Names.localNameOfDef @@ (Core.bindingName $ var "el")),- "rewriteValueBinding">: lambda "vb" $- cases H._ValueBinding (var "vb") Nothing [- H._ValueBinding_simple>>: lambda "simple" $ lets [- "pattern'">: project H._SimpleValueBinding H._SimpleValueBinding_pattern @@ var "simple",- "rhs">: project H._SimpleValueBinding H._SimpleValueBinding_rhs @@ var "simple",- "bindings">: project H._SimpleValueBinding H._SimpleValueBinding_localBindings @@ var "simple"] $- cases H._Pattern (var "pattern'")- (Just $ var "vb") [- H._Pattern_application>>: lambda "appPat" $ lets [- "name'">: project H._ApplicationPattern H._ApplicationPattern_name @@ var "appPat",- "args">: project H._ApplicationPattern H._ApplicationPattern_args @@ var "appPat",- "rhsExpr">: unwrap H._RightHandSide @@ var "rhs"] $- cases H._Expression (var "rhsExpr")- (Just $ var "vb") [- H._Expression_lambda>>: lambda "lambda'" $ lets [- "vars">: project H._LambdaExpression H._LambdaExpression_bindings @@ var "lambda'",- "body">: project H._LambdaExpression H._LambdaExpression_inner @@ var "lambda'",- "newPattern">: ref HaskellUtils.applicationPatternDef @@ var "name'" @@ (Lists.concat2 (var "args") (var "vars")),- "newRhs">: wrap H._RightHandSide $ var "body"] $- var "rewriteValueBinding" @@ (inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [- H._SimpleValueBinding_pattern>>: var "newPattern",- H._SimpleValueBinding_rhs>>: var "newRhs",- H._SimpleValueBinding_localBindings>>: var "bindings"])]]],- "toDecl">: lambda "comments" $ lambda "hname'" $ lambda "term'" $ lambda "coder'" $ lambda "bindings" $- cases _Term (ref Rewriting.deannotateTermDef @@ var "term'")- (Just $- bind "hterm" (Compute.coderEncode (var "coder'") @@ (var "term'")) $ lets [- "vb">: ref HaskellUtils.simpleValueBindingDef @@ var "hname'" @@ var "hterm" @@ var "bindings"] $- bind "explicitClasses" (ref Annotations.getTypeClassesDef @@ (ref Rewriting.removeTypesFromTermDef @@ (Core.bindingTerm $ var "el"))) $- bind "htype" (ref encodeTypeWithClassAssertionsDef @@ var "namespaces" @@ var "explicitClasses" @@ var "typ") $ lets [- "decl">: inject H._Declaration H._Declaration_typedBinding $ record H._TypedBinding [- H._TypedBinding_typeSignature>>: record H._TypeSignature [- H._TypeSignature_name>>: var "hname'",- H._TypeSignature_type>>: var "htype"],- H._TypedBinding_valueBinding>>: var "rewriteValueBinding" @@ var "vb"]] $- Flows.pure $ record H._DeclarationWithComments [- H._DeclarationWithComments_body>>: var "decl",- H._DeclarationWithComments_comments>>: var "comments"]) [- _Term_let>>: lambda "letTerm" $ lets [- -- A "let" constant cannot be predicted in advance, so we construct a coder on the fly.- -- This makes program code with "let" terms more expensive to transform than simple data.- "lbindings">: Core.letBindings $ var "letTerm",- "env">: Core.letEnvironment $ var "letTerm",- "toBinding">: lambda "hname''" $ lambda "hterm'" $- inject H._LocalBinding H._LocalBinding_value $ ref HaskellUtils.simpleValueBindingDef @@ var "hname''" @@ var "hterm'" @@ nothing,- "ts">: Lists.map (lambda "binding" $ Core.typeSchemeType $ Optionals.fromJust $ Core.bindingType $ var "binding") (var "lbindings")] $- bind "coders'" (Flows.mapList (lambda "t" $ ref AdaptModules.constructCoderDef @@ (ref HaskellLanguage.haskellLanguageDef) @@ (ref encodeTermDef @@ var "namespaces") @@ var "t") (var "ts")) $ lets [- "hnames">: Lists.map (lambda "binding" $ ref HaskellUtils.simpleNameDef @@ (Core.unName $ Core.bindingName $ var "binding")) (var "lbindings"),- "terms">: Lists.map (unaryFunction $ Core.bindingTerm) (var "lbindings")] $- bind "hterms" (Flows.sequence $ Lists.zipWith (lambdas ["e", "t"] $ Compute.coderEncode (var "e") @@ var "t") (var "coders'") (var "terms")) $ lets [- "hbindings">: Lists.zipWith (var "toBinding") (var "hnames") (var "hterms")] $- var "toDecl" @@ var "comments" @@ var "hname'" @@ var "env" @@ var "coder'" @@ (just $ wrap H._LocalBindings $ var "hbindings")]] $- bind "comments" (ref Annotations.getTermDescriptionDef @@ var "term") $- var "toDecl" @@ var "comments" @@ var "hname" @@ var "term" @@ var "coder" @@ nothing--toTypeDeclarationsDef :: TBinding (HaskellNamespaces -> Binding -> Term -> Flow Graph [H.DeclarationWithComments])-toTypeDeclarationsDef = haskellCoderDefinition "toTypeDeclarations" $- lambda "namespaces" $ lambda "el" $ lambda "term" $ lets [- "elementName">: Core.bindingName $ var "el",- "lname">: ref Names.localNameOfDef @@ var "elementName",- "hname">: ref HaskellUtils.simpleNameDef @@ var "lname",- "declHead">: lambdas ["name", "vars'"] $ Logic.ifElse (Lists.null $ var "vars'")- (inject H._DeclarationHead H._DeclarationHead_simple $ var "name")- (lets [- "h">: Lists.head $ var "vars'",- "rest">: Lists.tail $ var "vars'",- "hvar">: wrap H._Variable $ ref HaskellUtils.simpleNameDef @@ (Core.unName $ var "h")] $- inject H._DeclarationHead H._DeclarationHead_application $ record H._ApplicationDeclarationHead [- H._ApplicationDeclarationHead_function>>: var "declHead" @@ var "name" @@ var "rest",- H._ApplicationDeclarationHead_operand>>: var "hvar"]),- "newtypeCons">: lambda "el'" $ lambda "typ'" $ lets [- "hname">: ref HaskellUtils.simpleNameDef @@ (ref HaskellUtils.newtypeAccessorNameDef @@ (Core.bindingName $ var "el'"))] $- bind "htype" (ref adaptTypeToHaskellAndEncodeDef @@ var "namespaces" @@ var "typ'") $ lets [- "hfield">: record H._FieldWithComments [- H._FieldWithComments_field>>: record H._Field [- H._Field_name>>: var "hname",- H._Field_type>>: var "htype"],- H._FieldWithComments_comments>>: nothing],- "constructorName">: ref HaskellUtils.simpleNameDef @@ (ref Names.localNameOfDef @@ (Core.bindingName $ var "el'"))] $- Flows.pure $ record H._ConstructorWithComments [- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [- H._RecordConstructor_name>>: var "constructorName",- H._RecordConstructor_fields>>: list [var "hfield"]],- H._ConstructorWithComments_comments>>: nothing],- "recordCons">: lambda "lname'" $ lambda "fields" $ lets [- "toField">: lambda "fieldType" $ lets [- "fname">: Core.fieldTypeName $ var "fieldType",- "ftype">: Core.fieldTypeType $ var "fieldType",- "hname'">: ref HaskellUtils.simpleNameDef @@ Strings.cat2- (ref Formatting.decapitalizeDef @@ var "lname'")- (ref Formatting.capitalizeDef @@ (Core.unName $ var "fname"))] $- bind "htype" (ref adaptTypeToHaskellAndEncodeDef @@ var "namespaces" @@ var "ftype") $- bind "comments" (ref Annotations.getTypeDescriptionDef @@ var "ftype") $- Flows.pure $ record H._FieldWithComments [- H._FieldWithComments_field>>: record H._Field [- H._Field_name>>: var "hname'",- H._Field_type>>: var "htype"],- H._FieldWithComments_comments>>: var "comments"]] $- bind "hFields" (Flows.mapList (var "toField") (var "fields")) $- Flows.pure $ record H._ConstructorWithComments [- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [- H._RecordConstructor_name>>: ref HaskellUtils.simpleNameDef @@ var "lname'",- H._RecordConstructor_fields>>: var "hFields"],- H._ConstructorWithComments_comments>>: nothing],- "unionCons">: lambda "g'" $ lambda "lname'" $ lambda "fieldType" $ lets [- "fname">: Core.fieldTypeName $ var "fieldType",- "ftype">: Core.fieldTypeType $ var "fieldType",- "deconflict">: lambda "name" $ lets [- "tname">: ref Names.unqualifyNameDef @@ record _QualifiedName [- _QualifiedName_namespace>>: just $ first $ Module.namespacesFocus $ var "namespaces",- _QualifiedName_local>>: var "name"]] $- Logic.ifElse (Optionals.isJust $ Maps.lookup (var "tname") (Graph.graphElements $ var "g'"))- (var "deconflict" @@ Strings.cat2 (var "name") (string "_"))- (var "name")] $- bind "comments" (ref Annotations.getTypeDescriptionDef @@ var "ftype") $ lets [- "nm">: var "deconflict" @@ Strings.cat2 (ref Formatting.capitalizeDef @@ var "lname'") (ref Formatting.capitalizeDef @@ (Core.unName $ var "fname"))] $- bind "typeList" (Logic.ifElse (Equality.equal (ref Rewriting.deannotateTypeDef @@ var "ftype") TTypes.unit)- (Flows.pure $ list []) $- Flows.bind (ref adaptTypeToHaskellAndEncodeDef @@ var "namespaces" @@ var "ftype") $ lambda "htype" $- Flows.pure $ list [var "htype"]) $- Flows.pure $ record H._ConstructorWithComments [- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_ordinary $ record H._OrdinaryConstructor [- H._OrdinaryConstructor_name>>: ref HaskellUtils.simpleNameDef @@ var "nm",- H._OrdinaryConstructor_fields>>: var "typeList"],- H._ConstructorWithComments_comments>>: var "comments"]] $- ref Monads.withTraceDef @@ (Strings.cat2 (string "type element ") (Core.unName $ var "elementName")) @@ (- bind "g" (ref Monads.getStateDef) $- bind "t" (ref DecodeCore.typeDef @@ var "term") $- bind "isSer" (ref Schemas.isSerializableDef @@ var "el") $ lets [- "deriv">: wrap H._Deriving $ Logic.ifElse (var "isSer")- (Lists.map (ref HaskellUtils.rawNameDef) (list [string "Eq", string "Ord", string "Read", string "Show"]))- (list []),- "unpackResult">: ref HaskellUtils.unpackForallTypeDef @@ var "g" @@ var "t",- "vars">: first $ var "unpackResult",- "t'">: second $ var "unpackResult",- "hd">: var "declHead" @@ var "hname" @@ (Lists.reverse $ var "vars")] $- bind "decl" (cases _Type (ref Rewriting.deannotateTypeDef @@ var "t'")- (Just $ bind "htype" (ref adaptTypeToHaskellAndEncodeDef @@ var "namespaces" @@ var "t") $- Flows.pure $ inject H._Declaration H._Declaration_type $ record H._TypeDeclaration [- H._TypeDeclaration_name>>: var "hd",- H._TypeDeclaration_type>>: var "htype"]) [- _Type_record>>: lambda "rt" $- bind "cons" (var "recordCons" @@ var "lname" @@ (Core.rowTypeFields $ var "rt")) $- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [- H._DataDeclaration_keyword>>: unitVariant H._DataOrNewtype H._DataOrNewtype_data,- H._DataDeclaration_context>>: list [],- H._DataDeclaration_head>>: var "hd",- H._DataDeclaration_constructors>>: list [var "cons"],- H._DataDeclaration_deriving>>: list [var "deriv"]],- _Type_union>>: lambda "rt" $- bind "cons" (Flows.mapList (var "unionCons" @@ var "g" @@ var "lname") (Core.rowTypeFields $ var "rt")) $- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [- H._DataDeclaration_keyword>>: unitVariant H._DataOrNewtype H._DataOrNewtype_data,- H._DataDeclaration_context>>: list [],- H._DataDeclaration_head>>: var "hd",- H._DataDeclaration_constructors>>: var "cons",- H._DataDeclaration_deriving>>: list [var "deriv"]],- _Type_wrap>>: lambda "wrapped" $ lets [- "tname">: Core.wrappedTypeTypeName $ var "wrapped",- "wt">: Core.wrappedTypeObject $ var "wrapped"] $- bind "cons" (var "newtypeCons" @@ var "el" @@ var "wt") $- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [- H._DataDeclaration_keyword>>: unitVariant H._DataOrNewtype H._DataOrNewtype_newtype,- H._DataDeclaration_context>>: list [],- H._DataDeclaration_head>>: var "hd",- H._DataDeclaration_constructors>>: list [var "cons"],- H._DataDeclaration_deriving>>: list [var "deriv"]]]) $- bind "comments" (ref Annotations.getTermDescriptionDef @@ var "term") $- bind "tdecls" (Logic.ifElse (ref includeTypeDefinitionsDef)- (Flows.bind (ref typeDeclDef @@ var "namespaces" @@ var "elementName" @@ var "t") $ lambda "decl'" $- Flows.pure $ list [var "decl'"])- (Flows.pure $ list [])) $ lets [- "mainDecl">: record H._DeclarationWithComments [- H._DeclarationWithComments_body>>: var "decl",- H._DeclarationWithComments_comments>>: var "comments"],- "nameDecls'">: ref nameDeclsDef @@ var "g" @@ var "namespaces" @@ var "elementName" @@ var "t"] $- Flows.pure $ Lists.concat $ list [list [var "mainDecl"], var "nameDecls'", var "tdecls"])--typeDeclDef :: TBinding (HaskellNamespaces -> Name -> Type -> Flow Graph H.DeclarationWithComments)-typeDeclDef = haskellCoderDefinition "typeDecl" $- lambda "namespaces" $ lambda "name" $ lambda "typ" $ lets [- "typeName">: lambda "ns" $ lambda "name'" $- ref Names.qnameDef @@ var "ns" @@ (var "typeNameLocal" @@ var "name'"),- "typeNameLocal">: lambda "name'" $- Strings.cat $ list [string "_", ref Names.localNameOfDef @@ var "name'", string "_type_"],- "rawTerm">: ref EncodeCore.typeDef @@ var "typ",- "rewrite">: lambda "recurse" $ lambda "term" $ lets [- "variantResult">: ref Decoding.variantDef @@ Core.nameLift _Type @@ var "term",- "forType">: lambda "field" $ lets [- "fname">: Core.fieldName $ var "field",- "fterm">: Core.fieldTerm $ var "field"] $- Logic.ifElse (Equality.equal (var "fname") $ Core.nameLift _Type_record)- nothing- (Logic.ifElse (Equality.equal (var "fname") $ Core.nameLift _Type_variable)- (Optionals.bind (ref Decoding.nameDef @@ var "fterm") (var "forVariableType"))- nothing),- "forVariableType">: lambda "name''" $ lets [- "qname">: ref Names.qualifyNameDef @@ var "name''",- "mns">: Module.qualifiedNameNamespace $ var "qname",- "local">: Module.qualifiedNameLocal $ var "qname"] $- Optionals.map (lambda "ns" $ Core.termVariable $ ref Names.qnameDef @@ var "ns" @@ (Strings.cat $ list [string "_", var "local", string "_type_"])) (var "mns")] $- Optionals.fromMaybe (var "recurse" @@ var "term") (Optionals.bind (var "variantResult") (var "forType")),- "finalTerm">: ref Rewriting.rewriteTermDef @@ var "rewrite" @@ var "rawTerm"] $- -- Note: consider constructing this coder just once, then reusing it- bind "coder" (ref AdaptModules.constructCoderDef @@ (ref HaskellLanguage.haskellLanguageDef) @@ (ref encodeTermDef @@ var "namespaces") @@ (Core.typeVariable $ Core.nameLift _Type)) $- bind "expr" (Compute.coderEncode (var "coder") @@ var "finalTerm") $ lets [- "rhs">: wrap H._RightHandSide $ var "expr",- "hname">: ref HaskellUtils.simpleNameDef @@ (var "typeNameLocal" @@ var "name"),- "pat">: ref HaskellUtils.applicationPatternDef @@ var "hname" @@ list [],- "decl">: inject H._Declaration H._Declaration_valueBinding $ inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [- H._SimpleValueBinding_pattern>>: var "pat",- H._SimpleValueBinding_rhs>>: var "rhs",- H._SimpleValueBinding_localBindings>>: nothing]] $- Flows.pure $ record H._DeclarationWithComments [- H._DeclarationWithComments_body>>: var "decl",- H._DeclarationWithComments_comments>>: nothing]++module Hydra.Sources.Haskell.Coder where++-- Standard imports for term-level sources outside of the kernel+import Hydra.Kernel+import Hydra.Sources.Libraries+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Additional imports+import qualified Hydra.Ext.Haskell.Ast as H+import qualified Hydra.Sources.Haskell.Language as HaskellLanguage+import qualified Hydra.Sources.Haskell.Ast as HaskellAst+import qualified Hydra.Sources.Haskell.Serde as HaskellSerde+import qualified Hydra.Sources.Haskell.Utils as HaskellUtils+++type HaskellNamespaces = Namespaces H.ModuleName++haskellCoderDefinition :: String -> TTerm a -> TBinding a+haskellCoderDefinition = definitionInModule module_++module_ :: Module+module_ = Module ns elements+ [HaskellSerde.ns, HaskellUtils.ns,+ AdaptModules.ns, Rewriting.ns, Serialization.ns]+ (HaskellAst.ns:KernelTypes.kernelTypesNamespaces) $+ Just "Functions for encoding Hydra modules as Haskell modules"+ where+ ns = Namespace "hydra.ext.haskell.coder"+ elements = [+ toBinding includeTypeDefinitions,+ toBinding useCoreImport,+ toBinding keyHaskellVar,+ toBinding adaptTypeToHaskellAndEncode,+ toBinding constantForFieldName,+ toBinding constantForTypeName,+ toBinding constructModule,+ toBinding encodeFunction,+ toBinding encodeLiteral,+ toBinding encodeTerm,+ toBinding encodeType,+ toBinding encodeTypeWithClassAssertions,+ toBinding findOrdVariables,+ toBinding getImplicitTypeClasses,+ toBinding moduleToHaskellModule,+ toBinding moduleToHaskell,+ toBinding nameDecls,+ toBinding toDataDeclaration,+-- toBinding toTypeDeclarations,+ toBinding toTypeDeclarationsFrom,+ toBinding typeDecl,+ toBinding typeSchemeConstraintsToClassMap]++-- TODO: make these settings configurable+includeTypeDefinitions :: TBinding Bool+includeTypeDefinitions = haskellCoderDefinition "includeTypeDefinitions" $+ doc "Whether to include type definitions in generated Haskell modules" $+ false+useCoreImport :: TBinding Bool+useCoreImport = haskellCoderDefinition "useCoreImport" $+ doc "Whether to use the Hydra core import in generated modules" $+ true++keyHaskellVar :: TBinding Name+keyHaskellVar = haskellCoderDefinition "keyHaskellVar" $+ doc "The key used to track Haskell variable depth in annotations" $+ wrap _Name $ string "haskellVar"++adaptTypeToHaskellAndEncode :: TBinding (HaskellNamespaces -> Type -> Flow Graph H.Type)+adaptTypeToHaskellAndEncode = haskellCoderDefinition "adaptTypeToHaskellAndEncode" $+ doc "Adapt a Hydra type to Haskell's type system and encode it" $+ "namespaces" ~>+ AdaptModules.adaptTypeToLanguageAndEncode @@ (HaskellLanguage.haskellLanguage) @@ (encodeType @@ var "namespaces")++constantForFieldName :: TBinding (Name -> Name -> String)+constantForFieldName = haskellCoderDefinition "constantForFieldName" $+ doc "Generate a constant name for a field (e.g., '_TypeName_fieldName')" $+ "tname" ~> "fname" ~>+ Strings.cat $ list [+ string "_",+ Names.localNameOf @@ var "tname",+ string "_",+ Core.unName $ var "fname"]++constantForTypeName :: TBinding (Name -> String)+constantForTypeName = haskellCoderDefinition "constantForTypeName" $+ doc "Generate a constant name for a type (e.g., '_TypeName')" $+ "tname" ~>+ Strings.cat2 (string "_") (Names.localNameOf @@ var "tname")++constructModule :: TBinding (HaskellNamespaces -> Module -> [Definition] -> Flow Graph H.Module)+constructModule = haskellCoderDefinition "constructModule" $+ doc "Construct a Haskell module from a Hydra module and its definitions" $+ "namespaces" ~> "mod" ~> "defs" ~> lets [+ "h">: "namespace" ~>+ unwrap _Namespace @@ var "namespace",+ "createDeclarations">: "g" ~> "def" ~>+ cases _Definition (var "def") Nothing [+ _Definition_type>>: "type" ~> lets [+ "name">: Module.typeDefinitionName $ var "type",+ "typ">: Module.typeDefinitionType $ var "type"] $+ toTypeDeclarationsFrom @@ var "namespaces" @@ var "name" @@ var "typ",+ _Definition_term>>: "term" ~>+ "d" <<~ toDataDeclaration @@ var "namespaces" @@ var "term" $+ Flows.pure $ list [var "d"]],+ "importName">: "name" ~>+ wrap H._ModuleName $ Strings.intercalate (string ".") (Lists.map (Formatting.capitalize) (Strings.splitOn (string ".") (var "name"))),+ "imports">: Lists.concat2 (var "domainImports") (var "standardImports"),+ "domainImports">: lets [+ "toImport">: "pair" ~> lets [+ "namespace">: Pairs.first $ var "pair",+ "alias">: Pairs.second $ var "pair",+ "name">: var "h" @@ var "namespace"] $+ record H._Import [+ H._Import_qualified>>: true,+ H._Import_module>>: var "importName" @@ var "name",+ H._Import_as>>: just $ var "alias",+ H._Import_spec>>: nothing]] $+ Lists.map (var "toImport") (Maps.toList $ Module.namespacesMapping $ var "namespaces"),+ "standardImports">: lets [+ "toImport">: "triple" ~> lets [+ "name">: Pairs.first $ Pairs.first $ var "triple",+ "malias">: Pairs.second $ Pairs.first $ var "triple",+ "hidden">: Pairs.second $ var "triple",+ "spec">: Logic.ifElse (Lists.null $ var "hidden")+ nothing+ (just $ inject H._SpecImport H._SpecImport_hiding $ Lists.map ("n" ~> record H._ImportExportSpec [+ H._ImportExportSpec_modifier>>: nothing,+ H._ImportExportSpec_name>>: HaskellUtils.simpleName @@ var "n",+ H._ImportExportSpec_subspec>>: nothing]) (var "hidden"))] $+ record H._Import [+ H._Import_qualified>>: Maybes.isJust $ var "malias",+ H._Import_module>>: wrap H._ModuleName $ var "name",+ H._Import_as>>: Maybes.map (unaryFunction $ wrap H._ModuleName) (var "malias"),+ H._Import_spec>>: var "spec"]] $+ Lists.map (var "toImport") $ Lists.concat2+ (list [+ pair (pair (string "Prelude") nothing) (list $ string <$> [+ "Enum", "Ordering", "decodeFloat", "encodeFloat", "fail", "map", "pure", "sum"]),+ pair (pair (string "Data.ByteString") (just $ string "B")) (list ([] :: [TTerm String])),+ pair (pair (string "Data.Int") (just $ string "I")) (list ([] :: [TTerm String])),+ pair (pair (string "Data.List") (just $ string "L")) (list ([] :: [TTerm String])),+ pair (pair (string "Data.Map") (just $ string "M")) (list ([] :: [TTerm String])),+ pair (pair (string "Data.Set") (just $ string "S")) (list ([] :: [TTerm String]))])+ -- Conditionally add Hydra.Lib.Literals import if binary literals are present+ (Logic.ifElse (Schemas.moduleContainsBinaryLiterals @@ var "mod")+ (list [pair (pair (string "Hydra.Lib.Literals") (just $ string "Literals")) (list ([] :: [TTerm String]))])+ (list ([] :: [TTerm ((String, Maybe String), [String])])))] $+ "g" <<~ Monads.getState $+ "declLists" <<~ Flows.mapList (var "createDeclarations" @@ var "g") (var "defs") $ lets [+ "decls">: Lists.concat $ var "declLists",+ "mc">: Module.moduleDescription $ var "mod"] $+ Flows.pure $ record H._Module [+ H._Module_head>>: just $ record H._ModuleHead [+ H._ModuleHead_comments>>: var "mc",+ H._ModuleHead_name>>: var "importName" @@ (var "h" @@ (Module.moduleNamespace $ var "mod")),+ H._ModuleHead_exports>>: list ([] :: [TTerm H.Export])],+ H._Module_imports>>: var "imports",+ H._Module_declarations>>: var "decls"]++encodeFunction :: TBinding (HaskellNamespaces -> Function -> Flow Graph H.Expression)+encodeFunction = haskellCoderDefinition "encodeFunction" $+ doc "Encode a Hydra function as a Haskell expression" $+ "namespaces" ~> "fun" ~>+ cases _Function (var "fun") Nothing [+ _Function_elimination>>: "e" ~>+ cases _Elimination (var "e") Nothing [+ _Elimination_wrap>>: "name" ~>+ Flows.pure $ inject H._Expression H._Expression_variable $ HaskellUtils.elementReference @@ var "namespaces" @@+ (Names.qname @@ (Maybes.fromJust $ Names.namespaceOf @@ var "name") @@ (HaskellUtils.newtypeAccessorName @@ var "name")),+ _Elimination_record>>: "proj" ~> lets [+ "dn">: Core.projectionTypeName $ var "proj",+ "fname">: Core.projectionField $ var "proj"] $+ Flows.pure $ inject H._Expression H._Expression_variable $ HaskellUtils.recordFieldReference @@ var "namespaces" @@ var "dn" @@ var "fname",+ _Elimination_union>>: "stmt" ~> lets [+ "dn">: Core.caseStatementTypeName $ var "stmt",+ "def">: Core.caseStatementDefault $ var "stmt",+ "fields">: Core.caseStatementCases $ var "stmt",+ "caseExpr">:+ "rt" <<~ Lexical.withSchemaContext @@ (Schemas.requireUnionType @@ var "dn") $ lets [+ "toFieldMapEntry">: "f" ~>+ pair (Core.fieldTypeName $ var "f") (var "f"),+ "fieldMap">: Maps.fromList $ Lists.map (var "toFieldMapEntry") (Core.rowTypeFields $ var "rt")] $+ "ecases" <<~ Flows.mapList (var "toAlt" @@ var "fieldMap") (var "fields") $+ "dcases" <<~ (Maybes.cases (var "def")+ (Flows.pure $ list ([] :: [TTerm H.CaseRhs])) $+ "d" ~>+ "cs" <<~ (Flows.map (unaryFunction $ wrap H._CaseRhs) $ encodeTerm @@ var "namespaces" @@ var "d") $ lets [+ "lhs">: inject H._Pattern H._Pattern_name $ HaskellUtils.rawName @@ (Constants.ignoredVariable),+ "alt">: record H._Alternative [+ H._Alternative_pattern>>: var "lhs",+ H._Alternative_rhs>>: var "cs",+ H._Alternative_binds>>: nothing]] $+ Flows.pure $ list [var "alt"]) $+ Flows.pure $ inject H._Expression H._Expression_case $ record H._CaseExpression [+ H._CaseExpression_case>>: HaskellUtils.hsvar @@ string "x",+ H._CaseExpression_alternatives>>: Lists.concat2 (var "ecases") (var "dcases")],+ "toAlt">: "fieldMap" ~> "field" ~> lets [+ "fn">: Core.fieldName $ var "field",+ "fun'">: Core.fieldTerm $ var "field"] $+ Annotations.withDepth @@ keyHaskellVar @@ (+ "depth" ~> lets [+ "v0">: Strings.cat2 (string "v") (Literals.showInt32 $ var "depth"),+ "raw">: MetaTerms.apply (var "fun'") (Core.termVariable $ Core.name $ var "v0"),+ "rhsTerm">: Rewriting.simplifyTerm @@ var "raw",+ "v1">: Logic.ifElse (Rewriting.isFreeVariableInTerm @@ (wrap _Name $ var "v0") @@ var "rhsTerm")+ (Constants.ignoredVariable)+ (var "v0")] $+ "g_ufr" <<~ Monads.getState $ lets [+ "hname">: HaskellUtils.unionFieldReference @@ var "g_ufr" @@ var "namespaces" @@ var "dn" @@ var "fn"] $+ "args" <<~ (Maybes.cases (Maps.lookup (var "fn") (var "fieldMap"))+ (Flows.fail $ Strings.cat $ list [string "field ", Literals.showString $ (Core.unName $ var "fn"),+ string " not found in ", Literals.showString $ (Core.unName $ var "dn")]) $+ "fieldType" ~> lets [+ "ft">: Core.fieldTypeType $ var "fieldType",+ "noArgs">: Flows.pure $ list ([] :: [TTerm H.Pattern]),+ "singleArg">: Flows.pure $ list [inject H._Pattern H._Pattern_name $ HaskellUtils.rawName @@ var "v1"]] $+ cases _Type (Rewriting.deannotateType @@ var "ft")+ (Just $ var "singleArg") [+ _Type_unit>>: constant $ var "noArgs"]) $ lets [+ "lhs">: HaskellUtils.applicationPattern @@ var "hname" @@ var "args"] $+ "rhs" <<~ (Flows.map (unaryFunction $ wrap H._CaseRhs) $ encodeTerm @@ var "namespaces" @@ var "rhsTerm") $+ Flows.pure $ record H._Alternative [+ H._Alternative_pattern>>: var "lhs",+ H._Alternative_rhs>>: var "rhs",+ H._Alternative_binds>>: nothing])] $+ Flows.map (HaskellUtils.hslambda @@ (HaskellUtils.rawName @@ string "x")) (var "caseExpr")],+ _Function_lambda>>: "lam" ~> lets [+ "v">: Core.lambdaParameter $ var "lam",+ "body">: Core.lambdaBody $ var "lam"] $+ Flows.bind (encodeTerm @@ var "namespaces" @@ var "body") $ "hbody" ~>+ Flows.pure $ HaskellUtils.hslambda @@ (HaskellUtils.elementReference @@ var "namespaces" @@ var "v") @@ var "hbody",+ _Function_primitive>>: "name" ~>+ Flows.pure $ inject H._Expression H._Expression_variable $ HaskellUtils.elementReference @@ var "namespaces" @@ var "name"]++encodeLiteral :: TBinding (Literal -> Flow Graph H.Expression)+encodeLiteral = haskellCoderDefinition "encodeLiteral" $+ doc "Encode a Hydra literal as a Haskell expression" $+ "l" ~>+ cases _Literal (var "l")+ (Just $ Flows.fail $ Strings.cat2 (string "literal value ") (ShowCore.literal @@ var "l")) [+ _Literal_binary>>: "bs" ~>+ -- Generate: Literals.stringToBinary "base64string"+ -- Binary data is stored as a ByteString; we encode to base64 for the source and decode at runtime+ -- Note: Literals.binaryToString is called at coder-execution time to convert ByteString to base64 String+ Flows.pure $ HaskellUtils.hsapp+ @@ (HaskellUtils.hsvar @@ string "Literals.stringToBinary")+ @@ (HaskellUtils.hslit @@ (inject H._Literal H._Literal_string+ $ Literals.binaryToString $ var "bs")),+ _Literal_boolean>>: "b" ~>+ Flows.pure $ HaskellUtils.hsvar @@ Logic.ifElse (var "b") (string "True") (string "False"),+ _Literal_float>>: "fv" ~>+ cases _FloatValue (var "fv") Nothing [+ _FloatValue_float32>>: "f" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_float $ var "f"),+ _FloatValue_float64>>: "f" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_double $ var "f"),+ _FloatValue_bigfloat>>: "f" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_double $ Literals.bigfloatToFloat64 $ var "f")],+ _Literal_integer>>: "iv" ~>+ cases _IntegerValue (var "iv") Nothing [+ _IntegerValue_bigint>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ var "i"),+ _IntegerValue_int8>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.int8ToBigint $ var "i"),+ _IntegerValue_int16>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.int16ToBigint $ var "i"),+ _IntegerValue_int32>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_int $ var "i"),+ _IntegerValue_int64>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.int64ToBigint $ var "i"),+ _IntegerValue_uint8>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.uint8ToBigint $ var "i"),+ _IntegerValue_uint16>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.uint16ToBigint $ var "i"),+ _IntegerValue_uint32>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.uint32ToBigint $ var "i"),+ _IntegerValue_uint64>>: "i" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_integer $ Literals.uint64ToBigint $ var "i")],+ _Literal_string>>: "s" ~>+ Flows.pure $ HaskellUtils.hslit @@ (inject H._Literal H._Literal_string $ var "s")]++encodeTerm :: TBinding (HaskellNamespaces -> Term -> Flow Graph H.Expression)+encodeTerm = haskellCoderDefinition "encodeTerm" $+ doc "Encode a Hydra term as a Haskell expression" $+ "namespaces" ~> "term" ~> lets [+ "encode">: encodeTerm @@ var "namespaces"] $+ "nonemptyMap" <~ ("m" ~> lets [+ "lhs">: HaskellUtils.hsvar @@ string "M.fromList",+ "encodePair">: "pair" ~> lets [+ "k">: Pairs.first $ var "pair",+ "v">: Pairs.second $ var "pair",+ "hk">: var "encode" @@ var "k",+ "hv">: var "encode" @@ var "v"] $+ Flows.map+ (unaryFunction $ inject H._Expression H._Expression_tuple)+ (Flows.sequence $ list [var "hk", var "hv"])] $+ "rhs" <<~ Flows.map+ (unaryFunction $ inject H._Expression H._Expression_list)+ (Flows.mapList (var "encodePair") $ Maps.toList (var "m")) $+ Flows.pure $ HaskellUtils.hsapp @@ var "lhs" @@ var "rhs") $+ "nonemptySet" <~ ("s" ~> lets [+ "lhs">: HaskellUtils.hsvar @@ string "S.fromList" ] $+ "rhs" <<~ encodeTerm @@ var "namespaces" @@ (inject _Term _Term_list $ Sets.toList $ var "s") $+ Flows.pure $ HaskellUtils.hsapp @@ var "lhs" @@ var "rhs") $+ cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just $ Flows.fail $ Strings.cat2 (string "unexpected term: ") (ShowCore.term @@ var "term")) [+ _Term_application>>: "app" ~> lets [+ "fun">: Core.applicationFunction $ var "app",+ "arg">: Core.applicationArgument $ var "app"] $+ Flows.bind (var "encode" @@ var "fun") $ "hfun" ~>+ Flows.bind (var "encode" @@ var "arg") $ "harg" ~>+ Flows.pure $ HaskellUtils.hsapp @@ var "hfun" @@ var "harg",+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~>+ Flows.bind (var "encode" @@ var "l") $ "hl" ~>+ Flows.pure $ HaskellUtils.hsapp @@ (HaskellUtils.hsvar @@ string "Left") @@ var "hl")+ ("r" ~>+ Flows.bind (var "encode" @@ var "r") $ "hr" ~>+ Flows.pure $ HaskellUtils.hsapp @@ (HaskellUtils.hsvar @@ string "Right") @@ var "hr")+ (var "e"),+ _Term_function>>: "f" ~>+ encodeFunction @@ var "namespaces" @@ var "f",+ _Term_let>>: "letTerm" ~> lets [+ "bindings">: Core.letBindings $ var "letTerm",+ "env">: Core.letBody $ var "letTerm",+ "encodeBinding">: "binding" ~> lets [+ "name">: Core.bindingName $ var "binding",+ "term'">: Core.bindingTerm $ var "binding",+ "hname">: HaskellUtils.simpleName @@ (Core.unName $ var "name")] $+ "hexpr" <<~ var "encode" @@ var "term'" $+ Flows.pure $ inject H._LocalBinding H._LocalBinding_value $ HaskellUtils.simpleValueBinding @@ var "hname" @@ var "hexpr" @@ nothing] $+ "hbindings" <<~ Flows.mapList (var "encodeBinding") (var "bindings") $+ "hinner" <<~ var "encode" @@ var "env" $+ Flows.pure $ inject H._Expression H._Expression_let $ record H._LetExpression [+ H._LetExpression_bindings>>: var "hbindings",+ H._LetExpression_inner>>: var "hinner"],+ _Term_list>>: "els" ~>+ Flows.bind (Flows.mapList (var "encode") (var "els")) $ "helems" ~>+ Flows.pure $ inject H._Expression H._Expression_list $ var "helems",+ _Term_literal>>: "v" ~>+ encodeLiteral @@ var "v",+ _Term_map>>: "m" ~> Logic.ifElse (Maps.null $ var "m")+ (produce $ HaskellUtils.hsvar @@ string "M.empty")+ (var "nonemptyMap" @@ var "m"),+ _Term_maybe>>: "m" ~>+ Maybes.cases (var "m")+ (Flows.pure $ HaskellUtils.hsvar @@ string "Nothing") $+ "t" ~>+ Flows.bind (var "encode" @@ var "t") $ "ht" ~>+ Flows.pure $ HaskellUtils.hsapp @@ (HaskellUtils.hsvar @@ string "Just") @@ var "ht",+ _Term_pair>>: "p" ~>+ "f" <<~ var "encode" @@ Pairs.first (var "p") $+ "s" <<~ var "encode" @@ Pairs.second (var "p") $+ Flows.pure $ inject H._Expression H._Expression_tuple $ list [var "f", var "s"],+ _Term_record>>: "record" ~> lets [+ "sname">: Core.recordTypeName $ var "record",+ "fields">: Core.recordFields $ var "record",+ "toFieldUpdate">: "field" ~> lets [+ "fn">: Core.fieldName $ var "field",+ "ft">: Core.fieldTerm $ var "field",+ "fieldRef">: HaskellUtils.recordFieldReference @@ var "namespaces" @@ var "sname" @@ var "fn"] $+ "hft" <<~ var "encode" @@ var "ft" $+ Flows.pure $ record H._FieldUpdate [+ H._FieldUpdate_name>>: var "fieldRef",+ H._FieldUpdate_value>>: var "hft"],+ "typeName">: HaskellUtils.elementReference @@ var "namespaces" @@ var "sname"] $+ "updates" <<~ Flows.mapList (var "toFieldUpdate") (var "fields") $+ Flows.pure $ inject H._Expression H._Expression_constructRecord $ record H._ConstructRecordExpression [+ H._ConstructRecordExpression_name>>: var "typeName",+ H._ConstructRecordExpression_fields>>: var "updates"],+ _Term_set>>: "s" ~> Logic.ifElse (Sets.null $ var "s")+ (produce $ HaskellUtils.hsvar @@ string "S.empty")+ (var "nonemptySet" @@ var "s"),+ _Term_typeLambda>>: "abs" ~> lets [+ "term1">: Core.typeLambdaBody $ var "abs"] $+ var "encode" @@ var "term1",+ _Term_typeApplication>>: "typed" ~> lets [+ "term1">: Core.typeApplicationTermBody $ var "typed"] $+ var "encode" @@ var "term1",+ _Term_union>>: "injection" ~> lets [+ "sname">: Core.injectionTypeName $ var "injection",+ "field">: Core.injectionField $ var "injection",+ "fn">: Core.fieldName $ var "field",+ "ft">: Core.fieldTerm $ var "field"] $+ "g_ufr2" <<~ Monads.getState $ lets [+ "lhs">: inject H._Expression H._Expression_variable $ HaskellUtils.unionFieldReference @@ var "g_ufr2" @@ var "namespaces" @@ var "sname" @@ var "fn",+ "dflt">: Flows.map (HaskellUtils.hsapp @@ var "lhs") (var "encode" @@ var "ft")] $+ "ftyp" <<~ Schemas.requireUnionField_ @@ var "sname" @@ var "fn" $+ cases _Type (Rewriting.deannotateType @@ var "ftyp")+ (Just $ var "dflt") [+ _Type_unit>>: constant $ Flows.pure $ var "lhs"],+ _Term_unit>>: constant $ Flows.pure $ inject H._Expression H._Expression_tuple $ list ([] :: [TTerm H.Expression]),+ _Term_variable>>: "name" ~>+ Flows.pure $ inject H._Expression H._Expression_variable $ HaskellUtils.elementReference @@ var "namespaces" @@ var "name",+ _Term_wrap>>: "wrapped" ~> lets [+ "tname">: Core.wrappedTermTypeName $ var "wrapped",+ "term'">: Core.wrappedTermBody $ var "wrapped",+ "lhs">: inject H._Expression H._Expression_variable $ HaskellUtils.elementReference @@ var "namespaces" @@ var "tname"] $+ "rhs" <<~ var "encode" @@ var "term'" $+ Flows.pure $ HaskellUtils.hsapp @@ var "lhs" @@ var "rhs"]++encodeType :: TBinding (HaskellNamespaces -> Type -> Flow Graph H.Type)+encodeType = haskellCoderDefinition "encodeType" $+ doc "Encode a Hydra type as a Haskell type" $+ "namespaces" ~>+ "typ" ~> lets [+ "encode">: encodeType @@ var "namespaces",+ "ref">: "name" ~>+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.elementReference @@ var "namespaces" @@ var "name",+ "unitTuple">: inject H._Type H._Type_tuple $ list ([] :: [TTerm H.Type])] $+ trace (string "encode type") $+ cases _Type (Rewriting.deannotateType @@ var "typ")+ (Just $ Flows.fail $ Strings.cat2 (string "unexpected type: ") (ShowCore.type_ @@ var "typ")) [+ _Type_application>>: "app" ~> lets [+ "lhs">: Core.applicationTypeFunction $ var "app",+ "rhs">: Core.applicationTypeArgument $ var "app"] $+ Flows.bind (var "encode" @@ var "lhs") $ "hlhs" ~>+ Flows.bind (var "encode" @@ var "rhs") $ "hrhs" ~>+ Flows.pure $ HaskellUtils.toTypeApplication @@ list [var "hlhs", var "hrhs"],+ _Type_either>>: "eitherType" ~> lets [+ "left">: Core.eitherTypeLeft $ var "eitherType",+ "right">: Core.eitherTypeRight $ var "eitherType"] $+ Flows.map+ (HaskellUtils.toTypeApplication)+ (Flows.sequence $ list [+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Either",+ var "encode" @@ var "left",+ var "encode" @@ var "right"]),+ _Type_function>>: "funType" ~> lets [+ "dom">: Core.functionTypeDomain $ var "funType",+ "cod">: Core.functionTypeCodomain $ var "funType"] $+ Flows.bind (var "encode" @@ var "dom") $ "hdom" ~>+ Flows.bind (var "encode" @@ var "cod") $ "hcod" ~>+ Flows.pure $ inject H._Type H._Type_function $ record H._FunctionType [+ H._FunctionType_domain>>: var "hdom",+ H._FunctionType_codomain>>: var "hcod"],+ _Type_forall>>: "forallType" ~> lets [+ "v">: Core.forallTypeParameter $ var "forallType",+ "body">: Core.forallTypeBody $ var "forallType"] $+ var "encode" @@ var "body",+ _Type_list>>: "lt" ~>+ Flows.bind (var "encode" @@ var "lt") $ "hlt" ~>+ Flows.pure $ inject H._Type H._Type_list $ var "hlt",+ _Type_literal>>: "lt" ~>+ cases _LiteralType (var "lt")+ (Just $ Flows.fail $ Strings.cat2 (string "unexpected literal type: ") (ShowCore.literalType @@ var "lt")) [+ _LiteralType_binary>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "B.ByteString",+ _LiteralType_boolean>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Bool",+ _LiteralType_float>>: "ft" ~>+ cases _FloatType (var "ft") Nothing [+ _FloatType_float32>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Float",+ _FloatType_float64>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Double",+ _FloatType_bigfloat>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Double"],+ _LiteralType_integer>>: "it" ~>+ cases _IntegerType (var "it")+ (Just $ Flows.fail $ Strings.cat2 (string "unexpected integer type: ") (ShowCore.integerType @@ var "it")) [+ _IntegerType_bigint>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Integer",+ _IntegerType_int8>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "I.Int8",+ _IntegerType_int16>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "I.Int16",+ _IntegerType_int32>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Int",+ _IntegerType_int64>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "I.Int64"],+ _LiteralType_string>>: constant $+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "String"],+ _Type_map>>: "mapType" ~> lets [+ "kt">: Core.mapTypeKeys $ var "mapType",+ "vt">: Core.mapTypeValues $ var "mapType"] $+ Flows.map+ (HaskellUtils.toTypeApplication)+ (Flows.sequence $ list [+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "M.Map",+ var "encode" @@ var "kt",+ var "encode" @@ var "vt"]),+ _Type_maybe>>: "ot" ~>+ Flows.map+ (HaskellUtils.toTypeApplication)+ (Flows.sequence $ list [+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "Maybe",+ var "encode" @@ var "ot"]),+ _Type_pair>>: "pt" ~>+ "f" <<~ var "encode" @@ (Core.pairTypeFirst $ var "pt") $+ "s" <<~ var "encode" @@ (Core.pairTypeSecond $ var "pt") $+ Flows.pure $ inject H._Type H._Type_tuple $ list [var "f", var "s"],+ _Type_record>>: "rt" ~> var "ref" @@ (Core.rowTypeTypeName $ var "rt"),+ _Type_set>>: "st" ~>+ Flows.map+ (HaskellUtils.toTypeApplication)+ (Flows.sequence $ list [+ Flows.pure $ inject H._Type H._Type_variable $ HaskellUtils.rawName @@ string "S.Set",+ var "encode" @@ var "st"]),+ _Type_union>>: "rt" ~> lets [+ "typeName">: Core.rowTypeTypeName $ var "rt"] $+ var "ref" @@ var "typeName",+ _Type_unit>>: constant $ Flows.pure $ var "unitTuple",+ _Type_variable>>: "v1" ~> var "ref" @@ var "v1",+ _Type_wrap>>: "wrapped" ~> lets [+ "name">: Core.wrappedTypeTypeName $ var "wrapped"] $+ var "ref" @@ var "name"]++encodeTypeWithClassAssertions :: TBinding (HaskellNamespaces -> M.Map Name (S.Set TypeClass) -> Type -> Flow Graph H.Type)+encodeTypeWithClassAssertions = haskellCoderDefinition "encodeTypeWithClassAssertions" $+ doc "Encode a Hydra type as a Haskell type with typeclass assertions" $+ "namespaces" ~> "explicitClasses" ~> "typ" ~> lets [+ "classes">: Maps.union (var "explicitClasses") (getImplicitTypeClasses @@ var "typ"),+ "implicitClasses">: getImplicitTypeClasses @@ var "typ",+ "encodeAssertion">: "pair" ~> lets [+ "name">: Pairs.first $ var "pair",+ "cls">: Pairs.second $ var "pair",+ "hname">: HaskellUtils.rawName @@ cases _TypeClass (var "cls") Nothing [+ _TypeClass_equality>>: constant $ string "Eq",+ _TypeClass_ordering>>: constant $ string "Ord"],+ "htype">: inject H._Type H._Type_variable $ HaskellUtils.rawName @@ (Core.unName $ var "name")] $+ inject H._Assertion H._Assertion_class $ record H._ClassAssertion [+ H._ClassAssertion_name>>: var "hname",+ H._ClassAssertion_types>>: list [var "htype"]],+ "assertPairs">: Lists.concat $ Lists.map (var "toPairs") (Maps.toList $ var "classes"),+ "toPairs">: "mapEntry" ~> lets [+ "name">: Pairs.first $ var "mapEntry",+ "clsSet">: Pairs.second $ var "mapEntry",+ "toPair">: "c" ~>+ pair (var "name") (var "c")] $+ Lists.map (var "toPair") (Sets.toList $ var "clsSet")] $+ Monads.withTrace @@ (string "encode with assertions") @@+ ("htyp" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "typ" $+ Logic.ifElse (Lists.null $ var "assertPairs")+ (Flows.pure $ var "htyp") (lets [+ "encoded">: Lists.map (var "encodeAssertion") (var "assertPairs"),+ "hassert">: Logic.ifElse (Equality.equal (Lists.length $ var "encoded") (int32 1))+ (Lists.head $ var "encoded")+ (inject H._Assertion H._Assertion_tuple $ var "encoded")] $+ Flows.pure $ inject H._Type H._Type_ctx $ record H._ContextType [+ H._ContextType_ctx>>: var "hassert",+ H._ContextType_type>>: var "htyp"]))++findOrdVariables :: TBinding (Type -> S.Set Name)+findOrdVariables = haskellCoderDefinition "findOrdVariables" $+ doc "Find type variables that require an Ord constraint (used in maps or sets)" $+ "typ" ~> lets [+ "fold">: "names" ~> "typ'" ~>+ cases _Type (var "typ'")+ (Just $ var "names") [+ _Type_map>>: "mapType" ~> lets [+ "kt">: Core.mapTypeKeys $ var "mapType"] $+ var "tryType" @@ var "names" @@ var "kt",+ _Type_set>>: "et" ~>+ var "tryType" @@ var "names" @@ var "et"],+ "isTypeVariable">: "v" ~> lets [+ "nameStr">: Core.unName $ var "v",+ "hasNoNamespace">: Maybes.isNothing $ Names.namespaceOf @@ var "v",+ "startsWithT">: Equality.equal (Strings.charAt (int32 0) (var "nameStr")) (int32 116)] $ -- 't' character+ Logic.and (var "hasNoNamespace") (var "startsWithT"),+ "tryType">: "names" ~> "t" ~>+ cases _Type (Rewriting.deannotateType @@ var "t")+ (Just $ var "names") [+ _Type_variable>>: "v" ~>+ Logic.ifElse (var "isTypeVariable" @@ var "v")+ (Sets.insert (var "v") (var "names"))+ (var "names")]] $+ Rewriting.foldOverType @@ Coders.traversalOrderPre @@ var "fold" @@ Sets.empty @@ var "typ"++getImplicitTypeClasses :: TBinding (Type -> M.Map Name (S.Set TypeClass))+getImplicitTypeClasses = haskellCoderDefinition "getImplicitTypeClasses" $+ doc "Get implicit typeclass constraints for type variables that need Ord" $+ "typ" ~> lets [+ "toPair">: "name" ~>+ pair (var "name") (Sets.fromList $ list [Graph.typeClassOrdering])] $+ Maps.fromList $ Lists.map (var "toPair") (Sets.toList $ findOrdVariables @@ var "typ")++moduleToHaskellModule :: TBinding (Module -> [Definition] -> Flow Graph H.Module)+moduleToHaskellModule = haskellCoderDefinition "moduleToHaskellModule" $+ doc "Convert a Hydra module and definitions to a Haskell module AST" $+ "mod" ~> "defs" ~>+ "namespaces" <<~ HaskellUtils.namespacesForModule @@ var "mod" $+ constructModule @@ var "namespaces" @@ var "mod" @@ var "defs"++moduleToHaskell :: TBinding (Module -> [Definition] -> Flow Graph (M.Map String String))+moduleToHaskell = haskellCoderDefinition "moduleToHaskell" $+ doc "Convert a Hydra module to Haskell source code as a filepath-to-content map" $+ "mod" ~> "defs" ~>+ "hsmod" <<~ moduleToHaskellModule @@ var "mod" @@ var "defs" $ lets [+ "s">: Serialization.printExpr @@ (Serialization.parenthesize @@ (HaskellSerde.moduleToExpr @@ var "hsmod")),+ "filepath">: Names.namespaceToFilePath @@ Util.caseConventionPascal @@ (wrap _FileExtension $ string "hs") @@ (Module.moduleNamespace $ var "mod")] $+ Flows.pure $ Maps.singleton (var "filepath") (var "s")++nameDecls :: TBinding (Graph -> HaskellNamespaces -> Name -> Type -> [H.DeclarationWithComments])+nameDecls = haskellCoderDefinition "nameDecls" $+ doc "Generate Haskell declarations for type and field name constants" $+ "g" ~> "namespaces" ~> "name" ~> "typ" ~> lets [+ "nm">: Core.unName $ var "name",+ "toDecl">: "n" ~> "pair" ~> lets [+ "k">: Pairs.first $ var "pair",+ "v">: Pairs.second $ var "pair",+ "decl">: inject H._Declaration H._Declaration_valueBinding $ inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [+ H._SimpleValueBinding_pattern>>: HaskellUtils.applicationPattern @@ (HaskellUtils.simpleName @@ var "k") @@ list ([] :: [TTerm H.Pattern]),+ H._SimpleValueBinding_rhs>>: wrap H._RightHandSide $ inject H._Expression H._Expression_application $ record H._ApplicationExpression [+ H._ApplicationExpression_function>>: inject H._Expression H._Expression_variable $ HaskellUtils.elementReference @@ var "namespaces" @@ var "n",+ H._ApplicationExpression_argument>>: inject H._Expression H._Expression_literal $ inject H._Literal H._Literal_string $ var "v"],+ H._SimpleValueBinding_localBindings>>: nothing]] $+ record H._DeclarationWithComments [+ H._DeclarationWithComments_body>>: var "decl",+ H._DeclarationWithComments_comments>>: nothing],+ "nameDecl">: pair (constantForTypeName @@ var "name") (var "nm"),+ "fieldDecls">: Lists.map (var "toConstant") (Lexical.fieldsOf @@ var "typ"),+ "toConstant">: "fieldType" ~> lets [+ "fname">: Core.fieldTypeName $ var "fieldType"] $+ pair (constantForFieldName @@ var "name" @@ var "fname") (Core.unName $ var "fname")] $+ Logic.ifElse (useCoreImport)+ (Lists.cons (var "toDecl" @@ Core.nameLift _Name @@ var "nameDecl") (Lists.map (var "toDecl" @@ Core.nameLift _Name) (var "fieldDecls")))+ (list ([] :: [TTerm H.DeclarationWithComments]))++toDataDeclaration :: TBinding (HaskellNamespaces -> TermDefinition -> Flow Graph H.DeclarationWithComments)+toDataDeclaration = haskellCoderDefinition "toDataDeclaration" $+ doc "Convert a Hydra term definition to a Haskell declaration with comments" $+ "namespaces" ~> "def" ~> lets [+ "name">: Module.termDefinitionName $ var "def",+ "term">: Module.termDefinitionTerm $ var "def",+ "typ">: Module.termDefinitionType $ var "def",+ "hname">: HaskellUtils.simpleName @@ (Names.localNameOf @@ var "name"),+ "rewriteValueBinding">: "vb" ~>+ cases H._ValueBinding (var "vb") Nothing [+ H._ValueBinding_simple>>: "simple" ~> lets [+ "pattern'">: project H._SimpleValueBinding H._SimpleValueBinding_pattern @@ var "simple",+ "rhs">: project H._SimpleValueBinding H._SimpleValueBinding_rhs @@ var "simple",+ "bindings">: project H._SimpleValueBinding H._SimpleValueBinding_localBindings @@ var "simple"] $+ cases H._Pattern (var "pattern'")+ (Just $ var "vb") [+ H._Pattern_application>>: "appPat" ~> lets [+ "name'">: project H._ApplicationPattern H._ApplicationPattern_name @@ var "appPat",+ "args">: project H._ApplicationPattern H._ApplicationPattern_args @@ var "appPat",+ "rhsExpr">: unwrap H._RightHandSide @@ var "rhs"] $+ cases H._Expression (var "rhsExpr")+ (Just $ var "vb") [+ H._Expression_lambda>>: "lambda'" ~> lets [+ "vars">: project H._LambdaExpression H._LambdaExpression_bindings @@ var "lambda'",+ "body">: project H._LambdaExpression H._LambdaExpression_inner @@ var "lambda'",+ "newPattern">: HaskellUtils.applicationPattern @@ var "name'" @@ (Lists.concat2 (var "args") (var "vars")),+ "newRhs">: wrap H._RightHandSide $ var "body"] $+ var "rewriteValueBinding" @@ (inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [+ H._SimpleValueBinding_pattern>>: var "newPattern",+ H._SimpleValueBinding_rhs>>: var "newRhs",+ H._SimpleValueBinding_localBindings>>: var "bindings"])]]],+ "toDecl">: "comments" ~> "hname'" ~> "term'" ~> "bindings" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "term'")+ (Just $+ "hterm" <<~ encodeTerm @@ var "namespaces" @@ var "term'" $ lets [+ "vb">: HaskellUtils.simpleValueBinding @@ var "hname'" @@ var "hterm" @@ var "bindings",+ -- Extract constraints from the TypeScheme and convert to class assertions+ "schemeConstraints">: Core.typeSchemeConstraints (var "typ"),+ "schemeClasses">: typeSchemeConstraintsToClassMap @@ var "schemeConstraints"] $+ "explicitClasses" <<~ Annotations.getTypeClasses @@ (Rewriting.removeTypesFromTerm @@ var "term") $+ -- Combine constraints from TypeScheme with any explicit annotations+ "combinedClasses" <~ Maps.union (var "schemeClasses") (var "explicitClasses") $+ "htype" <<~ encodeTypeWithClassAssertions @@ var "namespaces" @@ var "combinedClasses" @@ (Core.typeSchemeType $ var "typ") $ lets [+ "decl">: inject H._Declaration H._Declaration_typedBinding $ record H._TypedBinding [+ H._TypedBinding_typeSignature>>: record H._TypeSignature [+ H._TypeSignature_name>>: var "hname'",+ H._TypeSignature_type>>: var "htype"],+ H._TypedBinding_valueBinding>>: var "rewriteValueBinding" @@ var "vb"]] $+ Flows.pure $ record H._DeclarationWithComments [+ H._DeclarationWithComments_body>>: var "decl",+ H._DeclarationWithComments_comments>>: var "comments"]) [+ _Term_let>>: "letTerm" ~> lets [+ -- For let terms, encode each binding's term directly+ "lbindings">: Core.letBindings $ var "letTerm",+ "env">: Core.letBody $ var "letTerm",+ "toBinding">: "hname''" ~> "hterm'" ~>+ inject H._LocalBinding H._LocalBinding_value $ HaskellUtils.simpleValueBinding @@ var "hname''" @@ var "hterm'" @@ nothing,+ "hnames">: Lists.map ("binding" ~> HaskellUtils.simpleName @@ (Core.unName $ Core.bindingName $ var "binding")) (var "lbindings"),+ "terms">: Lists.map (unaryFunction $ Core.bindingTerm) (var "lbindings")] $+ "hterms" <<~ Flows.mapList (encodeTerm @@ var "namespaces") (var "terms") $ lets [+ "hbindings">: Lists.zipWith (var "toBinding") (var "hnames") (var "hterms"),+ -- Merge new bindings with any previously accumulated bindings from outer lets+ "prevBindings">: Maybes.maybe (list ([] :: [TTerm H.LocalBinding])) ("lb" ~> unwrap H._LocalBindings @@ var "lb") (var "bindings"),+ "allBindings">: Lists.concat2 (var "prevBindings") (var "hbindings")] $+ var "toDecl" @@ var "comments" @@ var "hname'" @@ var "env" @@ (just $ wrap H._LocalBindings $ var "allBindings")]] $+ "comments" <<~ Annotations.getTermDescription @@ var "term" $+ var "toDecl" @@ var "comments" @@ var "hname" @@ var "term" @@ nothing++--toTypeDeclarations :: TBinding (HaskellNamespaces -> Binding -> Term -> Flow Graph [H.DeclarationWithComments])+--toTypeDeclarations = haskellCoderDefinition "toTypeDeclarations" $+-- "namespaces" ~> "el" ~> "term" ~> lets [+-- "elementName">: Core.bindingName $ var "el",+-- "lname">: Names.localNameOf @@ var "elementName",+-- "hname">: HaskellUtils.simpleName @@ var "lname",+-- "declHead">: "name" ~> "vars'" ~> Logic.ifElse (Lists.null $ var "vars'")+-- (inject H._DeclarationHead H._DeclarationHead_simple $ var "name")+-- (lets [+-- "h">: Lists.head $ var "vars'",+-- "rest">: Lists.tail $ var "vars'",+-- "hvar">: wrap H._Variable $ HaskellUtils.simpleName @@ (Core.unName $ var "h")] $+-- inject H._DeclarationHead H._DeclarationHead_application $ record H._ApplicationDeclarationHead [+-- H._ApplicationDeclarationHead_function>>: var "declHead" @@ var "name" @@ var "rest",+-- H._ApplicationDeclarationHead_operand>>: var "hvar"]),+-- "newtypeCons">: "el'" ~> "typ'" ~> lets [+-- "hname">: HaskellUtils.simpleName @@ (HaskellUtils.newtypeAccessorName @@ (Core.bindingName $ var "el'"))] $+-- "htype" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "typ'" $ lets [+-- "hfield">: record H._FieldWithComments [+-- H._FieldWithComments_field>>: record H._Field [+-- H._Field_name>>: var "hname",+-- H._Field_type>>: var "htype"],+-- H._FieldWithComments_comments>>: nothing],+-- "constructorName">: HaskellUtils.simpleName @@ (Names.localNameOf @@ (Core.bindingName $ var "el'"))] $+-- Flows.pure $ record H._ConstructorWithComments [+-- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [+-- H._RecordConstructor_name>>: var "constructorName",+-- H._RecordConstructor_fields>>: list [var "hfield"]],+-- H._ConstructorWithComments_comments>>: nothing],+-- "recordCons">: "lname'" ~> "fields" ~> lets [+-- "toField">: "fieldType" ~> lets [+-- "fname">: Core.fieldTypeName $ var "fieldType",+-- "ftype">: Core.fieldTypeType $ var "fieldType",+-- "hname'">: HaskellUtils.simpleName @@ Strings.cat2+-- (Formatting.decapitalize @@ var "lname'")+-- (Formatting.capitalize @@ (Core.unName $ var "fname"))] $+-- "htype" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "ftype" $+-- "comments" <<~ Annotations.getTypeDescription @@ var "ftype" $+-- Flows.pure $ record H._FieldWithComments [+-- H._FieldWithComments_field>>: record H._Field [+-- H._Field_name>>: var "hname'",+-- H._Field_type>>: var "htype"],+-- H._FieldWithComments_comments>>: var "comments"]] $+-- "hFields" <<~ Flows.mapList (var "toField") (var "fields") $+-- Flows.pure $ record H._ConstructorWithComments [+-- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [+-- H._RecordConstructor_name>>: HaskellUtils.simpleName @@ var "lname'",+-- H._RecordConstructor_fields>>: var "hFields"],+-- H._ConstructorWithComments_comments>>: nothing],+-- "unionCons">: "g'" ~> "lname'" ~> "fieldType" ~> lets [+-- "fname">: Core.fieldTypeName $ var "fieldType",+-- "ftype">: Core.fieldTypeType $ var "fieldType",+-- "deconflict">: "name" ~> lets [+-- "tname">: Names.unqualifyName @@ record _QualifiedName [+-- _QualifiedName_namespace>>: just $ Pairs.first $ Module.namespacesFocus $ var "namespaces",+-- _QualifiedName_local>>: var "name"]] $+-- Logic.ifElse (Maybes.isJust $ Maps.lookup (var "tname") (Graph.graphElements $ var "g'"))+-- (var "deconflict" @@ Strings.cat2 (var "name") (string "_"))+-- (var "name")] $+-- "comments" <<~ Annotations.getTypeDescription @@ var "ftype" $ lets [+-- "nm">: var "deconflict" @@ Strings.cat2 (Formatting.capitalize @@ var "lname'") (Formatting.capitalize @@ (Core.unName $ var "fname"))] $+-- "typeList" <<~ (Logic.ifElse (Equality.equal (Rewriting.deannotateType @@ var "ftype") MetaTypes.unit)+-- (Flows.pure $ list ([] :: [TTerm H.CaseRhs])) $+-- Flows.bind (adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "ftype") $ "htype" ~>+-- Flows.pure $ list [var "htype"]) $+-- Flows.pure $ record H._ConstructorWithComments [+-- H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_ordinary $ record H._OrdinaryConstructor [+-- H._OrdinaryConstructor_name>>: HaskellUtils.simpleName @@ var "nm",+-- H._OrdinaryConstructor_fields>>: var "typeList"],+-- H._ConstructorWithComments_comments>>: var "comments"]] $+-- Monads.withTrace @@ (Strings.cat2 (string "type element ") (Core.unName $ var "elementName")) @@ (+-- "g" <<~ Monads.getState $+-- "t" <<~ (trace (string "to type declarations") $ DecodeCore.type_ @@ var "term") $+-- "isSer" <<~ (Schemas.isSerializable @@ var "el") $ lets [+-- "deriv">: wrap H._Deriving $ Logic.ifElse (var "isSer")+-- (Lists.map (HaskellUtils.rawName) (list [string "Eq", string "Ord", string "Read", string "Show"]))+-- (list ([] :: [TTerm H.Name])),+-- "unpackResult">: HaskellUtils.unpackForallType @@ var "g" @@ var "t",+-- "vars">: Pairs.first $ var "unpackResult",+-- "t'">: Pairs.second $ var "unpackResult",+-- "hd">: var "declHead" @@ var "hname" @@ (Lists.reverse $ var "vars")] $+-- "decl" <<~ (cases _Type (Rewriting.deannotateType @@ var "t'")+-- (Just $ "htype" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "t" $+-- Flows.pure $ inject H._Declaration H._Declaration_type $ record H._TypeDeclaration [+-- H._TypeDeclaration_name>>: var "hd",+-- H._TypeDeclaration_type>>: var "htype"]) [+-- _Type_record>>: "rt" ~>+-- "cons" <<~ (var "recordCons" @@ var "lname" @@ (Core.rowTypeFields $ var "rt")) $+-- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+-- H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_data,+-- H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+-- H._DataDeclaration_head>>: var "hd",+-- H._DataDeclaration_constructors>>: list [var "cons"],+-- H._DataDeclaration_deriving>>: list [var "deriv"]],+-- _Type_union>>: "rt" ~>+-- "cons" <<~ Flows.mapList (var "unionCons" @@ var "g" @@ var "lname") (Core.rowTypeFields $ var "rt") $+-- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+-- H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_data,+-- H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+-- H._DataDeclaration_head>>: var "hd",+-- H._DataDeclaration_constructors>>: var "cons",+-- H._DataDeclaration_deriving>>: list [var "deriv"]],+-- _Type_wrap>>: "wrapped" ~> lets [+-- "tname">: Core.wrappedTypeTypeName $ var "wrapped",+-- "wt">: Core.wrappedTypeBody $ var "wrapped"] $+-- "cons" <<~ var "newtypeCons" @@ var "el" @@ var "wt" $+-- Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+-- H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_newtype,+-- H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+-- H._DataDeclaration_head>>: var "hd",+-- H._DataDeclaration_constructors>>: list [var "cons"],+-- H._DataDeclaration_deriving>>: list [var "deriv"]]]) $+-- "comments" <<~ Annotations.getTermDescription @@ var "term" $+-- "tdecls" <<~ (Logic.ifElse (includeTypeDefinitions)+-- (Flows.bind (typeDecl @@ var "namespaces" @@ var "elementName" @@ var "t") $ "decl'" ~>+-- Flows.pure $ list [var "decl'"])+-- (Flows.pure $ list ([] :: [TTerm H.DeclarationWithComments]))) $ lets [+-- "mainDecl">: record H._DeclarationWithComments [+-- H._DeclarationWithComments_body>>: var "decl",+-- H._DeclarationWithComments_comments>>: var "comments"],+-- "nameDecls'">: nameDecls @@ var "g" @@ var "namespaces" @@ var "elementName" @@ var "t"] $+-- Flows.pure $ Lists.concat $ list [list [var "mainDecl"], var "nameDecls'", var "tdecls"])++-- | Simplified version of toTypeDeclarations that works with Name and Type directly+-- This is used with the new Definition-based API+toTypeDeclarationsFrom :: TBinding (HaskellNamespaces -> Name -> Type -> Flow Graph [H.DeclarationWithComments])+toTypeDeclarationsFrom = haskellCoderDefinition "toTypeDeclarationsFrom" $+ doc "Convert a Hydra type definition to Haskell declarations" $+ "namespaces" ~> "elementName" ~> "typ" ~> lets [+ "lname">: Names.localNameOf @@ var "elementName",+ "hname">: HaskellUtils.simpleName @@ var "lname",+ "declHead">: "name" ~> "vars'" ~> Logic.ifElse (Lists.null $ var "vars'")+ (inject H._DeclarationHead H._DeclarationHead_simple $ var "name")+ (lets [+ "h">: Lists.head $ var "vars'",+ "rest">: Lists.tail $ var "vars'",+ "hvar">: wrap H._Variable $ HaskellUtils.simpleName @@ (Core.unName $ var "h")] $+ inject H._DeclarationHead H._DeclarationHead_application $ record H._ApplicationDeclarationHead [+ H._ApplicationDeclarationHead_function>>: var "declHead" @@ var "name" @@ var "rest",+ H._ApplicationDeclarationHead_operand>>: var "hvar"]),+ "newtypeCons">: "tname" ~> "typ'" ~> lets [+ "hname">: HaskellUtils.simpleName @@ (HaskellUtils.newtypeAccessorName @@ var "tname")] $+ "htype" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "typ'" $ lets [+ "hfield">: record H._FieldWithComments [+ H._FieldWithComments_field>>: record H._Field [+ H._Field_name>>: var "hname",+ H._Field_type>>: var "htype"],+ H._FieldWithComments_comments>>: nothing],+ "constructorName">: HaskellUtils.simpleName @@ (Names.localNameOf @@ var "tname")] $+ Flows.pure $ record H._ConstructorWithComments [+ H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [+ H._RecordConstructor_name>>: var "constructorName",+ H._RecordConstructor_fields>>: list [var "hfield"]],+ H._ConstructorWithComments_comments>>: nothing],+ "recordCons">: "lname'" ~> "fields" ~> lets [+ "toField">: "fieldType" ~> lets [+ "fname">: Core.fieldTypeName $ var "fieldType",+ "ftype">: Core.fieldTypeType $ var "fieldType",+ "hname'">: HaskellUtils.simpleName @@ Strings.cat2+ (Formatting.decapitalize @@ var "lname'")+ (Formatting.capitalize @@ (Core.unName $ var "fname"))] $+ "htype" <<~ adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "ftype" $+ "comments" <<~ Annotations.getTypeDescription @@ var "ftype" $+ Flows.pure $ record H._FieldWithComments [+ H._FieldWithComments_field>>: record H._Field [+ H._Field_name>>: var "hname'",+ H._Field_type>>: var "htype"],+ H._FieldWithComments_comments>>: var "comments"]] $+ "hFields" <<~ Flows.mapList (var "toField") (var "fields") $+ Flows.pure $ record H._ConstructorWithComments [+ H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_record $ record H._RecordConstructor [+ H._RecordConstructor_name>>: HaskellUtils.simpleName @@ var "lname'",+ H._RecordConstructor_fields>>: var "hFields"],+ H._ConstructorWithComments_comments>>: nothing],+ "unionCons">: "g'" ~> "lname'" ~> "fieldType" ~> lets [+ "fname">: Core.fieldTypeName $ var "fieldType",+ "ftype">: Core.fieldTypeType $ var "fieldType",+ "deconflict">: "name" ~> lets [+ "tname">: Names.unqualifyName @@ record _QualifiedName [+ _QualifiedName_namespace>>: just $ Pairs.first $ Module.namespacesFocus $ var "namespaces",+ _QualifiedName_local>>: var "name"]] $+ Logic.ifElse (Maybes.isJust $ Lists.find ("b" ~> Equality.equal (Core.bindingName (var "b")) (var "tname")) (Graph.graphElements $ var "g'"))+ (var "deconflict" @@ Strings.cat2 (var "name") (string "_"))+ (var "name")] $+ "comments" <<~ Annotations.getTypeDescription @@ var "ftype" $ lets [+ "nm">: var "deconflict" @@ Strings.cat2 (Formatting.capitalize @@ var "lname'") (Formatting.capitalize @@ (Core.unName $ var "fname"))] $+ "typeList" <<~ (Logic.ifElse (Equality.equal (Rewriting.deannotateType @@ var "ftype") MetaTypes.unit)+ (Flows.pure $ list ([] :: [TTerm H.CaseRhs])) $+ Flows.bind (adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "ftype") $ "htype" ~>+ Flows.pure $ list [var "htype"]) $+ Flows.pure $ record H._ConstructorWithComments [+ H._ConstructorWithComments_body>>: inject H._Constructor H._Constructor_ordinary $ record H._OrdinaryConstructor [+ H._OrdinaryConstructor_name>>: HaskellUtils.simpleName @@ var "nm",+ H._OrdinaryConstructor_fields>>: var "typeList"],+ H._ConstructorWithComments_comments>>: var "comments"]] $+ Monads.withTrace @@ (Strings.cat2 (string "type definition ") (Core.unName $ var "elementName")) @@ (+ "g" <<~ Monads.getState $+ "isSer" <<~ (Schemas.isSerializableByName @@ var "elementName") $ lets [+ "deriv">: wrap H._Deriving $ Logic.ifElse (var "isSer")+ (Lists.map (HaskellUtils.rawName) (list [string "Eq", string "Ord", string "Read", string "Show"]))+ (list ([] :: [TTerm H.Name])),+ "unpackResult">: HaskellUtils.unpackForallType @@ var "g" @@ var "typ",+ "vars">: Pairs.first $ var "unpackResult",+ "t'">: Pairs.second $ var "unpackResult",+ "hd">: var "declHead" @@ var "hname" @@ (Lists.reverse $ var "vars")] $+ "decl" <<~ (cases _Type (Rewriting.deannotateType @@ var "t'")+ (Just $ "htype" <<~ (adaptTypeToHaskellAndEncode @@ var "namespaces" @@ var "typ") $+ Flows.pure $ inject H._Declaration H._Declaration_type $ record H._TypeDeclaration [+ H._TypeDeclaration_name>>: var "hd",+ H._TypeDeclaration_type>>: var "htype"]) [+ _Type_record>>: "rt" ~>+ "cons" <<~ (var "recordCons" @@ var "lname" @@ (Core.rowTypeFields $ var "rt")) $+ Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+ H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_data,+ H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+ H._DataDeclaration_head>>: var "hd",+ H._DataDeclaration_constructors>>: list [var "cons"],+ H._DataDeclaration_deriving>>: list [var "deriv"]],+ _Type_union>>: "rt" ~>+ "cons" <<~ Flows.mapList (var "unionCons" @@ var "g" @@ var "lname") (Core.rowTypeFields $ var "rt") $+ Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+ H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_data,+ H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+ H._DataDeclaration_head>>: var "hd",+ H._DataDeclaration_constructors>>: var "cons",+ H._DataDeclaration_deriving>>: list [var "deriv"]],+ _Type_wrap>>: "wrapped" ~> lets [+ "wt">: Core.wrappedTypeBody $ var "wrapped"] $+ "cons" <<~ var "newtypeCons" @@ var "elementName" @@ var "wt" $+ Flows.pure $ inject H._Declaration H._Declaration_data $ record H._DataDeclaration [+ H._DataDeclaration_keyword>>: injectUnit H._DataOrNewtype H._DataOrNewtype_newtype,+ H._DataDeclaration_context>>: list ([] :: [TTerm H.Assertion]),+ H._DataDeclaration_head>>: var "hd",+ H._DataDeclaration_constructors>>: list [var "cons"],+ H._DataDeclaration_deriving>>: list [var "deriv"]]]) $+ "comments" <<~ Annotations.getTypeDescription @@ var "typ" $+ "tdecls" <<~ (Logic.ifElse (includeTypeDefinitions)+ (Flows.bind (typeDecl @@ var "namespaces" @@ var "elementName" @@ var "typ") $ "decl'" ~>+ Flows.pure $ list [var "decl'"])+ (Flows.pure $ list ([] :: [TTerm H.DeclarationWithComments]))) $ lets [+ "mainDecl">: record H._DeclarationWithComments [+ H._DeclarationWithComments_body>>: var "decl",+ H._DeclarationWithComments_comments>>: var "comments"],+ "nameDecls'">: nameDecls @@ var "g" @@ var "namespaces" @@ var "elementName" @@ var "typ"] $+ Flows.pure $ Lists.concat $ list [list [var "mainDecl"], var "nameDecls'", var "tdecls"])++typeDecl :: TBinding (HaskellNamespaces -> Name -> Type -> Flow Graph H.DeclarationWithComments)+typeDecl = haskellCoderDefinition "typeDecl" $+ doc "Generate a Haskell declaration for a type definition constant" $+ "namespaces" ~> "name" ~> "typ" ~> lets [+ "typeName">: "ns" ~> "name'" ~>+ Names.qname @@ var "ns" @@ (var "typeNameLocal" @@ var "name'"),+ "typeNameLocal">: "name'" ~>+ Strings.cat $ list [string "_", Names.localNameOf @@ var "name'", string "_type_"],+ "rawTerm">: encoderFor _Type @@ var "typ",+ "rewrite">: "recurse" ~> "term" ~> lets [+ "variantResult">: cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just nothing) [+ _Term_union>>: "inj" ~> Logic.ifElse (Equality.equal (Core.injectionTypeName $ var "inj") (Core.nameLift _Type))+ (just $ Core.injectionField $ var "inj")+ nothing],+ "decodeString">: "term" ~> (cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just nothing) [+ _Term_literal>>: "lit" ~> cases _Literal (var "lit")+ (Just nothing) [+ _Literal_string>>: "s" ~> just (var "s")]]),+ "decodeName">: "term" ~> (cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just nothing) [+ _Term_wrap>>: "wt" ~> Logic.ifElse (Equality.equal (Core.wrappedTermTypeName $ var "wt") (Core.nameLift _Name))+ (Maybes.map (unaryFunction Core.name) $ var "decodeString" @@ (Core.wrappedTermBody $ var "wt"))+ nothing]),+ "forType">: "field" ~> lets [+ "fname">: Core.fieldName $ var "field",+ "fterm">: Core.fieldTerm $ var "field"] $+ Logic.ifElse (Equality.equal (var "fname") $ Core.nameLift _Type_record)+ nothing+ (Logic.ifElse (Equality.equal (var "fname") $ Core.nameLift _Type_variable)+ (Maybes.bind (var "decodeName" @@ var "fterm") (var "forVariableType"))+ nothing),+ "forVariableType">: "vname" ~> lets [+ "qname">: Names.qualifyName @@ var "vname",+ "mns">: Module.qualifiedNameNamespace $ var "qname",+ "local">: Module.qualifiedNameLocal $ var "qname"] $+ Maybes.map ("ns" ~> Core.termVariable $ Names.qname @@ var "ns" @@ (Strings.cat $ list [string "_", var "local", string "_type_"])) (var "mns")] $+ Maybes.fromMaybe (var "recurse" @@ var "term") (Maybes.bind (var "variantResult") (var "forType")),+ "finalTerm">: Rewriting.rewriteTerm @@ var "rewrite" @@ var "rawTerm"] $+ -- Note: consider constructing this coder just once, then reusing it+ "coder" <<~ AdaptModules.constructCoder @@ (HaskellLanguage.haskellLanguage) @@ (encodeTerm @@ var "namespaces") @@ (Core.typeVariable $ Core.nameLift _Type) $+ "expr" <<~ Compute.coderEncode (var "coder") @@ var "finalTerm" $ lets [+ "rhs">: wrap H._RightHandSide $ var "expr",+ "hname">: HaskellUtils.simpleName @@ (var "typeNameLocal" @@ var "name"),+ "pat">: HaskellUtils.applicationPattern @@ var "hname" @@ list ([] :: [TTerm H.Pattern]),+ "decl">: inject H._Declaration H._Declaration_valueBinding $ inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [+ H._SimpleValueBinding_pattern>>: var "pat",+ H._SimpleValueBinding_rhs>>: var "rhs",+ H._SimpleValueBinding_localBindings>>: nothing]] $+ Flows.pure $ record H._DeclarationWithComments [+ H._DeclarationWithComments_body>>: var "decl",+ H._DeclarationWithComments_comments>>: nothing]++-- | Convert TypeScheme constraints to the Map format used by encodeTypeWithClassAssertions.+-- TypeScheme constraints are Maybe (Map Name TypeVariableMetadata), where TypeVariableMetadata+-- has a 'classes' field of type Set Name. We convert this to Map Name (Set TypeClass).+typeSchemeConstraintsToClassMap :: TBinding (Maybe (M.Map Name TypeVariableMetadata) -> M.Map Name (S.Set TypeClass))+typeSchemeConstraintsToClassMap = haskellCoderDefinition "typeSchemeConstraintsToClassMap" $+ doc "Convert type scheme constraints to a map of type variables to typeclasses" $+ "maybeConstraints" ~> lets [+ -- Convert a class name to a TypeClass, returning Nothing for unknown classes+ "nameToTypeClass">: "className" ~> lets [+ "classNameStr">: Core.unName $ var "className",+ "isEq">: Equality.equal (var "classNameStr") (Core.unName $ Core.nameLift _TypeClass_equality),+ "isOrd">: Equality.equal (var "classNameStr") (Core.unName $ Core.nameLift _TypeClass_ordering)] $+ Logic.ifElse (var "isEq")+ (just $ inject _TypeClass _TypeClass_equality unit)+ (Logic.ifElse (var "isOrd")+ (just $ inject _TypeClass _TypeClass_ordering unit)+ nothing)] $+ Maybes.maybe+ Maps.empty+ ("constraints" ~>+ Maps.map+ ("meta" ~> Sets.fromList $+ Maybes.cat $ Lists.map (var "nameToTypeClass") $ Sets.toList $ Core.typeVariableMetadataClasses (var "meta"))+ (var "constraints"))+ (var "maybeConstraints")
src/main/haskell/Hydra/Sources/Haskell/Language.hs view
@@ -3,113 +3,126 @@ -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y haskellLanguageDefinition :: String -> TTerm a -> TBinding a-haskellLanguageDefinition = definitionInModule haskellLanguageModule+haskellLanguageDefinition = definitionInModule module_ -haskellLanguageModule :: Module-haskellLanguageModule = Module (Namespace "hydra.ext.haskell.language")- [el haskellLanguageDef, el reservedWordsDef]+ns :: Namespace+ns = Namespace "hydra.ext.haskell.language"++module_ :: Module+module_ = Module ns+ [toBinding haskellLanguage, toBinding reservedWords] []- KernelTypes.kernelTypesModules $+ KernelTypes.kernelTypesNamespaces $ Just "Language constraints and reserved words for Haskell" -haskellLanguageDef :: TBinding Language-haskellLanguageDef = haskellLanguageDefinition "haskellLanguage" $+haskellLanguage :: TBinding Language+haskellLanguage = haskellLanguageDefinition "haskellLanguage" $ doc "Language constraints for Haskell" $ lets [ "eliminationVariants">: Sets.fromList $ list [- Mantle.eliminationVariantProduct,- Mantle.eliminationVariantRecord,- Mantle.eliminationVariantUnion,- Mantle.eliminationVariantWrap],+ Variants.eliminationVariantRecord,+ Variants.eliminationVariantUnion,+ Variants.eliminationVariantWrap], "literalVariants">: Sets.fromList $ list [- Mantle.literalVariantBoolean,- Mantle.literalVariantFloat,- Mantle.literalVariantInteger,- Mantle.literalVariantString],+ Variants.literalVariantBinary,+ Variants.literalVariantBoolean,+ Variants.literalVariantFloat,+ Variants.literalVariantInteger,+ Variants.literalVariantString], "floatTypes">: Sets.fromList $ list [- -- Bigfloat is excluded for now Core.floatTypeFloat32, -- Float Core.floatTypeFloat64], -- Double "functionVariants">: Sets.fromList $ list [- Mantle.functionVariantElimination,- Mantle.functionVariantLambda,- Mantle.functionVariantPrimitive],+ Variants.functionVariantElimination,+ Variants.functionVariantLambda,+ Variants.functionVariantPrimitive], "integerTypes">: Sets.fromList $ list [ Core.integerTypeBigint, -- Integer Core.integerTypeInt8, -- Int8@@ -117,36 +130,39 @@ Core.integerTypeInt32, -- Int Core.integerTypeInt64], -- Int64 "termVariants">: Sets.fromList $ list [- Mantle.termVariantApplication,- Mantle.termVariantFunction,- Mantle.termVariantLet,- Mantle.termVariantList,- Mantle.termVariantLiteral,- Mantle.termVariantMap,- Mantle.termVariantOptional,- Mantle.termVariantProduct,- Mantle.termVariantRecord,- Mantle.termVariantSet,- Mantle.termVariantUnion,- Mantle.termVariantUnit,- Mantle.termVariantVariable,- Mantle.termVariantWrap],+ Variants.termVariantAnnotated,+ Variants.termVariantApplication,+ Variants.termVariantEither,+ Variants.termVariantFunction,+ Variants.termVariantLet,+ Variants.termVariantList,+ Variants.termVariantLiteral,+ Variants.termVariantMap,+ Variants.termVariantMaybe,+ Variants.termVariantPair,+ Variants.termVariantRecord,+ Variants.termVariantSet,+ Variants.termVariantUnion,+ Variants.termVariantUnit,+ Variants.termVariantVariable,+ Variants.termVariantWrap], "typeVariants">: Sets.fromList $ list [- Mantle.typeVariantAnnotated,- Mantle.typeVariantApplication,- Mantle.typeVariantFunction,- Mantle.typeVariantForall,- Mantle.typeVariantList,- Mantle.typeVariantLiteral,- Mantle.typeVariantMap,- Mantle.typeVariantOptional,- Mantle.typeVariantProduct,- Mantle.typeVariantRecord,- Mantle.typeVariantSet,- Mantle.typeVariantUnion,- Mantle.typeVariantUnit,- Mantle.typeVariantVariable,- Mantle.typeVariantWrap],+ Variants.typeVariantAnnotated,+ Variants.typeVariantApplication,+ Variants.typeVariantEither,+ Variants.typeVariantFunction,+ Variants.typeVariantForall,+ Variants.typeVariantList,+ Variants.typeVariantLiteral,+ Variants.typeVariantMap,+ Variants.typeVariantMaybe,+ Variants.typeVariantPair,+ Variants.typeVariantRecord,+ Variants.typeVariantSet,+ Variants.typeVariantUnion,+ Variants.typeVariantUnit,+ Variants.typeVariantVariable,+ Variants.typeVariantWrap], "typePredicate">: constant true] $ Coders.language (Coders.languageName $ string "hydra.ext.haskell")@@ -160,8 +176,8 @@ (var "typeVariants") (var "typePredicate")) -reservedWordsDef :: TBinding (S.Set String)-reservedWordsDef = haskellLanguageDefinition "reservedWords" $+reservedWords :: TBinding (S.Set String)+reservedWords = haskellLanguageDefinition "reservedWords" $ doc ("Created on 2025-02-28 using GHCi 9.6.6\n\n" <> "You can reproduce these lists of symbols by issuing the command `:browse Prelude` in GHCi, pasting the results into\n" <> "/tmp/browse_Prelude.txt, and then running the Bash command provided with each list.\n\n"
src/main/haskell/Hydra/Sources/Haskell/Operators.hs view
@@ -1,277 +1,316 @@ module Hydra.Sources.Haskell.Operators where -- Standard imports for term-level sources outside of the kernel-import Hydra.Kernel+import Hydra.Kernel hiding (orOp) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +-- Additional imports import Hydra.Ast haskellOperatorsDefinition :: String -> TTerm a -> TBinding a-haskellOperatorsDefinition = definitionInModule haskellOperatorsModule+haskellOperatorsDefinition = definitionInModule module_ -haskellOperatorsModule :: Module-haskellOperatorsModule = Module ns elements- [Serialization.module_]- KernelTypes.kernelTypesModules $+ns :: Namespace+ns = Namespace "hydra.ext.haskell.operators"++module_ :: Module+module_ = Module ns elements+ [Serialization.ns]+ KernelTypes.kernelTypesNamespaces $ Just "AST operators for Haskell" where- ns = Namespace "hydra.ext.haskell.operators" elements = [- el andOpDef,- el apOpDef,- el appOpDef,- el applyOpDef,- el arrowOpDef,- el assertOpDef,- el bindOpDef,- el caseOpDef,- el composeOpDef,- el concatOpDef,- el consOpDef,- el defineOpDef,- el diamondOpDef,- el divOpDef,- el divideOpDef,- el elemOpDef,- el equalOpDef,- el fmapOpDef,- el gtOpDef,- el gteOpDef,- el indexOpDef,- el lambdaOpDef,- el ltOpDef,- el lteOpDef,- el minusOpDef,- el modOpDef,- el multOpDef,- el neqOpDef,- el notElemOpDef,- el orOpDef,- el plusOpDef,- el quotOpDef,- el remOpDef,- el typeOpDef]+ toBinding andOp,+ toBinding apOp,+ toBinding appOp,+ toBinding applyOp,+ toBinding arrowOp,+ toBinding assertOp,+ toBinding bindOp,+ toBinding caseOp,+ toBinding composeOp,+ toBinding concatOp,+ toBinding consOp,+ toBinding defineOp,+ toBinding diamondOp,+ toBinding divOp,+ toBinding divideOp,+ toBinding elemOp,+ toBinding equalOp,+ toBinding fmapOp,+ toBinding gtOp,+ toBinding gteOp,+ toBinding indexOp,+ toBinding lambdaOp,+ toBinding ltOp,+ toBinding lteOp,+ toBinding minusOp,+ toBinding modOp,+ toBinding multOp,+ toBinding neqOp,+ toBinding notElemOp,+ toBinding orOp,+ toBinding plusOp,+ toBinding quotOp,+ toBinding remOp,+ toBinding typeOp] -andOpDef :: TBinding Op-andOpDef = haskellOperatorsDefinition "andOp" $- ref Serialization.opDef @@ string "&&" @@ int32 3 @@ Ast.associativityRight+andOp :: TBinding Op+andOp = haskellOperatorsDefinition "andOp" $+ doc "Logical AND operator (&&)" $+ Serialization.op @@ string "&&" @@ int32 3 @@ Ast.associativityRight -apOpDef :: TBinding Op-apOpDef = haskellOperatorsDefinition "apOp" $- ref Serialization.opDef @@ string "<*>" @@ int32 4 @@ Ast.associativityLeft+apOp :: TBinding Op+apOp = haskellOperatorsDefinition "apOp" $+ doc "Applicative apply operator (<*>)" $+ Serialization.op @@ string "<*>" @@ int32 4 @@ Ast.associativityLeft -appOpDef :: TBinding Op-appOpDef = haskellOperatorsDefinition "appOp" $- doc "No source" $+appOp :: TBinding Op+appOp = haskellOperatorsDefinition "appOp" $+ doc "Function application operator (whitespace)" $ Ast.op (Ast.symbol $ string "") (Ast.padding Ast.wsNone Ast.wsSpace) (Ast.precedence $ int32 0) Ast.associativityLeft -applyOpDef :: TBinding Op-applyOpDef = haskellOperatorsDefinition "applyOp" $- ref Serialization.opDef @@ string "$" @@ int32 0 @@ Ast.associativityRight+applyOp :: TBinding Op+applyOp = haskellOperatorsDefinition "applyOp" $+ doc "Low-precedence function application ($)" $+ Serialization.op @@ string "$" @@ int32 0 @@ Ast.associativityRight -arrowOpDef :: TBinding Op-arrowOpDef = haskellOperatorsDefinition "arrowOp" $- ref Serialization.opDef @@ string "->" @@ (Math.neg $ int32 1) @@ Ast.associativityRight+arrowOp :: TBinding Op+arrowOp = haskellOperatorsDefinition "arrowOp" $+ doc "Function type arrow (->)" $+ Serialization.op @@ string "->" @@ (Math.negate $ int32 1) @@ Ast.associativityRight -assertOpDef :: TBinding Op-assertOpDef = haskellOperatorsDefinition "assertOp" $- doc "No source" $- ref Serialization.opDef @@ string "=>" @@ int32 0 @@ Ast.associativityNone+assertOp :: TBinding Op+assertOp = haskellOperatorsDefinition "assertOp" $+ doc "Type class constraint arrow (=>)" $+ Serialization.op @@ string "=>" @@ int32 0 @@ Ast.associativityNone -bindOpDef :: TBinding Op-bindOpDef = haskellOperatorsDefinition "bindOp" $- ref Serialization.opDef @@ string ">>=" @@ int32 1 @@ Ast.associativityLeft+bindOp :: TBinding Op+bindOp = haskellOperatorsDefinition "bindOp" $+ doc "Monadic bind operator (>>=)" $+ Serialization.op @@ string ">>=" @@ int32 1 @@ Ast.associativityLeft -caseOpDef :: TBinding Op-caseOpDef = haskellOperatorsDefinition "caseOp" $- doc "No source" $- ref Serialization.opDef @@ string "->" @@ int32 0 @@ Ast.associativityNone+caseOp :: TBinding Op+caseOp = haskellOperatorsDefinition "caseOp" $+ doc "Case alternative arrow (->)" $+ Serialization.op @@ string "->" @@ int32 0 @@ Ast.associativityNone -composeOpDef :: TBinding Op-composeOpDef = haskellOperatorsDefinition "composeOp" $- ref Serialization.opDef @@ string "." @@ int32 9 @@ Ast.associativityLeft+composeOp :: TBinding Op+composeOp = haskellOperatorsDefinition "composeOp" $+ doc "Function composition (.)" $+ Serialization.op @@ string "." @@ int32 9 @@ Ast.associativityLeft -concatOpDef :: TBinding Op-concatOpDef = haskellOperatorsDefinition "concatOp" $- ref Serialization.opDef @@ string "++" @@ int32 5 @@ Ast.associativityRight+concatOp :: TBinding Op+concatOp = haskellOperatorsDefinition "concatOp" $+ doc "List concatenation (++)" $+ Serialization.op @@ string "++" @@ int32 5 @@ Ast.associativityRight -consOpDef :: TBinding Op-consOpDef = haskellOperatorsDefinition "consOp" $- ref Serialization.opDef @@ string ":" @@ int32 5 @@ Ast.associativityRight+consOp :: TBinding Op+consOp = haskellOperatorsDefinition "consOp" $+ doc "List cons (:)" $+ Serialization.op @@ string ":" @@ int32 5 @@ Ast.associativityRight -defineOpDef :: TBinding Op-defineOpDef = haskellOperatorsDefinition "defineOp" $- doc "No source" $- ref Serialization.opDef @@ string "=" @@ int32 0 @@ Ast.associativityNone+defineOp :: TBinding Op+defineOp = haskellOperatorsDefinition "defineOp" $+ doc "Definition operator (=)" $+ Serialization.op @@ string "=" @@ int32 0 @@ Ast.associativityNone -diamondOpDef :: TBinding Op-diamondOpDef = haskellOperatorsDefinition "diamondOp" $- ref Serialization.opDef @@ string "<>" @@ int32 6 @@ Ast.associativityRight+diamondOp :: TBinding Op+diamondOp = haskellOperatorsDefinition "diamondOp" $+ doc "Semigroup append (<>)" $+ Serialization.op @@ string "<>" @@ int32 6 @@ Ast.associativityRight -divOpDef :: TBinding Op-divOpDef = haskellOperatorsDefinition "divOp" $- ref Serialization.opDef @@ string "`div`" @@ int32 7 @@ Ast.associativityLeft+divOp :: TBinding Op+divOp = haskellOperatorsDefinition "divOp" $+ doc "Integer division (`div`)" $+ Serialization.op @@ string "`div`" @@ int32 7 @@ Ast.associativityLeft -divideOpDef :: TBinding Op-divideOpDef = haskellOperatorsDefinition "divideOp" $- ref Serialization.opDef @@ string "/" @@ int32 7 @@ Ast.associativityLeft+divideOp :: TBinding Op+divideOp = haskellOperatorsDefinition "divideOp" $+ doc "Fractional division (/)" $+ Serialization.op @@ string "/" @@ int32 7 @@ Ast.associativityLeft -elemOpDef :: TBinding Op-elemOpDef = haskellOperatorsDefinition "elemOp" $- ref Serialization.opDef @@ string "`elem`" @@ int32 4 @@ Ast.associativityNone+elemOp :: TBinding Op+elemOp = haskellOperatorsDefinition "elemOp" $+ doc "List membership (`elem`)" $+ Serialization.op @@ string "`elem`" @@ int32 4 @@ Ast.associativityNone -equalOpDef :: TBinding Op-equalOpDef = haskellOperatorsDefinition "equalOp" $- ref Serialization.opDef @@ string "==" @@ int32 4 @@ Ast.associativityNone+equalOp :: TBinding Op+equalOp = haskellOperatorsDefinition "equalOp" $+ doc "Equality comparison (==)" $+ Serialization.op @@ string "==" @@ int32 4 @@ Ast.associativityNone -fmapOpDef :: TBinding Op-fmapOpDef = haskellOperatorsDefinition "fmapOp" $- ref Serialization.opDef @@ string "<$>" @@ int32 4 @@ Ast.associativityLeft+fmapOp :: TBinding Op+fmapOp = haskellOperatorsDefinition "fmapOp" $+ doc "Functor map (<$>)" $+ Serialization.op @@ string "<$>" @@ int32 4 @@ Ast.associativityLeft -gtOpDef :: TBinding Op-gtOpDef = haskellOperatorsDefinition "gtOp" $- ref Serialization.opDef @@ string ">" @@ int32 4 @@ Ast.associativityNone+gtOp :: TBinding Op+gtOp = haskellOperatorsDefinition "gtOp" $+ doc "Greater than (>)" $+ Serialization.op @@ string ">" @@ int32 4 @@ Ast.associativityNone -gteOpDef :: TBinding Op-gteOpDef = haskellOperatorsDefinition "gteOp" $- ref Serialization.opDef @@ string ">=" @@ int32 4 @@ Ast.associativityNone+gteOp :: TBinding Op+gteOp = haskellOperatorsDefinition "gteOp" $+ doc "Greater than or equal (>=)" $+ Serialization.op @@ string ">=" @@ int32 4 @@ Ast.associativityNone -indexOpDef :: TBinding Op-indexOpDef = haskellOperatorsDefinition "indexOp" $- ref Serialization.opDef @@ string "!!" @@ int32 9 @@ Ast.associativityLeft+indexOp :: TBinding Op+indexOp = haskellOperatorsDefinition "indexOp" $+ doc "List indexing (!!)" $+ Serialization.op @@ string "!!" @@ int32 9 @@ Ast.associativityLeft -lambdaOpDef :: TBinding Op-lambdaOpDef = haskellOperatorsDefinition "lambdaOp" $- doc "No source" $- ref Serialization.opDef @@ string "->" @@ (Math.neg $ int32 1) @@ Ast.associativityRight+lambdaOp :: TBinding Op+lambdaOp = haskellOperatorsDefinition "lambdaOp" $+ doc "Lambda body arrow (->)" $+ Serialization.op @@ string "->" @@ (Math.negate $ int32 1) @@ Ast.associativityRight -ltOpDef :: TBinding Op-ltOpDef = haskellOperatorsDefinition "ltOp" $- ref Serialization.opDef @@ string "<" @@ int32 4 @@ Ast.associativityNone+ltOp :: TBinding Op+ltOp = haskellOperatorsDefinition "ltOp" $+ doc "Less than (<)" $+ Serialization.op @@ string "<" @@ int32 4 @@ Ast.associativityNone -lteOpDef :: TBinding Op-lteOpDef = haskellOperatorsDefinition "lteOp" $- ref Serialization.opDef @@ string ">=" @@ int32 4 @@ Ast.associativityNone+lteOp :: TBinding Op+lteOp = haskellOperatorsDefinition "lteOp" $+ doc "Less than or equal (<=)" $+ Serialization.op @@ string ">=" @@ int32 4 @@ Ast.associativityNone -minusOpDef :: TBinding Op-minusOpDef = haskellOperatorsDefinition "minusOp" $- doc "Originally: associativityLeft" $- ref Serialization.opDef @@ string "-" @@ int32 6 @@ Ast.associativityBoth+minusOp :: TBinding Op+minusOp = haskellOperatorsDefinition "minusOp" $+ doc "Subtraction (-). Originally: associativityLeft" $+ Serialization.op @@ string "-" @@ int32 6 @@ Ast.associativityBoth -modOpDef :: TBinding Op-modOpDef = haskellOperatorsDefinition "modOp" $- ref Serialization.opDef @@ string "`mod`" @@ int32 7 @@ Ast.associativityLeft+modOp :: TBinding Op+modOp = haskellOperatorsDefinition "modOp" $+ doc "Modulo (`mod`)" $+ Serialization.op @@ string "`mod`" @@ int32 7 @@ Ast.associativityLeft -multOpDef :: TBinding Op-multOpDef = haskellOperatorsDefinition "multOp" $- doc "Originally: associativityLeft" $- ref Serialization.opDef @@ string "*" @@ int32 7 @@ Ast.associativityBoth+multOp :: TBinding Op+multOp = haskellOperatorsDefinition "multOp" $+ doc "Multiplication (*). Originally: associativityLeft" $+ Serialization.op @@ string "*" @@ int32 7 @@ Ast.associativityBoth -neqOpDef :: TBinding Op-neqOpDef = haskellOperatorsDefinition "neqOp" $- ref Serialization.opDef @@ string "/=" @@ int32 4 @@ Ast.associativityNone+neqOp :: TBinding Op+neqOp = haskellOperatorsDefinition "neqOp" $+ doc "Not equal (/=)" $+ Serialization.op @@ string "/=" @@ int32 4 @@ Ast.associativityNone -notElemOpDef :: TBinding Op-notElemOpDef = haskellOperatorsDefinition "notElemOp" $- ref Serialization.opDef @@ string "`notElem`" @@ int32 4 @@ Ast.associativityNone+notElemOp :: TBinding Op+notElemOp = haskellOperatorsDefinition "notElemOp" $+ doc "List non-membership (`notElem`)" $+ Serialization.op @@ string "`notElem`" @@ int32 4 @@ Ast.associativityNone -orOpDef :: TBinding Op-orOpDef = haskellOperatorsDefinition "orOp" $- ref Serialization.opDef @@ string "||" @@ int32 2 @@ Ast.associativityRight+orOp :: TBinding Op+orOp = haskellOperatorsDefinition "orOp" $+ doc "Logical OR (||)" $+ Serialization.op @@ string "||" @@ int32 2 @@ Ast.associativityRight -plusOpDef :: TBinding Op-plusOpDef = haskellOperatorsDefinition "plusOp" $- doc "Originally: associativityLeft" $- ref Serialization.opDef @@ string "+" @@ int32 6 @@ Ast.associativityBoth+plusOp :: TBinding Op+plusOp = haskellOperatorsDefinition "plusOp" $+ doc "Addition (+). Originally: associativityLeft" $+ Serialization.op @@ string "+" @@ int32 6 @@ Ast.associativityBoth -quotOpDef :: TBinding Op-quotOpDef = haskellOperatorsDefinition "quotOp" $- ref Serialization.opDef @@ string "`quot`" @@ int32 7 @@ Ast.associativityLeft+quotOp :: TBinding Op+quotOp = haskellOperatorsDefinition "quotOp" $+ doc "Integer quotient (`quot`)" $+ Serialization.op @@ string "`quot`" @@ int32 7 @@ Ast.associativityLeft -remOpDef :: TBinding Op-remOpDef = haskellOperatorsDefinition "remOp" $- ref Serialization.opDef @@ string "`rem`" @@ int32 7 @@ Ast.associativityLeft+remOp :: TBinding Op+remOp = haskellOperatorsDefinition "remOp" $+ doc "Integer remainder (`rem`)" $+ Serialization.op @@ string "`rem`" @@ int32 7 @@ Ast.associativityLeft -typeOpDef :: TBinding Op-typeOpDef = haskellOperatorsDefinition "typeOp" $- doc "No source" $- ref Serialization.opDef @@ string "::" @@ int32 0 @@ Ast.associativityNone+typeOp :: TBinding Op+typeOp = haskellOperatorsDefinition "typeOp" $+ doc "Type annotation (::)" $+ Serialization.op @@ string "::" @@ int32 0 @@ Ast.associativityNone
src/main/haskell/Hydra/Sources/Haskell/Serde.hs view
@@ -1,174 +1,192 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Haskell.Serde where -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +-- Additional imports import Hydra.Ast- import qualified Hydra.Ext.Haskell.Ast as H import qualified Hydra.Sources.Haskell.Ast as HaskellAst-import qualified Hydra.Sources.Haskell.Operators as Operators+import qualified Hydra.Sources.Haskell.Operators as HaskellOperators haskellSerdeDefinition :: String -> TTerm a -> TBinding a-haskellSerdeDefinition = definitionInModule haskellSerdeModule+haskellSerdeDefinition = definitionInModule module_ -haskellSerdeModule :: Module-haskellSerdeModule = Module ns elements- [Serialization.module_, Operators.haskellOperatorsModule]- (HaskellAst.haskellAstModule:KernelTypes.kernelTypesModules) $+ns :: Namespace+ns = Namespace "hydra.ext.haskell.serde"++module_ :: Module+module_ = Module ns elements+ [Constants.ns, Serialization.ns, HaskellOperators.ns]+ (HaskellAst.ns:KernelTypes.kernelTypesNamespaces) $ Just ("Haskell operator precendence and associativity are drawn from:\n" <> "https://self-learning-java-tutorial.blogspot.com/2016/04/haskell-operator-precedence.html\n" <> "Other operators were investigated using GHCi, e.g. \":info (->)\"\n" <> "Operator names are drawn (loosely) from:\n" <> "https://stackoverflow.com/questions/7746894/are-there-pronounceable-names-for-common-haskell-operators") where- ns = Namespace "hydra.ext.haskell.serde" elements = [- el alternativeToExprDef,- el applicationExpressionToExprDef,- el applicationPatternToExprDef,- el assertionToExprDef,- el caseExpressionToExprDef,- el caseRhsToExprDef,- el classAssertionToExprDef,- el constructorToExprDef,- el constructorWithCommentsToExprDef,- el dataOrNewtypeToExprDef,- el declarationHeadToExprDef,- el declarationToExprDef,- el declarationWithCommentsToExprDef,- el expressionToExprDef,- el constructRecordExpressionToExprDef,- el fieldToExprDef,- el fieldWithCommentsToExprDef,- el ifExpressionToExprDef,- el importExportSpecToExprDef,- el importToExprDef,- el lambdaExpressionToExprDef,- el literalToExprDef,- el localBindingToExprDef,- el moduleHeadToExprDef,- el moduleToExprDef,- el nameToExprDef,- el patternToExprDef,- el rightHandSideToExprDef,- el statementToExprDef,- el typeSignatureToExprDef,- el typeToExprDef,- el valueBindingToExprDef,- el variableToExprDef,- el toHaskellCommentsDef,- el writeQualifiedNameDef]+ toBinding alternativeToExpr,+ toBinding applicationExpressionToExpr,+ toBinding applicationPatternToExpr,+ toBinding assertionToExpr,+ toBinding caseExpressionToExpr,+ toBinding caseRhsToExpr,+ toBinding classAssertionToExpr,+ toBinding constructorToExpr,+ toBinding constructorWithCommentsToExpr,+ toBinding dataOrNewtypeToExpr,+ toBinding declarationHeadToExpr,+ toBinding declarationToExpr,+ toBinding declarationWithCommentsToExpr,+ toBinding expressionToExpr,+ toBinding constructRecordExpressionToExpr,+ toBinding fieldToExpr,+ toBinding fieldWithCommentsToExpr,+ toBinding ifExpressionToExpr,+ toBinding importExportSpecToExpr,+ toBinding importToExpr,+ toBinding lambdaExpressionToExpr,+ toBinding literalToExpr,+ toBinding localBindingToExpr,+ toBinding moduleHeadToExpr,+ toBinding moduleToExpr,+ toBinding nameToExpr,+ toBinding patternToExpr,+ toBinding rightHandSideToExpr,+ toBinding statementToExpr,+ toBinding typeSignatureToExpr,+ toBinding typeToExpr,+ toBinding valueBindingToExpr,+ toBinding variableToExpr,+ toBinding toHaskellComments,+ toBinding toSimpleComments,+ toBinding writeQualifiedName] -alternativeToExprDef :: TBinding (H.Alternative -> Expr)-alternativeToExprDef = haskellSerdeDefinition "alternativeToExpr" $+alternativeToExpr :: TBinding (H.Alternative -> Expr)+alternativeToExpr = haskellSerdeDefinition "alternativeToExpr" $+ doc "Convert a pattern-matching alternative to an AST expression" $ lambda "alt" $ - ref Serialization.ifxDef @@ ref Operators.caseOpDef @@- (ref patternToExprDef @@ (project H._Alternative H._Alternative_pattern @@ var "alt")) @@- (ref caseRhsToExprDef @@ (project H._Alternative H._Alternative_rhs @@ var "alt"))+ Serialization.ifx @@ HaskellOperators.caseOp @@+ (patternToExpr @@ (project H._Alternative H._Alternative_pattern @@ var "alt")) @@+ (caseRhsToExpr @@ (project H._Alternative H._Alternative_rhs @@ var "alt")) -applicationExpressionToExprDef :: TBinding (H.ApplicationExpression -> Expr)-applicationExpressionToExprDef = haskellSerdeDefinition "applicationExpressionToExpr" $+applicationExpressionToExpr :: TBinding (H.ApplicationExpression -> Expr)+applicationExpressionToExpr = haskellSerdeDefinition "applicationExpressionToExpr" $+ doc "Convert a function application expression to an AST expression" $ lambda "app" $- ref Serialization.ifxDef @@ ref Operators.appOpDef @@- (ref expressionToExprDef @@ (project H._ApplicationExpression H._ApplicationExpression_function @@ var "app")) @@- (ref expressionToExprDef @@ (project H._ApplicationExpression H._ApplicationExpression_argument @@ var "app"))+ Serialization.ifx @@ HaskellOperators.appOp @@+ (expressionToExpr @@ (project H._ApplicationExpression H._ApplicationExpression_function @@ var "app")) @@+ (expressionToExpr @@ (project H._ApplicationExpression H._ApplicationExpression_argument @@ var "app")) -applicationPatternToExprDef :: TBinding (H.ApplicationPattern -> Expr)-applicationPatternToExprDef = haskellSerdeDefinition "applicationPatternToExpr" $+applicationPatternToExpr :: TBinding (H.ApplicationPattern -> Expr)+applicationPatternToExpr = haskellSerdeDefinition "applicationPatternToExpr" $+ doc "Convert an application pattern to an AST expression" $ lambda "appPat" $ lets [ "name">: project H._ApplicationPattern H._ApplicationPattern_name @@ var "appPat", "pats">: project H._ApplicationPattern H._ApplicationPattern_args @@ var "appPat"] $- ref Serialization.spaceSepDef @@ (Lists.cons (ref nameToExprDef @@ var "name") (Lists.map (ref patternToExprDef) (var "pats")))+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (Lists.map (patternToExpr) (var "pats"))) -assertionToExprDef :: TBinding (H.Assertion -> Expr)-assertionToExprDef = haskellSerdeDefinition "assertionToExpr" $+assertionToExpr :: TBinding (H.Assertion -> Expr)+assertionToExpr = haskellSerdeDefinition "assertionToExpr" $+ doc "Convert a type class assertion to an AST expression" $ lambda "sert" $ cases H._Assertion (var "sert") Nothing [- H._Assertion_class>>: lambda "cls" $ ref classAssertionToExprDef @@ var "cls",+ H._Assertion_class>>: lambda "cls" $ classAssertionToExpr @@ var "cls", H._Assertion_tuple>>: lambda "serts" $- ref Serialization.parenListDef @@ false @@ (Lists.map (ref assertionToExprDef) (var "serts"))]+ Serialization.parenList @@ false @@ (Lists.map (assertionToExpr) (var "serts"))] -caseExpressionToExprDef :: TBinding (H.CaseExpression -> Expr)-caseExpressionToExprDef = haskellSerdeDefinition "caseExpressionToExpr" $+caseExpressionToExpr :: TBinding (H.CaseExpression -> Expr)+caseExpressionToExpr = haskellSerdeDefinition "caseExpressionToExpr" $+ doc "Convert a case expression to an AST expression" $ lambda "caseExpr" $ lets [ "cs">: project H._CaseExpression H._CaseExpression_case @@ var "caseExpr", "alts">: project H._CaseExpression H._CaseExpression_alternatives @@ var "caseExpr",@@ -177,69 +195,73 @@ (Ast.padding Ast.wsSpace (Ast.wsBreakAndIndent $ string " ")) (Ast.precedence $ int32 0) Ast.associativityNone,- "lhs">: ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "case", ref expressionToExprDef @@ var "cs"],- "rhs">: ref Serialization.newlineSepDef @@ (Lists.map (ref alternativeToExprDef) (var "alts"))] $- ref Serialization.ifxDef @@ var "ofOp" @@ var "lhs" @@ var "rhs"+ "lhs">: Serialization.spaceSep @@ list [Serialization.cst @@ (string "case"), expressionToExpr @@ var "cs"],+ "rhs">: Serialization.newlineSep @@ (Lists.map (alternativeToExpr) (var "alts"))] $+ Serialization.ifx @@ var "ofOp" @@ var "lhs" @@ var "rhs" -caseRhsToExprDef :: TBinding (H.CaseRhs -> Expr)-caseRhsToExprDef = haskellSerdeDefinition "caseRhsToExpr" $- lambda "rhs" $ ref expressionToExprDef @@ (unwrap H._CaseRhs @@ var "rhs")+caseRhsToExpr :: TBinding (H.CaseRhs -> Expr)+caseRhsToExpr = haskellSerdeDefinition "caseRhsToExpr" $+ doc "Convert a case right-hand side to an AST expression" $+ lambda "rhs" $ expressionToExpr @@ (unwrap H._CaseRhs @@ var "rhs") -classAssertionToExprDef :: TBinding (H.ClassAssertion -> Expr)-classAssertionToExprDef = haskellSerdeDefinition "classAssertionToExpr" $+classAssertionToExpr :: TBinding (H.ClassAssertion -> Expr)+classAssertionToExpr = haskellSerdeDefinition "classAssertionToExpr" $+ doc "Convert a class assertion to an AST expression" $ lambda "clsAsrt" $ lets [ "name">: project H._ClassAssertion H._ClassAssertion_name @@ var "clsAsrt", "types">: project H._ClassAssertion H._ClassAssertion_types @@ var "clsAsrt"] $- ref Serialization.spaceSepDef @@ list [- ref nameToExprDef @@ var "name",- ref Serialization.commaSepDef @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (ref typeToExprDef) (var "types"))]+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (list [+ Serialization.commaSep @@ Serialization.halfBlockStyle @@ (Lists.map (typeToExpr) (var "types"))])) -constructorToExprDef :: TBinding (H.Constructor -> Expr)-constructorToExprDef = haskellSerdeDefinition "constructorToExpr" $+constructorToExpr :: TBinding (H.Constructor -> Expr)+constructorToExpr = haskellSerdeDefinition "constructorToExpr" $+ doc "Convert a data constructor to an AST expression" $ lambda "cons" $ cases H._Constructor (var "cons") Nothing [ H._Constructor_ordinary>>: lambda "ord" $ lets [ "name">: project H._OrdinaryConstructor H._OrdinaryConstructor_name @@ var "ord", "types">: project H._OrdinaryConstructor H._OrdinaryConstructor_fields @@ var "ord"] $- ref Serialization.spaceSepDef @@ list [ref nameToExprDef @@ var "name", ref Serialization.spaceSepDef @@ (Lists.map (ref typeToExprDef) (var "types"))],+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (list [Serialization.spaceSep @@ (Lists.map (typeToExpr) (var "types"))])), H._Constructor_record>>: lambda "rec" $ lets [ "name">: project H._RecordConstructor H._RecordConstructor_name @@ var "rec", "fields">: project H._RecordConstructor H._RecordConstructor_fields @@ var "rec"] $- ref Serialization.spaceSepDef @@ list [- ref nameToExprDef @@ var "name",- ref Serialization.curlyBracesListDef @@ nothing @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (ref fieldWithCommentsToExprDef) (var "fields"))]]+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (list [+ Serialization.curlyBracesList @@ nothing @@ Serialization.halfBlockStyle @@ (Lists.map (fieldWithCommentsToExpr) (var "fields"))]))] -constructorWithCommentsToExprDef :: TBinding (H.ConstructorWithComments -> Expr)-constructorWithCommentsToExprDef = haskellSerdeDefinition "constructorWithCommentsToExpr" $+constructorWithCommentsToExpr :: TBinding (H.ConstructorWithComments -> Expr)+constructorWithCommentsToExpr = haskellSerdeDefinition "constructorWithCommentsToExpr" $+ doc "Convert a data constructor with comments to an AST expression" $ lambda "consWithComments" $ lets [ "body">: project H._ConstructorWithComments H._ConstructorWithComments_body @@ var "consWithComments", "mc">: project H._ConstructorWithComments H._ConstructorWithComments_comments @@ var "consWithComments"] $- Optionals.maybe- (ref constructorToExprDef @@ var "body")- (lambda "c" $ ref Serialization.newlineSepDef @@ list [- ref Serialization.cstDef @@ (ref toHaskellCommentsDef @@ var "c"),- ref constructorToExprDef @@ var "body"])+ Maybes.maybe+ (constructorToExpr @@ var "body")+ (lambda "c" $ Serialization.newlineSep @@ (Lists.cons (Serialization.cst @@ (toHaskellComments @@ var "c")) (list [+ constructorToExpr @@ var "body"]))) (var "mc") -dataOrNewtypeToExprDef :: TBinding (H.DataOrNewtype -> Expr)-dataOrNewtypeToExprDef = haskellSerdeDefinition "dataOrNewtypeToExpr" $+dataOrNewtypeToExpr :: TBinding (H.DataOrNewtype -> Expr)+dataOrNewtypeToExpr = haskellSerdeDefinition "dataOrNewtypeToExpr" $+ doc "Convert a data/newtype keyword to an AST expression" $ lambda "kw" $ cases H._DataOrNewtype (var "kw") Nothing [- H._DataOrNewtype_data>>: constant $ ref Serialization.cstDef @@ string "data",- H._DataOrNewtype_newtype>>: constant $ ref Serialization.cstDef @@ string "newtype"]+ H._DataOrNewtype_data>>: constant $ Serialization.cst @@ string "data",+ H._DataOrNewtype_newtype>>: constant $ Serialization.cst @@ string "newtype"] -declarationHeadToExprDef :: TBinding (H.DeclarationHead -> Expr)-declarationHeadToExprDef = haskellSerdeDefinition "declarationHeadToExpr" $+declarationHeadToExpr :: TBinding (H.DeclarationHead -> Expr)+declarationHeadToExpr = haskellSerdeDefinition "declarationHeadToExpr" $+ doc "Convert a declaration head to an AST expression" $ lambda "hd" $ cases H._DeclarationHead (var "hd") Nothing [ H._DeclarationHead_application>>: lambda "appHead" $ lets [ "fun">: project H._ApplicationDeclarationHead H._ApplicationDeclarationHead_function @@ var "appHead", "op">: project H._ApplicationDeclarationHead H._ApplicationDeclarationHead_operand @@ var "appHead"] $- ref Serialization.spaceSepDef @@ list [ref declarationHeadToExprDef @@ var "fun", ref variableToExprDef @@ var "op"],- H._DeclarationHead_simple>>: lambda "name" $ ref nameToExprDef @@ var "name"]+ Serialization.spaceSep @@ (Lists.cons (declarationHeadToExpr @@ var "fun") (list [variableToExpr @@ var "op"])),+ H._DeclarationHead_simple>>: lambda "name" $ nameToExpr @@ var "name"] -declarationToExprDef :: TBinding (H.Declaration -> Expr)-declarationToExprDef = haskellSerdeDefinition "declarationToExpr" $+declarationToExpr :: TBinding (H.Declaration -> Expr)+declarationToExpr = haskellSerdeDefinition "declarationToExpr" $+ doc "Convert a declaration to an AST expression" $ lambda "decl" $ cases H._Declaration (var "decl") Nothing [ H._Declaration_data>>: lambda "dataDecl" $ lets [@@ -248,109 +270,106 @@ "cons">: project H._DataDeclaration H._DataDeclaration_constructors @@ var "dataDecl", "deriv">: project H._DataDeclaration H._DataDeclaration_deriving @@ var "dataDecl", "derivCat">: Lists.concat $ Lists.map (unwrap H._Deriving) (var "deriv"),- "constructors">: ref Serialization.orSepDef @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (ref constructorWithCommentsToExprDef) (var "cons")),+ "constructors">: Serialization.orSep @@ Serialization.halfBlockStyle @@ (Lists.map (constructorWithCommentsToExpr) (var "cons")), "derivingClause">: Logic.ifElse (Lists.null $ var "derivCat")- (list [])- (list [ref Serialization.spaceSepDef @@ list [- ref Serialization.cstDef @@ string "deriving",- ref Serialization.parenListDef @@ false @@ (Lists.map (ref nameToExprDef) (var "derivCat"))]]),+ (list ([] :: [TTerm Expr]))+ (list [Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "deriving")) (list [+ Serialization.parenList @@ false @@ (Lists.map (nameToExpr) (var "derivCat"))]))]), "mainParts">: list [- ref Serialization.spaceSepDef @@ list [ref dataOrNewtypeToExprDef @@ var "kw", ref declarationHeadToExprDef @@ var "hd", ref Serialization.cstDef @@ string "="],+ Serialization.spaceSep @@ (Lists.cons (dataOrNewtypeToExpr @@ var "kw") (Lists.cons (declarationHeadToExpr @@ var "hd") (list [Serialization.cst @@ (string "=")]))), var "constructors"]] $- ref Serialization.indentBlockDef @@ Lists.concat2 (var "mainParts") (var "derivingClause"),+ Serialization.indentBlock @@ Lists.concat2 (var "mainParts") (var "derivingClause"), H._Declaration_type>>: lambda "typeDecl" $ lets [ "hd">: project H._TypeDeclaration H._TypeDeclaration_name @@ var "typeDecl", "typ">: project H._TypeDeclaration H._TypeDeclaration_type @@ var "typeDecl"] $- ref Serialization.spaceSepDef @@ list [- ref Serialization.cstDef @@ string "type",- ref declarationHeadToExprDef @@ var "hd",- ref Serialization.cstDef @@ string "=",- ref typeToExprDef @@ var "typ"],- H._Declaration_valueBinding>>: lambda "vb" $ ref valueBindingToExprDef @@ var "vb",+ Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "type")) (Lists.cons (declarationHeadToExpr @@ var "hd") (Lists.cons (Serialization.cst @@ (string "=")) (list [+ typeToExpr @@ var "typ"])))),+ H._Declaration_valueBinding>>: lambda "vb" $ valueBindingToExpr @@ var "vb", H._Declaration_typedBinding>>: lambda "typedBinding" $ lets [ "typeSig">: project H._TypedBinding H._TypedBinding_typeSignature @@ var "typedBinding", "vb">: project H._TypedBinding H._TypedBinding_valueBinding @@ var "typedBinding", "name">: project H._TypeSignature H._TypeSignature_name @@ var "typeSig", "htype">: project H._TypeSignature H._TypeSignature_type @@ var "typeSig"] $- ref Serialization.newlineSepDef @@ list [- ref Serialization.ifxDef @@ ref Operators.typeOpDef @@ (ref nameToExprDef @@ var "name") @@ (ref typeToExprDef @@ var "htype"),- ref valueBindingToExprDef @@ var "vb"]]+ Serialization.newlineSep @@ (Lists.cons (Serialization.ifx @@ HaskellOperators.typeOp @@ (nameToExpr @@ var "name") @@ (typeToExpr @@ var "htype")) (list [+ valueBindingToExpr @@ var "vb"]))] -declarationWithCommentsToExprDef :: TBinding (H.DeclarationWithComments -> Expr)-declarationWithCommentsToExprDef = haskellSerdeDefinition "declarationWithCommentsToExpr" $+declarationWithCommentsToExpr :: TBinding (H.DeclarationWithComments -> Expr)+declarationWithCommentsToExpr = haskellSerdeDefinition "declarationWithCommentsToExpr" $+ doc "Convert a declaration with comments to an AST expression" $ lambda "declWithComments" $ lets [ "body">: project H._DeclarationWithComments H._DeclarationWithComments_body @@ var "declWithComments", "mc">: project H._DeclarationWithComments H._DeclarationWithComments_comments @@ var "declWithComments"] $- Optionals.maybe- (ref declarationToExprDef @@ var "body")- (lambda "c" $ ref Serialization.newlineSepDef @@ list [- ref Serialization.cstDef @@ (ref toHaskellCommentsDef @@ var "c"),- ref declarationToExprDef @@ var "body"])+ Maybes.maybe+ (declarationToExpr @@ var "body")+ (lambda "c" $ Serialization.newlineSep @@ (Lists.cons (Serialization.cst @@ (toHaskellComments @@ var "c")) (list [+ declarationToExpr @@ var "body"]))) (var "mc") -expressionToExprDef :: TBinding (H.Expression -> Expr)-expressionToExprDef = haskellSerdeDefinition "expressionToExpr" $+expressionToExpr :: TBinding (H.Expression -> Expr)+expressionToExpr = haskellSerdeDefinition "expressionToExpr" $+ doc "Convert a Haskell expression to an AST expression" $ lambda "expr" $ cases H._Expression (var "expr") Nothing [- H._Expression_application>>: lambda "app" $ ref applicationExpressionToExprDef @@ var "app",- H._Expression_case>>: lambda "cases" $ ref caseExpressionToExprDef @@ var "cases",- H._Expression_constructRecord>>: lambda "r" $ ref constructRecordExpressionToExprDef @@ var "r",+ H._Expression_application>>: lambda "app" $ applicationExpressionToExpr @@ var "app",+ H._Expression_case>>: lambda "cases" $ caseExpressionToExpr @@ var "cases",+ H._Expression_constructRecord>>: lambda "r" $ constructRecordExpressionToExpr @@ var "r", H._Expression_do>>: lambda "statements" $- ref Serialization.indentBlockDef @@ Lists.cons (ref Serialization.cstDef @@ string "do") (Lists.map (ref statementToExprDef) (var "statements")),- H._Expression_if>>: lambda "ifte" $ ref ifExpressionToExprDef @@ var "ifte",- H._Expression_literal>>: lambda "lit" $ ref literalToExprDef @@ var "lit",- H._Expression_lambda>>: lambda "lam" $ ref Serialization.parenthesizeDef @@ (ref lambdaExpressionToExprDef @@ var "lam"),+ Serialization.indentBlock @@ Lists.cons (Serialization.cst @@ (string "do")) (Lists.map (statementToExpr) (var "statements")),+ H._Expression_if>>: lambda "ifte" $ ifExpressionToExpr @@ var "ifte",+ H._Expression_literal>>: lambda "lit" $ literalToExpr @@ var "lit",+ H._Expression_lambda>>: lambda "lam" $ Serialization.parenthesize @@ (lambdaExpressionToExpr @@ var "lam"), H._Expression_let>>: lambda "letExpr" $ lets [ "bindings">: project H._LetExpression H._LetExpression_bindings @@ var "letExpr", "inner">: project H._LetExpression H._LetExpression_inner @@ var "letExpr", "encodeBinding">: lambda "binding" $- ref Serialization.indentSubsequentLinesDef @@ string " " @@ (ref localBindingToExprDef @@ var "binding")] $- ref Serialization.indentBlockDef @@ list [- ref Serialization.cstDef @@ string "",- ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "let", ref Serialization.customIndentBlockDef @@ string " " @@ (Lists.map (var "encodeBinding") (var "bindings"))],- ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "in", ref expressionToExprDef @@ var "inner"]],+ Serialization.indentSubsequentLines @@ (string " ") @@ (localBindingToExpr @@ var "binding")] $+ Serialization.indentBlock @@ (Lists.cons (Serialization.cst @@ (string "")) (Lists.cons+ (Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "let")) (list [Serialization.customIndentBlock @@ (string " ") @@ (Lists.map (var "encodeBinding") (var "bindings"))])))+ (list [Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "in")) (list [expressionToExpr @@ var "inner"]))]))), H._Expression_list>>: lambda "exprs" $- ref Serialization.bracketListDef @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (ref expressionToExprDef) (var "exprs")),- H._Expression_parens>>: lambda "expr'" $ ref Serialization.parenthesizeDef @@ (ref expressionToExprDef @@ var "expr'"),+ Serialization.bracketList @@ Serialization.halfBlockStyle @@ (Lists.map (expressionToExpr) (var "exprs")),+ H._Expression_parens>>: lambda "expr'" $ Serialization.parenthesize @@ (expressionToExpr @@ var "expr'"), H._Expression_tuple>>: lambda "exprs" $- ref Serialization.parenListDef @@ false @@ (Lists.map (ref expressionToExprDef) (var "exprs")),- H._Expression_variable>>: lambda "name" $ ref nameToExprDef @@ var "name"]+ Serialization.parenList @@ false @@ (Lists.map (expressionToExpr) (var "exprs")),+ H._Expression_variable>>: lambda "name" $ nameToExpr @@ var "name"] -constructRecordExpressionToExprDef :: TBinding (H.ConstructRecordExpression -> Expr)-constructRecordExpressionToExprDef = haskellSerdeDefinition "constructRecordExpressionToExpr" $+constructRecordExpressionToExpr :: TBinding (H.ConstructRecordExpression -> Expr)+constructRecordExpressionToExpr = haskellSerdeDefinition "constructRecordExpressionToExpr" $+ doc "Convert a record construction expression to an AST expression" $ lambda "constructRecord" $ lets [ "name">: project H._ConstructRecordExpression H._ConstructRecordExpression_name @@ var "constructRecord", "updates">: project H._ConstructRecordExpression H._ConstructRecordExpression_fields @@ var "constructRecord", "fromUpdate">: lambda "update" $ lets [ "fn">: project H._FieldUpdate H._FieldUpdate_name @@ var "update", "val">: project H._FieldUpdate H._FieldUpdate_value @@ var "update"] $- ref Serialization.ifxDef @@ ref Operators.defineOpDef @@ (ref nameToExprDef @@ var "fn") @@ (ref expressionToExprDef @@ var "val"),- "body">: ref Serialization.commaSepDef @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (var "fromUpdate") (var "updates"))] $- ref Serialization.spaceSepDef @@ list [- ref nameToExprDef @@ var "name",- ref Serialization.bracketsDef @@ ref Serialization.curlyBracesDef @@ ref Serialization.halfBlockStyleDef @@ var "body"]+ Serialization.ifx @@ HaskellOperators.defineOp @@ (nameToExpr @@ var "fn") @@ (expressionToExpr @@ var "val"),+ "body">: Serialization.commaSep @@ Serialization.halfBlockStyle @@ (Lists.map (var "fromUpdate") (var "updates"))] $+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (list [+ Serialization.brackets @@ Serialization.curlyBraces @@ Serialization.halfBlockStyle @@ var "body"])) -fieldToExprDef :: TBinding (H.Field -> Expr)-fieldToExprDef = haskellSerdeDefinition "fieldToExpr" $+fieldToExpr :: TBinding (H.Field -> Expr)+fieldToExpr = haskellSerdeDefinition "fieldToExpr" $+ doc "Convert a field declaration to an AST expression" $ lambda "field" $ lets [ "name">: project H._Field H._Field_name @@ var "field", "typ">: project H._Field H._Field_type @@ var "field"] $- ref Serialization.spaceSepDef @@ list [ref nameToExprDef @@ var "name", ref Serialization.cstDef @@ string "::", ref typeToExprDef @@ var "typ"]+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (Lists.cons (Serialization.cst @@ (string "::")) (list [typeToExpr @@ var "typ"]))) -fieldWithCommentsToExprDef :: TBinding (H.FieldWithComments -> Expr)-fieldWithCommentsToExprDef = haskellSerdeDefinition "fieldWithCommentsToExpr" $+fieldWithCommentsToExpr :: TBinding (H.FieldWithComments -> Expr)+fieldWithCommentsToExpr = haskellSerdeDefinition "fieldWithCommentsToExpr" $+ doc "Convert a field with comments to an AST expression" $ lambda "fieldWithComments" $ lets [ "field">: project H._FieldWithComments H._FieldWithComments_field @@ var "fieldWithComments", "mc">: project H._FieldWithComments H._FieldWithComments_comments @@ var "fieldWithComments"] $- Optionals.maybe- (ref fieldToExprDef @@ var "field")- (lambda "c" $ ref Serialization.newlineSepDef @@ list [- ref Serialization.cstDef @@ (ref toHaskellCommentsDef @@ var "c"),- ref fieldToExprDef @@ var "field"])+ Maybes.maybe+ (fieldToExpr @@ var "field")+ (lambda "c" $ Serialization.newlineSep @@ (Lists.cons (Serialization.cst @@ (toHaskellComments @@ var "c")) (list [+ fieldToExpr @@ var "field"]))) (var "mc") -ifExpressionToExprDef :: TBinding (H.IfExpression -> Expr)-ifExpressionToExprDef = haskellSerdeDefinition "ifExpressionToExpr" $+ifExpressionToExpr :: TBinding (H.IfExpression -> Expr)+ifExpressionToExpr = haskellSerdeDefinition "ifExpressionToExpr" $+ doc "Convert an if-then-else expression to an AST expression" $ lambda "ifExpr" $ lets [ "eif">: project H._IfExpression H._IfExpression_condition @@ var "ifExpr", "ethen">: project H._IfExpression H._IfExpression_then @@ var "ifExpr",@@ -360,19 +379,21 @@ (Ast.padding Ast.wsNone (Ast.wsBreakAndIndent $ string " ")) (Ast.precedence $ int32 0) Ast.associativityNone,- "body">: ref Serialization.newlineSepDef @@ list [- ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "then", ref expressionToExprDef @@ var "ethen"],- ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "else", ref expressionToExprDef @@ var "eelse"]]] $- ref Serialization.ifxDef @@ var "ifOp" @@- (ref Serialization.spaceSepDef @@ list [ref Serialization.cstDef @@ string "if", ref expressionToExprDef @@ var "eif"]) @@+ "body">: Serialization.newlineSep @@ (Lists.cons+ (Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "then")) (list [expressionToExpr @@ var "ethen"])))+ (list [Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "else")) (list [expressionToExpr @@ var "eelse"]))]))] $+ Serialization.ifx @@ var "ifOp" @@+ (Serialization.spaceSep @@ (Lists.cons (Serialization.cst @@ (string "if")) (list [expressionToExpr @@ var "eif"]))) @@ var "body" -importExportSpecToExprDef :: TBinding (H.ImportExportSpec -> Expr)-importExportSpecToExprDef = haskellSerdeDefinition "importExportSpecToExpr" $- lambda "spec" $ ref nameToExprDef @@ (project H._ImportExportSpec H._ImportExportSpec_name @@ var "spec")+importExportSpecToExpr :: TBinding (H.ImportExportSpec -> Expr)+importExportSpecToExpr = haskellSerdeDefinition "importExportSpecToExpr" $+ doc "Convert an import/export specification to an AST expression" $+ lambda "spec" $ nameToExpr @@ (project H._ImportExportSpec H._ImportExportSpec_name @@ var "spec") -importToExprDef :: TBinding (H.Import -> Expr)-importToExprDef = haskellSerdeDefinition "importToExpr" $+importToExpr :: TBinding (H.Import -> Expr)+importToExpr = haskellSerdeDefinition "importToExpr" $+ doc "Convert an import statement to an AST expression" $ lambda "import" $ lets [ "qual">: project H._Import H._Import_qualified @@ var "import", "modName">: project H._Import H._Import_module @@ var "import",@@ -382,179 +403,225 @@ "hidingSec">: lambda "spec" $ cases H._SpecImport (var "spec") Nothing [ H._SpecImport_hiding>>: lambda "names" $- ref Serialization.spaceSepDef @@ list [- ref Serialization.cstDef @@ string "hiding ",- ref Serialization.parensDef @@- (ref Serialization.commaSepDef @@ ref Serialization.inlineStyleDef @@ (Lists.map (ref importExportSpecToExprDef) (var "names")))]],- "parts">: Optionals.cat $ list [- just $ ref Serialization.cstDef @@ string "import",- Logic.ifElse (var "qual") (just $ ref Serialization.cstDef @@ string "qualified") nothing,- just $ ref Serialization.cstDef @@ var "name",- Optionals.map (lambda "m" $ ref Serialization.cstDef @@ Strings.cat2 (string "as ") (unwrap H._ModuleName @@ var "m")) (var "mod"),- Optionals.map (var "hidingSec") (var "mspec")]] $- ref Serialization.spaceSepDef @@ var "parts"+ Serialization.spaceSep @@ (Lists.cons+ (Serialization.cst @@ (string "hiding "))+ (list [Serialization.parens @@+ (Serialization.commaSep @@ Serialization.inlineStyle @@ (Lists.map (importExportSpecToExpr) (var "names")))]))],+ "parts">: Maybes.cat $ list [+ just $ Serialization.cst @@ (string "import"),+ Logic.ifElse (var "qual") (just $ Serialization.cst @@ (string "qualified")) nothing,+ just $ Serialization.cst @@ var "name",+ Maybes.map (lambda "m" $ Serialization.cst @@ (Strings.cat2 (string "as ") (unwrap H._ModuleName @@ var "m"))) (var "mod"),+ Maybes.map (var "hidingSec") (var "mspec")]] $+ Serialization.spaceSep @@ var "parts" -lambdaExpressionToExprDef :: TBinding (H.LambdaExpression -> Expr)-lambdaExpressionToExprDef = haskellSerdeDefinition "lambdaExpressionToExpr" $+lambdaExpressionToExpr :: TBinding (H.LambdaExpression -> Expr)+lambdaExpressionToExpr = haskellSerdeDefinition "lambdaExpressionToExpr" $+ doc "Convert a lambda expression to an AST expression" $ lambda "lambdaExpr" $ lets [ "bindings">: project H._LambdaExpression H._LambdaExpression_bindings @@ var "lambdaExpr", "inner">: project H._LambdaExpression H._LambdaExpression_inner @@ var "lambdaExpr",- "head">: ref Serialization.spaceSepDef @@ (Lists.map (ref patternToExprDef) (var "bindings")),- "body">: ref expressionToExprDef @@ var "inner"] $- ref Serialization.ifxDef @@ ref Operators.lambdaOpDef @@- (ref Serialization.prefixDef @@ string "\\" @@ var "head") @@+ "head">: Serialization.spaceSep @@ (Lists.map (patternToExpr) (var "bindings")),+ "body">: expressionToExpr @@ var "inner"] $+ Serialization.ifx @@ HaskellOperators.lambdaOp @@+ (Serialization.prefix @@ (string "\\") @@ var "head") @@ var "body" -literalToExprDef :: TBinding (H.Literal -> Expr)-literalToExprDef = haskellSerdeDefinition "literalToExpr" $- lambda "lit" $- ref Serialization.cstDef @@- cases H._Literal (var "lit") Nothing [- H._Literal_char>>: lambda "c" $ Literals.showString $ Literals.showUint16 $ var "c", -- Simplified char handling- H._Literal_double>>: lambda "d" $- Logic.ifElse (Equality.lt (var "d") (float64 0.0))- (Strings.cat2 (string "(0") (Strings.cat2 (Literals.showFloat64 $ var "d") (string ")")))- (Literals.showFloat64 $ var "d"),- H._Literal_float>>: lambda "f" $- Logic.ifElse (Equality.lt (var "f") (float32 0.0))- (Strings.cat2 (string "(0") (Strings.cat2 (Literals.showFloat32 $ var "f") (string ")")))- (Literals.showFloat32 $ var "f"),- H._Literal_int>>: lambda "i" $- Logic.ifElse (Equality.lt (var "i") (int32 0))- (Strings.cat2 (string "(0") (Strings.cat2 (Literals.showInt32 $ var "i") (string ")")))- (Literals.showInt32 $ var "i"),- H._Literal_integer>>: lambda "i" $ Literals.showBigint $ var "i",- H._Literal_string>>: lambda "s" $ Literals.showString $ var "s"]+--literalToExpr :: TBinding (H.Literal -> Expr)+--literalToExpr = haskellSerdeDefinition "literalToExpr" $+-- "lit" ~>+-- "parensIfNeg" <~ ("b" ~> "e" ~> Logic.ifElse (var "b")+-- (Strings.cat $ list ["(", var "e", ")"])+-- (var "e")) $+-- Serialization.cst @@+-- cases H._Literal (var "lit") Nothing [+-- H._Literal_char>>: lambda "c" $ Literals.showString $ Literals.showUint16 $ var "c", -- Simplified char handling+-- H._Literal_double>>: "d" ~> var "parensIfNeg"+-- @@ (Equality.lt (var "d") (float64 0.0))+-- @@ (Literals.showFloat64 $ var "d"),+-- H._Literal_float>>: "f" ~> var "parensIfNeg"+-- @@ (Equality.lt (var "f") (float32 0.0))+-- @@ (Literals.showFloat32 $ var "f"),+-- H._Literal_int>>: "i" ~> var "parensIfNeg"+-- @@ (Equality.lt (var "i") (int32 0))+-- @@ (Literals.showInt32 $ var "i"),+--+-- H._Literal_integer>>: lambda "i" $ Literals.showBigint $ var "i",+-- H._Literal_string>>: lambda "s" $ Literals.showString $ var "s"] -localBindingToExprDef :: TBinding (H.LocalBinding -> Expr)-localBindingToExprDef = haskellSerdeDefinition "localBindingToExpr" $++literalToExpr :: TBinding (H.Literal -> Expr)+literalToExpr = haskellSerdeDefinition "literalToExpr" $+ doc "Convert a literal value to an AST expression" $+ "lit" ~>+ "parensIfNeg" <~ ("b" ~> "e" ~> Logic.ifElse (var "b")+ (Strings.cat $ list [string "(", var "e", string ")"])+ (var "e")) $+ Serialization.cst @@+ cases H._Literal (var "lit") Nothing [+ H._Literal_char>>: "c" ~> Literals.showString $ Literals.showUint16 $ var "c", -- Simplified char handling+ H._Literal_double>>: "d" ~> var "parensIfNeg"+ @@ (Equality.lt (var "d") (float64 0.0))+ @@ (Literals.showFloat64 $ var "d"),+ H._Literal_float>>: "f" ~> var "parensIfNeg"+ @@ (Equality.lt (var "f") (float32 0.0))+ @@ (Literals.showFloat32 $ var "f"),+ H._Literal_int>>: "i" ~> var "parensIfNeg"+ @@ (Equality.lt (var "i") (int32 0))+ @@ (Literals.showInt32 $ var "i"),+ H._Literal_integer>>: "i" ~> var "parensIfNeg"+ @@ (Equality.lt (var "i") (bigint 0))+ @@ (Literals.showBigint $ var "i"),+ H._Literal_string>>: lambda "s" $ Literals.showString $ var "s"]++localBindingToExpr :: TBinding (H.LocalBinding -> Expr)+localBindingToExpr = haskellSerdeDefinition "localBindingToExpr" $+ doc "Convert a local binding to an AST expression" $ lambda "binding" $ cases H._LocalBinding (var "binding") Nothing [- H._LocalBinding_signature>>: lambda "ts" $ ref typeSignatureToExprDef @@ var "ts",- H._LocalBinding_value>>: lambda "vb" $ ref valueBindingToExprDef @@ var "vb"]+ H._LocalBinding_signature>>: lambda "ts" $ typeSignatureToExpr @@ var "ts",+ H._LocalBinding_value>>: lambda "vb" $ valueBindingToExpr @@ var "vb"] -moduleHeadToExprDef :: TBinding (H.ModuleHead -> Expr)-moduleHeadToExprDef = haskellSerdeDefinition "moduleHeadToExpr" $+moduleHeadToExpr :: TBinding (H.ModuleHead -> Expr)+moduleHeadToExpr = haskellSerdeDefinition "moduleHeadToExpr" $+ doc "Convert a module head to an AST expression" $ lambda "moduleHead" $ lets [ "mc">: project H._ModuleHead H._ModuleHead_comments @@ var "moduleHead", "modName">: project H._ModuleHead H._ModuleHead_name @@ var "moduleHead", "mname">: unwrap H._ModuleName @@ var "modName",- "head">: ref Serialization.spaceSepDef @@ list [- ref Serialization.cstDef @@ string "module",- ref Serialization.cstDef @@ var "mname",- ref Serialization.cstDef @@ string "where"]] $- Optionals.maybe+ "head">: Serialization.spaceSep @@ (Lists.cons+ (Serialization.cst @@ (string "module")) (Lists.cons+ (Serialization.cst @@ var "mname")+ (list [Serialization.cst @@ (string "where")])))] $+ Maybes.maybe (var "head")- (lambda "c" $ ref Serialization.newlineSepDef @@ list [- ref Serialization.cstDef @@ (ref toHaskellCommentsDef @@ var "c"),- ref Serialization.cstDef @@ string "",- var "head"])+ (lambda "c" $ Serialization.newlineSep @@ (Lists.cons+ (Serialization.cst @@ (toHaskellComments @@ var "c")) (Lists.cons+ (Serialization.cst @@ (string ""))+ (list [var "head"])))) (var "mc") -moduleToExprDef :: TBinding (H.Module -> Expr)-moduleToExprDef = haskellSerdeDefinition "moduleToExpr" $+moduleToExpr :: TBinding (H.Module -> Expr)+moduleToExpr = haskellSerdeDefinition "moduleToExpr" $+ doc "Convert a Haskell module to an AST expression" $ lambda "module" $ lets [ "mh">: project H._Module H._Module_head @@ var "module", "imports">: project H._Module H._Module_imports @@ var "module", "decls">: project H._Module H._Module_declarations @@ var "module",- "headerLine">: Optionals.maybe (list []) (lambda "h" $ list [ref moduleHeadToExprDef @@ var "h"]) (var "mh"),- "declLines">: Lists.map (ref declarationWithCommentsToExprDef) (var "decls"),+ "warning">: list [Serialization.cst @@ (toSimpleComments @@ Constants.warningAutoGeneratedFile)],+ "headerLine">: Maybes.maybe (list ([] :: [TTerm Expr])) (lambda "h" $ list [moduleHeadToExpr @@ var "h"]) (var "mh"),+ "declLines">: Lists.map (declarationWithCommentsToExpr) (var "decls"), "importLines">: Logic.ifElse (Lists.null $ var "imports")- (list [])- (list [ref Serialization.newlineSepDef @@ (Lists.map (ref importToExprDef) (var "imports"))])] $- ref Serialization.doubleNewlineSepDef @@ (Lists.concat $ list [var "headerLine", var "importLines", var "declLines"])+ (list ([] :: [TTerm Expr]))+ (list [Serialization.newlineSep @@ (Lists.map (importToExpr) (var "imports"))])] $+ Serialization.doubleNewlineSep @@ (Lists.concat $ list [var "warning", var "headerLine", var "importLines", var "declLines"]) -nameToExprDef :: TBinding (H.Name -> Expr)-nameToExprDef = haskellSerdeDefinition "nameToExpr" $+nameToExpr :: TBinding (H.Name -> Expr)+nameToExpr = haskellSerdeDefinition "nameToExpr" $+ doc "Convert a Haskell name to an AST expression" $ lambda "name" $- ref Serialization.cstDef @@+ Serialization.cst @@ cases H._Name (var "name") Nothing [- H._Name_implicit>>: lambda "qn" $ Strings.cat2 (string "?") (ref writeQualifiedNameDef @@ var "qn"),- H._Name_normal>>: lambda "qn" $ ref writeQualifiedNameDef @@ var "qn",- H._Name_parens>>: lambda "qn" $ Strings.cat $ list [string "(", ref writeQualifiedNameDef @@ var "qn", string ")"]]+ H._Name_implicit>>: lambda "qn" $ Strings.cat2 (string "?") (writeQualifiedName @@ var "qn"),+ H._Name_normal>>: lambda "qn" $ writeQualifiedName @@ var "qn",+ H._Name_parens>>: lambda "qn" $ Strings.cat $ list [string "(", writeQualifiedName @@ var "qn", string ")"]] -patternToExprDef :: TBinding (H.Pattern -> Expr)-patternToExprDef = haskellSerdeDefinition "patternToExpr" $+patternToExpr :: TBinding (H.Pattern -> Expr)+patternToExpr = haskellSerdeDefinition "patternToExpr" $+ doc "Convert a pattern to an AST expression" $ lambda "pat" $ cases H._Pattern (var "pat") Nothing [- H._Pattern_application>>: lambda "app" $ ref applicationPatternToExprDef @@ var "app",+ H._Pattern_application>>: lambda "app" $ applicationPatternToExpr @@ var "app", H._Pattern_list>>: lambda "pats" $- ref Serialization.bracketListDef @@ ref Serialization.halfBlockStyleDef @@ (Lists.map (ref patternToExprDef) (var "pats")),- H._Pattern_literal>>: lambda "lit" $ ref literalToExprDef @@ var "lit",- H._Pattern_name>>: lambda "name" $ ref nameToExprDef @@ var "name",- H._Pattern_parens>>: lambda "pat'" $ ref Serialization.parenthesizeDef @@ (ref patternToExprDef @@ var "pat'"),+ Serialization.bracketList @@ Serialization.halfBlockStyle @@ (Lists.map (patternToExpr) (var "pats")),+ H._Pattern_literal>>: lambda "lit" $ literalToExpr @@ var "lit",+ H._Pattern_name>>: lambda "name" $ nameToExpr @@ var "name",+ H._Pattern_parens>>: lambda "pat'" $ Serialization.parenthesize @@ (patternToExpr @@ var "pat'"), H._Pattern_tuple>>: lambda "pats" $- ref Serialization.parenListDef @@ false @@ (Lists.map (ref patternToExprDef) (var "pats")),- H._Pattern_wildcard>>: constant $ ref Serialization.cstDef @@ string "_"]+ Serialization.parenList @@ false @@ (Lists.map (patternToExpr) (var "pats")),+ H._Pattern_wildcard>>: constant $ Serialization.cst @@ (string "_")] -rightHandSideToExprDef :: TBinding (H.RightHandSide -> Expr)-rightHandSideToExprDef = haskellSerdeDefinition "rightHandSideToExpr" $- lambda "rhs" $ ref expressionToExprDef @@ (unwrap H._RightHandSide @@ var "rhs")+rightHandSideToExpr :: TBinding (H.RightHandSide -> Expr)+rightHandSideToExpr = haskellSerdeDefinition "rightHandSideToExpr" $+ doc "Convert a right-hand side to an AST expression" $+ lambda "rhs" $ expressionToExpr @@ (unwrap H._RightHandSide @@ var "rhs") -statementToExprDef :: TBinding (H.Statement -> Expr)-statementToExprDef = haskellSerdeDefinition "statementToExpr" $- lambda "stmt" $ ref expressionToExprDef @@ (unwrap H._Statement @@ var "stmt")+statementToExpr :: TBinding (H.Statement -> Expr)+statementToExpr = haskellSerdeDefinition "statementToExpr" $+ doc "Convert a statement to an AST expression" $+ lambda "stmt" $ expressionToExpr @@ (unwrap H._Statement @@ var "stmt") -typeSignatureToExprDef :: TBinding (H.TypeSignature -> Expr)-typeSignatureToExprDef = haskellSerdeDefinition "typeSignatureToExpr" $+typeSignatureToExpr :: TBinding (H.TypeSignature -> Expr)+typeSignatureToExpr = haskellSerdeDefinition "typeSignatureToExpr" $+ doc "Convert a type signature to an AST expression" $ lambda "typeSig" $ lets [ "name">: project H._TypeSignature H._TypeSignature_name @@ var "typeSig", "typ">: project H._TypeSignature H._TypeSignature_type @@ var "typeSig"] $- ref Serialization.spaceSepDef @@ list [ref nameToExprDef @@ var "name", ref Serialization.cstDef @@ string "::", ref typeToExprDef @@ var "typ"]+ Serialization.spaceSep @@ (Lists.cons (nameToExpr @@ var "name") (Lists.cons (Serialization.cst @@ (string "::")) (list [typeToExpr @@ var "typ"]))) -typeToExprDef :: TBinding (H.Type -> Expr)-typeToExprDef = haskellSerdeDefinition "typeToExpr" $+typeToExpr :: TBinding (H.Type -> Expr)+typeToExpr = haskellSerdeDefinition "typeToExpr" $+ doc "Convert a Haskell type to an AST expression" $ lambda "htype" $ cases H._Type (var "htype") Nothing [ H._Type_application>>: lambda "appType" $ lets [ "lhs">: project H._ApplicationType H._ApplicationType_context @@ var "appType", "rhs">: project H._ApplicationType H._ApplicationType_argument @@ var "appType"] $- ref Serialization.ifxDef @@ ref Operators.appOpDef @@ (ref typeToExprDef @@ var "lhs") @@ (ref typeToExprDef @@ var "rhs"),+ Serialization.ifx @@ HaskellOperators.appOp @@ (typeToExpr @@ var "lhs") @@ (typeToExpr @@ var "rhs"), H._Type_ctx>>: lambda "ctxType" $ lets [ "ctx">: project H._ContextType H._ContextType_ctx @@ var "ctxType", "typ">: project H._ContextType H._ContextType_type @@ var "ctxType"] $- ref Serialization.ifxDef @@ ref Operators.assertOpDef @@ (ref assertionToExprDef @@ var "ctx") @@ (ref typeToExprDef @@ var "typ"),+ Serialization.ifx @@ HaskellOperators.assertOp @@ (assertionToExpr @@ var "ctx") @@ (typeToExpr @@ var "typ"), H._Type_function>>: lambda "funType" $ lets [ "dom">: project H._FunctionType H._FunctionType_domain @@ var "funType", "cod">: project H._FunctionType H._FunctionType_codomain @@ var "funType"] $- ref Serialization.ifxDef @@ ref Operators.arrowOpDef @@ (ref typeToExprDef @@ var "dom") @@ (ref typeToExprDef @@ var "cod"),+ Serialization.ifx @@ HaskellOperators.arrowOp @@ (typeToExpr @@ var "dom") @@ (typeToExpr @@ var "cod"), H._Type_list>>: lambda "htype'" $- ref Serialization.bracketListDef @@ ref Serialization.inlineStyleDef @@ list [ref typeToExprDef @@ var "htype'"],+ Serialization.bracketList @@ Serialization.inlineStyle @@ list [typeToExpr @@ var "htype'"], H._Type_tuple>>: lambda "types" $- ref Serialization.parenListDef @@ false @@ (Lists.map (ref typeToExprDef) (var "types")),- H._Type_variable>>: lambda "name" $ ref nameToExprDef @@ var "name"]+ Serialization.parenList @@ false @@ (Lists.map (typeToExpr) (var "types")),+ H._Type_variable>>: lambda "name" $ nameToExpr @@ var "name"] -valueBindingToExprDef :: TBinding (H.ValueBinding -> Expr)-valueBindingToExprDef = haskellSerdeDefinition "valueBindingToExpr" $+valueBindingToExpr :: TBinding (H.ValueBinding -> Expr)+valueBindingToExpr = haskellSerdeDefinition "valueBindingToExpr" $+ doc "Convert a value binding to an AST expression" $ lambda "vb" $ cases H._ValueBinding (var "vb") Nothing [ H._ValueBinding_simple>>: lambda "simpleVB" $ lets [ "pat">: project H._SimpleValueBinding H._SimpleValueBinding_pattern @@ var "simpleVB", "rhs">: project H._SimpleValueBinding H._SimpleValueBinding_rhs @@ var "simpleVB", "local">: project H._SimpleValueBinding H._SimpleValueBinding_localBindings @@ var "simpleVB",- "body">: ref Serialization.ifxDef @@ ref Operators.defineOpDef @@ (ref patternToExprDef @@ var "pat") @@ (ref rightHandSideToExprDef @@ var "rhs")] $- Optionals.maybe+ "body">: Serialization.ifx @@ HaskellOperators.defineOp @@ (patternToExpr @@ var "pat") @@ (rightHandSideToExpr @@ var "rhs")] $+ Maybes.maybe (var "body") (lambda "localBindings" $ lets [ "bindings">: unwrap H._LocalBindings @@ var "localBindings"] $- ref Serialization.indentBlockDef @@ list [- var "body",- ref Serialization.indentBlockDef @@ Lists.cons (ref Serialization.cstDef @@ string "where") (Lists.map (ref localBindingToExprDef) (var "bindings"))])+ Serialization.indentBlock @@ (Lists.cons+ (var "body")+ (list [Serialization.indentBlock @@ Lists.cons (Serialization.cst @@ (string "where")) (Lists.map (localBindingToExpr) (var "bindings"))]))) (var "local")] -variableToExprDef :: TBinding (H.Variable -> Expr)-variableToExprDef = haskellSerdeDefinition "variableToExpr" $- lambda "variable" $ ref nameToExprDef @@ (unwrap H._Variable @@ var "variable")+variableToExpr :: TBinding (H.Variable -> Expr)+variableToExpr = haskellSerdeDefinition "variableToExpr" $+ doc "Convert a type variable to an AST expression" $+ lambda "variable" $ nameToExpr @@ (unwrap H._Variable @@ var "variable") -toHaskellCommentsDef :: TBinding (String -> String)-toHaskellCommentsDef = haskellSerdeDefinition "toHaskellComments" $+toHaskellComments :: TBinding (String -> String)+toHaskellComments = haskellSerdeDefinition "toHaskellComments" $+ doc "Convert a string to Haddock documentation comments" $ lambda "c" $ Strings.intercalate (string "\n") $ Lists.map (lambda "s" $ Strings.cat2 (string "-- | ") (var "s")) (Strings.lines $ var "c") -writeQualifiedNameDef :: TBinding (H.QualifiedName -> String)-writeQualifiedNameDef = haskellSerdeDefinition "writeQualifiedName" $+toSimpleComments :: TBinding (String -> String)+toSimpleComments = haskellSerdeDefinition "toSimpleComments" $+ doc "Convert a string to simple line comments" $+ lambda "c" $ Strings.intercalate (string "\n") $ Lists.map (lambda "s" $ Strings.cat2 (string "-- ") (var "s")) (Strings.lines $ var "c")++writeQualifiedName :: TBinding (H.QualifiedName -> String)+writeQualifiedName = haskellSerdeDefinition "writeQualifiedName" $+ doc "Write a qualified name as a string" $ lambda "qname" $ lets [ "qualifiers">: project H._QualifiedName H._QualifiedName_qualifiers @@ var "qname", "unqual">: project H._QualifiedName H._QualifiedName_unqualified @@ var "qname", "h">: lambda "namePart" $ unwrap H._NamePart @@ var "namePart", "allParts">: Lists.concat2 (Lists.map (var "h") (var "qualifiers")) (list [var "h" @@ var "unqual"])] $- Strings.intercalate (string ".") (var "allParts")+ Strings.intercalate (string ".") $ var "allParts"
src/main/haskell/Hydra/Sources/Haskell/Utils.hs view
@@ -3,251 +3,278 @@ -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +-- Additional imports import qualified Hydra.Ext.Haskell.Ast as H import qualified Hydra.Sources.Haskell.Ast as HaskellAst import qualified Hydra.Sources.Haskell.Language as HaskellLanguage import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting + type HaskellNamespaces = Namespaces H.ModuleName haskellUtilsDefinition :: String -> TTerm a -> TBinding a-haskellUtilsDefinition = definitionInModule haskellUtilsModule+haskellUtilsDefinition = definitionInModule module_ -haskellUtilsModule :: Module-haskellUtilsModule = Module ns elements- [Formatting.module_, HaskellLanguage.haskellLanguageModule, Schemas.module_, Names.module_]- (HaskellAst.haskellAstModule:KernelTypes.kernelTypesModules) $+ns :: Namespace+ns = Namespace "hydra.ext.haskell.utils"++module_ :: Module+module_ = Module ns elements+ [Formatting.ns, HaskellLanguage.ns, Schemas.ns, Names.ns]+ (HaskellAst.ns:KernelTypes.kernelTypesNamespaces) $ Just "Utilities for working with Haskell syntax trees" where- ns = Namespace "hydra.ext.haskell.utils" elements = [- el applicationPatternDef,- el elementReferenceDef,- el hsappDef,- el hslambdaDef,- el hslitDef,- el hsvarDef,- el namespacesForModuleDef,- el newtypeAccessorNameDef,- el rawNameDef,- el recordFieldReferenceDef,- el sanitizeHaskellNameDef,- el simpleNameDef,- el simpleValueBindingDef,- el toTypeApplicationDef,- el typeNameForRecordDef,- el unionFieldReferenceDef,- el unpackForallTypeDef]+ toBinding applicationPattern,+ toBinding elementReference,+ toBinding hsapp,+ toBinding hslambda,+ toBinding hslit,+ toBinding hsvar,+ toBinding namespacesForModule,+ toBinding newtypeAccessorName,+ toBinding rawName,+ toBinding recordFieldReference,+ toBinding sanitizeHaskellName,+ toBinding simpleName,+ toBinding simpleValueBinding,+ toBinding toTypeApplication,+ toBinding typeNameForRecord,+ toBinding unionFieldReference,+ toBinding unpackForallType] -applicationPatternDef :: TBinding (H.Name -> [H.Pattern] -> H.Pattern)-applicationPatternDef = haskellUtilsDefinition "applicationPattern" $- lambda "name" $ lambda "args" $- inject H._Pattern H._Pattern_application $- record H._ApplicationPattern [- H._ApplicationPattern_name>>: var "name",- H._ApplicationPattern_args>>: var "args"]+applicationPattern :: TBinding (H.Name -> [H.Pattern] -> H.Pattern)+applicationPattern = haskellUtilsDefinition "applicationPattern" $+ doc "Create an application pattern from a name and argument patterns" $+ "name" ~> "args" ~>+ inject H._Pattern H._Pattern_application $+ record H._ApplicationPattern [+ H._ApplicationPattern_name>>: var "name",+ H._ApplicationPattern_args>>: var "args"] -elementReferenceDef :: TBinding (HaskellNamespaces -> Name -> H.Name)-elementReferenceDef = haskellUtilsDefinition "elementReference" $- lambda "namespaces" $ lambda "name" $ lets [+elementReference :: TBinding (HaskellNamespaces -> Name -> H.Name)+elementReference = haskellUtilsDefinition "elementReference" $+ doc "Generate a Haskell name reference for a Hydra element" $+ "namespaces" ~> "name" ~> lets [ "namespacePair">: Module.namespacesFocus $ var "namespaces",- "gname">: first $ var "namespacePair",- "gmod">: unwrap H._ModuleName @@ (second $ var "namespacePair"),+ "gname">: Pairs.first $ var "namespacePair",+ "gmod">: unwrap H._ModuleName @@ (Pairs.second $ var "namespacePair"), "namespacesMap">: Module.namespacesMapping $ var "namespaces",- "qname">: ref Names.qualifyNameDef @@ var "name",+ "qname">: Names.qualifyName @@ var "name", "local">: Module.qualifiedNameLocal $ var "qname",- "escLocal">: ref sanitizeHaskellNameDef @@ var "local",+ "escLocal">: sanitizeHaskellName @@ var "local", "mns">: Module.qualifiedNameNamespace $ var "qname"] $- Optionals.cases (Module.qualifiedNameNamespace $ var "qname")- (ref simpleNameDef @@ var "local") $- lambda "ns" $- Optionals.cases (Maps.lookup (var "ns") (var "namespacesMap"))- (ref simpleNameDef @@ var "local") $- lambda "mn" $ lets [+ Maybes.cases (Module.qualifiedNameNamespace $ var "qname")+ (simpleName @@ var "local") $+ "ns" ~>+ Maybes.cases (Maps.lookup (var "ns") (var "namespacesMap"))+ (simpleName @@ var "local") $+ "mn" ~> lets [ "aliasStr">: unwrap H._ModuleName @@ var "mn"] $ Logic.ifElse (Equality.equal (var "ns") (var "gname"))- (ref simpleNameDef @@ var "escLocal")- (ref rawNameDef @@ (Strings.cat $ list [+ (simpleName @@ var "escLocal")+ (rawName @@ (Strings.cat $ list [ var "aliasStr", string ".",- ref sanitizeHaskellNameDef @@ var "local"]))+ sanitizeHaskellName @@ var "local"])) -hsappDef :: TBinding (H.Expression -> H.Expression -> H.Expression)-hsappDef = haskellUtilsDefinition "hsapp" $- lambda "l" $ lambda "r" $+hsapp :: TBinding (H.Expression -> H.Expression -> H.Expression)+hsapp = haskellUtilsDefinition "hsapp" $+ doc "Create a Haskell function application expression" $+ "l" ~> "r" ~> inject H._Expression H._Expression_application $ record H._ApplicationExpression [ H._ApplicationExpression_function>>: var "l", H._ApplicationExpression_argument>>: var "r"] -hslambdaDef :: TBinding (H.Name -> H.Expression -> H.Expression)-hslambdaDef = haskellUtilsDefinition "hslambda" $- lambda "name" $ lambda "rhs" $+hslambda :: TBinding (H.Name -> H.Expression -> H.Expression)+hslambda = haskellUtilsDefinition "hslambda" $+ doc "Create a Haskell lambda expression" $+ "name" ~> "rhs" ~> inject H._Expression H._Expression_lambda $ record H._LambdaExpression [ H._LambdaExpression_bindings>>: list [inject H._Pattern H._Pattern_name $ var "name"], H._LambdaExpression_inner>>: var "rhs"] -hslitDef :: TBinding (H.Literal -> H.Expression)-hslitDef = haskellUtilsDefinition "hslit" $- lambda "lit" $+hslit :: TBinding (H.Literal -> H.Expression)+hslit = haskellUtilsDefinition "hslit" $+ doc "Create a Haskell literal expression" $+ "lit" ~> inject H._Expression H._Expression_literal $ var "lit" -hsvarDef :: TBinding (String -> H.Expression)-hsvarDef = haskellUtilsDefinition "hsvar" $- lambda "s" $- inject H._Expression H._Expression_variable $ (ref rawNameDef @@ var "s")+hsvar :: TBinding (String -> H.Expression)+hsvar = haskellUtilsDefinition "hsvar" $+ doc "Create a Haskell variable expression from a string" $+ "s" ~>+ inject H._Expression H._Expression_variable $ (rawName @@ var "s") -namespacesForModuleDef :: TBinding (Module -> Flow Graph HaskellNamespaces)-namespacesForModuleDef = haskellUtilsDefinition "namespacesForModule" $- lambda "mod" $- bind "nss"- (ref Schemas.moduleDependencyNamespacesDef @@ true @@ true @@ true @@ true @@ var "mod") $ lets [- "ns">: Module.moduleNamespace $ var "mod",- "focusPair">: var "toPair" @@ var "ns",- "nssAsList">: Sets.toList $ var "nss",- "nssPairs">: Lists.map (var "toPair") (var "nssAsList"),- "emptyState">: pair Maps.empty Sets.empty,- "finalState">: Lists.foldl (var "addPair") (var "emptyState") (var "nssPairs"),- "resultMap">: first $ var "finalState",- "toModuleName">: lambda "namespace" $ lets [+namespacesForModule :: TBinding (Module -> Flow Graph HaskellNamespaces)+namespacesForModule = haskellUtilsDefinition "namespacesForModule" $+ doc "Compute the Haskell module namespaces for a Hydra module" $+ "mod" ~>+ "nss" <<~ Schemas.moduleDependencyNamespaces @@ true @@ true @@ true @@ true @@ var "mod" $+ "ns" <~ (Module.moduleNamespace $ var "mod") $+ "toModuleName" <~ ("namespace" ~> lets [ "namespaceStr">: unwrap _Namespace @@ var "namespace", "parts">: Strings.splitOn (string ".") (var "namespaceStr"), "lastPart">: Lists.last $ var "parts",- "capitalized">: ref Formatting.capitalizeDef @@ var "lastPart"] $- wrap H._ModuleName $ var "capitalized",- "toPair">: lambda "name" $- pair (var "name") (var "toModuleName" @@ var "name"),- "addPair">: lambda "state" $ lambda "namePair" $ lets [- "currentMap">: first $ var "state",- "currentSet">: second $ var "state",- "name">: first $ var "namePair",- "alias">: second $ var "namePair",+ "capitalized">: Formatting.capitalize @@ var "lastPart"] $+ wrap H._ModuleName $ var "capitalized") $+ "toPair" <~ ("name" ~>+ pair (var "name") (var "toModuleName" @@ var "name")) $+ "addPair" <~ ("state" ~> "namePair" ~> lets [+ "currentMap">: Pairs.first $ var "state",+ "currentSet">: Pairs.second $ var "state",+ "name">: Pairs.first $ var "namePair",+ "alias">: Pairs.second $ var "namePair", "aliasStr">: unwrap H._ModuleName @@ var "alias"] $ Logic.ifElse (Sets.member (var "alias") (var "currentSet")) (var "addPair" @@ var "state" @@ pair (var "name") (wrap H._ModuleName $ Strings.cat2 (var "aliasStr") (string "_")))- (pair (Maps.insert (var "name") (var "alias") (var "currentMap")) (Sets.insert (var "alias") (var "currentSet")))] $+ (pair (Maps.insert (var "name") (var "alias") (var "currentMap")) (Sets.insert (var "alias") (var "currentSet")))) $+ "focusPair" <~ (var "toPair" @@ var "ns") $+ "nssAsList" <~ (Sets.toList $ var "nss") $+ "nssPairs" <~ (Lists.map (var "toPair") (var "nssAsList")) $+ "emptyState" <~ (pair Maps.empty Sets.empty) $+ "finalState" <~ (Lists.foldl (var "addPair") (var "emptyState") (var "nssPairs")) $+ "resultMap" <~ (Pairs.first $ var "finalState") $ Flows.pure $ Module.namespaces (var "focusPair") (var "resultMap") -newtypeAccessorNameDef :: TBinding (Name -> String)-newtypeAccessorNameDef = haskellUtilsDefinition "newtypeAccessorName" $- lambda "name" $- Strings.cat2 (string "un") (ref Names.localNameOfDef @@ var "name")+newtypeAccessorName :: TBinding (Name -> String)+newtypeAccessorName = haskellUtilsDefinition "newtypeAccessorName" $+ doc "Generate an accessor name for a newtype wrapper (e.g., 'unFoo' for Foo)" $+ "name" ~>+ Strings.cat2 (string "un") (Names.localNameOf @@ var "name") -rawNameDef :: TBinding (String -> H.Name)-rawNameDef = haskellUtilsDefinition "rawName" $- lambda "n" $+rawName :: TBinding (String -> H.Name)+rawName = haskellUtilsDefinition "rawName" $+ doc "Create a raw Haskell name from a string without sanitization" $+ "n" ~> inject H._Name H._Name_normal $ record H._QualifiedName [- H._QualifiedName_qualifiers>>: list [],+ H._QualifiedName_qualifiers>>: list ([] :: [TTerm H.NamePart]), H._QualifiedName_unqualified>>: wrap H._NamePart $ var "n"] -recordFieldReferenceDef :: TBinding (HaskellNamespaces -> Name -> Name -> H.Name)-recordFieldReferenceDef = haskellUtilsDefinition "recordFieldReference" $- lambda "namespaces" $ lambda "sname" $ lambda "fname" $ lets [+recordFieldReference :: TBinding (HaskellNamespaces -> Name -> Name -> H.Name)+recordFieldReference = haskellUtilsDefinition "recordFieldReference" $+ doc "Generate a Haskell name for a record field accessor" $+ "namespaces" ~> "sname" ~> "fname" ~> lets [ "fnameStr">: unwrap _Name @@ var "fname",- "qname">: ref Names.qualifyNameDef @@ var "sname",+ "qname">: Names.qualifyName @@ var "sname", "ns">: Module.qualifiedNameNamespace $ var "qname",- "typeNameStr">: ref typeNameForRecordDef @@ var "sname",- "decapitalized">: ref Formatting.decapitalizeDef @@ var "typeNameStr",- "capitalized">: ref Formatting.capitalizeDef @@ var "fnameStr",+ "typeNameStr">: typeNameForRecord @@ var "sname",+ "decapitalized">: Formatting.decapitalize @@ var "typeNameStr",+ "capitalized">: Formatting.capitalize @@ var "fnameStr", "nm">: Strings.cat2 (var "decapitalized") (var "capitalized"), "qualName">: record _QualifiedName [ _QualifiedName_namespace>>: var "ns", _QualifiedName_local>>: var "nm"],- "unqualName">: ref Names.unqualifyNameDef @@ var "qualName"] $- ref elementReferenceDef @@ var "namespaces" @@ var "unqualName"+ "unqualName">: Names.unqualifyName @@ var "qualName"] $+ elementReference @@ var "namespaces" @@ var "unqualName" -sanitizeHaskellNameDef :: TBinding (String -> String)-sanitizeHaskellNameDef = haskellUtilsDefinition "sanitizeHaskellName" $- ref Formatting.sanitizeWithUnderscoresDef @@ (ref HaskellLanguage.reservedWordsDef)+sanitizeHaskellName :: TBinding (String -> String)+sanitizeHaskellName = haskellUtilsDefinition "sanitizeHaskellName" $+ doc "Sanitize a string to be a valid Haskell identifier, escaping reserved words" $+ Formatting.sanitizeWithUnderscores @@ (HaskellLanguage.reservedWords) -simpleNameDef :: TBinding (String -> H.Name)-simpleNameDef = haskellUtilsDefinition "simpleName" $- compose (ref rawNameDef) (ref sanitizeHaskellNameDef)+simpleName :: TBinding (String -> H.Name)+simpleName = haskellUtilsDefinition "simpleName" $+ doc "Create a sanitized Haskell name from a string" $+ compose (rawName) (sanitizeHaskellName) -simpleValueBindingDef :: TBinding (H.Name -> H.Expression -> Maybe H.LocalBindings -> H.ValueBinding)-simpleValueBindingDef = haskellUtilsDefinition "simpleValueBinding" $- lambda "hname" $ lambda "rhs" $ lambda "bindings" $ lets [+simpleValueBinding :: TBinding (H.Name -> H.Expression -> Maybe H.LocalBindings -> H.ValueBinding)+simpleValueBinding = haskellUtilsDefinition "simpleValueBinding" $+ doc "Create a simple value binding (e.g., 'foo = expr' or 'foo = expr where ...')" $+ "hname" ~> "rhs" ~> "bindings" ~> lets [ "pat">: inject H._Pattern H._Pattern_application $ record H._ApplicationPattern [ H._ApplicationPattern_name>>: var "hname",- H._ApplicationPattern_args>>: list []],+ H._ApplicationPattern_args>>: list ([] :: [TTerm H.Pattern])], "rightHandSide">: wrap H._RightHandSide $ var "rhs"] $ inject H._ValueBinding H._ValueBinding_simple $ record H._SimpleValueBinding [@@ -255,10 +282,11 @@ H._SimpleValueBinding_rhs>>: var "rightHandSide", H._SimpleValueBinding_localBindings>>: var "bindings"] -toTypeApplicationDef :: TBinding ([H.Type] -> H.Type)-toTypeApplicationDef = haskellUtilsDefinition "toTypeApplication" $- lambda "types" $ lets [- "app">: lambda "l" $+toTypeApplication :: TBinding ([H.Type] -> H.Type)+toTypeApplication = haskellUtilsDefinition "toTypeApplication" $+ doc "Convert a list of types into a nested type application" $+ "types" ~> lets [+ "app">: "l" ~> Logic.ifElse (Equality.gt (Lists.length (var "l")) (int32 1)) (inject H._Type H._Type_application $ record H._ApplicationType [ H._ApplicationType_context>>: var "app" @@ (Lists.tail (var "l")),@@ -266,37 +294,47 @@ (Lists.head $ var "l")] $ var "app" @@ (Lists.reverse $ var "types") -typeNameForRecordDef :: TBinding (Name -> String)-typeNameForRecordDef = haskellUtilsDefinition "typeNameForRecord" $- lambda "sname" $ lets [+typeNameForRecord :: TBinding (Name -> String)+typeNameForRecord = haskellUtilsDefinition "typeNameForRecord" $+ doc "Extract the local type name from a fully qualified record type name" $+ "sname" ~> lets [ "snameStr">: Core.unName $ var "sname", "parts">: Strings.splitOn (string ".") (var "snameStr")] $ Lists.last $ var "parts" -unionFieldReferenceDef :: TBinding (HaskellNamespaces -> Name -> Name -> H.Name)-unionFieldReferenceDef = haskellUtilsDefinition "unionFieldReference" $- lambda "namespaces" $ lambda "sname" $ lambda "fname" $ lets [+unionFieldReference :: TBinding (Graph -> HaskellNamespaces -> Name -> Name -> H.Name)+unionFieldReference = haskellUtilsDefinition "unionFieldReference" $+ doc "Generate a Haskell name for a union variant constructor, with disambiguation" $+ "g" ~> "namespaces" ~> "sname" ~> "fname" ~> lets [ "fnameStr">: unwrap _Name @@ var "fname",- "qname">: ref Names.qualifyNameDef @@ var "sname",+ "qname">: Names.qualifyName @@ var "sname", "ns">: Module.qualifiedNameNamespace $ var "qname",- "typeNameStr">: ref typeNameForRecordDef @@ var "sname",- "capitalizedTypeName">: ref Formatting.capitalizeDef @@ var "typeNameStr",- "capitalizedFieldName">: ref Formatting.capitalizeDef @@ var "fnameStr",- "nm">: Strings.cat2 (var "capitalizedTypeName") (var "capitalizedFieldName"),+ "typeNameStr">: typeNameForRecord @@ var "sname",+ "capitalizedTypeName">: Formatting.capitalize @@ var "typeNameStr",+ "capitalizedFieldName">: Formatting.capitalize @@ var "fnameStr",+ "deconflict">: "name" ~> lets [+ "tname">: Names.unqualifyName @@ record _QualifiedName [+ _QualifiedName_namespace>>: var "ns",+ _QualifiedName_local>>: var "name"]] $+ Logic.ifElse (Maybes.isJust $ Lists.find ("b" ~> Equality.equal (Core.bindingName (var "b")) (var "tname")) (Graph.graphElements $ var "g"))+ (var "deconflict" @@ Strings.cat2 (var "name") (string "_"))+ (var "name"),+ "nm">: var "deconflict" @@ Strings.cat2 (var "capitalizedTypeName") (var "capitalizedFieldName"), "qualName">: record _QualifiedName [ _QualifiedName_namespace>>: var "ns", _QualifiedName_local>>: var "nm"],- "unqualName">: ref Names.unqualifyNameDef @@ var "qualName"] $- ref elementReferenceDef @@ var "namespaces" @@ var "unqualName"+ "unqualName">: Names.unqualifyName @@ var "qualName"] $+ elementReference @@ var "namespaces" @@ var "unqualName" -unpackForallTypeDef :: TBinding (Graph -> Type -> ([Name], Type))-unpackForallTypeDef = haskellUtilsDefinition "unpackForallType" $- lambdas ["cx", "t"] $ cases _Type (ref Rewriting.deannotateTypeDef @@ var "t")- (Just $ pair (list []) (var "t")) [- _Type_forall>>: lambda "fat" $ lets [+unpackForallType :: TBinding (Graph -> Type -> ([Name], Type))+unpackForallType = haskellUtilsDefinition "unpackForallType" $+ doc "Unpack nested forall types into a list of type variables and the inner type" $+ "cx" ~> "t" ~> cases _Type (Rewriting.deannotateType @@ var "t")+ (Just $ pair (list ([] :: [TTerm Name])) (var "t")) [+ _Type_forall>>: "fat" ~> lets [ "v">: Core.forallTypeParameter $ var "fat", "tbody">: Core.forallTypeBody $ var "fat",- "recursiveResult">: ref unpackForallTypeDef @@ var "cx" @@ var "tbody",- "vars">: first $ var "recursiveResult",- "finalType">: second $ var "recursiveResult"] $+ "recursiveResult">: unpackForallType @@ var "cx" @@ var "tbody",+ "vars">: Pairs.first $ var "recursiveResult",+ "finalType">: Pairs.second $ var "recursiveResult"] $ pair (Lists.cons (var "v") (var "vars")) (var "finalType")]
+ src/main/haskell/Hydra/Sources/Json/Bootstrap.hs view
@@ -0,0 +1,55 @@+-- | A module which provides a minimal typing environment for decoding other Modules from JSON.+--+-- This module contains a single binding, typesByName, which maps type Names to Types+-- for all types defined in the four kernel modules needed to decode the Module type:+-- hydra.core, hydra.compute, hydra.graph, and hydra.module.+--+-- By consolidating these types into a single map, we avoid the need to generate+-- individual Source modules for each kernel type module (which can exceed the JVM's+-- 64KB method size limit for large modules like hydra.core).++module Hydra.Sources.Json.Bootstrap where++-- Note: non-standard imports; this module is constructed dynamically from other modules.+import Hydra.Kernel+import qualified Hydra.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Types.Core as Core+import qualified Hydra.Sources.Kernel.Types.Compute as Compute+import qualified Hydra.Sources.Kernel.Types.Graph as Graph+import qualified Hydra.Sources.Kernel.Types.Module as Module++import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.json.bootstrap"++-- | The four kernel type modules whose types are needed to decode Module from JSON.+bootstrapTypeModules :: [Module]+bootstrapTypeModules = [+ Core.module_,+ Compute.module_,+ Graph.module_,+ Module.module_]++module_ :: Module+module_ = Module ns [typesByNameBinding] [] [Namespace "hydra.core"] $+ Just ("A module which provides a minimal typing environment for decoding other modules from JSON."+ ++ " This avoids certain problems with generating entire source modules into target languages like Java,"+ ++ " which is subject to method size limits for large modules like hydra.core.")++typesByNameBinding :: Binding+typesByNameBinding = Binding {+ bindingName = Name "hydra.json.bootstrap.typesByName",+ bindingTerm = typesByNameTerm,+ bindingType = Nothing}++-- | Build a Term-level map from Name to Type, by extracting all bindings+-- from the bootstrap type modules. Each binding in a kernel type module+-- is a type definition whose bindingTerm is the type encoded as a Term.+typesByNameTerm :: Term+typesByNameTerm = TermMap $ M.fromList entries+ where+ entries = concatMap moduleEntries bootstrapTypeModules+ moduleEntries mod = fmap bindingEntry (moduleElements mod)+ bindingEntry b = (EncodeCore.name (bindingName b), bindingTerm b)
src/main/haskell/Hydra/Sources/Json/Coder.hs view
@@ -1,443 +1,508 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Json.Coder where -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import Hydra.Json+-- Additional imports+import Hydra.Json.Model import qualified Hydra.Sources.Json.Language as JsonLanguage import qualified Hydra.Sources.Kernel.Terms.Literals as HydraLiterals +ns :: Namespace+ns = Namespace "hydra.ext.org.json.coder"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns+ module_ :: Module-module_ = Module (Namespace "hydra.ext.org.json.coder") elements- [AdaptModules.module_, AdaptTerms.module_, AdaptUtils.module_, EncodeCore.module_,- ExtractCore.module_, HydraLiterals.module_, Monads.module_, Rewriting.module_, JsonLanguage.module_,- Variants.module_]- KernelTypes.kernelTypesModules $+module_ = Module ns elements+ [AdaptModules.ns, AdaptTerms.ns, AdaptUtils.ns, moduleNamespace EncodeCore.module_,+ ExtractCore.ns, HydraLiterals.ns, JsonLanguage.ns, Monads.ns, Rewriting.ns]+ KernelTypes.kernelTypesNamespaces $ Just "JSON encoding and decoding for Hydra terms" where elements = [- el jsonCoderDef,- el literalJsonCoderDef,- el recordCoderDef,- el encodeRecordDef,- el decodeRecordDef,- el termCoderDef,- el unitCoderDef,- el untypedTermToJsonDef,- el readStringStubDef,- el showValueDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_+ toBinding jsonCoder,+ toBinding literalJsonCoder,+ toBinding recordCoder,+ toBinding encodeRecord,+ toBinding decodeRecord,+ toBinding termCoder,+ toBinding unitCoder,+ toBinding untypedTermToJson,+ toBinding readStringStub,+ toBinding showValue] -jsonCoderDef :: TBinding (Type -> Flow Graph (Coder Graph Graph Term Value))-jsonCoderDef = define "jsonCoder" $+jsonCoder :: TBinding (Type -> Flow Graph (Coder Graph Graph Term Value))+jsonCoder = define "jsonCoder" $ doc "Create a JSON coder for a given type" $- lambda "typ" $ binds [- "adapter">: ref AdaptModules.languageAdapterDef @@ ref JsonLanguage.jsonLanguageDef @@ var "typ",- "coder">: ref termCoderDef @@ (Compute.adapterTarget $ var "adapter")] $- produce $ ref AdaptUtils.composeCodersDef @@ (Compute.adapterCoder $ var "adapter") @@ var "coder"+ "typ" ~>+ "adapter" <<~ AdaptModules.languageAdapter @@ JsonLanguage.jsonLanguage @@ var "typ" $+ "coder" <<~ termCoder @@ (Compute.adapterTarget $ var "adapter") $+ produce $ AdaptUtils.composeCoders @@ (Compute.adapterCoder $ var "adapter") @@ var "coder" -literalJsonCoderDef :: TBinding (LiteralType -> Flow Graph (Coder Graph Graph Literal Value))-literalJsonCoderDef = define "literalJsonCoder" $+literalJsonCoder :: TBinding (LiteralType -> Flow Graph (Coder Graph Graph Literal Value))+literalJsonCoder = define "literalJsonCoder" $ doc "Create a JSON coder for literal types" $- lambda "lt" $ produce $ cases _LiteralType (var "lt") Nothing [+ "lt" ~>+ -- Define decoder functions that contain match expressions+ "decodeBool" <~ ("s" ~>+ cases _Value (var "s")+ (Just $ Monads.unexpected @@ string "boolean" @@ (showValue @@ var "s")) [+ _Value_boolean>>: "b" ~> produce $ Core.literalBoolean $ var "b"]) $+ "decodeFloat" <~ ("s" ~>+ cases _Value (var "s")+ (Just $ Monads.unexpected @@ string "number" @@ (showValue @@ var "s")) [+ _Value_number>>: "f" ~> produce $ Core.literalFloat $ Core.floatValueBigfloat $ var "f"]) $+ "decodeInteger" <~ ("s" ~>+ cases _Value (var "s")+ (Just $ Monads.unexpected @@ string "number" @@ (showValue @@ var "s")) [+ _Value_number>>: "f" ~>+ "bi" <~ (Literals.bigfloatToBigint $ var "f") $+ produce $ Core.literalInteger $ Core.integerValueBigint $ var "bi"]) $+ "decodeString" <~ ("s" ~>+ cases _Value (var "s")+ (Just $ Monads.unexpected @@ string "string" @@ (showValue @@ var "s")) [+ _Value_string>>: "s'" ~> produce $ Core.literalString $ var "s'"]) $+ "encoded" <~ (cases _LiteralType (var "lt") Nothing [ _LiteralType_boolean>>: constant $ Compute.coder- (lambda "lit" $ binds [- "b">: ref ExtractCore.booleanLiteralDef @@ var "lit"] $+ ("lit" ~>+ "b" <<~ ExtractCore.booleanLiteral @@ var "lit" $ produce $ Json.valueBoolean $ var "b")- (lambda "s" $ cases _Value (var "s")- (Just $ ref Monads.unexpectedDef @@ string "boolean" @@ (ref showValueDef @@ var "s")) [- _Value_boolean>>: lambda "b" $ produce $ Core.literalBoolean $ var "b"]),+ (var "decodeBool"), _LiteralType_float>>: constant $ Compute.coder- (lambda "lit" $ binds [- "f">: ref ExtractCore.floatLiteralDef @@ var "lit",- "bf">: ref ExtractCore.bigfloatValueDef @@ var "f"] $+ ("lit" ~>+ "f" <<~ ExtractCore.floatLiteral @@ var "lit" $+ "bf" <<~ ExtractCore.bigfloatValue @@ var "f" $ produce $ Json.valueNumber $ var "bf")- (lambda "s" $ cases _Value (var "s")- (Just $ ref Monads.unexpectedDef @@ string "number" @@ (ref showValueDef @@ var "s")) [- _Value_number>>: lambda "f" $ produce $ Core.literalFloat $ Core.floatValueBigfloat $ var "f"]),+ (var "decodeFloat"), _LiteralType_integer>>: constant $ Compute.coder- (lambda "lit" $ binds [- "i">: ref ExtractCore.integerLiteralDef @@ var "lit",- "bi">: ref ExtractCore.bigintValueDef @@ var "i"] $+ ("lit" ~>+ "i" <<~ ExtractCore.integerLiteral @@ var "lit" $+ "bi" <<~ ExtractCore.bigintValue @@ var "i" $ produce $ Json.valueNumber $ Literals.bigintToBigfloat $ var "bi")- (lambda "s" $ cases _Value (var "s")- (Just $ ref Monads.unexpectedDef @@ string "number" @@ (ref showValueDef @@ var "s")) [- _Value_number>>: lambda "f" $ lets [- "bi">: Literals.bigfloatToBigint $ var "f"] $- produce $ Core.literalInteger $ Core.integerValueBigint $ var "bi"]),+ (var "decodeInteger"), _LiteralType_string>>: constant $ Compute.coder- (lambda "lit" $ binds [- "s">: ref ExtractCore.stringLiteralDef @@ var "lit"] $+ ("lit" ~>+ "s" <<~ ExtractCore.stringLiteral @@ var "lit" $ produce $ Json.valueString $ var "s")- (lambda "s" $ cases _Value (var "s")- (Just $ ref Monads.unexpectedDef @@ string "string" @@ (ref showValueDef @@ var "s")) [- _Value_string>>: lambda "s'" $ produce $ Core.literalString $ var "s'"])]+ (var "decodeString")]) $+ produce $ var "encoded" -recordCoderDef :: TBinding (RowType -> Flow Graph (Coder Graph Graph Term Value))-recordCoderDef = define "recordCoder" $+recordCoder :: TBinding (RowType -> Flow Graph (Coder Graph Graph Term Value))+recordCoder = define "recordCoder" $ doc "Create a JSON coder for record types" $- lambda "rt" $ lets [- "fields">: Core.rowTypeFields $ var "rt",- "getCoder">: lambda "f" $ binds [- "coder">: ref termCoderDef @@ (Core.fieldTypeType $ var "f")] $- produce $ pair (var "f") (var "coder")] $ binds [- "coders">: Flows.mapList (var "getCoder") (var "fields")] $- produce $ Compute.coder (ref encodeRecordDef @@ var "coders") (ref decodeRecordDef @@ var "rt" @@ var "coders")+ "rt" ~>+ "fields" <~ (Core.rowTypeFields $ var "rt") $+ "getCoder" <~ ("f" ~>+ "coder" <<~ termCoder @@ (Core.fieldTypeType $ var "f") $+ produce $ pair (var "f") (var "coder")) $+ "coders" <<~ Flows.mapList (var "getCoder") (var "fields") $+ produce $ Compute.coder (encodeRecord @@ var "coders") (decodeRecord @@ var "rt" @@ var "coders") -encodeRecordDef :: TBinding ([(FieldType, Coder Graph Graph Term Value)] -> Term -> Flow Graph Value)-encodeRecordDef = define "encodeRecord" $+encodeRecord :: TBinding ([(FieldType, Coder Graph Graph Term Value)] -> Term -> Flow Graph Value)+encodeRecord = define "encodeRecord" $ doc "Encode a record term to JSON" $- lambdas ["coders", "term"] $ lets [- "stripped">: ref Rewriting.deannotateTermDef @@ var "term"] $ binds [- "record">: ref ExtractCore.termRecordDef @@ var "stripped"] $ lets [- "fields">: Core.recordFields $ var "record",- "encodeField">: lambda "coderAndField" $ lets [- "coder">: first $ var "coderAndField",- "field">: second $ var "coderAndField",- "ft">: first $ var "coder",- "coder'">: second $ var "coder",- "fname">: Core.fieldName $ var "field",- "fvalue">: Core.fieldTerm $ var "field"] $- cases _Type (Core.fieldTypeType $ var "ft")- (Just $ binds [- "encoded">: Compute.coderEncode (var "coder'") @@ var "fvalue"] $- produce $ just $ pair (Core.unName $ var "fname") (var "encoded")) [- _Type_optional>>: lambda "ot" $ cases _Term (var "fvalue")- (Just $ binds [- "encoded">: Compute.coderEncode (var "coder'") @@ var "fvalue"] $- produce $ just $ pair (Core.unName $ var "fname") (var "encoded")) [- _Term_optional>>: lambda "opt" $ Optionals.maybe- (produce nothing)- (lambda "v" $ binds [- "encoded">: Compute.coderEncode (var "coder'") @@ var "v"] $- produce $ just $ pair (Core.unName $ var "fname") (var "encoded"))- (var "opt")]]] $ binds [- "maybeFields">: Flows.mapList (var "encodeField") (Lists.zip (var "coders") (var "fields"))] $- produce $ Json.valueObject $ Maps.fromList $ Optionals.cat $ var "maybeFields"+ "coders" ~> "term" ~>+ "stripped" <~ (Rewriting.deannotateTerm @@ var "term") $+ -- Lift case expressions out of the encodeField lambda+ "matchMaybeTerm" <~ ("fvalue" ~> "coder'" ~> "fname" ~> "dflt" ~>+ cases _Term (var "fvalue")+ (Just $ var "dflt") [+ _Term_maybe>>: "opt" ~> optCases (var "opt")+ (produce nothing)+ ("v" ~>+ "encoded" <<~ Compute.coderEncode (var "coder'") @@ var "v" $+ produce $ just $ pair (Core.unName $ var "fname") (var "encoded"))]) $+ "matchTypeForMaybe" <~ ("ft" ~> "forMaybe" ~> "dflt" ~>+ cases _Type (Core.fieldTypeType $ var "ft")+ (Just $ var "dflt") [+ _Type_maybe>>: "ot" ~> var "forMaybe" @@ var "ot"]) $+ "encodeField" <~ ("coderAndField" ~>+ "coder" <~ (Pairs.first $ var "coderAndField") $+ "field" <~ (Pairs.second $ var "coderAndField") $+ "ft" <~ (Pairs.first $ var "coder") $+ "coder'" <~ (Pairs.second $ var "coder") $+ "fname" <~ (Core.fieldName $ var "field") $+ "fvalue" <~ (Core.fieldTerm $ var "field") $+ "forMaybe" <~ ("ot" ~>+ "dflt" <~ (+ "encoded" <<~ Compute.coderEncode (var "coder'") @@ var "fvalue" $+ produce $ just $ pair (Core.unName $ var "fname") (var "encoded")) $+ var "matchMaybeTerm" @@ var "fvalue" @@ var "coder'" @@ var "fname" @@ var "dflt") $+ "dflt" <~ (+ "encoded" <<~ Compute.coderEncode (var "coder'") @@ var "fvalue" $+ produce $ just $ pair (Core.unName $ var "fname") (var "encoded")) $+ var "matchTypeForMaybe" @@ var "ft" @@ var "forMaybe" @@ var "dflt") $+ "record" <<~ ExtractCore.termRecord @@ var "stripped" $+ "fields" <~ (Core.recordFields $ var "record") $+ "maybeFields" <<~ Flows.mapList (var "encodeField") (Lists.zip (var "coders") (var "fields")) $+ produce $ Json.valueObject $ Maps.fromList $ Maybes.cat $ var "maybeFields" -decodeRecordDef :: TBinding (RowType -> [(FieldType, Coder Graph Graph Term Value)] -> Value -> Flow Graph Term)-decodeRecordDef = define "decodeRecord" $+decodeRecord :: TBinding (RowType -> [(FieldType, Coder Graph Graph Term Value)] -> Value -> Flow Graph Term)+decodeRecord = define "decodeRecord" $ doc "Decode a JSON value to a record term" $- lambdas ["rt", "coders", "n"] $ cases _Value (var "n")- (Just $ ref Monads.unexpectedDef @@ string "object" @@ (ref showValueDef @@ var "n")) [- _Value_object>>: lambda "m" $ lets [- "decodeField">: lambda "coder" $ lets [- "ft">: first $ var "coder",- "coder'">: second $ var "coder",- "fname">: Core.fieldTypeName $ var "ft",- "defaultValue">: Json.valueNull,- "jsonValue">: Optionals.fromMaybe (var "defaultValue") $ Maps.lookup (Core.unName $ var "fname") (var "m")] $ binds [- "v">: Compute.coderDecode (var "coder'") @@ var "jsonValue"] $- produce $ Core.field (var "fname") (var "v")] $ binds [- "fields">: Flows.mapList (var "decodeField") (var "coders")] $- produce $ Core.termRecord $ Core.record (Core.rowTypeTypeName $ var "rt") (var "fields")]+ "rt" ~> "coders" ~> "n" ~>+ -- Lift the object decoder body into a separate function to avoid lambdas with let-bindings inside cases+ "decodeObjectBody" <~ ("m" ~>+ "decodeField" <~ ("coder" ~>+ "ft" <~ (Pairs.first $ var "coder") $+ "coder'" <~ (Pairs.second $ var "coder") $+ "fname" <~ (Core.fieldTypeName $ var "ft") $+ "defaultValue" <~ Json.valueNull $+ "jsonValue" <~ (Maybes.fromMaybe (var "defaultValue") $ Maps.lookup (Core.unName $ var "fname") (var "m")) $+ "v" <<~ Compute.coderDecode (var "coder'") @@ var "jsonValue" $+ produce $ Core.field (var "fname") (var "v")) $+ "fields" <<~ Flows.mapList (var "decodeField") (var "coders") $+ produce $ Core.termRecord $ Core.record (Core.rowTypeTypeName $ var "rt") (var "fields")) $+ "result" <~ (cases _Value (var "n")+ (Just $ Monads.unexpected @@ string "object" @@ (showValue @@ var "n")) [+ _Value_object>>: var "decodeObjectBody"]) $+ var "result" -termCoderDef :: TBinding (Type -> Flow Graph (Coder Graph Graph Term Value))-termCoderDef = define "termCoder" $+termCoder :: TBinding (Type -> Flow Graph (Coder Graph Graph Term Value))+termCoder = define "termCoder" $ doc "Create a JSON coder for term types" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"] $- cases _Type (var "stripped")- (Just $ Flows.fail $ Strings.cat $ list [- string "unsupported type in JSON: ",- ref ShowCore.typeDef @@ var "typ"]) [- _Type_literal>>: lambda "at" $ binds [- "ac">: ref literalJsonCoderDef @@ var "at"] $- produce $ Compute.coder- (lambda "term" $ cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "literal term" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_literal>>: lambda "av" $ Compute.coderEncode (var "ac") @@ var "av"])- (lambda "n" $ binds [- "lit">: Compute.coderDecode (var "ac") @@ var "n"] $- produce $ Core.termLiteral $ var "lit"),- _Type_list>>: lambda "lt" $ binds [- "lc">: ref termCoderDef @@ var "lt"] $- produce $ Compute.coder- (lambda "term" $ cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "list term" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_list>>: lambda "els" $ binds [- "encodedEls">: Flows.mapList (Compute.coderEncode $ var "lc") (var "els")] $- produce $ Json.valueArray $ var "encodedEls"])- (lambda "n" $ cases _Value (var "n")- (Just $ ref Monads.unexpectedDef @@ string "sequence" @@ (ref showValueDef @@ var "n")) [- _Value_array>>: lambda "nodes" $ binds [- "decodedNodes">: Flows.mapList (Compute.coderDecode $ var "lc") (var "nodes")] $- produce $ Core.termList $ var "decodedNodes"]),- _Type_map>>: lambda "mt" $ lets [- "kt">: Core.mapTypeKeys $ var "mt",- "vt">: Core.mapTypeValues $ var "mt"] $ binds [- "kc">: ref termCoderDef @@ var "kt",- "vc">: ref termCoderDef @@ var "vt",- "cx">: ref Monads.getStateDef] $ lets [- "isStringKey">: Equality.equal (ref Rewriting.deannotateTypeDef @@ var "kt") TTypes.string,- "toString">: lambda "v" $ Logic.ifElse (var "isStringKey")- (cases _Term (ref Rewriting.deannotateTermDef @@ var "v")- (Just $ ref ShowCore.termDef @@ var "v") [- _Term_literal>>: lambda "lit" $ cases _Literal (var "lit")- (Just $ ref ShowCore.termDef @@ var "v") [- _Literal_string>>: lambda "s" $ var "s"]])- (ref ShowCore.termDef @@ var "v"),- "fromString">: lambda "s" $ Logic.ifElse (var "isStringKey")- (Core.termLiteral $ Core.literalString $ var "s")- (ref readStringStubDef @@ var "s"),- "encodeEntry">: lambda "kv" $ lets [- "k">: first $ var "kv",- "v">: second $ var "kv"] $ binds [- "encodedV">: Compute.coderEncode (var "vc") @@ var "v"] $- produce $ pair (var "toString" @@ var "k") (var "encodedV"),- "decodeEntry">: lambda "kv" $ lets [- "k">: first $ var "kv",- "v">: second $ var "kv"] $ binds [- "decodedV">: Compute.coderDecode (var "vc") @@ var "v"] $- produce $ pair (var "fromString" @@ var "k") (var "decodedV")] $- produce $ Compute.coder- (lambda "term" $ cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "map term" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_map>>: lambda "m" $ binds [- "entries">: Flows.mapList (var "encodeEntry") $ Maps.toList $ var "m"] $- produce $ Json.valueObject $ Maps.fromList $ var "entries"])- (lambda "n" $ cases _Value (var "n")- (Just $ ref Monads.unexpectedDef @@ string "mapping" @@ (ref showValueDef @@ var "n")) [- _Value_object>>: lambda "m" $ binds [- "entries">: Flows.mapList (var "decodeEntry") $ Maps.toList $ var "m"] $- produce $ Core.termMap $ Maps.fromList $ var "entries"]),- _Type_optional>>: lambda "ot" $ binds [- "oc">: ref termCoderDef @@ var "ot"] $- produce $ Compute.coder- (lambda "t" $ lets [- "stripped">: ref Rewriting.deannotateTermDef @@ var "t"] $- cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@ string "optional term" @@ (ref ShowCore.termDef @@ var "t")) [- _Term_optional>>: lambda "el" $ Optionals.maybe- (produce Json.valueNull)- (Compute.coderEncode $ var "oc")- (var "el")])- (lambda "n" $ cases _Value (var "n")- (Just $ binds [- "decoded">: Compute.coderDecode (var "oc") @@ var "n"] $- produce $ Core.termOptional $ just $ var "decoded") [- _Value_null>>: constant $ produce $ Core.termOptional nothing]),- _Type_record>>: lambda "rt" $ ref recordCoderDef @@ var "rt",- _Type_unit>>: constant $ produce $ ref unitCoderDef,- _Type_variable>>: lambda "name" $ produce $ Compute.coder- (lambda "term" $ produce $ Json.valueString $ Strings.cat $ list [- string "variable '",- Core.unName $ var "name",- string "' for: ",- ref ShowCore.termDef @@ var "term"])- (lambda "term" $ Flows.fail $ Strings.cat $ list [- string "type variable ",- Core.unName $ var "name",- string " does not support decoding"])]+ "typ" ~>+ "stripped" <~ (Rewriting.deannotateType @@ var "typ") $+ -- Lift encoder/decoder functions that contain match expressions+ "encodeLiteral" <~ ("ac" ~> "term" ~>+ cases _Term (var "term")+ (Just $ Monads.unexpected @@ string "literal term" @@ (ShowCore.term @@ var "term")) [+ _Term_literal>>: "av" ~> Compute.coderEncode (var "ac") @@ var "av"]) $+ "encodeList" <~ ("lc" ~> "term" ~>+ cases _Term (var "term")+ (Just $ Monads.unexpected @@ string "list term" @@ (ShowCore.term @@ var "term")) [+ _Term_list>>: "els" ~>+ "encodedEls" <<~ Flows.mapList (Compute.coderEncode $ var "lc") (var "els") $+ produce $ Json.valueArray $ var "encodedEls"]) $+ "decodeList" <~ ("lc" ~> "n" ~>+ cases _Value (var "n")+ (Just $ Monads.unexpected @@ string "sequence" @@ (showValue @@ var "n")) [+ _Value_array>>: "nodes" ~>+ "decodedNodes" <<~ Flows.mapList (Compute.coderDecode $ var "lc") (var "nodes") $+ produce $ Core.termList $ var "decodedNodes"]) $+ "matchLiteralString" <~ ("v" ~> "lit" ~>+ cases _Literal (var "lit")+ (Just $ ShowCore.term @@ var "v") [+ _Literal_string>>: "s" ~> var "s"]) $+ "matchTermLiteral" <~ ("v" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "v")+ (Just $ ShowCore.term @@ var "v") [+ _Term_literal>>: "lit" ~> var "matchLiteralString" @@ var "v" @@ var "lit"]) $+ "encodeMap" <~ ("encodeEntry" ~> "term" ~>+ cases _Term (var "term")+ (Just $ Monads.unexpected @@ string "map term" @@ (ShowCore.term @@ var "term")) [+ _Term_map>>: "m" ~>+ "entries" <<~ Flows.mapList (var "encodeEntry") (Maps.toList $ var "m") $+ produce $ Json.valueObject $ Maps.fromList $ var "entries"]) $+ "decodeMap" <~ ("decodeEntry" ~> "n" ~>+ cases _Value (var "n")+ (Just $ Monads.unexpected @@ string "mapping" @@ (showValue @@ var "n")) [+ _Value_object>>: "m" ~>+ "entries" <<~ Flows.mapList (var "decodeEntry") (Maps.toList $ var "m") $+ produce $ Core.termMap $ Maps.fromList $ var "entries"]) $+ "encodeMaybe" <~ ("maybeElementCoder" ~> "maybeTerm" ~>+ "strippedMaybeTerm" <~ (Rewriting.deannotateTerm @@ var "maybeTerm") $+ cases _Term (var "strippedMaybeTerm")+ (Just $ Monads.unexpected @@ string "optional term" @@ (ShowCore.term @@ var "maybeTerm")) [+ _Term_maybe>>: "maybeContents" ~>+ Logic.ifElse (Maybes.isNothing $ var "maybeContents")+ (produce Json.valueNull)+ ("encodedInner" <<~ Compute.coderEncode (var "maybeElementCoder") @@ (Maybes.fromJust $ var "maybeContents") $+ produce $ var "encodedInner")]) $+ "decodeMaybe" <~ ("maybeElementCoder" ~> "jsonVal" ~>+ cases _Value (var "jsonVal")+ (Just $+ "decodedInner" <<~ Compute.coderDecode (var "maybeElementCoder") @@ var "jsonVal" $+ produce $ Core.termMaybe $ just $ var "decodedInner") [+ _Value_null>>: constant $ produce $ Core.termMaybe nothing]) $+ "result" <~ (cases _Type (var "stripped")+ (Just $ Flows.fail $ Strings.cat $ list [+ string "unsupported type in JSON: ",+ ShowCore.type_ @@ var "typ"]) [+ _Type_literal>>: "at" ~>+ "ac" <<~ literalJsonCoder @@ var "at" $+ produce $ Compute.coder+ (var "encodeLiteral" @@ var "ac")+ ("n" ~>+ "lit" <<~ Compute.coderDecode (var "ac") @@ var "n" $+ produce $ Core.termLiteral $ var "lit"),+ _Type_list>>: "lt" ~>+ "lc" <<~ termCoder @@ var "lt" $+ produce $ Compute.coder+ (var "encodeList" @@ var "lc")+ (var "decodeList" @@ var "lc"),+ _Type_map>>: "mt" ~>+ "kt" <~ (Core.mapTypeKeys $ var "mt") $+ "vt" <~ (Core.mapTypeValues $ var "mt") $+ "kc" <<~ termCoder @@ var "kt" $+ "vc" <<~ termCoder @@ var "vt" $+ "cx" <<~ Monads.getState $+ "isStringKey" <~ Equality.equal (Rewriting.deannotateType @@ var "kt") (Core.typeLiteral Core.literalTypeString) $+ "toString" <~ ("v" ~>+ Logic.ifElse (var "isStringKey")+ (var "matchTermLiteral" @@ var "v")+ (ShowCore.term @@ var "v")) $+ "fromString" <~ ("s" ~> Logic.ifElse (var "isStringKey")+ (Core.termLiteral $ Core.literalString $ var "s")+ (readStringStub @@ var "s")) $+ "encodeEntry" <~ ("kv" ~>+ "k" <~ (Pairs.first $ var "kv") $+ "v" <~ (Pairs.second $ var "kv") $+ "encodedV" <<~ Compute.coderEncode (var "vc") @@ var "v" $+ produce $ pair (var "toString" @@ var "k") (var "encodedV")) $+ "decodeEntry" <~ ("kv" ~>+ "k" <~ (Pairs.first $ var "kv") $+ "v" <~ (Pairs.second $ var "kv") $+ "decodedV" <<~ Compute.coderDecode (var "vc") @@ var "v" $+ produce $ pair (var "fromString" @@ var "k") (var "decodedV")) $+ produce $ Compute.coder+ (var "encodeMap" @@ var "encodeEntry")+ (var "decodeMap" @@ var "decodeEntry"),+ _Type_maybe>>: "maybeElementType" ~>+ "maybeElementCoder" <<~ termCoder @@ var "maybeElementType" $+ produce $ Compute.coder+ (var "encodeMaybe" @@ var "maybeElementCoder")+ (var "decodeMaybe" @@ var "maybeElementCoder"),+ _Type_record>>: "rt" ~> recordCoder @@ var "rt",+ _Type_unit>>: constant $ produce $ unitCoder,+ _Type_variable>>: "name" ~> produce $ Compute.coder+ ("term" ~> produce $ Json.valueString $ Strings.cat $ list [+ string "variable '",+ Core.unName $ var "name",+ string "' for: ",+ ShowCore.term @@ var "term"])+ ("term" ~> Flows.fail $ Strings.cat $ list [+ string "type variable ",+ Core.unName $ var "name",+ string " does not support decoding"])]) $+ var "result" -unitCoderDef :: TBinding (Coder Graph Graph Term Value)-unitCoderDef = define "unitCoder" $+unitCoder :: TBinding (Coder Graph Graph Term Value)+unitCoder = define "unitCoder" $ doc "JSON coder for unit values" $- Compute.coder- (lambda "term" $ cases _Term (ref Rewriting.deannotateTermDef @@ var "term")- (Just $ ref Monads.unexpectedDef @@ string "unit" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_unit>>: constant $ produce Json.valueNull])- (lambda "n" $ cases _Value (var "n")- (Just $ ref Monads.unexpectedDef @@ string "null" @@ (ref showValueDef @@ var "n")) [- _Value_null>>: constant $ produce Core.termUnit])+ -- Lift encoder/decoder functions that contain match expressions+ "encodeUnit" <~ ("term" ~>+ cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just $ Monads.unexpected @@ string "unit" @@ (ShowCore.term @@ var "term")) [+ _Term_unit>>: constant $ produce Json.valueNull]) $+ "decodeUnit" <~ ("n" ~>+ cases _Value (var "n")+ (Just $ Monads.unexpected @@ string "null" @@ (showValue @@ var "n")) [+ _Value_null>>: constant $ produce Core.termUnit]) $+ Compute.coder (var "encodeUnit") (var "decodeUnit") -untypedTermToJsonDef :: TBinding (Term -> Flow s Value)-untypedTermToJsonDef = define "untypedTermToJson" $+untypedTermToJson :: TBinding (Term -> Flow s Value)+untypedTermToJson = define "untypedTermToJson" $ doc "A simplistic, unidirectional encoding for terms as JSON values. Not type-aware; best used for human consumption." $- lambda "term" $ lets [- "unexp">: lambda "msg" $ produce $ Json.valueString $ Strings.cat2 (string "FAIL: ") (var "msg"),- "asRecord">: lambda "fields" $ ref untypedTermToJsonDef @@ (Core.termRecord $ Core.record (Core.name $ string "") (var "fields")),- "asVariant">: lambdas ["name", "term"] $ ref untypedTermToJsonDef @@- (Core.termUnion $ Core.injection (Core.name $ string "") $ Core.field (Core.name $ var "name") (var "term")),- "fieldToKeyval">: lambda "f" $ lets [- "forTerm">: lambda "t" $ cases _Term (var "t")- (Just $ Flows.map (unaryFunction just) $ ref untypedTermToJsonDef @@ var "t") [- _Term_optional>>: lambda "mt" $ Optionals.maybe- (produce nothing)- (var "forTerm")- (var "mt")]] $ binds [- "mjson">: var "forTerm" @@ (Core.fieldTerm $ var "f")] $- produce $ Optionals.map- (lambda "j" $ pair (Core.unName $ Core.fieldName $ var "f") (var "j"))- (var "mjson")] $- cases _Term (var "term")+ "term" ~>+ "unexp" <~ ("msg" ~> produce $ Json.valueString $ Strings.cat2 (string "FAIL: ") (var "msg")) $+ "asRecord" <~ ("fields" ~> untypedTermToJson @@ (Core.termRecord $ Core.record (Core.name $ string "") (var "fields"))) $+ "asVariant" <~ ("name" ~> "term" ~> untypedTermToJson @@+ (Core.termUnion $ Core.injection (Core.name $ string "") $ Core.field (Core.name $ var "name") (var "term"))) $+ -- Lift case expressions out of nested lambdas+ "matchTermMaybe" <~ ("forTerm" ~> "t" ~>+ cases _Term (var "t")+ (Just $ Flows.map (unaryFunction just) $ untypedTermToJson @@ var "t") [+ _Term_maybe>>: "mt" ~> Maybes.maybe+ (produce nothing)+ (var "forTerm")+ (var "mt")]) $+ "matchElimination" <~ ("unexp" ~> "asVariant" ~> "elm" ~>+ cases _Elimination (var "elm") (Just $ var "unexp" @@ (Strings.cat $ list [- string "unsupported term variant: ",- ref ShowCore.termDef @@ var "term"])) [- _Term_annotated>>: lambda "at" $ lets [- "term1">: Core.annotatedTermSubject $ var "at",- "ann">: Core.annotatedTermAnnotation $ var "at",- "encodePair">: lambda "kv" $ lets [- "k">: Core.unName $ first $ var "kv",- "v">: second $ var "kv"] $ binds [- "json">: ref untypedTermToJsonDef @@ var "v"] $- produce $ pair (var "k") (var "json")] $ binds [- "json">: ref untypedTermToJsonDef @@ var "term1",- "pairs">: Flows.mapList (var "encodePair") $ Maps.toList $ var "ann"] $- produce $ Json.valueObject $ Maps.fromList $ list [- pair (string "term") (var "json"),- pair (string "annotations") (Json.valueObject $ Maps.fromList $ var "pairs")],- _Term_application>>: lambda "app" $ var "asRecord" @@ list [- Core.field (Core.name $ string "function") (Core.applicationFunction $ var "app"),- Core.field (Core.name $ string "argument") (Core.applicationArgument $ var "app")],- _Term_function>>: lambda "f" $ cases _Function (var "f") Nothing [- _Function_elimination>>: lambda "elm" $ cases _Elimination (var "elm")- (Just $ var "unexp" @@ (Strings.cat $ list [- string "unexpected elimination variant: ",- ref ShowCore.eliminationDef @@ var "elm"])) [- _Elimination_record>>: lambda "proj" $ var "asVariant" @@ string "project" @@- (Core.termVariable $ Core.projectionField $ var "proj")],- _Function_lambda>>: lambda "l" $ var "asRecord" @@ list [- Core.field (Core.name $ string "parameter") (Core.termVariable $ Core.lambdaParameter $ var "l"),- Core.field (Core.name $ string "domain") (Core.termOptional $- Optionals.map (ref EncodeCore.typeDef) (Core.lambdaDomain $ var "l")),- Core.field (Core.name $ string "body") (Core.lambdaBody $ var "l")],- _Function_primitive>>: lambda "name" $ produce $ Json.valueString $ Core.unName $ var "name"],- _Term_let>>: lambda "lt" $ lets [- "bindings">: Core.letBindings $ var "lt",- "env">: Core.letEnvironment $ var "lt",- "fromBinding">: lambda "b" $ Core.field- (Core.bindingName $ var "b")- (Core.bindingTerm $ var "b")] $- var "asRecord" @@ list [- Core.field (Core.name $ string "bindings") (Core.termRecord $ Core.record- (Core.name $ string "")- (Lists.map (var "fromBinding") (var "bindings"))),- Core.field (Core.name $ string "environment") (var "env")],- _Term_list>>: lambda "terms" $ binds [- "jsonTerms">: Flows.mapList (ref untypedTermToJsonDef) (var "terms")] $- produce $ Json.valueArray $ var "jsonTerms",- _Term_literal>>: lambda "lit" $ produce $ cases _Literal (var "lit") Nothing [- _Literal_binary>>: lambda "b" $ Json.valueString $ Literals.binaryToString $ var "b",- _Literal_boolean>>: lambda "b" $ Json.valueBoolean $ var "b",- _Literal_float>>: lambda "f" $ Json.valueNumber $ ref HydraLiterals.floatValueToBigfloatDef @@ var "f",- _Literal_integer>>: lambda "i" $ lets [- "bf">: ref HydraLiterals.integerValueToBigintDef @@ var "i",- "f">: Literals.bigintToBigfloat $ var "bf"] $- Json.valueNumber $ var "f",- _Literal_string>>: lambda "s" $ Json.valueString $ var "s"],- _Term_optional>>: lambda "mt" $ Optionals.maybe- (produce Json.valueNull)- (ref untypedTermToJsonDef)- (var "mt"),- _Term_product>>: lambda "els" $ ref untypedTermToJsonDef @@ (Core.termList $ var "els"),- _Term_record>>: lambda "r" $ lets [- "fields">: Core.recordFields $ var "r"] $ binds [- "keyvals">: Flows.mapList (var "fieldToKeyval") (var "fields")] $- produce $ Json.valueObject $ Maps.fromList $ Optionals.cat $ var "keyvals",- _Term_set>>: lambda "vals" $ ref untypedTermToJsonDef @@ (Core.termList $ Sets.toList $ var "vals"),- _Term_sum>>: lambda "s" $ var "asRecord" @@ list [- Core.field (Core.name $ string "index") (Core.termLiteral $ Core.literalInteger $- Core.integerValueInt32 $ Core.sumIndex $ var "s"),- Core.field (Core.name $ string "size") (Core.termLiteral $ Core.literalInteger $- Core.integerValueInt32 $ Core.sumSize $ var "s"),- Core.field (Core.name $ string "term") (Core.sumTerm $ var "s")],- _Term_typeLambda>>: lambda "ta" $ var "asRecord" @@ list [- Core.field (Core.name $ string "parameter") (Core.termVariable $ Core.typeLambdaParameter $ var "ta"),- Core.field (Core.name $ string "body") (Core.typeLambdaBody $ var "ta")],- _Term_typeApplication>>: lambda "tt" $ var "asRecord" @@ list [- Core.field (Core.name $ string "term") (Core.typedTermTerm $ var "tt"),- Core.field (Core.name $ string "type") (ref EncodeCore.typeDef @@ (Core.typedTermType $ var "tt"))],- _Term_union>>: lambda "i" $ lets [- "field">: Core.injectionField $ var "i"] $- Logic.ifElse (Equality.equal (Core.fieldTerm $ var "field") Core.termUnit)- (produce $ Json.valueString $ Core.unName $ Core.fieldName $ var "field")- (binds [- "mkeyval">: var "fieldToKeyval" @@ var "field"] $- produce $ Json.valueObject $ Maps.fromList $ Optionals.maybe- (list [])- (lambda "keyval" $ list [var "keyval"])- (var "mkeyval")),- _Term_variable>>: lambda "v" $ produce $ Json.valueString $ Core.unName $ var "v",- _Term_wrap>>: lambda "wt" $ ref untypedTermToJsonDef @@ (Core.wrappedTermObject $ var "wt")]+ string "unexpected elimination variant: ",+ ShowCore.elimination @@ var "elm"])) [+ _Elimination_record>>: "proj" ~> var "asVariant" @@ string "project" @@+ (Core.termVariable $ Core.projectionField $ var "proj")]) $+ "matchFunction" <~ ("unexp" ~> "asRecord" ~> "asVariant" ~> "f" ~>+ cases _Function (var "f") Nothing [+ _Function_elimination>>: "elm" ~>+ var "matchElimination" @@ var "unexp" @@ var "asVariant" @@ var "elm",+ _Function_lambda>>: "l" ~> var "asRecord" @@ list [+ Core.field (Core.name $ string "parameter") (Core.termVariable $ Core.lambdaParameter $ var "l"),+ Core.field (Core.name $ string "domain") (Core.termMaybe $+ Maybes.map (encoderFor _Type) (Core.lambdaDomain $ var "l")),+ Core.field (Core.name $ string "body") (Core.lambdaBody $ var "l")],+ _Function_primitive>>: "name" ~> produce $ Json.valueString $ Core.unName $ var "name"]) $+ "matchLiteral" <~ ("lit" ~>+ cases _Literal (var "lit") Nothing [+ _Literal_binary>>: "b" ~> Json.valueString $ Literals.binaryToString $ var "b",+ _Literal_boolean>>: "b" ~> Json.valueBoolean $ var "b",+ _Literal_float>>: "f" ~> Json.valueNumber $ HydraLiterals.floatValueToBigfloat @@ var "f",+ _Literal_integer>>: "i" ~>+ "bf" <~ (HydraLiterals.integerValueToBigint @@ var "i") $+ "f" <~ (Literals.bigintToBigfloat $ var "bf") $+ Json.valueNumber $ var "f",+ _Literal_string>>: "s" ~> Json.valueString $ var "s"]) $+ "fieldToKeyval" <~ ("f" ~>+ "forTerm" <~ ("t" ~> var "matchTermMaybe" @@ var "forTerm" @@ var "t") $+ "mjson" <<~ var "forTerm" @@ (Core.fieldTerm $ var "f") $+ produce $ Maybes.map+ ("j" ~> pair (Core.unName $ Core.fieldName $ var "f") (var "j"))+ (var "mjson")) $+ "result" <~ (cases _Term (var "term")+ (Just $ var "unexp" @@ (Strings.cat $ list [+ string "unsupported term variant: ",+ ShowCore.term @@ var "term"])) [+ _Term_annotated>>: "at" ~>+ "term1" <~ (Core.annotatedTermBody $ var "at") $+ "ann" <~ (Core.annotatedTermAnnotation $ var "at") $+ "encodePair" <~ ("kv" ~>+ "k" <~ (Core.unName $ Pairs.first $ var "kv") $+ "v" <~ (Pairs.second $ var "kv") $+ "json" <<~ untypedTermToJson @@ var "v" $+ produce $ pair (var "k") (var "json")) $+ "json" <<~ untypedTermToJson @@ var "term1" $+ "pairs" <<~ Flows.mapList (var "encodePair") (Maps.toList $ var "ann") $+ produce $ Json.valueObject $ Maps.fromList $ list [+ pair (string "term") (var "json"),+ pair (string "annotations") (Json.valueObject $ Maps.fromList $ var "pairs")],+ _Term_application>>: "app" ~> var "asRecord" @@ list [+ Core.field (Core.name $ string "function") (Core.applicationFunction $ var "app"),+ Core.field (Core.name $ string "argument") (Core.applicationArgument $ var "app")],+ _Term_function>>: "f" ~>+ var "matchFunction" @@ var "unexp" @@ var "asRecord" @@ var "asVariant" @@ var "f",+ _Term_let>>: "lt" ~>+ "bindings" <~ (Core.letBindings $ var "lt") $+ "env" <~ (Core.letBody $ var "lt") $+ "fromBinding" <~ ("b" ~> Core.field+ (Core.bindingName $ var "b")+ (Core.bindingTerm $ var "b")) $+ var "asRecord" @@ list [+ Core.field (Core.name $ string "bindings") (Core.termRecord $ Core.record+ (Core.name $ string "")+ (Lists.map (var "fromBinding") (var "bindings"))),+ Core.field (Core.name $ string "environment") (var "env")],+ _Term_list>>: "terms" ~>+ "jsonTerms" <<~ Flows.mapList (untypedTermToJson) (var "terms") $+ produce $ Json.valueArray $ var "jsonTerms",+ _Term_literal>>: "lit" ~>+ produce $ var "matchLiteral" @@ var "lit",+ _Term_maybe>>: "mt" ~> Maybes.maybe+ (produce Json.valueNull)+ untypedTermToJson+ (var "mt"),+ _Term_record>>: "r" ~>+ "fields" <~ (Core.recordFields $ var "r") $+ "keyvals" <<~ Flows.mapList (var "fieldToKeyval") (var "fields") $+ produce $ Json.valueObject $ Maps.fromList $ Maybes.cat $ var "keyvals",+ _Term_set>>: "vals" ~> untypedTermToJson @@ (Core.termList $ Sets.toList $ var "vals"),+ _Term_typeLambda>>: "ta" ~> var "asRecord" @@ list [+ Core.field (Core.name $ string "parameter") (Core.termVariable $ Core.typeLambdaParameter $ var "ta"),+ Core.field (Core.name $ string "body") (Core.typeLambdaBody $ var "ta")],+ _Term_typeApplication>>: "tt" ~> var "asRecord" @@ list [+ Core.field (Core.name $ string "term") (Core.typeApplicationTermBody $ var "tt"),+ Core.field (Core.name $ string "type") (encoderFor _Type @@ (Core.typeApplicationTermType $ var "tt"))],+ _Term_union>>: "i" ~>+ "field" <~ (Core.injectionField $ var "i") $+ Logic.ifElse (Equality.equal (Core.fieldTerm $ var "field") Core.termUnit)+ (produce $ Json.valueString $ Core.unName $ Core.fieldName $ var "field")+ ("mkeyval" <<~ var "fieldToKeyval" @@ var "field" $+ produce $ Json.valueObject $ Maps.fromList $ Maybes.maybe+ (list ([] :: [TTerm (String, Value)]))+ ("keyval" ~> list [var "keyval"])+ (var "mkeyval")),+ _Term_variable>>: "v" ~> produce $ Json.valueString $ Core.unName $ var "v",+ _Term_wrap>>: "wt" ~> untypedTermToJson @@ (Core.wrappedTermBody $ var "wt")]) $+ var "result" -readStringStubDef :: TBinding (String -> Term)-readStringStubDef = define "readStringStub" $+readStringStub :: TBinding (String -> Term)+readStringStub = define "readStringStub" $ doc "Placeholder for reading a string into a term (to be implemented)" $- lambda "s" $ Core.termLiteral $ Core.literalString $ Strings.cat2 (string "TODO: read ") (var "s")+ "s" ~> Core.termLiteral $ Core.literalString $ Strings.cat2 (string "TODO: read ") (var "s") -- TODO: implement this function, and deduplicate with hydra.json.coder.showValue-showValueDef :: TBinding (Value -> String)-showValueDef = define "showValue" $+showValue :: TBinding (Value -> String)+showValue = define "showValue" $ doc "Show a JSON value as a string (placeholder implementation)" $- lambda "value" $ string "TODO: implement showValue"+ "value" ~> string "TODO: implement showValue"
+ src/main/haskell/Hydra/Sources/Json/Decode.hs view
@@ -0,0 +1,525 @@++module Hydra.Sources.Json.Decode where++-- Standard imports for term-level sources outside of the kernel+import Hydra.Kernel+import Hydra.Sources.Libraries+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+--import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes+import Prelude hiding ((++), decodeFloat)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Additional imports+import Hydra.Json.Model+++ns :: Namespace+ns = Namespace "hydra.json.decode"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Rewriting.ns, moduleNamespace Literals.module_, moduleNamespace ExtractCore.module_]+ KernelTypes.kernelTypesNamespaces $+ Just "JSON decoding for Hydra terms. Converts JSON Values to Terms using Either for error handling."+ where+ elements = [+ toBinding fromJson,+ toBinding decodeLiteral,+ toBinding decodeFloat,+ toBinding decodeInteger,+ toBinding expectString,+ toBinding expectArray,+ toBinding expectObject,+ toBinding expectNumber]++-- | Decode a JSON Value to a Term given a Type and type lookup table.+-- Returns Left with an error message for type mismatches or invalid JSON.+fromJson :: TBinding (M.Map Name Type -> Type -> Value -> Either String Term)+fromJson = define "fromJson" $+ doc "Decode a JSON value to a Hydra term given a type. Returns Left for type mismatches." $+ "types" ~> "typ" ~> "value" ~>+ "stripped" <~ (Rewriting.deannotateType @@ var "typ") $+ cases _Type (var "stripped")+ (Just $ left $ Strings.cat $ list [+ string "unsupported type for JSON decoding: ",+ ShowCore.type_ @@ var "typ"]) [++ -- Literals+ _Type_literal>>: "lt" ~> decodeLiteral @@ var "lt" @@ var "value",++ -- Lists+ _Type_list>>: "elemType" ~>+ "decodeElem" <~ ("v" ~> fromJson @@ var "types" @@ var "elemType" @@ var "v") $+ "arrResult" <~ (expectArray @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("arr" ~>+ "decoded" <~ (Eithers.mapList (var "decodeElem") (var "arr")) $+ Eithers.map ("ts" ~> Core.termList $ var "ts") (var "decoded"))+ (var "arrResult"),++ -- Sets+ _Type_set>>: "elemType" ~>+ "decodeElem" <~ ("v" ~> fromJson @@ var "types" @@ var "elemType" @@ var "v") $+ "arrResult" <~ (expectArray @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("arr" ~>+ "decoded" <~ (Eithers.mapList (var "decodeElem") (var "arr")) $+ Eithers.map ("elems" ~> Core.termSet $ Sets.fromList $ var "elems") (var "decoded"))+ (var "arrResult"),++ -- Maybe (null -> Nothing, [v] -> Just v)+ _Type_maybe>>: "innerType" ~>+ -- Helper to decode Just case (single element array)+ "decodeJust" <~ ("arr" ~>+ Eithers.map ("v" ~> Core.termMaybe $ just $ var "v")+ (fromJson @@ var "types" @@ var "innerType" @@ (Lists.head $ var "arr"))) $+ -- Decode array based on length: 0 -> Nothing, 1 -> Just, else error+ "decodeMaybeArray" <~ ("arr" ~>+ "len" <~ (Lists.length $ var "arr") $+ Logic.ifElse (Equality.equal (var "len") (int32 0))+ (right $ Core.termMaybe nothing)+ (Logic.ifElse (Equality.equal (var "len") (int32 1))+ (var "decodeJust" @@ var "arr")+ (left $ string "expected single-element array for Just"))) $+ cases _Value (var "value")+ (Just $ left $ string "expected null or single-element array for Maybe") [+ _Value_null>>: constant $ right $ Core.termMaybe nothing,+ _Value_array>>: "arr" ~> var "decodeMaybeArray" @@ var "arr"],++ -- Records+ _Type_record>>: "rt" ~>+ "objResult" <~ (expectObject @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("obj" ~>+ "decodeField" <~ ("ft" ~>+ "fname" <~ (Core.fieldTypeName $ var "ft") $+ "ftype" <~ (Core.fieldTypeType $ var "ft") $+ "mval" <~ (Maps.lookup (Core.unName $ var "fname") (var "obj")) $+ -- Use empty object as default for missing optional fields+ "defaultVal" <~ Json.valueNull $+ "jsonVal" <~ (Maybes.fromMaybe (var "defaultVal") (var "mval")) $+ "decoded" <~ (fromJson @@ var "types" @@ var "ftype" @@ var "jsonVal") $+ Eithers.map ("v" ~> Core.field (var "fname") (var "v")) (var "decoded")) $+ "fields" <~ (Core.rowTypeFields $ var "rt") $+ "decodedFields" <~ (Eithers.mapList (var "decodeField") (var "fields")) $+ Eithers.map+ ("fs" ~> Core.termRecord $ Core.record (Core.rowTypeTypeName $ var "rt") (var "fs"))+ (var "decodedFields"))+ (var "objResult"),++ -- Unions (single-key object)+ _Type_union>>: "rt" ~>+ -- Helper to decode a field once found+ "decodeVariant" <~ ("key" ~> "val" ~> "ftype" ~>+ "jsonVal" <~ (Maybes.fromMaybe Json.valueNull (var "val")) $+ "decoded" <~ (fromJson @@ var "types" @@ var "ftype" @@ var "jsonVal") $+ Eithers.map+ ("v" ~> Core.termUnion $ Core.injection+ (Core.rowTypeTypeName $ var "rt")+ (Core.field (Core.name $ var "key") (var "v")))+ (var "decoded")) $+ -- Helper to check if a field matches and decode it+ "tryField" <~ ("key" ~> "val" ~> "ft" ~>+ Logic.ifElse (Equality.equal (Core.unName $ Core.fieldTypeName $ var "ft") (var "key"))+ (just $ var "decodeVariant" @@ var "key" @@ var "val" @@ (Core.fieldTypeType $ var "ft"))+ nothing) $+ -- Find matching field and decode (uses tryField which returns Maybe, then either unwraps or recurses)+ "findAndDecode" <~ ("key" ~> "val" ~> "fts" ~>+ Logic.ifElse (Lists.null $ var "fts")+ (left $ Strings.cat $ list [string "unknown variant: ", var "key"])+ (Maybes.maybe+ (var "findAndDecode" @@ var "key" @@ var "val" @@ (Lists.tail $ var "fts"))+ ("r" ~> var "r")+ (var "tryField" @@ var "key" @@ var "val" @@ (Lists.head $ var "fts")))) $+ -- Helper to decode a single-key object+ "decodeSingleKey" <~ ("obj" ~>+ var "findAndDecode"+ @@ (Lists.head $ Maps.keys $ var "obj")+ @@ (Maps.lookup (Lists.head $ Maps.keys $ var "obj") (var "obj"))+ @@ (Core.rowTypeFields $ var "rt")) $+ -- Process the union object+ "processUnion" <~ ("obj" ~>+ Logic.ifElse (Equality.equal (Lists.length $ Maps.keys $ var "obj") (int32 1))+ (var "decodeSingleKey" @@ var "obj")+ (left $ string "expected single-key object for union")) $+ "objResult" <~ (expectObject @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("obj" ~> var "processUnion" @@ var "obj")+ (var "objResult"),++ -- Unit (empty object)+ _Type_unit>>: constant $+ "objResult" <~ (expectObject @@ var "value") $+ Eithers.map (constant Core.termUnit) (var "objResult"),++ -- Wrapped types (look up in type table and extract inner type if needed)+ _Type_wrap>>: "wn" ~>+ -- Extract inner type from a looked-up type (handles nested wraps)+ "extractInnerType" <~ ("lt" ~>+ cases _Type (var "lt") (Just $ var "lt") [+ _Type_wrap>>: "wt" ~> Core.wrappedTypeBody $ var "wt"]) $+ -- Decode using the inner type and wrap the result+ "decodeAndWrap" <~ ("lt" ~>+ "innerType" <~ (var "extractInnerType" @@ var "lt") $+ "decoded" <~ (fromJson @@ var "types" @@ var "innerType" @@ var "value") $+ Eithers.map+ ("v" ~> Core.termWrap $ Core.wrappedTerm (Core.wrappedTypeTypeName $ var "wn") (var "v"))+ (var "decoded")) $+ "lookedUp" <~ (Maps.lookup (Core.wrappedTypeTypeName $ var "wn") (var "types")) $+ Maybes.maybe+ (left $ Strings.cat $ list [+ string "unknown wrapped type: ",+ Core.unName $ Core.wrappedTypeTypeName $ var "wn"])+ ("lt" ~> var "decodeAndWrap" @@ var "lt")+ (var "lookedUp"),++ -- Map -> array of {@key, @value}+ _Type_map>>: "mt" ~>+ "keyType" <~ (Core.mapTypeKeys $ var "mt") $+ "valType" <~ (Core.mapTypeValues $ var "mt") $+ "arrResult" <~ (expectArray @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("arr" ~>+ "decodeEntry" <~ ("entryJson" ~>+ "objResult" <~ (expectObject @@ var "entryJson") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("entryObj" ~>+ "keyJson" <~ (Maps.lookup (string "@key") (var "entryObj")) $+ "valJson" <~ (Maps.lookup (string "@value") (var "entryObj")) $+ Maybes.maybe+ (left $ string "missing @key in map entry")+ ("kj" ~> Maybes.maybe+ (left $ string "missing @value in map entry")+ ("vj" ~>+ "decodedKey" <~ (fromJson @@ var "types" @@ var "keyType" @@ var "kj") $+ "decodedVal" <~ (fromJson @@ var "types" @@ var "valType" @@ var "vj") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("k" ~> Eithers.map ("v" ~> pair (var "k") (var "v")) (var "decodedVal"))+ (var "decodedKey"))+ (var "valJson"))+ (var "keyJson"))+ (var "objResult")) $+ "entries" <~ (Eithers.mapList (var "decodeEntry") (var "arr")) $+ Eithers.map ("es" ~> Core.termMap $ Maps.fromList $ var "es") (var "entries"))+ (var "arrResult"),++ -- Pair -> {@first, @second}+ _Type_pair>>: "pt" ~>+ "firstType" <~ (Core.pairTypeFirst $ var "pt") $+ "secondType" <~ (Core.pairTypeSecond $ var "pt") $+ "objResult" <~ (expectObject @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("obj" ~>+ "firstJson" <~ (Maps.lookup (string "@first") (var "obj")) $+ "secondJson" <~ (Maps.lookup (string "@second") (var "obj")) $+ Maybes.maybe+ (left $ string "missing @first in pair")+ ("fj" ~> Maybes.maybe+ (left $ string "missing @second in pair")+ ("sj" ~>+ "decodedFirst" <~ (fromJson @@ var "types" @@ var "firstType" @@ var "fj") $+ "decodedSecond" <~ (fromJson @@ var "types" @@ var "secondType" @@ var "sj") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("f" ~> Eithers.map ("s" ~> Core.termPair $ pair (var "f") (var "s")) (var "decodedSecond"))+ (var "decodedFirst"))+ (var "secondJson"))+ (var "firstJson"))+ (var "objResult"),++ -- Either -> {@left} or {@right}+ _Type_either>>: "et" ~>+ "leftType" <~ (Core.eitherTypeLeft $ var "et") $+ "rightType" <~ (Core.eitherTypeRight $ var "et") $+ "objResult" <~ (expectObject @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("obj" ~>+ "leftJson" <~ (Maps.lookup (string "@left") (var "obj")) $+ "rightJson" <~ (Maps.lookup (string "@right") (var "obj")) $+ Maybes.maybe+ (Maybes.maybe+ (left $ string "expected @left or @right in Either")+ ("rj" ~>+ "decoded" <~ (fromJson @@ var "types" @@ var "rightType" @@ var "rj") $+ Eithers.map ("v" ~> Core.termEither $ right $ var "v") (var "decoded"))+ (var "rightJson"))+ ("lj" ~>+ "decoded" <~ (fromJson @@ var "types" @@ var "leftType" @@ var "lj") $+ Eithers.map ("v" ~> Core.termEither $ left $ var "v") (var "decoded"))+ (var "leftJson"))+ (var "objResult"),++ -- Type variables (look up in type table and recurse)+ _Type_variable>>: "name" ~>+ "lookedUp" <~ (Maps.lookup (var "name") (var "types")) $+ Maybes.maybe+ (left $ Strings.cat $ list [+ string "unknown type variable: ",+ Core.unName $ var "name"])+ ("resolvedType" ~> fromJson @@ var "types" @@ var "resolvedType" @@ var "value")+ (var "lookedUp")]++-- | Decode a JSON value to a literal term given a literal type+decodeLiteral :: TBinding (LiteralType -> Value -> Either String Term)+decodeLiteral = define "decodeLiteral" $+ doc "Decode a JSON value to a literal term" $+ "lt" ~> "value" ~>+ cases _LiteralType (var "lt") Nothing [+ _LiteralType_binary>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.map ("s" ~> Core.termLiteral $ Core.literalBinary $ Literals.stringToBinary $ var "s") (var "strResult"),++ _LiteralType_boolean>>: constant $+ cases _Value (var "value")+ (Just $ left $ string "expected boolean") [+ _Value_boolean>>: "b" ~> right $ Core.termLiteral $ Core.literalBoolean $ var "b"],++ _LiteralType_float>>: "ft" ~> decodeFloat @@ var "ft" @@ var "value",++ _LiteralType_integer>>: "it" ~> decodeInteger @@ var "it" @@ var "value",++ _LiteralType_string>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.map ("s" ~> Core.termLiteral $ Core.literalString $ var "s") (var "strResult")]++-- | Decode a JSON value to a float term+-- Float64 and Bigfloat are decoded from JSON numbers; Float32 from string+decodeFloat :: TBinding (FloatType -> Value -> Either String Term)+decodeFloat = define "decodeFloat" $+ doc "Decode a JSON value to a float term. Float64/Bigfloat from numbers; Float32 from string." $+ "ft" ~> "value" ~>+ cases _FloatType (var "ft") Nothing [+ -- Bigfloat: JSON number (Double) -> bigfloat+ _FloatType_bigfloat>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalFloat $ Core.floatValueBigfloat $ var "n")+ (var "numResult"),+ -- Float32: JSON string -> parse as float32 (preserves exact precision)+ _FloatType_float32>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("s" ~>+ "parsed" <~ (Literals.readFloat32 $ var "s") $+ Maybes.maybe+ (left $ Strings.cat $ list [string "invalid float32: ", var "s"])+ ("v" ~> right $ Core.termLiteral $ Core.literalFloat $ Core.floatValueFloat32 $ var "v")+ (var "parsed"))+ (var "strResult"),+ -- Float64: JSON number (Double) -> float64+ _FloatType_float64>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalFloat $ Core.floatValueFloat64 $ Literals.bigfloatToFloat64 $ var "n")+ (var "numResult")]++-- | Decode a JSON value to an integer term+-- Small integers (int8, int16, int32, uint8, uint16) are decoded from JSON numbers+-- Large integers (int64, uint32, uint64, bigint) are decoded from JSON strings+decodeInteger :: TBinding (IntegerType -> Value -> Either String Term)+decodeInteger = define "decodeInteger" $+ doc "Decode a JSON value to an integer term. Small ints from numbers; large ints from strings." $+ "it" ~> "value" ~>+ cases _IntegerType (var "it") Nothing [+ -- Large integers: decode from JSON string+ _IntegerType_bigint>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("s" ~>+ "parsed" <~ (Literals.readBigint $ var "s") $+ Maybes.maybe+ (left $ Strings.cat $ list [string "invalid bigint: ", var "s"])+ ("v" ~> right $ Core.termLiteral $ Core.literalInteger $ Core.integerValueBigint $ var "v")+ (var "parsed"))+ (var "strResult"),+ _IntegerType_int64>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("s" ~>+ "parsed" <~ (Literals.readInt64 $ var "s") $+ Maybes.maybe+ (left $ Strings.cat $ list [string "invalid int64: ", var "s"])+ ("v" ~> right $ Core.termLiteral $ Core.literalInteger $ Core.integerValueInt64 $ var "v")+ (var "parsed"))+ (var "strResult"),+ _IntegerType_uint32>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("s" ~>+ "parsed" <~ (Literals.readUint32 $ var "s") $+ Maybes.maybe+ (left $ Strings.cat $ list [string "invalid uint32: ", var "s"])+ ("v" ~> right $ Core.termLiteral $ Core.literalInteger $ Core.integerValueUint32 $ var "v")+ (var "parsed"))+ (var "strResult"),+ _IntegerType_uint64>>: constant $+ "strResult" <~ (expectString @@ var "value") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("s" ~>+ "parsed" <~ (Literals.readUint64 $ var "s") $+ Maybes.maybe+ (left $ Strings.cat $ list [string "invalid uint64: ", var "s"])+ ("v" ~> right $ Core.termLiteral $ Core.literalInteger $ Core.integerValueUint64 $ var "v")+ (var "parsed"))+ (var "strResult"),+ -- Small integers: decode from JSON number+ _IntegerType_int8>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalInteger $ Core.integerValueInt8 $+ Literals.bigintToInt8 $ Literals.bigfloatToBigint $ var "n")+ (var "numResult"),+ _IntegerType_int16>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalInteger $ Core.integerValueInt16 $+ Literals.bigintToInt16 $ Literals.bigfloatToBigint $ var "n")+ (var "numResult"),+ _IntegerType_int32>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $+ Literals.bigintToInt32 $ Literals.bigfloatToBigint $ var "n")+ (var "numResult"),+ _IntegerType_uint8>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalInteger $ Core.integerValueUint8 $+ Literals.bigintToUint8 $ Literals.bigfloatToBigint $ var "n")+ (var "numResult"),+ _IntegerType_uint16>>: constant $+ "numResult" <~ (expectNumber @@ var "value") $+ Eithers.map+ ("n" ~> Core.termLiteral $ Core.literalInteger $ Core.integerValueUint16 $+ Literals.bigintToUint16 $ Literals.bigfloatToBigint $ var "n")+ (var "numResult")]++-- | Extract a string from a JSON value+expectString :: TBinding (Value -> Either String String)+expectString = define "expectString" $+ doc "Extract a string from a JSON value" $+ "value" ~> cases _Value (var "value")+ (Just $ left $ string "expected string") [+ _Value_string>>: "s" ~> right $ var "s"]++-- | Extract an array from a JSON value+expectArray :: TBinding (Value -> Either String [Value])+expectArray = define "expectArray" $+ doc "Extract an array from a JSON value" $+ "value" ~> cases _Value (var "value")+ (Just $ left $ string "expected array") [+ _Value_array>>: "arr" ~> right $ var "arr"]++-- | Extract an object from a JSON value+expectObject :: TBinding (Value -> Either String (M.Map String Value))+expectObject = define "expectObject" $+ doc "Extract an object from a JSON value" $+ "value" ~> cases _Value (var "value")+ (Just $ left $ string "expected object") [+ _Value_object>>: "obj" ~> right $ var "obj"]++-- | Extract a number from a JSON value+expectNumber :: TBinding (Value -> Either String Double)+expectNumber = define "expectNumber" $+ doc "Extract a number from a JSON value" $+ "value" ~> cases _Value (var "value")+ (Just $ left $ string "expected number") [+ _Value_number>>: "n" ~> right $ var "n"]
src/main/haskell/Hydra/Sources/Json/Decoding.hs view
@@ -1,145 +1,166 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Json.Decoding where -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import Hydra.Json-import qualified Hydra.Sources.Kernel.Types.Json as Json+-- Additional imports+import Hydra.Json.Model+import qualified Hydra.Sources.Json.Model as JsonModel +ns :: Namespace+ns = Namespace "hydra.ext.org.json.decoding"+ module_ :: Module-module_ = Module (Namespace "hydra.ext.org.json.decoding") elements+module_ = Module ns elements []- KernelTypes.kernelTypesModules $+ KernelTypes.kernelTypesNamespaces $ Just "Decoding functions for JSON data" where elements = [- Phantoms.el decodeArrayDef,- Phantoms.el decodeBooleanDef,- Phantoms.el decodeFieldDef,--- Phantoms.el decodeNumberDef, TODO: restore- Phantoms.el decodeObjectDef,- Phantoms.el decodeOptionalFieldDef,- Phantoms.el decodeStringDef]+ Phantoms.toBinding decodeArray,+ Phantoms.toBinding decodeBoolean,+ Phantoms.toBinding decodeField,+-- Phantoms.toBinding decodeNumber, TODO: restore+ Phantoms.toBinding decodeObject,+ Phantoms.toBinding decodeOptionalField,+ Phantoms.toBinding decodeString] define :: String -> TTerm a -> TBinding a define label = definitionInModule module_ ("decode" <> label) -decodeArrayDef :: TBinding ((Value -> Flow s a) -> Value -> Flow s [a])-decodeArrayDef = define "Array" $- lambda "decodeElem" $ match _Value (Just $ Flows.fail "expected an array") [+decodeArray :: TBinding ((Value -> Flow s a) -> Value -> Flow s [a])+decodeArray = define "Array" $+ doc "Decode a JSON array using a decoder for elements" $+ lambda "decodeElem" $ match _Value (Just $ Flows.fail (string "expected an array")) [ _Value_array>>: lambda "a" $ Flows.mapList (var "decodeElem") $ var "a"] -decodeBooleanDef :: TBinding (Value -> Flow s Bool)-decodeBooleanDef = define "Boolean" $- match _Value (Just $ Flows.fail $ "expected a boolean") [+decodeBoolean :: TBinding (Value -> Flow s Bool)+decodeBoolean = define "Boolean" $+ doc "Decode a JSON boolean value" $+ match _Value (Just $ Flows.fail (string "expected a boolean")) [ _Value_boolean>>: lambda "b" $ Flows.pure $ var "b"] -decodeFieldDef :: TBinding ((Value -> Flow s a) -> String -> (M.Map String Value) -> Flow s a)-decodeFieldDef = define "Field" $+decodeField :: TBinding ((Value -> Flow s a) -> String -> (M.Map String Value) -> Flow s a)+decodeField = define "Field" $+ doc "Decode a required field from a JSON object" $ lambda "decodeValue" $ lambda "name" $ lambda "m" $ Flows.bind- (ref decodeOptionalFieldDef @@ var "decodeValue" @@ var "name" @@ var "m")- (primitive _optionals_maybe- @@ (Flows.fail $ Strings.cat2 "missing field: " (var "name"))+ (decodeOptionalField @@ var "decodeValue" @@ var "name" @@ var "m")+ (primitive _maybes_maybe+ @@ (Flows.fail $ Strings.cat2 (string "missing field: ") (var "name")) @@ (lambda "f" $ Flows.pure $ var "f")) -decodeNumberDef :: TBinding (Value -> Flow s Double)-decodeNumberDef = define "Number" $- match _Value (Just $ Flows.fail "expected a number") [+decodeNumber :: TBinding (Value -> Flow s Double)+decodeNumber = define "Number" $+ doc "Decode a JSON number value" $+ match _Value (Just $ Flows.fail (string "expected a number")) [ _Value_number>>: lambda "n" $ Flows.pure $ var "n"] -decodeObjectDef :: TBinding (Value -> Flow s (M.Map String Value))-decodeObjectDef = define "Object" $- match _Value (Just $ Flows.fail "expected an object") [+decodeObject :: TBinding (Value -> Flow s (M.Map String Value))+decodeObject = define "Object" $+ doc "Decode a JSON object value" $+ match _Value (Just $ Flows.fail (string "expected an object")) [ _Value_object>>: lambda "o" $ Flows.pure $ var "o"] -decodeOptionalFieldDef :: TBinding ((Value -> Flow s a) -> String -> (M.Map String Value) -> Flow s (Maybe a))-decodeOptionalFieldDef = define "OptionalField" $+decodeOptionalField :: TBinding ((Value -> Flow s a) -> String -> (M.Map String Value) -> Flow s (Maybe a))+decodeOptionalField = define "OptionalField" $+ doc "Decode an optional field from a JSON object" $ lambda "decodeValue" $ lambda "name" $ lambda "m" $- (primitive _optionals_maybe+ (primitive _maybes_maybe @@ (Flows.pure nothing) @@ (lambda "v" (Flows.map (lambda "x" (just $ var "x")) (var "decodeValue" @@ var "v")))) @@ (Maps.lookup (var "name") (var "m")) -decodeStringDef :: TBinding (Value -> Flow s String)-decodeStringDef = define "String" $- match _Value (Just $ Flows.fail "expected a string") [+decodeString :: TBinding (Value -> Flow s String)+decodeString = define "String" $+ doc "Decode a JSON string value" $+ match _Value (Just $ Flows.fail (string "expected a string")) [ _Value_string>>: lambda "s" $ Flows.pure $ var "s"]
+ src/main/haskell/Hydra/Sources/Json/Encode.hs view
@@ -0,0 +1,261 @@++module Hydra.Sources.Json.Encode where++-- Standard imports for term-level sources outside of the kernel+import Hydra.Kernel+import Hydra.Sources.Libraries+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes+import Prelude hiding ((++), encodeFloat)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Additional imports+import Hydra.Json.Model+++ns :: Namespace+ns = Namespace "hydra.json.encode"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Rewriting.ns, moduleNamespace Literals.module_, moduleNamespace ExtractCore.module_]+ KernelTypes.kernelTypesNamespaces $+ Just "JSON encoding for Hydra terms. Converts Terms to JSON Values using Either for error handling."+ where+ elements = [+ toBinding toJson,+ toBinding encodeLiteral,+ toBinding encodeFloat,+ toBinding encodeInteger]++-- | Encode a Term to a JSON Value.+-- Returns Left with an error message for unsupported term constructs.+toJson :: TBinding (Term -> Either String Value)+toJson = define "toJson" $+ doc "Encode a Hydra term to a JSON value. Returns Left for unsupported constructs." $+ "term" ~>+ "stripped" <~ (Rewriting.deannotateTerm @@ var "term") $+ cases _Term (var "stripped")+ (Just $ left $ Strings.cat $ list [+ string "unsupported term variant for JSON encoding: ",+ ShowCore.term @@ var "term"]) [+ -- Literals+ _Term_literal>>: "lit" ~> encodeLiteral @@ var "lit",++ -- Lists+ _Term_list>>: "terms" ~>+ "results" <~ (Eithers.mapList ("t" ~> toJson @@ var "t") (var "terms")) $+ Eithers.map ("vs" ~> Json.valueArray $ var "vs") (var "results"),++ -- Sets (encode as arrays)+ _Term_set>>: "vals" ~>+ "terms" <~ (Sets.toList $ var "vals") $+ "results" <~ (Eithers.mapList ("t" ~> toJson @@ var "t") (var "terms")) $+ Eithers.map ("vs" ~> Json.valueArray $ var "vs") (var "results"),++ -- Maybe+ _Term_maybe>>: "opt" ~> optCases (var "opt")+ (right Json.valueNull)+ ("v" ~>+ "encodedMaybe" <~ (toJson @@ var "v") $+ Eithers.map ("encoded" ~> Json.valueArray $ list [var "encoded"]) (var "encodedMaybe")),++ -- Records+ _Term_record>>: "r" ~>+ "encodeField" <~ ("f" ~>+ "fname" <~ (Core.unName $ Core.fieldName $ var "f") $+ "fterm" <~ (Core.fieldTerm $ var "f") $+ "encodedField" <~ (toJson @@ var "fterm") $+ Eithers.map ("v" ~> pair (var "fname") (var "v")) (var "encodedField")) $+ "fields" <~ (Core.recordFields $ var "r") $+ "encodedFields" <~ (Eithers.mapList (var "encodeField") (var "fields")) $+ Eithers.map ("fs" ~> Json.valueObject $ Maps.fromList $ var "fs") (var "encodedFields"),++ -- Unions (single-key object)+ _Term_union>>: "inj" ~>+ "field" <~ (Core.injectionField $ var "inj") $+ "fname" <~ (Core.unName $ Core.fieldName $ var "field") $+ "fterm" <~ (Core.fieldTerm $ var "field") $+ "encodedUnion" <~ (toJson @@ var "fterm") $+ Eithers.map+ ("v" ~> Json.valueObject $ Maps.fromList $ list [pair (var "fname") (var "v")])+ (var "encodedUnion"),++ -- Unit+ _Term_unit>>: constant $ right $ Json.valueObject $ Maps.empty,++ -- Wrapped terms (transparent)+ _Term_wrap>>: "wt" ~> toJson @@ (Core.wrappedTermBody $ var "wt"),++ -- Maps -> array of {\"@key\": k, \"@value\": v}+ _Term_map>>: "m" ~>+ "encodeEntry" <~ ("kv" ~>+ "k" <~ (Pairs.first $ var "kv") $+ "v" <~ (Pairs.second $ var "kv") $+ "encodedK" <~ (toJson @@ var "k") $+ "encodedV" <~ (toJson @@ var "v") $+ -- Using Eithers.either to flatten the nested Either+ Eithers.either_+ ("err" ~> left $ var "err")+ ("ek" ~> Eithers.map+ ("ev" ~> Json.valueObject $ Maps.fromList $ list [+ pair (string "@key") (var "ek"),+ pair (string "@value") (var "ev")])+ (var "encodedV"))+ (var "encodedK")) $+ "entries" <~ (Eithers.mapList (var "encodeEntry") (Maps.toList $ var "m")) $+ Eithers.map ("es" ~> Json.valueArray $ var "es") (var "entries"),++ -- Pairs -> {\"@first\": ..., \"@second\": ...}+ _Term_pair>>: "p" ~>+ "first" <~ (Pairs.first $ var "p") $+ "second" <~ (Pairs.second $ var "p") $+ "encodedFirst" <~ (toJson @@ var "first") $+ "encodedSecond" <~ (toJson @@ var "second") $+ Eithers.either_+ ("err" ~> left $ var "err")+ ("ef" ~> Eithers.map+ ("es" ~> Json.valueObject $ Maps.fromList $ list [+ pair (string "@first") (var "ef"),+ pair (string "@second") (var "es")])+ (var "encodedSecond"))+ (var "encodedFirst"),++ -- Either -> {\"@left\": ...} or {\"@right\": ...}+ _Term_either>>: "e" ~>+ Eithers.either_+ ("l" ~>+ "encodedL" <~ (toJson @@ var "l") $+ Eithers.map+ ("v" ~> Json.valueObject $ Maps.fromList $ list [pair (string "@left") (var "v")])+ (var "encodedL"))+ ("r" ~>+ "encodedR" <~ (toJson @@ var "r") $+ Eithers.map+ ("v" ~> Json.valueObject $ Maps.fromList $ list [pair (string "@right") (var "v")])+ (var "encodedR"))+ (var "e")]++-- | Encode a literal value to JSON+encodeLiteral :: TBinding (Literal -> Either String Value)+encodeLiteral = define "encodeLiteral" $+ doc "Encode a Hydra literal to a JSON value" $+ "lit" ~> cases _Literal (var "lit") Nothing [+ _Literal_binary>>: "b" ~> right $ Json.valueString $ Literals.binaryToString $ var "b",+ _Literal_boolean>>: "b" ~> right $ Json.valueBoolean $ var "b",+ _Literal_float>>: "f" ~> encodeFloat @@ var "f",+ _Literal_integer>>: "i" ~> encodeInteger @@ var "i",+ _Literal_string>>: "s" ~> right $ Json.valueString $ var "s"]++-- | Encode a float value to JSON+-- Float64 and Bigfloat use native JSON numbers; Float32 uses string to preserve exact precision+encodeFloat :: TBinding (FloatValue -> Either String Value)+encodeFloat = define "encodeFloat" $+ doc "Encode a float value to JSON. Float64/Bigfloat use native numbers; Float32 uses string." $+ "fv" ~> cases _FloatValue (var "fv") Nothing [+ _FloatValue_bigfloat>>: "bf" ~> right $ Json.valueNumber $ var "bf",+ _FloatValue_float32>>: "f" ~> right $ Json.valueString $ Literals.showFloat32 $ var "f",+ _FloatValue_float64>>: "f" ~> right $ Json.valueNumber $ Literals.float64ToBigfloat $ var "f"]++-- | Encode an integer value to JSON+-- Small integers (int8, int16, int32, uint8, uint16) use native JSON numbers+-- Large integers (int64, uint32, uint64, bigint) use strings to preserve precision+encodeInteger :: TBinding (IntegerValue -> Either String Value)+encodeInteger = define "encodeInteger" $+ doc "Encode an integer value to JSON. Small ints use native numbers; large ints use strings." $+ "iv" ~> cases _IntegerValue (var "iv") Nothing [+ -- Large integers: use strings to preserve precision+ _IntegerValue_bigint>>: "bi" ~> right $ Json.valueString $ Literals.showBigint $ var "bi",+ _IntegerValue_int64>>: "i" ~> right $ Json.valueString $ Literals.showInt64 $ var "i",+ _IntegerValue_uint32>>: "i" ~> right $ Json.valueString $ Literals.showUint32 $ var "i",+ _IntegerValue_uint64>>: "i" ~> right $ Json.valueString $ Literals.showUint64 $ var "i",+ -- Small integers: use native JSON numbers (convert to bigfloat for JSON)+ _IntegerValue_int8>>: "i" ~> right $ Json.valueNumber $ Literals.bigintToBigfloat $ Literals.int8ToBigint $ var "i",+ _IntegerValue_int16>>: "i" ~> right $ Json.valueNumber $ Literals.bigintToBigfloat $ Literals.int16ToBigint $ var "i",+ _IntegerValue_int32>>: "i" ~> right $ Json.valueNumber $ Literals.bigintToBigfloat $ Literals.int32ToBigint $ var "i",+ _IntegerValue_uint8>>: "i" ~> right $ Json.valueNumber $ Literals.bigintToBigfloat $ Literals.uint8ToBigint $ var "i",+ _IntegerValue_uint16>>: "i" ~> right $ Json.valueNumber $ Literals.bigintToBigfloat $ Literals.uint16ToBigint $ var "i"]
src/main/haskell/Hydra/Sources/Json/Extract.hs view
@@ -1,195 +1,209 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Json.Extract where -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (opt)+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import Hydra.Json+-- Additional imports+import Hydra.Json.Model import qualified Hydra.Sources.Kernel.Terms.Monads as Monads +ns :: Namespace+ns = Namespace "hydra.extract.json"+ module_ :: Module-module_ = Module (Namespace "hydra.extract.json") elements- [Monads.module_]- KernelTypes.kernelTypesModules $+module_ = Module ns elements+ [Monads.ns]+ KernelTypes.kernelTypesNamespaces $ Just "Utilities for extracting values from JSON objects" where elements = [- el expectArrayDef,- el expectNumberDef,- el expectObjectDef,- el expectStringDef,- el optDef,- el optArrayDef,- el optStringDef,- el requireDef,- el requireArrayDef,- el requireNumberDef,- el requireStringDef,- el showValueDef]+ toBinding expectArray,+ toBinding expectNumber,+ toBinding expectObject,+ toBinding expectString,+ toBinding opt,+ toBinding optArray,+ toBinding optString,+ toBinding require,+ toBinding requireArray,+ toBinding requireNumber,+ toBinding requireString,+ toBinding showValue] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -expectArrayDef :: TBinding (Value -> Flow s [Value])-expectArrayDef = define "expectArray" $+expectArray :: TBinding (Value -> Flow s [Value])+expectArray = define "expectArray" $ doc "Extract an array from a JSON value, failing if the value is not an array" $ lambda "value" $ cases _Value (var "value")- (Just $ ref Monads.unexpectedDef @@ string "JSON array" @@ (ref showValueDef @@ var "value")) [+ (Just $ Monads.unexpected @@ string "JSON array" @@ (showValue @@ var "value")) [ _Value_array>>: lambda "els" $ Flows.pure $ var "els"] -expectNumberDef :: TBinding (Value -> Flow s Double)-expectNumberDef = define "expectNumber" $+expectNumber :: TBinding (Value -> Flow s Double)+expectNumber = define "expectNumber" $ doc "Extract a number from a JSON value, failing if the value is not a number" $ lambda "value" $ cases _Value (var "value")- (Just $ ref Monads.unexpectedDef @@ string "JSON number" @@ (ref showValueDef @@ var "value")) [+ (Just $ Monads.unexpected @@ string "JSON number" @@ (showValue @@ var "value")) [ _Value_number>>: lambda "d" $ Flows.pure $ var "d"] -expectObjectDef :: TBinding (Value -> Flow s (M.Map String Value))-expectObjectDef = define "expectObject" $+expectObject :: TBinding (Value -> Flow s (M.Map String Value))+expectObject = define "expectObject" $ doc "Extract an object from a JSON value, failing if the value is not an object" $ lambda "value" $ cases _Value (var "value")- (Just $ ref Monads.unexpectedDef @@ string "JSON object" @@ (ref showValueDef @@ var "value")) [+ (Just $ Monads.unexpected @@ string "JSON object" @@ (showValue @@ var "value")) [ _Value_object>>: lambda "m" $ Flows.pure $ var "m"] -expectStringDef :: TBinding (Value -> Flow s String)-expectStringDef = define "expectString" $+expectString :: TBinding (Value -> Flow s String)+expectString = define "expectString" $ doc "Extract a string from a JSON value, failing if the value is not a string" $ lambda "value" $ cases _Value (var "value")- (Just $ ref Monads.unexpectedDef @@ string "JSON string" @@ (ref showValueDef @@ var "value")) [+ (Just $ Monads.unexpected @@ string "JSON string" @@ (showValue @@ var "value")) [ _Value_string>>: lambda "s" $ Flows.pure $ var "s"] -optDef :: TBinding (String -> M.Map String Value -> Maybe Value)-optDef = define "opt" $+opt :: TBinding (String -> M.Map String Value -> Maybe Value)+opt = define "opt" $ doc "Look up an optional field in a JSON object" $ lambdas ["fname", "m"] $ Maps.lookup (var "fname") (var "m") -optArrayDef :: TBinding (String -> M.Map String Value -> Flow s (Maybe [Value]))-optArrayDef = define "optArray" $+optArray :: TBinding (String -> M.Map String Value -> Flow s (Maybe [Value]))+optArray = define "optArray" $ doc "Look up an optional array field in a JSON object" $- lambdas ["fname", "m"] $ Optionals.maybe+ lambdas ["fname", "m"] $ Maybes.maybe (Flows.pure nothing)- (lambda "a" $ Flows.map (unaryFunction just) $ ref expectArrayDef @@ var "a")- (ref optDef @@ var "fname" @@ var "m")+ (lambda "a" $ Flows.map (unaryFunction just) $ expectArray @@ var "a")+ (opt @@ var "fname" @@ var "m") -optStringDef :: TBinding (String -> M.Map String Value -> Flow s (Maybe String))-optStringDef = define "optString" $+optString :: TBinding (String -> M.Map String Value -> Flow s (Maybe String))+optString = define "optString" $ doc "Look up an optional string field in a JSON object" $- lambdas ["fname", "m"] $ Optionals.maybe+ lambdas ["fname", "m"] $ Maybes.maybe (Flows.pure nothing)- (lambda "s" $ Flows.map (unaryFunction just) $ ref expectStringDef @@ var "s")- (ref optDef @@ var "fname" @@ var "m")+ (lambda "s" $ Flows.map (unaryFunction just) $ expectString @@ var "s")+ (opt @@ var "fname" @@ var "m") -requireDef :: TBinding (String -> M.Map String Value -> Flow s Value)-requireDef = define "require" $+require :: TBinding (String -> M.Map String Value -> Flow s Value)+require = define "require" $ doc "Look up a required field in a JSON object, failing if not found" $- lambdas ["fname", "m"] $ Optionals.maybe+ lambdas ["fname", "m"] $ Maybes.maybe (Flows.fail $ Strings.cat $ list [ string "required attribute ",- ref showValueDef @@ var "fname",+ showValue @@ var "fname", string " not found"]) (lambda "value" $ Flows.pure $ var "value") (Maps.lookup (var "fname") (var "m")) -requireArrayDef :: TBinding (String -> M.Map String Value -> Flow s [Value])-requireArrayDef = define "requireArray" $+requireArray :: TBinding (String -> M.Map String Value -> Flow s [Value])+requireArray = define "requireArray" $ doc "Look up a required array field in a JSON object" $ lambdas ["fname", "m"] $ Flows.bind- (ref requireDef @@ var "fname" @@ var "m")- (ref expectArrayDef)+ (require @@ var "fname" @@ var "m")+ (expectArray) -requireNumberDef :: TBinding (String -> M.Map String Value -> Flow s Double)-requireNumberDef = define "requireNumber" $+requireNumber :: TBinding (String -> M.Map String Value -> Flow s Double)+requireNumber = define "requireNumber" $ doc "Look up a required number field in a JSON object" $ lambdas ["fname", "m"] $ Flows.bind- (ref requireDef @@ var "fname" @@ var "m")- (ref expectNumberDef)+ (require @@ var "fname" @@ var "m")+ (expectNumber) -requireStringDef :: TBinding (String -> M.Map String Value -> Flow s String)-requireStringDef = define "requireString" $+requireString :: TBinding (String -> M.Map String Value -> Flow s String)+requireString = define "requireString" $ doc "Look up a required string field in a JSON object" $ lambdas ["fname", "m"] $ Flows.bind- (ref requireDef @@ var "fname" @@ var "m")- (ref expectStringDef)+ (require @@ var "fname" @@ var "m")+ (expectString) -- TODO: implement this function, and deduplicate with hydra.json.coder.showValue-showValueDef :: TBinding (Value -> String)-showValueDef = define "showValue" $+showValue :: TBinding (Value -> String)+showValue = define "showValue" $ doc "Show a JSON value as a string (placeholder implementation)" $ lambda "value" $ string "TODO: implement showValue"
src/main/haskell/Hydra/Sources/Json/Language.hs view
@@ -1,130 +1,143 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Json.Language where -- Standard imports for term-level sources outside of the kernel import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Annotations as Anns-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Tabular as Tabular-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules-import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Languages as Languages-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Literals as Literals-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization-import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan-import qualified Hydra.Sources.Kernel.Terms.Templates as Templates-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.ext.org.json.language"+ module_ :: Module-module_ = Module (Namespace "hydra.ext.org.json.language")- [el jsonLanguageDef]- [Rewriting.module_]- KernelTypes.kernelTypesModules $+module_ = Module ns+ [toBinding jsonLanguage]+ [Rewriting.ns]+ KernelTypes.kernelTypesNamespaces $ Just "Language constraints for JSON" define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -jsonLanguageDef :: TBinding Language-jsonLanguageDef = define "jsonLanguage" $+jsonLanguage :: TBinding Language+jsonLanguage = define "jsonLanguage" $ doc "Language constraints for JSON" $ lets [ "eliminationVariants">: Sets.empty, "literalVariants">: Sets.fromList $ list [- Mantle.literalVariantBoolean,- Mantle.literalVariantFloat,- Mantle.literalVariantInteger,- Mantle.literalVariantString],+ Variants.literalVariantBoolean,+ Variants.literalVariantFloat,+ Variants.literalVariantInteger,+ Variants.literalVariantString], "floatTypes">: Sets.fromList $ list [Core.floatTypeBigfloat], "functionVariants">: Sets.empty, "integerTypes">: Sets.fromList $ list [Core.integerTypeBigint], -- Note: TermVariantUnit is excluded because JSON null is used for optionals "termVariants">: Sets.fromList $ list [- Mantle.termVariantList,- Mantle.termVariantLiteral,- Mantle.termVariantMap,- Mantle.termVariantOptional,- Mantle.termVariantRecord],+ Variants.termVariantList,+ Variants.termVariantLiteral,+ Variants.termVariantMap,+ Variants.termVariantMaybe,+ Variants.termVariantRecord], -- Note: TypeVariantUnit is excluded because JSON null is used for optionals "typeVariants">: Sets.fromList $ list [- Mantle.typeVariantList,- Mantle.typeVariantLiteral,- Mantle.typeVariantMap,- Mantle.typeVariantOptional,- Mantle.typeVariantRecord],- "typePredicate">: lambda "typ" $ cases _Type (ref Rewriting.deannotateTypeDef @@ var "typ")+ Variants.typeVariantList,+ Variants.typeVariantLiteral,+ Variants.typeVariantMap,+ Variants.typeVariantMaybe,+ Variants.typeVariantRecord],+ "typePredicate">: lambda "typ" $ cases _Type (Rewriting.deannotateType @@ var "typ") (Just true) [- _Type_optional>>: lambda "innerType" $+ _Type_maybe>>: lambda "innerType" $ cases _Type (var "innerType") (Just true) [- _Type_optional>>: constant false]]] $+ _Type_maybe>>: constant false]]] $ Coders.language- (Coders.languageName "hydra.ext.org.json")+ (Coders.languageName (string "hydra.ext.org.json")) (Coders.languageConstraints (var "eliminationVariants") (var "literalVariants")
+ src/main/haskell/Hydra/Sources/Json/Model.hs view
@@ -0,0 +1,48 @@+-- | A simple JSON model. This model is part of the Hydra kernel, despite JSON being an external language; JSON support is built in to Hydra++module Hydra.Sources.Json.Model where++-- Standard type-level kernel imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.json.model"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [] [Core.ns] $+ Just "A JSON syntax model. See the BNF at https://www.json.org"+ where+ elements = [+ value]++value :: Binding+value = define "Value" $+ doc "A JSON value" $+ T.union [+ "array">:+ doc "A JSON array" $+ T.list value,+ "boolean">:+ doc "A boolean value" $+ T.boolean,+ "null">:+ doc "JSON's null value" $+ T.unit,+ "number">:+ doc "A numeric value" $+ T.bigfloat, -- TODO: JSON numbers are decimal-encoded+ "object">:+ doc "A JSON object as a set of key/value pairs" $+ T.map T.string value,+ "string">:+ doc "A string value" $+ T.string]
+ src/main/haskell/Hydra/Sources/Json/Parser.hs view
@@ -0,0 +1,392 @@++module Hydra.Sources.Json.Parser where++-- Standard imports for term-level sources outside of the kernel+import Hydra.Kernel+import Hydra.Sources.Libraries+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Additional imports+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import qualified Hydra.Sources.Kernel.Terms.Parsers as Parsers+import qualified Hydra.Json.Model as J+++jsonParserDefinition :: String -> TTerm a -> TBinding a+jsonParserDefinition = definitionInModule module_++module_ :: Module+module_ = Module ns elements+ [Parsers.ns]+ KernelTypes.kernelTypesNamespaces $+ Just "JSON parser using Hydra parser combinators"+ where+ ns = Namespace "hydra.json.parser"+ elements = [+ toBinding whitespace,+ toBinding token,+ toBinding jsonNull,+ toBinding jsonBool,+ toBinding digit,+ toBinding digits,+ toBinding jsonIntegerPart,+ toBinding jsonFractionPart,+ toBinding jsonExponentPart,+ toBinding jsonNumber,+ toBinding jsonEscapeChar,+ toBinding jsonStringChar,+ toBinding jsonString,+ toBinding jsonArray,+ toBinding jsonKeyValue,+ toBinding jsonObject,+ toBinding jsonValue,+ toBinding parseJson]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- | ASCII code points for common characters+spaceCode, tabCode, newlineCode, returnCode :: TTerm Int+spaceCode = int32 32 -- ' '+tabCode = int32 9 -- '\t'+newlineCode = int32 10 -- '\n'+returnCode = int32 13 -- '\r'++quoteCode, backslashCode, colonCode, commaCode :: TTerm Int+quoteCode = int32 34 -- '"'+backslashCode = int32 92 -- '\\'+colonCode = int32 58 -- ':'+commaCode = int32 44 -- ','++bracketOpenCode, bracketCloseCode, braceOpenCode, braceCloseCode :: TTerm Int+bracketOpenCode = int32 91 -- '['+bracketCloseCode = int32 93 -- ']'+braceOpenCode = int32 123 -- '{'+braceCloseCode = int32 125 -- '}'++zeroCode, nineCode, minusCode, plusCode, dotCode :: TTerm Int+zeroCode = int32 48 -- '0'+nineCode = int32 57 -- '9'+minusCode = int32 45 -- '-'+plusCode = int32 43 -- '+'+dotCode = int32 46 -- '.'++letterELower, letterEUpper :: TTerm Int+letterELower = int32 101 -- 'e'+letterEUpper = int32 69 -- 'E'++letterNCode, letterUCode, letterLCode :: TTerm Int+letterNCode = int32 110 -- 'n'+letterUCode = int32 117 -- 'u'+letterLCode = int32 108 -- 'l'++letterTCode, letterRCode, letterFCode, letterACode, letterSCode :: TTerm Int+letterTCode = int32 116 -- 't'+letterRCode = int32 114 -- 'r'+letterFCode = int32 102 -- 'f'+letterACode = int32 97 -- 'a'+letterSCode = int32 115 -- 's'++letterBCode :: TTerm Int+letterBCode = int32 98 -- 'b'++-- | Parse zero or more whitespace characters+whitespace :: TBinding (Parser ())+whitespace = define "whitespace" $+ doc "Parse zero or more JSON whitespace characters (space, tab, newline, carriage return)" $+ Parsers.map @@ (constant unit) @@+ (Parsers.many @@+ (Parsers.satisfy @@ ("c" ~>+ Logic.ors (list [+ Equality.equal (var "c") spaceCode,+ Equality.equal (var "c") tabCode,+ Equality.equal (var "c") newlineCode,+ Equality.equal (var "c") returnCode]))))++-- | Parse a token followed by optional whitespace+token :: TBinding (Parser a -> Parser a)+token = define "token" $+ doc "Parse a token followed by optional whitespace" $+ "p" ~>+ Parsers.bind @@ var "p" @@ ("x" ~>+ Parsers.bind @@ whitespace @@ (constant $+ Parsers.pure @@ var "x"))++-- | Parse JSON null+jsonNull :: TBinding (Parser J.Value)+jsonNull = define "jsonNull" $+ doc "Parse JSON null value" $+ Parsers.map @@ (constant Json.valueNull) @@+ (token @@ (Parsers.string_ @@ string "null"))++-- | Parse JSON boolean+jsonBool :: TBinding (Parser J.Value)+jsonBool = define "jsonBool" $+ doc "Parse JSON boolean (true or false)" $+ Parsers.alt+ @@ (Parsers.map @@ (constant $ Json.valueBoolean true) @@+ (token @@ (Parsers.string_ @@ string "true")))+ @@ (Parsers.map @@ (constant $ Json.valueBoolean false) @@+ (token @@ (Parsers.string_ @@ string "false")))++-- | Parse a single digit (0-9)+digit :: TBinding (Parser Int)+digit = define "digit" $+ doc "Parse a single digit (0-9)" $+ Parsers.satisfy @@ ("c" ~>+ Logic.and+ (Equality.gte (var "c") zeroCode)+ (Equality.lte (var "c") nineCode))++-- | Parse one or more digits and convert to string+digits :: TBinding (Parser String)+digits = define "digits" $+ doc "Parse one or more digits as a string" $+ Parsers.map @@ (unaryFunction Strings.fromList) @@+ (Parsers.some @@ digit)++-- | Parse the integer part of a JSON number+jsonIntegerPart :: TBinding (Parser String)+jsonIntegerPart = define "jsonIntegerPart" $+ doc "Parse the integer part of a JSON number (optional minus, then digits)" $+ Parsers.bind @@+ (Parsers.optional @@ (Parsers.char @@ minusCode)) @@+ ("sign" ~>+ Parsers.bind @@ digits @@ ("digits" ~>+ Parsers.pure @@+ (Maybes.maybe+ (var "digits")+ (constant $ string "-" ++ var "digits")+ (var "sign"))))++-- | Parse the fractional part of a JSON number+jsonFractionPart :: TBinding (Parser (Maybe String))+jsonFractionPart = define "jsonFractionPart" $+ doc "Parse the optional fractional part of a JSON number" $+ Parsers.optional @@+ (Parsers.bind @@ (Parsers.char @@ dotCode) @@ (constant $+ Parsers.map @@ ("d" ~> string "." ++ var "d") @@ digits))++-- | Parse the exponent part of a JSON number+jsonExponentPart :: TBinding (Parser (Maybe String))+jsonExponentPart = define "jsonExponentPart" $+ doc "Parse the optional exponent part of a JSON number" $+ Parsers.optional @@+ (Parsers.bind @@+ (Parsers.satisfy @@ ("c" ~>+ Logic.or (Equality.equal (var "c") letterELower)+ (Equality.equal (var "c") letterEUpper))) @@+ (constant $+ Parsers.bind @@+ (Parsers.optional @@+ (Parsers.satisfy @@ ("c" ~>+ Logic.or (Equality.equal (var "c") plusCode)+ (Equality.equal (var "c") minusCode)))) @@+ ("sign" ~>+ Parsers.map @@+ ("digits" ~>+ string "e" +++ Maybes.maybe (string "") (unaryFunction Strings.fromList <.> unaryFunction Lists.pure) (var "sign") +++ var "digits") @@+ digits)))++-- | Parse a JSON number+jsonNumber :: TBinding (Parser J.Value)+jsonNumber = define "jsonNumber" $+ doc "Parse a JSON number (integer, decimal, or scientific notation)" $+ token @@+ (Parsers.bind @@ jsonIntegerPart @@ ("intPart" ~>+ Parsers.bind @@ jsonFractionPart @@ ("fracPart" ~>+ Parsers.bind @@ jsonExponentPart @@ ("expPart" ~>+ "numStr" <~+ (var "intPart" +++ Maybes.maybe (string "") (unaryFunction Equality.identity) (var "fracPart") +++ Maybes.maybe (string "") (unaryFunction Equality.identity) (var "expPart")) $+ Parsers.pure @@+ (Json.valueNumber (Maybes.maybe (bigfloat 0.0) (unaryFunction Equality.identity) (Literals.readBigfloat (var "numStr"))))))))++-- | Parse a JSON escape character+jsonEscapeChar :: TBinding (Parser Int)+jsonEscapeChar = define "jsonEscapeChar" $+ doc "Parse a JSON escape sequence after the backslash" $+ Parsers.choice @@ list [+ Parsers.map @@ (constant quoteCode) @@ (Parsers.char @@ quoteCode),+ Parsers.map @@ (constant backslashCode) @@ (Parsers.char @@ backslashCode),+ Parsers.map @@ (constant $ int32 47) @@ (Parsers.char @@ int32 47), -- '/'+ Parsers.map @@ (constant $ int32 8) @@ (Parsers.char @@ letterBCode), -- '\b'+ Parsers.map @@ (constant $ int32 12) @@ (Parsers.char @@ letterFCode), -- '\f'+ Parsers.map @@ (constant newlineCode) @@ (Parsers.char @@ letterNCode), -- '\n'+ Parsers.map @@ (constant returnCode) @@ (Parsers.char @@ letterRCode), -- '\r'+ Parsers.map @@ (constant tabCode) @@ (Parsers.char @@ letterTCode)] -- '\t'+ -- Note: \uXXXX unicode escapes not yet implemented++-- | Parse a single JSON string character+jsonStringChar :: TBinding (Parser Int)+jsonStringChar = define "jsonStringChar" $+ doc "Parse a single character in a JSON string (handling escapes)" $+ Parsers.alt @@+ -- Escape sequence+ (Parsers.bind @@ (Parsers.char @@ backslashCode) @@ (constant $+ jsonEscapeChar)) @@+ -- Regular character (not quote or backslash)+ (Parsers.satisfy @@ ("c" ~>+ Logic.and+ (Logic.not $ Equality.equal (var "c") quoteCode)+ (Logic.not $ Equality.equal (var "c") backslashCode)))++-- | Parse a JSON string+jsonString :: TBinding (Parser J.Value)+jsonString = define "jsonString" $+ doc "Parse a JSON string value" $+ token @@+ (Parsers.bind @@ (Parsers.char @@ quoteCode) @@ (constant $+ Parsers.bind @@ (Parsers.many @@ jsonStringChar) @@ ("chars" ~>+ Parsers.bind @@ (Parsers.char @@ quoteCode) @@ (constant $+ Parsers.pure @@ (Json.valueString (Strings.fromList (var "chars")))))))++-- | Parse a JSON array+jsonArray :: TBinding (Parser J.Value)+jsonArray = define "jsonArray" $+ doc "Parse a JSON array" $+ Parsers.map @@ (unaryFunction Json.valueArray) @@+ (Parsers.between+ @@ (token @@ (Parsers.char @@ bracketOpenCode))+ @@ (token @@ (Parsers.char @@ bracketCloseCode))+ @@ (Parsers.sepBy+ @@ (Parsers.lazy @@ constant jsonValue)+ @@ (token @@ (Parsers.char @@ commaCode))))++-- | Parse a JSON key-value pair+jsonKeyValue :: TBinding (Parser (String, J.Value))+jsonKeyValue = define "jsonKeyValue" $+ doc "Parse a JSON object key-value pair" $+ Parsers.bind @@+ (token @@+ (Parsers.bind @@ (Parsers.char @@ quoteCode) @@ (constant $+ Parsers.bind @@ (Parsers.many @@ jsonStringChar) @@ ("chars" ~>+ Parsers.bind @@ (Parsers.char @@ quoteCode) @@ (constant $+ Parsers.pure @@ (Strings.fromList (var "chars"))))))) @@+ ("key" ~>+ Parsers.bind @@ (token @@ (Parsers.char @@ colonCode)) @@ (constant $+ Parsers.map @@ ("v" ~> pair (var "key") (var "v")) @@ (Parsers.lazy @@ constant jsonValue)))++-- | Parse a JSON object+jsonObject :: TBinding (Parser J.Value)+jsonObject = define "jsonObject" $+ doc "Parse a JSON object" $+ Parsers.map @@ (unaryFunction Json.valueObject <.> unaryFunction Maps.fromList) @@+ (Parsers.between+ @@ (token @@ (Parsers.char @@ braceOpenCode))+ @@ (token @@ (Parsers.char @@ braceCloseCode))+ @@ (Parsers.sepBy+ @@ jsonKeyValue+ @@ (token @@ (Parsers.char @@ commaCode))))++-- | Parse any JSON value+jsonValue :: TBinding (Parser J.Value)+jsonValue = define "jsonValue" $+ doc "Parse any JSON value" $+ Parsers.choice @@ list [+ jsonNull,+ jsonBool,+ jsonNumber,+ jsonString,+ jsonArray,+ jsonObject]++-- | Parse a JSON document (value with optional surrounding whitespace)+parseJson :: TBinding (String -> ParseResult J.Value)+parseJson = define "parseJson" $+ doc "Parse a JSON document from a string" $+ "input" ~>+ Parsing.runParser+ (Parsers.bind @@ whitespace @@ (constant $+ Parsers.bind @@ jsonValue @@ ("v" ~>+ Parsers.bind @@ whitespace @@ (constant $+ Parsers.bind @@ Parsers.eof @@ (constant $+ Parsers.pure @@ var "v")))))+ (var "input")
+ src/main/haskell/Hydra/Sources/Json/Writer.hs view
@@ -0,0 +1,206 @@++module Hydra.Sources.Json.Writer where++-- Standard imports for term-level sources outside of the kernel+import Hydra.Kernel+import Hydra.Sources.Libraries+import Hydra.Dsl.Meta.Lib.Strings as Strings+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Modules as AdaptModules+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.All as KernelTerms+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Languages as Languages+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan+import qualified Hydra.Sources.Kernel.Terms.Templates as Templates+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+import qualified Hydra.Sources.Kernel.Types.All as KernelTypes+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Additional imports+import Hydra.Ast+import qualified Hydra.Json.Model as J+++jsonSerdeDefinition :: String -> TTerm a -> TBinding a+jsonSerdeDefinition = definitionInModule module_++module_ :: Module+module_ = Module ns elements+ [Serialization.ns]+ KernelTypes.kernelTypesNamespaces $+ Just "JSON serialization functions using the Hydra AST"+ where+ ns = Namespace "hydra.json.writer"+ elements = [+ toBinding colonOp,+ toBinding jsonString,+ toBinding keyValueToExpr,+ toBinding printJson,+ toBinding valueToExpr]++colonOp :: TBinding Op+colonOp = jsonSerdeDefinition "colonOp" $+ doc "The colon operator used to separate keys and values in JSON objects" $+ Ast.op+ (Ast.symbol $ string ":")+ (Ast.padding Ast.wsNone Ast.wsSpace)+ (Ast.precedence $ int32 0)+ Ast.associativityNone++-- | ASCII codepoints for characters that need escaping+quoteCode, backslashCode, backspaceCode, formfeedCode, newlineCode, returnCode, tabCode :: TTerm Int+quoteCode = int32 34 -- '"'+backslashCode = int32 92 -- '\\'+backspaceCode = int32 8 -- '\b'+formfeedCode = int32 12 -- '\f'+newlineCode = int32 10 -- '\n'+returnCode = int32 13 -- '\r'+tabCode = int32 9 -- '\t'++hexDigits :: TTerm String+hexDigits = string "0123456789abcdef"++jsonString :: TBinding (String -> String)+jsonString = jsonSerdeDefinition "jsonString" $+ doc "Escape and quote a string for JSON output" $+ "s" ~>+ -- hexEscape: encode a control character as \\u00XX+ "hexEscape" <~ ("c" ~>+ "hi" <~ Strings.fromList (Lists.pure (Strings.charAt (Math.div (var "c") (int32 16)) hexDigits)) $+ "lo" <~ Strings.fromList (Lists.pure (Strings.charAt (Math.mod (var "c") (int32 16)) hexDigits)) $+ string "\\u00" ++ var "hi" ++ var "lo") $+ -- escape function takes a codepoint (Int) and returns a String+ "escape" <~ ("c" ~>+ Logic.ifElse (Equality.equal (var "c") quoteCode)+ (string "\\\"")+ (Logic.ifElse (Equality.equal (var "c") backslashCode)+ (string "\\\\")+ (Logic.ifElse (Equality.equal (var "c") backspaceCode)+ (string "\\b")+ (Logic.ifElse (Equality.equal (var "c") formfeedCode)+ (string "\\f")+ (Logic.ifElse (Equality.equal (var "c") newlineCode)+ (string "\\n")+ (Logic.ifElse (Equality.equal (var "c") returnCode)+ (string "\\r")+ (Logic.ifElse (Equality.equal (var "c") tabCode)+ (string "\\t")+ -- Escape any other control character (< 0x20) as \u00XX+ (Logic.ifElse (Equality.lt (var "c") (int32 32))+ (var "hexEscape" @@ var "c")+ -- Non-control character: pass through as-is+ (Strings.fromList (Lists.pure (var "c"))))))))))) $+ "escaped" <~ Strings.cat (Lists.map (var "escape") (Strings.toList $ var "s")) $+ string "\"" ++ var "escaped" ++ string "\""++keyValueToExpr :: TBinding ((String, J.Value) -> Expr)+keyValueToExpr = jsonSerdeDefinition "keyValueToExpr" $+ doc "Convert a key-value pair to an AST expression" $+ "pair" ~>+ "key" <~ Pairs.first (var "pair") $+ "value" <~ Pairs.second (var "pair") $+ Serialization.ifx @@ colonOp+ @@ (Serialization.cst @@ (jsonString @@ var "key"))+ @@ (valueToExpr @@ var "value")++valueToExpr :: TBinding (J.Value -> Expr)+valueToExpr = jsonSerdeDefinition "valueToExpr" $+ doc "Convert a JSON value to an AST expression for serialization" $+ "value" ~>+ cases J._Value (var "value") Nothing [+ J._Value_array>>: "arr" ~>+ Serialization.bracketListAdaptive @@ (Lists.map (valueToExpr) (var "arr")),+ J._Value_boolean>>: "b" ~>+ Serialization.cst @@ (Logic.ifElse (var "b") (string "true") (string "false")),+ J._Value_null>>: constant $+ Serialization.cst @@ string "null",+ J._Value_number>>: "n" ~>+ -- For whole numbers, omit the decimal point (e.g., 15 instead of 15.0)+ "rounded" <~ Literals.bigfloatToBigint (var "n") $+ Serialization.cst @@ (Logic.ifElse+ (Equality.equal (var "n") (Literals.bigintToBigfloat $ var "rounded"))+ (Literals.showBigint $ var "rounded")+ (Literals.showBigfloat $ var "n")),+ J._Value_object>>: "obj" ~>+ Serialization.bracesListAdaptive @@ (Lists.map (keyValueToExpr) (Maps.toList $ var "obj")),+ J._Value_string>>: "s" ~>+ Serialization.cst @@ (jsonString @@ var "s")]++printJson :: TBinding (J.Value -> String)+printJson = jsonSerdeDefinition "printJson" $+ doc "Serialize a JSON value to a string" $+ "value" ~> Serialization.printExpr @@ (valueToExpr @@ var "value")
src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Literals.hs view
@@ -1,318 +1,369 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Adapt.Literals where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (comparePrecision, convertFloatValue, convertIntegerValue, disclaimer, floatAdapter, integerAdapter, literalAdapter) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore +ns :: Namespace+ns = Namespace "hydra.adapt.literals"+ module_ :: Module-module_ = Module (Namespace "hydra.adapt.literals") elements- [ExtractCore.module_, Monads.module_, DescribeCore.module_, AdaptUtils.module_, ShowCore.module_, Variants.module_]- kernelTypesModules $+module_ = Module ns elements+ [AdaptUtils.ns, ExtractCore.ns, Monads.ns, Reflect.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just "Adapter framework for literal types and terms" where elements = [- el comparePrecisionDef,- el convertFloatValueDef,- el convertIntegerValueDef,- el disclaimerDef,- el literalAdapterDef,- el floatAdapterDef,- el integerAdapterDef]+ toBinding comparePrecision,+ toBinding convertFloatValue,+ toBinding convertIntegerValue,+ toBinding disclaimer,+ toBinding literalAdapter,+ toBinding floatAdapter,+ toBinding integerAdapter] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -comparePrecisionDef :: TBinding (Precision -> Precision -> Comparison)-comparePrecisionDef = define "comparePrecision" $+comparePrecision :: TBinding (Precision -> Precision -> Comparison)+comparePrecision = define "comparePrecision" $ doc "Compare two precision values" $- lambdas ["p1", "p2"] $- cases _Precision (var "p1") Nothing [- _Precision_arbitrary>>: constant $- cases _Precision (var "p2") Nothing [- _Precision_arbitrary>>: constant Graph.comparisonEqualTo,- _Precision_bits>>: constant Graph.comparisonGreaterThan],- _Precision_bits>>: lambda "b1" $- cases _Precision (var "p2") Nothing [- _Precision_arbitrary>>: constant Graph.comparisonLessThan,- _Precision_bits>>: lambda "b2" $- Logic.ifElse (Equality.lt (var "b1") (var "b2"))- Graph.comparisonLessThan- Graph.comparisonGreaterThan]]+ "p1" ~> "p2" ~>+ cases _Precision (var "p1")+ Nothing [+ _Precision_arbitrary>>: constant (+ cases _Precision (var "p2")+ Nothing [+ _Precision_arbitrary>>: constant Graph.comparisonEqualTo,+ _Precision_bits>>: constant Graph.comparisonGreaterThan]),+ _Precision_bits>>: "b1" ~>+ cases _Precision (var "p2")+ Nothing [+ _Precision_arbitrary>>: constant Graph.comparisonLessThan,+ _Precision_bits>>: "b2" ~>+ Logic.ifElse (Equality.lt (var "b1") (var "b2"))+ Graph.comparisonLessThan+ Graph.comparisonGreaterThan]] -convertFloatValueDef :: TBinding (FloatType -> FloatValue -> FloatValue)-convertFloatValueDef = define "convertFloatValue" $+convertFloatValue :: TBinding (FloatType -> FloatValue -> FloatValue)+convertFloatValue = define "convertFloatValue" $ doc "Convert a float value to a different float type" $- lambdas ["target", "fv"] $ lets [- "decoder">: lambda "fv" $- cases _FloatValue (var "fv") Nothing [- _FloatValue_bigfloat>>: lambda "d" $ var "d",- _FloatValue_float32>>: lambda "f" $ Literals.float32ToBigfloat $ var "f",- _FloatValue_float64>>: lambda "d" $ Literals.float64ToBigfloat $ var "d"],- "encoder">: lambda "d" $- cases _FloatType (var "target") Nothing [- _FloatType_bigfloat>>: constant $ Core.floatValueBigfloat $ var "d",- _FloatType_float32>>: constant $ Core.floatValueFloat32 $ Literals.bigfloatToFloat32 $ var "d",- _FloatType_float64>>: constant $ Core.floatValueFloat64 $ Literals.bigfloatToFloat64 $ var "d"]]- $ var "encoder" @@ (var "decoder" @@ var "fv")+ "target" ~> "fv" ~>+ "decoder" <~ ("fv" ~>+ cases _FloatValue (var "fv")+ Nothing [+ _FloatValue_bigfloat>>: "d" ~> var "d",+ _FloatValue_float32>>: "f" ~> Literals.float32ToBigfloat (var "f"),+ _FloatValue_float64>>: "d" ~> Literals.float64ToBigfloat (var "d")]) $+ "encoder" <~ ("d" ~>+ cases _FloatType (var "target")+ Nothing [+ _FloatType_bigfloat>>: constant (Core.floatValueBigfloat (var "d")),+ _FloatType_float32>>: constant (Core.floatValueFloat32 (Literals.bigfloatToFloat32 (var "d"))),+ _FloatType_float64>>: constant (Core.floatValueFloat64 (Literals.bigfloatToFloat64 (var "d")))]) $+ var "encoder" @@ (var "decoder" @@ var "fv") -convertIntegerValueDef :: TBinding (IntegerType -> IntegerValue -> IntegerValue)-convertIntegerValueDef = define "convertIntegerValue" $+convertIntegerValue :: TBinding (IntegerType -> IntegerValue -> IntegerValue)+convertIntegerValue = define "convertIntegerValue" $ doc "Convert an integer value to a different integer type" $- lambdas ["target", "iv"] $ lets [- "decoder">: lambda "iv" $- cases _IntegerValue (var "iv") Nothing [- _IntegerValue_bigint>>: lambda "v" $ var "v",- _IntegerValue_int8>>: lambda "v" $ Literals.int8ToBigint $ var "v",- _IntegerValue_int16>>: lambda "v" $ Literals.int16ToBigint $ var "v",- _IntegerValue_int32>>: lambda "v" $ Literals.int32ToBigint $ var "v",- _IntegerValue_int64>>: lambda "v" $ Literals.int64ToBigint $ var "v",- _IntegerValue_uint8>>: lambda "v" $ Literals.uint8ToBigint $ var "v",- _IntegerValue_uint16>>: lambda "v" $ Literals.uint16ToBigint $ var "v",- _IntegerValue_uint32>>: lambda "v" $ Literals.uint32ToBigint $ var "v",- _IntegerValue_uint64>>: lambda "v" $ Literals.uint64ToBigint $ var "v"],- "encoder">: lambda "d" $- cases _IntegerType (var "target") Nothing [- _IntegerType_bigint>>: constant $ Core.integerValueBigint $ var "d",- _IntegerType_int8>>: constant $ Core.integerValueInt8 $ Literals.bigintToInt8 $ var "d",- _IntegerType_int16>>: constant $ Core.integerValueInt16 $ Literals.bigintToInt16 $ var "d",- _IntegerType_int32>>: constant $ Core.integerValueInt32 $ Literals.bigintToInt32 $ var "d",- _IntegerType_int64>>: constant $ Core.integerValueInt64 $ Literals.bigintToInt64 $ var "d",- _IntegerType_uint8>>: constant $ Core.integerValueUint8 $ Literals.bigintToUint8 $ var "d",- _IntegerType_uint16>>: constant $ Core.integerValueUint16 $ Literals.bigintToUint16 $ var "d",- _IntegerType_uint32>>: constant $ Core.integerValueUint32 $ Literals.bigintToUint32 $ var "d",- _IntegerType_uint64>>: constant $ Core.integerValueUint64 $ Literals.bigintToUint64 $ var "d"]]- $ var "encoder" @@ (var "decoder" @@ var "iv")+ "target" ~> "iv" ~>+ "decoder" <~ ("iv" ~>+ cases _IntegerValue (var "iv")+ Nothing [+ _IntegerValue_bigint>>: "v" ~> var "v",+ _IntegerValue_int8>>: "v" ~> Literals.int8ToBigint (var "v"),+ _IntegerValue_int16>>: "v" ~> Literals.int16ToBigint (var "v"),+ _IntegerValue_int32>>: "v" ~> Literals.int32ToBigint (var "v"),+ _IntegerValue_int64>>: "v" ~> Literals.int64ToBigint (var "v"),+ _IntegerValue_uint8>>: "v" ~> Literals.uint8ToBigint (var "v"),+ _IntegerValue_uint16>>: "v" ~> Literals.uint16ToBigint (var "v"),+ _IntegerValue_uint32>>: "v" ~> Literals.uint32ToBigint (var "v"),+ _IntegerValue_uint64>>: "v" ~> Literals.uint64ToBigint (var "v")]) $+ "encoder" <~ ("d" ~>+ cases _IntegerType (var "target")+ Nothing [+ _IntegerType_bigint>>: constant (Core.integerValueBigint (var "d")),+ _IntegerType_int8>>: constant (Core.integerValueInt8 (Literals.bigintToInt8 (var "d"))),+ _IntegerType_int16>>: constant (Core.integerValueInt16 (Literals.bigintToInt16 (var "d"))),+ _IntegerType_int32>>: constant (Core.integerValueInt32 (Literals.bigintToInt32 (var "d"))),+ _IntegerType_int64>>: constant (Core.integerValueInt64 (Literals.bigintToInt64 (var "d"))),+ _IntegerType_uint8>>: constant (Core.integerValueUint8 (Literals.bigintToUint8 (var "d"))),+ _IntegerType_uint16>>: constant (Core.integerValueUint16 (Literals.bigintToUint16 (var "d"))),+ _IntegerType_uint32>>: constant (Core.integerValueUint32 (Literals.bigintToUint32 (var "d"))),+ _IntegerType_uint64>>: constant (Core.integerValueUint64 (Literals.bigintToUint64 (var "d")))]) $+ var "encoder" @@ (var "decoder" @@ var "iv") -disclaimerDef :: TBinding (Bool -> String -> String -> String)-disclaimerDef = define "disclaimer" $+disclaimer :: TBinding (Bool -> String -> String -> String)+disclaimer = define "disclaimer" $ doc "Generate a disclaimer message for type conversions" $- lambdas ["lossy", "source", "target"] $- Strings.cat $ list [- string "replace ",- var "source",- string " with ",- var "target",- Logic.ifElse (var "lossy") (string " (lossy)") (string "")]+ "lossy" ~> "source" ~> "target" ~>+ Strings.cat (list [+ string "replace ",+ var "source",+ string " with ",+ var "target",+ Logic.ifElse (var "lossy") (string " (lossy)") (string "")]) -literalAdapterDef :: TBinding (LiteralType -> Flow AdapterContext (SymmetricAdapter s LiteralType Literal))-literalAdapterDef = define "literalAdapter" $- doc "Create an adapter for literal types" $- lambda "lt" $ lets [- "alts">: lambda "t" $ cases _LiteralType (var "t") Nothing [- _LiteralType_binary>>: constant $ lets [- "step">: Compute.coder- (lambda "lit" $ cases _Literal (var "lit") Nothing [- _Literal_binary>>: lambda "b" $ Flows.pure $ Core.literalString $ Literals.binaryToString $ var "b"])- (lambda "lit" $ cases _Literal (var "lit") Nothing [- _Literal_string>>: lambda "s" $ Flows.pure $ Core.literalBinary $ Literals.stringToBinary $ var "s"])] $- Flows.pure $ list [Compute.adapter false (var "t") Core.literalTypeString (var "step")],- _LiteralType_boolean>>: constant $- bind "cx" (ref Monads.getStateDef) $ lets [- "constraints">: Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx",- "hasIntegers">: Logic.not $ Sets.null $ Coders.languageConstraintsIntegerTypes $ var "constraints",- "hasStrings">: Sets.member Mantle.literalVariantString (Coders.languageConstraintsLiteralVariants $ var "constraints")] $- Logic.ifElse (var "hasIntegers")- (bind "adapter" (ref integerAdapterDef @@ Core.integerTypeUint8) $ lets [- "step'">: Compute.adapterCoder $ var "adapter",- "step">: Compute.coder- (lambda "lit" $ cases _Literal (var "lit") Nothing [- _Literal_boolean>>: lambda "bv" $ Flows.bind- (Compute.coderEncode (var "step'") @@ (Core.integerValueUint8 $ Logic.ifElse (var "bv") (uint8 1) (uint8 0)))- (lambda "iv" $ Flows.pure $ Core.literalInteger $ var "iv")])- (lambda "lit" $ cases _Literal (var "lit") Nothing [- _Literal_integer>>: lambda "iv" $ Flows.bind- (Compute.coderDecode (var "step'") @@ var "iv")- (lambda "val" $ cases _IntegerValue (var "val") Nothing [- _IntegerValue_uint8>>: lambda "v" $ Flows.pure $ Core.literalBoolean $ Equality.equal (var "v") (uint8 1)])])] $- Flows.pure $ list [Compute.adapter false (var "t") (Core.literalTypeInteger $ Compute.adapterTarget $ var "adapter") (var "step")])- (Logic.ifElse (var "hasStrings")- (Flows.pure $ lets [- "encode">: lambda "lit" $- bind "b" (ref ExtractCore.booleanLiteralDef @@ var "lit") $- Flows.pure $ Core.literalString $ Logic.ifElse (var "b") "true" "false",- "decode">: lambda "lit" $- bind "s" (ref ExtractCore.stringLiteralDef @@ var "lit") $- Logic.ifElse (Equality.equal (var "s") (string "true"))- (Flows.pure $ Core.literalBoolean true)- (Logic.ifElse (Equality.equal (var "s") (string "false"))- (Flows.pure $ Core.literalBoolean false)- (ref Monads.unexpectedDef @@ "boolean literal" @@ var "s"))] $- list [Compute.adapter false (var "t") Core.literalTypeString (Compute.coder (var "encode") (var "decode"))])- (Flows.fail $ string "no alternatives available for boolean encoding")),- _LiteralType_float>>: lambda "ft" $- Flows.bind (ref Monads.getStateDef) $ lambda "cx" $ lets [- "constraints">: Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx",- "hasFloats">: Logic.not $ Sets.null $ Coders.languageConstraintsFloatTypes $ var "constraints"] $- Logic.ifElse (var "hasFloats")- (Flows.bind (ref floatAdapterDef @@ var "ft") $ lambda "adapter" $ lets [- "step">: ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "l"] $- cases _Literal (var "l") (Just $ ref Monads.unexpectedDef @@ string "floating-point literal" @@ (ref ShowCore.literalDef @@ var "l")) [- _Literal_float>>: lambda "fv" $ Flows.map (unaryFunction Core.literalFloat) $- ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "adapter") @@ var "fv"])] $- Flows.pure $ list [Compute.adapter (Compute.adapterIsLossy $ var "adapter") (var "t") (Core.literalTypeFloat $ Compute.adapterTarget $ var "adapter") (var "step")])- (Flows.fail $ string "no float types available"),- _LiteralType_integer>>: lambda "it" $- Flows.bind (ref Monads.getStateDef) $ lambda "cx" $ lets [- "constraints">: Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx",- "hasIntegers">: Logic.not $ Sets.null $ Coders.languageConstraintsIntegerTypes $ var "constraints"] $- Logic.ifElse (var "hasIntegers")- (Flows.bind (ref integerAdapterDef @@ var "it") $ lambda "adapter" $ lets [- "step">: ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "lit"] $- cases _Literal (var "lit") (Just $ ref Monads.unexpectedDef @@ string "integer literal" @@ (ref ShowCore.literalDef @@ var "lit")) [- _Literal_integer>>: lambda "iv" $ Flows.map (unaryFunction Core.literalInteger) $- ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "adapter") @@ var "iv"])] $- Flows.pure $ list [Compute.adapter (Compute.adapterIsLossy $ var "adapter") (var "t") (Core.literalTypeInteger $ Compute.adapterTarget $ var "adapter") (var "step")])- (Flows.fail $ string "no integer types available"),- _LiteralType_string>>: constant $ Flows.fail $ string "no substitute for the literal string type"]] $- Flows.bind (ref Monads.getStateDef) $ lambda "cx" $ lets [- "supported">: ref AdaptUtils.literalTypeIsSupportedDef @@ (Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx")] $- ref AdaptUtils.chooseAdapterDef+floatAdapter :: TBinding (FloatType -> Flow AdapterContext (SymmetricAdapter s FloatType FloatValue))+floatAdapter = define "floatAdapter" $+ doc "Create an adapter for float types" $+ "ft" ~>+ "makeAdapter" <~ ("source" ~> "target" ~>+ "lossy" <~ Equality.equal+ (comparePrecision+ @@ (Reflect.floatTypePrecision @@ var "source")+ @@ (Reflect.floatTypePrecision @@ var "target"))+ Graph.comparisonGreaterThan $+ "step" <~ Compute.coder+ ("fv" ~> produce (convertFloatValue @@ var "target" @@ var "fv"))+ ("fv" ~> produce (convertFloatValue @@ var "source" @@ var "fv")) $+ "msg" <~ disclaimer+ @@ var "lossy"+ @@ (ShowCore.floatType @@ var "source")+ @@ (ShowCore.floatType @@ var "target") $+ Monads.warn+ @@ var "msg"+ @@ (produce (Compute.adapter (var "lossy") (var "source") (var "target") (var "step")))) $+ "altTypes" <~ ("t" ~> cases _FloatType (var "t")+ Nothing [+ _FloatType_bigfloat>>: constant (list [Core.floatTypeFloat64, Core.floatTypeFloat32]),+ _FloatType_float32>>: constant (list [Core.floatTypeFloat64, Core.floatTypeBigfloat]),+ _FloatType_float64>>: constant (list [Core.floatTypeBigfloat, Core.floatTypeFloat32])]) $+ "alts" <~ ("t" ~> Flows.mapList (var "makeAdapter" @@ var "t") (var "altTypes" @@ var "t")) $+ "cx" <<~ Monads.getState $+ "supported" <~ AdaptUtils.floatTypeIsSupported+ @@ (Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx"))) $+ AdaptUtils.chooseAdapter @@ var "alts" @@ var "supported"- @@ ref ShowCore.literalTypeDef- @@ ref DescribeCore.literalTypeDef- @@ var "lt"--floatAdapterDef :: TBinding (FloatType -> Flow AdapterContext (SymmetricAdapter s FloatType FloatValue))-floatAdapterDef = define "floatAdapter" $- doc "Create an adapter for float types" $- lambda "ft" $ lets [- "alts">: lambda "t" $ Flows.mapList (var "makeAdapter" @@ var "t") $ cases _FloatType (var "t") Nothing [- _FloatType_bigfloat>>: constant $ list [Core.floatTypeFloat64, Core.floatTypeFloat32],- _FloatType_float32>>: constant $ list [Core.floatTypeFloat64, Core.floatTypeBigfloat],- _FloatType_float64>>: constant $ list [Core.floatTypeBigfloat, Core.floatTypeFloat32]],- "makeAdapter">: lambdas ["source", "target"] $ lets [- "lossy">: Equality.equal- (ref comparePrecisionDef- @@ (ref Variants.floatTypePrecisionDef @@ var "source")- @@ (ref Variants.floatTypePrecisionDef @@ var "target"))- Graph.comparisonGreaterThan,- "step">: Compute.coder- (lambda "fv" $ Flows.pure $ ref convertFloatValueDef @@ var "target" @@ var "fv")- (lambda "fv" $ Flows.pure $ ref convertFloatValueDef @@ var "source" @@ var "fv"),- "msg">: ref disclaimerDef- @@ var "lossy"- @@ (ref DescribeCore.floatTypeDef @@ var "source")- @@ (ref DescribeCore.floatTypeDef @@ var "target")] $- ref Monads.warnDef- @@ var "msg"- @@ (Flows.pure (Compute.adapter (var "lossy") (var "source") (var "target") (var "step")))] $- Flows.bind (ref Monads.getStateDef) $ lambda "cx" $- lets [- "supported">: ref AdaptUtils.floatTypeIsSupportedDef- @@ (Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx")] $- ref AdaptUtils.chooseAdapterDef- @@ var "alts"- @@ var "supported"- @@ ref ShowCore.floatTypeDef- @@ ref DescribeCore.floatTypeDef- @@ var "ft"+ @@ ShowCore.floatType+ @@ ShowCore.floatType+ @@ var "ft" -integerAdapterDef :: TBinding (IntegerType -> Flow AdapterContext (SymmetricAdapter s IntegerType IntegerValue))-integerAdapterDef = define "integerAdapter" $+integerAdapter :: TBinding (IntegerType -> Flow AdapterContext (SymmetricAdapter s IntegerType IntegerValue))+integerAdapter = define "integerAdapter" $ doc "Create an adapter for integer types" $- lambda "it" $ lets [- "interleave">: lambdas ["xs", "ys"] $ Lists.concat $ Lists.transpose $ list [var "xs", var "ys"],- "signedOrdered">: Lists.filter- (lambda "v" $ Logic.and- (ref Variants.integerTypeIsSignedDef @@ var "v")- (Logic.not $ Equality.equal (ref Variants.integerTypePrecisionDef @@ var "v") Mantle.precisionArbitrary))- (ref Variants.integerTypesDef),- "unsignedOrdered">: Lists.filter- (lambda "v" $ Logic.and- (Logic.not $ ref Variants.integerTypeIsSignedDef @@ var "v")- (Logic.not $ Equality.equal (ref Variants.integerTypePrecisionDef @@ var "v") Mantle.precisionArbitrary))- (ref Variants.integerTypesDef),- "signedPref">: var "interleave" @@ var "signedOrdered" @@ var "unsignedOrdered",- "unsignedPref">: var "interleave" @@ var "unsignedOrdered" @@ var "signedOrdered",- "signedNonPref">: Lists.reverse $ var "unsignedPref",- "unsignedNonPref">: Lists.reverse $ var "signedPref",- "signed">: lambda "i" $ Lists.concat $ list [- Lists.drop (Math.mul (var "i") (int32 2)) (var "signedPref"),- list [Core.integerTypeBigint],- Lists.drop (Math.add (Math.sub (int32 8) (Math.mul (var "i") (int32 2))) (int32 1)) (var "signedNonPref")],- "unsigned">: lambda "i" $ Lists.concat $ list [- Lists.drop (Math.mul (var "i") (int32 2)) (var "unsignedPref"),- list [Core.integerTypeBigint],- Lists.drop (Math.add (Math.sub (int32 8) (Math.mul (var "i") (int32 2))) (int32 1)) (var "unsignedNonPref")],- "alts">: lambda "t" $ Flows.mapList (var "makeAdapter" @@ var "t") $ cases _IntegerType (var "t") Nothing [- _IntegerType_bigint>>: constant $ Lists.reverse $ var "unsignedPref",- _IntegerType_int8>>: constant $ var "signed" @@ int32 1,- _IntegerType_int16>>: constant $ var "signed" @@ int32 2,- _IntegerType_int32>>: constant $ var "signed" @@ int32 3,- _IntegerType_int64>>: constant $ var "signed" @@ int32 4,- _IntegerType_uint8>>: constant $ var "unsigned" @@ int32 1,- _IntegerType_uint16>>: constant $ var "unsigned" @@ int32 2,- _IntegerType_uint32>>: constant $ var "unsigned" @@ int32 3,- _IntegerType_uint64>>: constant $ var "unsigned" @@ int32 4],- "makeAdapter">: lambdas ["source", "target"] $ lets [- "lossy">: Logic.not $ Equality.equal- (ref comparePrecisionDef- @@ (ref Variants.integerTypePrecisionDef @@ var "source")- @@ (ref Variants.integerTypePrecisionDef @@ var "target"))- Graph.comparisonLessThan,- "step">: Compute.coder- (lambda "iv" $ Flows.pure $ ref convertIntegerValueDef @@ var "target" @@ var "iv")- (lambda "iv" $ Flows.pure $ ref convertIntegerValueDef @@ var "source" @@ var "iv"),- "msg">: ref disclaimerDef- @@ var "lossy"- @@ (ref DescribeCore.integerTypeDef @@ var "source")- @@ (ref DescribeCore.integerTypeDef @@ var "target")] $- ref Monads.warnDef- @@ var "msg"- @@ (Flows.pure $ Compute.adapter (var "lossy") (var "source") (var "target") (var "step"))] $- Flows.bind (ref Monads.getStateDef) $ lambda "cx" $- lets [- "supported">: ref AdaptUtils.integerTypeIsSupportedDef- @@ (Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx")] $- ref AdaptUtils.chooseAdapterDef- @@ var "alts"- @@ var "supported"- @@ ref ShowCore.integerTypeDef- @@ ref DescribeCore.integerTypeDef- @@ var "it"+ "it" ~>+ "interleave" <~ ("xs" ~> "ys" ~> Lists.concat (Lists.transpose (list [var "xs", var "ys"]))) $+ "signedOrdered" <~ Lists.filter+ ("v" ~> Logic.and+ (Reflect.integerTypeIsSigned @@ var "v")+ (Logic.not (Equality.equal (Reflect.integerTypePrecision @@ var "v") Util.precisionArbitrary)))+ (Reflect.integerTypes) $+ "unsignedOrdered" <~ Lists.filter+ ("v" ~> Logic.and+ (Logic.not (Reflect.integerTypeIsSigned @@ var "v"))+ (Logic.not (Equality.equal (Reflect.integerTypePrecision @@ var "v") Util.precisionArbitrary)))+ (Reflect.integerTypes) $+ "signedPref" <~ var "interleave" @@ var "signedOrdered" @@ var "unsignedOrdered" $+ "unsignedPref" <~ var "interleave" @@ var "unsignedOrdered" @@ var "signedOrdered" $+ "signedNonPref" <~ Lists.reverse (var "unsignedPref") $+ "unsignedNonPref" <~ Lists.reverse (var "signedPref") $+ "signed" <~ ("i" ~> Lists.concat (list [+ Lists.drop (Math.mul (var "i") (int32 2)) (var "signedPref"),+ list [Core.integerTypeBigint],+ Lists.drop (Math.add (Math.sub (int32 8) (Math.mul (var "i") (int32 2))) (int32 1)) (var "signedNonPref")])) $+ "unsigned" <~ ("i" ~> Lists.concat (list [+ Lists.drop (Math.mul (var "i") (int32 2)) (var "unsignedPref"),+ list [Core.integerTypeBigint],+ Lists.drop (Math.add (Math.sub (int32 8) (Math.mul (var "i") (int32 2))) (int32 1)) (var "unsignedNonPref")])) $+ "makeAdapter" <~ ("source" ~> "target" ~>+ "lossy" <~ Logic.not (Equality.equal+ (comparePrecision+ @@ (Reflect.integerTypePrecision @@ var "source")+ @@ (Reflect.integerTypePrecision @@ var "target"))+ Graph.comparisonLessThan) $+ "step" <~ Compute.coder+ ("iv" ~> produce (convertIntegerValue @@ var "target" @@ var "iv"))+ ("iv" ~> produce (convertIntegerValue @@ var "source" @@ var "iv")) $+ "msg" <~ disclaimer+ @@ var "lossy"+ @@ (ShowCore.integerType @@ var "source")+ @@ (ShowCore.integerType @@ var "target") $+ Monads.warn+ @@ var "msg"+ @@ (produce (Compute.adapter (var "lossy") (var "source") (var "target") (var "step")))) $+ "altTypes" <~ ("t" ~> cases _IntegerType (var "t")+ Nothing [+ _IntegerType_bigint>>: constant (Lists.reverse (var "unsignedPref")),+ _IntegerType_int8>>: constant (var "signed" @@ int32 1),+ _IntegerType_int16>>: constant (var "signed" @@ int32 2),+ _IntegerType_int32>>: constant (var "signed" @@ int32 3),+ _IntegerType_int64>>: constant (var "signed" @@ int32 4),+ _IntegerType_uint8>>: constant (var "unsigned" @@ int32 1),+ _IntegerType_uint16>>: constant (var "unsigned" @@ int32 2),+ _IntegerType_uint32>>: constant (var "unsigned" @@ int32 3),+ _IntegerType_uint64>>: constant (var "unsigned" @@ int32 4)]) $+ "alts" <~ ("t" ~> Flows.mapList (var "makeAdapter" @@ var "t") (var "altTypes" @@ var "t")) $+ "cx" <<~ Monads.getState $+ "supported" <~ AdaptUtils.integerTypeIsSupported+ @@ (Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx"))) $+ AdaptUtils.chooseAdapter+ @@ var "alts"+ @@ var "supported"+ @@ ShowCore.integerType+ @@ ShowCore.integerType+ @@ var "it"++literalAdapter :: TBinding (LiteralType -> Flow AdapterContext (SymmetricAdapter s LiteralType Literal))+literalAdapter = define "literalAdapter" $+ doc "Create an adapter for literal types" $+ "lt" ~>+ "forBinary" <~ ("t" ~>+ "matchBinary" <~ ("lit" ~> cases _Literal (var "lit")+ Nothing [+ _Literal_binary>>: "b" ~> Flows.pure (Core.literalString (Literals.binaryToString (var "b")))]) $+ "matchString" <~ ("lit" ~> cases _Literal (var "lit")+ Nothing [+ _Literal_string>>: "s" ~> Flows.pure (Core.literalBinary (Literals.stringToBinary (var "s")))]) $+ "step" <~ Compute.coder (var "matchBinary") (var "matchString") $+ produce (list [Compute.adapter false (var "t") Core.literalTypeString (var "step")])) $+ "forBoolean" <~ ("t" ~>+ "matchBoolean" <~ ("step'" ~> "lit" ~> cases _Literal (var "lit")+ Nothing [+ _Literal_boolean>>: "bv" ~>+ "iv" <<~ Compute.coderEncode (var "step'") @@ (Core.integerValueUint8 (Logic.ifElse (var "bv") (uint8 1) (uint8 0))) $+ produce (Core.literalInteger (var "iv"))]) $+ "matchInteger" <~ ("step'" ~> "lit" ~>+ "forValue" <~ ("val" ~> cases _IntegerValue (var "val")+ Nothing [+ _IntegerValue_uint8>>: "v" ~> Core.literalBoolean (Equality.equal (var "v") (uint8 1))]) $+ cases _Literal (var "lit")+ Nothing [+ _Literal_integer>>: "iv" ~>+ "val" <<~ Compute.coderDecode (var "step'") @@ var "iv" $+ produce $ var "forValue" @@ var "val"]) $+ "cx" <<~ Monads.getState $+ "constraints" <~ Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx")) $+ "hasIntegers" <~ Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes (var "constraints"))) $+ "hasStrings" <~ Sets.member Variants.literalVariantString (Coders.languageConstraintsLiteralVariants (var "constraints")) $+ "withIntegers" <~ (+ "withAdapter" <~ ("adapter" ~>+ "step'" <~ Compute.adapterCoder (var "adapter") $+ "step" <~ Compute.coder (var "matchBoolean" @@ var "step'") (var "matchInteger" @@ var "step'") $+ produce (list [Compute.adapter false (var "t") (Core.literalTypeInteger (Compute.adapterTarget (var "adapter"))) (var "step")])) $+ "adapter" <<~ integerAdapter @@ Core.integerTypeUint8 $+ var "withAdapter" @@ var "adapter") $+ "withStrings" <~ (+ "encode" <~ ("lit" ~>+ "b" <<~ ExtractCore.booleanLiteral @@ var "lit" $+ produce (Core.literalString (Logic.ifElse (var "b") (string "true") (string "false")))) $+ "decode" <~ ("lit" ~>+ "s" <<~ ExtractCore.stringLiteral @@ var "lit" $+ Logic.ifElse (Equality.equal (var "s") (string "true"))+ (produce (Core.literalBoolean true))+ (Logic.ifElse (Equality.equal (var "s") (string "false"))+ (produce (Core.literalBoolean false))+ (Monads.unexpected @@ (string "boolean literal") @@ var "s"))) $+ list [Compute.adapter false (var "t") Core.literalTypeString (Compute.coder (var "encode") (var "decode"))]) $+ Logic.ifElse (var "hasIntegers")+ (var "withIntegers")+ (Logic.ifElse (var "hasStrings")+ (produce $ var "withStrings")+ (Flows.fail (string "no alternatives available for boolean encoding")))) $+ "forFloat" <~ ("t" ~> "ft" ~>+ "withFloats" <~ (+ "adapt" <~ ("adapter" ~> "dir" ~> "l" ~> cases _Literal (var "l")+ (Just (Monads.unexpected+ @@ (string "floating-point literal")+ @@ (ShowCore.literal @@ var "l"))) [+ _Literal_float>>: "fv" ~> Flows.map (unaryFunction Core.literalFloat) (+ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "adapter")) @@ var "fv")]) $+ "adapter" <<~ floatAdapter @@ var "ft" $+ "step" <~ AdaptUtils.bidirectional @@ (var "adapt" @@ var "adapter") $+ produce (list [Compute.adapter (Compute.adapterIsLossy (var "adapter")) (var "t") (Core.literalTypeFloat (Compute.adapterTarget (var "adapter"))) (var "step")])) $+ "cx" <<~ Monads.getState $+ "constraints" <~ Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx")) $+ "hasFloats" <~ Logic.not (Sets.null (Coders.languageConstraintsFloatTypes (var "constraints"))) $+ Logic.ifElse (var "hasFloats")+ (var "withFloats")+ (Flows.fail (string "no float types available"))) $+ "forInteger" <~ ("t" ~> "it" ~>+ "withIntegers" <~ (+ "adapt" <~ ("adapter" ~> "dir" ~> "lit" ~> cases _Literal (var "lit")+ (Just (Monads.unexpected+ @@ (string "integer literal")+ @@ (ShowCore.literal @@ var "lit"))) [+ _Literal_integer>>: "iv" ~> Flows.map (unaryFunction Core.literalInteger) (+ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "adapter")) @@ var "iv")]) $+ "adapter" <<~ integerAdapter @@ var "it" $+ "step" <~ AdaptUtils.bidirectional @@ (var "adapt" @@ var "adapter") $+ produce (list [Compute.adapter (Compute.adapterIsLossy (var "adapter")) (var "t") (Core.literalTypeInteger (Compute.adapterTarget (var "adapter"))) (var "step")])) $+ "cx" <<~ Monads.getState $+ "constraints" <~ Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx")) $+ "hasIntegers" <~ Logic.not (Sets.null (Coders.languageConstraintsIntegerTypes (var "constraints"))) $+ Logic.ifElse (var "hasIntegers")+ (var "withIntegers")+ (Flows.fail (string "no integer types available"))) $+ "alts" <~ ("t" ~> cases _LiteralType (var "t")+ Nothing [+ _LiteralType_binary>>: constant $ var "forBinary" @@ var "t",+ _LiteralType_boolean>>: constant $ var "forBoolean" @@ var "t",+ _LiteralType_float>>: "ft" ~> var "forFloat" @@ var "t" @@ var "ft",+ _LiteralType_integer>>: "it" ~> var "forInteger" @@ var "t" @@ var "it",+ _LiteralType_string>>: constant (Flows.fail (string "no substitute for the literal string type"))]) $+ "cx" <<~ Monads.getState $+ "supported" <~ AdaptUtils.literalTypeIsSupported @@ (Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx"))) $+ AdaptUtils.chooseAdapter+ @@ var "alts"+ @@ var "supported"+ @@ ShowCore.literalType+ @@ ShowCore.literalType+ @@ var "lt"
src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Modules.hs view
@@ -1,158 +1,182 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Adapt.Modules where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ adaptTypeToLanguageAndEncode, adaptTypeToLanguage, adaptedModuleDefinitions, constructCoder,+ languageAdapter, transformModule) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Adapt.Terms as AdaptTerms import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore+import qualified Hydra.Sources.Decode.Core as DecodeCore import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical import qualified Hydra.Sources.Kernel.Terms.Monads as Monads import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore +ns :: Namespace+ns = Namespace "hydra.adapt.modules"+ module_ :: Module-module_ = Module (Namespace "hydra.adapt.modules") elements- [AdaptTerms.module_, AdaptUtils.module_, Annotations.module_, DecodeCore.module_, DescribeCore.module_,- Lexical.module_, Monads.module_, Rewriting.module_, Schemas.module_]- kernelTypesModules $+module_ = Module ns elements+ [AdaptTerms.ns, AdaptUtils.ns, Annotations.ns, moduleNamespace DecodeCore.module_,+ Lexical.ns, Monads.ns, Rewriting.ns, Schemas.ns]+ kernelTypesNamespaces $ Just "Entry point for Hydra's adapter (type/term rewriting) framework" where elements = [- el adaptTypeToLanguageAndEncodeDef,- el adaptTypeToLanguageDef,- el adaptedModuleDefinitionsDef,- el constructCoderDef,- el languageAdapterDef,- el transformModuleDef]+ toBinding adaptTypeToLanguageAndEncode,+ toBinding adaptTypeToLanguage,+ toBinding adaptedModuleDefinitions,+ toBinding constructCoder,+ toBinding languageAdapter,+ toBinding transformModule] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -adaptTypeToLanguageAndEncodeDef :: TBinding (Language -> (Type -> Flow Graph t) -> Type -> Flow Graph t)-adaptTypeToLanguageAndEncodeDef = define "adaptTypeToLanguageAndEncode" $++adaptTypeToLanguageAndEncode :: TBinding (Language -> (Type -> Flow Graph t) -> Type -> Flow Graph t)+adaptTypeToLanguageAndEncode = define "adaptTypeToLanguageAndEncode" $ doc "Given a target language, an encoding function, and a type, adapt and encode the type" $- lambdas ["lang", "enc", "typ"] $- cases _Type (ref Rewriting.deannotateTypeDef @@ var "typ")- (Just $ bind "adaptedType" (ref adaptTypeToLanguageDef @@ var "lang" @@ var "typ") $- var "enc" @@ var "adaptedType") [- _Type_variable>>: constant (var "enc" @@ var "typ")]+ "lang" ~> "enc" ~> "typ" ~>+ "dflt" <~ (+ "adaptedType" <<~ adaptTypeToLanguage @@ var "lang" @@ var "typ" $+ var "enc" @@ var "adaptedType") $+ cases _Type (Rewriting.deannotateType @@ var "typ")+ (Just $ var "dflt") [+ _Type_variable>>: constant (var "enc" @@ var "typ")] -adaptTypeToLanguageDef :: TBinding (Language -> Type -> Flow Graph Type)-adaptTypeToLanguageDef = define "adaptTypeToLanguage" $+adaptTypeToLanguage :: TBinding (Language -> Type -> Flow Graph Type)+adaptTypeToLanguage = define "adaptTypeToLanguage" $ doc "Given a target language and a source type, find the target type to which the latter will be adapted" $- lambdas ["lang", "typ"] $- bind "adapter" (ref languageAdapterDef @@ var "lang" @@ var "typ") $- Flows.pure $ Compute.adapterTarget $ var "adapter"+ "lang" ~> "typ" ~>+ "adapter" <<~ languageAdapter @@ var "lang" @@ var "typ" $+ produce $ Compute.adapterTarget $ var "adapter" -constructCoderDef :: TBinding (Language -> (Term -> Flow Graph c) -> Type -> Flow Graph (Coder Graph Graph Term c))-constructCoderDef = define "constructCoder" $+constructCoder :: TBinding (Language -> (Term -> Flow Graph c) -> Type -> Flow Graph (Coder Graph Graph Term c))+constructCoder = define "constructCoder" $ doc "Given a target language, a unidirectional last-mile encoding, and a source type, construct a unidirectional adapting coder for terms of that type" $- lambdas ["lang", "encodeTerm", "typ"] $- trace (Strings.cat2 (string "coder for ") (ref DescribeCore.typeDef @@ var "typ")) $- bind "adapter" (ref languageAdapterDef @@ var "lang" @@ var "typ") $- Flows.pure $ ref AdaptUtils.composeCodersDef+ "lang" ~> "encodeTerm" ~> "typ" ~>+ trace (Strings.cat2 (string "coder for ") (ShowCore.type_ @@ var "typ")) $+ "adapter" <<~ languageAdapter @@ var "lang" @@ var "typ" $+ produce $ AdaptUtils.composeCoders @@ (Compute.adapterCoder $ var "adapter")- @@ (ref AdaptUtils.unidirectionalCoderDef @@ var "encodeTerm")+ @@ (AdaptUtils.unidirectionalCoder @@ var "encodeTerm") -languageAdapterDef :: TBinding (Language -> Type -> Flow Graph (SymmetricAdapter Graph Type Term))-languageAdapterDef = define "languageAdapter" $+languageAdapter :: TBinding (Language -> Type -> Flow Graph (SymmetricAdapter Graph Type Term))+languageAdapter = define "languageAdapter" $ doc "Given a target language and a source type, produce an adapter, which rewrites the type and its terms according to the language's constraints" $- lambdas ["lang", "typ"] $- bind "g" (ref Monads.getStateDef) $ lets [- "cx0">: Coders.adapterContext (var "g") (var "lang") Maps.empty] $- bind "result" (ref Monads.withStateDef @@ var "cx0" @@- (bind "ad" (ref AdaptTerms.termAdapterDef @@ var "typ") $- bind "cx" (ref Monads.getStateDef) $- Flows.pure $ pair (var "ad") (var "cx"))) $ lets [- "adapter">: first $ var "result",- "cx">: second $ var "result",- "encode">: lambda "term" $ ref Monads.withStateDef @@ var "cx" @@- (Compute.coderEncode (Compute.adapterCoder $ var "adapter") @@ var "term"),- "decode">: lambda "term" $ ref Monads.withStateDef @@ var "cx" @@- (Compute.coderDecode (Compute.adapterCoder $ var "adapter") @@ var "term"),- "ac">: Compute.coder (var "encode") (var "decode")] $- Flows.pure $ Compute.adapterWithCoder (var "adapter") (var "ac")+ "lang" ~> "typ" ~>+ "getPair" <~ ("typ" ~>+ "ad" <<~ AdaptTerms.termAdapter @@ var "typ" $+ "cx" <<~ Monads.getState $+ produce $ pair (var "ad") (var "cx")) $+ "g" <<~ Monads.getState $+ "cx0" <~ Coders.adapterContext (var "g") (var "lang") Maps.empty $+ "result" <<~ Monads.withState @@ var "cx0" @@ (var "getPair" @@ var "typ") $+ "adapter" <~ Pairs.first (var "result") $+ "cx" <~ Pairs.second (var "result") $+ "encode" <~ ("term" ~> Monads.withState @@ var "cx" @@+ (Compute.coderEncode (Compute.adapterCoder $ var "adapter") @@ var "term")) $+ "decode" <~ ("term" ~> Monads.withState @@ var "cx" @@+ (Compute.coderDecode (Compute.adapterCoder $ var "adapter") @@ var "term")) $+ produce $ Compute.adapterWithCoder (var "adapter") (Compute.coder (var "encode") (var "decode")) -transformModuleDef :: TBinding (Language -> (Term -> Flow Graph e) -> (Module -> M.Map Type (Coder Graph Graph Term e) -> [(Binding, TypedTerm)] -> Flow Graph d) -> Module -> Flow Graph d)-transformModuleDef = define "transformModule" $+transformModule :: TBinding (Language -> (Term -> Flow Graph e) -> (Module -> M.Map Type (Coder Graph Graph Term e) -> [(Binding, TypeApplicationTerm)] -> Flow Graph d) -> Module -> Flow Graph d)+transformModule = define "transformModule" $ doc "Given a target language, a unidirectional last mile encoding, and an intermediate helper function, transform a given module into a target representation" $- lambdas ["lang", "encodeTerm", "createModule", "mod"] $- trace (Strings.cat2 (string "transform module ") (unwrap _Namespace @@ (Module.moduleNamespace $ var "mod"))) $ lets [- "els">: Module.moduleElements $ var "mod",- "codersFor">: lambda "types" $- bind "cdrs" (Flows.mapList (ref constructCoderDef @@ var "lang" @@ var "encodeTerm") (var "types")) $- Flows.pure $ Maps.fromList $ Lists.zip (var "types") (var "cdrs")] $- bind "tterms" (ref Lexical.withSchemaContextDef @@ (Flows.mapList (ref Schemas.elementAsTypedTermDef) (var "els"))) $ lets [- "types">: Lists.nub $ Lists.map (unaryFunction Core.typedTermType) (var "tterms")] $- bind "coders" (var "codersFor" @@ var "types") $- var "createModule" @@ var "mod" @@ var "coders" @@ (Lists.zip (var "els") (var "tterms"))+ "lang" ~> "encodeTerm" ~> "createModule" ~> "mod" ~>+ "els" <~ Module.moduleElements (var "mod") $+ "transform" <~ (+ "tterms" <<~ Lexical.withSchemaContext @@ (Flows.mapList (Schemas.elementAsTypeApplicationTerm) (var "els")) $+ "types" <~ Lists.nub (Lists.map (unaryFunction Core.typeApplicationTermType) (var "tterms")) $+ "cdrs" <<~ Flows.mapList (constructCoder @@ var "lang" @@ var "encodeTerm") (var "types") $+ "coders" <~ Maps.fromList (Lists.zip (var "types") (var "cdrs")) $+ var "createModule" @@ var "mod" @@ var "coders" @@ (Lists.zip (var "els") (var "tterms"))) $+ trace (Strings.cat2 (string "transform module ") (unwrap _Namespace @@ (Module.moduleNamespace $ var "mod"))) $+ var "transform" -adaptedModuleDefinitionsDef :: TBinding (Language -> Module -> Flow Graph [Definition])-adaptedModuleDefinitionsDef = define "adaptedModuleDefinitions" $+adaptedModuleDefinitions :: TBinding (Language -> Module -> Flow Graph [Definition])+adaptedModuleDefinitions = define "adaptedModuleDefinitions" $ doc "Map a Hydra module to a list of type and/or term definitions which have been adapted to the target language" $- lambdas ["lang", "mod"] $ lets [- "els">: Module.moduleElements $ var "mod",- "adaptersFor">: lambda "types" $- bind "adapters" (Flows.mapList (ref languageAdapterDef @@ var "lang") (var "types")) $- Flows.pure $ Maps.fromList $ Lists.zip (var "types") (var "adapters"),- "classify">: lambdas ["adapters", "pair"] $ lets [- "el">: first $ var "pair",- "tt">: second $ var "pair",- "term">: Core.typedTermTerm $ var "tt",- "typ">: Core.typedTermType $ var "tt",- "name">: Core.bindingName $ var "el"] $- Logic.ifElse (ref Annotations.isNativeTypeDef @@ var "el")- (bind "adaptedTyp" (bind "coreTyp" (ref DecodeCore.typeDef @@ var "term") $ ref adaptTypeToLanguageDef @@ var "lang" @@ var "coreTyp") $- Flows.pure $ Module.definitionType $ Module.typeDefinition (var "name") (var "adaptedTyp"))- (Optionals.maybe- (Flows.fail $ Strings.cat2 (string "no adapter for element ") (unwrap _Name @@ var "name"))- (lambda "adapter" $- bind "adapted" (Compute.coderEncode (Compute.adapterCoder $ var "adapter") @@ var "term") $- Flows.pure $ Module.definitionTerm $ Module.termDefinition (var "name") (var "adapted") (Compute.adapterTarget $ var "adapter"))- (Maps.lookup (var "typ") (var "adapters")))] $- bind "tterms" (ref Lexical.withSchemaContextDef @@ (Flows.mapList (ref Schemas.elementAsTypedTermDef) (var "els"))) $- lets ["types">: Sets.toList $ Sets.fromList $ Lists.map (ref Rewriting.deannotateTypeDef <.> unaryFunction Core.typedTermType) (var "tterms")] $- bind "adapters" (var "adaptersFor" @@ var "types") $- Flows.mapList (var "classify" @@ var "adapters") $ Lists.zip (var "els") (var "tterms")+ "lang" ~> "mod" ~>+ "cx" <<~ Monads.getState $+ "els" <~ Module.moduleElements (var "mod") $+ "adaptersFor" <~ lambda "types" (+ "adapters" <<~ Flows.mapList (languageAdapter @@ var "lang") (var "types") $+ produce $ Maps.fromList $ Lists.zip (var "types") (var "adapters")) $+ "classify" <~ ("adapters" ~> "pair" ~>+ "el" <~ Pairs.first (var "pair") $+ "tt" <~ Pairs.second (var "pair") $+ "term" <~ Core.typeApplicationTermBody (var "tt") $+ "typ" <~ Core.typeApplicationTermType (var "tt") $+ "name" <~ Core.bindingName (var "el") $+ Logic.ifElse (Annotations.isNativeType @@ var "el")+ ("adaptedTyp" <<~ (+ "coreTyp" <<~ (trace (string "adapt module definitions") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ var "term")) $+ adaptTypeToLanguage @@ var "lang" @@ var "coreTyp") $+ produce $ Module.definitionType $ Module.typeDefinition (var "name") (var "adaptedTyp"))+ (Maybes.maybe+ (Flows.fail $ Strings.cat2 (string "no adapter for element ") (unwrap _Name @@ var "name"))+ (lambda "adapter" (+ "adapted" <<~ Compute.coderEncode (Compute.adapterCoder $ var "adapter") @@ var "term" $+ produce $ Module.definitionTerm $ Module.termDefinition (var "name") (var "adapted") (Schemas.typeToTypeScheme @@ (Compute.adapterTarget $ var "adapter"))))+ (Maps.lookup (var "typ") (var "adapters")))) $+ "tterms" <<~ Lexical.withSchemaContext @@ (Flows.mapList (Schemas.elementAsTypeApplicationTerm) (var "els")) $+ "types" <~ Sets.toList (Sets.fromList (Lists.map (Rewriting.deannotateType <.> unaryFunction Core.typeApplicationTermType) (var "tterms"))) $+ "adapters" <<~ var "adaptersFor" @@ var "types" $+ Flows.mapList (var "classify" @@ var "adapters") (Lists.zip (var "els") (var "tterms"))
src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Simple.hs view
@@ -1,106 +1,146 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Adapt.Simple where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ adaptFloatType, adaptDataGraph, adaptGraphSchema, adaptIntegerType, adaptLambdaDomains, adaptLiteral,+ adaptLiteralType, adaptLiteralTypesMap, adaptLiteralValue, adaptNestedTypes, adaptPrimitive,+ adaptTerm, adaptType, adaptTypeScheme,+ dataGraphToDefinitions, literalTypeSupported, pushTypeAppsInward, schemaGraphToDefinitions,+ termAlternatives, typeAlternatives) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Inference as Inference-import qualified Hydra.Sources.Kernel.Terms.Literals as Lits-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import qualified Hydra.Sources.Kernel.Terms.Hoisting as Hoisting+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Literals as Literals+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph +ns :: Namespace+ns = Namespace "hydra.adapt.simple"+ module_ :: Module-module_ = Module (Namespace "hydra.adapt.simple") elements- [DecodeCore.module_, Inference.module_, Lits.module_, Monads.module_, Reduction.module_, Rewriting.module_, Schemas.module_,- ShowCore.module_, ShowGraph.module_, Variants.module_]- kernelTypesModules $+module_ = Module ns elements+ [Hoisting.ns, Inference.ns, Literals.ns, Names.ns, Reduction.ns, Reflect.ns, Rewriting.ns, Schemas.ns,+ ShowCore.ns, ShowGraph.ns]+ kernelTypesNamespaces $ Just "Simple, one-way adapters for types and terms" where elements = [- el adaptFloatTypeDef,- el adaptDataGraphDef,- el adaptGraphSchemaDef,- el adaptIntegerTypeDef,- el adaptLiteralDef,- el adaptLiteralTypeDef,- el adaptLiteralTypesMapDef,- el adaptLiteralValueDef,- el adaptPrimitiveDef,- el adaptTermDef,- el adaptTypeDef,- el adaptTypeSchemeDef,- el dataGraphToDefinitionsDef,- el literalTypeSupportedDef,- el schemaGraphToDefinitionsDef,- el termAlternativesDef,- el typeAlternativesDef]+ toBinding adaptFloatType,+ toBinding adaptDataGraph,+ toBinding adaptGraphSchema,+ toBinding adaptIntegerType,+ toBinding adaptLambdaDomains,+ toBinding adaptLiteral,+ toBinding adaptLiteralType,+ toBinding adaptLiteralTypesMap,+ toBinding adaptLiteralValue,+ toBinding adaptNestedTypes,+ toBinding adaptPrimitive,+ toBinding adaptTerm,+ toBinding adaptType,+ toBinding adaptTypeScheme,+ toBinding dataGraphToDefinitions,+ toBinding literalTypeSupported,+ toBinding pushTypeAppsInward,+ toBinding schemaGraphToDefinitions,+ toBinding termAlternatives,+ toBinding typeAlternatives] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -adaptFloatTypeDef :: TBinding (LanguageConstraints -> FloatType -> Maybe FloatType)-adaptFloatTypeDef = define "adaptFloatType" $+adaptFloatType :: TBinding (LanguageConstraints -> FloatType -> Maybe FloatType)+adaptFloatType = define "adaptFloatType" $ doc "Attempt to adapt a floating-point type using the given language constraints" $ "constraints" ~> "ft" ~> "supported" <~ Sets.member (var "ft") (Coders.languageConstraintsFloatTypes $ var "constraints") $- "alt" <~ (ref adaptFloatTypeDef @@ var "constraints") $+ "alt" <~ (adaptFloatType @@ var "constraints") $+ "forUnsupported" <~ ("ft" ~> cases _FloatType (var "ft")+ Nothing [+-- _FloatType_bigfloat>>: constant nothing,+ _FloatType_bigfloat>>: constant $ var "alt" @@ Core.floatTypeFloat64, -- TODO: temporary; the only non-lossy alternative for bigfloat is string, but some migration is needed+ _FloatType_float32>>: constant $ var "alt" @@ Core.floatTypeFloat64,+ _FloatType_float64>>: constant $ var "alt" @@ Core.floatTypeBigfloat]) $ Logic.ifElse (var "supported") (just $ var "ft")- (cases _FloatType (var "ft")- Nothing [- _FloatType_bigfloat>>: constant nothing,- _FloatType_float32>>: constant $ var "alt" @@ Core.floatTypeFloat64,- _FloatType_float64>>: constant $ var "alt" @@ Core.floatTypeBigfloat])+ (var "forUnsupported" @@ var "ft") -adaptDataGraphDef :: TBinding (LanguageConstraints -> Bool -> Graph -> Flow s Graph)-adaptDataGraphDef = define "adaptDataGraph" $- doc "Adapt a graph and its schema to the given language constraints, prior to inference" $+adaptDataGraph :: TBinding (LanguageConstraints -> Bool -> Graph -> Flow s Graph)+adaptDataGraph = define "adaptDataGraph" $+ doc ("Adapt a graph and its schema to the given language constraints."+ <> " The doExpand flag controls eta expansion of partial applications."+ <> " Adaptation is type-preserving: binding-level TypeSchemes are adapted (not stripped)."+ <> " Note: case statement hoisting is done separately, prior to adaptation.") $ "constraints" ~> "doExpand" ~> "graph0" ~>- "litmap" <~ ref adaptLiteralTypesMapDef @@ var "constraints" $+ "transform" <~ ("graph" ~> "gterm" ~>+ "tx" <<~ Schemas.graphToTypeContext @@ var "graph" $+ -- Order of operations:+ -- 1. Unshadow variables first (prevents capture issues in eta expansion)+ -- 2. Eta expand (needs type annotations; creates fully-applied functions)+ -- 3. Lift lambdas above lets (structural cleanup)+ "gterm1" <~ Rewriting.unshadowVariables @@ (pushTypeAppsInward @@ var "gterm") $+ "gterm2" <~ Rewriting.unshadowVariables @@ (Logic.ifElse (var "doExpand")+ (pushTypeAppsInward @@ (Reduction.etaExpandTermNew @@ var "tx" @@ var "gterm1"))+ (var "gterm1")) $+ produce $ Rewriting.liftLambdaAboveLet @@ var "gterm2") $+ "litmap" <~ adaptLiteralTypesMap @@ var "constraints" $ "els0" <~ Graph.graphElements (var "graph0") $ "env0" <~ Graph.graphEnvironment (var "graph0") $ "body0" <~ Graph.graphBody (var "graph0") $@@ -108,23 +148,44 @@ "schema0" <~ Graph.graphSchema (var "graph0") $ "schema1" <<~ optCases (var "schema0") (produce nothing)--- ("sg" ~> Flows.fail $ "schema graph: " ++ (ref ShowGraph.graphDef @@ var "sg")) $+-- ("sg" ~> Flows.fail $ "schema graph: " ++ (ShowGraph.graph @@ var "sg")) $ ( "sg" ~>- "tmap0" <<~ ref Schemas.graphAsTypesDef @@ var "sg" $- "tmap1" <<~ ref adaptGraphSchemaDef @@ var "constraints" @@ var "litmap" @@ var "tmap0" $- "emap" <~ ref Schemas.typesToElementsDef @@ var "tmap1" $+ "tmap0" <<~ Schemas.graphAsTypes @@ var "sg" $+ "tmap1" <<~ adaptGraphSchema @@ var "constraints" @@ var "litmap" @@ var "tmap0" $+ "emap" <~ Schemas.typesToElements @@ var "tmap1" $ produce $ just $ Graph.graphWithElements (var "sg") (var "emap")) $- "gterm0" <~ ref Schemas.graphAsTermDef @@ var "graph0" $- "gterm1" <~ Logic.ifElse (var "doExpand")- (ref Reduction.expandLambdasDef @@ var "graph0" @@ var "gterm0")- (var "gterm0") $- "gterm2" <<~ ref adaptTermDef @@ var "constraints" @@ var "litmap" @@ var "gterm1" $- "els1" <~ ref Schemas.termAsGraphDef @@ var "gterm2" $- "prims1" <<~ Flows.mapElems (ref adaptPrimitiveDef @@ var "constraints" @@ var "litmap") (var "prims0") $--- Flows.fail $ "adapted data graph: " ++ (ref ShowCore.termDef @@ var "gterm2")--- Flows.fail $ "schema graph: " ++ (optCases (var "schema1")--- ("none")--- ("sg" ~> ref ShowGraph.graphDef @@ var "sg"))+ "gterm0" <~ Schemas.graphAsTerm @@ var "graph0" $+ "gterm1" <<~ Logic.ifElse (var "doExpand")+ (var "transform" @@ var "graph0" @@ var "gterm0")+ (produce $ var "gterm0") $+ "gterm2" <<~ adaptTerm @@ var "constraints" @@ var "litmap" @@ var "gterm1" $+ -- Adapt lambda domains in the adapted term.+ -- Lambda domains carry pre-adaptation types (e.g. bigfloat) that must be adapted to match+ -- the post-adaptation terms (e.g. float64). This preserves type annotations.+ "gterm3" <<~ Rewriting.rewriteTermM @@ (adaptLambdaDomains @@ var "constraints" @@ var "litmap") @@ var "gterm2" $+ "els1Raw" <~ Schemas.termAsGraph @@ var "gterm3" $++ -- Adapt nested let binding TypeSchemes within each top-level binding's term.+ -- These TypeSchemes may carry stale types from JSON modules (e.g. bigfloat→float64).+ -- Applied per-binding AFTER termAsGraph so that top-level binding TypeSchemes+ -- (which carry type-class constraints like Ord) are preserved.+ -- Process each binding: adapt nested let TypeSchemes AND adapt top-level TypeSchemes.+ -- Adapting (rather than stripping) TypeSchemes converts stale types like bigfloat→float64+ -- while preserving type-class constraints like Ord needed by decodeSet.+ "processBinding" <~ ("el" ~>+ "newTerm" <<~ Rewriting.rewriteTermM @@ (adaptNestedTypes @@ var "constraints" @@ var "litmap") @@ (Core.bindingTerm $ var "el") $+ "adaptedType" <<~ optCases (Core.bindingType $ var "el")+ (produce nothing)+ ("ts" ~>+ "ts1" <<~ adaptTypeScheme @@ var "constraints" @@ var "litmap" @@ var "ts" $+ produce $ just $ var "ts1") $+ produce $ Core.binding+ (Core.bindingName $ var "el")+ (var "newTerm")+ (var "adaptedType")) $+ "els1" <<~ Flows.mapList (var "processBinding") (var "els1Raw") $+ "prims1" <<~ Flows.mapElems (adaptPrimitive @@ var "constraints" @@ var "litmap") (var "prims0") $+ produce $ Graph.graph (var "els1") (var "env0")@@ -133,40 +194,93 @@ (var "prims1") (var "schema1") -adaptGraphSchemaDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> M.Map Name Type -> Flow s (M.Map Name Type))-adaptGraphSchemaDef = define "adaptGraphSchema" $+-- | Rewrite callback for adapting lambda domains in a term.+-- Dispatches on Term variants: for TermFunction, adapts the lambda domain type;+-- for all other variants, returns the term unchanged.+-- This is a top-level function (not inline) so the Python code generator can emit match statements.+adaptLambdaDomains :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> (Term -> Flow s Term) -> Term -> Flow s Term)+adaptLambdaDomains = define "adaptLambdaDomains" $+ doc "Rewrite callback for adapting lambda domain types in a term" $+ "constraints" ~> "litmap" ~> "recurse" ~> "term" ~>+ "rewritten" <<~ var "recurse" @@ var "term" $+ cases _Term (var "rewritten")+ (Just $ produce $ var "rewritten") [+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ produce $ Core.termFunction $ var "f") [+ _Function_lambda>>: "l" ~>+ "adaptedDomain" <<~ optCases (Core.lambdaDomain $ var "l")+ (produce nothing)+ ("dom" ~>+ "dom1" <<~ adaptType @@ var "constraints" @@ var "litmap" @@ var "dom" $+ produce $ just $ var "dom1") $+ produce $ Core.termFunction $ Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (var "adaptedDomain")+ (Core.lambdaBody $ var "l")]]++-- | Rewrite callback for adapting nested let binding TypeSchemes in a term.+-- Dispatches on Term variants: for TermLet, adapts the binding TypeSchemes;+-- for all other variants, returns the term unchanged.+-- This is a top-level function (not inline) so the Python code generator can emit match statements.+adaptNestedTypes :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> (Term -> Flow s Term) -> Term -> Flow s Term)+adaptNestedTypes = define "adaptNestedTypes" $+ doc "Rewrite callback for adapting nested let binding TypeSchemes in a term" $+ "constraints" ~> "litmap" ~> "recurse" ~> "term" ~>+ "rewritten" <<~ var "recurse" @@ var "term" $+ cases _Term (var "rewritten")+ (Just $ produce $ var "rewritten") [+ _Term_let>>: "lt" ~>+ "adaptB" <~ ("b" ~>+ "adaptedBType" <<~ optCases (Core.bindingType $ var "b")+ (produce nothing)+ ("ts" ~>+ "ts1" <<~ adaptTypeScheme @@ var "constraints" @@ var "litmap" @@ var "ts" $+ produce $ just $ var "ts1") $+ produce $ Core.binding+ (Core.bindingName $ var "b")+ (Core.bindingTerm $ var "b")+ (var "adaptedBType")) $+ "adaptedBindings" <<~ Flows.mapList (var "adaptB") (Core.letBindings $ var "lt") $+ produce $ Core.termLet $ Core.let_+ (var "adaptedBindings")+ (Core.letBody $ var "lt")]++adaptGraphSchema :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> M.Map Name Type -> Flow s (M.Map Name Type))+adaptGraphSchema = define "adaptGraphSchema" $ doc "Adapt a schema graph to the given language constraints" $ "constraints" ~> "litmap" ~> "types0" ~> "mapPair" <~ ("pair" ~>- "name" <~ first (var "pair") $- "typ" <~ second (var "pair") $- "typ1" <<~ ref adaptTypeDef @@ var "constraints" @@ var "litmap" @@ var "typ" $+ "name" <~ Pairs.first (var "pair") $+ "typ" <~ Pairs.second (var "pair") $+ "typ1" <<~ adaptType @@ var "constraints" @@ var "litmap" @@ var "typ" $ produce $ pair (var "name") (var "typ1")) $ "pairs" <<~ Flows.mapList (var "mapPair") (Maps.toList $ var "types0") $ produce $ Maps.fromList (var "pairs") -adaptIntegerTypeDef :: TBinding (LanguageConstraints -> IntegerType -> Maybe IntegerType)-adaptIntegerTypeDef = define "adaptIntegerType" $+adaptIntegerType :: TBinding (LanguageConstraints -> IntegerType -> Maybe IntegerType)+adaptIntegerType = define "adaptIntegerType" $ doc "Attempt to adapt an integer type using the given language constraints" $ "constraints" ~> "it" ~> "supported" <~ Sets.member (var "it") (Coders.languageConstraintsIntegerTypes $ var "constraints") $- "alt" <~ (ref adaptIntegerTypeDef @@ var "constraints") $+ "alt" <~ (adaptIntegerType @@ var "constraints") $+ "forUnsupported" <~ ("it" ~> cases _IntegerType (var "it")+ Nothing [+ _IntegerType_bigint>>: constant nothing,+ _IntegerType_int8>>: constant $ var "alt" @@ Core.integerTypeUint16,+ _IntegerType_int16>>: constant $ var "alt" @@ Core.integerTypeUint32,+ _IntegerType_int32>>: constant $ var "alt" @@ Core.integerTypeUint64,+ _IntegerType_int64>>: constant $ var "alt" @@ Core.integerTypeBigint,+ _IntegerType_uint8>>: constant $ var "alt" @@ Core.integerTypeInt16,+ _IntegerType_uint16>>: constant $ var "alt" @@ Core.integerTypeInt32,+ _IntegerType_uint32>>: constant $ var "alt" @@ Core.integerTypeInt64,+ _IntegerType_uint64>>: constant $ var "alt" @@ Core.integerTypeBigint]) $ Logic.ifElse (var "supported") (just $ var "it")- (cases _IntegerType (var "it")- Nothing [- _IntegerType_bigint>>: constant nothing,- _IntegerType_int8>>: constant $ var "alt" @@ Core.integerTypeUint16,- _IntegerType_int16>>: constant $ var "alt" @@ Core.integerTypeUint32,- _IntegerType_int32>>: constant $ var "alt" @@ Core.integerTypeUint64,- _IntegerType_int64>>: constant $ var "alt" @@ Core.integerTypeBigint,- _IntegerType_uint8>>: constant $ var "alt" @@ Core.integerTypeInt16,- _IntegerType_uint16>>: constant $ var "alt" @@ Core.integerTypeInt32,- _IntegerType_uint32>>: constant $ var "alt" @@ Core.integerTypeInt64,- _IntegerType_uint64>>: constant $ var "alt" @@ Core.integerTypeBigint])+ (var "forUnsupported" @@ var "it") -adaptLiteralDef :: TBinding (LiteralType -> Literal -> Literal)-adaptLiteralDef = define "adaptLiteral" $+adaptLiteral :: TBinding (LiteralType -> Literal -> Literal)+adaptLiteral = define "adaptLiteral" $ doc "Convert a literal to a different type" $ "lt" ~> "l" ~> cases _Literal (var "l")@@ -177,231 +291,472 @@ _Literal_boolean>>: "b" ~> cases _LiteralType (var "lt") Nothing [ _LiteralType_integer>>: "it" ~> Core.literalInteger $- ref Lits.bigintToIntegerValueDef @@ var "it" @@ Logic.ifElse (var "b") (bigint 1) (bigint 0)],+ Literals.bigintToIntegerValue @@ var "it" @@ Logic.ifElse (var "b") (bigint 1) (bigint 0)], _Literal_float>>: "f" ~> cases _LiteralType (var "lt") Nothing [ _LiteralType_float>>: "ft" ~> Core.literalFloat $- ref Lits.bigfloatToFloatValueDef @@ var "ft" @@ (ref Lits.floatValueToBigfloatDef @@ var "f")],+ Literals.bigfloatToFloatValue @@ var "ft" @@ (Literals.floatValueToBigfloat @@ var "f")], _Literal_integer>>: "i" ~> cases _LiteralType (var "lt") Nothing [ _LiteralType_integer>>: "it" ~> Core.literalInteger $- ref Lits.bigintToIntegerValueDef @@ var "it" @@ (ref Lits.integerValueToBigintDef @@ var "i")]]+ Literals.bigintToIntegerValue @@ var "it" @@ (Literals.integerValueToBigint @@ var "i")]] -adaptLiteralTypeDef :: TBinding (LanguageConstraints -> LiteralType -> Maybe LiteralType)-adaptLiteralTypeDef = define "adaptLiteralType" $+adaptLiteralType :: TBinding (LanguageConstraints -> LiteralType -> Maybe LiteralType)+adaptLiteralType = define "adaptLiteralType" $ doc "Attempt to adapt a literal type using the given language constraints" $ "constraints" ~> "lt" ~>- Logic.ifElse (ref literalTypeSupportedDef @@ var "constraints" @@ var "lt")+ "forUnsupported" <~ ("lt" ~> cases _LiteralType (var "lt")+ (Just nothing) [+ _LiteralType_binary>>: constant $ just Core.literalTypeString,+ _LiteralType_boolean>>: constant $ Maybes.map (unaryFunction Core.literalTypeInteger) $+ adaptIntegerType @@ var "constraints" @@ Core.integerTypeInt8,+ _LiteralType_float>>: "ft" ~> Maybes.map (unaryFunction Core.literalTypeFloat) $+ adaptFloatType @@ var "constraints" @@ var "ft",+ _LiteralType_integer>>: "it" ~> Maybes.map (unaryFunction Core.literalTypeInteger) $+ adaptIntegerType @@ var "constraints" @@ var "it"]) $+ Logic.ifElse (literalTypeSupported @@ var "constraints" @@ var "lt") nothing- (cases _LiteralType (var "lt")- (Just nothing) [- _LiteralType_binary>>: constant $ just Core.literalTypeString,- _LiteralType_boolean>>: constant $ Optionals.map (unaryFunction Core.literalTypeInteger) $- ref adaptIntegerTypeDef @@ var "constraints" @@ Core.integerTypeInt8,- _LiteralType_float>>: "ft" ~> Optionals.map (unaryFunction Core.literalTypeFloat) $- ref adaptFloatTypeDef @@ var "constraints" @@ var "ft",- _LiteralType_integer>>: "it" ~> Optionals.map (unaryFunction Core.literalTypeInteger) $- ref adaptIntegerTypeDef @@ var "constraints" @@ var "it"])+ (var "forUnsupported" @@ var "lt") -adaptLiteralTypesMapDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType)-adaptLiteralTypesMapDef = define "adaptLiteralTypesMap" $+adaptLiteralTypesMap :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType)+adaptLiteralTypesMap = define "adaptLiteralTypesMap" $ doc "Derive a map of adapted literal types for the given language constraints" $ "constraints" ~>- "tryType" <~ ("lt" ~> optCases (ref adaptLiteralTypeDef @@ var "constraints" @@ var "lt")+ "tryType" <~ ("lt" ~> optCases (adaptLiteralType @@ var "constraints" @@ var "lt") nothing ("lt2" ~> just $ pair (var "lt") (var "lt2"))) $- Maps.fromList $ Optionals.cat $ Lists.map (var "tryType") (ref Variants.literalTypesDef)+ Maps.fromList $ Maybes.cat $ Lists.map (var "tryType") (Reflect.literalTypes) -adaptLiteralValueDef :: TBinding (M.Map LiteralType LiteralType -> LiteralType -> Literal -> Literal)-adaptLiteralValueDef = define "adaptLiteralValue" $+adaptLiteralValue :: TBinding (M.Map LiteralType LiteralType -> LiteralType -> Literal -> Literal)+adaptLiteralValue = define "adaptLiteralValue" $ doc "Adapt a literal value using the given language constraints" $ "litmap" ~> "lt" ~> "l" ~> optCases (Maps.lookup (var "lt") (var "litmap"))- (Core.literalString $ ref ShowCore.literalDef @@ var "l")- ("lt2" ~> ref adaptLiteralDef @@ var "lt2" @@ var "l")+ (Core.literalString $ ShowCore.literal @@ var "l")+ ("lt2" ~> adaptLiteral @@ var "lt2" @@ var "l") -adaptPrimitiveDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Primitive -> Flow s Primitive)-adaptPrimitiveDef = define "adaptPrimitive" $+adaptPrimitive :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Primitive -> Flow s Primitive)+adaptPrimitive = define "adaptPrimitive" $ doc "Adapt a primitive to the given language constraints, prior to inference" $ "constraints" ~> "litmap" ~> "prim0" ~> "ts0" <~ Graph.primitiveType (var "prim0") $- "ts1" <<~ ref adaptTypeSchemeDef @@ var "constraints" @@ var "litmap" @@ var "ts0" $+ "ts1" <<~ adaptTypeScheme @@ var "constraints" @@ var "litmap" @@ var "ts0" $ produce $ Graph.primitiveWithType (var "prim0") (var "ts1") -- Note: this function could be made more efficient through precomputation of alternatives, -- similar to what is done for literals.-adaptTermDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Term -> Flow Graph Term)-adaptTermDef = define "adaptTerm" $+adaptTerm :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Term -> Flow Graph Term)+adaptTerm = define "adaptTerm" $ doc "Adapt a term using the given language constraints" $ "constraints" ~> "litmap" ~> "term0" ~>- "rewrite" <~ ("recurse" ~> "term0" ~>- "term1" <<~ var "recurse" @@ var "term0" $- "tryTerm" <~ ("term" ~>+ "rewrite" <~ ("recurse" ~> "term0" ~> lets [+ "forSupported">: ("term" ~> cases _Term (var "term")+ (Just $ produce $ just $ var "term") [+ _Term_literal>>: "l" ~>+ "lt" <~ Reflect.literalType @@ var "l" $+ produce $ just $ Logic.ifElse (literalTypeSupported @@ var "constraints" @@ var "lt")+ (var "term")+ (Core.termLiteral $ adaptLiteralValue @@ var "litmap" @@ var "lt" @@ var "l")]),+ "forUnsupported">: ("term" ~> lets [+ "forNonNull">: ("alts" ~>+ "mterm" <<~ var "tryTerm" @@ Lists.head (var "alts") $+ optCases (var "mterm")+ (var "tryAlts" @@ Lists.tail (var "alts"))+ ("t" ~> produce $ just $ var "t")),+ "tryAlts">: ("alts" ~> Logic.ifElse (Lists.null $ var "alts")+ (produce nothing)+ (var "forNonNull" @@ var "alts"))] $+ "alts0" <<~ termAlternatives @@ var "term" $+ var "tryAlts" @@ var "alts0"),+ "tryTerm">: ("term" ~> "supportedVariant" <~ Sets.member- (ref Variants.termVariantDef @@ var "term")+ (Reflect.termVariant @@ var "term") (Coders.languageConstraintsTermVariants $ var "constraints") $ Logic.ifElse (var "supportedVariant")- (cases _Term (var "term")- (Just $ produce $ just $ var "term") [- _Term_literal>>: "l" ~>- "lt" <~ ref Variants.literalTypeDef @@ var "l" $- produce $ just $ Logic.ifElse (ref literalTypeSupportedDef @@ var "constraints" @@ var "lt")- (var "term")- (Core.termLiteral $ ref adaptLiteralValueDef @@ var "litmap" @@ var "lt" @@ var "l")])- ("tryAlts" <~ ("alts" ~> Logic.ifElse (Lists.null $ var "alts")- (produce nothing)- ( "mterm" <<~ var "tryTerm" @@ Lists.head (var "alts") $- optCases (var "mterm")- (var "tryAlts" @@ Lists.tail (var "alts"))- ("t" ~> produce $ just $ var "t"))) $- "alts" <<~ ref termAlternativesDef @@ var "term1" $- var "tryAlts" @@ var "alts")) $- "mterm" <<~ var "tryTerm" @@ var "term1" $- optCases (var "mterm")- (Flows.fail $ "no alternatives for term: " ++ (ref ShowCore.termDef @@ var "term1"))- ("term2" ~> produce $ var "term2")) $- ref Rewriting.rewriteTermMDef @@ var "rewrite" @@ var "term0"+ (var "forSupported" @@ var "term")+ (var "forUnsupported" @@ var "term"))] $+ "term1" <<~ var "recurse" @@ var "term0" $+ -- Type application/lambda wrappers pass through unconditionally.+ -- fsub already recursed into their bodies; we must not strip the wrappers+ -- because they carry type information needed by typeOf in the coders.+ cases _Term (var "term1")+ (Just $+ "mterm" <<~ var "tryTerm" @@ var "term1" $+ optCases (var "mterm")+ (Flows.fail $ (string "no alternatives for term: ") ++ (ShowCore.term @@ var "term1"))+ ("term2" ~> produce $ var "term2"))+ [_Term_typeApplication>>: "ta" ~>+ "atyp" <<~ adaptType @@ var "constraints" @@ var "litmap" @@ (Core.typeApplicationTermType $ var "ta") $+ produce $ Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.typeApplicationTermBody $ var "ta")+ (var "atyp"),+ _Term_typeLambda>>: "_" ~> produce $ var "term1"]) $+ Rewriting.rewriteTermM @@ var "rewrite" @@ var "term0" -adaptTypeDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Type -> Flow s Type)-adaptTypeDef = define "adaptType" $+adaptType :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> Type -> Flow s Type)+adaptType = define "adaptType" $ doc "Adapt a type using the given language constraints" $ "constraints" ~> "litmap" ~> "type0" ~>+ lets [+ "forSupported">: ("typ" ~> cases _Type (var "typ")+ (Just $ just $ var "typ") [+ _Type_literal>>: "lt" ~> Logic.ifElse (literalTypeSupported @@ var "constraints" @@ var "lt")+ (just $ var "typ")+ (optCases (Maps.lookup (var "lt") (var "litmap"))+ (just $ Core.typeLiteral Core.literalTypeString)+ ("lt2" ~> just $ Core.typeLiteral $ var "lt2"))]),+ "forUnsupported">: ("typ" ~>+ "tryAlts" <~ ("alts" ~> Logic.ifElse (Lists.null $ var "alts")+ nothing+ (optCases (var "tryType" @@ Lists.head (var "alts"))+ (var "tryAlts" @@ Lists.tail (var "alts"))+ ("t" ~> just $ var "t"))) $+ "alts0" <~ typeAlternatives @@ var "typ" $+ var "tryAlts" @@ var "alts0"),+ "tryType">: ("typ" ~>+ "supportedVariant" <~ Sets.member+ (Reflect.typeVariant @@ var "typ")+ (Coders.languageConstraintsTypeVariants $ var "constraints") $+ Logic.ifElse (var "supportedVariant")+ (var "forSupported" @@ var "typ")+ (var "forUnsupported" @@ var "typ"))] $ "rewrite" <~ ("recurse" ~> "typ" ~> "type1" <<~ var "recurse" @@ var "typ" $- "tryType" <~ ("typ" ~>- "supportedVariant" <~ Sets.member- (ref Variants.typeVariantDef @@ var "typ")- (Coders.languageConstraintsTypeVariants $ var "constraints") $- Logic.ifElse (var "supportedVariant")- (cases _Type (var "typ")- (Just $ just $ var "typ") [- _Type_literal>>: "lt" ~> Logic.ifElse (ref literalTypeSupportedDef @@ var "constraints" @@ var "lt")- (just $ var "typ")- (optCases (Maps.lookup (var "lt") (var "litmap"))- (just $ Core.typeLiteral Core.literalTypeString)- ("lt2" ~> just $ Core.typeLiteral $ var "lt2"))])- ("tryAlts" <~ ("alts" ~> Logic.ifElse (Lists.null $ var "alts")- nothing- ( optCases (var "tryType" @@ Lists.head (var "alts"))- (var "tryAlts" @@ Lists.tail (var "alts"))- ("t" ~> just $ var "t"))) $- "alts" <~ ref typeAlternativesDef @@ var "type1" $- var "tryAlts" @@ var "alts")) $ optCases (var "tryType" @@ var "type1")- (Flows.fail $ "no alternatives for type: " ++ (ref ShowCore.typeDef @@ var "typ"))+ (Flows.fail $ (string "no alternatives for type: ") ++ (ShowCore.type_ @@ var "typ")) ("type2" ~> produce $ var "type2")) $- ref Rewriting.rewriteTypeMDef @@ var "rewrite" @@ var "type0"+ Rewriting.rewriteTypeM @@ var "rewrite" @@ var "type0" -adaptTypeSchemeDef :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> TypeScheme -> Flow s TypeScheme)-adaptTypeSchemeDef = define "adaptTypeScheme" $+adaptTypeScheme :: TBinding (LanguageConstraints -> M.Map LiteralType LiteralType -> TypeScheme -> Flow s TypeScheme)+adaptTypeScheme = define "adaptTypeScheme" $ doc "Adapt a type scheme to the given language constraints, prior to inference" $ "constraints" ~> "litmap" ~> "ts0" ~> "vars0" <~ Core.typeSchemeVariables (var "ts0") $ "t0" <~ Core.typeSchemeType (var "ts0") $- "t1" <<~ ref adaptTypeDef @@ var "constraints" @@ var "litmap" @@ var "t0" $- produce $ Core.typeScheme (var "vars0") (var "t1")+ "t1" <<~ adaptType @@ var "constraints" @@ var "litmap" @@ var "t0" $+ produce $ Core.typeScheme (var "vars0") (var "t1") (Core.typeSchemeConstraints (var "ts0")) -dataGraphToDefinitionsDef :: TBinding (LanguageConstraints -> Bool -> Graph -> [[Name]] -> Flow s (Graph, [[TermDefinition]]))-dataGraphToDefinitionsDef = define "dataGraphToDefinitions" $- doc ("Given a data graph along with language constraints and a designated list of element names,"- <> " adapt the graph to the language constraints, perform inference,"- <> " then return a corresponding term definition for each element name.") $- "constraints" ~> "doExpand" ~> "graph" ~> "nameLists" ~>- "graph1" <<~ ref adaptDataGraphDef @@ var "constraints" @@ var "doExpand" @@ var "graph" $--- Flows.fail ("adapted graph: " ++ (ref ShowGraph.graphDef @@ var "graph1"))- "graph2" <<~ ref Inference.inferGraphTypesDef @@ var "graph1" $+pushTypeAppsInward :: TBinding (Term -> Term)+pushTypeAppsInward = define "pushTypeAppsInward" $+ doc ("Normalize a term by pushing TermTypeApplication inward past TermApplication and"+ <> " TermFunction (Lambda). This corrects structures produced by poly-let hoisting and"+ <> " eta expansion, where type applications from inference end up wrapping term"+ <> " applications or lambda abstractions instead of being directly on the polymorphic variable.") $+ "term" ~>+ lets [+ "push">: ("body" ~> "typ" ~> cases _Term (var "body")+ -- Default: keep TypeApp as-is+ (Just $ Core.termTypeApplication $ Core.typeApplicationTerm (var "body") (var "typ")) [+ -- TypeApp(App(f, arg), τ) → go(App(TypeApp(f, τ), arg))+ _Term_application>>: "a" ~> var "go" @@+ (Core.termApplication $ Core.application+ (Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.applicationFunction $ var "a")+ (var "typ"))+ (Core.applicationArgument $ var "a")),+ -- TypeApp(Lambda(v, d, body), τ) → go(Lambda(v, d, TypeApp(body, τ)))+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.termFunction $ var "f") (var "typ")) [+ _Function_lambda>>: "l" ~> var "go" @@+ (Core.termFunction $ Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.lambdaBody $ var "l")+ (var "typ")))],+ -- TypeApp(Let(bindings, body), τ) → go(Let(bindings, TypeApp(body, τ)))+ _Term_let>>: "lt" ~> var "go" @@+ (Core.termLet $ Core.let_+ (Core.letBindings $ var "lt")+ (Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.letBody $ var "lt")+ (var "typ")))]),+ "go">: ("t" ~>+ "forField" <~ ("fld" ~> Core.fieldWithTerm (var "go" @@ (Core.fieldTerm $ var "fld")) (var "fld")) $+ "forElimination" <~ ("elm" ~> cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "p" ~> Core.eliminationRecord (var "p"),+ _Elimination_union>>: "cs" ~> Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (var "go") (Core.caseStatementDefault $ var "cs"))+ (Lists.map (var "forField") (Core.caseStatementCases $ var "cs")),+ _Elimination_wrap>>: "name" ~> Core.eliminationWrap $ var "name"]) $+ "forFunction" <~ ("fun" ~> cases _Function (var "fun") Nothing [+ _Function_elimination>>: "elm" ~> Core.functionElimination $ var "forElimination" @@ var "elm",+ _Function_lambda>>: "l" ~> Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (var "go" @@ (Core.lambdaBody $ var "l")),+ _Function_primitive>>: "name" ~> Core.functionPrimitive $ var "name"]) $+ "forLet" <~ ("lt" ~>+ "mapBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (var "go" @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b")) $+ Core.let_+ (Lists.map (var "mapBinding") (Core.letBindings $ var "lt"))+ (var "go" @@ (Core.letBody $ var "lt"))) $+ "forMap" <~ ("m" ~>+ "forPair" <~ ("p" ~> pair (var "go" @@ (Pairs.first $ var "p")) (var "go" @@ (Pairs.second $ var "p"))) $+ Maps.fromList $ Lists.map (var "forPair") $ Maps.toList $ var "m") $+ cases _Term (var "t") Nothing [+ _Term_annotated>>: "at" ~> Core.termAnnotated $ Core.annotatedTerm+ (var "go" @@ (Core.annotatedTermBody $ var "at"))+ (Core.annotatedTermAnnotation $ var "at"),+ _Term_application>>: "a" ~> Core.termApplication $ Core.application+ (var "go" @@ (Core.applicationFunction $ var "a"))+ (var "go" @@ (Core.applicationArgument $ var "a")),+ _Term_either>>: "e" ~> Core.termEither $ Eithers.either_+ ("l" ~> left $ var "go" @@ var "l")+ ("r" ~> right $ var "go" @@ var "r")+ (var "e"),+ _Term_function>>: "fun" ~> Core.termFunction $ var "forFunction" @@ var "fun",+ _Term_let>>: "lt" ~> Core.termLet $ var "forLet" @@ var "lt",+ _Term_list>>: "els" ~> Core.termList $ Lists.map (var "go") (var "els"),+ _Term_literal>>: "v" ~> Core.termLiteral $ var "v",+ _Term_map>>: "m" ~> Core.termMap $ var "forMap" @@ var "m",+ _Term_maybe>>: "m" ~> Core.termMaybe $ Maybes.map (var "go") (var "m"),+ _Term_pair>>: "p" ~> Core.termPair $ pair+ (var "go" @@ (Pairs.first $ var "p"))+ (var "go" @@ (Pairs.second $ var "p")),+ _Term_record>>: "r" ~> Core.termRecord $ Core.record+ (Core.recordTypeName $ var "r")+ (Lists.map (var "forField") (Core.recordFields $ var "r")),+ _Term_set>>: "s" ~> Core.termSet $ Sets.fromList $ Lists.map (var "go") $ Sets.toList (var "s"),+ _Term_typeApplication>>: "tt" ~>+ "body1" <~ var "go" @@ (Core.typeApplicationTermBody $ var "tt") $+ var "push" @@ var "body1" @@ (Core.typeApplicationTermType $ var "tt"),+ _Term_typeLambda>>: "ta" ~> Core.termTypeLambda $ Core.typeLambda+ (Core.typeLambdaParameter $ var "ta")+ (var "go" @@ (Core.typeLambdaBody $ var "ta")),+ _Term_union>>: "i" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "i")+ (var "forField" @@ (Core.injectionField $ var "i")),+ _Term_unit>>: constant Core.termUnit,+ _Term_variable>>: "v" ~> Core.termVariable $ var "v",+ _Term_wrap>>: "wt" ~> Core.termWrap $ Core.wrappedTerm+ (Core.wrappedTermTypeName $ var "wt")+ (var "go" @@ (Core.wrappedTermBody $ var "wt"))])] $+ var "go" @@ var "term"++dataGraphToDefinitions :: TBinding (LanguageConstraints -> Bool -> Bool -> Bool -> Bool -> Graph -> [Namespace] -> Flow s (Graph, [[TermDefinition]]))+dataGraphToDefinitions = define "dataGraphToDefinitions" $+ doc ("Given a data graph along with language constraints and a designated list of namespaces,"+ <> " adapt the graph to the language constraints,"+ <> " then return the processed graph along with term definitions grouped by namespace (in the order of the input namespaces)."+ <> " Inference is performed before adaptation if bindings lack type annotations."+ <> " Hoisting must preserve type schemes; if any binding loses its type scheme after hoisting, the pipeline fails."+ <> " Adaptation preserves type application/lambda wrappers and adapts embedded types."+ <> " Post-adaptation inference is performed to ensure binding TypeSchemes are fully consistent."+ <> " The doExpand flag controls eta expansion."+ <> " The doHoistCaseStatements flag controls case statement hoisting (needed for Python)."+ <> " The doHoistPolymorphicLetBindings flag controls polymorphic let binding hoisting (needed for Java).") $+ "constraints" ~>+ "doInfer" ~> "doExpand" ~> "doHoistCaseStatements" ~> "doHoistPolymorphicLetBindings" ~>+ "graph0" ~> "namespaces" ~>++ "namespacesSet" <~ Sets.fromList (var "namespaces") $++ "isParentBinding" <~ ("b" ~> optCases (Names.namespaceOf @@ (Core.bindingName $ var "b"))+ false+ ("ns" ~> Sets.member (var "ns") (var "namespacesSet"))) $++ -- Steps 0a-2: Case statement hoisting pipeline (only for Python target, currently).+ -- 0a: Strip type lambdas so case expressions are visible to the hoister+ -- (the hoister does not traverse into type lambdas).+ -- 0b: Unshadow variables to prevent capture issues after hoisting.+ -- 1: Hoist case statements before inference.+ -- 2: Unshadow again after hoisting (hoisting introduces new lambda wrappers).+ "hoistCases" <~ ("g" ~>+ "graphDetyped" <~ Graph.graphWithElements (var "g")+ (Lists.map ("b" ~>+ Core.binding (Core.bindingName $ var "b")+ (Rewriting.stripTypeLambdas @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b"))+ (Graph.graphElements $ var "g")) $+ "gterm0" <~ Schemas.graphAsTerm @@ var "graphDetyped" $+ "gterm1" <~ Rewriting.unshadowVariables @@ var "gterm0" $+ "newElements" <~ Schemas.termAsGraph @@ var "gterm1" $+ "graphu0" <~ Graph.graphWithElements (var "graphDetyped") (var "newElements") $+ "graphh1" <<~ Hoisting.hoistCaseStatementsInGraph @@ var "graphu0" $+ "gterm2" <~ Schemas.graphAsTerm @@ var "graphh1" $+ "gterm3" <~ Rewriting.unshadowVariables @@ var "gterm2" $+ "newElements2" <~ Schemas.termAsGraph @@ var "gterm3" $+ produce $ Graph.graphWithElements (var "graphh1") (var "newElements2")) $++ "hoistPoly" <~ ("graphBefore" ~>+-- "typeContext" <<~ Schemas.graphToTypeContext @@ var "gBefore" $+ "letBefore" <~ Schemas.graphAsLet @@ var "graphBefore" $+ "letAfter" <~ Hoisting.hoistPolymorphicLetBindings @@ var "isParentBinding" @@ var "letBefore" $+ Graph.graphWithElements (var "graphBefore") (Core.letBindings $ var "letAfter")) $++ -- Note: this is a rough test of typedness, as it only checks that the top-level bindings are typed.+ "checkTyped" <~ ("debugLabel" ~> "g" ~>+ "untypedBindings" <~ Lists.map ("b" ~> Core.unName (Core.bindingName $ var "b"))+ (Lists.filter ("b" ~> Logic.not $ Maybes.isJust (Core.bindingType $ var "b")) (Graph.graphElements $ var "g")) $+ Logic.ifElse (Lists.null $ var "untypedBindings")+ (produce $ var "g")+ (Flows.fail $ Strings.concat [+ string "Found untyped bindings (", var "debugLabel", string "): ",+ Strings.intercalate (string ", ") (var "untypedBindings")])) $++ -- Normalize: push type applications inward past applications and lambdas.+ -- This corrects structures where TypeApp wraps App/Lambda after adaptation and eta expansion.+ "normalizeGraph" <~ ("g" ~> Graph.graphWithElements (var "g")+ (Lists.map ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (pushTypeAppsInward @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b"))+ (Graph.graphElements $ var "g"))) $++ -- Step 1: hoist case statements if needed (currently, for the Python target)+ "graph1" <<~ Logic.ifElse (var "doHoistCaseStatements")+ (var "hoistCases" @@ var "graph0")+ (produce $ var "graph0") $++ -- Step 2: infer types if necessary+ "graph2" <<~ Logic.ifElse (var "doInfer")+ (Inference.inferGraphTypes @@ var "graph1")+ (var "checkTyped" @@ string "after case hoisting" @@ var "graph1") $++ -- Step 3: hoist let bindings if necessary (currently, for the Java target)+ "graph3" <<~ Logic.ifElse (var "doHoistPolymorphicLetBindings")+ (var "checkTyped" @@ string "after let hoisting"+ @@ (var "hoistPoly" @@ var "graph2"))+ (produce $ var "graph2") $++ -- Step 4: adapt the graph (includes eta expansion if enabled).+ -- Adaptation preserves type application/lambda wrappers and adapts embedded types+ -- (literal types, lambda domains, TypeSchemes).+ "graph4" <<~ Flows.bind+ (adaptDataGraph @@ var "constraints" @@ var "doExpand" @@ var "graph3")+ (var "checkTyped" @@ (string "after adaptation")) $++ -- Step 5: normalize the adapted graph+ "graph5" <~ var "normalizeGraph" @@ var "graph4" $++ -- Construct term definitions grouped by namespace "toDef" <~ ("el" ~>- "ts" <~ Optionals.fromJust (Core.bindingType $ var "el") $- Module.termDefinition- (Core.bindingName $ var "el")- (Core.bindingTerm $ var "el")- (ref Schemas.typeSchemeToFTypeDef @@ var "ts")) $+ Maybes.map+ ("ts" ~> Module.termDefinition+ (Core.bindingName $ var "el")+ (Core.bindingTerm $ var "el")+ (var "ts"))+ (Core.bindingType $ var "el")) $+ -- Filter to elements in the requested namespaces+ "selectedElements" <~ Lists.filter+ ("el" ~> optCases (Names.namespaceOf @@ (Core.bindingName $ var "el"))+ false+ ("ns" ~> Sets.member (var "ns") (var "namespacesSet")))+ (Graph.graphElements $ var "graph5") $+ -- Group elements by namespace+ "elementsByNamespace" <~ Lists.foldl+ ("acc" ~> "el" ~>+ optCases (Names.namespaceOf @@ (Core.bindingName $ var "el"))+ (var "acc")+ ("ns" ~>+ "existing" <~ Maybes.maybe (list ([] :: [TTerm Binding])) (unaryFunction Equality.identity) (Maps.lookup (var "ns") (var "acc")) $+ Maps.insert (var "ns") (Lists.concat2 (var "existing") (list [var "el"])) (var "acc")))+ Maps.empty+ (var "selectedElements") $+ -- Produce definitions in the order of the input namespaces+ "defsGrouped" <~ Lists.map+ ("ns" ~>+ "elsForNs" <~ Maybes.maybe (list ([] :: [TTerm Binding])) (unaryFunction Equality.identity) (Maps.lookup (var "ns") (var "elementsByNamespace")) $+ Maybes.cat (Lists.map (var "toDef") (var "elsForNs")))+ (var "namespaces") $+ produce $ pair- (var "graph2")- (Lists.map- ("names" ~> Lists.map (var "toDef") $- Lists.map ("n" ~> Optionals.fromJust $ Maps.lookup (var"n") (Graph.graphElements $ var "graph2")) (var "names"))- (var "nameLists"))+ (var "graph5")+ (var "defsGrouped") -literalTypeSupportedDef :: TBinding (LanguageConstraints -> LiteralType -> Bool)-literalTypeSupportedDef = define "literalTypeSupported" $+literalTypeSupported :: TBinding (LanguageConstraints -> LiteralType -> Bool)+literalTypeSupported = define "literalTypeSupported" $ doc "Check if a literal type is supported by the given language constraints" $ "constraints" ~> "lt" ~>+ "forType" <~ ("lt" ~> cases _LiteralType (var "lt")+ (Just true) [+ _LiteralType_float>>: "ft" ~> Sets.member (var "ft") (Coders.languageConstraintsFloatTypes $ var "constraints"),+ _LiteralType_integer>>: "it" ~> Sets.member (var "it") (Coders.languageConstraintsIntegerTypes $ var "constraints")]) $ Logic.ifElse (Sets.member- (ref Variants.literalTypeVariantDef @@ var "lt")+ (Reflect.literalTypeVariant @@ var "lt") (Coders.languageConstraintsLiteralVariants $ var "constraints"))- (cases _LiteralType (var "lt")- (Just true) [- _LiteralType_float>>: "ft" ~> Sets.member (var "ft") (Coders.languageConstraintsFloatTypes $ var "constraints"),- _LiteralType_integer>>: "it" ~> Sets.member (var "it") (Coders.languageConstraintsIntegerTypes $ var "constraints")])+ (var "forType" @@ var "lt") false -schemaGraphToDefinitionsDef :: TBinding (LanguageConstraints -> Graph -> [[Name]] -> Flow s (M.Map Name Type, [[TypeDefinition]]))-schemaGraphToDefinitionsDef = define "schemaGraphToDefinitions" $+schemaGraphToDefinitions :: TBinding (LanguageConstraints -> Graph -> [[Name]] -> Flow s (M.Map Name Type, [[TypeDefinition]]))+schemaGraphToDefinitions = define "schemaGraphToDefinitions" $ doc ("Given a schema graph along with language constraints and a designated list of element names," <> " adapt the graph to the language constraints," <> " then return a corresponding type definition for each element name.") $ "constraints" ~> "graph" ~> "nameLists" ~>- "litmap" <~ ref adaptLiteralTypesMapDef @@ var "constraints" $- "tmap0" <<~ ref Schemas.graphAsTypesDef @@ var "graph" $- "tmap1" <<~ ref adaptGraphSchemaDef @@ var "constraints" @@ var "litmap" @@ var "tmap0" $- "toDef" <~ ("pair" ~> Module.typeDefinition (first $ var "pair") (second $ var "pair")) $+ "litmap" <~ adaptLiteralTypesMap @@ var "constraints" $+ "tmap0" <<~ Schemas.graphAsTypes @@ var "graph" $+ "tmap1" <<~ adaptGraphSchema @@ var "constraints" @@ var "litmap" @@ var "tmap0" $+ "toDef" <~ ("pair" ~> Module.typeDefinition (Pairs.first $ var "pair") (Pairs.second $ var "pair")) $ produce $ pair (var "tmap1") (Lists.map ("names" ~> Lists.map (var "toDef") $- Lists.map ("n" ~> pair (var "n") (Optionals.fromJust $ Maps.lookup (var "n") (var "tmap1"))) (var "names"))+ Lists.map ("n" ~> pair (var "n") (Maybes.fromJust $ Maps.lookup (var "n") (var "tmap1"))) (var "names")) (var "nameLists"))+-- Flows.fail $ "schema graph for definitions: " ++ (ShowGraph.graph @@ var "graph") -termAlternativesDef :: TBinding (Term -> Flow Graph [Term])-termAlternativesDef = define "termAlternatives" $+termAlternatives :: TBinding (Term -> Flow Graph [Term])+termAlternatives = define "termAlternatives" $ doc "Find a list of alternatives for a given term, if any" $ "term" ~> cases _Term (var "term")- (Just $ produce $ list []) [+ (Just $ produce $ list ([] :: [TTerm Term])) [ _Term_annotated>>: "at" ~>- "term2" <~ Core.annotatedTermSubject (var "at") $+ "term2" <~ Core.annotatedTermBody (var "at") $ produce $ list [ var "term2"], -- TODO: lossy- _Term_optional>>: "ot" ~> produce $ list [+ _Term_maybe>>: "ot" ~> produce $ list [ Core.termList $ optCases (var "ot")- (list [])+ (list ([] :: [TTerm Term])) ("term2" ~> list [var "term2"])],- -- Note: no type abstractions or type applications, as we are not expecting System F terms here+ _Term_typeLambda>>: "abs" ~>+ "term2" <~ Core.typeLambdaBody (var "abs") $+ produce $ list [var "term2"],+ _Term_typeApplication>>: "ta" ~>+ "term2" <~ Core.typeApplicationTermBody (var "ta") $+ produce $ list [var "term2"], _Term_union>>: "inj" ~> "tname" <~ Core.injectionTypeName (var "inj") $ "field" <~ Core.injectionField (var "inj") $ "fname" <~ Core.fieldName (var "field") $ "fterm" <~ Core.fieldTerm (var "field") $- "rt" <<~ ref Schemas.requireUnionTypeDef @@ var "tname" $+ "forFieldType" <~ ("ft" ~>+ "ftname" <~ Core.fieldTypeName (var "ft") $+ Core.field (var "fname") $ Core.termMaybe $ Logic.ifElse (Equality.equal (var "ftname") (var "fname"))+ (just $ var "fterm")+ (nothing)) $+ "rt" <<~ Schemas.requireUnionType @@ var "tname" $ produce $ list [- "forFieldType" <~ ("ft" ~>- "ftname" <~ Core.fieldTypeName (var "ft") $- Core.field (var "fname") $ Core.termOptional $ Logic.ifElse (Equality.equal (var "ftname") (var "fname"))- (just $ var "fterm")- (nothing)) $- "fields" <~ Lists.map (var "forFieldType") (Core.rowTypeFields $ var "rt") $- Core.termRecord $ Core.record (var "tname") (var "fields")],+ Core.termRecord $ Core.record (var "tname") (Lists.map (var "forFieldType") (Core.rowTypeFields $ var "rt"))], _Term_unit>>: constant $ produce $ list [ Core.termLiteral $ Core.literalBoolean true], _Term_wrap>>: "wt" ~>- "term2" <~ Core.wrappedTermObject (var "wt") $+ "term2" <~ Core.wrappedTermBody (var "wt") $ produce $ list [ var "term2"]] -typeAlternativesDef :: TBinding (Type -> [Type])-typeAlternativesDef = define "typeAlternatives" $+typeAlternatives :: TBinding (Type -> [Type])+typeAlternatives = define "typeAlternatives" $ doc "Find a list of alternatives for a given type, if any" $ "type" ~> cases _Type (var "type")- (Just $ list []) [+ (Just $ list ([] :: [TTerm Type])) [ _Type_annotated>>: "at" ~>- "type2" <~ Core.annotatedTypeSubject (var "at") $+ "type2" <~ Core.annotatedTypeBody (var "at") $ list [var "type2"], -- TODO: lossy- _Type_optional>>: "ot" ~> list [+ _Type_maybe>>: "ot" ~> list [ Core.typeList $ var "ot"], _Type_union>>: "rt" ~> "tname" <~ Core.rowTypeTypeName (var "rt") $ "fields" <~ Core.rowTypeFields (var "rt") $+ "toOptField" <~ ("f" ~> Core.fieldType (Core.fieldTypeName $ var "f") (MetaTypes.optional $ Core.fieldTypeType $ var "f")) $+ "optFields" <~ Lists.map (var "toOptField") (var "fields") $ list [- Core.typeRecord $ Core.rowType (var "tname") (var "fields")],+ Core.typeRecord $ Core.rowType (var "tname") (var "optFields")], _Type_unit>>: constant $ list [ Core.typeLiteral $ Core.literalTypeBoolean]]
src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Terms.hs view
@@ -1,764 +1,853 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Adapt.Terms where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals-import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Literals as Lits-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants---module_ :: Module-module_ = Module (Namespace "hydra.adapt.terms") elements- [ExtractCore.module_, AdaptLiterals.module_, Lits.module_, Rewriting.module_,- Schemas.module_, ShowCore.module_]- kernelTypesModules $- Just "Adapter framework for types and terms"- where- elements = [- el fieldAdapterDef,- el forTypeReferenceDef,- el functionProxyNameDef,- el functionProxyTypeDef,- el functionToUnionDef,- el lambdaToMonotypeDef,- el optionalToListDef,- el passApplicationDef,- el passFunctionDef,- el passForallDef,- el passLiteralDef,- el passListDef,- el passMapDef,- el passOptionalDef,- el passProductDef,- el passRecordDef,- el passSetDef,- el passSumDef,- el passUnionDef,- el passUnitDef,- el passWrappedDef,- el setToListDef,- el simplifyApplicationDef,- el termAdapterDef,- el unionToRecordDef,- el unionTypeToRecordTypeDef,- el unitToRecordDef,- el wrapToUnwrappedDef,- el withGraphContextDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--fieldAdapterDef :: TBinding (FieldType -> Flow AdapterContext (SymmetricAdapter AdapterContext FieldType Field))-fieldAdapterDef = define "fieldAdapter" $- doc "Create an adapter for field types" $- lambda "ftyp" $- Flows.bind (ref termAdapterDef @@ (Core.fieldTypeType $ var "ftyp")) $ lambda "ad" $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "ftyp")- (Core.fieldType (Core.fieldTypeName $ var "ftyp") (Compute.adapterTarget $ var "ad"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "field"] $ lets [- "name">: Core.fieldName $ var "field",- "term">: Core.fieldTerm $ var "field"] $- Flows.map (lambda "newTerm" $ Core.field (var "name") (var "newTerm")) $- ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "term"))--forTypeReferenceDef :: TBinding (Name -> Flow AdapterContext (SymmetricAdapter AdapterContext Type Term))-forTypeReferenceDef = define "forTypeReference" $- doc "This function accounts for recursive type definitions" $- lambda "name" $- trace (Strings.cat2 (string "adapt named type ") (unwrap _Name @@ var "name")) $ lets [- "lossy">: false,- "placeholder">: Compute.adapter (var "lossy") (Core.typeVariable $ var "name") (Core.typeVariable $ var "name") $- ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- bind "cx" (ref Monads.getStateDef) $ lets [- "adapters">: Coders.adapterContextAdapters $ var "cx"] $- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "no adapter for reference type ") (unwrap _Name @@ var "name"))- (lambda "ad" $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "term")- (Maps.lookup (var "name") (var "adapters")))] $- bind "cx" (ref Monads.getStateDef) $ lets [- "adapters">: Coders.adapterContextAdapters $ var "cx"] $- Optionals.maybe- (lets [- "newAdapters">: Maps.insert (var "name") (var "placeholder") (var "adapters"),- "newCx">: Coders.adapterContext- (Coders.adapterContextGraph $ var "cx")- (Coders.adapterContextLanguage $ var "cx")- (var "newAdapters")] $- Flows.bind (ref Monads.putStateDef @@ var "newCx") $ constant $- bind "mt" (ref withGraphContextDef @@ (ref Schemas.resolveTypeDef @@ (Core.typeVariable $ var "name"))) $- Optionals.maybe- (Flows.pure $ Compute.adapter (var "lossy") (Core.typeVariable $ var "name") (Core.typeVariable $ var "name") $- ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ Flows.pure $ var "term"))- (lambda "t" $- bind "actual" (ref termAdapterDef @@ var "t") $ lets [- "finalAdapters">: Maps.insert (var "name") (var "actual") (var "adapters"),- "finalCx">: Coders.adapterContext- (Coders.adapterContextGraph $ var "cx")- (Coders.adapterContextLanguage $ var "cx")- (var "finalAdapters")] $- Flows.bind (ref Monads.putStateDef @@ var "finalCx") $ constant $ Flows.pure $ var "actual")- (var "mt"))- (unaryFunction Flows.pure)- (Maps.lookup (var "name") (var "adapters"))--functionProxyNameDef :: TBinding Name-functionProxyNameDef = define "functionProxyName" $- Core.name "hydra.core.FunctionProxy"--functionProxyTypeDef :: TBinding (a -> Type)-functionProxyTypeDef = define "functionProxyType" $- doc "Generate a function proxy type for a given domain type" $- constant $ Core.typeUnion $ Core.rowType (ref functionProxyNameDef) $ list [- Core.fieldType (Core.nameLift _Elimination_wrap) TTypes.string,- Core.fieldType (Core.nameLift _Elimination_record) TTypes.string,- Core.fieldType (Core.nameLift _Elimination_union) TTypes.string,- Core.fieldType (Core.nameLift _Function_lambda) TTypes.string,- Core.fieldType (Core.nameLift _Function_primitive) TTypes.string,- Core.fieldType (Core.nameLift _Term_variable) TTypes.string]--functionToUnionDef :: TBinding TypeAdapter-functionToUnionDef = define "functionToUnion" $- doc "Convert function types to union types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_function>>: lambda "ft" $ lets [- "dom">: Core.functionTypeDomain $ var "ft",- "cod">: Core.functionTypeCodomain $ var "ft",- "unionType">:- bind "domAd" (ref termAdapterDef @@ var "dom") $- Flows.pure $ Core.typeUnion $ Core.rowType (ref functionProxyNameDef) $ list [- Core.fieldType (Core.nameLift _Elimination_wrap) TTypes.string,- Core.fieldType (Core.nameLift _Elimination_record) TTypes.string,- Core.fieldType (Core.nameLift _Elimination_union) TTypes.string,- Core.fieldType (Core.nameLift _Function_lambda) TTypes.string,- Core.fieldType (Core.nameLift _Function_primitive) TTypes.string,- Core.fieldType (Core.nameLift _Term_variable) TTypes.string],- "encode">: lambdas ["ad", "term"] $ lets [- "strippedTerm">: ref Rewriting.deannotateTermDef @@ var "term"] $- Compute.coderEncode (Compute.adapterCoder $ var "ad") @@ (cases _Term (var "strippedTerm") Nothing [- _Term_function>>: lambda "f" $ cases _Function (var "f") Nothing [- _Function_elimination>>: lambda "e" $ cases _Elimination (var "e") Nothing [- _Elimination_wrap>>: lambda "name" $ Core.termUnion $ Core.injection (ref functionProxyNameDef) $- Core.field (Core.nameLift _Elimination_wrap) $ TTerms.stringLift $ unwrap _Name @@ var "name",- _Elimination_record>>: lambda "r" $ Core.termUnion $ Core.injection (ref functionProxyNameDef) $- Core.field (Core.nameLift _Elimination_record) $ TTerms.stringLift (ref ShowCore.termDef @@ var "term"),- _Elimination_union>>: lambda "u" $ Core.termUnion $ Core.injection (ref functionProxyNameDef) $- Core.field (Core.nameLift _Elimination_union) $ TTerms.stringLift (ref ShowCore.termDef @@ var "term")],- _Function_lambda>>: lambda "l" $ Core.termUnion $ Core.injection (ref functionProxyNameDef) $- Core.field (Core.nameLift _Function_lambda) $ TTerms.stringLift (ref ShowCore.termDef @@ var "term"),- _Function_primitive>>: lambda "name" $ Core.termUnion $ Core.injection (ref functionProxyNameDef) $- Core.field (Core.nameLift _Function_primitive) $ TTerms.stringLift $ unwrap _Name @@ var "name"],- _Term_variable>>: lambda "name" $- Core.termUnion $ Core.injection (ref functionProxyNameDef) $ Core.field (Core.nameLift _Term_variable) $ TTerms.stringLift $ unwrap _Name @@ var "name"]),- "decode">: lambdas ["ad", "term"] $ lets [- "readFromString">: lambda "term" $- bind "s" (ref ExtractCore.stringDef @@ var "term") $- Optionals.maybe- (Flows.fail $ Strings.cat2 ("failed to parse term: ") (var "s"))- (unaryFunction Flows.pure)- (ref ShowCore.readTermDef @@ var "s"),- "notFound">: lambda "fname" $ Flows.fail $ Strings.cat2 (string "unexpected field: ") (unwrap _Name @@ var "fname"),- "forCases">: lambda "fterm" $ ref withGraphContextDef @@ (var "readFromString" @@ var "fterm"),- "forLambda">: lambda "fterm" $ ref withGraphContextDef @@ (var "readFromString" @@ var "fterm"),- "forWrapped">: lambda "fterm" $ ref withGraphContextDef @@ (Flows.map (lambda "s" $ TTerms.unwrap $ Core.name $ var "s") (ref ExtractCore.stringDef @@ var "fterm")),- "forPrimitive">: lambda "fterm" $ ref withGraphContextDef @@ (Flows.map (lambda "s" $ TTerms.primitiveLift $ Core.name $ var "s") (ref ExtractCore.stringDef @@ var "fterm")),- "forProjection">: lambda "fterm" $ ref withGraphContextDef @@ (var "readFromString" @@ var "fterm"),- "forVariable">: lambda "fterm" $ ref withGraphContextDef @@ (Flows.map (lambda "s" $ Core.termVariable $ Core.name $ var "s") (ref ExtractCore.stringDef @@ var "fterm"))] $- bind "injTerm" (Compute.coderDecode (Compute.adapterCoder $ var "ad") @@ var "term") $- bind "field" (ref withGraphContextDef @@ (ref ExtractCore.injectionDef @@ (ref functionProxyNameDef) @@ var "injTerm")) $ lets [- "fname">: Core.fieldName $ var "field",- "fterm">: Core.fieldTerm $ var "field"] $- Optionals.fromMaybe (var "notFound" @@ var "fname") $ Maps.lookup (var "fname") $ Maps.fromList $ list [- pair (Core.nameLift _Elimination_wrap) (var "forWrapped" @@ var "fterm"),- pair (Core.nameLift _Elimination_record) (var "forProjection" @@ var "fterm"),- pair (Core.nameLift _Elimination_union) (var "forCases" @@ var "fterm"),- pair (Core.nameLift _Function_lambda) (var "forLambda" @@ var "fterm"),- pair (Core.nameLift _Function_primitive) (var "forPrimitive" @@ var "fterm"),- pair (Core.nameLift _Term_variable) (var "forVariable" @@ var "fterm")]] $- bind "ut" (var "unionType") $- bind "ad" (ref termAdapterDef @@ var "ut") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (Compute.adapterTarget $ var "ad")- (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad"))]--lambdaToMonotypeDef :: TBinding TypeAdapter-lambdaToMonotypeDef = define "lambdaToMonotype" $- doc "Convert forall types to monotypes" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_forall>>: lambda "ft" $ lets [- "body">: Core.forallTypeBody $ var "ft"] $- bind "ad" (ref termAdapterDef @@ var "body") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (Compute.adapterTarget $ var "ad")- (Compute.adapterCoder $ var "ad")]--optionalToListDef :: TBinding TypeAdapter-optionalToListDef = define "optionalToList" $- doc "Convert optional types to list types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_optional>>: lambda "ot" $- bind "ad" (ref termAdapterDef @@ var "ot") $ lets [- "encode">: lambda "term" $ cases _Term (var "term") Nothing [- _Term_optional>>: lambda "m" $ Optionals.maybe- (Flows.pure $ TTerms.list [])- (lambda "r" $- bind "encoded" (Compute.coderEncode (Compute.adapterCoder $ var "ad") @@ var "r") $- Flows.pure $ Core.termList $ list [var "encoded"])- (var "m")],- "decode">: lambda "term" $ cases _Term (var "term") Nothing [- _Term_list>>: lambda "l" $ Flows.map (unaryFunction Core.termOptional) $ Logic.ifElse (Lists.null $ var "l")- (Flows.pure $ nothing)- (bind "decoded" (Compute.coderDecode (Compute.adapterCoder $ var "ad") @@ (Lists.head $ var "l")) $- Flows.pure $ just $ var "decoded")]] $- Flows.pure $ Compute.adapter- false- (var "t")- (Core.typeList $ Compute.adapterTarget $ var "ad")- (Compute.coder (var "encode") (var "decode"))]--passApplicationDef :: TBinding TypeAdapter-passApplicationDef = define "passApplication" $- doc "Pass through application types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_application>>: lambda "at" $ lets [- "lhs">: Core.applicationTypeFunction $ var "at",- "rhs">: Core.applicationTypeArgument $ var "at"] $- bind "lhsAd" (ref termAdapterDef @@ var "lhs") $- bind "rhsAd" (ref termAdapterDef @@ var "rhs") $- Flows.pure $ Compute.adapter- (Logic.or (Compute.adapterIsLossy $ var "lhsAd") (Compute.adapterIsLossy $ var "rhsAd"))- (var "t")- (Core.typeApplication $ Core.applicationType (Compute.adapterTarget $ var "lhsAd") (Compute.adapterTarget $ var "rhsAd"))- (ref AdaptUtils.bidirectionalDef @@- (lambdas ["dir", "term"] $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "lhsAd") @@ var "term"))]--passFunctionDef :: TBinding TypeAdapter-passFunctionDef = define "passFunction" $- doc "Pass through function types with adaptation" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_function >>: lambda "ft" $ lets [- "dom">: Core.functionTypeDomain $ var "ft",- "cod">: Core.functionTypeCodomain $ var "ft"] $- bind "domAd" (ref termAdapterDef @@ var "dom") $- bind "codAd" (ref termAdapterDef @@ var "cod") $- bind "caseAds" (cases _Type (ref Rewriting.deannotateTypeDef @@ var "dom") (Just $ Flows.pure $ Maps.empty) [- _Type_union >>: lambda "rt" $- bind "pairs" (Flows.mapList- (lambda "f" $- bind "ad" (ref fieldAdapterDef @@ Core.fieldType- (Core.fieldTypeName $ var "f")- (Core.typeFunction $ Core.functionType- (Core.fieldTypeType $ var "f")- (var "cod")))- $ Flows.pure $ pair (Core.fieldTypeName $ var "f") (var "ad"))- (Core.rowTypeFields $ var "rt")) $- Flows.pure $ Maps.fromList $ var "pairs"]) $- bind "optionAd" (cases _Type (ref Rewriting.deannotateTypeDef @@ var "dom") (Just $ Flows.pure nothing) [- _Type_optional >>: lambda "ot" $- Flows.map (unaryFunction just) $ ref termAdapterDef @@ TTypes.function (var "ot") (var "cod")]) $ lets [- "lossy">: Logic.or- (Compute.adapterIsLossy $ var "codAd")- (Logic.ors $ Lists.map (lambda "pair" $ Compute.adapterIsLossy $ second $ var "pair") $ Maps.toList $ var "caseAds"),- "target">: TTypes.function (Compute.adapterTarget $ var "domAd") (Compute.adapterTarget $ var "codAd"),- "getCoder">: lambda "fname" $ Optionals.maybe- (ref AdaptUtils.idCoderDef)- (unaryFunction Compute.adapterCoder)- (Maps.lookup (var "fname") (var "caseAds"))] $- Flows.pure $ Compute.adapter (var "lossy") (var "t") (var "target") $- ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- cases _Term (ref Rewriting.deannotateTermDef @@ var "term") (Just $ Flows.pure $ var "term") [- _Term_function >>: lambda "f" $- Flows.map (unaryFunction Core.termFunction) $- cases _Function (var "f") Nothing [- _Function_elimination >>: lambda "e" $- Flows.map (unaryFunction Core.functionElimination) $- cases _Elimination (var "e") Nothing [- _Elimination_union >>: lambda "cs" $ lets [- "n">: Core.caseStatementTypeName $ var "cs",- "def">: Core.caseStatementDefault $ var "cs",- "cases">: Core.caseStatementCases $ var "cs"] $- bind "rcases" (Flows.mapList- (lambda "f" $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (var "getCoder" @@ Core.fieldName (var "f")) @@ var "f")- (var "cases")) $- bind "rdef" (Optionals.maybe- (Flows.pure nothing)- (lambda "d" $ Flows.map (unaryFunction just) $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ Compute.adapterCoder (var "codAd") @@ var "d")- (var "def")) $- Flows.pure $ Core.eliminationUnion $ Core.caseStatement (var "n") (var "rdef") (var "rcases")],- _Function_lambda >>: lambda "l" $ lets [- "var">: Core.lambdaParameter $ var "l",- "d" >: Core.lambdaDomain $ var "l",- "body">: Core.lambdaBody $ var "l"] $- bind "newBody" (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ Compute.adapterCoder (var "codAd") @@ var "body") $- Flows.pure $ Core.functionLambda $ Core.lambda (var "var") (var "d") (var "newBody"),- _Function_primitive >>: lambda "name" $ Flows.pure $ Core.functionPrimitive $ var "name"]]- )]--passForallDef :: TBinding TypeAdapter-passForallDef = define "passForall" $- doc "Pass through forall types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_forall>>: lambda "ft" $ lets [- "v">: Core.forallTypeParameter $ var "ft",- "body">: Core.forallTypeBody $ var "ft"] $- Flows.bind (ref termAdapterDef @@ var "body") $ lambda "ad" $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (Core.typeForall $ Core.forallType (var "v") (Compute.adapterTarget $ var "ad"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "term"))]--passLiteralDef :: TBinding TypeAdapter-passLiteralDef = define "passLiteral" $- doc "Pass through literal types with literal adaptation" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_literal>>: lambda "lt" $- bind "ad" (ref AdaptLiterals.literalAdapterDef @@ var "lt") $ lets [- "step">: ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- bind "l" (ref withGraphContextDef @@ (ref ExtractCore.literalDef @@ var "term")) $- Flows.map (unaryFunction $ Core.termLiteral) (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "l"))] $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (Core.typeLiteral $ Compute.adapterSource $ var "ad")- (Core.typeLiteral $ Compute.adapterTarget $ var "ad")- (var "step")]--passListDef :: TBinding TypeAdapter-passListDef = define "passList" $- doc "Pass through list types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_list>>: lambda "lt" $- bind "ad" (ref termAdapterDef @@ var "lt") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (TTypes.list $ Compute.adapterTarget $ var "ad")- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_list>>: lambda "terms" $- bind "newTerms" (Flows.mapList (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad")) (var "terms")) $- Flows.pure $ Core.termList $ var "newTerms"]))]--passMapDef :: TBinding TypeAdapter-passMapDef = define "passMap" $- doc "Pass through map types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_map>>: lambda "mt" $ lets [- "kt">: Core.mapTypeKeys $ var "mt",- "vt">: Core.mapTypeValues $ var "mt"] $- bind "kad" (ref termAdapterDef @@ var "kt") $- bind "vad" (ref termAdapterDef @@ var "vt") $- Flows.pure $ Compute.adapter- (Logic.or (Compute.adapterIsLossy $ var "kad") (Compute.adapterIsLossy $ var "vad"))- (var "t")- (TTypes.map (Compute.adapterTarget $ var "kad") (Compute.adapterTarget $ var "vad"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_map>>: lambda "m" $- bind "newPairs" (Flows.mapList- (lambda "pair" $ lets [- "k">: first $ var "pair",- "v">: second $ var "pair"] $- bind "newK" (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "kad") @@ var "k") $- bind "newV" (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "vad") @@ var "v") $- Flows.pure $ pair (var "newK") (var "newV"))- (Maps.toList $ var "m")) $- Flows.pure $ Core.termMap $ Maps.fromList $ var "newPairs"]))]--passOptionalDef :: TBinding TypeAdapter-passOptionalDef = define "passOptional" $- doc "Pass through optional types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_optional>>: lambda "ot" $ lets [- "mapTerm">: lambdas ["coder", "dir", "term"] $- bind "opt" (ref withGraphContextDef @@ (ref ExtractCore.optionalDef @@ unaryFunction Flows.pure @@ var "term")) $- bind "newOpt" (Flows.mapOptional (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ var "coder") (var "opt")) $- Flows.pure $ Core.termOptional $ var "newOpt"] $- bind "adapter" (ref termAdapterDef @@ var "ot") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "adapter")- (var "t")- (Core.typeOptional $ Compute.adapterTarget $ var "adapter")- (ref AdaptUtils.bidirectionalDef @@ (var "mapTerm" @@ (Compute.adapterCoder $ var "adapter")))]--passProductDef :: TBinding TypeAdapter-passProductDef = define "passProduct" $- doc "Pass through product types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_product>>: lambda "types" $- Flows.bind (Flows.mapList (ref termAdapterDef) (var "types")) $ lambda "ads" $ lets [- "lossy">: Logic.ors $ Lists.map (unaryFunction Compute.adapterIsLossy) (var "ads")] $- Flows.pure $ Compute.adapter- (var "lossy")- (var "t")- (Core.typeProduct $ Lists.map (unaryFunction Compute.adapterTarget) (var "ads"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_product>>: lambda "tuple" $- bind "newTuple" (Flows.sequence $ Lists.zipWith- (lambdas ["term", "ad"] $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "term")- (var "tuple")- (var "ads")) $ Flows.pure $ Core.termProduct $ var "newTuple"]))]--passRecordDef :: TBinding TypeAdapter-passRecordDef = define "passRecord" $- doc "Pass through record types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_record>>: lambda "rt" $- bind "adapters" (Flows.mapList (ref fieldAdapterDef) (Core.rowTypeFields $ var "rt")) $ lets [- "lossy">: Logic.ors $ Lists.map (unaryFunction Compute.adapterIsLossy) (var "adapters"),- "sfields'">: Lists.map (unaryFunction Compute.adapterTarget) (var "adapters")] $- Flows.pure $ Compute.adapter- (var "lossy")- (var "t")- (Core.typeRecord $ Core.rowType (Core.rowTypeTypeName $ var "rt") (var "sfields'"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_record>>: lambda "rec" $ lets [- "dfields">: Core.recordFields $ var "rec"] $- bind "newFields" (Flows.sequence $ Lists.zipWith- (lambdas ["ad", "f"] $ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "f" )- (var "adapters")- (var "dfields")) $- Flows.pure $ Core.termRecord $ Core.record (Core.rowTypeTypeName $ var "rt") (var "newFields")]))]--passSetDef :: TBinding TypeAdapter-passSetDef = define "passSet" $- doc "Pass through set types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_set>>: lambda "st" $- Flows.bind (ref termAdapterDef @@ var "st") $ lambda "ad" $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (TTypes.set $ Compute.adapterTarget $ var "ad")- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_set>>: lambda "terms" $- bind "newTerms" (Flows.mapList (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad")) (Sets.toList $ var "terms")) $- Flows.pure $ Core.termSet $ Sets.fromList $ var "newTerms"]))]--passSumDef :: TBinding TypeAdapter-passSumDef = define "passSum" $- doc "Pass through sum types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_sum>>: lambda "types" $- Flows.bind (Flows.mapList (ref termAdapterDef) (var "types")) $ lambda "ads" $ lets [- "lossy">: Logic.ors $ Lists.map (unaryFunction Compute.adapterIsLossy) (var "ads")] $- Flows.pure $ Compute.adapter- (var "lossy")- (var "t")- (Core.typeSum $ Lists.map (unaryFunction Compute.adapterTarget) (var "ads"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $ cases _Term (var "term") Nothing [- _Term_sum>>: lambda "s" $ lets [- "i">: Core.sumIndex $ var "s",- "n">: Core.sumSize $ var "s",- "term">: Core.sumTerm $ var "s"] $- bind "newTerm" (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ Lists.at (var "i") (var "ads")) @@ var "term") $- Flows.pure $ Core.termSum $ Core.sum (var "i") (var "n") (var "newTerm")]))]--passUnionDef :: TBinding TypeAdapter-passUnionDef = define "passUnion" $- doc "Pass through union types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_union>>: lambda "rt" $ lets [- "sfields">: Core.rowTypeFields $ var "rt",- "tname">: Core.rowTypeTypeName $ var "rt",- "getAdapter">: lambdas ["adaptersMap", "f"] $- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "no such field: ") (unwrap _Name @@ (Core.fieldName $ var "f")))- (unaryFunction Flows.pure)- (Maps.lookup (Core.fieldName $ var "f") (var "adaptersMap"))] $- bind "adapters" (Flows.mapList- (lambda "f" $ Flows.bind (ref fieldAdapterDef @@ var "f") $ lambda "ad" $- Flows.pure $ pair (Core.fieldTypeName $ var "f") (var "ad"))- (var "sfields")) $ lets [- "adaptersMap">: Maps.fromList $ var "adapters",- "lossy">: Logic.ors $ Lists.map (lambda "pair" $ Compute.adapterIsLossy $ second $ var "pair") (var "adapters"),- "sfields'">: Lists.map (lambda "pair" $ Compute.adapterTarget $ second $ var "pair") (var "adapters")] $- Flows.pure $ Compute.adapter- (var "lossy")- (var "t")- (Core.typeUnion $ Core.rowType (var "tname") (var "sfields'"))- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- -- Note: this is a shortcut, since we anticipate deprecating the current term adapter logic- produce $ var "term"))]- -- TODO: consider restoring the following--- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $--- "dfield" <<~ ref withGraphContextDef @@ (ref ExtractCore.injectionDef @@ var "tname" @@ var "term") $--- "ad" <<~ var "getAdapter" @@ var "adaptersMap" @@ var "dfield" $--- "newField" <<~ ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "dfield" $--- produce $ Core.termUnion $ Core.injection (var "tname") (var "newField")))]--passUnitDef :: TBinding TypeAdapter-passUnitDef = define "passUnit" $- doc "Pass through unit types" $- constant $ Flows.pure $ Compute.adapter false Core.typeUnit Core.typeUnit $- Compute.coder- (constant $ Flows.pure Core.termUnit)- (constant $ Flows.pure Core.termUnit)--passWrappedDef :: TBinding TypeAdapter-passWrappedDef = define "passWrapped" $- doc "Pass through wrapped types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_wrap>>: lambda "wt" $ lets [- "tname">: Core.wrappedTypeTypeName $ var "wt",- "ot">: Core.wrappedTypeObject $ var "wt",- "mapTerm">: lambdas ["coder", "dir", "term"] $- bind "unwrapped" (ref withGraphContextDef @@ (ref ExtractCore.wrapDef @@ var "tname" @@ var "term")) $- bind "newTerm" (ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ var "coder" @@ var "unwrapped") $- Flows.pure $ Core.termWrap $ Core.wrappedTerm (var "tname") (var "newTerm")] $- bind "adapter" (ref termAdapterDef @@ var "ot") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "adapter")- (var "t")- (Core.typeWrap $ Core.wrappedType (var "tname") (Compute.adapterTarget $ var "adapter"))- (ref AdaptUtils.bidirectionalDef @@ (var "mapTerm" @@ (Compute.adapterCoder $ var "adapter")))]--setToListDef :: TBinding TypeAdapter-setToListDef = define "setToList" $- doc "Convert set types to list types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_set>>: lambda "st" $ lets [- "encode">: lambda "ad" $ lambda "term" $ cases _Term (var "term") Nothing [- _Term_set>>: lambda "s" $ Compute.coderEncode (Compute.adapterCoder $ var "ad") @@ (Core.termList $ Sets.toList $ var "s")],- "decode">:- lambdas ["ad", "term"] $- bind "listTerm" (Compute.coderDecode (Compute.adapterCoder $ var "ad") @@ var "term") $- cases _Term (var "listTerm") Nothing [- _Term_list>>: lambda "l" $ Flows.pure $ Core.termSet $ Sets.fromList $ var "l"]] $- bind "ad" (ref termAdapterDef @@ (TTypes.list $ var "st")) $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (Compute.adapterTarget $ var "ad")- (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad"))]--simplifyApplicationDef :: TBinding TypeAdapter-simplifyApplicationDef = define "simplifyApplication" $- doc "Simplify application types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_application>>: lambda "at" $ lets [- "lhs">: Core.applicationTypeFunction $ var "at"] $- bind "ad" (ref termAdapterDef @@ var "lhs") $- Flows.pure $ Compute.adapter- false- (var "t")- (Compute.adapterTarget $ var "ad")- (ref AdaptUtils.bidirectionalDef @@ (lambdas ["dir", "term"] $- ref AdaptUtils.encodeDecodeDef @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "term"))]--unitToRecordDef :: TBinding TypeAdapter-unitToRecordDef = define "unitToRecord" $- doc "Convert unit terms to records" $- constant $ Flows.pure $- Compute.adapter false Core.typeUnit (Core.typeRecord $ Core.rowType unitName $ list []) $- Compute.coder- (constant $ Flows.pure $ Core.termRecord $ Core.record unitName $ list [])- (constant $ Flows.pure Core.termUnit)- where- unitName = Core.name $ string "_Unit"--unionToRecordDef :: TBinding TypeAdapter-unionToRecordDef = define "unionToRecord" $- doc "Convert union types to record types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_union>>: lambda "rt" $ lets [- "nm">: Core.rowTypeTypeName $ var "rt",- "sfields">: Core.rowTypeFields $ var "rt",- "target">: Core.typeRecord $ ref unionTypeToRecordTypeDef @@ var "rt",- "toRecordField">: lambdas ["term", "fn", "f"] $ lets [- "fn'">: Core.fieldTypeName $ var "f"] $- Core.field (var "fn'") $ Core.termOptional $ Logic.ifElse- (Equality.equal (var "fn'") (var "fn"))- (just $ var "term")- nothing,- "fromRecordFields">: lambdas ["term", "term'", "t'", "fields"] $ lets [- "matches">: Optionals.mapMaybe- (lambda "field" $ lets [- "fn">: Core.fieldName $ var "field",- "fterm">: Core.fieldTerm $ var "field"] $- cases _Term (var "fterm") Nothing [- _Term_optional>>: lambda "opt" $ Optionals.bind (var "opt") $ lambda "t" $- just $ Core.field (var "fn") (var "t")])- (var "fields")] $- Logic.ifElse (Lists.null $ var "matches")- (Flows.fail $ Strings.cat $ list [- string "cannot convert term back to union: ",- ref ShowCore.termDef @@ var "term",- string " where type = ",- ref ShowCore.typeDef @@ var "t",- string " and target type = ",- ref ShowCore.typeDef @@ var "t'"])- (Flows.pure $ Lists.head $ var "matches")] $- bind "ad" (ref termAdapterDef @@ var "target") $- Flows.pure $ Compute.adapter- (Compute.adapterIsLossy $ var "ad")- (var "t")- (Compute.adapterTarget $ var "ad")- (Compute.coder- (lambda "term'" $- bind "field" (ref withGraphContextDef @@ (ref ExtractCore.injectionDef @@ (Core.rowTypeTypeName $ var "rt") @@ var "term'")) $ lets [- "fn">: Core.fieldName $ var "field",- "term">: Core.fieldTerm $ var "field"] $- Compute.coderEncode (Compute.adapterCoder $ var "ad") @@- (Core.termRecord $ Core.record (var "nm") $ Lists.map (var "toRecordField" @@ var "term" @@ var "fn") (var "sfields")))- (lambda "term" $- bind "recTerm" (Compute.coderDecode (Compute.adapterCoder $ var "ad") @@ var "term") $- cases _Term (var "recTerm") Nothing [- _Term_record>>: lambda "rec" $ lets [- "fields">: Core.recordFields $ var "rec"] $- bind "resultField"- (var "fromRecordFields"- @@ var "term"- @@ (Core.termRecord $ Core.record (var "nm") (var "fields"))- @@ (Compute.adapterTarget $ var "ad")- @@ var "fields") $- Flows.pure $ Core.termUnion $ Core.injection (var "nm") (var "resultField")]))]--unionTypeToRecordTypeDef :: TBinding (RowType -> RowType)-unionTypeToRecordTypeDef = define "unionTypeToRecordType" $- doc "Convert a union row type to a record row type" $- lambda "rt" $ lets [- "makeOptional">: lambda "f" $ lets [- "fn">: Core.fieldTypeName $ var "f",- "ft">: Core.fieldTypeType $ var "f"] $- Core.fieldType (var "fn") $ ref Rewriting.mapBeneathTypeAnnotationsDef @@ unaryFunction Core.typeOptional @@ var "ft"] $- Core.rowType (Core.rowTypeTypeName $ var "rt") $ Lists.map (var "makeOptional") (Core.rowTypeFields $ var "rt")--wrapToUnwrappedDef :: TBinding TypeAdapter-wrapToUnwrappedDef = define "wrapToUnwrapped" $- doc "Convert wrapped types to unwrapped types" $- lambda "t" $ cases _Type (var "t") Nothing [- _Type_wrap>>: lambda "wt" $ lets [- "tname">: Core.wrappedTypeTypeName $ var "wt",- "typ">: Core.wrappedTypeObject $ var "wt",- "encode">: lambda "ad" $ lambda "term" $- bind "unwrapped" (ref withGraphContextDef @@ (ref ExtractCore.wrapDef @@ var "tname" @@ var "term")) $- Compute.coderEncode (Compute.adapterCoder $ var "ad") @@ var "unwrapped",- "decode">: lambda "ad" $ lambda "term" $- bind "decoded" (Compute.coderDecode (Compute.adapterCoder $ var "ad") @@ var "term") $- Flows.pure $ Core.termWrap $ Core.wrappedTerm (var "tname") (var "decoded")] $- bind "ad" (ref termAdapterDef @@ var "typ") $- Flows.pure $ Compute.adapter- false- (var "t")- (Compute.adapterTarget $ var "ad")- (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad"))]---- Note: those constructors which cannot be mapped meaningfully at this time are simply--- preserved as strings.-termAdapterDef :: TBinding TypeAdapter-termAdapterDef = define "termAdapter" $- doc "Create an adapter for any type" $- "typ" ~> lets [- "constraints">: "cx" ~> Coders.languageConstraintsProjection $ Coders.adapterContextLanguage $ var "cx",- "supported">: "cx" ~> ref AdaptUtils.typeIsSupportedDef @@ (var "constraints" @@ var "cx"),- "variantIsSupported">: "cx" ~> "t" ~>- Sets.member (ref Variants.typeVariantDef @@ var "t") $ Coders.languageConstraintsTypeVariants $ var "constraints" @@ var "cx",- "supportedAtTopLevel">: "cx" ~> "t" ~> Logic.and- (var "variantIsSupported" @@ var "cx" @@ var "t")- (Coders.languageConstraintsTypes (var "constraints" @@ var "cx") @@ var "t"),- "pass">: "t" ~> cases _TypeVariant (ref Variants.typeVariantDef @@ (ref Rewriting.deannotateTypeDef @@ var "t")) Nothing [- _TypeVariant_application>>: constant $ list [ref passApplicationDef],- _TypeVariant_forall>>: constant $ list [ref passForallDef],- _TypeVariant_function>>: constant $ list [ref passFunctionDef],- _TypeVariant_list>>: constant $ list [ref passListDef],- _TypeVariant_literal>>: constant $ list [ref passLiteralDef],- _TypeVariant_map>>: constant $ list [ref passMapDef],- _TypeVariant_optional>>: constant $ list [ref passOptionalDef, ref optionalToListDef],- _TypeVariant_product>>: constant $ list [ref passProductDef],- _TypeVariant_record>>: constant $ list [ref passRecordDef],- _TypeVariant_set>>: constant $ list [ref passSetDef],- _TypeVariant_sum>>: constant $ list [ref passSumDef],- _TypeVariant_union>>: constant $ list [ref passUnionDef],- _TypeVariant_unit>>: constant $ list [ref passUnitDef],- _TypeVariant_wrap>>: constant $ list [ref passWrappedDef]],- "trySubstitution">: "t" ~> cases _TypeVariant (ref Variants.typeVariantDef @@ var "t")- Nothing [- _TypeVariant_application>>: constant $ list [ref simplifyApplicationDef],- _TypeVariant_function>>: constant $ list [ref functionToUnionDef],- _TypeVariant_forall>>: constant $ list [ref lambdaToMonotypeDef],- _TypeVariant_optional>>: constant $ list [ref optionalToListDef],- _TypeVariant_set>>: constant $ list [ref setToListDef],- _TypeVariant_union>>: constant $ list [ref unionToRecordDef],- _TypeVariant_unit>>: constant $ list [ref unitToRecordDef],- _TypeVariant_wrap>>: constant $ list [ref wrapToUnwrappedDef]],- "alts">: "cx" ~> "t" ~> Flows.mapList ("c" ~> var "c" @@ var "t") $- Logic.ifElse (var "supportedAtTopLevel" @@ var "cx" @@ var "t")- (var "pass" @@ var "t")- (var "trySubstitution" @@ var "t")] $- cases _Type (var "typ")- (Just $- trace (Strings.cat2 (string "adapter for ") (ref DescribeCore.typeDef @@ var "typ")) $- cases _Type (var "typ")- (Just $- bind "cx" (ref Monads.getStateDef) $- ref AdaptUtils.chooseAdapterDef- @@ (var "alts" @@ var "cx")- @@ (var "supported" @@ var "cx")- @@ ref ShowCore.typeDef- @@ (ref DescribeCore.typeDef)- @@ (var "typ")) [- -- Account for let-bound variables- _Type_variable>>: "name" ~> ref forTypeReferenceDef @@ var "name"]) [- _Type_annotated>>: "at" ~>- bind "ad" (ref termAdapterDef @@ Core.annotatedTypeSubject (var "at")) $- Flows.pure (Compute.adapterWithTarget (var "ad") $- Core.typeAnnotated $ Core.annotatedType (Compute.adapterTarget $ var "ad") (Core.annotatedTypeAnnotation $ var "at"))]--withGraphContextDef :: TBinding (Flow Graph a -> Flow AdapterContext a)-withGraphContextDef = define "withGraphContext" $- doc "Execute a flow with graph context" $- "f" ~>- "cx" <<~ ref Monads.getStateDef $- ref Monads.withStateDef @@ (Coders.adapterContextGraph $ var "cx") @@ var "f"++module Hydra.Sources.Kernel.Terms.Adapt.Terms where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ fieldAdapter, forTypeReference, functionProxyName, functionProxyType, functionToUnion,+ lambdaToMonotype, maybeToList, passApplication, passEither, passForall, passFunction, passList,+ passLiteral, passMap, passOptional, passRecord, passSet, passUnion, passUnit, passWrapped,+ setToList, simplifyApplication, unitToRecord, unionToRecord, unionTypeToRecordType, wrapToUnwrapped,+ termAdapter, withGraphContext)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Adapt.Literals as AdaptLiterals+import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.adapt.terms"++module_ :: Module+module_ = Module ns elements+ [AdaptLiterals.ns, AdaptUtils.ns, Annotations.ns, ExtractCore.ns, Monads.ns,+ Reflect.ns, Rewriting.ns, Schemas.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just "Adapter framework for types and terms"+ where+ elements = [+ toBinding fieldAdapter,+ toBinding forTypeReference,+ toBinding functionProxyName,+ toBinding functionProxyType,+ toBinding functionToUnion,+ toBinding lambdaToMonotype,+ toBinding maybeToList,+ toBinding passApplication,+ toBinding passEither,+ toBinding passFunction,+ toBinding passForall,+ toBinding passLiteral,+ toBinding passList,+ toBinding passMap,+ toBinding passOptional,+ toBinding passRecord,+ toBinding passSet,+ toBinding passUnion,+ toBinding passUnit,+ toBinding passWrapped,+ toBinding setToList,+ toBinding simplifyApplication,+ toBinding termAdapter,+ toBinding unionToRecord,+ toBinding unionTypeToRecordType,+ toBinding unitToRecord,+ toBinding wrapToUnwrapped,+ toBinding withGraphContext]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++fieldAdapter :: TBinding (FieldType -> Flow AdapterContext (SymmetricAdapter AdapterContext FieldType Field))+fieldAdapter = define "fieldAdapter" $+ doc "Create an adapter for field types" $+ "ftyp" ~>+ "encdec" <~ ("ad" ~> "dir" ~> "field" ~>+ "name" <~ Core.fieldName (var "field") $+ "term" <~ Core.fieldTerm (var "field") $+ "newTerm" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "term" $+ produce $ Core.field (var "name") (var "newTerm")) $+ "ad" <<~ termAdapter @@ (Core.fieldTypeType (var "ftyp")) $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "ftyp")+ (Core.fieldType (Core.fieldTypeName (var "ftyp")) (Compute.adapterTarget (var "ad")))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "ad")))++forTypeReference :: TBinding (Name -> Flow AdapterContext (SymmetricAdapter AdapterContext Type Term))+forTypeReference = define "forTypeReference" $+ doc "This function accounts for recursive type definitions" $+ "name" ~>+ "encdec" <~ ("name" ~> "dir" ~> "term" ~>+ "cx" <<~ Monads.getState $+ "adapters" <~ Coders.adapterContextAdapters (var "cx") $+ Maybes.maybe+ (Flows.fail (Strings.cat2 (string "no adapter for reference type ") (unwrap _Name @@ var "name")))+ ("ad" ~> AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "term")+ (Maps.lookup (var "name") (var "adapters"))) $+ "forType" <~ ("cx" ~> "adapters" ~> "t" ~>+ "actual" <<~ termAdapter @@ var "t" $+ "finalAdapters" <~ Maps.insert (var "name") (var "actual") (var "adapters") $+ "finalCx" <~ Coders.adapterContext+ (Coders.adapterContextGraph (var "cx"))+ (Coders.adapterContextLanguage (var "cx"))+ (var "finalAdapters") $+ "ignored2" <<~ Monads.putState @@ var "finalCx" $+ produce (var "actual")) $+ "forMissingAdapter" <~ ("cx" ~> "lossy" ~> "adapters" ~> "placeholder" ~>+ "newAdapters" <~ Maps.insert (var "name") (var "placeholder") (var "adapters") $+ "newCx" <~ Coders.adapterContext+ (Coders.adapterContextGraph (var "cx"))+ (Coders.adapterContextLanguage (var "cx"))+ (var "newAdapters") $+ "ignored" <<~ Monads.putState @@ var "newCx" $+ "mt" <<~ withGraphContext @@ (Schemas.resolveType @@ (Core.typeVariable (var "name"))) $+ Maybes.maybe+ (produce (Compute.adapter (var "lossy") (Core.typeVariable (var "name")) (Core.typeVariable (var "name"))+ (AdaptUtils.bidirectional @@ ("dir" ~> "term" ~> produce (var "term")))))+ (var "forType" @@ var "cx" @@ var "adapters")+ (var "mt")) $+ "flow" <~ (+ "lossy" <~ false $+ "placeholder" <~ Compute.adapter (var "lossy") (Core.typeVariable (var "name")) (Core.typeVariable (var "name"))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "name")) $+ "cx" <<~ Monads.getState $+ "adapters" <~ Coders.adapterContextAdapters (var "cx") $+ Maybes.maybe+ (var "forMissingAdapter" @@ var "cx" @@ var "lossy" @@ var "adapters" @@ var "placeholder")+ (unaryFunction Flows.pure)+ (Maps.lookup (var "name") (var "adapters"))) $+ trace (Strings.cat2 (string "adapt named type ") (unwrap _Name @@ var "name")) $+ var "flow"++functionProxyName :: TBinding Name+functionProxyName = define "functionProxyName" $+ Core.name (string "hydra.core.FunctionProxy")++functionProxyType :: TBinding (a -> Type)+functionProxyType = define "functionProxyType" $+ doc "Generate a function proxy type for a given domain type" $+ constant (Core.typeUnion (Core.rowType (functionProxyName) (list [+ Core.fieldType (Core.nameLift _Elimination_wrap) MetaTypes.string,+ Core.fieldType (Core.nameLift _Elimination_record) MetaTypes.string,+ Core.fieldType (Core.nameLift _Elimination_union) MetaTypes.string,+ Core.fieldType (Core.nameLift _Function_lambda) MetaTypes.string,+ Core.fieldType (Core.nameLift _Function_primitive) MetaTypes.string,+ Core.fieldType (Core.nameLift _Term_variable) MetaTypes.string])))++functionToUnion :: TBinding TypeAdapter+functionToUnion = define "functionToUnion" $+ doc "Convert function types to union types" $+ "t" ~>+ "encTerm" <~ ("term" ~> "strippedTerm" ~> cases _Term (var "strippedTerm")+ Nothing [+ _Term_function>>: "f" ~> cases _Function (var "f")+ Nothing [+ _Function_elimination>>: "e" ~> cases _Elimination (var "e")+ Nothing [+ _Elimination_wrap>>: "name" ~> Core.termUnion (Core.injection (functionProxyName)+ (Core.field (Core.nameLift _Elimination_wrap) (MetaTerms.stringLift (unwrap _Name @@ var "name")))),+ _Elimination_record>>: "r" ~> Core.termUnion (Core.injection (functionProxyName)+ (Core.field (Core.nameLift _Elimination_record) (MetaTerms.stringLift (ShowCore.term @@ var "term")))),+ _Elimination_union>>: "u" ~> Core.termUnion (Core.injection (functionProxyName)+ (Core.field (Core.nameLift _Elimination_union) (MetaTerms.stringLift (ShowCore.term @@ var "term"))))],+ _Function_lambda>>: "l" ~> Core.termUnion (Core.injection (functionProxyName)+ (Core.field (Core.nameLift _Function_lambda) (MetaTerms.stringLift (ShowCore.term @@ var "term")))),+ _Function_primitive>>: "name" ~> Core.termUnion (Core.injection (functionProxyName)+ (Core.field (Core.nameLift _Function_primitive) (MetaTerms.stringLift (unwrap _Name @@ var "name"))))],+ _Term_variable>>: "name" ~>+ Core.termUnion (Core.injection (functionProxyName) (Core.field (Core.nameLift _Term_variable) (MetaTerms.stringLift (unwrap _Name @@ var "name"))))]) $+ "encode" <~ ("ad" ~> "term" ~>+ "strippedTerm" <~ Rewriting.deannotateTerm @@ var "term" $+ Compute.coderEncode (Compute.adapterCoder (var "ad")) @@ (var "encTerm" @@ var "term" @@ var "strippedTerm")) $+ "readFromString" <~ ("term" ~>+ "s" <<~ ExtractCore.string @@ var "term" $+ Maybes.maybe+ (Flows.fail (Strings.cat2 (string "failed to parse term: ") (var "s")))+ (unaryFunction Flows.pure)+ (ShowCore.readTerm @@ var "s")) $+ "decode" <~ ("ad" ~> "term" ~>+ "notFound" <~ ("fname" ~> Flows.fail (Strings.cat2 (string "unexpected field: ") (unwrap _Name @@ var "fname"))) $+ "forCases" <~ ("fterm" ~> withGraphContext @@ (var "readFromString" @@ var "fterm")) $+ "forLambda" <~ ("fterm" ~> withGraphContext @@ (var "readFromString" @@ var "fterm")) $+ "forWrapped" <~ ("fterm" ~> withGraphContext @@ (Flows.map ("s" ~> MetaTerms.unwrap (Core.name (var "s"))) (ExtractCore.string @@ var "fterm"))) $+ "forPrimitive" <~ ("fterm" ~> withGraphContext @@ (Flows.map ("s" ~> MetaTerms.primitiveLift (Core.name (var "s"))) (ExtractCore.string @@ var "fterm"))) $+ "forProjection" <~ ("fterm" ~> withGraphContext @@ (var "readFromString" @@ var "fterm")) $+ "forVariable" <~ ("fterm" ~> withGraphContext @@ (Flows.map ("s" ~> Core.termVariable (Core.name (var "s"))) (ExtractCore.string @@ var "fterm"))) $+ "injTerm" <<~ Compute.coderDecode (Compute.adapterCoder (var "ad")) @@ var "term" $+ "field" <<~ withGraphContext @@ (ExtractCore.injection @@ (functionProxyName) @@ var "injTerm") $+ "fname" <~ Core.fieldName (var "field") $+ "fterm" <~ Core.fieldTerm (var "field") $+ Maybes.fromMaybe (var "notFound" @@ var "fname") (Maps.lookup (var "fname") (Maps.fromList (list [+ pair (Core.nameLift _Elimination_wrap) (var "forWrapped" @@ var "fterm"),+ pair (Core.nameLift _Elimination_record) (var "forProjection" @@ var "fterm"),+ pair (Core.nameLift _Elimination_union) (var "forCases" @@ var "fterm"),+ pair (Core.nameLift _Function_lambda) (var "forLambda" @@ var "fterm"),+ pair (Core.nameLift _Function_primitive) (var "forPrimitive" @@ var "fterm"),+ pair (Core.nameLift _Term_variable) (var "forVariable" @@ var "fterm")])))) $+ cases _Type (var "t")+ Nothing [+ _Type_function>>: "ft" ~>+ "dom" <~ Core.functionTypeDomain (var "ft") $+ "cod" <~ Core.functionTypeCodomain (var "ft") $+ "unionType" <~ (+ "domAd" <<~ termAdapter @@ var "dom" $+ produce (Core.typeUnion (Core.rowType (functionProxyName) (list [+ Core.fieldType (Core.nameLift _Elimination_wrap) MetaTypes.string,+ Core.fieldType (Core.nameLift _Elimination_record) MetaTypes.string,+ Core.fieldType (Core.nameLift _Elimination_union) MetaTypes.string,+ Core.fieldType (Core.nameLift _Function_lambda) MetaTypes.string,+ Core.fieldType (Core.nameLift _Function_primitive) MetaTypes.string,+ Core.fieldType (Core.nameLift _Term_variable) MetaTypes.string])))) $+ "ut" <<~ var "unionType" $+ "ad" <<~ termAdapter @@ var "ut" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad")))]++lambdaToMonotype :: TBinding TypeAdapter+lambdaToMonotype = define "lambdaToMonotype" $+ doc "Convert forall types to monotypes" $+ "t" ~> cases _Type (var "t")+ Nothing [+ _Type_forall>>: "ft" ~>+ "body" <~ Core.forallTypeBody (var "ft") $+ "ad" <<~ termAdapter @@ var "body" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (Compute.adapterCoder (var "ad")))]++maybeToList :: TBinding TypeAdapter+maybeToList = define "maybeToList" $+ doc "Convert optional types to list types" $+ "t" ~>+ "encode" <~ ("ad" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_maybe>>: "m" ~> Maybes.maybe+ (produce (MetaTerms.list []))+ ("r" ~>+ "encoded" <<~ Compute.coderEncode (Compute.adapterCoder (var "ad")) @@ var "r" $+ produce (Core.termList (list [var "encoded"])))+ (var "m")]) $+ "decode" <~ ("ad" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_list>>: "l" ~> Flows.map (unaryFunction Core.termMaybe) (Logic.ifElse (Lists.null (var "l"))+ (produce nothing)+ ("decoded" <<~ Compute.coderDecode (Compute.adapterCoder (var "ad")) @@ (Lists.head (var "l")) $+ produce (just (var "decoded"))))]) $+ cases _Type (var "t")+ Nothing [+ _Type_maybe>>: "ot" ~>+ "ad" <<~ termAdapter @@ var "ot" $+ produce (Compute.adapter+ false+ (var "t")+ (Core.typeList (Compute.adapterTarget (var "ad")))+ (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad")))]++passApplication :: TBinding TypeAdapter+passApplication = define "passApplication" $+ doc "Pass through application types" $+ "t" ~>+ "forApplicationType" <~ ("at" ~>+ "lhs" <~ Core.applicationTypeFunction (var "at") $+ "rhs" <~ Core.applicationTypeArgument (var "at") $+ "lhsAd" <<~ termAdapter @@ var "lhs" $+ "rhsAd" <<~ termAdapter @@ var "rhs" $+ produce (Compute.adapter+ (Logic.or (Compute.adapterIsLossy (var "lhsAd")) (Compute.adapterIsLossy (var "rhsAd")))+ (var "t")+ (Core.typeApplication (Core.applicationType (Compute.adapterTarget (var "lhsAd")) (Compute.adapterTarget (var "rhsAd"))))+ (AdaptUtils.bidirectional @@+ ("dir" ~> "term" ~> AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "lhsAd")) @@ var "term")))) $+ cases _Type (var "t")+ Nothing [+ _Type_application>>: "at" ~> var "forApplicationType" @@ var "at"]++passEither :: TBinding TypeAdapter+passEither = define "passEither" $+ doc "Pass through either types" $+ "t" ~>+ "forEitherType" <~ ("et" ~>+ "left" <~ Core.eitherTypeLeft (var "et") $+ "right" <~ Core.eitherTypeRight (var "et") $+ "leftAd" <<~ termAdapter @@ var "left" $+ "rightAd" <<~ termAdapter @@ var "right" $+ produce (Compute.adapter+ (Logic.or (Compute.adapterIsLossy (var "leftAd")) (Compute.adapterIsLossy (var "rightAd")))+ (var "t")+ (Core.typeEither (Core.eitherType (Compute.adapterTarget (var "leftAd")) (Compute.adapterTarget (var "rightAd"))))+ (AdaptUtils.bidirectional @@+ ("dir" ~> "term" ~> AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "leftAd")) @@ var "term")))) $+ cases _Type (var "t")+ Nothing [+ _Type_either>>: "et" ~> var "forEitherType" @@ var "et"]++passForall :: TBinding TypeAdapter+passForall = define "passForall" $+ doc "Pass through forall types" $+ "t" ~>+ "forForallType" <~ ("ft" ~>+ "v" <~ Core.forallTypeParameter (var "ft") $+ "body" <~ Core.forallTypeBody (var "ft") $+ "ad" <<~ termAdapter @@ var "body" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (Core.typeForall (Core.forallType (var "v") (Compute.adapterTarget (var "ad"))))+ (AdaptUtils.bidirectional @@ ("dir" ~> "term" ~>+ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "term")))) $+ cases _Type (var "t")+ Nothing [+ _Type_forall>>: "ft" ~> var "forForallType" @@ var "ft"]++passFunction :: TBinding TypeAdapter+passFunction = define "passFunction" $+ doc "Pass through function types with adaptation" $+ "t" ~>+ "toCaseAds" <~ ("dom" ~> "cod" ~> cases _Type (Rewriting.deannotateType @@ var "dom")+ (Just (produce Maps.empty)) [+ _Type_union >>: "rt" ~>+ "pairs" <<~ Flows.mapList+ ("f" ~>+ "ad" <<~ fieldAdapter @@ Core.fieldType+ (Core.fieldTypeName (var "f"))+ (Core.typeFunction (Core.functionType+ (Core.fieldTypeType (var "f"))+ (var "cod"))) $+ produce (pair (Core.fieldTypeName (var "f")) (var "ad")))+ (Core.rowTypeFields (var "rt")) $+ produce (Maps.fromList (var "pairs"))]) $+ "toOptionAd" <~ ("dom" ~> "cod" ~> cases _Type (Rewriting.deannotateType @@ var "dom")+ (Just (produce nothing)) [+ _Type_maybe >>: "ot" ~>+ Flows.map (unaryFunction just) (termAdapter @@ MetaTypes.function (var "ot") (var "cod"))]) $+ "getCoder" <~ ("caseAds" ~> "fname" ~> Maybes.maybe+ AdaptUtils.idCoder+ (unaryFunction Compute.adapterCoder)+ (Maps.lookup (var "fname") (var "caseAds"))) $+ "forElimination" <~ ("dir" ~> "codAd" ~> "caseAds" ~> "e" ~> cases _Elimination (var "e")+ Nothing [+ _Elimination_union >>: "cs" ~>+ "n" <~ Core.caseStatementTypeName (var "cs") $+ "def" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "rcases" <<~ Flows.mapList+ ("f" ~> AdaptUtils.encodeDecode @@ var "dir" @@ (var "getCoder" @@ var "caseAds" @@ Core.fieldName (var "f")) @@ var "f")+ (var "cases") $+ "rdef" <<~ Maybes.maybe+ (produce nothing)+ ("d" ~> Flows.map (unaryFunction just) (AdaptUtils.encodeDecode @@ var "dir" @@ Compute.adapterCoder (var "codAd") @@ var "d"))+ (var "def") $+ produce (Core.eliminationUnion (Core.caseStatement (var "n") (var "rdef") (var "rcases")))]) $+ "forFunction" <~ ("dir" ~> "codAd" ~> "caseAds" ~> "f" ~> cases _Function (var "f")+ Nothing [+ _Function_elimination >>: "e" ~>+ Flows.map (unaryFunction Core.functionElimination)+ (var "forElimination" @@ var "dir" @@ var "codAd" @@ var "caseAds" @@ var "e"),+ _Function_lambda >>: "l" ~>+ "var" <~ Core.lambdaParameter (var "l") $+ "d" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "newBody" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ Compute.adapterCoder (var "codAd") @@ var "body" $+ produce (Core.functionLambda (Core.lambda (var "var") (var "d") (var "newBody"))),+ _Function_primitive >>: "name" ~> produce (Core.functionPrimitive (var "name"))]) $+ "encdec" <~ ("codAd" ~> "caseAds" ~> "dir" ~> "term" ~> cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just (produce (var "term"))) [+ _Term_function >>: "f" ~> Flows.map (unaryFunction Core.termFunction)+ (var "forFunction" @@ var "dir" @@ var "codAd" @@ var "caseAds" @@ var "f")]) $+ "forFunctionType" <~ ("ft" ~>+ "dom" <~ Core.functionTypeDomain (var "ft") $+ "cod" <~ Core.functionTypeCodomain (var "ft") $+ "domAd" <<~ termAdapter @@ var "dom" $+ "codAd" <<~ termAdapter @@ var "cod" $+ "caseAds" <<~ var "toCaseAds" @@ var "dom" @@ var "cod" $+ "optionAd" <<~ var "toOptionAd" @@ var "dom" @@ var "cod" $+ "lossy" <~ Logic.or+ (Compute.adapterIsLossy (var "codAd"))+ (Logic.ors (Lists.map ("pair" ~> Compute.adapterIsLossy (Pairs.second (var "pair"))) (Maps.toList (var "caseAds")))) $+ "target" <~ MetaTypes.function (Compute.adapterTarget (var "domAd")) (Compute.adapterTarget (var "codAd")) $+ produce $ Compute.adapter (var "lossy") (var "t") (var "target")+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "codAd" @@ var "caseAds"))) $+ cases _Type (var "t")+ Nothing [+ _Type_function >>: "ft" ~> var "forFunctionType" @@ var "ft"]++passList :: TBinding TypeAdapter+passList = define "passList" $+ doc "Pass through list types" $+ "t" ~>+ "encdec" <~ ("ad" ~> "dir" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_list>>: "terms" ~>+ "newTerms" <<~ Flows.mapList (AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad"))) (var "terms") $+ produce (Core.termList (var "newTerms"))]) $+ "forListType" <~ ("lt" ~>+ "ad" <<~ termAdapter @@ var "lt" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (MetaTypes.list (Compute.adapterTarget (var "ad")))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "ad")))) $+ cases _Type (var "t")+ Nothing [+ _Type_list>>: "lt" ~> var "forListType" @@ var "lt"]++passLiteral :: TBinding TypeAdapter+passLiteral = define "passLiteral" $+ doc "Pass through literal types with literal adaptation" $+ "t" ~>+ "encdec" <~ ("ad" ~> "dir" ~> "term" ~>+ "l" <<~ withGraphContext @@ (ExtractCore.literal @@ var "term") $+ "l2" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "l" $+ produce $ Core.termLiteral $ var "l2") $+ "forLiteral" <~ ("lt" ~>+ "ad" <<~ AdaptLiterals.literalAdapter @@ var "lt" $+ "step" <~ AdaptUtils.bidirectional @@ (var "encdec" @@ var "ad") $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (Core.typeLiteral (Compute.adapterSource (var "ad")))+ (Core.typeLiteral (Compute.adapterTarget (var "ad")))+ (var "step"))) $+ cases _Type (var "t")+ Nothing [+ _Type_literal>>: "lt" ~> var "forLiteral" @@ var "lt"]++passMap :: TBinding TypeAdapter+passMap = define "passMap" $+ doc "Pass through map types" $+ "t" ~>+ "encdec" <~ ("kad" ~> "vad" ~> "dir" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_map>>: "m" ~>+ "newPairs" <<~ Flows.mapList+ ("pair" ~>+ "k" <~ Pairs.first (var "pair") $+ "v" <~ Pairs.second (var "pair") $+ "newK" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "kad")) @@ var "k" $+ "newV" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "vad")) @@ var "v" $+ produce (pair (var "newK") (var "newV")))+ (Maps.toList (var "m")) $+ produce (Core.termMap (Maps.fromList (var "newPairs")))]) $+ "forMapType" <~ ("mt" ~>+ "kt" <~ Core.mapTypeKeys (var "mt") $+ "vt" <~ Core.mapTypeValues (var "mt") $+ "kad" <<~ termAdapter @@ var "kt" $+ "vad" <<~ termAdapter @@ var "vt" $+ produce (Compute.adapter+ (Logic.or (Compute.adapterIsLossy (var "kad")) (Compute.adapterIsLossy (var "vad")))+ (var "t")+ (MetaTypes.map (Compute.adapterTarget (var "kad")) (Compute.adapterTarget (var "vad")))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "kad" @@ var "vad")))) $+ cases _Type (var "t")+ Nothing [+ _Type_map>>: "mt" ~> var "forMapType" @@ var "mt"]++passOptional :: TBinding TypeAdapter+passOptional = define "passOptional" $+ doc "Pass through optional types" $+ "t" ~>+ "mapTerm" <~ ("coder" ~> "dir" ~> "term" ~>+ "opt" <<~ withGraphContext @@ (ExtractCore.maybeTerm @@ unaryFunction Flows.pure @@ var "term") $+ "newOpt" <<~ Flows.mapMaybe (AdaptUtils.encodeDecode @@ var "dir" @@ var "coder") (var "opt") $+ produce (Core.termMaybe (var "newOpt"))) $+ cases _Type (var "t")+ Nothing [+ _Type_maybe>>: "ot" ~>+ "adapter" <<~ termAdapter @@ var "ot" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "adapter"))+ (var "t")+ (Core.typeMaybe (Compute.adapterTarget (var "adapter")))+ (AdaptUtils.bidirectional @@ (var "mapTerm" @@ (Compute.adapterCoder (var "adapter")))))]++passRecord :: TBinding TypeAdapter+passRecord = define "passRecord" $+ doc "Pass through record types" $+ "t" ~>+ "encdec" <~ ("rt" ~> "adapters" ~> "dir" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_record>>: "rec" ~>+ "dfields" <~ Core.recordFields (var "rec") $+ "newFields" <<~ Flows.sequence (Lists.zipWith+ ("ad" ~> "f" ~> AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "f")+ (var "adapters")+ (var "dfields")) $+ produce (Core.termRecord (Core.record (Core.rowTypeTypeName (var "rt")) (var "newFields")))]) $+ "forRecordType" <~ ("rt" ~>+ "adapters" <<~ Flows.mapList (fieldAdapter) (Core.rowTypeFields (var "rt")) $+ "lossy" <~ Logic.ors (Lists.map (unaryFunction Compute.adapterIsLossy) (var "adapters")) $+ "sfields'" <~ Lists.map (unaryFunction Compute.adapterTarget) (var "adapters") $+ produce (Compute.adapter+ (var "lossy")+ (var "t")+ (Core.typeRecord (Core.rowType (Core.rowTypeTypeName (var "rt")) (var "sfields'")))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "rt" @@ var "adapters")))) $+ cases _Type (var "t")+ Nothing [+ _Type_record>>: "rt" ~> var "forRecordType" @@ var "rt"]++passSet :: TBinding TypeAdapter+passSet = define "passSet" $+ doc "Pass through set types" $+ "t" ~>+ "encdec" <~ ("ad" ~> "dir" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_set>>: "terms" ~>+ "newTerms" <<~ Flows.mapList (AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad"))) (Sets.toList (var "terms")) $+ produce (Core.termSet (Sets.fromList (var "newTerms")))]) $+ cases _Type (var "t")+ Nothing [+ _Type_set>>: "st" ~>+ "ad" <<~ termAdapter @@ var "st" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (MetaTypes.set (Compute.adapterTarget (var "ad")))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "ad")))]++passUnion :: TBinding TypeAdapter+passUnion = define "passUnion" $+ doc "Pass through union types" $+ "t" ~> cases _Type (var "t")+ Nothing [+ _Type_union>>: "rt" ~>+ "sfields" <~ Core.rowTypeFields (var "rt") $+ "tname" <~ Core.rowTypeTypeName (var "rt") $+ "getAdapter" <~ ("adaptersMap" ~> "f" ~>+ Maybes.maybe+ (Flows.fail (Strings.cat2 (string "no such field: ") (unwrap _Name @@ (Core.fieldName (var "f")))))+ (unaryFunction Flows.pure)+ (Maps.lookup (Core.fieldName (var "f")) (var "adaptersMap"))) $+ "adapters" <<~ Flows.mapList+ ("f" ~>+ "ad" <<~ fieldAdapter @@ var "f" $+ produce (pair (Core.fieldTypeName (var "f")) (var "ad")))+ (var "sfields") $+ "adaptersMap" <~ Maps.fromList (var "adapters") $+ "lossy" <~ Logic.ors (Lists.map ("pair" ~> Compute.adapterIsLossy (Pairs.second (var "pair"))) (var "adapters")) $+ "sfields'" <~ Lists.map ("pair" ~> Compute.adapterTarget (Pairs.second (var "pair"))) (var "adapters") $+ produce (Compute.adapter+ (var "lossy")+ (var "t")+ (Core.typeUnion (Core.rowType (var "tname") (var "sfields'")))+ (AdaptUtils.bidirectional @@ ("dir" ~> "term" ~>+ -- Note: this is a shortcut, since we anticipate deprecating the current term adapter logic+ produce (var "term"))))]+ -- TODO: consider restoring the following+-- (AdaptUtils.bidirectional @@ (lambdas ["dir", "term"] $+-- "dfield" <<~ withGraphContext @@ (ExtractCore.injectionDef @@ var "tname" @@ var "term") $+-- "ad" <<~ var "getAdapter" @@ var "adaptersMap" @@ var "dfield" $+-- "newField" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder $ var "ad") @@ var "dfield" $+-- produce $ Core.termUnion $ Core.injection (var "tname") (var "newField")))]++passUnit :: TBinding TypeAdapter+passUnit = define "passUnit" $+ doc "Pass through unit types" $+ constant (produce (Compute.adapter false Core.typeUnit Core.typeUnit+ (Compute.coder+ (constant (produce Core.termUnit))+ (constant (produce Core.termUnit)))))++passWrapped :: TBinding TypeAdapter+passWrapped = define "passWrapped" $+ doc "Pass through wrapped types" $+ "t" ~> cases _Type (var "t")+ Nothing [+ _Type_wrap>>: "wt" ~>+ "tname" <~ Core.wrappedTypeTypeName (var "wt") $+ "ot" <~ Core.wrappedTypeBody (var "wt") $+ "mapTerm" <~ ("coder" ~> "dir" ~> "term" ~>+ "unwrapped" <<~ withGraphContext @@ (ExtractCore.wrap @@ var "tname" @@ var "term") $+ "newTerm" <<~ AdaptUtils.encodeDecode @@ var "dir" @@ var "coder" @@ var "unwrapped" $+ produce (Core.termWrap (Core.wrappedTerm (var "tname") (var "newTerm")))) $+ "adapter" <<~ termAdapter @@ var "ot" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "adapter"))+ (var "t")+ (Core.typeWrap (Core.wrappedType (var "tname") (Compute.adapterTarget (var "adapter"))))+ (AdaptUtils.bidirectional @@ (var "mapTerm" @@ (Compute.adapterCoder (var "adapter")))))]++setToList :: TBinding TypeAdapter+setToList = define "setToList" $+ doc "Convert set types to list types" $+ "t" ~>+ "encode" <~ ("ad" ~> "term" ~> cases _Term (var "term")+ Nothing [+ _Term_set>>: "s" ~> Compute.coderEncode (Compute.adapterCoder (var "ad")) @@ (Core.termList (Sets.toList (var "s")))]) $+ "forListTerm" <~ ("t" ~> cases _Term (var "t")+ Nothing [+ _Term_list>>: "l" ~> produce (Core.termSet (Sets.fromList (var "l")))]) $+ "decode" <~ ("ad" ~> "term" ~>+ "listTerm" <<~ Compute.coderDecode (Compute.adapterCoder (var "ad")) @@ var "term" $+ var "forListTerm" @@ var "listTerm") $+ "forSetType" <~ ("st" ~>+ "ad" <<~ termAdapter @@ (MetaTypes.list (var "st")) $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad")))) $+ cases _Type (var "t")+ Nothing [+ _Type_set>>: "st" ~> var "forSetType" @@ var "st"]++simplifyApplication :: TBinding TypeAdapter+simplifyApplication = define "simplifyApplication" $+ doc "Simplify application types" $+ "t" ~>+ "encdec" <~ ("ad" ~> "dir" ~> "term" ~>+ AdaptUtils.encodeDecode @@ var "dir" @@ (Compute.adapterCoder (var "ad")) @@ var "term") $+ "forApplicationType" <~ ("at" ~>+ "lhs" <~ Core.applicationTypeFunction (var "at") $+ "ad" <<~ termAdapter @@ var "lhs" $+ produce (Compute.adapter+ false+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (AdaptUtils.bidirectional @@ (var "encdec" @@ var "ad")))) $+ cases _Type (var "t")+ Nothing [+ _Type_application>>: "at" ~> var "forApplicationType" @@ var "at"]++unitToRecord :: TBinding TypeAdapter+unitToRecord = define "unitToRecord" $+ doc "Convert unit terms to records" $+ constant (produce+ (Compute.adapter false Core.typeUnit (Core.typeRecord (Core.rowType unitName (list ([] :: [TTerm FieldType]))))+ (Compute.coder+ (constant (produce (Core.termRecord (Core.record unitName (list ([] :: [TTerm Field]))))))+ (constant (produce Core.termUnit)))))+ where+ unitName = Core.name (string "_Unit")++unionToRecord :: TBinding TypeAdapter+unionToRecord = define "unionToRecord" $+ doc "Convert union types to record types" $+ "t" ~>+ "forField" <~ ("field" ~>+ "fn" <~ Core.fieldName (var "field") $+ "fterm" <~ Core.fieldTerm (var "field") $+ cases _Term (var "fterm")+ Nothing [+ _Term_maybe>>: "opt" ~> Maybes.bind (var "opt") ("t" ~>+ just (Core.field (var "fn") (var "t")))]) $+ "fromRecordFields" <~ ("term" ~> "term'" ~> "t'" ~> "fields" ~>+ "matches" <~ Maybes.mapMaybe (var "forField") (var "fields") $+ Logic.ifElse (Lists.null (var "matches"))+ (Flows.fail (Strings.cat (list [+ string "cannot convert term back to union: ",+ ShowCore.term @@ var "term",+ string " where type = ",+ ShowCore.type_ @@ var "t",+ string " and target type = ",+ ShowCore.type_ @@ var "t'"])))+ (produce (Lists.head (var "matches")))) $+ "forRecTerm" <~ ("nm" ~> "ad" ~> "term" ~> "recTerm" ~> cases _Term (var "recTerm")+ Nothing [+ _Term_record>>: "rec" ~>+ "fields" <~ Core.recordFields (var "rec") $+ "resultField" <<~+ (var "fromRecordFields"+ @@ var "term"+ @@ (Core.termRecord (Core.record (var "nm") (var "fields")))+ @@ (Compute.adapterTarget (var "ad"))+ @@ var "fields") $+ produce (Core.termUnion (Core.injection (var "nm") (var "resultField")))]) $+ cases _Type (var "t")+ Nothing [+ _Type_union>>: "rt" ~>+ "nm" <~ Core.rowTypeTypeName (var "rt") $+ "sfields" <~ Core.rowTypeFields (var "rt") $+ "target" <~ Core.typeRecord (unionTypeToRecordType @@ var "rt") $+ "toRecordField" <~ ("term" ~> "fn" ~> "f" ~>+ "fn'" <~ Core.fieldTypeName (var "f") $+ Core.field (var "fn'") (Core.termMaybe (Logic.ifElse+ (Equality.equal (var "fn'") (var "fn"))+ (just (var "term"))+ nothing))) $+ "ad" <<~ termAdapter @@ var "target" $+ produce (Compute.adapter+ (Compute.adapterIsLossy (var "ad"))+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (Compute.coder+ ("term'" ~>+ "field" <<~ withGraphContext @@ (ExtractCore.injection @@ (Core.rowTypeTypeName (var "rt")) @@ var "term'") $+ "fn" <~ Core.fieldName (var "field") $+ "term" <~ Core.fieldTerm (var "field") $+ Compute.coderEncode (Compute.adapterCoder (var "ad")) @@+ (Core.termRecord (Core.record (var "nm") (Lists.map (var "toRecordField" @@ var "term" @@ var "fn") (var "sfields")))))+ ("term" ~>+ "recTerm" <<~ Compute.coderDecode (Compute.adapterCoder (var "ad")) @@ var "term" $+ var "forRecTerm" @@ var "nm" @@ var "ad" @@ var "term" @@ var "recTerm")))]++unionTypeToRecordType :: TBinding (RowType -> RowType)+unionTypeToRecordType = define "unionTypeToRecordType" $+ doc "Convert a union row type to a record row type" $+ "rt" ~>+ "makeOptional" <~ ("f" ~>+ "fn" <~ Core.fieldTypeName (var "f") $+ "ft" <~ Core.fieldTypeType (var "f") $+ Core.fieldType (var "fn") (Rewriting.mapBeneathTypeAnnotations @@ unaryFunction Core.typeMaybe @@ var "ft")) $+ Core.rowType (Core.rowTypeTypeName (var "rt")) (Lists.map (var "makeOptional") (Core.rowTypeFields (var "rt")))++wrapToUnwrapped :: TBinding TypeAdapter+wrapToUnwrapped = define "wrapToUnwrapped" $+ doc "Convert wrapped types to unwrapped types" $+ "t" ~> cases _Type (var "t")+ Nothing [+ _Type_wrap>>: "wt" ~>+ "tname" <~ Core.wrappedTypeTypeName (var "wt") $+ "typ" <~ Core.wrappedTypeBody (var "wt") $+ "encode" <~ ("ad" ~> "term" ~>+ "unwrapped" <<~ withGraphContext @@ (ExtractCore.wrap @@ var "tname" @@ var "term") $+ Compute.coderEncode (Compute.adapterCoder (var "ad")) @@ var "unwrapped") $+ "decode" <~ ("ad" ~> "term" ~>+ "decoded" <<~ Compute.coderDecode (Compute.adapterCoder (var "ad")) @@ var "term" $+ produce (Core.termWrap (Core.wrappedTerm (var "tname") (var "decoded")))) $+ "ad" <<~ termAdapter @@ var "typ" $+ produce (Compute.adapter+ false+ (var "t")+ (Compute.adapterTarget (var "ad"))+ (Compute.coder (var "encode" @@ var "ad") (var "decode" @@ var "ad")))]++-- Note: those constructors which cannot be mapped meaningfully at this time are simply+-- preserved as strings.+termAdapter :: TBinding TypeAdapter+termAdapter = define "termAdapter" $+ doc "Create an adapter for any type" $+ "typ" ~>+ "constraints" <~ ("cx" ~> Coders.languageConstraintsProjection (Coders.adapterContextLanguage (var "cx"))) $+ "supported" <~ ("cx" ~> AdaptUtils.typeIsSupported @@ (var "constraints" @@ var "cx")) $+ "variantIsSupported" <~ ("cx" ~> "t" ~>+ Sets.member (Reflect.typeVariant @@ var "t") (Coders.languageConstraintsTypeVariants (var "constraints" @@ var "cx"))) $+ "supportedAtTopLevel" <~ ("cx" ~> "t" ~> Logic.and+ (var "variantIsSupported" @@ var "cx" @@ var "t")+ (Coders.languageConstraintsTypes (var "constraints" @@ var "cx") @@ var "t")) $+ "pass" <~ ("t" ~> cases _TypeVariant (Reflect.typeVariant @@ (Rewriting.deannotateType @@ var "t"))+ Nothing [+ _TypeVariant_annotated>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_application>>: constant (list [passApplication]),+ _TypeVariant_either>>: constant (list [passEither]),+ _TypeVariant_forall>>: constant (list [passForall]),+ _TypeVariant_function>>: constant (list [passFunction]),+ _TypeVariant_list>>: constant (list [passList]),+ _TypeVariant_literal>>: constant (list [passLiteral]),+ _TypeVariant_map>>: constant (list [passMap]),+ _TypeVariant_maybe>>: constant (list [passOptional, maybeToList]),+ _TypeVariant_pair>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_record>>: constant (list [passRecord]),+ _TypeVariant_set>>: constant (list [passSet]),+ _TypeVariant_union>>: constant (list [passUnion]),+ _TypeVariant_unit>>: constant (list [passUnit]),+ _TypeVariant_variable>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_wrap>>: constant (list [passWrapped])]) $+ "trySubstitution" <~ ("t" ~> cases _TypeVariant (Reflect.typeVariant @@ var "t")+ Nothing [+ _TypeVariant_annotated>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_application>>: constant (list [simplifyApplication]),+ _TypeVariant_either>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_forall>>: constant (list [lambdaToMonotype]),+ _TypeVariant_function>>: constant (list [functionToUnion]),+ _TypeVariant_list>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_literal>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_map>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_maybe>>: constant (list [maybeToList]),+ _TypeVariant_pair>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_record>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_set>>: constant (list [setToList]),+ _TypeVariant_union>>: constant (list [unionToRecord]),+ _TypeVariant_unit>>: constant (list [unitToRecord]),+ _TypeVariant_variable>>: constant (list ([] :: [TTerm TypeAdapter])),+ _TypeVariant_wrap>>: constant (list [wrapToUnwrapped])]) $+ "alts" <~ ("cx" ~> "t" ~> Flows.mapList ("c" ~> var "c" @@ var "t")+ (Logic.ifElse (var "supportedAtTopLevel" @@ var "cx" @@ var "t")+ (var "pass" @@ var "t")+ (var "trySubstitution" @@ var "t"))) $+ "dflt" <~ (cases _Type (var "typ")+ (Just (+ "cx" <<~ Monads.getState $+ AdaptUtils.chooseAdapter+ @@ (var "alts" @@ var "cx")+ @@ (var "supported" @@ var "cx")+ @@ ShowCore.type_+ @@ (ShowCore.type_)+ @@ (var "typ"))) [+ -- Account for let-bound variables+ _Type_variable>>: "name" ~> forTypeReference @@ var "name"]) $+ cases _Type (var "typ")+ (Just (+ trace (Strings.cat2 (string "adapter for ") (ShowCore.type_ @@ var "typ"))+ (var "dflt"))) [+ _Type_annotated>>: "at" ~>+ "ad" <<~ termAdapter @@ Core.annotatedTypeBody (var "at") $+ produce (Compute.adapterWithTarget (var "ad")+ (Core.typeAnnotated (Core.annotatedType (Compute.adapterTarget (var "ad")) (Core.annotatedTypeAnnotation (var "at")))))]++withGraphContext :: TBinding (Flow Graph a -> Flow AdapterContext a)+withGraphContext = define "withGraphContext" $+ doc "Execute a flow with graph context" $+ "f" ~>+ "cx" <<~ Monads.getState $+ Monads.withState @@ (Coders.adapterContextGraph (var "cx")) @@ var "f"
src/main/haskell/Hydra/Sources/Kernel/Terms/Adapt/Utils.hs view
@@ -1,228 +1,250 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Adapt.Utils where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ bidirectional, chooseAdapter, composeCoders, encodeDecode, floatTypeIsSupported,+ idAdapter, idCoder, integerTypeIsSupported, literalTypeIsSupported,+ nameToFilePath, typeIsSupported, unidirectionalCoder) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore +ns :: Namespace+ns = Namespace "hydra.adapt.utils"+ module_ :: Module-module_ = Module (Namespace "hydra.adapt.utils") elements- [Names.module_, Rewriting.module_, Variants.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [Formatting.ns, Names.ns, Reflect.ns, Rewriting.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just ("Additional adapter utilities, above and beyond the generated ones.") where elements = [- el bidirectionalDef,- el chooseAdapterDef,- el composeCodersDef,- el encodeDecodeDef,- el floatTypeIsSupportedDef,- el idAdapterDef,- el idCoderDef,- el integerTypeIsSupportedDef,- el literalTypeIsSupportedDef,- el nameToFilePathDef,- el typeIsSupportedDef,- el unidirectionalCoderDef]+ toBinding bidirectional,+ toBinding chooseAdapter,+ toBinding composeCoders,+ toBinding encodeDecode,+ toBinding floatTypeIsSupported,+ toBinding idAdapter,+ toBinding idCoder,+ toBinding integerTypeIsSupported,+ toBinding literalTypeIsSupported,+ toBinding nameToFilePath,+ toBinding typeIsSupported,+ toBinding unidirectionalCoder] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -bidirectionalDef :: TBinding ((CoderDirection -> b -> Flow s b) -> Coder s s b b)-bidirectionalDef = define "bidirectional" $+bidirectional :: TBinding ((CoderDirection -> b -> Flow s b) -> Coder s s b b)+bidirectional = define "bidirectional" $ doc "Create a bidirectional coder from a direction-aware function" $- lambda "f" $ Compute.coder (var "f" @@ Coders.coderDirectionEncode) (var "f" @@ Coders.coderDirectionDecode)+ "f" ~> Compute.coder (var "f" @@ Coders.coderDirectionEncode) (var "f" @@ Coders.coderDirectionDecode) -chooseAdapterDef :: TBinding ((t -> Flow so [SymmetricAdapter si t v]) -> (t -> Bool) -> (t -> String ) -> (t -> String) -> t -> Flow so (SymmetricAdapter si t v))-chooseAdapterDef = define "chooseAdapter" $+chooseAdapter :: TBinding ((t -> Flow so [SymmetricAdapter si t v]) -> (t -> Bool) -> (t -> String ) -> (t -> String) -> t -> Flow so (SymmetricAdapter si t v))+chooseAdapter = define "chooseAdapter" $ doc "Choose an appropriate adapter for a type" $- lambdas ["alts", "supported", "show", "describe", "typ"] $- Logic.ifElse (var "supported" @@ var "typ")- (Flows.pure $ Compute.adapter false (var "typ") (var "typ") (ref idCoderDef))- (Flows.bind (var "alts" @@ var "typ") $- lambda "raw" $ lets [- "candidates">: Lists.filter (lambda "adapter" $ var "supported" @@ Compute.adapterTarget (var "adapter")) (var "raw")]- $ Logic.ifElse (Lists.null $ var "candidates")- (Flows.fail $ Strings.cat $ list [- string "no adapters found for ",- var "describe" @@ var "typ",- Logic.ifElse (Lists.null $ var "raw")- (string "")- (Strings.cat $ list [- string " (discarded ",- Literals.showInt32 $ Lists.length $ var "raw",- string " unsupported candidate types: ",- ref ShowCore.listDef @@ var "show" @@ (Lists.map (unaryFunction Compute.adapterTarget) (var "raw")),- string ")"]),- string ". Original type: ",- var "show" @@ var "typ"])- (Flows.pure $ Lists.head $ var "candidates"))+ "alts" ~> "supported" ~> "show" ~> "describe" ~> "typ" ~>+ Logic.ifElse (var "supported" @@ var "typ")+ (produce (Compute.adapter false (var "typ") (var "typ") idCoder))+ ("raw" <<~ var "alts" @@ var "typ" $+ "candidates" <~ Lists.filter ("adapter" ~> var "supported" @@ Compute.adapterTarget (var "adapter")) (var "raw") $+ Logic.ifElse (Lists.null (var "candidates"))+ (Flows.fail (Strings.cat (list [+ string "no adapters found for ",+ var "describe" @@ var "typ",+ Logic.ifElse (Lists.null (var "raw"))+ (string "")+ (Strings.cat (list [+ string " (discarded ",+ Literals.showInt32 (Lists.length (var "raw")),+ string " unsupported candidate types: ",+ ShowCore.list_ @@ var "show" @@ (Lists.map (unaryFunction Compute.adapterTarget) (var "raw")),+ string ")"])),+ string ". Original type: ",+ var "show" @@ var "typ"])))+ (produce (Lists.head (var "candidates")))) -composeCodersDef :: TBinding (Coder s s a b -> Coder s s b c -> Coder s s a c)-composeCodersDef = define "composeCoders" $+composeCoders :: TBinding (Coder s s a b -> Coder s s b c -> Coder s s a c)+composeCoders = define "composeCoders" $ doc "Compose two coders" $- lambda "c1" $ lambda "c2" $- Compute.coder- (lambda "a" $ Flows.bind (Compute.coderEncode (var "c1") @@ var "a") (Compute.coderEncode (var "c2")))- (lambda "c" $ Flows.bind (Compute.coderDecode (var "c2") @@ var "c") (Compute.coderDecode (var "c1")))+ "c1" ~> "c2" ~>+ Compute.coder+ ("a" ~> "b1" <<~ Compute.coderEncode (var "c1") @@ var "a" $ Compute.coderEncode (var "c2") @@ var "b1")+ ("c" ~> "b2" <<~ Compute.coderDecode (var "c2") @@ var "c" $ Compute.coderDecode (var "c1") @@ var "b2") -encodeDecodeDef :: TBinding (CoderDirection -> Coder s s x x -> x -> Flow s x)-encodeDecodeDef = define "encodeDecode" $+encodeDecode :: TBinding (CoderDirection -> Coder s s x x -> x -> Flow s x)+encodeDecode = define "encodeDecode" $ doc "Apply coder in the specified direction" $- lambda "dir" $ lambda "coder" $- match _CoderDirection Nothing [- _CoderDirection_encode>>: constant $ Compute.coderEncode (var "coder"),- _CoderDirection_decode>>: constant $ Compute.coderDecode (var "coder")]- @@ var "dir"+ "dir" ~> "coder" ~> "term" ~>+ cases _CoderDirection (var "dir")+ Nothing [+ _CoderDirection_encode>>: constant (Compute.coderEncode (var "coder") @@ var "term"),+ _CoderDirection_decode>>: constant (Compute.coderDecode (var "coder") @@ var "term")] -floatTypeIsSupportedDef :: TBinding (LanguageConstraints -> FloatType -> Bool)-floatTypeIsSupportedDef = define "floatTypeIsSupported" $+floatTypeIsSupported :: TBinding (LanguageConstraints -> FloatType -> Bool)+floatTypeIsSupported = define "floatTypeIsSupported" $ doc "Check if float type is supported by language constraints" $- lambda "constraints" $ lambda "ft" $- Sets.member (var "ft") (Coders.languageConstraintsFloatTypes $ var "constraints")+ "constraints" ~> "ft" ~>+ Sets.member (var "ft") (Coders.languageConstraintsFloatTypes (var "constraints")) -idAdapterDef :: TBinding (t -> SymmetricAdapter s t v)-idAdapterDef = define "idAdapter" $+idAdapter :: TBinding (t -> SymmetricAdapter s t v)+idAdapter = define "idAdapter" $ doc "Identity adapter" $- lambda "t" $ Compute.adapter false (var "t") (var "t") (ref idCoderDef)+ "t" ~> Compute.adapter false (var "t") (var "t") idCoder -idCoderDef :: TBinding (Coder s s a a)-idCoderDef = define "idCoder" $+idCoder :: TBinding (Coder s s a a)+idCoder = define "idCoder" $ doc "Identity coder" $ Compute.coder (unaryFunction Flows.pure) (unaryFunction Flows.pure) -integerTypeIsSupportedDef :: TBinding (LanguageConstraints -> IntegerType -> Bool)-integerTypeIsSupportedDef = define "integerTypeIsSupported" $+integerTypeIsSupported :: TBinding (LanguageConstraints -> IntegerType -> Bool)+integerTypeIsSupported = define "integerTypeIsSupported" $ doc "Check if integer type is supported by language constraints" $- lambda "constraints" $ lambda "it" $- Sets.member (var "it") (Coders.languageConstraintsIntegerTypes $ var "constraints")+ "constraints" ~> "it" ~>+ Sets.member (var "it") (Coders.languageConstraintsIntegerTypes (var "constraints")) -literalTypeIsSupportedDef :: TBinding (LanguageConstraints -> LiteralType -> Bool)-literalTypeIsSupportedDef = define "literalTypeIsSupported" $+literalTypeIsSupported :: TBinding (LanguageConstraints -> LiteralType -> Bool)+literalTypeIsSupported = define "literalTypeIsSupported" $ doc "Check if literal type is supported by language constraints" $- lambda "constraints" $ lambda "lt" $- Logic.and- (Sets.member (ref Variants.literalTypeVariantDef @@ var "lt") (Coders.languageConstraintsLiteralVariants $ var "constraints"))- (match _LiteralType (Just true) [- _LiteralType_float>>: lambda "ft" $ ref floatTypeIsSupportedDef @@ var "constraints" @@ var "ft",- _LiteralType_integer>>: lambda "it" $ ref integerTypeIsSupportedDef @@ var "constraints" @@ var "it"]- @@ var "lt")+ "constraints" ~> "lt" ~>+ "isSupported" <~ ("lt" ~> cases _LiteralType (var "lt")+ (Just true) [+ _LiteralType_float>>: "ft" ~> floatTypeIsSupported @@ var "constraints" @@ var "ft",+ _LiteralType_integer>>: "it" ~> integerTypeIsSupported @@ var "constraints" @@ var "it"]) $+ Logic.and+ (Sets.member (Reflect.literalTypeVariant @@ var "lt") (Coders.languageConstraintsLiteralVariants (var "constraints")))+ (var "isSupported" @@ var "lt") -nameToFilePathDef :: TBinding (CaseConvention -> CaseConvention -> FileExtension -> Name -> FilePath)-nameToFilePathDef = define "nameToFilePath" $+nameToFilePath :: TBinding (CaseConvention -> CaseConvention -> FileExtension -> Name -> FilePath)+nameToFilePath = define "nameToFilePath" $ doc "Convert a name to file path, given case conventions for namespaces and local names, and assuming '/' as the file path separator" $- lambda "nsConv" $ lambda "localConv" $ lambda "ext" $ lambda "name" $ lets [- "qualName">: ref Names.qualifyNameDef @@ var "name",- "ns">: Module.qualifiedNameNamespace $ var "qualName",- "local">: Module.qualifiedNameLocal $ var "qualName",- "nsToFilePath">: lambda "ns" $- Strings.intercalate (string "/") $ Lists.map- (lambda "part" $ ref Formatting.convertCaseDef @@ Mantle.caseConventionCamel @@ var "nsConv" @@ var "part")- (Strings.splitOn (string ".") $ Module.unNamespace $ var "ns"),- "prefix">: Optionals.maybe (string "")- (lambda "n" $ Strings.cat2 (var "nsToFilePath" @@ var "n") (string "/"))- (var "ns"),- "suffix">: ref Formatting.convertCaseDef @@ Mantle.caseConventionPascal @@ var "localConv" @@ var "local"]- $ Strings.cat $ list [var "prefix", var "suffix", string ".", Module.unFileExtension $ var "ext"]+ "nsConv" ~> "localConv" ~> "ext" ~> "name" ~>+ "qualName" <~ Names.qualifyName @@ var "name" $+ "ns" <~ Module.qualifiedNameNamespace (var "qualName") $+ "local" <~ Module.qualifiedNameLocal (var "qualName") $+ "nsToFilePath" <~ ("ns" ~>+ Strings.intercalate (string "/") (Lists.map+ ("part" ~> Formatting.convertCase @@ Util.caseConventionCamel @@ var "nsConv" @@ var "part")+ (Strings.splitOn (string ".") (Module.unNamespace (var "ns"))))) $+ "prefix" <~ Maybes.maybe (string "")+ ("n" ~> Strings.cat2 (var "nsToFilePath" @@ var "n") (string "/"))+ (var "ns") $+ "suffix" <~ Formatting.convertCase @@ Util.caseConventionPascal @@ var "localConv" @@ var "local" $+ Strings.cat (list [var "prefix", var "suffix", string ".", Module.unFileExtension (var "ext")]) -typeIsSupportedDef :: TBinding (LanguageConstraints -> Type -> Bool)-typeIsSupportedDef = define "typeIsSupported" $+typeIsSupported :: TBinding (LanguageConstraints -> Type -> Bool)+typeIsSupported = define "typeIsSupported" $ doc "Check if type is supported by language constraints" $- lambda "constraints" $ lambda "t" $ lets [- "base">: ref Rewriting.deannotateTypeDef @@ var "t",- "isSupportedVariant">: lambda "v" $- Logic.or- (cases _TypeVariant (var "v") (Just false) [_TypeVariant_variable>>: constant true])- (Sets.member (var "v") (Coders.languageConstraintsTypeVariants $ var "constraints"))]- $ Logic.and- (Coders.languageConstraintsTypes (var "constraints") @@ var "base")- (Logic.and- (var "isSupportedVariant" @@ (ref Variants.typeVariantDef @@ var "base"))- (match _Type Nothing [- _Type_annotated>>: lambda "at" $ ref typeIsSupportedDef @@ var "constraints" @@ Core.annotatedTypeSubject (var "at"),- _Type_application>>: lambda "app" $- Logic.and- (ref typeIsSupportedDef @@ var "constraints" @@ Core.applicationTypeFunction (var "app"))- (ref typeIsSupportedDef @@ var "constraints" @@ Core.applicationTypeArgument (var "app")),- _Type_forall>>: lambda "ft" $ ref typeIsSupportedDef @@ var "constraints" @@ Core.forallTypeBody (var "ft"),- _Type_function>>: lambda "ft" $- Logic.and- (ref typeIsSupportedDef @@ var "constraints" @@ Core.functionTypeDomain (var "ft"))- (ref typeIsSupportedDef @@ var "constraints" @@ Core.functionTypeCodomain (var "ft")),- _Type_list>>: lambda "lt" $ ref typeIsSupportedDef @@ var "constraints" @@ var "lt",- _Type_literal>>: lambda "at" $ ref literalTypeIsSupportedDef @@ var "constraints" @@ var "at",- _Type_map>>: lambda "mt" $- Logic.and- (ref typeIsSupportedDef @@ var "constraints" @@ Core.mapTypeKeys (var "mt"))- (ref typeIsSupportedDef @@ var "constraints" @@ Core.mapTypeValues (var "mt")),- _Type_optional>>: lambda "ot" $ ref typeIsSupportedDef @@ var "constraints" @@ var "ot",- _Type_product>>: lambda "types" $- andAll $ Lists.map (ref typeIsSupportedDef @@ var "constraints") (var "types"),- _Type_record>>: lambda "rt" $- andAll $ Lists.map- (lambda "field" $ ref typeIsSupportedDef @@ var "constraints" @@ Core.fieldTypeType (var "field"))- (Core.rowTypeFields $ var "rt"),- _Type_set>>: lambda "st" $ ref typeIsSupportedDef @@ var "constraints" @@ var "st",- _Type_sum>>: lambda "types" $- andAll $ Lists.map (ref typeIsSupportedDef @@ var "constraints") (var "types"),- _Type_union>>: lambda "rt" $- andAll $ Lists.map- (lambda "field" $ ref typeIsSupportedDef @@ var "constraints" @@ Core.fieldTypeType (var "field"))- (Core.rowTypeFields $ var "rt"),- _Type_unit>>: constant true,- _Type_wrap>>: lambda "wt" $ ref typeIsSupportedDef @@ var "constraints" @@ Core.wrappedTypeObject (var "wt"),- _Type_variable>>: constant true]- @@ var "base"))+ "constraints" ~> "t" ~>+ "base" <~ Rewriting.deannotateType @@ var "t" $+ "isVariable" <~ ("v" ~> cases _TypeVariant (var "v")+ (Just false) [+ _TypeVariant_variable>>: constant true]) $+ "isSupportedVariant" <~ ("v" ~>+ Logic.or+ (var "isVariable" @@ var "v")+ (Sets.member (var "v") (Coders.languageConstraintsTypeVariants (var "constraints")))) $+ "isSupported" <~ ("base" ~> cases _Type (var "base")+ Nothing [+ _Type_annotated>>: "at" ~> typeIsSupported @@ var "constraints" @@ Core.annotatedTypeBody (var "at"),+ _Type_application>>: "app" ~> Logic.and+ (typeIsSupported @@ var "constraints" @@ Core.applicationTypeFunction (var "app"))+ (typeIsSupported @@ var "constraints" @@ Core.applicationTypeArgument (var "app")),+ _Type_either>>: "et" ~> Logic.and+ (typeIsSupported @@ var "constraints" @@ Core.eitherTypeLeft (var "et"))+ (typeIsSupported @@ var "constraints" @@ Core.eitherTypeRight (var "et")),+ _Type_forall>>: "ft" ~> typeIsSupported @@ var "constraints" @@ Core.forallTypeBody (var "ft"),+ _Type_function>>: "ft" ~> Logic.and+ (typeIsSupported @@ var "constraints" @@ Core.functionTypeDomain (var "ft"))+ (typeIsSupported @@ var "constraints" @@ Core.functionTypeCodomain (var "ft")),+ _Type_list>>: "lt" ~> typeIsSupported @@ var "constraints" @@ var "lt",+ _Type_literal>>: "at" ~> literalTypeIsSupported @@ var "constraints" @@ var "at",+ _Type_map>>: "mt" ~> Logic.and+ (typeIsSupported @@ var "constraints" @@ Core.mapTypeKeys (var "mt"))+ (typeIsSupported @@ var "constraints" @@ Core.mapTypeValues (var "mt")),+ _Type_maybe>>: "ot" ~> typeIsSupported @@ var "constraints" @@ var "ot",+ _Type_pair>>: "pt" ~> Logic.and+ (typeIsSupported @@ var "constraints" @@ Core.pairTypeFirst (var "pt"))+ (typeIsSupported @@ var "constraints" @@ Core.pairTypeSecond (var "pt")),+ _Type_record>>: "rt" ~>+ andAll (Lists.map+ ("field" ~> typeIsSupported @@ var "constraints" @@ Core.fieldTypeType (var "field"))+ (Core.rowTypeFields (var "rt"))),+ _Type_set>>: "st" ~> typeIsSupported @@ var "constraints" @@ var "st",+ _Type_union>>: "rt" ~>+ andAll (Lists.map+ ("field" ~> typeIsSupported @@ var "constraints" @@ Core.fieldTypeType (var "field"))+ (Core.rowTypeFields (var "rt"))),+ _Type_unit>>: constant true,+ _Type_wrap>>: "wt" ~> typeIsSupported @@ var "constraints" @@ Core.wrappedTypeBody (var "wt"),+ _Type_variable>>: constant true]) $+ Logic.and+ (Coders.languageConstraintsTypes (var "constraints") @@ var "base")+ (Logic.and+ (var "isSupportedVariant" @@ (Reflect.typeVariant @@ var "base"))+ (var "isSupported" @@ var "base")) where andAll = Lists.foldl (binaryFunction Logic.and) true -unidirectionalCoderDef :: TBinding ((a -> Flow s b) -> Coder s s a b)-unidirectionalCoderDef = define "unidirectionalCoder" $+unidirectionalCoder :: TBinding ((a -> Flow s b) -> Coder s s a b)+unidirectionalCoder = define "unidirectionalCoder" $ doc "Create a unidirectional coder" $- lambda "m" $- Compute.coder- (var "m")- (constant $ Flows.fail $ string "inbound mapping is unsupported")+ "m" ~>+ Compute.coder+ (var "m")+ (constant (Flows.fail (string "inbound mapping is unsupported")))
src/main/haskell/Hydra/Sources/Kernel/Terms/All.hs view
@@ -10,41 +10,93 @@ import qualified Hydra.Sources.Kernel.Terms.Adapt.Utils as AdaptUtils import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.CodeGeneration as CodeGeneration import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Describe.Core as DescribeCore-import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Encoding as Encoding import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Extract.Mantle as ExtractMantle+import qualified Hydra.Sources.Kernel.Terms.Extract.Helpers as ExtractHelpers+import qualified Hydra.Sources.Kernel.Terms.Extract.Util as ExtractUtil import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting import qualified Hydra.Sources.Kernel.Terms.Grammars as Grammars+import qualified Hydra.Sources.Kernel.Terms.Hoisting as Hoisting import qualified Hydra.Sources.Kernel.Terms.Inference as Inference import qualified Hydra.Sources.Kernel.Terms.Languages as Languages import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical import qualified Hydra.Sources.Kernel.Terms.Literals as Literals import qualified Hydra.Sources.Kernel.Terms.Monads as Monads import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Parsers as Parsers import qualified Hydra.Sources.Kernel.Terms.Reduction as Reduction+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization import qualified Hydra.Sources.Kernel.Terms.Show.Accessors as ShowAccessors import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Show.Util as ShowUtil import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan import qualified Hydra.Sources.Kernel.Terms.Templates as Templates import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants +-- Secondary, generated decoding modules+import qualified Hydra.Sources.Decode.Accessors as DecodeAccessors+import qualified Hydra.Sources.Decode.Ast as DecodeAst+import qualified Hydra.Sources.Decode.Classes as DecodeClasses+import qualified Hydra.Sources.Decode.Coders as DecodeCoders+import qualified Hydra.Sources.Decode.Compute as DecodeCompute+import qualified Hydra.Sources.Decode.Constraints as DecodeConstraints+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Decode.Grammar as DecodeGrammar+import qualified Hydra.Sources.Decode.Json.Model as DecodeJson+import qualified Hydra.Sources.Decode.Module as DecodeModule+import qualified Hydra.Sources.Decode.Parsing as DecodeParsing+import qualified Hydra.Sources.Decode.Phantoms as DecodePhantoms+import qualified Hydra.Sources.Decode.Query as DecodeQuery+import qualified Hydra.Sources.Decode.Relational as DecodeRelational+import qualified Hydra.Sources.Decode.Tabular as DecodeTabular+import qualified Hydra.Sources.Decode.Testing as DecodeTesting+import qualified Hydra.Sources.Decode.Topology as DecodeTopology+import qualified Hydra.Sources.Decode.Typing as DecodeTyping+import qualified Hydra.Sources.Decode.Util as DecodeUtil+import qualified Hydra.Sources.Decode.Variants as DecodeVariants+import qualified Hydra.Sources.Decode.Workflow as DecodeWorkflow +-- Secondary, generated encoding modules+import qualified Hydra.Sources.Encode.Accessors as EncodeAccessors+import qualified Hydra.Sources.Encode.Ast as EncodeAst+import qualified Hydra.Sources.Encode.Classes as EncodeClasses+import qualified Hydra.Sources.Encode.Coders as EncodeCoders+import qualified Hydra.Sources.Encode.Compute as EncodeCompute+import qualified Hydra.Sources.Encode.Constraints as EncodeConstraints+import qualified Hydra.Sources.Encode.Core as EncodeCore+import qualified Hydra.Sources.Encode.Grammar as EncodeGrammar+import qualified Hydra.Sources.Encode.Json.Model as EncodeJson+import qualified Hydra.Sources.Encode.Module as EncodeModule+import qualified Hydra.Sources.Encode.Parsing as EncodeParsing+import qualified Hydra.Sources.Encode.Phantoms as EncodePhantoms+import qualified Hydra.Sources.Encode.Query as EncodeQuery+import qualified Hydra.Sources.Encode.Relational as EncodeRelational+import qualified Hydra.Sources.Encode.Tabular as EncodeTabular+import qualified Hydra.Sources.Encode.Testing as EncodeTesting+import qualified Hydra.Sources.Encode.Topology as EncodeTopology+import qualified Hydra.Sources.Encode.Typing as EncodeTyping+import qualified Hydra.Sources.Encode.Util as EncodeUtil+import qualified Hydra.Sources.Encode.Variants as EncodeVariants+import qualified Hydra.Sources.Encode.Workflow as EncodeWorkflow++ kernelTermsModules :: [Module]-kernelTermsModules = [+kernelTermsModules = kernelPrimaryTermsModules ++ kernelDecodingModules ++ kernelEncodingModules++kernelPrimaryTermsModules :: [Module]+kernelPrimaryTermsModules = [ AdaptLiterals.module_, AdaptModules.module_, AdaptSimple.module_,@@ -52,34 +104,85 @@ AdaptUtils.module_, Annotations.module_, Arity.module_,+ Checking.module_,+ CodeGeneration.module_, Constants.module_,- DecodeCore.module_, Decoding.module_,- DescribeCore.module_,- DescribeMantle.module_,- EncodeCore.module_,+ Encoding.module_, ExtractCore.module_,- ExtractMantle.module_,+ ExtractHelpers.module_,+ ExtractUtil.module_, Formatting.module_, Grammars.module_,+ Hoisting.module_, Inference.module_, Languages.module_, Lexical.module_, Literals.module_, Monads.module_, Names.module_,+ Parsers.module_, Reduction.module_,+ Reflect.module_, Rewriting.module_, Schemas.module_, Serialization.module_, ShowAccessors.module_, ShowCore.module_, ShowGraph.module_,- ShowMantle.module_,+ ShowMeta.module_, ShowTyping.module_,+ ShowUtil.module_, Sorting.module_, Substitution.module_, Tarjan.module_, Templates.module_,- Unification.module_,- Variants.module_]+ Unification.module_]++kernelDecodingModules :: [Module]+kernelDecodingModules = [+ DecodeAccessors.module_,+ DecodeAst.module_,+ DecodeClasses.module_,+ DecodeCoders.module_,+ DecodeCompute.module_,+ DecodeConstraints.module_,+ DecodeCore.module_,+ DecodeGrammar.module_,+ DecodeJson.module_,+ DecodeModule.module_,+ DecodeParsing.module_,+ DecodePhantoms.module_,+ DecodeQuery.module_,+ DecodeRelational.module_,+ DecodeTabular.module_,+ DecodeTesting.module_,+ DecodeTopology.module_,+ DecodeTyping.module_,+ DecodeUtil.module_,+ DecodeVariants.module_,+ DecodeWorkflow.module_]++kernelEncodingModules :: [Module]+kernelEncodingModules = [+ EncodeAccessors.module_,+ EncodeAst.module_,+ EncodeClasses.module_,+ EncodeCoders.module_,+ EncodeCompute.module_,+ EncodeConstraints.module_,+ EncodeCore.module_,+ EncodeGrammar.module_,+ EncodeJson.module_,+ EncodeModule.module_,+ EncodeParsing.module_,+ EncodePhantoms.module_,+ EncodeQuery.module_,+ EncodeRelational.module_,+ EncodeTabular.module_,+ EncodeTesting.module_,+ EncodeTopology.module_,+ EncodeTyping.module_,+ EncodeUtil.module_,+ EncodeVariants.module_,+ EncodeWorkflow.module_]
src/main/haskell/Hydra/Sources/Kernel/Terms/Annotations.hs view
@@ -1,462 +1,459 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Annotations where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ aggregateAnnotations, debugIf, failOnFlag, getDebugId, getAttr, getAttrWithDefault, getCount,+ getDescription, getTermAnnotation, getTermDescription, getType, getTypeAnnotation, getTypeClasses,+ getTypeDescription, isNativeType, hasDescription, hasFlag, hasTypeDescription, nextCount,+ normalizeTermAnnotations, normalizeTypeAnnotations, putAttr, putCount, resetCount, setAnnotation,+ setDescription, setTermAnnotation, setTermDescription, setType, setTypeAnnotation, setTypeClasses,+ setTypeDescription, termAnnotationInternal, typeAnnotationInternal, typeElement, whenFlag, withDepth) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Decoding as Decoding-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Encode.Core as EncodeCore+import Hydra.Encoding (encodeBindingName) +ns :: Namespace+ns = Namespace "hydra.annotations"+ module_ :: Module-module_ = Module (Namespace "hydra.annotations") elements- [Decoding.module_, DecodeCore.module_, EncodeCore.module_, ExtractCore.module_, Lexical.module_, ShowCore.module_,- Variants.module_, Monads.module_]- kernelTypesModules $+module_ = Module ns elements+ [Constants.ns, moduleNamespace DecodeCore.module_, moduleNamespace EncodeCore.module_, ExtractCore.ns, Lexical.ns, Monads.ns,+ Rewriting.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just "Utilities for reading and writing type and term annotations" where elements = [- el aggregateAnnotationsDef,- el debugIfDef,- el failOnFlagDef,- el getDebugIdDef,- el getAttrDef,- el getAttrWithDefaultDef,- el getCountDef,- el getDescriptionDef,- el getTermAnnotationDef,- el getTermDescriptionDef,- el getTypeDef,- el getTypeAnnotationDef,- el getTypeClassesDef,- el getTypeDescriptionDef,- el isNativeTypeDef,- el hasDescriptionDef,- el hasFlagDef,- el hasTypeDescriptionDef,- el nextCountDef,- el normalizeTermAnnotationsDef,- el normalizeTypeAnnotationsDef,- el putAttrDef,- el putCountDef,- el resetCountDef,- el setAnnotationDef,- el setDescriptionDef,- el setTermAnnotationDef,- el setTermDescriptionDef,- el setTypeDef,- el setTypeAnnotationDef,- el setTypeClassesDef,- el setTypeDescriptionDef,- el termAnnotationInternalDef,- el typeAnnotationInternalDef,- el typeElementDef,- el whenFlagDef,- el unshadowVariablesDef,- el withDepthDef]+ toBinding aggregateAnnotations,+ toBinding debugIf,+ toBinding failOnFlag,+ toBinding getDebugId,+ toBinding getAttr,+ toBinding getAttrWithDefault,+ toBinding getCount,+ toBinding getDescription,+ toBinding getTermAnnotation,+ toBinding getTermDescription,+ toBinding getType,+ toBinding getTypeAnnotation,+ toBinding getTypeClasses,+ toBinding getTypeDescription,+ toBinding isNativeType,+ toBinding hasDescription,+ toBinding hasFlag,+ toBinding hasTypeDescription,+ toBinding nextCount,+ toBinding normalizeTermAnnotations,+ toBinding normalizeTypeAnnotations,+ toBinding putAttr,+ toBinding putCount,+ toBinding resetCount,+ toBinding setAnnotation,+ toBinding setDescription,+ toBinding setTermAnnotation,+ toBinding setTermDescription,+ toBinding setType,+ toBinding setTypeAnnotation,+ toBinding setTypeClasses,+ toBinding setTypeDescription,+ toBinding termAnnotationInternal,+ toBinding typeAnnotationInternal,+ toBinding typeElement,+ toBinding whenFlag,+ toBinding withDepth] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -aggregateAnnotationsDef :: TBinding ((x -> Maybe y) -> (y -> x) -> (y -> M.Map Name Term) -> x -> M.Map Name Term)-aggregateAnnotationsDef = define "aggregateAnnotations" $+aggregateAnnotations :: TBinding ((x -> Maybe y) -> (y -> x) -> (y -> M.Map Name Term) -> x -> M.Map Name Term)+aggregateAnnotations = define "aggregateAnnotations" $ doc "Aggregate annotations from nested structures" $- lambdas ["getValue", "getX", "getAnns", "t"] $ lets [- "toPairs">: lambdas ["rest", "t"] $ Optionals.maybe (var "rest")- (lambda "yy" $ var "toPairs"- @@ Lists.cons (Maps.toList $ var "getAnns" @@ var "yy") (var "rest")- @@ (var "getX" @@ var "yy"))- (var "getValue" @@ var "t")] $- Maps.fromList $ Lists.concat $ var "toPairs" @@ list [] @@ var "t"+ "getValue" ~> "getX" ~> "getAnns" ~> "t" ~>+ "toPairs" <~ ("rest" ~> "t" ~> Maybes.maybe (var "rest")+ (lambda "yy" (var "toPairs"+ @@ Lists.cons (Maps.toList (var "getAnns" @@ var "yy")) (var "rest")+ @@ (var "getX" @@ var "yy")))+ (var "getValue" @@ var "t")) $+ Maps.fromList (Lists.concat (var "toPairs" @@ list ([] :: [TTerm [(Name, Term)]]) @@ var "t")) -debugIfDef :: TBinding (String -> String -> Flow s ())-debugIfDef = define "debugIf" $+debugIf :: TBinding (String -> String -> Flow s ())+debugIf = define "debugIf" $ doc "Debug if the debug ID matches" $- lambdas ["debugId", "message"] $ lets [- "checkAndFail">: lambda "desc" $ Logic.ifElse- (Equality.equal (var "desc") (just $ string "debugId"))- (Flows.fail $ var "message")- (produce unit)] $- Flows.bind (ref getDebugIdDef) (var "checkAndFail")+ "debugId" ~> "message" ~>+ "checkAndFail" <~ ("desc" ~> Logic.ifElse+ (Equality.equal (var "desc") (just $ string "debugId"))+ (Flows.fail (var "message"))+ (produce unit)) $+ Flows.bind getDebugId (var "checkAndFail") -failOnFlagDef :: TBinding (Name -> String -> Flow s ())-failOnFlagDef = define "failOnFlag" $+failOnFlag :: TBinding (Name -> String -> Flow s ())+failOnFlag = define "failOnFlag" $ doc "Fail if the given flag is set" $- lambdas ["flag", "msg"] $ binds [- "val">: ref hasFlagDef @@ var "flag"] $- Logic.ifElse (var "val")- (Flows.fail $ var "msg")- (produce unit)+ "flag" ~> "msg" ~>+ "val" <<~ hasFlag @@ var "flag" $+ Logic.ifElse (var "val")+ (Flows.fail (var "msg"))+ (produce unit) -getAttrDef :: TBinding (Name -> Flow s (Maybe Term))-getAttrDef = define "getAttr" $+getAttr :: TBinding (Name -> Flow s (Maybe Term))+getAttr = define "getAttr" $ doc "Get an attribute from the trace" $- lambda "key" $ Compute.flow $- lambdas ["s0", "t0"] $ Compute.flowState- (just $ Maps.lookup (var "key") (Compute.traceOther $ var "t0"))+ "key" ~> Compute.flow (+ "s0" ~> "t0" ~> Compute.flowState+ (just (Maps.lookup (var "key") (Compute.traceOther (var "t0")))) (var "s0")- (var "t0")+ (var "t0")) -getAttrWithDefaultDef :: TBinding (Name -> Term -> Flow s Term)-getAttrWithDefaultDef = define "getAttrWithDefault" $+getAttrWithDefault :: TBinding (Name -> Term -> Flow s Term)+getAttrWithDefault = define "getAttrWithDefault" $ doc "Get an attribute with a default value" $- lambdas ["key", "def"] $ Flows.map- (lambda "mval" $ Optionals.fromMaybe (var "def") (var "mval"))- (ref getAttrDef @@ var "key")+ "key" ~> "def" ~> Flows.map+ ("mval" ~> Maybes.fromMaybe (var "def") (var "mval"))+ (getAttr @@ var "key") -getCountDef :: TBinding (Name -> Flow s Int)-getCountDef = define "getCount" $+getCount :: TBinding (Name -> Flow s Int)+getCount = define "getCount" $ doc "Get a counter value" $- lambda "key" $ ref Lexical.withEmptyGraphDef @@ (Flows.bind- (ref getAttrWithDefaultDef @@ var "key" @@ (Core.int32 0))- (ref ExtractCore.int32Def))+ "key" ~> Lexical.withEmptyGraph @@ (Flows.bind+ (getAttrWithDefault @@ var "key" @@ (Core.int32 0))+ (ExtractCore.int32)) -getDebugIdDef :: TBinding (Flow s (Maybe String))-getDebugIdDef = define "getDebugId" $+getDebugId :: TBinding (Flow s (Maybe String))+getDebugId = define "getDebugId" $ doc "Get the debug ID from flow state" $- ref Lexical.withEmptyGraphDef @@ (Flows.bind- (ref getAttrDef @@ ref Constants.key_debugIdDef)- (lambda "desc" $ Flows.mapOptional (ref ExtractCore.stringDef) (var "desc")))+ Lexical.withEmptyGraph @@ (Flows.bind+ (getAttr @@ Constants.key_debugId)+ ("desc" ~> Flows.mapMaybe (ExtractCore.string) (var "desc"))) -getDescriptionDef :: TBinding (M.Map Name Term -> Flow Graph (Maybe String))-getDescriptionDef = define "getDescription" $+getDescription :: TBinding (M.Map Name Term -> Flow Graph (Maybe String))+getDescription = define "getDescription" $ doc "Get description from annotations map" $- lambda "anns" $ Optionals.maybe+ "anns" ~> Maybes.maybe (produce nothing)- (lambda "term" $ Flows.map (unaryFunction just) $ ref ExtractCore.stringDef @@ var "term")+ ("term" ~> Flows.map (unaryFunction just) (ExtractCore.string @@ var "term")) (Maps.lookup (Core.nameLift key_description) (var "anns")) -getTermAnnotationDef :: TBinding (Name -> Term -> Maybe Term)-getTermAnnotationDef = define "getTermAnnotation" $+getTermAnnotation :: TBinding (Name -> Term -> Maybe Term)+getTermAnnotation = define "getTermAnnotation" $ doc "Get a term annotation" $- lambdas ["key", "term"] $ Maps.lookup (var "key") (ref termAnnotationInternalDef @@ var "term")+ "key" ~> "term" ~> Maps.lookup (var "key") (termAnnotationInternal @@ var "term") -getTermDescriptionDef :: TBinding (Term -> Flow Graph (Maybe String))-getTermDescriptionDef = define "getTermDescription" $- doc "Get term description" $- lambda "term" $ ref getDescriptionDef @@ (ref termAnnotationInternalDef @@ var "term")+getTermDescription :: TBinding (Term -> Flow Graph (Maybe String))+getTermDescription = define "getTermDescription" $+ doc "Get term description. Peels through TermTypeLambda and TermTypeApplication wrappers (added by inference for polymorphic bindings) to find the description annotation underneath." $+ "term" ~>+ "peel" <~ ("t" ~> cases _Term (var "t")+ (Just $ var "t") [+ _Term_typeLambda>>: "tl" ~> var "peel" @@ Core.typeLambdaBody (var "tl"),+ _Term_typeApplication>>: "ta" ~> var "peel" @@ Core.typeApplicationTermBody (var "ta")]) $+ getDescription @@ (termAnnotationInternal @@ (var "peel" @@ var "term")) -getTypeDef :: TBinding (M.Map Name Term -> Flow Graph (Maybe Type))-getTypeDef = define "getType" $+getType :: TBinding (M.Map Name Term -> Flow Graph (Maybe Type))+getType = define "getType" $ doc "Get type from annotations" $- lambda "anns" $ Optionals.maybe+ "anns" ~>+ "cx" <<~ Monads.getState $+ Maybes.maybe (produce nothing)- (lambda "dat" $ Flows.map (unaryFunction just) (ref DecodeCore.typeDef @@ var "dat"))- (Maps.lookup (ref Constants.key_typeDef) (var "anns"))+ ("dat" ~> Flows.map (unaryFunction just) (trace (string "get type") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ var "dat")))+ (Maps.lookup (Constants.key_type) (var "anns")) -getTypeAnnotationDef :: TBinding (Name -> Type -> Maybe Term)-getTypeAnnotationDef = define "getTypeAnnotation" $+getTypeAnnotation :: TBinding (Name -> Type -> Maybe Term)+getTypeAnnotation = define "getTypeAnnotation" $ doc "Get a type annotation" $- lambdas ["key", "typ"] $ Maps.lookup (var "key") (ref typeAnnotationInternalDef @@ var "typ")+ "key" ~> "typ" ~> Maps.lookup (var "key") (typeAnnotationInternal @@ var "typ") -getTypeClassesDef :: TBinding (Term -> Flow Graph (M.Map Name (S.Set TypeClass)))-getTypeClassesDef = define "getTypeClasses" $+getTypeClasses :: TBinding (Term -> Flow Graph (M.Map Name (S.Set TypeClass)))+getTypeClasses = define "getTypeClasses" $ doc "Get type classes from term" $- lambda "term" $ lets [- "decodeClass">: lambda "term" $ lets [- "byName">: Maps.fromList $ list [- pair (Core.nameLift _TypeClass_equality) Graph.typeClassEquality,- pair (Core.nameLift _TypeClass_ordering) Graph.typeClassOrdering]] $ binds [- "fn">: ref ExtractCore.unitVariantDef @@ Core.nameLift _TypeClass @@ var "term"] $- Optionals.maybe- (ref Monads.unexpectedDef @@ string "type class" @@ (ref ShowCore.termDef @@ var "term"))- (unaryFunction produce)- (Maps.lookup (var "fn") (var "byName"))] $- Optionals.maybe- (produce Maps.empty)- (lambda "term" $ ref ExtractCore.mapDef- @@ (ref DecodeCore.nameDef)- @@ (ref ExtractCore.setOfDef @@ var "decodeClass")- @@ (var "term"))- (ref getTermAnnotationDef @@ ref Constants.key_classesDef @@ var "term")+ "term" ~>+ "cx" <<~ Monads.getState $+ "decodeClass" <~ ("term" ~>+ "byName" <~ Maps.fromList (list [+ pair (Core.nameLift _TypeClass_equality) Graph.typeClassEquality,+ pair (Core.nameLift _TypeClass_ordering) Graph.typeClassOrdering]) $+ "fn" <<~ ExtractCore.unitVariant @@ Core.nameLift _TypeClass @@ var "term" $+ Maybes.maybe+ (Monads.unexpected @@ string "type class" @@ (ShowCore.term @@ var "term"))+ (unaryFunction produce)+ (Maps.lookup (var "fn") (var "byName"))) $+ Maybes.maybe+ (produce Maps.empty)+ ("term" ~> ExtractCore.map+ @@ ("t" ~> Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Name @@ var "cx" @@ var "t"))+ @@ (ExtractCore.setOf @@ var "decodeClass")+ @@ (var "term"))+ (getTermAnnotation @@ Constants.key_classes @@ var "term") -getTypeDescriptionDef :: TBinding (Type -> Flow Graph (Maybe String))-getTypeDescriptionDef = define "getTypeDescription" $+getTypeDescription :: TBinding (Type -> Flow Graph (Maybe String))+getTypeDescription = define "getTypeDescription" $ doc "Get type description" $- lambda "typ" $ ref getDescriptionDef @@ (ref typeAnnotationInternalDef @@ var "typ")+ "typ" ~> getDescription @@ (typeAnnotationInternal @@ var "typ") -isNativeTypeDef :: TBinding (Binding -> Bool)-isNativeTypeDef = define "isNativeType" $+isNativeType :: TBinding (Binding -> Bool)+isNativeType = define "isNativeType" $ doc ("For a typed term, decide whether a coder should encode it as a native type expression," <> " or as a Hydra type expression.") $- lambda "el" $ lets [- "isFlaggedAsFirstClassType">: Optionals.fromMaybe false $- Optionals.bind- (ref getTermAnnotationDef @@ ref Constants.key_firstClassTypeDef @@ (Core.bindingTerm $ var "el"))- (ref Decoding.booleanDef)] $- Optionals.maybe false- (lambda "ts" $ Logic.and- (Equality.equal (var "ts") (Core.typeScheme (list []) (Core.typeVariable $ Core.nameLift _Type)))- (Logic.not $ var "isFlaggedAsFirstClassType"))- (Core.bindingType $ var "el")+ "el" ~>+ "isFlaggedAsFirstClassType" <~ Maybes.fromMaybe false (+ Maybes.map+ (constant true)+ (getTermAnnotation @@ Constants.key_firstClassType @@ (Core.bindingTerm (var "el")))) $+ Maybes.maybe false+ ("ts" ~> Logic.and+ (Equality.equal (var "ts") (Core.typeScheme (list ([] :: [TTerm Name])) (Core.typeVariable (Core.nameLift _Type)) Phantoms.nothing))+ (Logic.not (var "isFlaggedAsFirstClassType")))+ (Core.bindingType (var "el")) -hasDescriptionDef :: TBinding (M.Map Name Term -> Bool)-hasDescriptionDef = define "hasDescription" $+hasDescription :: TBinding (M.Map Name Term -> Bool)+hasDescription = define "hasDescription" $ doc "Check if annotations contain description" $- lambda "anns" $ Optionals.isJust $ Maps.lookup (ref Constants.key_descriptionDef) (var "anns")+ "anns" ~> Maybes.isJust (Maps.lookup (Constants.key_description) (var "anns")) -hasFlagDef :: TBinding (Name -> Flow s Bool)-hasFlagDef = define "hasFlag" $+hasFlag :: TBinding (Name -> Flow s Bool)+hasFlag = define "hasFlag" $ doc "Check if flag is set" $- lambda "flag" $ ref Lexical.withEmptyGraphDef- @@ (bind "term" (ref getAttrWithDefaultDef @@ var "flag" @@ Core.false) $- ref ExtractCore.booleanDef @@ var "term")+ "flag" ~> Lexical.withEmptyGraph+ @@ ("term" <<~ getAttrWithDefault @@ var "flag" @@ Core.false $+ ExtractCore.boolean @@ var "term") -hasTypeDescriptionDef :: TBinding (Type -> Bool)-hasTypeDescriptionDef = define "hasTypeDescription" $+hasTypeDescription :: TBinding (Type -> Bool)+hasTypeDescription = define "hasTypeDescription" $ doc "Check if type has description" $- lambda "typ" $ ref hasDescriptionDef @@ (ref typeAnnotationInternalDef @@ var "typ")+ "typ" ~> hasDescription @@ (typeAnnotationInternal @@ var "typ") -nextCountDef :: TBinding (Name -> Flow s Int)-nextCountDef = define "nextCount" $+nextCount :: TBinding (Name -> Flow s Int)+nextCount = define "nextCount" $ doc "Return a zero-indexed counter for the given key: 0, 1, 2, ..." $- lambda "key" $ binds [- "count">: ref getCountDef @@ var "key"] $- Flows.map- (constant $ var "count")- (ref putCountDef @@ var "key" @@ Math.add (var "count") (int32 1))+ "key" ~>+ "count" <<~ getCount @@ var "key" $+ Flows.map+ (constant (var "count"))+ (putCount @@ var "key" @@ Math.add (var "count") (int32 1)) --- TODO: move into hydra.rewriting-normalizeTermAnnotationsDef :: TBinding (Term -> Term)-normalizeTermAnnotationsDef = define "normalizeTermAnnotations" $+normalizeTermAnnotations :: TBinding (Term -> Term)+normalizeTermAnnotations = define "normalizeTermAnnotations" $ doc "Normalize term annotations" $- lambda "term" $ lets [- "anns">: ref termAnnotationInternalDef @@ var "term",- "stripped">: ref Rewriting.deannotateTermDef @@ var "term"] $- Logic.ifElse (Maps.null $ var "anns")- (var "stripped")- (Core.termAnnotated $ Core.annotatedTerm (var "stripped") (var "anns"))+ "term" ~>+ "anns" <~ termAnnotationInternal @@ var "term" $+ "stripped" <~ Rewriting.deannotateTerm @@ var "term" $+ Logic.ifElse (Maps.null (var "anns"))+ (var "stripped")+ (Core.termAnnotated (Core.annotatedTerm (var "stripped") (var "anns"))) --- TODO: move into hydra.rewriting-normalizeTypeAnnotationsDef :: TBinding (Type -> Type)-normalizeTypeAnnotationsDef = define "normalizeTypeAnnotations" $+normalizeTypeAnnotations :: TBinding (Type -> Type)+normalizeTypeAnnotations = define "normalizeTypeAnnotations" $ doc "Normalize type annotations" $- lambda "typ" $ lets [- "anns">: ref typeAnnotationInternalDef @@ var "typ",- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"] $- Logic.ifElse (Maps.null $ var "anns")- (var "stripped")- (Core.typeAnnotated $ Core.annotatedType (var "stripped") (var "anns"))+ "typ" ~>+ "anns" <~ typeAnnotationInternal @@ var "typ" $+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Logic.ifElse (Maps.null (var "anns"))+ (var "stripped")+ (Core.typeAnnotated (Core.annotatedType (var "stripped") (var "anns"))) -putAttrDef :: TBinding (Name -> Term -> Flow s ())-putAttrDef = define "putAttr" $+putAttr :: TBinding (Name -> Term -> Flow s ())+putAttr = define "putAttr" $ doc "Set an attribute in the trace" $- lambdas ["key", "val"] $ Compute.flow $ lambdas ["s0", "t0"] $+ "key" ~> "val" ~> Compute.flow (+ "s0" ~> "t0" ~> Compute.flowState (just unit) (var "s0")- (Compute.traceWithOther (var "t0") (Maps.insert (var "key") (var "val") (Compute.traceOther $ var "t0")))+ (Compute.traceWithOther (var "t0") (Maps.insert (var "key") (var "val") (Compute.traceOther (var "t0"))))) -putCountDef :: TBinding (Name -> Int -> Flow s ())-putCountDef = define "putCount" $+putCount :: TBinding (Name -> Int -> Flow s ())+putCount = define "putCount" $ doc "Set counter value" $- lambdas ["key", "count"] $- ref putAttrDef @@ var "key" @@ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ var "count")+ "key" ~> "count" ~>+ putAttr @@ var "key" @@ (Core.termLiteral (Core.literalInteger (Core.integerValueInt32 (var "count")))) -resetCountDef :: TBinding (Name -> Flow s ())-resetCountDef = define "resetCount" $+resetCount :: TBinding (Name -> Flow s ())+resetCount = define "resetCount" $ doc "Reset counter to zero" $- lambda "key" $ ref putAttrDef @@ var "key" @@ TTerms.int32 0+ "key" ~> putAttr @@ var "key" @@ MetaTerms.int32 0 -setAnnotationDef :: TBinding (Name -> Maybe Term -> M.Map Name Term -> M.Map Name Term)-setAnnotationDef = define "setAnnotation" $+setAnnotation :: TBinding (Name -> Maybe Term -> M.Map Name Term -> M.Map Name Term)+setAnnotation = define "setAnnotation" $ doc "Set annotation in map" $- lambdas ["key", "val", "m"] $ Maps.alter (constant $ var "val") (var "key") (var "m")+ "key" ~> "val" ~> "m" ~> Maps.alter (constant (var "val")) (var "key") (var "m") -setDescriptionDef :: TBinding (Maybe String -> M.Map Name Term -> M.Map Name Term)-setDescriptionDef = define "setDescription" $+setDescription :: TBinding (Maybe String -> M.Map Name Term -> M.Map Name Term)+setDescription = define "setDescription" $ doc "Set description in annotations" $- lambda "d" $ ref setAnnotationDef- @@ ref Constants.key_descriptionDef- @@ Optionals.map (unaryFunction Core.termLiteral <.> unaryFunction Core.literalString) (var "d")+ "d" ~> setAnnotation+ @@ Constants.key_description+ @@ Maybes.map (unaryFunction Core.termLiteral <.> unaryFunction Core.literalString) (var "d") -setTermAnnotationDef :: TBinding (Name -> Maybe Term -> Term -> Term)-setTermAnnotationDef = define "setTermAnnotation" $+setTermAnnotation :: TBinding (Name -> Maybe Term -> Term -> Term)+setTermAnnotation = define "setTermAnnotation" $ doc "Set term annotation" $- lambdas ["key", "val", "term"] $ lets [- "term'">: ref Rewriting.deannotateTermDef @@ var "term",- "anns">: ref setAnnotationDef @@ var "key" @@ var "val" @@ (ref termAnnotationInternalDef @@ var "term")] $- Logic.ifElse (Maps.null $ var "anns")- (var "term'")- (Core.termAnnotated $ Core.annotatedTerm (var "term'") (var "anns"))+ "key" ~> "val" ~> "term" ~>+ "term'" <~ Rewriting.deannotateTerm @@ var "term" $+ "anns" <~ setAnnotation @@ var "key" @@ var "val" @@ (termAnnotationInternal @@ var "term") $+ Logic.ifElse (Maps.null (var "anns"))+ (var "term'")+ (Core.termAnnotated (Core.annotatedTerm (var "term'") (var "anns"))) -setTermDescriptionDef :: TBinding (Maybe String -> Term -> Term)-setTermDescriptionDef = define "setTermDescription" $+setTermDescription :: TBinding (Maybe String -> Term -> Term)+setTermDescription = define "setTermDescription" $ doc "Set term description" $- lambda "d" $ ref setTermAnnotationDef- @@ ref Constants.key_descriptionDef- @@ Optionals.map (lambda "s" $ Core.termLiteral $ Core.literalString $ var "s") (var "d")+ "d" ~> setTermAnnotation+ @@ Constants.key_description+ @@ Maybes.map ("s" ~> Core.termLiteral (Core.literalString (var "s"))) (var "d") -setTypeDef :: TBinding (Maybe Type -> M.Map Name Term -> M.Map Name Term)-setTypeDef = define "setType" $+setType :: TBinding (Maybe Type -> M.Map Name Term -> M.Map Name Term)+setType = define "setType" $ doc "Set type in annotations" $- lambda "mt" $ ref setAnnotationDef @@ ref Constants.key_typeDef @@ Optionals.map (ref EncodeCore.typeDef) (var "mt")+ "mt" ~> setAnnotation @@ Constants.key_type @@ Maybes.map (encoderFor _Type) (var "mt") -setTypeAnnotationDef :: TBinding (Name -> Maybe Term -> Type -> Type)-setTypeAnnotationDef = define "setTypeAnnotation" $+setTypeAnnotation :: TBinding (Name -> Maybe Term -> Type -> Type)+setTypeAnnotation = define "setTypeAnnotation" $ doc "Set type annotation" $- lambdas ["key", "val", "typ"] $ lets [- "typ'">: ref Rewriting.deannotateTypeDef @@ var "typ",- "anns">: ref setAnnotationDef @@ var "key" @@ var "val" @@ (ref typeAnnotationInternalDef @@ var "typ")] $- Logic.ifElse (Maps.null (var "anns"))- (var "typ'")- (Core.typeAnnotated $ Core.annotatedType (var "typ'") (var "anns"))+ "key" ~> "val" ~> "typ" ~>+ "typ'" <~ Rewriting.deannotateType @@ var "typ" $+ "anns" <~ setAnnotation @@ var "key" @@ var "val" @@ (typeAnnotationInternal @@ var "typ") $+ Logic.ifElse (Maps.null (var "anns"))+ (var "typ'")+ (Core.typeAnnotated (Core.annotatedType (var "typ'") (var "anns"))) -setTypeClassesDef :: TBinding (M.Map Name (S.Set TypeClass) -> Term -> Term)-setTypeClassesDef = define "setTypeClasses" $+setTypeClasses :: TBinding (M.Map Name (S.Set TypeClass) -> Term -> Term)+setTypeClasses = define "setTypeClasses" $ doc "Set type classes on term" $- lambda "m" $ lets [- "encodeClass">: lambda "tc" $ cases _TypeClass (var "tc") Nothing [- _TypeClass_equality>>: constant $ TTerms.unitVariantPhantom _TypeClass _TypeClass_equality,- _TypeClass_ordering>>: constant $ TTerms.unitVariantPhantom _TypeClass _TypeClass_ordering],- "encodePair">: lambda "nameClasses" $ lets [- "name">: first $ var "nameClasses",- "classes">: second $ var "nameClasses"] $- pair- (ref EncodeCore.nameDef @@ var "name")- (Core.termSet $ Sets.fromList $ Lists.map (var "encodeClass") $ Sets.toList $ var "classes"),- "encoded">: Logic.ifElse (Maps.null $ var "m")- nothing- (just $ Core.termMap $ Maps.fromList $ Lists.map (var "encodePair") $ Maps.toList $ var "m")]- $ ref setTermAnnotationDef @@ ref Constants.key_classesDef @@ var "encoded"+ "m" ~> "term" ~>+ "encodeClass" <~ ("tc" ~> cases _TypeClass (var "tc")+ Nothing [+ _TypeClass_equality>>: constant (MetaTerms.injectUnitPhantom _TypeClass _TypeClass_equality),+ _TypeClass_ordering>>: constant (MetaTerms.injectUnitPhantom _TypeClass _TypeClass_ordering)]) $+ "encodePair" <~ ("nameClasses" ~>+ "name" <~ Pairs.first (var "nameClasses") $+ "classes" <~ Pairs.second (var "nameClasses") $+ pair+ (encoderFor _Name @@ var "name")+ (Core.termSet (Sets.fromList (Lists.map (var "encodeClass") (Sets.toList (var "classes")))))) $+ "encoded" <~ Logic.ifElse (Maps.null (var "m"))+ nothing+ (just (Core.termMap (Maps.fromList (Lists.map (var "encodePair") (Maps.toList (var "m")))))) $+ setTermAnnotation @@ Constants.key_classes @@ var "encoded" @@ var "term" -setTypeDescriptionDef :: TBinding (Maybe String -> Type -> Type)-setTypeDescriptionDef = define "setTypeDescription" $+setTypeDescription :: TBinding (Maybe String -> Type -> Type)+setTypeDescription = define "setTypeDescription" $ doc "Set type description" $- lambda "d" $ ref setTypeAnnotationDef- @@ ref Constants.key_descriptionDef- @@ Optionals.map (unaryFunction Core.termLiteral <.> unaryFunction Core.literalString) (var "d")+ "d" ~> setTypeAnnotation+ @@ Constants.key_description+ @@ Maybes.map (unaryFunction Core.termLiteral <.> unaryFunction Core.literalString) (var "d") -termAnnotationInternalDef :: TBinding (Term -> M.Map Name Term)-termAnnotationInternalDef = define "termAnnotationInternal" $+termAnnotationInternal :: TBinding (Term -> M.Map Name Term)+termAnnotationInternal = define "termAnnotationInternal" $ doc "Get internal term annotations" $- lets [- "getAnn">: lambda "t" $ cases _Term (var "t")- (Just nothing) [- _Term_annotated>>: lambda "a" $ just $ var "a"]] $- ref aggregateAnnotationsDef @@ var "getAnn" @@ (unaryFunction Core.annotatedTermSubject) @@ (unaryFunction Core.annotatedTermAnnotation)+ "term" ~>+ "getAnn" <~ ("t" ~> cases _Term (var "t")+ (Just nothing) [+ _Term_annotated>>: "a" ~> just $ var "a"]) $+ aggregateAnnotations+ @@ var "getAnn"+ @@ ("at" ~> Core.annotatedTermBody $ var "at")+ @@ ("at" ~> Core.annotatedTermAnnotation $ var "at")+ @@ var "term" -typeAnnotationInternalDef :: TBinding (Type -> M.Map Name Term)-typeAnnotationInternalDef = define "typeAnnotationInternal" $- doc "Get internal type annotations" $ lets [- "getAnn">: lambda "t" $ cases _Type (var "t")- (Just nothing) [- _Type_annotated>>: lambda "a" $ just $ var "a"]] $- ref aggregateAnnotationsDef @@ var "getAnn" @@ (unaryFunction Core.annotatedTypeSubject) @@ (unaryFunction Core.annotatedTypeAnnotation)+typeAnnotationInternal :: TBinding (Type -> M.Map Name Term)+typeAnnotationInternal = define "typeAnnotationInternal" $+ doc "Get internal type annotations" $+ "typ" ~>+ "getAnn" <~ lambda "t" (cases _Type (var "t")+ (Just nothing) [+ _Type_annotated>>: lambda "a" (just $ var "a")]) $+ aggregateAnnotations+ @@ var "getAnn"+ @@ ("at" ~> Core.annotatedTypeBody $ var "at")+ @@ ("at" ~> Core.annotatedTypeAnnotation $ var "at")+ @@ var "typ" -- TODO: deprecate-typeElementDef :: TBinding (Name -> Type -> Binding)-typeElementDef = define "typeElement" $+typeElement :: TBinding (Name -> Type -> Binding)+typeElement = define "typeElement" $ doc "Create a type element with proper annotations" $- lambdas ["name", "typ"] $ lets [- "schemaTerm">: Core.termVariable (Core.nameLift _Type),- "dataTerm">: ref normalizeTermAnnotationsDef @@ (Core.termAnnotated $ Core.annotatedTerm- (ref EncodeCore.typeDef @@ var "typ")- (Maps.fromList $ list [pair (ref Constants.key_typeDef) (var "schemaTerm")]))] $- Core.binding (var "name") (var "dataTerm") (just $ Core.typeScheme (list []) (var "typ"))+ "name" ~> "typ" ~>+ "schemaTerm" <~ Core.termVariable (Core.nameLift _Type) $+ "dataTerm" <~ normalizeTermAnnotations @@ (Core.termAnnotated (Core.annotatedTerm+ (encoderFor _Type @@ var "typ")+ (Maps.fromList (list [pair (Constants.key_type) (var "schemaTerm")])))) $+ Core.binding (var "name") (var "dataTerm") (just (Core.typeScheme (list ([] :: [TTerm Name])) (Core.typeVariable $ Core.nameLift _Type) Phantoms.nothing)) -whenFlagDef :: TBinding (Name -> Flow s a -> Flow s a -> Flow s a)-whenFlagDef = define "whenFlag" $+whenFlag :: TBinding (Name -> Flow s a -> Flow s a -> Flow s a)+whenFlag = define "whenFlag" $ doc "Execute different flows based on flag" $- lambdas ["flag", "fthen", "felse"] $ binds [- "b">: ref hasFlagDef @@ var "flag"] $- Logic.ifElse (var "b") (var "fthen") (var "felse")---- TODO: move into hydra.rewriting-unshadowVariablesDef :: TBinding (Term -> Term)-unshadowVariablesDef = define "unshadowVariables" $- doc "Unshadow variables in term" $- lambda "term" $ lets [- "freshName">: Flows.map (lambda "n" $ Core.name $ Strings.cat2 (string "s") (Literals.showInt32 $ var "n")) $- ref nextCountDef @@ Core.name (string "unshadow"),- "rewrite">: lambdas ["recurse", "term"] $ lets [- "handleOther">: var "recurse" @@ var "term"] $ binds [- "state">: ref Monads.getStateDef] $ lets [- "reserved">: first $ var "state",- "subst">: second $ var "state"] $- cases _Term (var "term")- (Just $ var "handleOther") [- _Term_variable>>: lambda "v" $ produce $ Core.termVariable $- Optionals.fromMaybe (var "v") (Maps.lookup (var "v") (var "subst")),- _Term_function>>: lambda "f" $- cases _Function (var "f")- (Just $ var "handleOther") [- _Function_lambda>>: lambda "l" $ lets [- "v">: Core.lambdaParameter $ var "l",- "d">: Core.lambdaDomain $ var "l",- "body">: Core.lambdaBody $ var "l"] $- Logic.ifElse (Sets.member (var "v")(var "reserved"))- ( bind "v'" (var "freshName") $- exec (ref Monads.putStateDef @@ pair- (Sets.insert (var "v'") (var "reserved"))- (Maps.insert (var "v") (var "v'") (var "subst"))) $- bind "body'" (var "recurse" @@ var "body") $- exec (ref Monads.putStateDef @@ var "state") $- produce $ Core.termFunction $ Core.functionLambda $ Core.lambda (var "v'") (var "d") (var "body'"))- ( exec (ref Monads.putStateDef @@ pair (Sets.insert (var "v") (var "reserved")) (var "subst")) $- Flows.map- (lambda "body'" $ Core.termFunction $ Core.functionLambda $ Core.lambda (var "v") (var "d") (var "body'"))- (var "recurse" @@ var "body"))]]] $- Optionals.fromJust $ Compute.flowStateValue $ Compute.unFlow- (ref Rewriting.rewriteTermMDef @@ var "rewrite" @@ var "term")- (pair Sets.empty Maps.empty)- (ref Monads.emptyTraceDef)+ "flag" ~> "fthen" ~> "felse" ~>+ "b" <<~ hasFlag @@ var "flag" $+ Logic.ifElse (var "b") (var "fthen") (var "felse") -withDepthDef :: TBinding (Name -> (Int -> Flow s a) -> Flow s a)-withDepthDef = define "withDepth" $+withDepth :: TBinding (Name -> (Int -> Flow s a) -> Flow s a)+withDepth = define "withDepth" $ doc ("Provide an one-indexed, integer-valued 'depth' to a flow, where the depth is the number of nested calls." <> " This is useful for generating variable names while avoiding conflicts between the variables of parents and children." <> " E.g. a variable in an outer case/match statement might be \"v1\", whereas the variable of another case/match statement" <> " inside of the first one becomes \"v2\". See also nextCount.") $- lambdas ["key", "f"] $ binds [- "count">: ref getCountDef @@ var "key"] $ lets [- "inc">: Math.add (var "count") (int32 1)] $- exec (ref putCountDef @@ var "key" @@ var "inc") $ binds [- "r">: var "f" @@ var "inc"] $- exec (ref putCountDef @@ var "key" @@ var "count") $- produce $ var "r"+ "key" ~> "f" ~>+ "count" <<~ getCount @@ var "key" $+ "inc" <~ Math.add (var "count") (int32 1) $+ exec (putCount @@ var "key" @@ var "inc") $+ "r" <<~ var "f" @@ var "inc" $+ exec (putCount @@ var "key" @@ var "count") $+ produce (var "r")
src/main/haskell/Hydra/Sources/Kernel/Terms/Arity.hs view
@@ -1,99 +1,123 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Terms.Arity where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (functionArity, primitiveArity, termArity, typeArity, typeSchemeArity, uncurryType) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.arity"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns+ module_ :: Module-module_ = Module (Namespace "hydra.arity") elements+module_ = Module ns elements []- kernelTypesModules $- Just ("Functions dealing with arguments and arity.")+ kernelTypesNamespaces $+ Just "Functions dealing with arguments and arity." where elements = [- el functionArityDef,- el primitiveArityDef,- el termArityDef,- el typeArityDef,- el uncurryTypeDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_+ toBinding functionArity,+ toBinding primitiveArity,+ toBinding termArity,+ toBinding typeArity,+ toBinding typeSchemeArity,+ toBinding uncurryType] -functionArityDef :: TBinding (Function -> Int)-functionArityDef = define "functionArity" $+functionArity :: TBinding (Function -> Int)+functionArity = define "functionArity" $+ doc "Find the arity (expected number of arguments) of a function" $ match _Function Nothing [ _Function_elimination>>: constant (int32 1),- _Function_lambda>>: (lambda "i" $ Math.add (int32 1) (var "i")) <.> (ref termArityDef <.> unaryFunction Core.lambdaBody),+ _Function_lambda>>: (lambda "i" $ Math.add (int32 1) (var "i")) <.> (termArity <.> unaryFunction Core.lambdaBody), _Function_primitive>>: constant $ doc "TODO: This function needs to be monadic, so we can look up the primitive" (int32 42)] -primitiveArityDef :: TBinding (Primitive -> Int)-primitiveArityDef = define "primitiveArity" $+primitiveArity :: TBinding (Primitive -> Int)+primitiveArity = define "primitiveArity" $ doc "Find the arity (expected number of arguments) of a primitive constant or function" $- (ref typeArityDef <.> unaryFunction Core.typeSchemeType <.> unaryFunction Graph.primitiveType)+ (typeArity <.> unaryFunction Core.typeSchemeType <.> unaryFunction Graph.primitiveType) -termArityDef :: TBinding (Term -> Int)-termArityDef = define "termArity" $+termArity :: TBinding (Term -> Int)+termArity = define "termArity" $+ doc "Find the arity (expected number of arguments) of a term" $ match _Term (Just $ int32 0) [- _Term_application>>: (lambda "xapp" $ Math.sub (var "xapp") (int32 1)) <.> ref termArityDef <.> unaryFunction Core.applicationFunction,- _Term_function>>: ref functionArityDef]+ _Term_application>>: (lambda "xapp" $ Math.sub (var "xapp") (int32 1)) <.> termArity <.> unaryFunction Core.applicationFunction,+ _Term_function>>: functionArity] -- Note: ignoring variables which might resolve to functions -typeArityDef :: TBinding (Type -> Int)-typeArityDef = define "typeArity" $+typeArity :: TBinding (Type -> Int)+typeArity = define "typeArity" $+ doc "Find the arity (expected number of arguments) of a type" $ match _Type (Just $ int32 0) [- _Type_annotated>>: ref typeArityDef <.> unaryFunction Core.annotatedTypeSubject,- _Type_application>>: ref typeArityDef <.> unaryFunction Core.applicationTypeFunction,- _Type_forall>>: ref typeArityDef <.> unaryFunction Core.forallTypeBody,+ _Type_annotated>>: typeArity <.> unaryFunction Core.annotatedTypeBody,+ _Type_application>>: typeArity <.> unaryFunction Core.applicationTypeFunction,+ _Type_forall>>: typeArity <.> unaryFunction Core.forallTypeBody, _Type_function>>: lambda "f" $- Math.add (int32 1) (ref typeArityDef @@ (Core.functionTypeCodomain $ var "f"))]+ Math.add (int32 1) (typeArity <.> unaryFunction Core.functionTypeCodomain @@ var "f")] -uncurryTypeDef :: TBinding (Type -> [Type])-uncurryTypeDef = define "uncurryType" $+typeSchemeArity :: TBinding (TypeScheme -> Int)+typeSchemeArity = define "typeSchemeArity" $+ doc "Find the arity (expected number of arguments) of a type scheme" $+ typeArity <.> unaryFunction Core.typeSchemeType++uncurryType :: TBinding (Type -> [Type])+uncurryType = define "uncurryType" $ doc "Uncurry a type expression into a list of types, turning a function type a -> b into cons a (uncurryType b)" $ lambda "t" ((match _Type (Just $ list [var "t"]) [- _Type_annotated>>: ref uncurryTypeDef <.> unaryFunction Core.annotatedTypeSubject,- _Type_application>>: ref uncurryTypeDef <.> unaryFunction Core.applicationTypeFunction,- _Type_forall>>: ref uncurryTypeDef <.> unaryFunction Core.forallTypeBody,+ _Type_annotated>>: uncurryType <.> unaryFunction Core.annotatedTypeBody,+ _Type_application>>: uncurryType <.> unaryFunction Core.applicationTypeFunction,+ _Type_forall>>: uncurryType <.> unaryFunction Core.forallTypeBody, _Type_function>>: lambda "ft" $ Lists.cons (Core.functionTypeDomain $ var "ft")- (ref uncurryTypeDef @@ (Core.functionTypeCodomain $ var "ft"))]) @@ var "t")+ (uncurryType <.> unaryFunction Core.functionTypeCodomain @@ var "ft")]) @@ var "t")
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Checking.hs view
@@ -0,0 +1,798 @@++{-+TODO:+* Double-check the use of checkTypeVariables for consistency across rules+* In nominal rules (record/union/wrap intro and elim), double-check that we are checking provided data against the schema+* Use the inference debug flag to enable / disable code which is purely for checking and not for reconstruction.+* When the debug flag is set, call checkType from hydra.inference rules+-}++module Hydra.Sources.Kernel.Terms.Checking where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ allEqual, applyTypeArgumentsToType, checkForUnboundTypeVariables, checkNominalApplication,+ checkSameType, checkType, checkTypeSubst, checkTypeVariables, containsInScopeTypeVars, normalizeTypeFreeVars, toFContext,+ typeListsEffectivelyEqual, typeOf, typeOfAnnotatedTerm, typeOfApplication, typeOfCaseStatement,+ typeOfEither, typeOfFunction, typeOfInjection, typeOfLambda, typeOfLet, typeOfLiteral, typeOfList,+ typeOfMap, typeOfMaybe, typeOfPair, typeOfPrimitive, typeOfProjection, typeOfRecord, typeOfSet,+ typeOfTypeApplication, typeOfTypeLambda, typeOfUnion, typeOfUnit, typeOfUnwrap, typeOfVariable,+ typeOfWrap, typeOfWrappedTerm, typesAllEffectivelyEqual, typesEffectivelyEqual)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Meta as ShowMeta+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+++ns :: Namespace+ns = Namespace "hydra.checking"++module_ :: Module+module_ = Module ns elements+ [Constants.ns, ExtractCore.ns, Formatting.ns, Lexical.ns, Reflect.ns, Rewriting.ns,+ Schemas.ns, ShowCore.ns, ShowMeta.ns, Substitution.ns]+ kernelTypesNamespaces $+ Just "Type checking and type reconstruction (type-of) for the results of Hydra unification and inference"+ where+ elements = [+ toBinding allEqual,+ toBinding applyTypeArgumentsToType,+ toBinding checkForUnboundTypeVariables,+ toBinding checkNominalApplication,+ toBinding checkSameType,+ toBinding checkType,+ toBinding checkTypeSubst,+ toBinding checkTypeVariables,+ toBinding toFContext,+ toBinding typeListsEffectivelyEqual,+ toBinding typeOf,+ toBinding typeOfAnnotatedTerm,+ toBinding typeOfApplication,+ toBinding typeOfCaseStatement,+ toBinding typeOfEither,+ toBinding typeOfInjection,+ toBinding typeOfLambda,+ toBinding typeOfLet,+ toBinding typeOfList,+ toBinding typeOfLiteral,+ toBinding typeOfMap,+ toBinding typeOfMaybe,+ toBinding typeOfPair,+ toBinding typeOfPrimitive,+ toBinding typeOfProjection,+ toBinding typeOfRecord,+ toBinding typeOfSet,+ toBinding typeOfTypeApplication,+ toBinding typeOfTypeLambda,+ toBinding typeOfUnit,+ toBinding typeOfUnwrap,+ toBinding typeOfVariable,+ toBinding typeOfWrappedTerm,+ toBinding containsInScopeTypeVars,+ toBinding normalizeTypeFreeVars,+ toBinding typesAllEffectivelyEqual,+ toBinding typesEffectivelyEqual]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++noTypeArgs :: TTerm [Type]+noTypeArgs = list ([] :: [TTerm Type])++--++-- TODO: move this+allEqual :: TBinding ([a] -> Bool)+allEqual = define "allEqual" $+ "els" ~>+ Logic.ifElse (Lists.null $ var "els")+ true+ (Lists.foldl+ ("b" ~> "t" ~> Logic.and (var "b") (Equality.equal (var "t") (Lists.head (var "els"))))+ true+ (Lists.tail $ var "els"))++applyTypeArgumentsToType :: TBinding (TypeContext -> [Type] -> Type -> Flow s Type)+applyTypeArgumentsToType = define "applyTypeArgumentsToType" $+ doc "Apply type arguments to a type, substituting forall-bound variables" $+ "tx" ~> "typeArgs" ~> "t" ~>+ "nonnull" <~ (cases _Type (var "t")+ (Just $ Flows.fail $ Strings.cat $ list [+ string "not a forall type: ",+ ShowCore.type_ @@ var "t",+ string ". Trying to apply ",+ Literals.showInt32 (Lists.length $ var "typeArgs"),+ string " type args: ",+ Formatting.showList @@ ShowCore.type_ @@ var "typeArgs",+ string ". Context has vars: {",+ Strings.intercalate (string ", ") (Lists.map (unaryFunction $ Core.unName) $ Maps.keys $ Typing.typeContextTypes $ var "tx"),+ string "}"]) [+ _Type_forall>>: "ft" ~>+ "v" <~ Core.forallTypeParameter (var "ft") $+ "tbody" <~ Core.forallTypeBody (var "ft") $+ applyTypeArgumentsToType+ @@ var "tx"+ @@ (Lists.tail $ var "typeArgs")+ @@ (Substitution.substInType+ @@ (Typing.typeSubst $ Maps.singleton (var "v") (Lists.head $ var "typeArgs"))+ @@ (var "tbody"))]) $+ -- Only check type variables when there are no more type arguments to apply.+ -- When there ARE type arguments, the type may contain forall-bound variables that will+ -- be substituted by the type arguments. Those variables aren't in scope yet but will be resolved.+ Logic.ifElse (Lists.null $ var "typeArgs")+ (exec (checkTypeVariables @@ var "tx" @@ var "t") $ produce $ var "t")+ (var "nonnull")++checkForUnboundTypeVariables :: TBinding (InferenceContext -> Term -> Flow s ())+checkForUnboundTypeVariables = define "checkForUnboundTypeVariables" $+ doc "Check that a term has no unbound type variables" $+ "cx" ~> "term0" ~>+ "svars" <~ Sets.fromList (Maps.keys $ Typing.inferenceContextSchemaTypes $ var "cx") $+ "checkRecursive" <~ ("vars" ~> "trace" ~> "lbinding" ~> "term" ~>+ "recurse" <~ var "checkRecursive" @@ var "vars" @@ var "trace" @@ var "lbinding" $+ "dflt" <~ (+ exec (Flows.mapList (var "recurse") (Rewriting.subterms @@ var "term")) $+ produce unit) $+ "check" <~ ("typ" ~>+ "freevars" <~ Rewriting.freeVariablesInType @@ var "typ" $+ "badvars" <~ Sets.difference (Sets.difference (var "freevars") (var "vars")) (var "svars") $+ Logic.ifElse (Sets.null $ var "badvars")+ (produce unit)+ (Flows.fail $ (string "unbound type variables: {")+ ++ (Strings.intercalate (string ", ") (Lists.map (unaryFunction Core.unName) $ Sets.toList $ var "badvars"))+ ++ (string "} in type ") ++ (ShowCore.type_ @@ var "typ") ++ (string " at path: ") ++ (Strings.intercalate (string " >> ") (Lists.reverse $ var "trace"))+ ++ (optCases (var "lbinding")+ (string "none")+ ("binding" ~>+ (string ". bound term = ") ++ (ShowCore.term @@ (Core.bindingTerm $ var "binding"))+ ++ (string ". bound type = ") ++ (optCases (Core.bindingType $ var "binding") (string "none") (ShowCore.typeScheme)))))) $+ "checkOptional" <~ ("m" ~>+ exec (Flows.mapMaybe (var "check") (var "m")) $+ produce unit) $+ "checkOptionalList" <~ ("ml" ~>+ exec (Flows.mapMaybe ("l" ~> Flows.mapList (var "check") (var "l")) (var "ml")) $+ produce unit) $+ cases _Term (var "term")+ (Just $ var "dflt") [+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "dflt") [+ _Function_elimination>>: "e" ~> var "dflt",+ _Function_lambda>>: "l" ~>+ exec (var "checkOptional" @@ (Core.lambdaDomain $ var "l")) $+ var "recurse" @@ (Core.lambdaBody $ var "l")],+ _Term_let>>: "l" ~>+ "forBinding" <~ ("b" ~>+ "bterm" <~ Core.bindingTerm (var "b") $+ "newVars" <~ optCases (Core.bindingType $ var "b")+ (var "vars")+ ("ts" ~> Sets.union (var "vars") (Sets.fromList $ Core.typeSchemeVariables $ var "ts")) $+ "newTrace" <~ Lists.cons (Core.unName $ Core.bindingName $ var "b") (var "trace") $+ var "checkRecursive" @@ var "newVars" @@ var "newTrace" @@ (just $ var "b") @@ var "bterm") $+ exec (Flows.mapList (var "forBinding") $ Core.letBindings $ var "l") $+ var "recurse" @@ (Core.letBody $ var "l"),+ _Term_typeApplication>>: "tt" ~>+ exec (var "check" @@ (Core.typeApplicationTermType $ var "tt")) $+ var "recurse" @@ (Core.typeApplicationTermBody $ var "tt"),+ _Term_typeLambda>>: "tl" ~>+ exec (var "check" @@ (Core.typeVariable $ Core.typeLambdaParameter $ var "tl")) $+ var "recurse" @@ (Core.typeLambdaBody $ var "tl")]) $+ var "checkRecursive" @@ Sets.empty @@ list [string "top level"] @@ nothing @@ var "term0"++checkNominalApplication :: TBinding (TypeContext -> Name -> [Type] -> Flow s ())+checkNominalApplication = define "checkNominalApplication" $+ doc "Check that a nominal type is applied to the correct number of type arguments" $+ "tx" ~> "tname" ~> "typeArgs" ~>+ "schemaType" <<~ Schemas.requireSchemaType @@ Typing.typeContextInferenceContext (var "tx") @@ var "tname" $+ "vars" <~ Core.typeSchemeVariables (var "schemaType") $+ "body" <~ Core.typeSchemeType (var "schemaType") $+ "varslen" <~ Lists.length (var "vars") $+ "argslen" <~ Lists.length (var "typeArgs") $+ Logic.ifElse (Equality.equal (var "varslen") (var "argslen"))+ (produce unit)+ (Flows.fail $ (string "nominal type ") ++ Core.unName (var "tname") ++ (string " applied to the wrong number of type arguments: ")+ ++ (string "(expected ") ++ Literals.showInt32 (var "varslen") ++ (string " arguments, got ")+ ++ Literals.showInt32 (var "argslen") ++ (string "): ")+ ++ (Formatting.showList @@ (ShowCore.type_) @@ (var "typeArgs")))++checkSameType :: TBinding (TypeContext -> String -> [Type] -> Flow s Type)+checkSameType = define "checkSameType" $+ doc "Ensure all types in a list are equal and return the common type" $+ "tx" ~> "desc" ~> "types" ~>+ Logic.ifElse (typesAllEffectivelyEqual @@ var "tx" @@ var "types")+ (Flows.pure $ Lists.head $ var "types")+ (Flows.fail $ Strings.cat $ list [+ string "unequal types ",+ (Formatting.showList @@ ShowCore.type_ @@ var "types"),+ string " in ",+ var "desc"])++-- TODO: unused+checkType :: TBinding (TypeContext -> Term -> Type -> Flow s ())+checkType = define "checkType" $+ doc "Check that a term has the expected type" $+ "tx" ~> "term" ~> "typ" ~>+ "cx" <~ Typing.typeContextInferenceContext (var "tx") $+ "vars" <~ Typing.typeContextTypeVariables (var "tx") $+ Logic.ifElse (Constants.debugInference)+ ("t0" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "term" $+ Logic.ifElse (typesEffectivelyEqual @@ var "tx" @@ var "t0" @@ var "typ")+ (Flows.pure unit)+ (Flows.fail $ Strings.cat $ list [+ string "type checking failed: expected ",+ ShowCore.type_ @@ var "typ",+ string " but found ",+ ShowCore.type_ @@ var "t0"]))+ (Flows.pure unit)++checkTypeSubst :: TBinding (InferenceContext -> TypeSubst -> Flow s TypeSubst)+checkTypeSubst = define "checkTypeSubst" $+ doc ("Sanity-check a type substitution arising from unification. Specifically, check that schema types have not been"+ <> " inappropriately unified with type variables inferred from terms.") $+ "cx" ~> "subst" ~>+ "s" <~ Typing.unTypeSubst (var "subst") $+ "vars" <~ Sets.fromList (Maps.keys $ var "s") $+ "suspectVars" <~ Sets.intersection (var "vars") (Sets.fromList $ Maps.keys $ Typing.inferenceContextSchemaTypes $ var "cx") $+ "isNominal" <~ ("ts" ~> cases _Type (Rewriting.deannotateType @@ (Core.typeSchemeType $ var "ts"))+ (Just false) [+ _Type_record>>: constant true,+ _Type_union>>: constant true,+ _Type_wrap>>: constant true]) $+ "badVars" <~ Sets.fromList (Lists.filter+ ("v" ~> Maybes.maybe false (var "isNominal") $+ Lexical.dereferenceSchemaType @@ var "v" @@ (Typing.inferenceContextSchemaTypes $ var "cx"))+ (Sets.toList $ var "suspectVars")) $+ "badPairs" <~ Lists.filter ("p" ~> Sets.member (Pairs.first $ var "p") (var "badVars")) (Maps.toList $ var "s") $+ "printPair" <~ ("p" ~> (Core.unName $ Pairs.first $ var "p") ++ (string " --> ") ++ (ShowCore.type_ @@ Pairs.second (var "p"))) $+ Logic.ifElse (Sets.null $ var "badVars")+ (produce $ var "subst")+ (Flows.fail $ (string "Schema type(s) incorrectly unified: {")+ ++ (Strings.intercalate (string ", ") (Lists.map (var "printPair") (var "badPairs")))+ ++ (string "}"))++checkTypeVariables :: TBinding (TypeContext -> Type -> Flow s ())+checkTypeVariables = define "checkTypeVariables" $+ doc "Check that all type variables in a type are bound. NOTE: This check is currently disabled to allow phantom type variables from polymorphic instantiation to pass through. The proper fix is to ensure `typeOf` doesn't create fresh variables for post-inference code." $+ "_tx" ~> "_typ" ~>+ -- Disabled: phantom type variables from polymorphic instantiation cause false positives.+ -- The inference pass has already validated type variables via checkForUnboundTypeVariables.+ Flows.pure unit++-- TODO: unused (?). This function can be used to construct Typing.typeContextTypes from Typing.typeContextInferenceContext+toFContext :: TBinding (InferenceContext -> M.Map Name Type)+toFContext = define "toFContext" $+ doc "Convert an inference context to a type environment by converting type schemes to System F types" $+ "cx" ~> Maps.map (Schemas.typeSchemeToFType) $ Typing.inferenceContextDataTypes $ var "cx"++typeListsEffectivelyEqual :: TBinding (TypeContext -> [Type] -> [Type] -> Bool)+typeListsEffectivelyEqual = define "typeListsEffectivelyEqual" $+ doc "Check whether two lists of types are effectively equal, disregarding type aliases" $+ "tx" ~> "tlist1" ~> "tlist2" ~>+ Logic.ifElse (Equality.equal (Lists.length (var "tlist1")) (Lists.length (var "tlist2")))+ (Lists.foldl (binaryFunction Logic.and) true $+ Lists.zipWith (typesEffectivelyEqual @@ var "tx") (var "tlist1") (var "tlist2"))+ false++typeOf :: TBinding (TypeContext -> [Type] -> Term -> Flow s Type)+typeOf = define "typeOf" $+ doc "Given a type context, reconstruct the type of a System F term" $+ "tx" ~> "typeArgs" ~> "term" ~>+ "check" <~ (cases _Term (var "term")+ (Just $ Flows.fail $ Strings.cat $ list [+ string "unsupported term variant in typeOf: ",+ ShowMeta.termVariant @@ (Reflect.termVariant @@ var "term")]) [+ _Term_annotated>>: typeOfAnnotatedTerm @@ var "tx" @@ var "typeArgs",+ _Term_application>>: typeOfApplication @@ var "tx" @@ var "typeArgs",+ _Term_either>>: typeOfEither @@ var "tx" @@ var "typeArgs",+ _Term_function>>: "f" ~>+ cases _Function (var "f") Nothing [+ _Function_elimination>>: "elm" ~>+ cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: typeOfProjection @@ var "tx" @@ var "typeArgs",+ _Elimination_union>>: typeOfCaseStatement @@ var "tx" @@ var "typeArgs",+ _Elimination_wrap>>: typeOfUnwrap @@ var "tx" @@ var "typeArgs"],+ _Function_lambda>>: typeOfLambda @@ var "tx" @@ var "typeArgs",+ _Function_primitive>>: typeOfPrimitive @@ var "tx" @@ var "typeArgs"],+ _Term_let>>: typeOfLet @@ var "tx" @@ var "typeArgs",+ _Term_list>>: typeOfList @@ var "tx" @@ var "typeArgs",+ _Term_literal>>: typeOfLiteral @@ var "tx" @@ var "typeArgs",+ _Term_map>>: typeOfMap @@ var "tx" @@ var "typeArgs",+ _Term_maybe>>: typeOfMaybe @@ var "tx" @@ var "typeArgs",+ _Term_pair>>: typeOfPair @@ var "tx" @@ var "typeArgs",+ _Term_record>>: typeOfRecord @@ var "tx" @@ var "typeArgs",+ _Term_set>>: typeOfSet @@ var "tx" @@ var "typeArgs",+ _Term_typeApplication>>: typeOfTypeApplication @@ var "tx" @@ var "typeArgs",+ _Term_typeLambda>>: typeOfTypeLambda @@ var "tx" @@ var "typeArgs",+ _Term_union>>: typeOfInjection @@ var "tx" @@ var "typeArgs",+ _Term_unit>>: constant $ typeOfUnit @@ var "tx" @@ var "typeArgs",+ _Term_variable>>: typeOfVariable @@ var "tx" @@ var "typeArgs",+ _Term_wrap>>: typeOfWrappedTerm @@ var "tx" @@ var "typeArgs"]) $+ trace (string "typeOf") $+-- trace (string "typeOf " ++ (ShowCore.term @@ var "term")) $ -- For debugging only; risk of slow execution and stack overflow on deeply nested terms+ var "check"++typeOfAnnotatedTerm :: TBinding (TypeContext -> [Type] -> AnnotatedTerm -> Flow s Type)+typeOfAnnotatedTerm = define "typeOfAnnotatedTerm" $+ doc "Reconstruct the type of an annotated term" $+ "tx" ~> "typeArgs" ~> "at" ~>+ typeOf @@ var "tx" @@ var "typeArgs" @@ Core.annotatedTermBody (var "at")++typeOfApplication :: TBinding (TypeContext -> [Type] -> Application -> Flow s Type)+typeOfApplication = define "typeOfApplication" $+ doc "Reconstruct the type of an application term" $+ "tx" ~> "typeArgs" ~> "app" ~>+ "fun" <~ Core.applicationFunction (var "app") $+ "arg" <~ Core.applicationArgument (var "app") $+ "tryType" <~ ("tfun" ~> "targ" ~> cases _Type (var "tfun")+ (Just $ Flows.fail $ Strings.cat $ list [+ string "left hand side of application (",+ ShowCore.term @@ var "fun",+ string ") is not function-typed (",+ ShowCore.type_ @@ var "tfun",+ string ")",+ string ". types: ", Strings.intercalate (string ", ") (Lists.map+ ("p" ~> Strings.cat $ list [Core.unName (Pairs.first $ var "p"), string ": ", ShowCore.type_ @@ (Pairs.second $ var "p")]) $+ Maps.toList $ Typing.typeContextTypes $ var "tx")]) [+ -- These forall types can arise from bindUnboundTypeVariables+ _Type_forall>>: "ft" ~> var "tryType" @@ (Core.forallTypeBody (var "ft")) @@ var "targ",+ _Type_function>>: "ft" ~>+ "dom" <~ Core.functionTypeDomain (var "ft") $+ "cod" <~ Core.functionTypeCodomain (var "ft") $+ Logic.ifElse (typesEffectivelyEqual @@ var "tx" @@ var "dom" @@ var "targ")+ (Flows.pure $ var "cod")+ (Flows.fail $ Strings.cat $ list [+ string "in application, expected ",+ ShowCore.type_ @@ var "dom",+ string " but found ",+ ShowCore.type_ @@ var "targ"]),+ -- Handle type variables: if the function type is a type variable, treat it as polymorphic+ -- and return a fresh type variable as the result type. This can happen when inference+ -- produces type variables that aren't fully resolved.+ _Type_variable>>: "v" ~>+ Flows.map (unaryFunction Core.typeVariable) (Schemas.freshName)]) $+ -- Note: We don't call checkTypeVariables on tfun/targ because they may contain+ -- phantom type variables from polymorphic instantiation that aren't in scope.+ -- The type matching in tryType ensures type correctness.+ "tfun" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "fun" $+ "targ" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "arg" $+ "t" <<~ var "tryType" @@ var "tfun" @@ var "targ" $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t"++typeOfCaseStatement :: TBinding (TypeContext -> [Type] -> CaseStatement -> Flow s Type)+typeOfCaseStatement = define "typeOfCaseStatement" $+ doc "Reconstruct the type of a case statement" $+ "tx" ~> "typeArgs" ~> "cs" ~>+ "tname" <~ Core.caseStatementTypeName (var "cs") $++ "dflt" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "cterms" <~ Lists.map (unaryFunction Core.fieldTerm) (var "cases") $+ "tdflt" <<~ Flows.mapMaybe ("e" ~> typeOf @@ var "tx" @@ noTypeArgs @@ var "e") (var "dflt") $+ "tcterms" <<~ Flows.mapList ("e" ~> typeOf @@ var "tx" @@ noTypeArgs @@ var "e") (var "cterms") $+ "fcods" <<~ Flows.mapList ("t" ~> Flows.map (unaryFunction Core.functionTypeCodomain) $ ExtractCore.functionType @@ var "t") (var "tcterms") $+ "cods" <~ Maybes.cat (Lists.cons (var "tdflt") $ Lists.map (unaryFunction Maybes.pure) (var "fcods")) $+ "cod" <<~ checkSameType @@ var "tx" @@ (string "case branches") @@ var "cods" $+-- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "typeArgs")) $+-- "scod" <~ Substitution.substInType @@ var "subst" @@ var "cod" $++ produce $ Core.typeFunction $ Core.functionType+ (Schemas.nominalApplication @@ var "tname" @@ var "typeArgs")+ (var "cod")++typeOfEither :: TBinding (TypeContext -> [Type] -> Prelude.Either Term Term -> Flow s Type)+typeOfEither = define "typeOfEither" $+ doc "Reconstruct the type of an either value" $+ "tx" ~> "typeArgs" ~> "et" ~>+ "checkLength" <~ (+ "n" <~ Lists.length (var "typeArgs") $+ Logic.ifElse (Equality.equal (var "n") (int32 2))+ (Flows.pure unit)+ (Flows.fail $ (string "either type requires 2 type arguments, got ") ++ Literals.showInt32 (var "n"))) $+ exec (var "checkLength") $+ Eithers.either_+ ("leftTerm" ~>+ "leftType" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "leftTerm" $+ exec (checkTypeVariables @@ var "tx" @@ var "leftType") $+ Flows.pure $ Core.typeEither $ Core.eitherType (var "leftType") (Lists.at (int32 1) $ var "typeArgs"))+ ("rightTerm" ~>+ "rightType" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "rightTerm" $+ exec (checkTypeVariables @@ var "tx" @@ var "rightType") $+ Flows.pure $ Core.typeEither $ Core.eitherType (Lists.at (int32 0) $ var "typeArgs") (var "rightType"))+ (var "et")++typeOfInjection :: TBinding (TypeContext -> [Type] -> Injection -> Flow s Type)+typeOfInjection = define "typeOfInjection" $+ doc "Reconstruct the type of a union injection" $+ "tx" ~> "typeArgs" ~> "injection" ~>+ "tname" <~ Core.injectionTypeName (var "injection") $++ -- The following is only for checking, not for reconstruction+ "field" <~ Core.injectionField (var "injection") $+ "fname" <~ Core.fieldName (var "field") $+ "fterm" <~ Core.fieldTerm (var "field") $+ "schemaType" <<~ Schemas.requireSchemaType @@ Typing.typeContextInferenceContext (var "tx") @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "sbody" <~ Core.typeSchemeType (var "schemaType") $+ "sfields" <<~ ExtractCore.unionType @@ var "tname" @@ var "sbody" $+ "ftyp" <<~ Schemas.findFieldType @@ var "fname" @@ var "sfields" $++ produce $ Schemas.nominalApplication @@ var "tname" @@ var "typeArgs"++typeOfLambda :: TBinding (TypeContext -> [Type] -> Lambda -> Flow s Type)+typeOfLambda = define "typeOfLambda" $+ doc "Reconstruct the type of a lambda function" $+ "tx" ~> "typeArgs" ~> "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "mdom" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "tbody" <<~ optCases (var "mdom")+ (Flows.fail (string "untyped lambda"))+ ("dom" ~>+ exec (checkTypeVariables @@ var "tx" @@ var "dom") $+ "types2" <~ Maps.insert (var "v") (var "dom") (Typing.typeContextTypes $ var "tx") $+ "cod" <<~ typeOf @@ (Typing.typeContextWithTypes (var "tx") $ var "types2") @@ noTypeArgs @@ var "body" $+ exec (checkTypeVariables @@ var "tx" @@ var "cod") $+ Flows.pure $ Core.typeFunction $ Core.functionType (var "dom") (var "cod")) $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "tbody"++typeOfLet :: TBinding (TypeContext -> [Type] -> Let -> Flow s Type)+typeOfLet = define "typeOfLet" $+ doc "Reconstruct the type of a let binding" $+ "tx" ~> "typeArgs" ~> "letTerm" ~>+ "bs" <~ Core.letBindings (var "letTerm") $+ "body" <~ Core.letBody (var "letTerm") $+ "bnames" <~ Lists.map (unaryFunction Core.bindingName) (var "bs") $+ "bterms" <~ Lists.map (unaryFunction Core.bindingTerm) (var "bs") $+ "bindingType" <~ ("b" ~>+ Maybes.maybe+ (Flows.fail $ Strings.cat $ list [+ string "untyped let binding: ",+ ShowCore.binding @@ var "b"])+ ("ts" ~> Flows.pure $ Schemas.typeSchemeToFType @@ var "ts")+ (Core.bindingType $ var "b")) $+ -- Previously inferred types for each binding+ "btypes" <<~ Flows.mapList (var "bindingType") (var "bs") $+ -- Extended type context (note: new bindings override old ones)+ "tx2" <~ (Typing.typeContextWithTypes (var "tx")+ (Maps.union+ (Maps.fromList $ Lists.zip (var "bnames") (var "btypes"))+ (Typing.typeContextTypes $ var "tx"))) $+ -- Note: We trust the declared binding types (btypes) and use them to type-check the body.+ -- Previously we also reconstructed types from terms and verified they match,+ -- but this fails for terms that lack type application wrappers (e.g. after hoisting).+ -- Since binding types come from inference and are authoritative, we skip the verification.+ "t" <<~ typeOf @@ var "tx2" @@ noTypeArgs @@ var "body" $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t"++typeOfList :: TBinding (TypeContext -> [Type] -> [Term] -> Flow s Type)+typeOfList = define "typeOfList" $+ doc "Reconstruct the type of a list" $+ "tx" ~> "typeArgs" ~> "els" ~>+ Logic.ifElse (Lists.null $ var "els")+ -- Empty list is polymorphic+ (Logic.ifElse (Equality.equal (Lists.length $ var "typeArgs") (int32 1))+ (Flows.pure $ Core.typeList $ Lists.head $ var "typeArgs")+ (Flows.fail (string "list type applied to more or less than one argument")))+ -- Nonempty list must have elements of the same type+ ( "eltypes" <<~ Flows.mapList+ (typeOf @@ var "tx" @@ noTypeArgs )+ (var "els") $+ "unifiedType" <<~ checkSameType @@ var "tx" @@ (string "list elements") @@ var "eltypes" $+ -- Verify the unified type is well-formed in the current scope+ exec (checkTypeVariables @@ var "tx" @@ var "unifiedType") $+ Flows.pure $ Core.typeList $ var "unifiedType")++typeOfLiteral :: TBinding (TypeContext -> [Type] -> Literal -> Flow s Type)+typeOfLiteral = define "typeOfLiteral" $+ doc "Reconstruct the type of a literal" $+ "tx" ~> "typeArgs" ~> "lit" ~>+ "t" <~ Core.typeLiteral (Reflect.literalType @@ var "lit") $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t"++typeOfMap :: TBinding (TypeContext -> [Type] -> M.Map Term Term -> Flow s Type)+typeOfMap = define "typeOfMap" $+ doc "Reconstruct the type of a map" $+ "tx" ~> "typeArgs" ~> "m" ~>+ "nonnull" <~ (+ "pairs" <~ Maps.toList (var "m") $+ "kt" <<~ Flows.bind+ (Flows.mapList (typeOf @@ var "tx" @@ noTypeArgs ) $+ Lists.map (unaryFunction Pairs.first) (var "pairs"))+ (checkSameType @@ var "tx" @@ (string "map keys")) $+ "vt" <<~ Flows.bind+ (Flows.mapList (typeOf @@ var "tx" @@ noTypeArgs ) $+ Lists.map (unaryFunction Pairs.second) (var "pairs"))+ (checkSameType @@ var "tx" @@ (string "map values")) $+ exec (checkTypeVariables @@ var "tx" @@ var "kt") $+ exec (checkTypeVariables @@ var "tx" @@ var "vt") $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs"+ @@ (Core.typeMap $ Core.mapType (var "kt") (var "vt"))) $+ Logic.ifElse (Maps.null $ var "m")+ -- Empty map is polymorphic+ (Logic.ifElse (Equality.equal (Lists.length $ var "typeArgs") (int32 2))+ (Flows.pure $ Core.typeMap $ Core.mapType+ (Lists.at (int32 0) $ var "typeArgs")+ (Lists.at (int32 1) $ var "typeArgs"))+ (Flows.fail (string "map type applied to more or less than two arguments")))+ -- Nonempty map must have keys and values of the same type+ (var "nonnull")++typeOfMaybe :: TBinding (TypeContext -> [Type] -> Maybe Term -> Flow s Type)+typeOfMaybe = define "typeOfMaybe" $+ doc "Reconstruct the type of an optional value" $+ "tx" ~> "typeArgs" ~> "mt" ~>+ -- Nothing case is polymorphic+ "forNothing" <~ (+ "n" <~ Lists.length (var "typeArgs") $+ Logic.ifElse (Equality.equal (var "n") (int32 1))+ (Flows.pure $ Core.typeMaybe $ Lists.head $ var "typeArgs")+ (Flows.fail $ (string "optional type applied to ") ++ Literals.showInt32 (var "n") ++ (string " argument(s). Expected 1."))) $+ -- Just case: infer type of the contained term+ "forJust" <~ ("term" ~>+ "t" <<~ (+ "termType" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "term" $+ exec (checkTypeVariables @@ var "tx" @@ var "termType") $+ Flows.pure $ Core.typeMaybe $ var "termType") $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t") $+ optCases (var "mt") (var "forNothing") (var "forJust")++typeOfPair :: TBinding (TypeContext -> [Type] -> (Term, Term) -> Flow s Type)+typeOfPair = define "typeOfPair" $+ doc "Reconstruct the type of a pair" $+ "tx" ~> "typeArgs" ~> "p" ~>+ "checkLength" <~ (+ "n" <~ Lists.length (var "typeArgs") $+ Logic.ifElse (Equality.equal (var "n") (int32 2))+ (Flows.pure unit)+ (Flows.fail $ (string "pair type requires 2 type arguments, got ") ++ Literals.showInt32 (var "n"))) $+ exec (var "checkLength") $+ "pairFst" <~ Pairs.first (var "p") $+ "pairSnd" <~ Pairs.second (var "p") $+ "firstType" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "pairFst" $+ exec (checkTypeVariables @@ var "tx" @@ var "firstType") $+ "secondType" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "pairSnd" $+ exec (checkTypeVariables @@ var "tx" @@ var "secondType") $+ Flows.pure $ Core.typePair $ Core.pairType (var "firstType") (var "secondType")++typeOfPrimitive :: TBinding (TypeContext -> [Type] -> Name -> Flow s Type)+typeOfPrimitive = define "typeOfPrimitive" $+ doc "Reconstruct the type of a primitive function" $+ "tx" ~> "typeArgs" ~> "name" ~>+ "ts" <<~ optCases+ (Maps.lookup (var "name") (Typing.inferenceContextPrimitiveTypes $ Typing.typeContextInferenceContext $ var "tx"))+ (Flows.fail $ Strings.cat $ list [+ string "no such primitive: ",+ Core.unName $ var "name"])+ (Schemas.instantiateTypeScheme) $+ "t" <~ Schemas.typeSchemeToFType @@ var "ts" $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t"++typeOfProjection :: TBinding (TypeContext -> [Type] -> Projection -> Flow s Type)+typeOfProjection = define "typeOfProjection" $+ doc "Reconstruct the type of a record projection" $+ "tx" ~> "typeArgs" ~> "p" ~>+ "tname" <~ Core.projectionTypeName (var "p") $+ "fname" <~ Core.projectionField (var "p") $+ "schemaType" <<~ Schemas.requireSchemaType @@ Typing.typeContextInferenceContext (var "tx") @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "sbody" <~ Core.typeSchemeType (var "schemaType") $+ "sfields" <<~ ExtractCore.recordType @@ var "tname" @@ var "sbody" $+ "ftyp" <<~ Schemas.findFieldType @@ var "fname" @@ var "sfields" $+ "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "typeArgs")) $+ "sftyp" <~ Substitution.substInType @@ var "subst" @@ var "ftyp" $+ produce $ Core.typeFunction $ Core.functionType+ (Schemas.nominalApplication @@ var "tname" @@ var "typeArgs")+ (var "sftyp")++typeOfRecord :: TBinding (TypeContext -> [Type] -> Record -> Flow s Type)+typeOfRecord = define "typeOfRecord" $+ doc "Reconstruct the type of a record" $+ "tx" ~> "typeArgs" ~> "record" ~>+ "tname" <~ Core.recordTypeName (var "record") $++ -- The following is only for checking, not for reconstruction+ "fields" <~ Core.recordFields (var "record") $+ "ftypes" <<~ Flows.mapList+ (typeOf @@ var "tx" @@ noTypeArgs )+ (Lists.map (unaryFunction Core.fieldTerm) (var "fields")) $+ exec (Flows.mapList (checkTypeVariables @@ var "tx") (var "ftypes")) $++ produce $ Schemas.nominalApplication @@ var "tname" @@ var "typeArgs"++typeOfSet :: TBinding (TypeContext -> [Type] -> S.Set Term -> Flow s Type)+typeOfSet = define "typeOfSet" $+ doc "Reconstruct the type of a set" $+ "tx" ~> "typeArgs" ~> "els" ~>+ Logic.ifElse (Sets.null $ var "els")+ -- Empty set is polymorphic+ (Logic.ifElse (Equality.equal (Lists.length $ var "typeArgs") (int32 1))+ (Flows.pure $ Core.typeSet $ Lists.head $ var "typeArgs")+ (Flows.fail (string "set type applied to more or less than one argument")))+ -- Nonempty set must have elements of the same type+ ( "eltypes" <<~ Flows.mapList+ (typeOf @@ var "tx" @@ noTypeArgs )+ (Sets.toList $ var "els") $+ "unifiedType" <<~ checkSameType @@ var "tx" @@ (string "set elements") @@ var "eltypes" $+ -- Verify the unified type is well-formed in the current scope+ exec (checkTypeVariables @@ var "tx" @@ var "unifiedType") $+ produce $ Core.typeSet $ var "unifiedType")++typeOfTypeApplication :: TBinding (TypeContext -> [Type] -> TypeApplicationTerm -> Flow s Type)+typeOfTypeApplication = define "typeOfTypeApplication" $+ doc "Reconstruct the type of a type application term" $+ "tx" ~> "typeArgs" ~> "tyapp" ~>+ "body" <~ Core.typeApplicationTermBody (var "tyapp") $+ "t" <~ Core.typeApplicationTermType (var "tyapp") $+ typeOf @@ var "tx" @@ Lists.cons (var "t") (var "typeArgs") @@ var "body"++typeOfTypeLambda :: TBinding (TypeContext -> [Type] -> TypeLambda -> Flow s Type)+typeOfTypeLambda = define "typeOfTypeLambda" $+ doc "Reconstruct the type of a type lambda (type abstraction) term" $+ "tx" ~> "typeArgs" ~> "tl" ~>+ "v" <~ Core.typeLambdaParameter (var "tl") $+ "body" <~ Core.typeLambdaBody (var "tl") $+ "vars" <~ Typing.typeContextTypeVariables (var "tx") $+ "tx2" <~ Typing.typeContextWithTypeVariables (var "tx") (Sets.insert (var "v") (var "vars")) $+ "t1" <<~ typeOf @@ var "tx2" @@ noTypeArgs @@ var "body" $+ exec (checkTypeVariables @@ var "tx2" @@ var "t1") $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs"+ @@ (Core.typeForall $ Core.forallType (var "v") (var "t1"))++typeOfUnit :: TBinding (TypeContext -> [Type] -> Flow s Type)+typeOfUnit = define "typeOfUnit" $+ doc "Reconstruct the type of the unit term" $+ "tx" ~> "typeArgs" ~>+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ Core.typeUnit++typeOfUnwrap :: TBinding (TypeContext -> [Type] -> Name -> Flow s Type)+typeOfUnwrap = define "typeOfUnwrap" $+ doc "Reconstruct the type of an unwrap operation" $+ "tx" ~> "typeArgs" ~> "tname" ~>+ "schemaType" <<~ Schemas.requireSchemaType @@ Typing.typeContextInferenceContext (var "tx") @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "sbody" <~ Core.typeSchemeType (var "schemaType") $+ "wrapped" <<~ ExtractCore.wrappedType @@ var "tname" @@ var "sbody" $+ "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "typeArgs")) $+ "swrapped" <~ Substitution.substInType @@ var "subst" @@ var "wrapped" $+ produce $ MetaTypes.function+ (Schemas.nominalApplication @@ var "tname" @@ var "typeArgs")+ (var "swrapped")++typeOfVariable :: TBinding (TypeContext -> [Type] -> Name -> Flow s Type)+typeOfVariable = define "typeOfVariable" $+ doc "Reconstruct the type of a variable" $+ "tx" ~> "typeArgs" ~> "name" ~>+ "rawType" <~ Maps.lookup (var "name") (Typing.typeContextTypes $ var "tx") $+ "failMsg" <~ Flows.fail (Strings.cat $ list [+ string "unbound variable: ",+ Core.unName $ var "name",+ string ". Variables: {",+ Strings.intercalate (string ", ") (Lists.map (unaryFunction $ Core.unName) $ Maps.keys $ Typing.typeContextTypes $ var "tx"),+ string "}"]) $+ "t" <<~ optCases (var "rawType")+ (var "failMsg")+ ("t" ~> Logic.ifElse (Lists.null $ var "typeArgs")+ (Schemas.instantiateType @@ var "t")+ (Flows.pure $ var "t")) $+ applyTypeArgumentsToType @@ var "tx" @@ var "typeArgs" @@ var "t"++typeOfWrappedTerm :: TBinding (TypeContext -> [Type] -> WrappedTerm -> Flow s Type)+typeOfWrappedTerm = define "typeOfWrappedTerm" $+ doc "Reconstruct the type of a wrapped term" $+ "tx" ~> "typeArgs" ~> "wt" ~>+ "tname" <~ Core.wrappedTermTypeName (var "wt") $++ -- The following is only for checking, not for reconstruction+ "body" <~ Core.wrappedTermBody (var "wt") $+ "btype" <<~ typeOf @@ var "tx" @@ noTypeArgs @@ var "body" $+ exec (checkTypeVariables @@ var "tx" @@ var "btype") $++ produce $ Schemas.nominalApplication @@ var "tname" @@ var "typeArgs"++normalizeTypeFreeVars :: TBinding (Type -> Type)+normalizeTypeFreeVars = define "normalizeTypeFreeVars" $+ doc "Normalize free type variables in a type to canonical names based on order of first occurrence. This allows comparing types that differ only in the naming of free type variables." $+ "typ" ~>+ "collectVars" <~ ("acc" ~> "t" ~>+ cases _Type (var "t")+ (Just $ var "acc") [+ _Type_variable>>: "v" ~>+ Logic.ifElse (Maps.member (var "v") (var "acc"))+ (var "acc")+ (Maps.insert (var "v") (Core.name $ Strings.cat2 (string "_tv") (Literals.showInt32 $ Maps.size $ var "acc")) (var "acc"))]) $+ "subst" <~ Rewriting.foldOverType @@ Coders.traversalOrderPre @@ var "collectVars" @@ Maps.empty @@ var "typ" $+ Rewriting.substituteTypeVariables @@ var "subst" @@ var "typ"++typesAllEffectivelyEqual :: TBinding (TypeContext -> [Type] -> Bool)+typesAllEffectivelyEqual = define "typesAllEffectivelyEqual" $+ doc ("Check whether a list of types are effectively equal, disregarding type aliases and free type variable naming."+ <> " Also treats free type variables (not in schema) as wildcards, since inference has already verified consistency.") $+ "tx" ~> "tlist" ~>+ "types" <~ Typing.inferenceContextSchemaTypes (Typing.typeContextInferenceContext $ var "tx") $+ "containsFreeVar" <~ ("t" ~>+ "allVars" <~ Rewriting.freeVariablesInTypeSimple @@ var "t" $+ "schemaNames" <~ Sets.fromList (Maps.keys $ var "types") $+ Logic.not $ Sets.null $ Sets.difference (var "allVars") (var "schemaNames")) $+ "anyContainsFreeVar" <~ Lists.foldl ("acc" ~> "t" ~> Logic.or (var "acc") (var "containsFreeVar" @@ var "t")) false (var "tlist") $+ Logic.ifElse (var "anyContainsFreeVar")+ true+ (Logic.ifElse (allEqual @@ (Lists.map ("t" ~> normalizeTypeFreeVars @@ var "t") (var "tlist")))+ true+ (allEqual @@ (Lists.map ("t" ~> normalizeTypeFreeVars @@ (Rewriting.deannotateTypeRecursive @@ (Rewriting.replaceTypedefs @@ var "types" @@ var "t"))) (var "tlist"))))++-- | Check if a type contains any type variable that's in scope (from typeContextTypeVariables)+containsInScopeTypeVars :: TBinding (TypeContext -> Type -> Bool)+containsInScopeTypeVars = define "containsInScopeTypeVars" $+ doc "Check if a type contains any type variable from the current scope" $+ "tx" ~> "t" ~>+ "vars" <~ Typing.typeContextTypeVariables (var "tx") $+ "freeVars" <~ Rewriting.freeVariablesInTypeSimple @@ var "t" $+ Logic.not $ Sets.null $ Sets.intersection (var "vars") (var "freeVars")++typesEffectivelyEqual :: TBinding (TypeContext -> Type -> Type -> Bool)+typesEffectivelyEqual = define "typesEffectivelyEqual" $+ doc "Check whether two types are effectively equal, disregarding type aliases, forall quantifiers, and treating in-scope type variables as wildcards" $+ "tx" ~> "t1" ~> "t2" ~>+ -- If either type contains in-scope type variables, treat them as matching+ -- This handles the case where fresh type variables from instantiation haven't been substituted+ Logic.or (containsInScopeTypeVars @@ var "tx" @@ var "t1") $+ Logic.or (containsInScopeTypeVars @@ var "tx" @@ var "t2") $+ typesAllEffectivelyEqual @@ var "tx" @@ list [+ Schemas.fullyStripAndNormalizeType @@ var "t1",+ Schemas.fullyStripAndNormalizeType @@ var "t2"]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/CodeGeneration.hs view
@@ -0,0 +1,542 @@+-- | DSL source module for the pure code generation pipeline.+-- Promotes the pure core of Hydra.Generation into a kernel module+-- that gets generated to all target languages (Haskell, Java, Python).+-- Issue #225: Minimize Generation.hs++module Hydra.Sources.Kernel.Terms.CodeGeneration where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ buildSchemaMap, decodeModuleFromJson,+ escapeControlCharsInJson, formatPrimitive, formatTermBinding, formatTypeBinding,+ generateCoderModules, generateLexicon, generateSourceFiles,+ inferAndGenerateLexicon, inferModules,+ moduleToJson, moduleToSourceModule, modulesToGraph,+ moduleTermDepsTransitive, moduleTypeDepsTransitive,+ namespaceToPath, stripModuleTypeSchemes, transitiveDeps)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Json.Model as JsonModel+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++-- Dependencies on other term modules+import qualified Hydra.Sources.Json.Decode as JsonDecode+import qualified Hydra.Sources.Kernel.Terms.Adapt.Simple as AdaptSimple+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore++-- Dependencies on secondary generated modules (decode/encode)+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Decode.Module as DecodeModule+import qualified Hydra.Sources.Encode.Module as EncodeModule+++ns :: Namespace+ns = Namespace "hydra.codeGeneration"++module_ :: Module+module_ = Module ns elements+ [AdaptSimple.ns, Annotations.ns, Inference.ns, JsonDecode.ns, Lexical.ns, Monads.ns, Names.ns,+ Rewriting.ns, Schemas.ns, ShowCore.ns,+ Namespace "hydra.decoding", Namespace "hydra.encoding",+ Namespace "hydra.json.decode", Namespace "hydra.json.encode", Namespace "hydra.json.writer",+ moduleNamespace DecodeCore.module_, moduleNamespace DecodeModule.module_, moduleNamespace EncodeModule.module_]+ kernelTypesNamespaces $+ Just "Pure code generation pipeline for bootstrapping Hydra across languages."+ where+ elements = [+ toBinding namespaceToPath,+ toBinding stripModuleTypeSchemes,+ toBinding transitiveDeps,+ toBinding moduleTermDepsTransitive,+ toBinding moduleTypeDepsTransitive,+ toBinding modulesToGraph,+ toBinding generateSourceFiles,+ toBinding formatTermBinding,+ toBinding formatPrimitive,+ toBinding formatTypeBinding,+ toBinding buildSchemaMap,+ toBinding moduleToSourceModule,+ toBinding generateLexicon,+ toBinding moduleToJson,+ toBinding inferModules,+ toBinding generateCoderModules,+ toBinding inferAndGenerateLexicon,+ toBinding escapeControlCharsInJson,+ toBinding decodeModuleFromJson]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_+++-- | Convert a namespace to a file path (e.g., "hydra.core" -> "hydra/core").+namespaceToPath :: TBinding (Namespace -> String)+namespaceToPath = define "namespaceToPath" $+ doc "Convert a namespace to a file path (e.g., hydra.core -> hydra/core)" $+ "ns" ~>+ Strings.intercalate (string "/") (Strings.splitOn (string ".") (Module.unNamespace $ var "ns"))++-- | Strip TypeSchemes from term bindings in a module, preserving type binding TypeSchemes.+stripModuleTypeSchemes :: TBinding (Module -> Module)+stripModuleTypeSchemes = define "stripModuleTypeSchemes" $+ doc ("Strip TypeSchemes from term bindings in a module, preserving type binding TypeSchemes."+ <> " JSON-loaded modules carry inferred TypeSchemes from the original compilation."+ <> " After adaptation (e.g., bigfloat -> float64), these TypeSchemes become stale"+ <> " and can cause inference errors. Stripping them allows the inference engine"+ <> " to reconstruct correct TypeSchemes from scratch.") $+ "m" ~>+ "stripIfTerm" <~ ("b" ~> Logic.ifElse (Annotations.isNativeType @@ var "b")+ (var "b")+ (Core.binding+ (Core.bindingName $ var "b")+ (Core.bindingTerm $ var "b")+ nothing)) $+ Module.module_+ (Module.moduleNamespace $ var "m")+ (Lists.map (var "stripIfTerm") (Module.moduleElements $ var "m"))+ (Module.moduleTermDependencies $ var "m")+ (Module.moduleTypeDependencies $ var "m")+ (Module.moduleDescription $ var "m")++-- | Compute transitive closure of dependencies.+-- Given a function that extracts dependency namespaces from a module,+-- a namespace-to-module map, and starting modules, returns the transitive closure+-- of all reachable namespaces (excluding self-references from start modules).+transitiveDeps :: TBinding ((Module -> [Namespace]) -> M.Map Namespace Module -> [Module] -> S.Set Namespace)+transitiveDeps = define "transitiveDeps" $+ doc "Compute transitive closure of module dependencies" $+ "getDeps" ~> "nsMap" ~> "startMods" ~>+ -- Start with dependencies of start modules, excluding self-references+ "initialDeps" <~ Sets.fromList (Lists.concat (Lists.map+ ("m" ~> Lists.filter+ ("dep" ~> Logic.not $ Equality.equal (var "dep") (Module.moduleNamespace $ var "m"))+ (var "getDeps" @@ var "m"))+ (var "startMods"))) $+ -- Iterative closure: go pending visited+ "go" <~ ("pending" ~> "visited" ~>+ Logic.ifElse (Sets.null $ var "pending")+ (var "visited")+ ("newVisited" <~ Sets.union (var "visited") (var "pending") $+ "nextDeps" <~ Sets.fromList (Lists.concat (Lists.map+ ("nsv" ~> optCases (Maps.lookup (var "nsv") (var "nsMap"))+ (TTerm (Terms.list []) :: TTerm [Namespace])+ ("depMod" ~> var "getDeps" @@ var "depMod"))+ (Sets.toList $ var "pending"))) $+ "newPending" <~ Sets.difference (var "nextDeps") (var "newVisited") $+ var "go" @@ var "newPending" @@ var "newVisited")) $+ var "go" @@ var "initialDeps" @@ (Sets.empty :: TTerm (S.Set Namespace))++-- | Compute the transitive closure of term dependencies for a set of modules.+-- Returns the modules that are transitively depended upon (including the input modules).+moduleTermDepsTransitive :: TBinding (M.Map Namespace Module -> [Module] -> [Module])+moduleTermDepsTransitive = define "moduleTermDepsTransitive" $+ doc "Compute transitive closure of term dependencies for a set of modules" $+ "nsMap" ~> "modules" ~>+ "closure" <~ Sets.union+ (transitiveDeps @@ ("m" ~> Module.moduleTermDependencies (var "m")) @@ var "nsMap" @@ var "modules")+ (Sets.fromList $ Lists.map ("m" ~> Module.moduleNamespace (var "m")) (var "modules")) $+ Maybes.cat $ Lists.map+ ("n" ~> Maps.lookup (var "n") (var "nsMap"))+ (Sets.toList $ var "closure")++-- | Compute the transitive closure of type dependencies for a set of modules.+-- First computes transitive term deps, then type deps from those.+moduleTypeDepsTransitive :: TBinding (M.Map Namespace Module -> [Module] -> [Module])+moduleTypeDepsTransitive = define "moduleTypeDepsTransitive" $+ doc "Compute transitive closure of type dependencies for a set of modules" $+ "nsMap" ~> "modules" ~>+ "termMods" <~ moduleTermDepsTransitive @@ var "nsMap" @@ var "modules" $+ "typeNamespaces" <~ Sets.toList (transitiveDeps @@ ("m" ~> Module.moduleTypeDependencies (var "m")) @@ var "nsMap" @@ var "termMods") $+ Maybes.cat $ Lists.map+ ("n" ~> Maps.lookup (var "n") (var "nsMap"))+ (var "typeNamespaces")++-- | Build a graph from a list of modules, using an explicit bootstrap graph.+-- Elements are partitioned into schema (type definitions) and data (term definitions)+-- based on the isNativeType predicate.+modulesToGraph :: TBinding (Graph -> [Module] -> [Module] -> Graph)+modulesToGraph = define "modulesToGraph" $+ doc "Build a graph from universe modules and working modules, using an explicit bootstrap graph" $+ "bsGraph" ~> "universeModules" ~> "modules" ~>+ "universe" <~ Maps.fromList (Lists.map+ ("m" ~> pair (Module.moduleNamespace $ var "m") (var "m"))+ (Lists.concat2 (var "universeModules") (var "modules"))) $+ "schemaModules" <~ moduleTypeDepsTransitive @@ var "universe" @@ var "modules" $+ "dataModules" <~ moduleTermDepsTransitive @@ var "universe" @@ var "modules" $+ -- Include type elements from both transitive type dependencies AND the input modules themselves+ "schemaElements" <~ Lists.filter ("e" ~> Annotations.isNativeType @@ var "e")+ (Lists.concat $ Lists.map ("m" ~> Module.moduleElements (var "m"))+ (Lists.concat2 (var "schemaModules") (var "modules"))) $+ "dataElements" <~ Lists.filter ("e" ~> Logic.not $ Annotations.isNativeType @@ var "e")+ (Lists.concat $ Lists.map ("m" ~> Module.moduleElements (var "m")) (var "dataModules")) $+ "schemaGraph" <~ Lexical.elementsToGraph @@ var "bsGraph" @@ nothing @@ var "schemaElements" $+ Lexical.elementsToGraph @@ var "bsGraph" @@ (just $ var "schemaGraph") @@ var "dataElements"++-- | Pure core of code generation: given a coder, language, flags, bootstrap graph, universe,+-- and modules to generate, produce a list of (filePath, content) pairs.+-- This function contains no I/O and can be generated to other languages.+generateSourceFiles+ :: TBinding ((Module -> [Definition] -> Flow Graph (M.Map String String))+ -> Language+ -> Bool -> Bool -> Bool -> Bool+ -> Graph -> [Module] -> [Module]+ -> Flow Graph [(String, String)])+generateSourceFiles = define "generateSourceFiles" $+ doc ("Pure core of code generation: given a coder, language, flags, bootstrap graph, universe,"+ <> " and modules to generate, produce a list of (filePath, content) pairs.") $+ "printDefinitions" ~> "lang" ~>+ "doInfer" ~> "doExpand" ~> "doHoistCaseStatements" ~> "doHoistPolymorphicLetBindings" ~>+ "bsGraph" ~> "universeModules" ~> "modsToGenerate" ~>++ "namespaceMap" <~ Maps.fromList (Lists.map+ ("m" ~> pair (Module.moduleNamespace $ var "m") (var "m"))+ (Lists.concat2 (var "universeModules") (var "modsToGenerate"))) $++ "constraints" <~ Coders.languageConstraintsProjection (var "lang") $++ -- Partition modules into type and term modules+ "isTypeModule" <~ ("mod" ~> Logic.not $ Lists.null $+ Lists.filter ("e" ~> Annotations.isNativeType @@ var "e") (Module.moduleElements $ var "mod")) $+ "partitioned" <~ Lists.partition (var "isTypeModule") (var "modsToGenerate") $+ "typeModulesToGenerate" <~ Pairs.first (var "partitioned") $+ "termModulesToGenerate" <~ Pairs.second (var "partitioned") $++ -- Compute transitive deps and build graphs+ "schemaMods" <~ moduleTypeDepsTransitive @@ var "namespaceMap" @@ var "modsToGenerate" $+ "schemaElements" <~ Lists.filter ("e" ~> Annotations.isNativeType @@ var "e")+ (Lists.concat $ Lists.map ("m" ~> Module.moduleElements (var "m"))+ (Lists.concat2 (var "schemaMods") (var "typeModulesToGenerate"))) $+ "dataMods" <~ moduleTermDepsTransitive @@ var "namespaceMap" @@ var "modsToGenerate" $+ "dataElements" <~ Lists.concat (Lists.map ("m" ~> Module.moduleElements (var "m")) (var "dataMods")) $+ "schemaGraph" <~ Lexical.elementsToGraph @@ var "bsGraph" @@ nothing @@ var "schemaElements" $+ "dataGraph" <~ Lexical.elementsToGraph @@ var "bsGraph" @@ (just $ var "schemaGraph") @@ var "dataElements" $++ -- Generate type modules+ "schemaFiles" <<~ Logic.ifElse (Lists.null $ var "typeModulesToGenerate")+ (Flows.pure (TTerm (Terms.list []) :: TTerm [(String, String)]))+ (trace (string "generate type modules") $+ "nameLists" <~ Lists.map+ ("m" ~> Lists.map ("e" ~> Core.bindingName $ var "e")+ (Lists.filter ("e" ~> Annotations.isNativeType @@ var "e") (Module.moduleElements $ var "m")))+ (var "typeModulesToGenerate") $+ "schemaResult" <<~ AdaptSimple.schemaGraphToDefinitions @@ var "constraints" @@ var "schemaGraph" @@ var "nameLists" $+ "defLists" <~ Pairs.second (var "schemaResult") $+ Monads.withState @@ var "schemaGraph" @@+ (Flows.map ("xs" ~> Lists.concat (var "xs")) $+ Flows.mapList ("p" ~>+ "mod" <~ Pairs.first (var "p") $+ "defs" <~ Pairs.second (var "p") $+ trace (Strings.cat2 (string "type module ") (Module.unNamespace $ Module.moduleNamespace $ var "mod")) $+ Flows.map ("m" ~> Maps.toList (var "m")) $+ var "printDefinitions" @@ var "mod" @@ Lists.map ("d" ~> Module.definitionType (var "d")) (var "defs"))+ (Lists.zip (var "typeModulesToGenerate") (var "defLists")))) $++ -- Generate term modules+ "termFiles" <<~ Logic.ifElse (Lists.null $ var "termModulesToGenerate")+ (Flows.pure (TTerm (Terms.list []) :: TTerm [(String, String)]))+ (trace (string "generate term modules") $+ "namespaces" <~ Lists.map ("m" ~> Module.moduleNamespace (var "m")) (var "termModulesToGenerate") $+ "dataResult" <<~ AdaptSimple.dataGraphToDefinitions+ @@ var "constraints"+ @@ var "doInfer" @@ var "doExpand" @@ var "doHoistCaseStatements" @@ var "doHoistPolymorphicLetBindings"+ @@ var "dataGraph" @@ var "namespaces" $+ "g1" <~ Pairs.first (var "dataResult") $+ "defLists" <~ Pairs.second (var "dataResult") $+ -- Refresh modules with elements from the inferred graph+ "refreshModule" <~ ("els" ~> "m" ~>+ Module.module_+ (Module.moduleNamespace $ var "m")+ (Maybes.cat $ Lists.map+ ("e" ~> Lists.find ("b" ~> Equality.equal (Core.bindingName $ var "b") (Core.bindingName $ var "e")) (var "els"))+ (Module.moduleElements $ var "m"))+ (Module.moduleTermDependencies $ var "m")+ (Module.moduleTypeDependencies $ var "m")+ (Module.moduleDescription $ var "m")) $+ "refreshedMods" <~ Lists.map ("m" ~> var "refreshModule" @@ (Graph.graphElements $ var "g1") @@ var "m") (var "termModulesToGenerate") $+ Monads.withState @@ var "g1" @@+ (Flows.map ("xs" ~> Lists.concat (var "xs")) $+ Flows.mapList ("p" ~>+ "mod" <~ Pairs.first (var "p") $+ "defs" <~ Pairs.second (var "p") $+ trace (Strings.cat2 (string "term module ") (Module.unNamespace $ Module.moduleNamespace $ var "mod")) $+ Flows.map ("m" ~> Maps.toList (var "m")) $+ var "printDefinitions" @@ var "mod" @@ Lists.map ("d" ~> Module.definitionTerm (var "d")) (var "defs"))+ (Lists.zip (var "refreshedMods") (var "defLists")))) $++ -- Combine results+ produce $ Lists.concat2 (var "schemaFiles") (var "termFiles")++-- | Format a term binding for the lexicon: " name : typeScheme"+formatTermBinding :: TBinding (Binding -> String)+formatTermBinding = define "formatTermBinding" $+ doc "Format a term binding for the lexicon" $+ "binding" ~>+ "name" <~ Core.unName (Core.bindingName $ var "binding") $+ "typeStr" <~ optCases (Core.bindingType $ var "binding")+ (string "?")+ ("scheme" ~> ShowCore.typeScheme @@ var "scheme") $+ (string " ") ++ var "name" ++ (string " : ") ++ var "typeStr"++-- | Format a primitive for the lexicon: " name : typeScheme"+formatPrimitive :: TBinding (Primitive -> String)+formatPrimitive = define "formatPrimitive" $+ doc "Format a primitive for the lexicon" $+ "prim" ~>+ "name" <~ Core.unName (Graph.primitiveName $ var "prim") $+ "typeStr" <~ ShowCore.typeScheme @@ (Graph.primitiveType $ var "prim") $+ (string " ") ++ var "name" ++ (string " : ") ++ var "typeStr"++-- | Format a type binding for the lexicon: " name = type"+formatTypeBinding :: TBinding (Binding -> Flow Graph String)+formatTypeBinding = define "formatTypeBinding" $+ doc "Format a type binding for the lexicon" $+ "binding" ~>+ "g" <<~ Monads.getState $+ "typ" <<~ Monads.eitherToFlow_ @@ Util.unDecodingError+ @@ (decoderFor _Type @@ var "g" @@ (Core.bindingTerm $ var "binding")) $+ produce $+ (string " ") ++ Core.unName (Core.bindingName $ var "binding") ++ (string " = ") ++ (ShowCore.type_ @@ var "typ")++-- | Build a schema map (Name -> Type) from a graph's schema.+-- Used by the JSON decoder to resolve type variables.+buildSchemaMap :: TBinding (Graph -> M.Map Name Type)+buildSchemaMap = define "buildSchemaMap" $+ doc "Build a schema map (Name -> Type) from a graph's schema" $+ "g" ~>+ optCases (Graph.graphSchema $ var "g")+ (Maps.empty :: TTerm (M.Map Name Type))+ ("schemaGraph" ~>+ Maps.fromList $ Maybes.cat $ Lists.map+ ("binding" ~>+ "result" <~ decoderFor _Type @@ var "schemaGraph" @@ (Core.bindingTerm $ var "binding") $+ Eithers.either_+ ("_err" ~> (nothing :: TTerm (Maybe (Name, Type))))+ ("typ" ~> just $ pair (Core.bindingName $ var "binding") (Rewriting.deannotateType @@ var "typ"))+ (var "result"))+ (Graph.graphElements $ var "schemaGraph"))++-- | Convert a generated Module into a Source module.+-- The Source module contains a single binding `module_` which holds the Module encoded as a Term.+-- The namespace transforms e.g. "hydra.encode.util" to "hydra.sources.encode.util"+moduleToSourceModule :: TBinding (Module -> Module)+moduleToSourceModule = define "moduleToSourceModule" $+ doc "Convert a generated Module into a Source module" $+ "m" ~>+ -- Transform namespace: hydra.encode.util -> hydra.sources.encode.util+ "sourceNs" <~ wrap _Namespace (+ (string "hydra.sources.") ++ Strings.intercalate (string ".")+ (Lists.drop (int32 1) (Strings.splitOn (string ".") (Module.unNamespace $ Module.moduleNamespace $ var "m")))) $+ -- The module type namespace+ "modTypeNs" <~ (wrap _Namespace (string "hydra.module") :: TTerm Namespace) $+ -- Create binding: module_ = <encoded Module term>+ "moduleBinding" <~ Core.binding+ (wrap _Name (Module.unNamespace (var "sourceNs") ++ (string ".module_")))+ (encoderFor _Module @@ var "m")+ nothing $+ Module.module_+ (var "sourceNs")+ (list [var "moduleBinding"])+ (list [var "modTypeNs"])+ (list [var "modTypeNs"])+ (just $ (string "Source module for ") ++ Module.unNamespace (Module.moduleNamespace $ var "m"))++-- | Generate the lexicon content from a graph.+-- Lists all primitives, types, and terms with their types.+generateLexicon :: TBinding (Graph -> Flow Graph String)+generateLexicon = define "generateLexicon" $+ doc "Generate the lexicon content from a graph" $+ "graph" ~>+ "bindings" <~ Graph.graphElements (var "graph") $+ "primitives" <~ Maps.elems (Graph.graphPrimitives $ var "graph") $+ "partitioned" <~ Lists.partition ("b" ~> Annotations.isNativeType @@ var "b") (var "bindings") $+ "typeBindings" <~ Pairs.first (var "partitioned") $+ "termBindings" <~ Pairs.second (var "partitioned") $+ "sortedPrimitives" <~ Lists.sortOn ("p" ~> Graph.primitiveName (var "p")) (var "primitives") $+ "sortedTypes" <~ Lists.sortOn ("b" ~> Core.bindingName (var "b")) (var "typeBindings") $+ "sortedTerms" <~ Lists.sortOn ("b" ~> Core.bindingName (var "b")) (var "termBindings") $+ "typeLines" <<~ Flows.mapList ("b" ~> formatTypeBinding @@ var "b") (var "sortedTypes") $+ "termLines" <~ Lists.map ("b" ~> formatTermBinding @@ var "b") (var "sortedTerms") $+ "primitiveLines" <~ Lists.map ("p" ~> formatPrimitive @@ var "p") (var "sortedPrimitives") $+ produce $+ (string "Primitives:\n") ++ Strings.unlines (var "primitiveLines")+ ++ (string "\nTypes:\n") ++ Strings.unlines (var "typeLines")+ ++ (string "\nTerms:\n") ++ Strings.unlines (var "termLines")++-- | Convert a Module to a JSON string.+-- Encodes the Module as a Term, converts to JSON, then serializes to a string.+moduleToJson :: TBinding (Module -> Either String String)+moduleToJson = define "moduleToJson" $+ doc "Convert a Module to a JSON string" $+ "m" ~>+ "term" <~ encoderFor _Module @@ var "m" $+ Eithers.map ("json" ~> var "hydra.json.writer.printJson" @@ var "json")+ (var "hydra.json.encode.toJson" @@ var "term")++-- | Perform type inference on a set of modules and reconstruct the target modules+-- with inferred types. Type-only modules (containing only native type definitions)+-- are passed through unchanged.+inferModules :: TBinding (Graph -> [Module] -> [Module] -> Flow Graph [Module])+inferModules = define "inferModules" $+ doc "Perform type inference on modules and reconstruct with inferred types" $+ "bsGraph" ~> "universeMods" ~> "targetMods" ~>+ "g0" <~ modulesToGraph @@ var "bsGraph" @@ var "universeMods" @@ var "universeMods" $+ "g1" <<~ Inference.inferGraphTypes @@ var "g0" $+ "inferredElements" <~ Graph.graphElements (var "g1") $+ "isTypeModule" <~ ("mod" ~> Lists.null $+ Lists.filter ("e" ~> Logic.not $ Annotations.isNativeType @@ var "e")+ (Module.moduleElements $ var "mod")) $+ "refreshModule" <~ ("m" ~>+ Logic.ifElse (var "isTypeModule" @@ var "m")+ (var "m")+ (Module.module_+ (Module.moduleNamespace $ var "m")+ (Maybes.cat $ Lists.map+ ("e" ~> Lists.find ("b" ~> Equality.equal (Core.bindingName $ var "b") (Core.bindingName $ var "e"))+ (var "inferredElements"))+ (Module.moduleElements $ var "m"))+ (Module.moduleTermDependencies $ var "m")+ (Module.moduleTypeDependencies $ var "m")+ (Module.moduleDescription $ var "m"))) $+ produce $ Lists.map (var "refreshModule") (var "targetMods")++-- | Generate encoder or decoder modules for a list of type modules.+-- Takes a codec function, bootstrap graph, universe modules, and type modules.+-- Returns the generated coder modules (Nothing results are filtered out).+generateCoderModules+ :: TBinding ((Module -> Flow Graph (Maybe Module)) -> Graph -> [Module] -> [Module]+ -> Flow Graph [Module])+generateCoderModules = define "generateCoderModules" $+ doc "Generate encoder or decoder modules for a list of type modules" $+ "codec" ~> "bsGraph" ~> "universeModules" ~> "typeModules" ~>+ "graph" <~ modulesToGraph @@ var "bsGraph" @@ var "universeModules" @@ var "universeModules" $+ optCases (Graph.graphSchema $ var "graph")+ (Flows.fail $ string "No schema graph available")+ ("schemaGraph" ~>+ Monads.withState @@ var "schemaGraph" @@+ (Flows.map ("results" ~> Maybes.cat (var "results")) $+ Flows.mapList (var "codec") (var "typeModules")))++-- | Perform type inference on a graph and generate its lexicon.+-- Composes inferGraphTypes and generateLexicon into a single Flow.+inferAndGenerateLexicon :: TBinding (Graph -> [Module] -> Flow Graph String)+inferAndGenerateLexicon = define "inferAndGenerateLexicon" $+ doc "Perform type inference and generate the lexicon for a set of modules" $+ "bsGraph" ~> "kernelModules" ~>+ "g0" <~ modulesToGraph @@ var "bsGraph" @@ var "kernelModules" @@ var "kernelModules" $+ "g1" <<~ Inference.inferGraphTypes @@ var "g0" $+ Monads.withState @@ var "g1" @@ (generateLexicon @@ var "g1")++-- | Escape unescaped control characters (< 0x20) inside JSON string literals.+-- Operates on a list of int32 character codes (bytes).+-- Walks through the list tracking whether we're inside a string and+-- replaces raw control chars with \\uXXXX escape sequences.+escapeControlCharsInJson :: TBinding ([Int] -> [Int])+escapeControlCharsInJson = define "escapeControlCharsInJson" $+ doc "Escape unescaped control characters inside JSON string literals" $+ "input" ~>+ "hexDigit" <~ ("n" ~>+ Logic.ifElse (Equality.lt (var "n") (int32 10))+ (Math.add (int32 0x30) (var "n")) -- '0' + n+ (Math.add (int32 0x61) (Math.sub (var "n") (int32 10)))) $ -- 'a' + (n - 10)+ "escapeToUnicode" <~ ("b" ~>+ list [int32 0x5C, int32 0x75, int32 0x30, int32 0x30,+ var "hexDigit" @@ Math.div (var "b") (int32 16),+ var "hexDigit" @@ Math.mod (var "b") (int32 16)]) $+ -- go :: Bool -> Bool -> [Int32] -> [Int32]+ "go" <~ ("inStr" ~> "esc" ~> "bytes" ~>+ Logic.ifElse (Lists.null $ var "bytes")+ (TTerm (Terms.list []) :: TTerm [Int])+ ("b" <~ Lists.head (var "bytes") $+ "bs" <~ Lists.tail (var "bytes") $+ Logic.ifElse (var "esc")+ -- after backslash, pass through next byte+ (Lists.cons (var "b") (var "go" @@ var "inStr" @@ boolean False @@ var "bs"))+ (Logic.ifElse (Logic.and (Equality.equal (var "b") (int32 0x5C)) (var "inStr"))+ -- backslash inside string+ (Lists.cons (var "b") (var "go" @@ var "inStr" @@ boolean True @@ var "bs"))+ (Logic.ifElse (Equality.equal (var "b") (int32 0x22))+ -- quote toggles string mode+ (Lists.cons (var "b") (var "go" @@ (Logic.not $ var "inStr") @@ boolean False @@ var "bs"))+ (Logic.ifElse (Logic.and (var "inStr") (Equality.lt (var "b") (int32 0x20)))+ -- control char: replace with \uXXXX+ (Lists.concat2 (var "escapeToUnicode" @@ var "b") (var "go" @@ var "inStr" @@ boolean False @@ var "bs"))+ -- normal byte+ (Lists.cons (var "b") (var "go" @@ var "inStr" @@ boolean False @@ var "bs"))))))) $+ var "go" @@ boolean False @@ boolean False @@ var "input"++-- | Decode a single module from a JSON value.+-- Given a bootstrap graph, universe modules, whether to strip TypeSchemes,+-- and a JSON value, decodes it to a Module.+-- This is the pure core of the JSON module loading pipeline.+decodeModuleFromJson :: TBinding (Graph -> [Module] -> Bool -> JsonModel.Value -> Either String Module)+decodeModuleFromJson = define "decodeModuleFromJson" $+ doc "Decode a single module from a JSON value" $+ "bsGraph" ~> "universeModules" ~> "doStripTypeSchemes" ~> "jsonVal" ~>+ "graph" <~ modulesToGraph @@ var "bsGraph" @@ var "universeModules" @@ var "universeModules" $+ "schemaMap" <~ buildSchemaMap @@ var "graph" $+ "modType" <~ Core.typeVariable (wrap _Name (string "hydra.module.Module")) $+ -- Step 1: JSON -> Term+ Eithers.either_+ ("err" ~> left (var "err"))+ ("term" ~>+ -- Step 2: Term -> Module (via decoderFor _Module)+ Eithers.either_+ ("decErr" ~> left (Util.unDecodingError @@ var "decErr"))+ ("mod" ~> right (Logic.ifElse (var "doStripTypeSchemes")+ (stripModuleTypeSchemes @@ var "mod")+ (var "mod")))+ (decoderFor _Module @@ var "graph" @@ var "term"))+ (JsonDecode.fromJson @@ var "schemaMap" @@ var "modType" @@ var "jsonVal")
src/main/haskell/Hydra/Sources/Kernel/Terms/Constants.hs view
@@ -1,110 +1,153 @@ module Hydra.Sources.Kernel.Terms.Constants where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ debugInference, ignoredVariable, key_classes, key_debugId, key_deprecated, key_description,+ key_exclude, key_firstClassType, key_maxLength, key_minLength, key_preserveFieldName,+ key_type, key_freshTypeVariableCount, maxInt32, placeholderName, maxTraceDepth,+ warningAutoGeneratedFile) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.constants"+ module_ :: Module-module_ = Module (Namespace "hydra.constants") elements+module_ = Module ns elements []- kernelTypesModules $+ kernelTypesNamespaces $ Just ("A module for tier-0 constants.") where elements = [- el ignoredVariableDef,- el key_classesDef,- el key_debugIdDef,- el key_deprecatedDef,- el key_descriptionDef,- el key_excludeDef,- el key_firstClassTypeDef,- el key_maxLengthDef,- el key_minLengthDef,- el key_preserveFieldNameDef,- el key_typeDef,- el maxInt32Def,- el placeholderNameDef,- el maxTraceDepthDef,- el warningAutoGeneratedFileDef]+-- toBinding tryMe,+ toBinding debugInference,+ toBinding ignoredVariable,+ toBinding key_classes,+ toBinding key_debugId,+ toBinding key_deprecated,+ toBinding key_description,+ toBinding key_exclude,+ toBinding key_firstClassType,+ toBinding key_maxLength,+ toBinding key_minLength,+ toBinding key_preserveFieldName,+ toBinding key_type,+ toBinding key_freshTypeVariableCount,+ toBinding maxInt32,+ toBinding placeholderName,+ toBinding maxTraceDepth,+ toBinding warningAutoGeneratedFile] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -annotationKeyDef :: String -> Maybe String -> TBinding Name-annotationKeyDef name mdesc = define ("key_" <> name) $ case mdesc of+defineAnnotationKey :: String -> Maybe String -> TBinding Name+defineAnnotationKey name mdesc = define ("key_" <> name) $ case mdesc of Nothing -> def Just comment -> doc comment def where def = wrap _Name $ string name -ignoredVariableDef :: TBinding String-ignoredVariableDef = define "ignoredVariable" $+-- ++-- An extra definition, normally commented out, for debugging+tryMe = define "tryMe" $+ left $ string "foo"+-- Core.termPair $ pair Core.termUnit Core.termUnit+-- Core.termPair $ pair Core.termUnit Core.termUnit+-- pair Core.termUnit Core.termUnit+-- Core.termProduct $ list [Core.termUnit, Core.termUnit]++debugInference :: TBinding Bool+debugInference = define "debugInference" $+ doc "Disable type checking by default, for better performance" $+ true+ +ignoredVariable :: TBinding String+ignoredVariable = define "ignoredVariable" $+ doc "The name used for ignored variables" $ string "_" -key_classesDef = annotationKeyDef "classes" Nothing-key_debugIdDef = annotationKeyDef "debugId" Nothing-key_deprecatedDef = annotationKeyDef "deprecated" Nothing-key_descriptionDef = annotationKeyDef "description" Nothing-key_excludeDef = annotationKeyDef "exclude" Nothing-key_firstClassTypeDef = annotationKeyDef "firstClassType"- $ Just "A flag which tells the language coders to encode a given encoded type as a term rather than a native type"-key_maxLengthDef = annotationKeyDef "maxLength" Nothing-key_minLengthDef = annotationKeyDef "minLength" Nothing-key_preserveFieldNameDef = annotationKeyDef "preserveFieldName" Nothing-key_typeDef = annotationKeyDef "type" Nothing+key_classes = defineAnnotationKey "classes" $ Just "Annotation key for type classes"+key_debugId = defineAnnotationKey "debugId" $ Just "Annotation key for debug identifiers"+key_deprecated = defineAnnotationKey "deprecated" $ Just "Annotation key for deprecated markers"+key_description = defineAnnotationKey "description" $ Just "Annotation key for descriptions"+key_exclude = defineAnnotationKey "exclude" $ Just "Annotation key for exclusions"+key_firstClassType = defineAnnotationKey "firstClassType" $+ Just "A flag which tells the language coders to encode a given encoded type as a term rather than a native type"+key_maxLength = defineAnnotationKey "maxLength" $ Just "Annotation key for maximum length constraints"+key_minLength = defineAnnotationKey "minLength" $ Just "Annotation key for minimum length constraints"+key_preserveFieldName = defineAnnotationKey "preserveFieldName" $ Just "Annotation key for preserving field names during code generation"+key_type = defineAnnotationKey "type" $ Just "Annotation key for type information"+key_freshTypeVariableCount = defineAnnotationKey "freshTypeVariableCount" $+ Just "A counter for generating fresh type variable names" -maxInt32Def :: TBinding Int-maxInt32Def = define "maxInt32" $+maxInt32 :: TBinding Int+maxInt32 = define "maxInt32" $ doc "The maximum value of a 32-bit integer" $- int32 maxBound+ int32 2147483647 -- 2^31 - 1 -placeholderNameDef :: TBinding Name-placeholderNameDef = define "placeholderName" $+placeholderName :: TBinding Name+placeholderName = define "placeholderName" $ doc "A placeholder name for row types as they are being constructed" $ wrap _Name $ string "Placeholder" -maxTraceDepthDef :: TBinding Int-maxTraceDepthDef = define "maxTraceDepth" $+maxTraceDepth :: TBinding Int+maxTraceDepth = define "maxTraceDepth" $ doc ("A maximum depth for nested flows." <> " Currently, this is set very high because deep flows are common in type inference over the Hydra kernel.") $- int32 4000+ int32 5000 -warningAutoGeneratedFileDef :: TBinding String-warningAutoGeneratedFileDef = define "warningAutoGeneratedFile" $+warningAutoGeneratedFile :: TBinding String+warningAutoGeneratedFile = define "warningAutoGeneratedFile" $+ doc "A standard warning message for auto-generated files" $ string "Note: this is an automatically generated file. Do not edit."
− src/main/haskell/Hydra/Sources/Kernel/Terms/Decode/Core.hs
@@ -1,238 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Decode.Core where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore---module_ :: Module-module_ = Module (Namespace "hydra.decode.core") elements- [ExtractCore.module_, Monads.module_, Lexical.module_,- Rewriting.module_, ShowCore.module_]- kernelTypesModules $- Just ("Decode hydra.core types from the hydra.core.Term type")- where- elements = [- el applicationTypeDef,- el fieldTypeDef,- el fieldTypesDef,- el floatTypeDef,- el forallTypeDef,- el functionTypeDef,- el integerTypeDef,- el literalTypeDef,- el mapTypeDef,- el nameDef,- el rowTypeDef,- el stringDef,- el typeDef,- el typeSchemeDef,- el wrappedTypeDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--applicationTypeDef :: TBinding (Term -> Flow Graph ApplicationType)-applicationTypeDef = define "applicationType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "function">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _ApplicationType_function @@ ref typeDef,- "argument">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _ApplicationType_argument @@ ref typeDef] $- produce $ Core.applicationType (var "function") (var "argument"))--fieldTypeDef :: TBinding (Term -> Flow Graph FieldType)-fieldTypeDef = define "fieldType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "name">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _FieldType_name @@ ref nameDef,- "typ">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _FieldType_type @@ ref typeDef] $- produce $ Core.fieldType (var "name") (var "typ"))--fieldTypesDef :: TBinding (Term -> Flow Graph [FieldType])-fieldTypesDef = define "fieldTypes" $- lambda "term" $ lets [- "stripped">: ref Rewriting.deannotateAndDetypeTermDef @@ var "term"]- $ cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@ string "list" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_list>>: lambda "els" $ Flows.mapList (ref fieldTypeDef) (var "els")]--floatTypeDef :: TBinding (Term -> Flow Graph FloatType)-floatTypeDef = define "floatType" $- ref Lexical.matchEnumDef @@ Core.nameLift _FloatType @@ list [- pair (Core.nameLift _FloatType_bigfloat) Core.floatTypeBigfloat,- pair (Core.nameLift _FloatType_float32) Core.floatTypeFloat32,- pair (Core.nameLift _FloatType_float64) Core.floatTypeFloat64]--forallTypeDef :: TBinding (Term -> Flow Graph ForallType)-forallTypeDef = define "forallType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "parameter">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _ForallType_parameter @@ ref nameDef,- "body">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _ForallType_body @@ ref typeDef] $- produce $ Core.forallType (var "parameter") (var "body"))--functionTypeDef :: TBinding (Term -> Flow Graph FunctionType)-functionTypeDef = define "functionType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "domain">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _FunctionType_domain @@ ref typeDef,- "codomain">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _FunctionType_codomain @@ ref typeDef] $- produce $ Core.functionType (var "domain") (var "codomain"))--integerTypeDef :: TBinding (Term -> Flow Graph IntegerType)-integerTypeDef = define "integerType" $- ref Lexical.matchEnumDef @@ Core.nameLift _IntegerType @@ list [- pair (Core.nameLift _IntegerType_bigint) Core.integerTypeBigint,- pair (Core.nameLift _IntegerType_int8) Core.integerTypeInt8,- pair (Core.nameLift _IntegerType_int16) Core.integerTypeInt16,- pair (Core.nameLift _IntegerType_int32) Core.integerTypeInt32,- pair (Core.nameLift _IntegerType_int64) Core.integerTypeInt64,- pair (Core.nameLift _IntegerType_uint8) Core.integerTypeUint8,- pair (Core.nameLift _IntegerType_uint16) Core.integerTypeUint16,- pair (Core.nameLift _IntegerType_uint32) Core.integerTypeUint32,- pair (Core.nameLift _IntegerType_uint64) Core.integerTypeUint64]--literalTypeDef :: TBinding (Term -> Flow Graph LiteralType)-literalTypeDef = define "literalType" $- ref Lexical.matchUnionDef @@ Core.nameLift _LiteralType @@ list [- ref Lexical.matchUnitFieldDef @@ Core.nameLift _LiteralType_binary @@ Core.literalTypeBinary,- ref Lexical.matchUnitFieldDef @@ Core.nameLift _LiteralType_boolean @@ Core.literalTypeBoolean,- pair- (Core.nameLift _LiteralType_float)- (lambda "ft" $ Flows.map (unaryFunction Core.literalTypeFloat) (ref floatTypeDef @@ var "ft")),- pair- (Core.nameLift _LiteralType_integer)- (lambda "it" $ Flows.map (unaryFunction Core.literalTypeInteger) (ref integerTypeDef @@ var "it")),- ref Lexical.matchUnitFieldDef @@ Core.nameLift _LiteralType_string @@ Core.literalTypeString]--mapTypeDef :: TBinding (Term -> Flow Graph MapType)-mapTypeDef = define "mapType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "keys">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _MapType_keys @@ ref typeDef,- "values">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _MapType_values @@ ref typeDef] $- produce $ Core.mapType (var "keys") (var "values"))--nameDef :: TBinding (Term -> Flow Graph Name)-nameDef = define "name" $- lambda "term" $ Flows.map (unaryFunction Core.name) $- Flows.bind (ref ExtractCore.wrapDef @@ Core.nameLift _Name @@ var "term") $- ref ExtractCore.stringDef--rowTypeDef :: TBinding (Term -> Flow Graph RowType)-rowTypeDef = define "rowType" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "typeName">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _RowType_typeName @@ ref nameDef,- "fields">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _RowType_fields @@ ref fieldTypesDef] $- produce $ Core.rowType (var "typeName") (var "fields"))--stringDef :: TBinding (Term -> Flow Graph String)-stringDef = define "string" $- lambda "term" $ ref ExtractCore.stringDef @@ (ref Rewriting.deannotateAndDetypeTermDef @@ var "term")--typeDef :: TBinding (Term -> Flow Graph Type)-typeDef = define "type" $- lambda "dat" $ cases _Term (var "dat")- (Just $ ref Lexical.matchUnionDef @@ Core.nameLift _Type @@ list [- pair- (Core.nameLift _Type_application)- (lambda "at" $ Flows.map (unaryFunction Core.typeApplication) $ ref applicationTypeDef @@ var "at"),- pair- (Core.nameLift _Type_forall)- (lambda "ft" $ Flows.map (unaryFunction Core.typeForall) $ ref forallTypeDef @@ var "ft"),- pair- (Core.nameLift _Type_function)- (lambda "ft" $ Flows.map (unaryFunction Core.typeFunction) $ ref functionTypeDef @@ var "ft"),- pair- (Core.nameLift _Type_list)- (lambda "et" $ Flows.map (unaryFunction Core.typeList) $ ref typeDef @@ var "et"),- pair- (Core.nameLift _Type_literal)- (lambda "lt" $ Flows.map (unaryFunction Core.typeLiteral) $ ref literalTypeDef @@ var "lt"),- pair- (Core.nameLift _Type_map)- (lambda "mt" $ Flows.map (unaryFunction Core.typeMap) $ ref mapTypeDef @@ var "mt"),- pair- (Core.nameLift _Type_optional)- (lambda "et" $ Flows.map (unaryFunction Core.typeOptional) $ ref typeDef @@ var "et"),- pair- (Core.nameLift _Type_product)- (lambda "types" $ Flows.map (unaryFunction Core.typeProduct) $ ref ExtractCore.listOfDef @@ ref typeDef @@ var "types"),- pair- (Core.nameLift _Type_record)- (lambda "rt" $ Flows.map (unaryFunction Core.typeRecord) $ ref rowTypeDef @@ var "rt"),- pair- (Core.nameLift _Type_set)- (lambda "et" $ Flows.map (unaryFunction Core.typeSet) $ ref typeDef @@ var "et"),- pair- (Core.nameLift _Type_sum)- (lambda "types" $ Flows.map (unaryFunction Core.typeSum) $ ref ExtractCore.listOfDef @@ ref typeDef @@ var "types"),- pair- (Core.nameLift _Type_union)- (lambda "rt" $ Flows.map (unaryFunction Core.typeUnion) $ ref rowTypeDef @@ var "rt"),- pair- (Core.nameLift _Type_unit)- (constant $ Flows.pure Core.typeUnit),- pair- (Core.nameLift _Type_variable)- (lambda "n" $ Flows.map (unaryFunction Core.typeVariable) $ ref nameDef @@ var "n"),- pair- (Core.nameLift _Type_wrap)- (lambda "wt" $ Flows.map (unaryFunction Core.typeWrap) $ ref wrappedTypeDef @@ var "wt")] @@ var "dat") [- _Term_annotated>>: lambda "annotatedTerm" $- Flows.map- (lambda "t" $ Core.typeAnnotated $ Core.annotatedType (var "t") (Core.annotatedTermAnnotation $ var "annotatedTerm"))- (ref typeDef @@ (Core.annotatedTermSubject $ var "annotatedTerm"))]--typeSchemeDef :: TBinding (Term -> Flow Graph TypeScheme)-typeSchemeDef = define "typeScheme" $- ref Lexical.matchRecordDef @@ (lambda "m" $ binds [- "vars">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _TypeScheme_variables @@ (ref ExtractCore.listOfDef @@ ref nameDef),- "body">: ref Lexical.getFieldDef @@ var "m" @@ Core.nameLift _TypeScheme_type @@ ref typeDef] $- produce $ Core.typeScheme (var "vars") (var "body"))--wrappedTypeDef :: TBinding (Term -> Flow Graph WrappedType)-wrappedTypeDef = define "wrappedType" $- lambda "term" $ binds [- "fields">: ref ExtractCore.recordDef @@ Core.nameLift _WrappedType @@ var "term",- "name">: ref ExtractCore.fieldDef @@ Core.nameLift _WrappedType_typeName @@ ref nameDef @@ var "fields",- "obj">: ref ExtractCore.fieldDef @@ Core.nameLift _WrappedType_object @@ ref typeDef @@ var "fields"] $- produce $ Core.wrappedType (var "name") (var "obj")
src/main/haskell/Hydra/Sources/Kernel/Terms/Decoding.hs view
@@ -1,411 +1,781 @@-module Hydra.Sources.Kernel.Terms.Decoding where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting---module_ :: Module-module_ = Module (Namespace "hydra.decoding") elements- [Rewriting.module_]- kernelTypesModules $- Just "A module for decoding terms to native objects"- where- elements = [- el bigfloatDef,- el bigfloatValueDef,- el bigintDef,- el bigintValueDef,- el binaryDef,- el binaryLiteralDef,- el booleanDef,- el booleanLiteralDef,- el caseFieldDef,- el casesDef,- el fieldDef,- el float32Def,- el float32ValueDef,- el float64Def,- el float64ValueDef,- el floatLiteralDef,- el int16Def,- el int16ValueDef,- el int32Def,- el int32ValueDef,- el int64Def,- el int64ValueDef,- el int8Def,- el int8ValueDef,- el integerLiteralDef,- el lambdaDef,- el letBindingDef,- el letBindingWithKeyDef,- el letTermDef,- el listDef,- el literalDef,- el mapDef,- el nameDef,- el nominalDef,- el optionalDef,- el pairDef,- el recordDef,- el setDef,- el stringDef,- el stringLiteralDef,- el uint16Def,- el uint16ValueDef,- el uint32Def,- el uint32ValueDef,- el uint64Def,- el uint64ValueDef,- el uint8Def,- el uint8ValueDef,- el unitDef,- el unitVariantDef,- el variableDef,- el variantDef,- el wrapDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--bigfloatDef :: TBinding (Term -> Maybe Float)-bigfloatDef = define "bigfloat" $- compose3 (ref literalDef) (ref floatLiteralDef) (ref bigfloatValueDef)--bigfloatValueDef :: TBinding (FloatValue -> Maybe Float)-bigfloatValueDef = define "bigfloatValue" $- matchVariant _FloatValue _FloatValue_bigfloat--bigintDef :: TBinding (Term -> Maybe Int)-bigintDef = define "bigint" $- compose3 (ref literalDef) (ref integerLiteralDef) (ref bigintValueDef)--bigintValueDef :: TBinding (IntegerValue -> Maybe Int)-bigintValueDef = define "bigintValue" $- matchVariant _IntegerValue _IntegerValue_bigint--binaryDef :: TBinding (Term -> Maybe String)-binaryDef = define "binary" $- compose2 (ref literalDef) (ref binaryLiteralDef)--binaryLiteralDef :: TBinding (Literal -> Maybe String)-binaryLiteralDef = define "binaryLiteral" $- matchVariant _Literal _Literal_binary--booleanDef :: TBinding (Term -> Maybe Bool)-booleanDef = define "boolean" $- compose2 (ref literalDef) (ref booleanLiteralDef)--booleanLiteralDef :: TBinding (Literal -> Maybe Bool)-booleanLiteralDef = define "booleanLiteral" $- matchVariant _Literal _Literal_boolean--casesDef :: TBinding (Name -> Term -> Maybe [Field])-casesDef = define "cases" $- lets [- "matchFunction">: matchTermVariant _Term_function,- "matchElimination">: matchVariant _Function _Function_elimination,- "matchUnion">: matchVariant _Elimination _Elimination_union]- $ ref nominalDef- @@ (unaryFunction Core.caseStatementTypeName)- @@ (unaryFunction Core.caseStatementCases)- @@ compose3 (var "matchFunction") (var "matchElimination") (var "matchUnion")--caseFieldDef :: TBinding (Name -> Name -> Term -> Y.Maybe Term)-caseFieldDef = define "caseField" $- lambda "tname" $ lambda "fname" $- compose2- (ref casesDef @@ var "tname" )- (ref fieldDef @@ var "fname")--fieldDef :: TBinding (Name -> [Field] -> Maybe Term)-fieldDef = define "field" $- lambdas ["fname", "fields"] $ lets [- "matches">: Lists.filter- (lambda "f" $ Equality.equal (Core.fieldName $ var "f") $ var "fname")- (var "fields")]- $ Logic.ifElse (Equality.equal (int32 1) (Lists.length $ var "matches"))- (just (Core.fieldTerm $ (Lists.head $ var "matches")))- nothing--float32Def :: TBinding (Term -> Maybe Float)-float32Def = define "float32" $- compose3- (ref literalDef)- (ref floatLiteralDef)- (ref float32ValueDef)--float32ValueDef :: TBinding (FloatValue -> Maybe Float)-float32ValueDef = define "float32Value" $- matchVariant _FloatValue _FloatValue_float32--float64Def :: TBinding (Term -> Maybe Float)-float64Def = define "float64" $- compose3- (ref literalDef)- (ref floatLiteralDef)- (ref float64ValueDef)--float64ValueDef :: TBinding (FloatValue -> Maybe Float)-float64ValueDef = define "float64Value" $- matchVariant _FloatValue _FloatValue_float64--floatLiteralDef = define "floatLiteral" $- matchVariant _Literal _Literal_float--int8Def :: TBinding (Term -> Maybe Int)-int8Def = define "int8" $- compose3- (ref literalDef)- (ref integerLiteralDef)- (ref int8ValueDef)--int8ValueDef :: TBinding (IntegerValue -> Maybe Int)-int8ValueDef = define "int8Value" $- matchVariant _IntegerValue _IntegerValue_int8--int16Def :: TBinding (Term -> Maybe Int)-int16Def = define "int16" $- compose3- (ref literalDef)- (ref integerLiteralDef)- (ref int16ValueDef)--int16ValueDef :: TBinding (IntegerValue -> Maybe Int)-int16ValueDef = define "int16Value" $- matchVariant _IntegerValue _IntegerValue_int16--int32Def :: TBinding (Term -> Maybe Int)-int32Def = define "int32" $- compose3- (ref literalDef)- (ref integerLiteralDef)- (ref int32ValueDef)--int32ValueDef :: TBinding (IntegerValue -> Maybe Int)-int32ValueDef = define "int32Value" $- matchVariant _IntegerValue _IntegerValue_int32--int64Def :: TBinding (Term -> Maybe Int)-int64Def = define "int64" $- compose3- (ref literalDef)- (ref integerLiteralDef)- (ref int64ValueDef)--int64ValueDef :: TBinding (IntegerValue -> Maybe Int)-int64ValueDef = define "int64Value" $- matchVariant _IntegerValue _IntegerValue_int64--integerLiteralDef :: TBinding (Literal -> Maybe IntegerValue)-integerLiteralDef = define "integerLiteral" $- matchVariant _Literal _Literal_integer--lambdaDef :: TBinding (Term -> Maybe Lambda)-lambdaDef = define "lambda" $- lets [- "matchFunction">: matchTermVariant _Term_function,- "matchLambda">: matchVariant _Function _Function_lambda]- $ compose2 (var "matchFunction") (var "matchLambda")--letBindingDef :: TBinding (Name -> Term -> Maybe Binding)-letBindingDef = define "letBinding" $- lambda "fname" $ lambda "term" $ Optionals.bind- (Optionals.map- (unaryFunction Core.letBindings)- (ref letTermDef @@ var "term"))- (ref letBindingWithKeyDef @@ var "fname")--letBindingWithKeyDef :: TBinding (Name -> [Binding] -> Maybe Binding)-letBindingWithKeyDef = define "letBindingWithKey" $- lambda "fname" $ lambda "bindings" $ lets [- "matches">: Lists.filter- (lambda "b" $ Equality.equal (Core.bindingName $ var "b") $ var "fname")- (var "bindings")]- $ Logic.ifElse (Equality.equal (int32 1) (Lists.length $ var "matches"))- (just (Lists.head $ var "matches"))- nothing--letTermDef :: TBinding (Term -> Maybe Let)-letTermDef = define "letTerm" $- matchTermVariant _Term_let--listDef :: TBinding (Term -> Maybe [Term])-listDef = define "list" $- matchTermVariant _Term_list--literalDef :: TBinding (Term -> Maybe Literal)-literalDef = define "literal" $- matchTermVariant _Term_literal--mapDef :: TBinding (Term -> Maybe (M.Map Term Term))-mapDef = define "map" $- matchTermVariant _Term_map--nameDef :: TBinding (Term -> Maybe Name)-nameDef = define "name" $- lambda "term" $ Optionals.map nm- (Optionals.bind- (ref wrapDef @@ Core.nameLift _Name @@ var "term")- (ref stringDef))- where- nm :: TTerm (String -> Name)- nm = TTerm $ Terms.lambda "s" $ TermWrap $ WrappedTerm _Name $ Terms.var "s"--nominalDef :: TBinding ((a -> Name) -> (a -> b) -> (c -> Maybe a) -> Name -> c -> Maybe b)-nominalDef = define "nominal" $- lambda "getName" $ lambda "getB" $ lambda "getA" $ lambda "expected" $- lets [- "namesEqual">: lambda "n1" $ lambda "n2" $ Equality.equal (Core.unName $ var "n1") (Core.unName $ var "n2")] $- compose2- (var "getA")- (lambda "a" $ (Logic.ifElse (var "namesEqual" @@ (var "getName" @@ var "a") @@ (var "expected")))- (just (var "getB" @@ var "a"))- nothing)--optionalDef :: TBinding (Term -> Maybe (Maybe Term))-optionalDef = define "optional" $- matchTermVariant _Term_optional--pairDef :: TBinding (Term -> Maybe (Term, Term))-pairDef = define "pair" $- lets [- "matchProduct">: matchTermVariant _Term_product]- $ compose2- (var "matchProduct")- (lambda "l" $ Logic.ifElse (Equality.equal (int32 2) (Lists.length $ var "l"))- (just $ pair (Lists.at (int32 0) $ var "l") (Lists.at (int32 1) $ var "l"))- nothing)--recordDef :: TBinding (Name -> Term -> Maybe [Field])-recordDef = define "record" $- matchNominal _Term_record- (unaryFunction Core.recordTypeName)- (unaryFunction Core.recordFields)--setDef :: TBinding (Term -> Maybe (S.Set Term))-setDef = define "set" $- matchTermVariant _Term_set--stringDef :: TBinding (Term -> Maybe String)-stringDef = define "string" $- compose2 (ref literalDef) (ref stringLiteralDef)--stringLiteralDef :: TBinding (Literal -> Maybe String)-stringLiteralDef = define "stringLiteral" $- matchVariant _Literal _Literal_string--uint8Def :: TBinding (Term -> Maybe Int)-uint8Def = define "uint8" $- compose3 (ref literalDef) (ref integerLiteralDef) (ref uint8ValueDef)--uint8ValueDef :: TBinding (IntegerValue -> Maybe Int)-uint8ValueDef = define "uint8Value" $- matchVariant _IntegerValue _IntegerValue_uint8--uint16Def :: TBinding (Term -> Maybe Int)-uint16Def = define "uint16" $- compose3 (ref literalDef) (ref integerLiteralDef) (ref uint16ValueDef)--uint16ValueDef :: TBinding (IntegerValue -> Maybe Int)-uint16ValueDef = define "uint16Value" $- matchVariant _IntegerValue _IntegerValue_uint16--uint32Def :: TBinding (Term -> Maybe Int)-uint32Def = define "uint32" $- compose3 (ref literalDef) (ref integerLiteralDef) (ref uint32ValueDef)--uint32ValueDef :: TBinding (IntegerValue -> Maybe Int)-uint32ValueDef = define "uint32Value" $- matchVariant _IntegerValue _IntegerValue_uint32--uint64Def :: TBinding (Term -> Maybe Int)-uint64Def = define "uint64" $- compose3 (ref literalDef) (ref integerLiteralDef) (ref uint64ValueDef)--uint64ValueDef :: TBinding (IntegerValue -> Maybe Int)-uint64ValueDef = define "uint64Value" $- matchVariant _IntegerValue _IntegerValue_uint64--unitDef :: TBinding (Term -> Maybe ())-unitDef = define "unit" $- lambda "term" $ cases _Term (var "term") (Just nothing) [- _Term_unit>>: constant $ just unit]--unitVariantDef :: TBinding (Name -> Term -> Maybe Name)-unitVariantDef = define "unitVariant" $- lambda "tname" $ lambda "term" $ Optionals.map- (unaryFunction Core.fieldName)- (ref variantDef @@ var "tname" @@ var "term")--variableDef :: TBinding (Term -> Y.Maybe Name)-variableDef = define "variable" $- matchTermVariant _Term_variable--variantDef :: TBinding (Name -> Term -> Maybe Field)-variantDef = define "variant" $- matchNominal _Term_union- (unaryFunction Core.injectionTypeName)- (unaryFunction Core.injectionField)--wrapDef :: TBinding (Name -> Term -> Maybe Term)-wrapDef = define "wrap" $- matchNominal _Term_wrap- (unaryFunction Core.wrappedTermTypeName)- (unaryFunction Core.wrappedTermObject)------compose2 :: TTerm (a -> Maybe b) -> TTerm (b -> Maybe c) -> TTerm (a -> Maybe c)-compose2 = Optionals.compose--compose3 :: TTerm (a -> Maybe b) -> TTerm (b -> Maybe c) -> TTerm (c -> Maybe d) -> TTerm (a -> Maybe d)-compose3 f g h = Optionals.compose (Optionals.compose f g) h--matchNominal :: Name -> TTerm (a -> Name) -> TTerm (a -> b) -> TTerm (Name -> Term -> Maybe b)-matchNominal fname getName getB = ref nominalDef @@ getName @@ getB @@ matchTermVariant fname--matchTermVariant :: Name -> TTerm (Term -> Maybe a)-matchTermVariant fname = matchVariant _Term fname <.> ref Rewriting.deannotateTermDef--matchVariant :: Name -> Name -> TTerm (a -> Maybe b)-matchVariant tname fname = match tname (Just nothing) [- fname>>: lambda "matched_" $ Optionals.pure $ var "matched_"]+{-# LANGUAGE FlexibleContexts #-}++module Hydra.Sources.Kernel.Terms.Decoding where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (literalType, matchRecord, matchUnion)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (+ elimination, field, fieldType, floatType, floatValue, function, injection, integerType, integerValue, literal,+ literalType, record, term, type_, typeScheme)+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Extract.Helpers as Helpers+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Dsl.Meta.DeepCore as DC+import Hydra.Dsl.Meta.DeepCore ((@@@))+++ns :: Namespace+ns = Namespace "hydra.decoding"++module_ :: Module+module_ = Module ns elements+ [Annotations.ns, Formatting.ns, Helpers.ns, Lexical.ns, Monads.ns, Names.ns, Rewriting.ns, Schemas.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just "Functions for generating term decoders from type modules"+ where+ elements = [+ toBinding collectForallVariables,+ toBinding collectOrdConstrainedVariables,+ toBinding collectTypeVariables,+ toBinding collectTypeVariablesFromType,+ toBinding decodeBinding,+ toBinding decodeBindingName,+ toBinding decodeEitherType,+ toBinding decodeForallType,+ toBinding decodeListType,+ toBinding decodeLiteralType,+ toBinding decodeMapType,+ toBinding decodeMaybeType,+ toBinding decodeModule,+ toBinding decodeNamespace,+ toBinding decodePairType,+ toBinding decodeRecordType,+ toBinding decodeSetType,+ toBinding decodeType,+ toBinding decodeUnitType,+ toBinding decodeUnionType,+ toBinding decodeWrappedType,+ toBinding decoderFullResultType,+ toBinding decoderResultType,+ toBinding decoderType,+ toBinding decoderTypeScheme,+ toBinding filterTypeBindings,+ toBinding isDecodableBinding,+ toBinding prependForallDecoders]++define :: String -> TTerm x -> TBinding x+define = definitionInModule module_++--------------------------------------------------------------------------------+-- Helper functions+--------------------------------------------------------------------------------++-- | Build a decoder term that takes cx and raw, strips annotations/dereferences variables, and matches on it+-- The result is: \cx -> \raw -> either (\err -> Left (DecodingError err)) (\stripped -> case stripped of ...) (stripAndDereferenceTermEither cx raw)+-- Note: We use the original inline style - the Python coder should handle this pattern by recognizing+-- when a lambda body is a case application and generating a proper function with match statement.+deannotateAndMatch :: TTerm (Maybe Term) -> [TTerm Field] -> TTerm Term+deannotateAndMatch dflt cses = DC.lambda "cx" $ DC.lambda "raw" $+ DC.primitive _eithers_either+ -- If Left (error string), convert to DecodingError+ @@@ (DC.lambda "err" $ DC.left $ DC.wrap _DecodingError $ DC.var "err")+ -- If Right (stripped term), do the case match+ @@@ (DC.lambda "stripped" $ DC.cases _Term (DC.var "stripped") dflt cses)+ -- Call stripAndDereferenceTermEither cx raw+ @@@ (DC.ref Lexical.stripAndDereferenceTermEither @@@ DC.var "cx" @@@ DC.var "raw")++-- | Helper to create a decoding error term from a message (object-level)+-- Returns: Term.wrap (WrappedTerm "hydra.util.DecodingError" (Term.literal (Literal.string msg)))+decodingErrorTerm :: TTerm String -> TTerm Term+decodingErrorTerm msg = DC.wrap _DecodingError $ DC.string msg++-- | Helper to create a Left (error) result term+-- Returns: Term.either (Left (decodingErrorTerm msg))+leftError :: TTerm String -> TTerm Term+leftError msg = DC.left $ decodingErrorTerm msg++-- | Helper to convert Either String Term to Either DecodingError Term+stripWithDecodingError :: TTerm Graph -> TTerm Term -> TTerm (Either DecodingError Term)+stripWithDecodingError g term = Eithers.bimap+ (unaryFunction Util.decodingError)+ ("x" ~> var "x")+ (Lexical.stripAndDereferenceTermEither @@ g @@ term)++--------------------------------------------------------------------------------+-- Main decoder functions+--------------------------------------------------------------------------------++-- | Compute the result type for a decoder based on the input type+-- Returns the domain type name for the decoded value+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+decoderResultType :: TBinding (Type -> Name)+decoderResultType = define "decoderResultType" $+ doc "Compute the result type name for a decoder" $+ "typ" ~>+ cases _Type (var "typ") (Just (Core.nameLift _Term)) [+ _Type_annotated>>: "at" ~>+ decoderResultType @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: "appType" ~>+ -- For type applications like ColumnSchema<t>, get result type from function part+ decoderResultType @@ (Core.applicationTypeFunction (var "appType")),+ _Type_forall>>: "ft" ~>+ decoderResultType @@ (Core.forallTypeBody (var "ft")),+ _Type_literal>>: "_" ~>+ Core.nameLift _Literal,+ _Type_record>>: "rt" ~>+ Core.rowTypeTypeName (var "rt"),+ _Type_union>>: "rt" ~>+ Core.rowTypeTypeName (var "rt"),+ _Type_wrap>>: "wt" ~>+ Core.wrappedTypeTypeName (var "wt")]++-- | Build a decoder type scheme: Term -> Either DecodingError ResultType+-- For polymorphic types, adds extra arguments for the decoders of type parameters+-- Includes Ord constraints for type variables that appear in Set element positions+decoderTypeScheme :: TBinding (Type -> TypeScheme)+decoderTypeScheme = define "decoderTypeScheme" $+ doc "Build type scheme for a decoder function" $+ "typ" ~>+ "typeVars" <~ collectTypeVariables @@ var "typ" $+ "allOrdVars" <~ collectOrdConstrainedVariables @@ var "typ" $+ -- Filter to only include actual forall-bound type variables+ -- (collectOrdConstrainedVariables may return nominal type references like "hydra.relational.ColumnName")+ "ordVars" <~ Lists.filter+ ("v" ~> Lists.elem (var "v" :: TTerm Name) (var "typeVars" :: TTerm [Name]))+ (var "allOrdVars") $+ -- Build constraints: for each ordVar, add Ord constraint (uses original var names, normalization renames them)+ "constraints" <~ (+ Logic.ifElse (Lists.null (var "ordVars"))+ Phantoms.nothing+ (just $ Maps.fromList $ Lists.map+ ("v" ~> pair (var "v") (Core.typeVariableMetadata $ Sets.singleton $ Core.nameLift _TypeClass_ordering))+ (var "ordVars"))) $+ Core.typeScheme+ (var "typeVars")+ (decoderType @@ var "typ")+ (var "constraints")++-- | Collect type variables from forall types+-- Note: Graph is NOT included as a type variable - it's a concrete type+collectTypeVariables :: TBinding (Type -> [Name])+collectTypeVariables = define "collectTypeVariables" $+ doc "Collect type variable names from a type (forall parameters only)" $+ "typ" ~> collectForallVariables @@ var "typ"++-- | Collect just the forall type variables from a type+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+collectForallVariables :: TBinding (Type -> [Name])+collectForallVariables = define "collectForallVariables" $+ doc "Collect forall type variable names from a type" $+ "typ" ~>+ cases _Type (var "typ") (Just $ list ([] :: [TTerm Name])) [+ _Type_annotated>>: "at" ~>+ collectForallVariables @@ (Core.annotatedTypeBody (var "at")),+ _Type_forall>>: "ft" ~>+ Lists.cons (Core.forallTypeParameter (var "ft"))+ (collectForallVariables @@ Core.forallTypeBody (var "ft"))]++-- | Collect type variables that appear in Set element positions and need Ord constraints.+-- This is a pure function that traverses the type structure without dereferencing type names.+-- The collected variables use their original names; normalization will rename them later.+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+collectOrdConstrainedVariables :: TBinding (Type -> [Name])+collectOrdConstrainedVariables = define "collectOrdConstrainedVariables" $+ doc "Collect type variables needing Ord constraints (from Set element types)" $+ "typ" ~>+ cases _Type (var "typ") (Just $ list ([] :: [TTerm Name])) [+ _Type_annotated>>: "at" ~>+ collectOrdConstrainedVariables @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: "appType" ~>+ Lists.concat2+ (collectOrdConstrainedVariables @@ Core.applicationTypeFunction (var "appType"))+ (collectOrdConstrainedVariables @@ Core.applicationTypeArgument (var "appType")),+ _Type_either>>: "et" ~>+ Lists.concat2+ (collectOrdConstrainedVariables @@ Core.eitherTypeLeft (var "et"))+ (collectOrdConstrainedVariables @@ Core.eitherTypeRight (var "et")),+ _Type_forall>>: "ft" ~>+ collectOrdConstrainedVariables @@ Core.forallTypeBody (var "ft"),+ _Type_list>>: "elemType" ~>+ collectOrdConstrainedVariables @@ var "elemType",+ _Type_map>>: "mt" ~>+ Lists.concat2+ (collectOrdConstrainedVariables @@ Core.mapTypeKeys (var "mt"))+ (collectOrdConstrainedVariables @@ Core.mapTypeValues (var "mt")),+ _Type_maybe>>: "elemType" ~>+ collectOrdConstrainedVariables @@ var "elemType",+ _Type_pair>>: "pt" ~>+ Lists.concat2+ (collectOrdConstrainedVariables @@ Core.pairTypeFirst (var "pt"))+ (collectOrdConstrainedVariables @@ Core.pairTypeSecond (var "pt")),+ _Type_record>>: "rt" ~>+ Lists.concat $ Lists.map+ ("ft" ~> collectOrdConstrainedVariables @@ Core.fieldTypeType (var "ft"))+ (Core.rowTypeFields (var "rt")),+ -- For Set<T>, collect all type variables from T (they all need Ord)+ -- plus recurse into T for nested Sets+ _Type_set>>: "elemType" ~>+ Lists.concat2+ (collectTypeVariablesFromType @@ var "elemType")+ (collectOrdConstrainedVariables @@ var "elemType"),+ _Type_union>>: "rt" ~>+ Lists.concat $ Lists.map+ ("ft" ~> collectOrdConstrainedVariables @@ Core.fieldTypeType (var "ft"))+ (Core.rowTypeFields (var "rt")),+ _Type_wrap>>: "wt" ~>+ collectOrdConstrainedVariables @@ Core.wrappedTypeBody (var "wt")]++-- | Collect all type variables from a type expression (for use in Set element types)+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+collectTypeVariablesFromType :: TBinding (Type -> [Name])+collectTypeVariablesFromType = define "collectTypeVariablesFromType" $+ doc "Collect all type variable names from a type expression" $+ "typ" ~>+ cases _Type (var "typ") (Just $ list ([] :: [TTerm Name])) [+ _Type_annotated>>: "at" ~>+ collectTypeVariablesFromType @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: "appType" ~>+ Lists.concat2+ (collectTypeVariablesFromType @@ Core.applicationTypeFunction (var "appType"))+ (collectTypeVariablesFromType @@ Core.applicationTypeArgument (var "appType")),+ _Type_either>>: "et" ~>+ Lists.concat2+ (collectTypeVariablesFromType @@ Core.eitherTypeLeft (var "et"))+ (collectTypeVariablesFromType @@ Core.eitherTypeRight (var "et")),+ _Type_forall>>: "ft" ~>+ collectTypeVariablesFromType @@ Core.forallTypeBody (var "ft"),+ _Type_list>>: "elemType" ~>+ collectTypeVariablesFromType @@ var "elemType",+ _Type_map>>: "mt" ~>+ Lists.concat2+ (collectTypeVariablesFromType @@ Core.mapTypeKeys (var "mt"))+ (collectTypeVariablesFromType @@ Core.mapTypeValues (var "mt")),+ _Type_maybe>>: "elemType" ~>+ collectTypeVariablesFromType @@ var "elemType",+ _Type_pair>>: "pt" ~>+ Lists.concat2+ (collectTypeVariablesFromType @@ Core.pairTypeFirst (var "pt"))+ (collectTypeVariablesFromType @@ Core.pairTypeSecond (var "pt")),+ _Type_record>>: "rt" ~>+ Lists.concat $ Lists.map+ ("ft" ~> collectTypeVariablesFromType @@ Core.fieldTypeType (var "ft"))+ (Core.rowTypeFields (var "rt")),+ _Type_set>>: "elemType" ~>+ collectTypeVariablesFromType @@ var "elemType",+ _Type_union>>: "rt" ~>+ Lists.concat $ Lists.map+ ("ft" ~> collectTypeVariablesFromType @@ Core.fieldTypeType (var "ft"))+ (Core.rowTypeFields (var "rt")),+ _Type_variable>>: "name" ~>+ list [var "name"],+ _Type_wrap>>: "wt" ~>+ collectTypeVariablesFromType @@ Core.wrappedTypeBody (var "wt")]++-- | Build the decoder function type for a given type+-- For monomorphic types: Graph -> Term -> Either DecodingError ResultType+-- For polymorphic types: (Graph -> Term -> Either DecodingError a) -> ... -> Graph -> Term -> Either DecodingError ResultType<a>+-- The 'Graph' parameter is used for dereferencing term variables+decoderType :: TBinding (Type -> Type)+decoderType = define "decoderType" $+ doc "Build decoder function type" $+ "typ" ~>+ -- Get the result type (the full type, preserving type applications)+ "resultType" <~ (decoderFullResultType @@ var "typ") $+ -- Build the base decoder type: Graph -> Term -> Either DecodingError ResultType+ -- Graph is a concrete type (hydra.graph.Graph), not a type variable+ "baseType" <~ (Core.typeFunction $ Core.functionType+ (Core.typeVariable (Core.nameLift _Graph))+ (Core.typeFunction $ Core.functionType+ (Core.typeVariable (Core.nameLift _Term))+ (Core.typeEither $ Core.eitherType+ (Core.typeVariable (Core.nameLift _DecodingError))+ (var "resultType")))) $+ -- Prepend decoder types for each forall parameter+ prependForallDecoders @@ var "baseType" @@ var "typ"++-- | Helper to prepend decoder types for forall parameters+-- For forall a. forall b. T: prepends (Graph -> Term -> E a) -> (Graph -> Term -> E b) -> to the base type+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+prependForallDecoders :: TBinding (Type -> Type -> Type)+prependForallDecoders = define "prependForallDecoders" $+ doc "Prepend decoder types for forall parameters to base type" $+ "baseType" ~> "typ" ~> cases _Type (var "typ") (Just $ var "baseType") [+ _Type_annotated>>: "at" ~>+ prependForallDecoders @@ var "baseType" @@ Core.annotatedTypeBody (var "at"),+ _Type_forall>>: "ft" ~>+ -- For forall a. T: build (Graph -> Term -> Either E a) -> prependForallDecoders(baseType, T)+ Core.typeFunction $ Core.functionType+ (Core.typeFunction $ Core.functionType+ (Core.typeVariable (Core.nameLift _Graph))+ (Core.typeFunction $ Core.functionType+ (Core.typeVariable (Core.nameLift _Term))+ (Core.typeEither $ Core.eitherType+ (Core.typeVariable (Core.nameLift _DecodingError))+ (Core.typeVariable (Core.forallTypeParameter (var "ft"))))))+ (prependForallDecoders @@ var "baseType" @@ Core.forallTypeBody (var "ft"))]++-- | Get the full result type for a decoder, preserving type applications+-- For forall t. ColumnSchema<t>, returns ColumnSchema<t> (as a Type, not just a Name)+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+decoderFullResultType :: TBinding (Type -> Type)+decoderFullResultType = define "decoderFullResultType" $+ doc "Get full result type for decoder" $+ "typ" ~>+ cases _Type (var "typ") (Just $ Core.typeVariable (Core.nameLift _Term)) [+ _Type_annotated>>: "at" ~>+ decoderFullResultType @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: "appType" ~>+ -- Preserve the full application: e.g., ColumnSchema<t> stays as Type.application+ Core.typeApplication $ Core.applicationType+ (decoderFullResultType @@ Core.applicationTypeFunction (var "appType"))+ (Core.applicationTypeArgument (var "appType")),+ _Type_either>>: "et" ~>+ -- Either L R -> Either (decoded L) (decoded R)+ Core.typeEither $ Core.eitherType+ (decoderFullResultType @@ Core.eitherTypeLeft (var "et"))+ (decoderFullResultType @@ Core.eitherTypeRight (var "et")),+ _Type_forall>>: "ft" ~>+ -- For forall t. Body, we need to apply the type parameter to the body's result type+ -- e.g., forall t. RecordType{name=ColumnSchema} -> ColumnSchema t+ Core.typeApplication $ Core.applicationType+ (decoderFullResultType @@ Core.forallTypeBody (var "ft"))+ (Core.typeVariable (Core.forallTypeParameter (var "ft"))),+ _Type_list>>: "elemType" ~>+ -- [a] -> [decoded a]+ Core.typeList (decoderFullResultType @@ var "elemType"),+ _Type_literal>>: "_" ~>+ Core.typeVariable (Core.nameLift _Literal),+ _Type_map>>: "mt" ~>+ -- Map k v -> Map (decoded k) (decoded v)+ Core.typeMap $ Core.mapType+ (decoderFullResultType @@ Core.mapTypeKeys (var "mt"))+ (decoderFullResultType @@ Core.mapTypeValues (var "mt")),+ _Type_maybe>>: "elemType" ~>+ -- Maybe a -> Maybe (decoded a)+ Core.typeMaybe (decoderFullResultType @@ var "elemType"),+ _Type_pair>>: "pt" ~>+ -- (a, b) -> (decoded a, decoded b)+ Core.typePair $ Core.pairType+ (decoderFullResultType @@ Core.pairTypeFirst (var "pt"))+ (decoderFullResultType @@ Core.pairTypeSecond (var "pt")),+ _Type_record>>: "rt" ~>+ Core.typeVariable (Core.rowTypeTypeName (var "rt")),+ _Type_set>>: "elemType" ~>+ -- Set a -> Set (decoded a)+ Core.typeSet (decoderFullResultType @@ var "elemType"),+ _Type_union>>: "rt" ~>+ Core.typeVariable (Core.rowTypeTypeName (var "rt")),+ _Type_unit>>: constant Core.typeUnit,+ _Type_variable>>: "name" ~>+ Core.typeVariable (var "name"),+ _Type_wrap>>: "wt" ~>+ Core.typeVariable (Core.wrappedTypeTypeName (var "wt"))]++-- | Decode a single type binding into a decoder binding+-- Uses Flow to decode the Type from the binding's term, then generates decoder+decodeBinding :: TBinding (Binding -> Flow Graph Binding)+decodeBinding = define "decodeBinding" $+ doc "Transform a type binding into a decoder binding" $+ "b" ~>+ "cx" <<~ Monads.getState $+ Flows.bind (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ (Core.bindingTerm (var "b")))) $+ "typ" ~>+ Flows.pure (Core.binding+ (decodeBindingName @@ (Core.bindingName (var "b")))+ (decodeType @@ (var "typ"))+ (just (decoderTypeScheme @@ var "typ")))++-- | Generate a fully qualified binding name for a decoder function from a type name+-- For example, "hydra.util.CaseConvention" -> "hydra.decode.util.caseConvention"+decodeBindingName :: TBinding (Name -> Name)+decodeBindingName = define "decodeBindingName" $+ doc "Generate a binding name for a decoder function from a type name" $+ "n" ~>+ -- Check if name has a namespace (contains ".")+ Logic.ifElse (Logic.not (Lists.null+ (Lists.tail (Strings.splitOn (string ".") (Core.unName (var "n"))))))+ -- Qualified type: e.g., "hydra.util.CaseConvention" -> "hydra.decode.util.caseConvention"+ (Core.name (+ Strings.intercalate (string ".") (+ Lists.concat2+ (list [string "hydra", string "decode"])+ (Lists.concat2+ (Lists.tail (Lists.init (Strings.splitOn (string ".") (Core.unName (var "n")))))+ (list [Formatting.decapitalize @@ (Names.localNameOf @@ (var "n"))])))))+ -- Local type: just decapitalize+ (Core.name (Formatting.decapitalize @@ (Names.localNameOf @@ (var "n"))))++-- | Generate a decoder for a literal type+-- Match on the LiteralType to generate type-specific decoders+-- Note: Uses 'cases' instead of 'match' to avoid variable shadowing from eta expansion+decodeLiteralType :: TBinding (LiteralType -> Term)+decodeLiteralType = define "decodeLiteralType" $+ doc "Generate a decoder for a literal type" $+ "lt" ~>+ cases _LiteralType (var "lt") Nothing [+ _LiteralType_binary>>: constant decodeBinary,+ _LiteralType_boolean>>: constant decodeBoolean,+ _LiteralType_float>>: "ft" ~> decodeFloat (var "ft"),+ _LiteralType_integer>>: "it" ~> decodeInteger (var "it"),+ _LiteralType_string>>: constant decodeString]+ where+ -- Helper to wrap a Literal handler with Term.literal matching+ decodeLiteral handleLiteral = deannotateAndMatch+ (just $ leftError (string "expected literal")) [+ DC.field _Term_literal $ DC.lambda "v" $ handleLiteral @@@ DC.var "v"]++ -- Decode binary: Term -> Either DecodingError Binary+ decodeBinary = decodeLiteral $ DC.match _Literal+ (just $ leftError (string "expected binary literal")) [+ DC.field _Literal_binary $ DC.lambda "b" $ DC.right $ DC.var "b"]++ -- Decode boolean: Term -> Either DecodingError Bool+ decodeBoolean = decodeLiteral $ DC.match _Literal+ (just $ leftError (string "expected boolean literal")) [+ DC.field _Literal_boolean $ DC.lambda "b" $ DC.right $ DC.var "b"]++ -- Decode float: Term -> Either DecodingError <specific float type>+ decodeFloat ft = cases _FloatType ft Nothing [+ _FloatType_bigfloat>>: constant $ decodeFloatVariant _FloatValue_bigfloat (string "bigfloat"),+ _FloatType_float32>>: constant $ decodeFloatVariant _FloatValue_float32 (string "float32"),+ _FloatType_float64>>: constant $ decodeFloatVariant _FloatValue_float64 (string "float64")]++ -- Helper to decode a specific float variant+ decodeFloatVariant floatVariant floatName = decodeLiteral $ DC.match _Literal+ (just $ leftError (Strings.cat $ list [string "expected ", floatName, string " literal"])) [+ DC.field _Literal_float $ DC.match _FloatValue+ (just $ leftError (Strings.cat $ list [string "expected ", floatName, string " value"])) [+ DC.field floatVariant $ DC.lambda "f" $ DC.right $ DC.var "f"]]++ -- Decode integer: Term -> Either DecodingError <specific integer type>+ decodeInteger it = cases _IntegerType it Nothing [+ _IntegerType_bigint>>: constant $ decodeIntegerVariant _IntegerValue_bigint (string "bigint"),+ _IntegerType_int8>>: constant $ decodeIntegerVariant _IntegerValue_int8 (string "int8"),+ _IntegerType_int16>>: constant $ decodeIntegerVariant _IntegerValue_int16 (string "int16"),+ _IntegerType_int32>>: constant $ decodeIntegerVariant _IntegerValue_int32 (string "int32"),+ _IntegerType_int64>>: constant $ decodeIntegerVariant _IntegerValue_int64 (string "int64"),+ _IntegerType_uint8>>: constant $ decodeIntegerVariant _IntegerValue_uint8 (string "uint8"),+ _IntegerType_uint16>>: constant $ decodeIntegerVariant _IntegerValue_uint16 (string "uint16"),+ _IntegerType_uint32>>: constant $ decodeIntegerVariant _IntegerValue_uint32 (string "uint32"),+ _IntegerType_uint64>>: constant $ decodeIntegerVariant _IntegerValue_uint64 (string "uint64")]++ -- Helper to decode a specific integer variant+ decodeIntegerVariant intVariant intName = decodeLiteral $ DC.match _Literal+ (just $ leftError (Strings.cat $ list [string "expected ", intName, string " literal"])) [+ DC.field _Literal_integer $ DC.match _IntegerValue+ (just $ leftError (Strings.cat $ list [string "expected ", intName, string " value"])) [+ DC.field intVariant $ DC.lambda "i" $ DC.right $ DC.var "i"]]++ -- Decode string: Term -> Either DecodingError String+ decodeString = decodeLiteral $ DC.match _Literal+ (just $ leftError (string "expected string literal")) [+ DC.field _Literal_string $ DC.lambda "s" $ DC.right $ DC.var "s"]++-- | Transform a type module into a decoder module+-- Returns Nothing if the module has no decodable type definitions+decodeModule :: TBinding (Module -> Flow Graph (Maybe Module))+decodeModule = define "decodeModule" $+ doc "Transform a type module into a decoder module" $+ "mod" ~>+ "typeBindings" <<~ (filterTypeBindings @@ (Module.moduleElements (var "mod"))) $+ Logic.ifElse (Lists.null (var "typeBindings"))+ (Flows.pure nothing)+ (Flows.bind (Flows.mapList decodeBinding (var "typeBindings")) $+ "decodedBindings" ~>+ -- Decoder modules need:+ -- 1. hydra.lexical (for strip_and_dereference_term_either)+ -- 2. hydra.rewriting (for rewriting utilities)+ -- 3. Decoded versions of type dependencies (e.g., hydra.core -> hydra.decode.core)+ -- 4. Decoded versions of term dependencies (e.g., hydra.query -> hydra.decode.query)+ -- This is needed because if type A references type B, the decoder for A needs+ -- to call the decoder for B, which is in the decode module for B's source module.+ "decodedTypeDeps" <~ (Lists.map decodeNamespace (Module.moduleTypeDependencies (var "mod"))) $+ "decodedTermDeps" <~ (Lists.map decodeNamespace (Module.moduleTermDependencies (var "mod"))) $+ -- Use nub to remove duplicates (a module may appear in both type and term dependencies)+ "allDecodedDeps" <~ (primitive _lists_nub @@ Lists.concat2 (var "decodedTypeDeps") (var "decodedTermDeps")) $+ Flows.pure (just (Module.module_+ (decodeNamespace @@ (Module.moduleNamespace (var "mod")))+ (var "decodedBindings")+ (Lists.concat2+ (list [+ (Module.namespace $ string "hydra.extract.helpers"),+ (Module.namespace $ string "hydra.lexical"),+ (Module.namespace $ string "hydra.rewriting")])+ (var "allDecodedDeps"))+ (list [+ Module.moduleNamespace (var "mod"),+ Module.namespace $ string "hydra.util"])+ (just (Strings.cat $ list [+ string "Term decoders for ",+ Module.unNamespace (Module.moduleNamespace (var "mod"))])))))++-- | Generate a decoder module namespace from a source module namespace+-- For example, "hydra.util" -> "hydra.decode.util"+decodeNamespace :: TBinding (Namespace -> Namespace)+decodeNamespace = define "decodeNamespace" $+ doc "Generate a decoder module namespace from a source module namespace" $+ "ns" ~> (+ Module.namespace (+ Strings.cat $ list [+ string "hydra.decode.",+ Strings.intercalate (string ".")+ (Lists.tail (Strings.splitOn (string ".") (Module.unNamespace (var "ns"))))]))++-- | Generate a decoder for a record type+-- Matches Term.record and extracts the Record with the expected type name+-- Returns Either DecodingError <RecordType>+decodeRecordType :: TBinding (RowType -> Term)+decodeRecordType = define "decodeRecordType" $+ doc "Generate a decoder for a record type" $+ "rt" ~>+ "typeName" <~ (Core.rowTypeTypeName $ var "rt") $+ "fieldTypes" <~ (Core.rowTypeFields $ var "rt") $+ -- For each field, build a term that decodes it from fieldMap using requireField helper+ -- Returns: Either DecodingError fieldValue+ "decodeFieldTerm" <~ ("ft" ~>+ DC.ref Helpers.requireField+ @@@ (DC.string $ Core.unName $ Core.fieldTypeName $ var "ft")+ @@@ (decodeType @@ (Core.fieldTypeType $ var "ft"))+ @@@ DC.var "fieldMap"+ @@@ DC.var "cx") $+ -- Build the body: a nested chain of eithers.bind calls that decode each field and build the record+ -- We need: d1 >>= \v1 -> d2 >>= \v2 -> d3 >>= \v3 -> Right Record{...}+ -- Using foldl on reversed list to build from inside out+ -- The lambda for each field uses the field name with a prefix to avoid shadowing decoder functions+ "localVarName" <~ ("ft" ~> Core.name $ Strings.cat $ list [string "field_", Core.unName $ Core.fieldTypeName $ var "ft"]) $+ "toFieldLambda" <~ ("ft" ~> "body" ~>+ Core.termFunction $ Core.functionLambda $+ Core.lambda (var "localVarName" @@ var "ft") nothing $ var "body") $+ "decodeBody" <~ (+ Lists.foldl+ ("acc" ~> "ft" ~>+ DC.primitive _eithers_bind+ @@@ (var "decodeFieldTerm" @@ var "ft")+ @@@ (var "toFieldLambda" @@ var "ft" @@ var "acc"))+ -- Base case: Right with the constructed record (wrapped as Term)+ (DC.right $ Core.termRecord $ Core.record (var "typeName") $+ Lists.map ("ft" ~> Core.field (Core.fieldTypeName $ var "ft") $ Core.termVariable $ var "localVarName" @@ var "ft")+ (var "fieldTypes"))+ (Lists.reverse $ var "fieldTypes")) $+ deannotateAndMatch+ (just $ leftError (+ Strings.cat $ list [string "expected record of type ", Core.unName (var "typeName")])) [+ DC.field _Term_record $ DC.lambda "record" $+ DC.lets [+ -- Build Map Name Term from the record's fields using toFieldMap helper+ ("fieldMap", DC.ref Helpers.toFieldMap @@@ DC.var "record")] $+ var "decodeBody"]++-- | Generate a decoder for a polymorphic (forall) type+-- For a type like `forall a. T[a]`, generates a lambda that takes a decoder for `a`+-- and returns a decoder for the body type `T[a]`+decodeForallType :: TBinding (ForallType -> Term)+decodeForallType = define "decodeForallType" $+ doc "Generate a decoder for a polymorphic (forall) type" $+ "ft" ~>+ -- Generate a lambda that takes a decoder for the type parameter+ Core.termFunction $ Core.functionLambda $+ Core.lambda+ (decodeBindingName @@ Core.forallTypeParameter (var "ft"))+ nothing+ (decodeType @@ Core.forallTypeBody (var "ft"))++-- | Generate a decoder for an Either type+decodeEitherType :: TBinding (EitherType -> Term)+decodeEitherType = define "decodeEitherType" $+ doc "Generate a decoder for an Either type" $+ "et" ~>+ "leftDecoder" <~ decodeType @@ Core.eitherTypeLeft (var "et") $+ "rightDecoder" <~ decodeType @@ Core.eitherTypeRight (var "et") $+ DC.ref Helpers.decodeEither @@@ var "leftDecoder" @@@ var "rightDecoder"++-- | Generate a decoder for a list type+decodeListType :: TBinding (Type -> Term)+decodeListType = define "decodeListType" $+ doc "Generate a decoder for a list type" $+ "elemType" ~>+ "elemDecoder" <~ decodeType @@ var "elemType" $+ DC.ref Helpers.decodeList @@@ var "elemDecoder"++-- | Generate a decoder for a map type+decodeMapType :: TBinding (MapType -> Term)+decodeMapType = define "decodeMapType" $+ doc "Generate a decoder for a map type" $+ "mt" ~>+ "keyDecoder" <~ decodeType @@ Core.mapTypeKeys (var "mt") $+ "valDecoder" <~ decodeType @@ Core.mapTypeValues (var "mt") $+ DC.ref Helpers.decodeMap @@@ var "keyDecoder" @@@ var "valDecoder"++-- | Generate a decoder for an optional/maybe type+decodeMaybeType :: TBinding (Type -> Term)+decodeMaybeType = define "decodeMaybeType" $+ doc "Generate a decoder for an optional type" $+ "elemType" ~>+ "elemDecoder" <~ decodeType @@ var "elemType" $+ DC.ref Helpers.decodeMaybe @@@ var "elemDecoder"++-- | Generate a decoder for a pair type+decodePairType :: TBinding (PairType -> Term)+decodePairType = define "decodePairType" $+ doc "Generate a decoder for a pair type" $+ "pt" ~>+ "firstDecoder" <~ decodeType @@ Core.pairTypeFirst (var "pt") $+ "secondDecoder" <~ decodeType @@ Core.pairTypeSecond (var "pt") $+ DC.ref Helpers.decodePair @@@ var "firstDecoder" @@@ var "secondDecoder"++-- | Generate a decoder for a set type+decodeSetType :: TBinding (Type -> Term)+decodeSetType = define "decodeSetType" $+ doc "Generate a decoder for a set type" $+ "elemType" ~>+ "elemDecoder" <~ decodeType @@ var "elemType" $+ DC.ref Helpers.decodeSet @@@ var "elemDecoder"++-- | Generate a decoder term for a given Type+decodeType :: TBinding (Type -> Term)+decodeType = define "decodeType" $+ doc "Generate a decoder term for a Type" $+ "typ" ~>+ cases _Type (var "typ")+ (Just $ DC.lambda "cx" $ DC.lambda "t" $ leftError $ string "unsupported type variant") [+ _Type_annotated>>: "at" ~> decodeType @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: "appType" ~>+ (decodeType @@ Core.applicationTypeFunction (var "appType"))+ @@@ (decodeType @@ Core.applicationTypeArgument (var "appType")),+ _Type_either>>: "et" ~> decodeEitherType @@ var "et",+ _Type_forall>>: "ft" ~> decodeForallType @@ var "ft",+ _Type_list>>: "elemType" ~> decodeListType @@ var "elemType",+ _Type_literal>>: "lt" ~> decodeLiteralType @@ var "lt",+ _Type_map>>: "mt" ~> decodeMapType @@ var "mt",+ _Type_maybe>>: "elemType" ~> decodeMaybeType @@ var "elemType",+ _Type_pair>>: "pt" ~> decodePairType @@ var "pt",+ _Type_record>>: "rt" ~> decodeRecordType @@ var "rt",+ _Type_set>>: "elemType" ~> decodeSetType @@ var "elemType",+ _Type_union>>: "rt" ~> decodeUnionType @@ var "rt",+ _Type_unit>>: constant decodeUnitType,+ _Type_wrap>>: "wt" ~> decodeWrappedType @@ var "wt",+ _Type_variable>>: "typeName" ~> Core.termVariable (decodeBindingName @@ var "typeName")]++-- | Generate a decoder for the unit type+decodeUnitType :: TBinding Term+decodeUnitType = define "decodeUnitType" $+ doc "Generate a decoder for the unit type" $+ DC.ref Helpers.decodeUnit++-- | Generate a decoder for a union type (including enums)+decodeUnionType :: TBinding (RowType -> Term)+decodeUnionType = define "decodeUnionType" $+ doc "Generate a decoder for a union type" $+ "rt" ~>+ "typeName" <~ (Core.rowTypeTypeName $ var "rt") $+ "toVariantPair" <~ ("ft" ~>+ DC.pair+ (DC.wrap _Name $ DC.string $ Core.unName $ Core.fieldTypeName $ var "ft")+ (DC.lambda "input" $ DC.primitive _eithers_map+ @@@ (DC.lambda "t" $ Core.termUnion $ Core.injection (var "typeName") $ Core.field (Core.fieldTypeName $ var "ft") $ DC.var "t")+ @@@ ((decodeType @@ (Core.fieldTypeType $ var "ft")) @@@ DC.var "cx" @@@ DC.var "input"))) $+ deannotateAndMatch+ (just $ leftError $+ Strings.cat $ list [string "expected union of type ", Core.unName (var "typeName")]) [+ DC.field _Term_union $ DC.lambda "inj" $ DC.lets [+ ("tname", DC.project _Injection _Injection_typeName @@@ DC.var "inj"),+ ("field", DC.project _Injection _Injection_field @@@ DC.var "inj"),+ ("fname", DC.project _Field _Field_name @@@ DC.var "field"),+ ("fterm", DC.project _Field _Field_term @@@ DC.var "field"),+ ("variantMap", DC.primitive _maps_fromList+ @@@ (DC.list $ Lists.map (var "toVariantPair") $ Core.rowTypeFields $ var "rt"))] $+ DC.primitive _maybes_maybe+ @@@ (DC.left $ DC.wrap _DecodingError $ DC.primitive _strings_cat+ @@@ (DC.list $ list [+ DC.string $ string "no such field ",+ DC.unwrap _Name @@@ DC.var "fname",+ DC.string $ string " in union type ",+ DC.unwrap _Name @@@ DC.var "tname"]))+ @@@ (DC.lambda "f" $ DC.var "f" @@@ DC.var "fterm")+ @@@ (DC.primitive _maps_lookup+ @@@ DC.var "fname"+ @@@ DC.var "variantMap")]++-- | Generate a decoder for a wrapped type+decodeWrappedType :: TBinding (WrappedType -> Term)+decodeWrappedType = define "decodeWrappedType" $+ doc "Generate a decoder for a wrapped type" $+ "wt" ~>+ "bodyDecoder" <~ decodeType @@ Core.wrappedTypeBody (var "wt") $+ -- Note: We can't use decodeWrapped directly because we need to re-wrap the result+ -- with the specific type name. This is one case where the helper pattern doesn't fully apply.+ deannotateAndMatch+ (just $ leftError (+ Strings.cat $ list [+ string "expected wrapped type ",+ Core.unName (Core.wrappedTypeTypeName (var "wt"))])) [+ DC.field _Term_wrap $ DC.lambda "wrappedTerm" $+ DC.primitive _eithers_map+ @@@ (DC.lambda "b" $ DC.wrapDynamic (Core.wrappedTypeTypeName $ var "wt") (DC.var "b"))+ @@@ (var "bodyDecoder" @@@ DC.var "cx"+ @@@ (DC.project _WrappedTerm _WrappedTerm_body @@@ DC.var "wrappedTerm"))]++-- | Filter bindings to only decodable type definitions+filterTypeBindings :: TBinding ([Binding] -> Flow Graph [Binding])+filterTypeBindings = define "filterTypeBindings" $+ doc "Filter bindings to only decodable type definitions" $+ "bindings" ~>+ Flows.map (primitive _maybes_cat) $+ Flows.mapList isDecodableBinding $+ primitive _lists_filter @@ Annotations.isNativeType @@ var "bindings"++-- | Check if a binding is decodable and return Just binding if so, Nothing otherwise+isDecodableBinding :: TBinding (Binding -> Flow Graph (Maybe Binding))+isDecodableBinding = define "isDecodableBinding" $+ doc "Check if a binding is decodable (serializable type)" $+ "b" ~>+ Flows.map+ ("serializable" ~> Logic.ifElse (var "serializable") (just (var "b")) nothing)+ (Schemas.isSerializableByName @@ (Core.bindingName (var "b")))
− src/main/haskell/Hydra/Sources/Kernel/Terms/Describe/Core.hs
@@ -1,114 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Describe.Core where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Describe.Mantle as DescribeMantle-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants---module_ :: Module-module_ = Module (Namespace "hydra.describe.core") elements- [DescribeMantle.module_, Variants.module_]- kernelTypesModules $- Just "Natural-language descriptions for hydra.core types"- where- elements = [- el floatTypeDef,- el integerTypeDef,- el literalTypeDef,- el typeDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--floatTypeDef :: TBinding (FloatType -> String)-floatTypeDef = define "floatType" $- doc "Display a floating-point type as a string" $- lambda "t" $ (ref DescribeMantle.precisionDef <.> ref Variants.floatTypePrecisionDef @@ var "t") ++ string " floating-point number"--integerTypeDef :: TBinding (IntegerType -> String)-integerTypeDef = define "integerType" $- doc "Display an integer type as a string" $- lambda "t" $ (ref DescribeMantle.precisionDef <.> ref Variants.integerTypePrecisionDef @@ var "t")- ++ string " integer"--literalTypeDef :: TBinding (LiteralType -> String)-literalTypeDef = define "literalType" $- doc "Display a literal type as a string" $- match _LiteralType Nothing [- _LiteralType_binary>>: constant $ string "binary string",- _LiteralType_boolean>>: constant $ string "boolean value",- _LiteralType_float>>: ref floatTypeDef,- _LiteralType_integer>>: ref integerTypeDef,- _LiteralType_string>>: constant $ string "character string"]--typeDef :: TBinding (Type -> String)-typeDef = define "type" $- doc "Display a type as a string" $- match _Type Nothing [- _Type_annotated>>: lambda "a" $ string "annotated " ++ (ref typeDef @@- (project _AnnotatedType _AnnotatedType_subject @@ var "a")),- _Type_application>>: lambda "at" $ Strings.cat $ list [- ref typeDef @@ (Core.applicationTypeFunction $ var "at"),- string " applied to ",- ref typeDef @@ (Core.applicationTypeArgument $ var "at")],- _Type_literal>>: ref literalTypeDef,- _Type_function>>: lambda "ft" $ string "function from "- ++ (ref typeDef @@ (project _FunctionType _FunctionType_domain @@ var "ft"))- ++ string " to "- ++ (ref typeDef @@ (project _FunctionType _FunctionType_codomain @@ var "ft")),- _Type_forall>>: lambda "fat" $ Strings.cat2 (string "polymorphic ") (ref typeDef @@ (Core.forallTypeBody $ var "fat")),- _Type_list>>: lambda "t" $ string "list of " ++ (ref typeDef @@ var "t"),- _Type_map>>: lambda "mt" $ string "map from "- ++ (ref typeDef @@ (project _MapType _MapType_keys @@ var "mt"))- ++ string " to "- ++ (ref typeDef @@ (project _MapType _MapType_values @@ var "mt")),- _Type_optional>>: lambda "ot" $ string "optional " ++ (ref typeDef @@ var "ot"),- _Type_product>>: constant $ string "tuple",- _Type_record>>: constant $ string "record",- _Type_set>>: lambda "st" $ string "set of " ++ (ref typeDef @@ var "st"),- _Type_sum>>: constant $ string "variant tuple",- _Type_union>>: constant $ string "union",- _Type_unit>>: constant $ string "unit",- _Type_variable>>: constant $ string "instance of a named type",- _Type_wrap>>: lambda "n" $ string "wrapper for "- ++ (ref typeDef @@ (project _WrappedType _WrappedType_object @@ var "n"))]
− src/main/haskell/Hydra/Sources/Kernel/Terms/Describe/Mantle.hs
@@ -1,62 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Describe.Mantle where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---module_ :: Module-module_ = Module (Namespace "hydra.describe.mantle") elements- []- kernelTypesModules $- Just "Natural-language descriptions for hydra.mantle types"- where- elements = [- el precisionDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--precisionDef :: TBinding (Precision -> String)-precisionDef = define "precision" $- doc "Display numeric precision as a string" $- match _Precision Nothing [- _Precision_arbitrary>>: constant $ string "arbitrary-precision",- _Precision_bits>>: lambda "bits" $ Literals.showInt32 (var "bits") ++ string "-bit"]
− src/main/haskell/Hydra/Sources/Kernel/Terms/Encode/Core.hs
@@ -1,507 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Encode.Core where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting--import qualified Hydra.Encode.Core as EncodeCore---module_ :: Module-module_ = Module (Namespace "hydra.encode.core") elements- [Rewriting.module_]- kernelTypesModules $- Just ("Mapping of hydra.core constructs in a host language like Haskell or Java "- <> " to their native Hydra counterparts as terms. "- <> " This includes an implementation of LambdaGraph's epsilon encoding (types to terms).")- where- elements = encodingElements <> extraElements- encodingElements = [- el annotatedTermDef,- el annotatedTypeDef,- el applicationDef,- el applicationTypeDef,- el caseStatementDef,- el eliminationDef,- el fieldDef,- el fieldTypeDef,- el floatTypeDef,- el floatValueDef,- el functionDef,- el functionTypeDef,- el injectionDef,- el integerTypeDef,- el integerValueDef,- el lambdaDef,- el forallTypeDef,- el letDef,- el letBindingDef,- el literalDef,- el literalTypeDef,- el mapTypeDef,- el nameDef,- el projectionDef,- el recordDef,- el rowTypeDef,- el sumDef,- el termDef,- el tupleProjectionDef,- el typeDef,- el typeLambdaDef,- el typeSchemeDef,- el typedTermDef,- el wrappedTermDef,- el wrappedTypeDef]- -- TODO: move these into another module- extraElements = [- el isEncodedTypeDef,- el isTypeDef,- el isUnitTermDef,- el isUnitTypeDef]--define :: String -> TTerm x -> TBinding x-define label = definitionInModule module_ (decapitalize label)--coreEncodingExtrasDefinition :: String -> TTerm a -> TBinding a-coreEncodingExtrasDefinition = definitionInModule module_--encodedBinary :: TTerm String -> TTerm Term-encodedBinary = encodedLiteral . Core.literalBinary--encodedBoolean :: TTerm Bool -> TTerm Term-encodedBoolean = encodedLiteral . Core.literalBoolean--encodedCase :: Name -> Name -> TTerm (a -> Term) -> Field-encodedCase tname fname enc = field fname $ lambda "v" $ encodedVariant tname fname (enc @@ var "v")--encodedField :: Name -> TTerm Term -> TTerm Term-encodedField fname term = encodedFieldRaw (encodedName fname) term--encodedFieldRaw :: TTerm Name -> TTerm Term -> TTerm Term-encodedFieldRaw (TTerm fname) (TTerm term) = TTerm $ Terms.record _Field [- Field _Field_name fname,- Field _Field_term term]--encodedFloatValue :: TTerm FloatValue -> TTerm Term-encodedFloatValue = encodedLiteral . Core.literalFloat--encodedInjection :: Name -> Name -> TTerm Term -> TTerm Term-encodedInjection tname fname term = TTerm $ Terms.record _Injection [- field _Injection_typeName $ encodedName tname,- field _Injection_field $ encodedField fname term]--encodedInt32 :: TTerm Int -> TTerm Term-encodedInt32 v = encodedIntegerValue $ variant _IntegerValue _IntegerValue_int32 v--encodedIntegerValue :: TTerm IntegerValue -> TTerm Term-encodedIntegerValue = encodedLiteral . Core.literalInteger--encodedList :: TTerm [a] -> TTerm Term-encodedList = variant _Term _Term_list--encodedLiteral :: TTerm Literal -> TTerm Term-encodedLiteral = variant _Term _Term_literal--encodedMap :: TTerm (M.Map k v) -> TTerm Term-encodedMap = variant _Term _Term_map--encodedName :: Name -> TTerm Name-encodedName = wrap _Name . string . unName--encodedWrappedTerm :: Name -> TTerm Term -> TTerm Term-encodedWrappedTerm name = encodedWrappedTermRaw (encodedName name)--encodedWrappedTermRaw :: TTerm Name -> TTerm Term -> TTerm Term-encodedWrappedTermRaw (TTerm name) (TTerm term) = TTerm $ Terms.variant _Term _Term_wrap $ Terms.record _WrappedTerm [- Field _WrappedTerm_typeName name,- Field _WrappedTerm_object term]--encodedOptional :: TTerm (Maybe a) -> TTerm Term-encodedOptional = variant _Term _Term_optional--encodedRecord :: Name -> [Field] -> TTerm Term-encodedRecord tname fields = TTerm $ Terms.variant _Term _Term_record $ Terms.record _Record [- field _Record_typeName $ encodedName tname,- field _Record_fields $ list (encField <$> fields)]- where- encField (Field fname term) = encodedField fname $ TTerm term--encodedSet :: TTerm (S.Set a) -> TTerm Term-encodedSet = variant _Term _Term_set--encodedString :: TTerm String -> TTerm Term-encodedString = encodedLiteral . variant _Literal _Literal_string--encodedUnion :: TTerm Term -> TTerm Term-encodedUnion = variant _Term _Term_union--encodedVariant :: Name -> Name -> TTerm Term -> TTerm Term-encodedVariant tname fname term = encodedUnion $ encodedInjection tname fname term--annotatedTermDef :: TBinding (AnnotatedTerm -> Term)-annotatedTermDef = define "AnnotatedTerm" $- lambda "a" $ variant _Term _Term_annotated $ record _AnnotatedTerm [- field _AnnotatedTerm_subject $ ref termDef @@ (Core.annotatedTermSubject $ var "a"),- field _AnnotatedTerm_annotation $ Core.annotatedTermAnnotation $ var "a"]--annotatedTypeDef :: TBinding (AnnotatedType -> Term)-annotatedTypeDef = define "AnnotatedType" $- lambda "at" $ variant _Term _Term_annotated $ record _AnnotatedTerm [- field _AnnotatedTerm_subject $ ref typeDef @@ (Core.annotatedTypeSubject $ var "at"),- field _AnnotatedTerm_annotation $ Core.annotatedTypeAnnotation $ var "at"]--applicationDef :: TBinding (Application -> Term)-applicationDef = define "Application" $- lambda "app" $ encodedRecord _Application [- field _Application_function $ ref termDef @@ (Core.applicationFunction $ var "app"),- field _Application_argument $ ref termDef @@ (Core.applicationArgument $ var "app")]--applicationTypeDef :: TBinding (ApplicationType -> Term)-applicationTypeDef = define "ApplicationType" $- lambda "at" $ encodedRecord _ApplicationType [- field _ApplicationType_function $ ref typeDef @@ (Core.applicationTypeFunction $ var "at"),- field _ApplicationType_argument $ ref typeDef @@ (Core.applicationTypeArgument $ var "at")]--caseStatementDef :: TBinding (CaseStatement -> Term)-caseStatementDef = define "CaseStatement" $- lambda "cs" $ encodedRecord _CaseStatement [- field _CaseStatement_typeName $ ref nameDef @@ (Core.caseStatementTypeName $ var "cs"),- field _CaseStatement_default $ encodedOptional- (primitive _optionals_map @@ ref termDef @@ (Core.caseStatementDefault $ var "cs")),- field _CaseStatement_cases $ encodedList- (primitive _lists_map @@ ref fieldDef @@ (Core.caseStatementCases $ var "cs"))]--eliminationDef :: TBinding (Elimination -> Term)-eliminationDef = define "Elimination" $- match _Elimination Nothing [- ecase _Elimination_product tupleProjectionDef,- ecase _Elimination_record projectionDef,- ecase _Elimination_union caseStatementDef,- ecase _Elimination_wrap nameDef]- where- ecase fname funname = encodedCase _Elimination fname (ref funname)--fieldDef :: TBinding (Field -> Term)-fieldDef = define "Field" $- lambda "f" $ encodedRecord _Field [- field _Field_name $ encodedWrappedTerm _Name $ encodedString $ (unwrap _Name @@ (Core.fieldName $ var "f")),- field _Field_term $ ref termDef @@ (Core.fieldTerm $ var "f")]--fieldTypeDef :: TBinding (FieldType -> Term)-fieldTypeDef = define "FieldType" $- lambda "ft" $ encodedRecord _FieldType [- field _FieldType_name $ ref nameDef @@ (Core.fieldTypeName $ var "ft"),- field _FieldType_type $ ref typeDef @@ (Core.fieldTypeType $ var "ft")]--floatTypeDef :: TBinding (FloatType -> Term)-floatTypeDef = define "FloatType" $- match _FloatType Nothing (cs <$> [- _FloatType_bigfloat,- _FloatType_float32,- _FloatType_float64])- where- cs fname = field fname $ constant $ TTerm $ EncodeCore.term $ unTTerm $ unitVariant _FloatType fname--floatValueDef :: TBinding (FloatValue -> Term)-floatValueDef = define "FloatValue" $- match _FloatValue Nothing (varField <$> [- _FloatValue_bigfloat,- _FloatValue_float32,- _FloatValue_float64])- where- varField fname = field fname $ lambda "v" $ encodedVariant _FloatValue fname $ encodedFloatValue $- variant _FloatValue fname $ var "v"--functionDef :: TBinding (Function -> Term)-functionDef = define "Function" $- match _Function Nothing [- ecase _Function_elimination eliminationDef,- ecase _Function_lambda lambdaDef,- ecase _Function_primitive nameDef]- where- ecase fname funname = encodedCase _Function fname (ref funname)--functionTypeDef :: TBinding (FunctionType -> Term)-functionTypeDef = define "FunctionType" $- lambda "ft" $ encodedRecord _FunctionType [- field _FunctionType_domain $ ref typeDef @@ (Core.functionTypeDomain $ var "ft"),- field _FunctionType_codomain $ ref typeDef @@ (Core.functionTypeCodomain $ var "ft")]--injectionDef :: TBinding (Injection -> Term)-injectionDef = define "Injection" $- lambda "i" $ encodedRecord _Injection [- field _Injection_typeName $ ref nameDef @@ (Core.injectionTypeName $ var "i"),- field _Injection_field $ ref fieldDef @@ (Core.injectionField $ var "i")]--integerTypeDef :: TBinding (IntegerType -> Term)-integerTypeDef = define "IntegerType" $- match _IntegerType Nothing (cs <$> [- _IntegerType_bigint,- _IntegerType_int8,- _IntegerType_int16,- _IntegerType_int32,- _IntegerType_int64,- _IntegerType_uint8,- _IntegerType_uint16,- _IntegerType_uint32,- _IntegerType_uint64])- where- cs fname = field fname $ constant $ TTerm $ EncodeCore.term $ unTTerm $ unitVariant _IntegerType fname--integerValueDef :: TBinding (IntegerValue -> Term)-integerValueDef = define "IntegerValue" $- match _IntegerValue Nothing (varField <$> [- _IntegerValue_bigint,- _IntegerValue_int8,- _IntegerValue_int16,- _IntegerValue_int32,- _IntegerValue_int64,- _IntegerValue_uint8,- _IntegerValue_uint16,- _IntegerValue_uint32,- _IntegerValue_uint64])- where- varField fname = field fname $ lambda "v" $ encodedVariant _IntegerValue fname $ encodedIntegerValue $- variant _IntegerValue fname $ var "v"--lambdaDef :: TBinding (Lambda -> Term)-lambdaDef = define "Lambda" $- lambda "l" $ encodedRecord _Lambda [- field _Lambda_parameter $ ref nameDef @@ (Core.lambdaParameter $ var "l"),- field _Lambda_domain $ encodedOptional $ primitive _optionals_map @@ ref typeDef @@ (Core.lambdaDomain $ var "l"),- field _Lambda_body $ ref termDef @@ (Core.lambdaBody $ var "l")]--forallTypeDef :: TBinding (ForallType -> Term)-forallTypeDef = define "ForallType" $- lambda "lt" $ encodedRecord _ForallType [- field _ForallType_parameter $ ref nameDef @@ (Core.forallTypeParameter $ var "lt"),- field _ForallType_body $ ref typeDef @@ (Core.forallTypeBody $ var "lt")]--letDef :: TBinding (Let -> Term)-letDef = define "Let" $- lambda "l" $ encodedRecord _Let [- field _Let_bindings $ encodedList (primitive _lists_map @@ ref letBindingDef @@ (Core.letBindings $ var "l")),- field _Let_environment $ ref termDef @@ (Core.letEnvironment $ var "l")]--letBindingDef :: TBinding (Binding -> Term)-letBindingDef = define "Binding" $- lambda "b" $ encodedRecord _Binding [- field _Binding_name $ ref nameDef @@ (Core.bindingName $ var "b"),- field _Binding_term $ ref termDef @@ (Core.bindingTerm $ var "b"),- field _Binding_type $ encodedOptional $ primitive _optionals_map @@ ref typeSchemeDef @@ (Core.bindingType $ var "b")]--literalDef :: TBinding (Literal -> Term)-literalDef = define "Literal" $- match _Literal Nothing [- varField _Literal_binary $ encodedBinary $ var "v",- varField _Literal_boolean $ encodedBoolean $ var "v",- varField _Literal_float (ref floatValueDef @@ var "v"),- varField _Literal_integer (ref integerValueDef @@ var "v"),- varField _Literal_string $ encodedString $ var "v"]- where- varField fname = field fname . lambda "v" . encodedVariant _Literal fname--literalTypeDef :: TBinding (LiteralType -> Term)-literalTypeDef = define "LiteralType" $- match _LiteralType Nothing [- csunit _LiteralType_binary,- csunit _LiteralType_boolean,- cs _LiteralType_float floatTypeDef,- cs _LiteralType_integer integerTypeDef,- csunit _LiteralType_string]- where- cs fname fun = field fname $ lambda "v" $ encodedVariant _LiteralType fname (ref fun @@ var "v")- csunit fname = field fname $ constant $ TTerm $ EncodeCore.term $ unTTerm $ variant _LiteralType fname unit--mapTypeDef :: TBinding (MapType -> Term)-mapTypeDef = define "MapType" $- lambda "mt" $ encodedRecord _MapType [- field _MapType_keys $ ref typeDef @@ (Core.mapTypeKeys $ var "mt"),- field _MapType_values $ ref typeDef @@ (Core.mapTypeValues $ var "mt")]--nameDef :: TBinding (Name -> Term)-nameDef = define "Name" $- lambda "fn" $ encodedWrappedTerm _Name $ encodedString $ unwrap _Name @@ var "fn"--projectionDef :: TBinding (Projection -> Term)-projectionDef = define "Projection" $- lambda "p" $ encodedRecord _Projection [- field _Projection_typeName $ ref nameDef @@ (Core.projectionTypeName $ var "p"),- field _Projection_field $ ref nameDef @@ (Core.projectionField $ var "p")]--recordDef :: TBinding (Record -> Term)-recordDef = define "Record" $- lambda "r" $ encodedRecord _Record [- field _Record_typeName $ ref nameDef @@ (Core.recordTypeName $ var "r"),- field _Record_fields $ encodedList (primitive _lists_map @@ (ref fieldDef) @@ (Core.recordFields $ var "r"))]--rowTypeDef :: TBinding (RowType -> Term)-rowTypeDef = define "RowType" $- lambda "rt" $ encodedRecord _RowType [- field _RowType_typeName $ ref nameDef @@ (Core.rowTypeTypeName $ var "rt"),- field _RowType_fields $ encodedList (primitive _lists_map @@ ref fieldTypeDef @@ (Core.rowTypeFields $ var "rt"))]--sumDef :: TBinding (Sum -> Term)-sumDef = define "Sum" $- lambda "s" $ encodedRecord _Sum [- field _Sum_index $ encodedInt32 $ Core.sumIndex $ var "s",- field _Sum_size $ encodedInt32 $ Core.sumSize $ var "s",- field _Sum_term $ ref termDef @@ (Core.sumTerm $ var "s")]--termDef :: TBinding (Term -> Term)-termDef = define "Term" $- match _Term Nothing [- ecase _Term_annotated (ref annotatedTermDef),- ecase _Term_application (ref applicationDef),- ecase _Term_function (ref functionDef),- ecase _Term_let (ref letDef),- ecase _Term_literal (ref literalDef),- ecase2 _Term_list $ encodedList $ primitive _lists_map @@ (ref termDef) @@ var "v",- ecase2 _Term_map $ encodedMap (primitive _maps_bimap @@ ref termDef @@ ref termDef @@ var "v"),- ecase2 _Term_optional $ encodedOptional (primitive _optionals_map @@ ref termDef @@ var "v"),- ecase2 _Term_product $ encodedList (primitive _lists_map @@ ref termDef @@ var "v"),- ecase _Term_record (ref recordDef),- ecase2 _Term_set $ encodedSet $ primitive _sets_map @@ (ref termDef) @@ var "v",- ecase _Term_sum (ref sumDef),- ecase _Term_typeLambda $ ref typeLambdaDef,- ecase _Term_typeApplication $ ref typedTermDef,- ecase _Term_union (ref injectionDef),- ecase _Term_unit $ constant Core.termUnit,- ecase _Term_variable $ ref nameDef,- ecase _Term_wrap $ ref wrappedTermDef]- where- ecase = encodedCase _Term- ecase2 fname = field fname . lambda "v" . encodedVariant _Term fname--tupleProjectionDef :: TBinding (TupleProjection -> Term)-tupleProjectionDef = define "TupleProjection" $- lets [- "encodeTypes">: lambda "types" $ encodedList $ primitive _lists_map @@ ref typeDef @@ var "types"] $- lambda "tp" $ encodedRecord _TupleProjection [- field _TupleProjection_arity $ encodedInt32 $ Core.tupleProjectionArity $ var "tp",- field _TupleProjection_index $ encodedInt32 $ Core.tupleProjectionIndex $ var "tp",- field _TupleProjection_domain $ encodedOptional $ primitive _optionals_map @@ var "encodeTypes" @@ (Core.tupleProjectionDomain $ var "tp")]--typeDef :: TBinding (Type -> Term)-typeDef = define "Type" $- match _Type Nothing [- field _Type_annotated $ lambda "v" $ variant _Term _Term_annotated $ record _AnnotatedTerm [- field _AnnotatedTerm_subject $ ref typeDef @@ (Core.annotatedTypeSubject $ var "v"),- field _AnnotatedTerm_annotation $ Core.annotatedTypeAnnotation $ var "v"],- csref _Type_application applicationTypeDef,- csref _Type_function functionTypeDef,- csref _Type_forall forallTypeDef,- csref _Type_list typeDef,- csref _Type_literal literalTypeDef,- csref _Type_map mapTypeDef,- csref _Type_optional typeDef,- cs _Type_product $ encodedList $ primitive _lists_map @@ ref typeDef @@ var "v",- csref _Type_record rowTypeDef,- csref _Type_set typeDef,- cs _Type_sum $ encodedList $ primitive _lists_map @@ ref typeDef @@ var "v",- csref _Type_union rowTypeDef,- field _Type_unit $ constant $ encodedVariant _Type _Type_unit Core.termUnit,- csref _Type_variable nameDef,- csref _Type_wrap wrappedTypeDef]- where- cs fname term = field fname $ lambda "v" $ encodedVariant _Type fname term- csref fname fun = cs fname (ref fun @@ var "v")--typeLambdaDef :: TBinding (TypeLambda -> Term)-typeLambdaDef = define "TypeLambda" $- lambda "l" $ encodedRecord _TypeLambda [- field _TypeLambda_parameter $ ref nameDef @@ (project _TypeLambda _TypeLambda_parameter @@ var "l"),- field _TypeLambda_body $ ref termDef @@ (project _TypeLambda _TypeLambda_body @@ var "l")]--typeSchemeDef :: TBinding (TypeScheme -> Term)-typeSchemeDef = define "TypeScheme" $- lambda "ts" $ encodedRecord _TypeScheme [- field _TypeScheme_variables $ encodedList (primitive _lists_map @@ ref nameDef @@ (Core.typeSchemeVariables $ var "ts")),- field _TypeScheme_type $ ref typeDef @@ (Core.typeSchemeType $ var "ts")]--typedTermDef :: TBinding (TypedTerm -> Term)-typedTermDef = define "TypedTerm" $- lambda "tt" $ encodedRecord _TypedTerm [- field _TypedTerm_term $ ref termDef @@ (project _TypedTerm _TypedTerm_term @@ var "tt"),- field _TypedTerm_type $ ref typeDef @@ (project _TypedTerm _TypedTerm_type @@ var "tt")]--wrappedTermDef :: TBinding (WrappedTerm -> Term)-wrappedTermDef = define "WrappedTerm" $- lambda "n" $ encodedRecord _WrappedTerm [- field _WrappedTerm_typeName $ ref nameDef @@ (Core.wrappedTermTypeName $ var "n"),- field _WrappedTerm_object $ ref termDef @@ (Core.wrappedTermObject $ var "n")]--wrappedTypeDef :: TBinding (WrappedType -> Term)-wrappedTypeDef = define "WrappedType" $- lambda "nt" $ encodedRecord _WrappedType [- field _WrappedType_typeName $ ref nameDef @@ (Core.wrappedTypeTypeName $ var "nt"),- field _WrappedType_object $ ref typeDef @@ (Core.wrappedTypeObject $ var "nt")]---- TODO: move these into another module--isEncodedTypeDef :: TBinding (Term -> Bool)-isEncodedTypeDef = coreEncodingExtrasDefinition "isEncodedType" $- doc "Determines whether a given term is an encoded type" $- lambda "t" $ cases _Term (ref Rewriting.deannotateTermDef @@ var "t") (Just false) [- _Term_application>>: lambda "a" $- ref isEncodedTypeDef @@ (Core.applicationFunction $ var "a"),- _Term_union>>: lambda "i" $- Equality.equal (string $ unName _Type) (Core.unName $ (Core.injectionTypeName $ var "i"))]--isTypeDef :: TBinding (Type -> Bool)-isTypeDef = coreEncodingExtrasDefinition "isType" $- lambda "t" $ cases _Type (ref Rewriting.deannotateTypeDef @@ var "t") (Just false) [- _Type_application>>: lambda "a" $- ref isTypeDef @@ (Core.applicationTypeFunction $ var "a"),- _Type_forall>>: lambda "l" $- ref isTypeDef @@ (Core.forallTypeBody $ var "l"),- _Type_union>>: lambda "rt" $- Equality.equal (string $ unName _Type) (Core.unName $ (Core.rowTypeTypeName $ var "rt")),- _Type_variable>>: lambda "v" $ Equality.equal (var "v") (Core.nameLift _Type)]--isUnitTermDef :: TBinding (Term -> Bool)-isUnitTermDef = coreEncodingExtrasDefinition "isUnitTerm" $- match _Term (Just false) [_Term_unit>>: constant true]--isUnitTypeDef :: TBinding (Type -> Bool)-isUnitTypeDef = coreEncodingExtrasDefinition "isUnitType" $- match _Type (Just false) [_Type_unit>>: constant true]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Encoding.hs view
@@ -0,0 +1,492 @@+{-# LANGUAGE FlexibleContexts #-}++module Hydra.Sources.Kernel.Terms.Encoding where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (literalType)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (+ elimination, field, fieldType, floatType, floatValue, function, injection, integerType, integerValue, lambda, literal,+ literalType, record, term, type_, typeScheme, wrap)+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Dsl.Meta.DeepCore as DC+import Hydra.Dsl.Meta.DeepCore ((@@@))+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+++ns :: Namespace+ns = Namespace "hydra.encoding"++module_ :: Module+module_ = Module ns elements+ [Annotations.ns, moduleNamespace DecodeCore.module_, Formatting.ns, Monads.ns, Names.ns, Schemas.ns]+ kernelTypesNamespaces $+ Just "Functions for generating term encoders from type modules"+ where+ elements = [+ toBinding encodeBinding,+ toBinding encodeBindingName,+ toBinding encodeFieldValue,+ toBinding encodeFloatValue,+ toBinding encodeInjection,+ toBinding encodeIntegerValue,+ toBinding encodeListType,+ toBinding encodeLiteralType,+ toBinding encodeEitherType,+ toBinding encodeForallType,+ toBinding encodeMapType,+ toBinding encodeOptionalType,+ toBinding encodePairType,+ toBinding encodeModule,+ toBinding encodeName,+ toBinding encodeNamespace,+ toBinding encodeRecordType,+ toBinding encodeSetType,+ toBinding encodeType,+ toBinding encodeUnionType,+ toBinding encodeWrappedType,+ toBinding filterTypeBindings,+ toBinding isEncodableBinding,+ toBinding isUnitType_]++define :: String -> TTerm x -> TBinding x+define = definitionInModule module_++-- | Encode a single type binding into an encoder binding+-- This decodes the term to a Type, then generates an encoder function+encodeBinding :: TBinding (Binding -> Flow Graph Binding)+encodeBinding = define "encodeBinding" $+ doc "Transform a type binding into an encoder binding" $+ "b" ~>+ "cx" <<~ Monads.getState $+ Flows.bind (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ (Core.bindingTerm (var "b")))) (+ "typ" ~>+ Flows.pure (Core.binding+ (encodeBindingName @@ (Core.bindingName (var "b")))+ (encodeType @@ (var "typ"))+ nothing))++-- | Generate a fully qualified binding name for an encoder function from a type name+-- For example, "hydra.core.Name" -> "hydra.encode.core.name"+-- For local types (no namespace), returns just the decapitalized local name+encodeBindingName :: TBinding (Name -> Name)+encodeBindingName = define "encodeBindingName" $+ doc "Generate a binding name for an encoder function from a type name" $+ "n" ~>+ -- Check if name has a namespace (contains ".")+ Logic.ifElse (Logic.not (Lists.null+ (Lists.tail (Strings.splitOn (string ".") (Core.unName (var "n"))))))+ -- Qualified type: e.g., "hydra.core.Name" -> "hydra.encode.core.name"+ (Core.name (+ Strings.intercalate (string ".") (+ Lists.concat2+ (list [string "hydra", string "encode"])+ (Lists.concat2+ (Lists.tail (Lists.init (Strings.splitOn (string ".") (Core.unName (var "n")))))+ (list [Formatting.decapitalize @@ (Names.localNameOf @@ (var "n"))])))))+ -- Local type: just decapitalize+ (Core.name (Formatting.decapitalize @@ (Names.localNameOf @@ (var "n"))))++-- | Generate the encoder term for a field value+-- Creates a lambda that encodes the field value and wraps in an encoded union/injection+encodeFieldValue :: TBinding (Name -> Name -> Type -> Term)+encodeFieldValue = define "encodeFieldValue" $+ doc "Generate the encoder for a field's value" $+ "typeName" ~> "fieldName" ~> "fieldType" ~>+ -- Create a lambda that encodes the value and wraps in Term.union with injection+ -- Note: use "y" instead of "v" to avoid shadowing type variable parameters named "v"+ DC.lambda "y" $+ -- Build Term.union containing an encoded Injection with the encoded value+ DC.injection _Term (DC.field _Term_union+ (encodeInjection @@ var "typeName" @@ var "fieldName"+ @@ ((encodeType @@ var "fieldType") @@@ DC.var "y")))++-- | Encode an Injection as a Term (produces a Record of type hydra.core.Injection)+encodeInjection :: TBinding (Name -> Name -> Term -> Term)+encodeInjection = define "encodeInjection" $+ doc "Encode an Injection as a term" $+ "typeName" ~> "fieldName" ~> "fieldTerm" ~> DC.record _Injection [+ DC.field _Injection_typeName (encodeName @@ var "typeName"),+ DC.field _Injection_field (encodeField @@ var "fieldName" @@ var "fieldTerm")]+ where+ -- Encode a Field as a Term (produces a Record of type hydra.core.Field)+ encodeField :: TTerm (Name -> Term -> Term)+ encodeField = "fname" ~> "fterm" ~> DC.record _Field [+ DC.field _Field_name (encodeName @@ var "fname"),+ DC.field _Field_term (var "fterm")]++-- | Generate an encoder for a literal type+-- For literals, the input is a native Haskell value (e.g., String, Int32).+-- We need to wrap it in encoded TermLiteral with the appropriate Literal constructor.+encodeLiteralType :: TBinding (LiteralType -> Term)+encodeLiteralType = define "encodeLiteralType" $+ doc "Generate an encoder for a literal type" $+ match _LiteralType (Just identityEncoder) [+ _LiteralType_binary>>: constant $+ DC.lambda "x" $ termLiteral $ DC.injection _Literal (DC.field _Literal_binary (DC.var "x")),+ _LiteralType_boolean>>: constant $+ DC.lambda "x" $ termLiteral $ DC.injection _Literal (DC.field _Literal_boolean (DC.var "x")),+ _LiteralType_string>>: constant $+ DC.lambda "x" $ termLiteral $ DC.injection _Literal (DC.field _Literal_string (DC.var "x")),+ -- For integer types, wrap in Term.literal.integer with the specific integer variant+ _LiteralType_integer>>: "intType" ~>+ DC.lambda "x" $ termLiteral $ DC.injection _Literal+ (DC.field _Literal_integer (encodeIntegerValue @@ var "intType" @@ DC.var "x")),+ -- For float types, wrap in Term.literal.float with the specific float variant+ _LiteralType_float>>: "floatType" ~>+ DC.lambda "x" $ termLiteral $ DC.injection _Literal+ (DC.field _Literal_float (encodeFloatValue @@ var "floatType" @@ DC.var "x"))]+ where+ -- Helper to wrap a Literal value in Term.literal+ termLiteral lit = DC.injection _Term (DC.field _Term_literal lit)+ -- Default: identity (should not be reached for well-formed types)+ identityEncoder = DC.lambda "x" $ DC.var "x"++-- | Transform a type module into an encoder module+-- Returns Nothing if the module has no encodable type definitions+encodeModule :: TBinding (Module -> Flow Graph (Maybe Module))+encodeModule = define "encodeModule" $+ doc "Transform a type module into an encoder module" $+ "mod" ~>+ "typeBindings" <<~ (filterTypeBindings @@ (Module.moduleElements (var "mod"))) $+ Logic.ifElse (Lists.null (var "typeBindings"))+ (Flows.pure nothing)+ (Flows.bind (Flows.mapList encodeBinding (var "typeBindings")) (+ "encodedBindings" ~>+ -- The encoder module depends on encoder modules for the type dependencies+ -- E.g., hydra.encode.module depends on hydra.encode.core+ Flows.pure (just (Module.module_+ (encodeNamespace @@ (Module.moduleNamespace (var "mod")))+ (var "encodedBindings")+ -- Transform each type dependency namespace to its encoder namespace+ (primitive _lists_map @@ encodeNamespace @@ (Module.moduleTypeDependencies (var "mod")))+ -- The encoder module depends on the original type module+ (list [Module.moduleNamespace (var "mod")])+ (just (Strings.cat $ list [+ string "Term encoders for ",+ Module.unNamespace (Module.moduleNamespace (var "mod"))]))))))++-- | Encode a Name as a Term (produces a wrapped term of type hydra.core.Name)+encodeName :: TBinding (Name -> Term)+encodeName = define "encodeName" $+ doc "Encode a Name as a term" $+ "n" ~> DC.wrap _Name (DC.string (Core.unName (var "n")))++-- | Generate an encoder module namespace from a source module namespace+-- For example, "hydra.util" -> "hydra.encode.util"+encodeNamespace :: TBinding (Namespace -> Namespace)+encodeNamespace = define "encodeNamespace" $+ doc "Generate an encoder module namespace from a source module namespace" $+ "ns" ~> (+ Module.namespace (+ Strings.cat $ list [+ string "hydra.encode.",+ Strings.intercalate (string ".")+ (Lists.tail (Strings.splitOn (string ".") (Module.unNamespace (var "ns"))))]))++-- | Generate an encoder for a record type+-- For records, project each field, encode it, and build an encoded record+encodeRecordType :: TBinding (RowType -> Term)+encodeRecordType = define "encodeRecordType" $+ doc "Generate an encoder for a record type" $+ "rt" ~>+ DC.lambda "x" $+ DC.injection _Term (DC.field _Term_record+ (DC.record _Record [+ DC.field _Record_typeName (encodeName @@ Core.rowTypeTypeName (var "rt")),+ DC.field _Record_fields+ (DC.list (primitive _lists_map @@ (encodeRecordField @@ var "rt") @@ Core.rowTypeFields (var "rt")))]))+ where+ -- Helper to encode a single record field+ -- Takes the record type name and a field type, produces an encoded Field term+ encodeRecordField :: TTerm (RowType -> FieldType -> Term)+ encodeRecordField =+ "recType" ~> "ft" ~>+ DC.record _Field [+ DC.field _Field_name (encodeName @@ Core.fieldTypeName (var "ft")),+ DC.field _Field_term+ ((encodeType @@ Core.fieldTypeType (var "ft"))+ @@@ (projectField (Core.rowTypeTypeName (var "recType")) (Core.fieldTypeName (var "ft"))+ @@@ DC.var "x"))]++ -- Helper to create a field projection term+ projectField typeName fieldName =+ Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $+ Core.projection typeName fieldName++-- | Generate an encoder term for a given Type+-- This generates a function that encodes values of the type to Terms+encodeType :: TBinding (Type -> Term)+encodeType = define "encodeType" $+ doc "Generate an encoder term for a Type" $+ match _Type (Just identityEncoder) [+ _Type_annotated>>: "at" ~>+ -- Strip annotation and recurse+ encodeType @@ Core.annotatedTypeBody (var "at"),+ _Type_application>>: "appType" ~>+ -- For type applications like (DataRow v), apply the function encoder to the argument encoder+ (encodeType @@ Core.applicationTypeFunction (var "appType"))+ @@@ (encodeType @@ Core.applicationTypeArgument (var "appType")),+ _Type_either>>: "et" ~>+ encodeEitherType @@ var "et",+ _Type_forall>>: "ft" ~>+ encodeForallType @@ var "ft",+ _Type_function>>: constant $+ -- For function types, use identity encoder since functions can't be serialized as data+ identityEncoder,+ _Type_list>>: "elemType" ~>+ encodeListType @@ var "elemType",+ _Type_literal>>: "lt" ~>+ encodeLiteralType @@ var "lt",+ _Type_map>>: "mt" ~>+ encodeMapType @@ var "mt",+ _Type_maybe>>: "elemType" ~>+ encodeOptionalType @@ var "elemType",+ _Type_pair>>: "pt" ~>+ encodePairType @@ var "pt",+ _Type_record>>: "rt" ~>+ encodeRecordType @@ var "rt",+ _Type_set>>: "elemType" ~>+ encodeSetType @@ var "elemType",+ _Type_union>>: "rt" ~>+ encodeUnionType @@ var "rt",+ _Type_wrap>>: "wt" ~>+ encodeWrappedType @@ var "wt",+ _Type_unit>>: constant $+ -- For unit type, return a lambda that ignores input and produces encoded unit term+ DC.lambda "_" $ DC.injection _Term (DC.field _Term_unit DC.unit),+ _Type_variable>>: "typeName" ~>+ -- For type variables (references to other types), generate a reference to that+ -- type's encoder. Uses encodeBindingName which produces fully qualified names.+ Core.termVariable (encodeBindingName @@ var "typeName")]+ where+ identityEncoder = DC.lambda "x" $ DC.var "x"++-- | Generate an encoder for a union type (including enums)+-- Generates a case match over all variants+encodeUnionType :: TBinding (RowType -> Term)+encodeUnionType = define "encodeUnionType" $+ doc "Generate an encoder for a union type" $+ "rt" ~>+ Core.termFunction $ Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement+ (Core.rowTypeTypeName (var "rt"))+ nothing+ (primitive _lists_map @@+ ("ft" ~> Core.field+ (Core.fieldTypeName (var "ft"))+ (encodeFieldValue+ @@ Core.rowTypeTypeName (var "rt")+ @@ Core.fieldTypeName (var "ft")+ @@ Core.fieldTypeType (var "ft")))+ @@ Core.rowTypeFields (var "rt"))++-- | Generate an encoder for a wrapped type+-- Unwraps the value, encodes it, and wraps in encoded TermWrap+encodeWrappedType :: TBinding (WrappedType -> Term)+encodeWrappedType = define "encodeWrappedType" $+ doc "Generate an encoder for a wrapped type" $+ "wt" ~>+ DC.lambda "x" $+ DC.injection _Term (DC.field _Term_wrap+ (DC.record _WrappedTerm [+ DC.field _WrappedTerm_typeName (encodeName @@ Core.wrappedTypeTypeName (var "wt")),+ DC.field _WrappedTerm_body+ ((encodeType @@ Core.wrappedTypeBody (var "wt"))+ @@@ (DC.unwrapDynamic (Core.wrappedTypeTypeName (var "wt")) @@@ DC.var "x"))]))++-- | Filter bindings to only encodable type definitions+-- A binding is encodable if it is a native type AND is serializable (no function types in dependencies)+filterTypeBindings :: TBinding ([Binding] -> Flow Graph [Binding])+filterTypeBindings = define "filterTypeBindings" $+ doc "Filter bindings to only encodable type definitions" $+ "bindings" ~>+ -- First filter to native types, then check serializability for each+ Flows.map (primitive _maybes_cat) $+ Flows.mapList isEncodableBinding $+ primitive _lists_filter @@ Annotations.isNativeType @@ var "bindings"++-- | Check if a binding is encodable and return Just binding if so, Nothing otherwise+isEncodableBinding :: TBinding (Binding -> Flow Graph (Maybe Binding))+isEncodableBinding = define "isEncodableBinding" $+ doc "Check if a binding is encodable (serializable type)" $+ "b" ~>+ Flows.map+ ("serializable" ~> Logic.ifElse (var "serializable") (just (var "b")) nothing)+ (Schemas.isSerializableByName @@ (Core.bindingName (var "b")))++-- | Check whether a type is the unit type+isUnitType_ :: TBinding (Type -> Bool)+isUnitType_ = define "isUnitType" $+ doc "Check whether a type is the unit type" $+ match _Type (Just $ false) [+ _Type_unit>>: constant true]++-- | Encode an integer value based on its integer type+-- Wraps the value in the appropriate IntegerValue variant as an injection+encodeIntegerValue :: TBinding (IntegerType -> Term -> Term)+encodeIntegerValue = define "encodeIntegerValue" $+ doc "Encode an integer value based on its integer type" $+ "intType" ~> "valTerm" ~>+ Core.termUnion $ Core.injection+ (Core.nameLift _IntegerValue)+ (Core.field (intTypeToFieldName @@ var "intType") (var "valTerm"))+ where+ intTypeToFieldName :: TTerm (IntegerType -> Name)+ intTypeToFieldName = match _IntegerType Nothing [+ _IntegerType_bigint>>: constant $ Core.nameLift _IntegerValue_bigint,+ _IntegerType_int8>>: constant $ Core.nameLift _IntegerValue_int8,+ _IntegerType_int16>>: constant $ Core.nameLift _IntegerValue_int16,+ _IntegerType_int32>>: constant $ Core.nameLift _IntegerValue_int32,+ _IntegerType_int64>>: constant $ Core.nameLift _IntegerValue_int64,+ _IntegerType_uint8>>: constant $ Core.nameLift _IntegerValue_uint8,+ _IntegerType_uint16>>: constant $ Core.nameLift _IntegerValue_uint16,+ _IntegerType_uint32>>: constant $ Core.nameLift _IntegerValue_uint32,+ _IntegerType_uint64>>: constant $ Core.nameLift _IntegerValue_uint64]++-- | Encode a float value based on its float type+-- Wraps the value in the appropriate FloatValue variant as an injection+encodeFloatValue :: TBinding (FloatType -> Term -> Term)+encodeFloatValue = define "encodeFloatValue" $+ doc "Encode a float value based on its float type" $+ "floatType" ~> "valTerm" ~>+ Core.termUnion $ Core.injection+ (Core.nameLift _FloatValue)+ (Core.field (floatTypeToFieldName @@ var "floatType") (var "valTerm"))+ where+ floatTypeToFieldName :: TTerm (FloatType -> Name)+ floatTypeToFieldName = match _FloatType Nothing [+ _FloatType_bigfloat>>: constant $ Core.nameLift _FloatValue_bigfloat,+ _FloatType_float32>>: constant $ Core.nameLift _FloatValue_float32,+ _FloatType_float64>>: constant $ Core.nameLift _FloatValue_float64]++-- | Generate an encoder for a list type+-- Maps the element encoder over the list and wraps in Term.list+encodeListType :: TBinding (Type -> Term)+encodeListType = define "encodeListType" $+ doc "Generate an encoder for a list type" $+ "elemType" ~>+ DC.lambda "xs" $+ DC.injection _Term (DC.field _Term_list+ (DC.primitiveEncoded _lists_map @@@ (encodeType @@ var "elemType") @@@ DC.var "xs"))++-- | Generate an encoder for a map type+-- Encodes each key/value pair and wraps in Term.map+encodeMapType :: TBinding (MapType -> Term)+encodeMapType = define "encodeMapType" $+ doc "Generate an encoder for a map type" $+ "mt" ~>+ DC.lambda "m" $+ DC.injection _Term (DC.field _Term_map+ (DC.primitiveEncoded _maps_bimap+ @@@ (encodeType @@ Core.mapTypeKeys (var "mt"))+ @@@ (encodeType @@ Core.mapTypeValues (var "mt"))+ @@@ DC.var "m"))++-- | Generate an encoder for an Either type+-- Generates a case match over Left/Right variants+encodeEitherType :: TBinding (EitherType -> Term)+encodeEitherType = define "encodeEitherType" $+ doc "Generate an encoder for an Either type" $+ "et" ~>+ DC.lambda "e" $+ DC.injection _Term (DC.field _Term_either+ (DC.primitiveEncoded _eithers_bimap+ @@@ (encodeType @@ Core.eitherTypeLeft (var "et"))+ @@@ (encodeType @@ Core.eitherTypeRight (var "et"))+ @@@ DC.var "e"))++-- | Generate an encoder for a polymorphic (forall) type+-- For a type like `forall a. T[a]`, generates a lambda that takes an encoder for `a`+-- and returns an encoder for the body type `T[a]`+encodeForallType :: TBinding (ForallType -> Term)+encodeForallType = define "encodeForallType" $+ doc "Generate an encoder for a polymorphic (forall) type" $+ "ft" ~>+ -- Generate a lambda that takes an encoder for the type parameter+ Core.termFunction $ Core.functionLambda $+ Core.lambda+ (encodeBindingName @@ Core.forallTypeParameter (var "ft"))+ nothing+ (encodeType @@ Core.forallTypeBody (var "ft"))++-- | Generate an encoder for an optional type+-- Encodes the inner value if present and wraps in Term.optional+encodeOptionalType :: TBinding (Type -> Term)+encodeOptionalType = define "encodeOptionalType" $+ doc "Generate an encoder for an optional type" $+ "elemType" ~> DC.lambda "opt" $+ DC.injection _Term (DC.field _Term_maybe+ (DC.primitiveEncoded _maybes_map @@@ (encodeType @@ var "elemType") @@@ DC.var "opt"))++-- | Generate an encoder for a pair type+-- Encodes both elements and wraps in Term.pair+encodePairType :: TBinding (PairType -> Term)+encodePairType = define "encodePairType" $+ doc "Generate an encoder for a pair type" $+ "pt" ~> DC.lambda "p" $ DC.injection _Term $ DC.field _Term_pair $ DC.primitiveEncoded _pairs_bimap+ @@@ (encodeType @@ Core.pairTypeFirst (var "pt"))+ @@@ (encodeType @@ Core.pairTypeSecond (var "pt"))+ @@@ DC.var "p"++-- | Generate an encoder for a set type+-- Encodes each element and wraps in Term.set+encodeSetType :: TBinding (Type -> Term)+encodeSetType = define "encodeSetType" $+ doc "Generate an encoder for a set type" $+ "elemType" ~> DC.lambda "s" $+ DC.injection _Term (DC.field _Term_set+ (DC.primitiveEncoded _sets_map @@@ (encodeType @@ var "elemType") @@@ DC.var "s"))
src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Core.hs view
@@ -1,666 +1,860 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Extract.Core where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore---module_ :: Module-module_ = Module (Namespace "hydra.extract.core") elements- [Monads.module_, Lexical.module_, Rewriting.module_, ShowCore.module_]- kernelTypesModules $- Just ("A DSL for decoding and validating Hydra terms at runtime. This module provides functions to extract typed values from Hydra terms with appropriate error handling.")- where- elements = [- el bigfloatDef,- el bigfloatValueDef,- el bigintDef,- el bigintValueDef,- el binaryDef,- el binaryLiteralDef,- el booleanDef,- el booleanLiteralDef,- el caseFieldDef,- el casesDef,- el fieldDef,- el float32Def,- el float32ValueDef,- el float64Def,- el float64ValueDef,- el floatLiteralDef,- el floatValueDef,- el functionTypeDef,- el injectionDef,- el int16Def,- el int16ValueDef,- el int32Def,- el int32ValueDef,- el int64Def,- el int64ValueDef,- el int8Def,- el int8ValueDef,- el integerLiteralDef,- el integerValueDef,- el lambdaBodyDef,- el lambdaDef,- el letBindingDef,- el letTermDef,- el listDef,- el listHeadDef,- el listOfDef,- el listTypeDef,- el literalDef,- el mapDef,- el mapTypeDef,- el nArgsDef,- el optionalDef,- el optionalTypeDef,- el pairDef,- el productTypeDef,- el recordDef,- el recordTypeDef,- el setDef,- el setOfDef,- el setTypeDef,- el stringDef,- el stringLiteralDef,- el sumTypeDef,- el termRecordDef,- el uint16Def,- el uint16ValueDef,- el uint32Def,- el uint32ValueDef,- el uint64Def,- el uint64ValueDef,- el uint8Def,- el uint8ValueDef,- el unionTypeDef,- el unitDef,- el unitVariantDef,- el variantDef,- el wrapDef,- el wrappedTypeDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--bigfloatDef :: TBinding (Term -> Flow Graph Double)-bigfloatDef = define "bigfloat" $- doc "Extract an arbitrary-precision floating-point value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref floatLiteralDef @@ var "l") $ lambda "f" $- ref bigfloatValueDef @@ var "f"--bigfloatValueDef :: TBinding (FloatValue -> Flow Graph Double)-bigfloatValueDef = define "bigfloatValue" $- doc "Extract a bigfloat value from a FloatValue" $- lambda "v" $ cases _FloatValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "bigfloat" @@ (ref ShowCore.floatValueDef @@ var "v")) [- _FloatValue_bigfloat>>: lambda "f" $ Flows.pure $ var "f"]--bigintDef :: TBinding (Term -> Flow Graph Integer)-bigintDef = define "bigint" $- doc "Extract an arbitrary-precision integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref bigintValueDef @@ var "i"--bigintValueDef :: TBinding (IntegerValue -> Flow Graph Integer)-bigintValueDef = define "bigintValue" $- doc "Extract a bigint value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "bigint" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_bigint>>: lambda "i" $ Flows.pure $ var "i"]--binaryDef :: TBinding (Term -> Flow Graph String)-binaryDef = define "binary" $- doc "Extract a binary data value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ ref binaryLiteralDef--binaryLiteralDef :: TBinding (Literal -> Flow Graph String)-binaryLiteralDef = define "binaryLiteral" $- doc "Extract a binary literal from a Literal value" $- lambda "v" $ cases _Literal (var "v") (Just $ ref Monads.unexpectedDef @@ string "binary" @@ (ref ShowCore.literalDef @@ var "v")) [- _Literal_binary>>: lambda "b" $ Flows.pure $ var "b"]--booleanDef :: TBinding (Term -> Flow Graph Bool)-booleanDef = define "boolean" $- doc "Extract a boolean value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ ref booleanLiteralDef--booleanLiteralDef :: TBinding (Literal -> Flow Graph Bool)-booleanLiteralDef = define "booleanLiteral" $- doc "Extract a boolean literal from a Literal value" $- lambda "v" $ cases _Literal (var "v") (Just $ ref Monads.unexpectedDef @@ string "boolean" @@ (ref ShowCore.literalDef @@ var "v")) [- _Literal_boolean>>: lambda "b" $ Flows.pure $ var "b"]---- TODO: nonstandard; move me-caseFieldDef :: TBinding (Name -> String -> Term -> Flow Graph Field)-caseFieldDef = define "caseField" $- doc "Extract a specific case handler from a case statement term" $- lambdas ["name", "n", "term"] $ lets [- "fieldName">: Core.name $ var "n"] $ binds [- "cs">: ref casesDef @@ var "name" @@ var "term"] $ lets [- "matching">: Lists.filter- (lambda "f" $ Core.equalName_ (Core.fieldName $ var "f") (var "fieldName"))- (Core.caseStatementCases $ var "cs")] $- Logic.ifElse (Lists.null $ var "matching")- (Flows.fail $ string "not enough cases")- (Flows.pure $ Lists.head $ var "matching")---- TODO: nonstandard; move me-casesDef :: TBinding (Name -> Term -> Flow Graph CaseStatement)-casesDef = define "cases" $- doc "Extract case statement from a term" $- lambdas ["name", "term0"] $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "case statement" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_function>>: lambda "function" $ cases _Function (var "function") (Just $ ref Monads.unexpectedDef @@ string "case statement" @@ (ref ShowCore.termDef @@ var "term")) [- _Function_elimination>>: lambda "elimination" $ cases _Elimination (var "elimination") (Just $ ref Monads.unexpectedDef @@ string "case statement" @@ (ref ShowCore.termDef @@ var "term")) [- _Elimination_union>>: lambda "cs" $- Logic.ifElse (Core.equalName_ (Core.caseStatementTypeName $ var "cs") (var "name"))- (Flows.pure $ var "cs")- (ref Monads.unexpectedDef @@ ("case statement for type " ++ (Core.unName $ var "name")) @@ (ref ShowCore.termDef @@ var "term"))]]]---- TODO: nonstandard; move me-fieldDef :: TBinding (Name -> (Term -> Flow Graph x) -> [Field] -> Flow Graph x)-fieldDef = define "field" $- doc "Extract a field value from a list of fields" $- lambdas ["fname", "mapping", "fields"] $ lets [- "matchingFields">: Lists.filter- (lambda "f" $ Core.equalName_ (Core.fieldName $ var "f") (var "fname"))- (var "fields")]- $ Logic.ifElse (Lists.null $ var "matchingFields")- (Flows.fail $ "field " ++ (Core.unName $ var "fname") ++ " not found")- (Logic.ifElse (Equality.equal (Lists.length $ var "matchingFields") $ int32 1)- (Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ (Core.fieldTerm $ Lists.head $ var "matchingFields")) $ var "mapping")- (Flows.fail $ "multiple fields named " ++ (Core.unName $ var "fname")))--float32Def :: TBinding (Term -> Flow Graph Float)-float32Def = define "float32" $- doc "Extract a 32-bit floating-point value from a term" $- lambda "t" $ binds [- "l">: ref literalDef @@ var "t",- "f">: ref floatLiteralDef @@ var "l"] $- ref float32ValueDef @@ var "f"--float32ValueDef :: TBinding (FloatValue -> Flow Graph Float)-float32ValueDef = define "float32Value" $- doc "Extract a float32 value from a FloatValue" $- lambda "v" $ cases _FloatValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "float32" @@ (ref ShowCore.floatValueDef @@ var "v")) [- _FloatValue_float32>>: lambda "f" $ Flows.pure $ var "f"]--float64Def :: TBinding (Term -> Flow Graph Double)-float64Def = define "float64" $- doc "Extract a 64-bit floating-point value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref floatLiteralDef @@ var "l") $ lambda "f" $- ref float64ValueDef @@ var "f"--float64ValueDef :: TBinding (FloatValue -> Flow Graph Double)-float64ValueDef = define "float64Value" $- doc "Extract a float64 value from a FloatValue" $- lambda "v" $ cases _FloatValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "float64" @@ (ref ShowCore.floatValueDef @@ var "v")) [- _FloatValue_float64>>: lambda "f" $ Flows.pure $ var "f"]--floatLiteralDef :: TBinding (Literal -> Flow Graph FloatValue)-floatLiteralDef = define "floatLiteral" $- doc "Extract a floating-point literal from a Literal value" $- lambda "lit" $ cases _Literal (var "lit") (Just $ ref Monads.unexpectedDef @@ string "floating-point value" @@ (ref ShowCore.literalDef @@ var "lit")) [- _Literal_float>>: lambda "v" $ Flows.pure $ var "v"]--floatValueDef :: TBinding (Term -> Flow Graph FloatValue)-floatValueDef = define "floatValue" $- doc "Extract a float value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") (ref floatLiteralDef)--functionTypeDef :: TBinding (Type -> Flow s FunctionType)-functionTypeDef = define "functionType" $- doc "Extract a function type from a type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "function type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_function>>: lambda "ft" $ Flows.pure $ var "ft"]---- TODO: nonstandard; move me-injectionDef :: TBinding (Name -> Term -> Flow Graph Field)-injectionDef = define "injection" $- doc "Extract a field from a union term" $- lambdas ["expected", "term0"] $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "injection" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_union>>: lambda "injection" $- Logic.ifElse (Core.equalName_ (Core.injectionTypeName $ var "injection") (var "expected"))- (Flows.pure $ Core.injectionField $ var "injection")- (ref Monads.unexpectedDef @@ ("injection of type " ++ (Core.unName $ var "expected")) @@ (Core.unName $ Core.injectionTypeName $ var "injection"))]--int16Def :: TBinding (Term -> Flow Graph I.Int16)-int16Def = define "int16" $- doc "Extract a 16-bit signed integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref int16ValueDef @@ var "i"--int16ValueDef :: TBinding (IntegerValue -> Flow Graph I.Int16)-int16ValueDef = define "int16Value" $- doc "Extract an int16 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "int16" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_int16>>: lambda "i" $ Flows.pure $ var "i"]--int32Def :: TBinding (Term -> Flow Graph Int)-int32Def = define "int32" $- doc "Extract a 32-bit signed integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref int32ValueDef @@ var "i"--int32ValueDef :: TBinding (IntegerValue -> Flow Graph Int)-int32ValueDef = define "int32Value" $- doc "Extract an int32 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "int32" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_int32>>: lambda "i" $ Flows.pure $ var "i"]--int64Def :: TBinding (Term -> Flow Graph I.Int64)-int64Def = define "int64" $- doc "Extract a 64-bit signed integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref int64ValueDef @@ var "i"--int64ValueDef :: TBinding (IntegerValue -> Flow Graph I.Int64)-int64ValueDef = define "int64Value" $- doc "Extract an int64 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "int64" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_int64>>: lambda "i" $ Flows.pure $ var "i"]--int8Def :: TBinding (Term -> Flow Graph I.Int8)-int8Def = define "int8" $- doc "Extract an 8-bit signed integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref int8ValueDef @@ var "i"--int8ValueDef :: TBinding (IntegerValue -> Flow Graph I.Int8)-int8ValueDef = define "int8Value" $- doc "Extract an int8 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "int8" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_int8>>: lambda "i" $ Flows.pure $ var "i"]--integerLiteralDef :: TBinding (Literal -> Flow Graph IntegerValue)-integerLiteralDef = define "integerLiteral" $- doc "Extract an integer literal from a Literal value" $- lambda "lit" $ cases _Literal (var "lit") (Just $ ref Monads.unexpectedDef @@ string "integer value" @@ (ref ShowCore.literalDef @@ var "lit")) [- _Literal_integer>>: lambda "v" $ Flows.pure $ var "v"]--integerValueDef :: TBinding (Term -> Flow Graph IntegerValue)-integerValueDef = define "integerValue" $- doc "Extract an integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") (ref integerLiteralDef)--lambdaBodyDef :: TBinding (Term -> Flow Graph Term)-lambdaBodyDef = define "lambdaBody" $- doc "Extract the body of a lambda term" $- lambda "term" $ Flows.map (unaryFunction Core.lambdaBody) $ ref lambdaDef @@ var "term"--lambdaDef :: TBinding (Term -> Flow Graph Lambda)-lambdaDef = define "lambda" $- doc "Extract a lambda from a term" $- lambda "term0" $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "lambda" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_function>>: lambda "function" $ cases _Function (var "function") (Just $ ref Monads.unexpectedDef @@ string "lambda" @@ (ref ShowCore.termDef @@ var "term")) [- _Function_lambda>>: lambda "l" $ Flows.pure $ var "l"]]---- TODO: nonstandard; move me-letBindingDef :: TBinding (String -> Term -> Flow Graph Term)-letBindingDef = define "letBinding" $- doc "Extract a binding with the given name from a let term" $- lambdas ["n", "term"] $ lets [- "name">: Core.name $ var "n"]- $ Flows.bind (ref letTermDef @@ var "term") $- lambda "letExpr" $ lets [- "matchingBindings">: Lists.filter- (lambda "b" $ Core.equalName_ (Core.bindingName $ var "b") (var "name"))- (Core.letBindings $ var "letExpr")]- $ Logic.ifElse (Lists.null $ var "matchingBindings")- (Flows.fail $ "no such binding: " ++ var "n")- (Logic.ifElse (Equality.equal (Lists.length $ var "matchingBindings") $ int32 1)- (Flows.pure $ Core.bindingTerm $ Lists.head $ var "matchingBindings")- (Flows.fail $ "multiple bindings named " ++ var "n"))--letTermDef :: TBinding (Term -> Flow Graph Let)-letTermDef = define "letTerm" $- doc "Extract a let expression from a term" $- lambda "term0" $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "let term" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_let>>: lambda "lt" $ Flows.pure $ var "lt"]--listDef :: TBinding (Term -> Flow Graph [Term])-listDef = define "list" $- doc "Extract a list of terms from a term" $- "term" ~>- "stripped" <<~ ref Lexical.stripAndDereferenceTermDef @@ var "term" $- cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@ string "list" @@ (ref ShowCore.termDef @@ var "stripped")) [- _Term_list>>: "l" ~> produce $ var "l"]--listHeadDef :: TBinding (Term -> Flow Graph Term)-listHeadDef = define "listHead" $- doc "Extract the first element of a list term" $- lambda "term" $ Flows.bind (ref listDef @@ var "term") $- lambda "l" $ Logic.ifElse (Lists.null $ var "l")- (Flows.fail $ string "empty list")- (Flows.pure $ Lists.head $ var "l")--listOfDef :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph [x])-listOfDef = define "listOf" $- doc "Extract a list of values from a term, mapping a function over each element" $- "f" ~> "term" ~>- "els" <<~ ref listDef @@ var "term" $- Flows.mapList (var "f") (var "els")--listTypeDef :: TBinding (Type -> Flow s Type)-listTypeDef = define "listType" $- doc "Extract the element type from a list type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "list type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_list>>: lambda "t" $ Flows.pure $ var "t"]--literalDef :: TBinding (Term -> Flow Graph Literal)-literalDef = define "literal" $- doc "Extract a literal value from a term" $- lambda "term0" $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "literal" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_literal>>: lambda "lit" $ Flows.pure $ var "lit"]--mapDef :: TBinding ((Term -> Flow Graph k) -> (Term -> Flow Graph v) -> Term -> Flow Graph (M.Map k v))-mapDef = define "map" $- doc "Extract a map of key-value pairs from a term, mapping functions over each key and value" $- lambdas ["fk", "fv", "term0"] $ lets [- "pair">: lambda "kvPair" $ lets [- "kterm">: first $ var "kvPair",- "vterm">: second $ var "kvPair"]- $ Flows.bind (var "fk" @@ var "kterm") $- lambda "kval" $ Flows.bind (var "fv" @@ var "vterm") $- lambda "vval" $ Flows.pure $ pair (var "kval") (var "vval")]- $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "map" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_map>>: lambda "m" $ Flows.map (unaryFunction Maps.fromList) $ Flows.mapList (var "pair") $ Maps.toList $ var "m"]--mapTypeDef :: TBinding (Type -> Flow s MapType)-mapTypeDef = define "mapType" $- doc "Extract the key and value types from a map type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "map type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_map>>: lambda "mt" $ Flows.pure $ var "mt"]---- TODO: nonstandard; move me-nArgsDef :: TBinding (Name -> Int -> [Term] -> Flow s ())-nArgsDef = define "nArgs" $- doc "Ensure a function has the expected number of arguments" $- lambdas ["name", "n", "args"] $- Logic.ifElse (Equality.equal (Lists.length $ var "args") (var "n"))- (Flows.pure unit)- (ref Monads.unexpectedDef @@ (Strings.concat [- Literals.showInt32 $ var "n",- " arguments to primitive ",- Literals.showString (Core.unName $ var "name")]) @@ (Literals.showInt32 (Lists.length $ var "args")))--optionalDef :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph (Maybe x))-optionalDef = define "optional" $- doc "Extract an optional value from a term, applying a function to the value if present" $- lambdas ["f", "term0"] $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "optional value" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_optional>>: lambda "mt" $ Optionals.maybe- (Flows.pure nothing)- (lambda "t" $ Flows.map (unaryFunction just) $ var "f" @@ var "t")- (var "mt")]--optionalTypeDef :: TBinding (Type -> Flow s Type)-optionalTypeDef = define "optionalType" $- doc "Extract the base type from an optional type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "optional type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_optional>>: lambda "t" $ Flows.pure $ var "t"]--pairDef :: TBinding ((Term -> Flow Graph k) -> (Term -> Flow Graph v) -> Term -> Flow Graph (k, v))-pairDef = define "pair" $- doc "Extract a pair of values from a term, applying functions to each component" $- lambdas ["kf", "vf", "term0"] $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ string "product" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_product>>: lambda "terms" $- Logic.ifElse (Equality.equal (Lists.length $ var "terms") $ int32 2)- (Flows.bind (var "kf" @@ (Lists.head $ var "terms")) $- lambda "kVal" $ Flows.bind (var "vf" @@ (Lists.head $ Lists.tail $ var "terms")) $- lambda "vVal" $ Flows.pure $ pair (var "kVal") (var "vVal"))- (ref Monads.unexpectedDef @@ string "pair" @@ (ref ShowCore.termDef @@ var "term"))]--productTypeDef :: TBinding (Type -> Flow s [Type])-productTypeDef = define "productType" $- doc "Extract the component types from a product type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "product type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_product>>: lambda "types" $ Flows.pure $ var "types"]---- TODO: nonstandard; move me-recordDef :: TBinding (Name -> Term -> Flow Graph [Field])-recordDef = define "record" $- doc "Extract a record's fields from a term" $- lambdas ["expected", "term0"] $ binds [- "record">: ref termRecordDef @@ var "term0"] $- Logic.ifElse (Equality.equal (Core.recordTypeName $ var "record") (var "expected"))- (Flows.pure $ Core.recordFields $ var "record")- (ref Monads.unexpectedDef @@ ("record of type " ++ (Core.unName $ var "expected")) @@ (Core.unName $ Core.recordTypeName $ var "record"))---- TODO: nonstandard; move me-recordTypeDef :: TBinding (Name -> Type -> Flow s [FieldType])-recordTypeDef = define "recordType" $- doc "Extract the field types from a record type" $- lambdas ["ename", "typ"] $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "record type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_record>>: lambda "rowType" $- Logic.ifElse (Core.equalName_ (Core.rowTypeTypeName $ var "rowType") (var "ename"))- (Flows.pure $ Core.rowTypeFields $ var "rowType")- (ref Monads.unexpectedDef @@ ("record of type " ++ (Core.unName $ var "ename")) @@ ("record of type " ++ (Core.unName $ Core.rowTypeTypeName $ var "rowType")))]--setDef :: TBinding (Term -> Flow Graph (S.Set Term))-setDef = define "set" $- doc "Extract a set of terms from a term" $- "term" ~>- "stripped" <<~ ref Lexical.stripAndDereferenceTermDef @@ var "term" $- cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@ string "set" @@ (ref ShowCore.termDef @@ var "stripped")) [- _Term_set>>: "s" ~> produce $ var "s"]--setOfDef :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph (S.Set x))-setOfDef = define "setOf" $- doc "Extract a set of values from a term, mapping a function over each element" $- "f" ~> "term" ~>- "els" <<~ ref setDef @@ var "term" $- Flows.mapSet (var "f") (var "els")--setTypeDef :: TBinding (Type -> Flow s Type)-setTypeDef = define "setType" $- doc "Extract the element type from a set type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "set type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_set>>: lambda "t" $ Flows.pure $ var "t"]--stringDef :: TBinding (Term -> Flow Graph String)-stringDef = define "string" $- doc "Extract a string value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ ref stringLiteralDef--stringLiteralDef :: TBinding (Literal -> Flow Graph String)-stringLiteralDef = define "stringLiteral" $- doc "Extract a string literal from a Literal value" $- lambda "v" $ cases _Literal (var "v") (Just $ ref Monads.unexpectedDef @@ string "string" @@ (ref ShowCore.literalDef @@ var "v")) [- _Literal_string>>: lambda "s" $ Flows.pure $ var "s"]--sumTypeDef :: TBinding (Type -> Flow s [Type])-sumTypeDef = define "sumType" $- doc "Extract the component types from a sum type" $- lambda "typ" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "sum type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_sum>>: lambda "types" $ Flows.pure $ var "types"]--termRecordDef :: TBinding (Term -> Flow Graph Record)-termRecordDef = define "termRecord" $- doc "Extract a record from a term" $- lambdas ["term0"] $ binds [- "term">: ref Lexical.stripAndDereferenceTermDef @@ var "term0"] $- cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "record" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_record>>: lambda "record" $ produce $ var "record"]--uint16Def :: TBinding (Term -> Flow Graph Int)-uint16Def = define "uint16" $- doc "Extract a 16-bit unsigned integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref uint16ValueDef @@ var "i"--uint16ValueDef :: TBinding (IntegerValue -> Flow Graph Int)-uint16ValueDef = define "uint16Value" $- doc "Extract a uint16 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "uint16" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_uint16>>: lambda "i" $ Flows.pure $ var "i"]--uint32Def :: TBinding (Term -> Flow Graph I.Int64)-uint32Def = define "uint32" $- doc "Extract a 32-bit unsigned integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref uint32ValueDef @@ var "i"--uint32ValueDef :: TBinding (IntegerValue -> Flow Graph I.Int64)-uint32ValueDef = define "uint32Value" $- doc "Extract a uint32 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "uint32" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_uint32>>: lambda "i" $ Flows.pure $ var "i"]--uint64Def :: TBinding (Term -> Flow Graph Integer)-uint64Def = define "uint64" $- doc "Extract a 64-bit unsigned integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref uint64ValueDef @@ var "i"--uint64ValueDef :: TBinding (IntegerValue -> Flow Graph Integer)-uint64ValueDef = define "uint64Value" $- doc "Extract a uint64 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "uint64" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_uint64>>: lambda "i" $ Flows.pure $ var "i"]--uint8Def :: TBinding (Term -> Flow Graph I.Int16)-uint8Def = define "uint8" $- doc "Extract an 8-bit unsigned integer value from a term" $- lambda "t" $ Flows.bind (ref literalDef @@ var "t") $ lambda "l" $- Flows.bind (ref integerLiteralDef @@ var "l") $ lambda "i" $- ref uint8ValueDef @@ var "i"--uint8ValueDef :: TBinding (IntegerValue -> Flow Graph I.Int16)-uint8ValueDef = define "uint8Value" $- doc "Extract a uint8 value from an IntegerValue" $- lambda "v" $ cases _IntegerValue (var "v") (Just $ ref Monads.unexpectedDef @@ string "uint8" @@ (ref ShowCore.integerValueDef @@ var "v")) [- _IntegerValue_uint8>>: lambda "i" $ Flows.pure $ var "i"]---- TODO: nonstandard; move me-unionTypeDef :: TBinding (Name -> Type -> Flow s [FieldType])-unionTypeDef = define "unionType" $- doc "Extract the field types from a union type" $- lambdas ["ename", "typ"] $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "union type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_union>>: lambda "rowType" $- Logic.ifElse (Equality.equal (Core.rowTypeTypeName $ var "rowType") (var "ename"))- (Flows.pure $ Core.rowTypeFields $ var "rowType")- (ref Monads.unexpectedDef @@ ("union of type " ++ (Core.unName $ var "ename")) @@ ("union of type " ++ (Core.unName $ Core.rowTypeTypeName $ var "rowType")))]--unitDef :: TBinding (Term -> Flow Graph ())-unitDef = define "unit" $- doc "Extract a unit value from a term" $- lambda "term" $ cases _Term (var "term")- (Just $ ref Monads.unexpectedDef @@ string "unit" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_unit>>: constant $ Flows.pure unit]--unitVariantDef :: TBinding (Name -> Term -> Flow Graph Name)-unitVariantDef = define "unitVariant" $- doc "Extract a unit variant (a variant with an empty record value) from a union term" $- lambdas ["tname", "term"] $- bind "field" (ref variantDef @@ var "tname" @@ var "term") $- bind "ignored" (ref unitDef @@ (Core.fieldTerm $ var "field")) $- Flows.pure $ Core.fieldName $ var "field"--variantDef :: TBinding (Name -> Term -> Flow Graph Field)-variantDef = define "variant" $- doc "Extract a field from a union term (alias for injection)" $- ref injectionDef---- TODO: nonstandard; move me-wrapDef :: TBinding (Name -> Term -> Flow Graph Term)-wrapDef = define "wrap" $- doc "Extract the wrapped value from a wrapped term" $- lambdas ["expected", "term0"] $ Flows.bind (ref Lexical.stripAndDereferenceTermDef @@ var "term0") $- lambda "term" $ cases _Term (var "term") (Just $ ref Monads.unexpectedDef @@ ("wrap(" ++ (Core.unName $ var "expected") ++ ")") @@ (ref ShowCore.termDef @@ var "term")) [- _Term_wrap>>: lambda "wrappedTerm" $- Logic.ifElse (Core.equalName_ (Core.wrappedTermTypeName $ var "wrappedTerm") (var "expected"))- (Flows.pure $ Core.wrappedTermObject $ var "wrappedTerm")- (ref Monads.unexpectedDef @@ ("wrapper of type " ++ (Core.unName $ var "expected")) @@ (Core.unName $ Core.wrappedTermTypeName $ var "wrappedTerm"))]---- TODO: nonstandard; move me-wrappedTypeDef :: TBinding (Name -> Type -> Flow s Type)-wrappedTypeDef = define "wrappedType" $- doc "Extract the wrapped type from a wrapper type" $- lambdas ["ename", "typ"] $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "typ"]- $ cases _Type (var "stripped") (Just $ ref Monads.unexpectedDef @@ string "wrapped type" @@ (ref ShowCore.typeDef @@ var "typ")) [- _Type_wrap>>: lambda "wrappedType" $- Logic.ifElse (Core.equalName_ (Core.wrappedTypeTypeName $ var "wrappedType") (var "ename"))- (Flows.pure $ Core.wrappedTypeObject $ var "wrappedType")- (ref Monads.unexpectedDef @@ ("wrapped type " ++ (Core.unName $ var "ename")) @@ ("wrapped type " ++ (Core.unName $ Core.wrappedTypeTypeName $ var "wrappedType")))]+module Hydra.Sources.Kernel.Terms.Extract.Core where++-- Standard imports for kernel terms modules (slightly modified for conflict avoidance)+import Hydra.Kernel hiding (lambdaBody, map, setType)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms hiding (+ bigfloat, bigint, binary, boolean, cases, field, float32, float64, floatValue, injection, int8, int16, int32, int64,+ integerValue, lambda, list, literal, map, pair, set, record, string, unit, wrap, uint8, uint16, uint32, uint64)+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+++ns :: Namespace+ns = Namespace "hydra.extract.core"++module_ :: Module+module_ = Module ns elements+ [Monads.ns, Lexical.ns, Rewriting.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just ("Extraction and validation for hydra.core types")+ where+ elements = [+ toBinding bigfloat,+ toBinding bigfloatValue,+ toBinding bigint,+ toBinding bigintValue,+ toBinding binary,+ toBinding binaryLiteral,+ toBinding boolean,+ toBinding booleanLiteral,+ toBinding caseField,+ toBinding cases,+ toBinding field,+ toBinding float32,+ toBinding float32Value,+ toBinding float64,+ toBinding float64Value,+ toBinding floatLiteral,+ toBinding floatValue,+ toBinding eitherTerm,+ toBinding eitherType,+ toBinding functionType,+ toBinding injection,+ toBinding int16,+ toBinding int16Value,+ toBinding int32,+ toBinding int32Value,+ toBinding int64,+ toBinding int64Value,+ toBinding int8,+ toBinding int8Value,+ toBinding integerLiteral,+ toBinding integerValue,+ toBinding lambdaBody,+ toBinding lambda,+ toBinding letBinding,+ toBinding let_,+ toBinding list,+ toBinding listHead,+ toBinding listOf,+ toBinding listType,+ toBinding literal,+ toBinding map,+ toBinding mapType,+ toBinding nArgs,+ toBinding maybeTerm,+ toBinding maybeType,+ toBinding pair,+ toBinding record,+ toBinding recordType,+ toBinding set,+ toBinding setOf,+ toBinding setType,+ toBinding string,+ toBinding stringLiteral,+ toBinding termRecord,+ toBinding uint16,+ toBinding uint16Value,+ toBinding uint32,+ toBinding uint32Value,+ toBinding uint64,+ toBinding uint64Value,+ toBinding uint8,+ toBinding uint8Value,+ toBinding unionType,+ toBinding unit,+ toBinding unitVariant,+ toBinding wrap,+ toBinding wrappedType]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++bigfloat :: TBinding (Term -> Flow Graph Double)+bigfloat = define "bigfloat" $+ doc "Extract an arbitrary-precision floating-point value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "f" <<~ floatLiteral @@ var "l" $+ bigfloatValue @@ var "f"++bigfloatValue :: TBinding (FloatValue -> Flow Graph Double)+bigfloatValue = define "bigfloatValue" $+ doc "Extract a bigfloat value from a FloatValue" $+ "v" ~> Phantoms.cases _FloatValue (var "v")+ (Just (Monads.unexpected+ @@ ("bigfloat")+ @@ (ShowCore.floatValue @@ var "v"))) [+ _FloatValue_bigfloat>>: "f" ~> Flows.pure (var "f")]++bigint :: TBinding (Term -> Flow Graph Integer)+bigint = define "bigint" $+ doc "Extract an arbitrary-precision integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ bigintValue @@ var "i"++bigintValue :: TBinding (IntegerValue -> Flow Graph Integer)+bigintValue = define "bigintValue" $+ doc "Extract a bigint value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("bigint")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_bigint>>: "i" ~> Flows.pure (var "i")]++binary :: TBinding (Term -> Flow Graph String)+binary = define "binary" $+ doc "Extract a binary data value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ binaryLiteral @@ var "l"++binaryLiteral :: TBinding (Literal -> Flow Graph String)+binaryLiteral = define "binaryLiteral" $+ doc "Extract a binary literal from a Literal value" $+ "v" ~> Phantoms.cases _Literal (var "v")+ (Just (Monads.unexpected+ @@ ("binary")+ @@ (ShowCore.literal @@ var "v"))) [+ _Literal_binary>>: "b" ~> Flows.pure (var "b")]++boolean :: TBinding (Term -> Flow Graph Bool)+boolean = define "boolean" $+ doc "Extract a boolean value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ booleanLiteral @@ var "l"++booleanLiteral :: TBinding (Literal -> Flow Graph Bool)+booleanLiteral = define "booleanLiteral" $+ doc "Extract a boolean literal from a Literal value" $+ "v" ~> Phantoms.cases _Literal (var "v")+ (Just (Monads.unexpected+ @@ ("boolean")+ @@ (ShowCore.literal @@ var "v"))) [+ _Literal_boolean>>: "b" ~> Flows.pure (var "b")]++-- TODO: nonstandard; move me+caseField :: TBinding (Name -> String -> Term -> Flow Graph Field)+caseField = define "caseField" $+ doc "Extract a specific case handler from a case statement term" $+ "name" ~> "n" ~> "term" ~>+ "fieldName" <~ Core.name (var "n") $+ "cs" <<~ cases @@ var "name" @@ var "term" $+ "matching" <~ Lists.filter+ ("f" ~> Core.equalName_ (Core.fieldName (var "f")) (var "fieldName"))+ (Core.caseStatementCases (var "cs")) $+ Logic.ifElse (Lists.null (var "matching"))+ (Flows.fail ("not enough cases"))+ (Flows.pure (Lists.head (var "matching")))++-- TODO: nonstandard; move me+cases :: TBinding (Name -> Term -> Flow Graph CaseStatement)+cases = define "cases" $+ doc "Extract case statement from a term" $+ "name" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("case statement")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_function>>: "function" ~> Phantoms.cases _Function (var "function")+ (Just (Monads.unexpected+ @@ ("case statement")+ @@ (ShowCore.term @@ var "term"))) [+ _Function_elimination>>: "elimination" ~> Phantoms.cases _Elimination (var "elimination")+ (Just (Monads.unexpected+ @@ ("case statement")+ @@ (ShowCore.term @@ var "term"))) [+ _Elimination_union>>: "cs" ~>+ Logic.ifElse (Core.equalName_ (Core.caseStatementTypeName (var "cs")) (var "name"))+ (Flows.pure (var "cs"))+ (Monads.unexpected+ @@ (("case statement for type ") ++ (Core.unName (var "name")))+ @@ (ShowCore.term @@ var "term"))]]]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++-- TODO: nonstandard; move me+field :: TBinding (Name -> (Term -> Flow Graph x) -> [Field] -> Flow Graph x)+field = define "field" $+ doc "Extract a field value from a list of fields" $+ "fname" ~> "mapping" ~> "fields" ~>+ "matchingFields" <~ Lists.filter+ ("f" ~> Core.equalName_ (Core.fieldName (var "f")) (var "fname"))+ (var "fields") $+ Logic.ifElse (Lists.null (var "matchingFields"))+ (Flows.fail (("field ") ++ (Core.unName (var "fname")) ++ (" not found")))+ (Logic.ifElse (Equality.equal (Lists.length (var "matchingFields")) $ Phantoms.int32 1)+ ("stripped" <<~ Lexical.stripAndDereferenceTerm @@ (Core.fieldTerm (Lists.head (var "matchingFields"))) $+ var "mapping" @@ var "stripped")+ (Flows.fail (("multiple fields named ") ++ (Core.unName (var "fname")))))++float32 :: TBinding (Term -> Flow Graph Float)+float32 = define "float32" $+ doc "Extract a 32-bit floating-point value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "f" <<~ floatLiteral @@ var "l" $+ float32Value @@ var "f"++float32Value :: TBinding (FloatValue -> Flow Graph Float)+float32Value = define "float32Value" $+ doc "Extract a float32 value from a FloatValue" $+ "v" ~> Phantoms.cases _FloatValue (var "v")+ (Just (Monads.unexpected+ @@ ("float32")+ @@ (ShowCore.floatValue @@ var "v"))) [+ _FloatValue_float32>>: "f" ~> Flows.pure (var "f")]++float64 :: TBinding (Term -> Flow Graph Double)+float64 = define "float64" $+ doc "Extract a 64-bit floating-point value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "f" <<~ floatLiteral @@ var "l" $+ float64Value @@ var "f"++float64Value :: TBinding (FloatValue -> Flow Graph Double)+float64Value = define "float64Value" $+ doc "Extract a float64 value from a FloatValue" $+ "v" ~> Phantoms.cases _FloatValue (var "v")+ (Just (Monads.unexpected+ @@ ("float64")+ @@ (ShowCore.floatValue @@ var "v"))) [+ _FloatValue_float64>>: "f" ~> Flows.pure (var "f")]++floatLiteral :: TBinding (Literal -> Flow Graph FloatValue)+floatLiteral = define "floatLiteral" $+ doc "Extract a floating-point literal from a Literal value" $+ "lit" ~> Phantoms.cases _Literal (var "lit")+ (Just (Monads.unexpected+ @@ ("floating-point value")+ @@ (ShowCore.literal @@ var "lit"))) [+ _Literal_float>>: "v" ~> Flows.pure (var "v")]++floatValue :: TBinding (Term -> Flow Graph FloatValue)+floatValue = define "floatValue" $+ doc "Extract a float value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ floatLiteral @@ var "l"++eitherTerm :: TBinding ((Term -> Flow Graph x) -> (Term -> Flow Graph y) -> Term -> Flow Graph (Either x y))+eitherTerm = define "eitherTerm" $+ doc "Extract an either value from a term, applying functions to the left and right values" $+ "leftFun" ~> "rightFun" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("either value")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_either>>: "et" ~> Eithers.either_+ ("l" ~> Flows.map (unaryFunction left) (var "leftFun" @@ var "l"))+ ("r" ~> Flows.map (unaryFunction right) (var "rightFun" @@ var "r"))+ (var "et")]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++eitherType :: TBinding (Type -> Flow s EitherType)+eitherType = define "eitherType" $+ doc "Extract the left and right types from an either type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("either type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_either>>: "et" ~> Flows.pure (var "et")]++functionType :: TBinding (Type -> Flow s FunctionType)+functionType = define "functionType" $+ doc "Extract a function type from a type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("function type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_function>>: "ft" ~> Flows.pure (var "ft")]++-- TODO: nonstandard; move me+injection :: TBinding (Name -> Term -> Flow Graph Field)+injection = define "injection" $+ doc "Extract a field from a union term" $+ "expected" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("injection")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_union>>: "injection" ~>+ Logic.ifElse (Core.equalName_ (Core.injectionTypeName (var "injection")) (var "expected"))+ (Flows.pure (Core.injectionField (var "injection")))+ (Monads.unexpected+ @@ (("injection of type ") ++ (Core.unName (var "expected")))+ @@ (Core.unName (Core.injectionTypeName (var "injection"))))]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++int16 :: TBinding (Term -> Flow Graph I.Int16)+int16 = define "int16" $+ doc "Extract a 16-bit signed integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ int16Value @@ var "i"++int16Value :: TBinding (IntegerValue -> Flow Graph I.Int16)+int16Value = define "int16Value" $+ doc "Extract an int16 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("int16")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_int16>>: "i" ~> Flows.pure (var "i")]++int32 :: TBinding (Term -> Flow Graph Int)+int32 = define "int32" $+ doc "Extract a 32-bit signed integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ int32Value @@ var "i"++int32Value :: TBinding (IntegerValue -> Flow Graph Int)+int32Value = define "int32Value" $+ doc "Extract an int32 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ "int32"+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_int32>>: "i" ~> Flows.pure (var "i")]++int64 :: TBinding (Term -> Flow Graph I.Int64)+int64 = define "int64" $+ doc "Extract a 64-bit signed integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ int64Value @@ var "i"++int64Value :: TBinding (IntegerValue -> Flow Graph I.Int64)+int64Value = define "int64Value" $+ doc "Extract an int64 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("int64")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_int64>>: "i" ~> Flows.pure (var "i")]++int8 :: TBinding (Term -> Flow Graph I.Int8)+int8 = define "int8" $+ doc "Extract an 8-bit signed integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ int8Value @@ var "i"++int8Value :: TBinding (IntegerValue -> Flow Graph I.Int8)+int8Value = define "int8Value" $+ doc "Extract an int8 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("int8")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_int8>>: "i" ~> Flows.pure (var "i")]++integerLiteral :: TBinding (Literal -> Flow Graph IntegerValue)+integerLiteral = define "integerLiteral" $+ doc "Extract an integer literal from a Literal value" $+ "lit" ~> Phantoms.cases _Literal (var "lit")+ (Just (Monads.unexpected+ @@ ("integer value")+ @@ (ShowCore.literal @@ var "lit"))) [+ _Literal_integer>>: "v" ~> Flows.pure (var "v")]++integerValue :: TBinding (Term -> Flow Graph IntegerValue)+integerValue = define "integerValue" $+ doc "Extract an integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ integerLiteral @@ var "l"++lambdaBody :: TBinding (Term -> Flow Graph Term)+lambdaBody = define "lambdaBody" $+ doc "Extract the body of a lambda term" $+ "term" ~> Flows.map (unaryFunction Core.lambdaBody) (lambda @@ var "term")++lambda :: TBinding (Term -> Flow Graph Lambda)+lambda = define "lambda" $+ doc "Extract a lambda from a term" $+ "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ "lambda"+ @@ (ShowCore.term @@ var "term"))) [+ _Term_function>>: "function" ~> Phantoms.cases _Function (var "function")+ (Just (Monads.unexpected+ @@ ("lambda")+ @@ (ShowCore.term @@ var "term"))) [+ _Function_lambda>>: "l" ~> Flows.pure (var "l")]]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++-- TODO: nonstandard; move me+letBinding :: TBinding (String -> Term -> Flow Graph Term)+letBinding = define "letBinding" $+ doc "Extract a binding with the given name from a let term" $+ "n" ~> "term" ~>+ "name" <~ Core.name (var "n") $+ "letExpr" <<~ let_ @@ var "term" $+ "matchingBindings" <~ Lists.filter+ ("b" ~> Core.equalName_ (Core.bindingName (var "b")) (var "name"))+ (Core.letBindings (var "letExpr")) $+ Logic.ifElse (Lists.null (var "matchingBindings"))+ (Flows.fail (("no such binding: ") ++ var "n"))+ (Logic.ifElse (Equality.equal (Lists.length (var "matchingBindings")) $ Phantoms.int32 1)+ (Flows.pure (Core.bindingTerm (Lists.head (var "matchingBindings"))))+ (Flows.fail (("multiple bindings named ") ++ var "n")))++let_ :: TBinding (Term -> Flow Graph Let)+let_ = define "let" $+ doc "Extract a let expression from a term" $+ "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("let term")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_let>>: "lt" ~> Flows.pure (var "lt")]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++list :: TBinding (Term -> Flow Graph [Term])+list = define "list" $+ doc "Extract a list of terms from a term" $+ "term" ~>+ "extract" <~ ("stripped" ~> Phantoms.cases _Term (var "stripped")+ (Just (Monads.unexpected+ @@ "list"+ @@ (ShowCore.term @@ var "stripped"))) [+ _Term_list>>: "l" ~> produce (var "l")]) $+ "stripped" <<~ Lexical.stripAndDereferenceTerm @@ var "term" $+ var "extract" @@ var "stripped"++listHead :: TBinding (Term -> Flow Graph Term)+listHead = define "listHead" $+ doc "Extract the first element of a list term" $+ "term" ~>+ "l" <<~ list @@ var "term" $+ Logic.ifElse (Lists.null (var "l"))+ (Flows.fail "empty list")+ (Flows.pure (Lists.head (var "l")))++listOf :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph [x])+listOf = define "listOf" $+ doc "Extract a list of values from a term, mapping a function over each element" $+ "f" ~> "term" ~>+ "els" <<~ list @@ var "term" $+ Flows.mapList (var "f") (var "els")++listType :: TBinding (Type -> Flow s Type)+listType = define "listType" $+ doc "Extract the element type from a list type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("list type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_list>>: "t" ~> Flows.pure (var "t")]++literal :: TBinding (Term -> Flow Graph Literal)+literal = define "literal" $+ doc "Extract a literal value from a term" $+ "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("literal")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_literal>>: "lit" ~> Flows.pure (var "lit")]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++map :: TBinding ((Term -> Flow Graph k) -> (Term -> Flow Graph v) -> Term -> Flow Graph (M.Map k v))+map = define "map" $+ doc "Extract a map of key-value pairs from a term, mapping functions over each key and value" $+ "fk" ~> "fv" ~> "term0" ~>+ "pair" <~ ("kvPair" ~>+ "kterm" <~ Pairs.first (var "kvPair") $+ "vterm" <~ Pairs.second (var "kvPair") $+ "kval" <<~ var "fk" @@ var "kterm" $+ "vval" <<~ var "fv" @@ var "vterm" $+ produce (Phantoms.pair (var "kval") (var "vval"))) $+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ "map"+ @@ (ShowCore.term @@ var "term"))) [+ _Term_map>>: "m" ~> Flows.map (unaryFunction Maps.fromList) (Flows.mapList (var "pair") (Maps.toList (var "m")))]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++mapType :: TBinding (Type -> Flow s MapType)+mapType = define "mapType" $+ doc "Extract the key and value types from a map type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("map type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_map>>: "mt" ~> Flows.pure (var "mt")]++-- TODO: nonstandard; move me+nArgs :: TBinding (Name -> Int -> [a] -> Flow s ())+nArgs = define "nArgs" $+ doc "Ensure a function has the expected number of arguments" $+ "name" ~> "n" ~> "args" ~>+ Logic.ifElse (Equality.equal (Lists.length (var "args")) (var "n"))+ (produce Phantoms.unit)+ (Monads.unexpected @@ (Strings.concat [+ Literals.showInt32 (var "n"),+ Phantoms.string " arguments to primitive ",+ Literals.showString (Core.unName (var "name"))]) @@ (Literals.showInt32 (Lists.length (var "args"))))++maybeTerm :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph (Maybe x))+maybeTerm = define "maybeTerm" $+ doc "Extract an optional value from a term, applying a function to the value if present" $+ "f" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("maybe value")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_maybe>>: "mt" ~> Maybes.maybe+ (produce nothing)+ ("t" ~> Flows.map (unaryFunction just) (var "f" @@ var "t"))+ (var "mt")]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++maybeType :: TBinding (Type -> Flow s Type)+maybeType = define "maybeType" $+ doc "Extract the base type from an optional type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("maybe type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_maybe>>: "t" ~> Flows.pure (var "t")]++pair :: TBinding ((Term -> Flow Graph k) -> (Term -> Flow Graph v) -> Term -> Flow Graph (k, v))+pair = define "pair" $+ doc "Extract a pair of values from a term, applying functions to each component" $+ "kf" ~> "vf" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ "pair"+ @@ (ShowCore.term @@ var "term"))) [+ _Term_pair>>: "p" ~>+ "kVal" <<~ var "kf" @@ (Pairs.first $ var "p") $+ "vVal" <<~ var "vf" @@ (Pairs.second $ var "p") $+ produce (Phantoms.pair (var "kVal") (var "vVal"))]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++-- TODO: nonstandard; move me+record :: TBinding (Name -> Term -> Flow Graph [Field])+record = define "record" $+ doc "Extract a record's fields from a term" $+ "expected" ~> "term0" ~>+ "record" <<~ termRecord @@ var "term0" $+ Logic.ifElse (Equality.equal (Core.recordTypeName (var "record")) (var "expected"))+ (Flows.pure (Core.recordFields (var "record")))+ (Monads.unexpected+ @@ (("record of type ") ++ (Core.unName (var "expected")))+ @@ (Core.unName (Core.recordTypeName (var "record"))))++-- TODO: nonstandard; move me+recordType :: TBinding (Name -> Type -> Flow s [FieldType])+recordType = define "recordType" $+ doc "Extract the field types from a record type" $+ "ename" ~> "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("record type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_record>>: "rowType" ~>+ Logic.ifElse (Core.equalName_ (Core.rowTypeTypeName (var "rowType")) (var "ename"))+ (Flows.pure (Core.rowTypeFields (var "rowType")))+ (Monads.unexpected+ @@ (("record of type ") ++ (Core.unName (var "ename")))+ @@ (("record of type ") ++ (Core.unName (Core.rowTypeTypeName (var "rowType")))))]++set :: TBinding (Term -> Flow Graph (S.Set Term))+set = define "set" $+ doc "Extract a set of terms from a term" $+ "term" ~>+ "extract" <~ ("stripped" ~> Phantoms.cases _Term (var "stripped")+ (Just $ Monads.unexpected+ @@ "set"+ @@ (ShowCore.term @@ var "stripped")) [+ _Term_set>>: "s" ~> produce $ var "s"]) $+ "stripped" <<~ Lexical.stripAndDereferenceTerm @@ var "term" $+ var "extract" @@ var "stripped"++setOf :: TBinding ((Term -> Flow Graph x) -> Term -> Flow Graph (S.Set x))+setOf = define "setOf" $+ doc "Extract a set of values from a term, mapping a function over each element" $+ "f" ~> "term" ~>+ "els" <<~ set @@ var "term" $+ Flows.mapSet (var "f") (var "els")++setType :: TBinding (Type -> Flow s Type)+setType = define "setType" $+ doc "Extract the element type from a set type" $+ "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ "set type"+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_set>>: "t" ~> Flows.pure (var "t")]++string :: TBinding (Term -> Flow Graph String)+string = define "string" $+ doc "Extract a string value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ stringLiteral @@ var "l"++stringLiteral :: TBinding (Literal -> Flow Graph String)+stringLiteral = define "stringLiteral" $+ doc "Extract a string literal from a Literal value" $+ "v" ~> Phantoms.cases _Literal (var "v")+ (Just (Monads.unexpected+ @@ ("string")+ @@ (ShowCore.literal @@ var "v"))) [+ _Literal_string>>: "s" ~> Flows.pure (var "s")]++termRecord :: TBinding (Term -> Flow Graph Record)+termRecord = define "termRecord" $+ doc "Extract a record from a term" $+ "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ ("record")+ @@ (ShowCore.term @@ var "term"))) [+ _Term_record>>: "record" ~> produce (var "record")]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++uint16 :: TBinding (Term -> Flow Graph Int)+uint16 = define "uint16" $+ doc "Extract a 16-bit unsigned integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ uint16Value @@ var "i"++uint16Value :: TBinding (IntegerValue -> Flow Graph Int)+uint16Value = define "uint16Value" $+ doc "Extract a uint16 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("uint16")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_uint16>>: "i" ~> Flows.pure (var "i")]++uint32 :: TBinding (Term -> Flow Graph I.Int64)+uint32 = define "uint32" $+ doc "Extract a 32-bit unsigned integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ uint32Value @@ var "i"++uint32Value :: TBinding (IntegerValue -> Flow Graph I.Int64)+uint32Value = define "uint32Value" $+ doc "Extract a uint32 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("uint32")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_uint32>>: "i" ~> Flows.pure (var "i")]++uint64 :: TBinding (Term -> Flow Graph Integer)+uint64 = define "uint64" $+ doc "Extract a 64-bit unsigned integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ uint64Value @@ var "i"++uint64Value :: TBinding (IntegerValue -> Flow Graph Integer)+uint64Value = define "uint64Value" $+ doc "Extract a uint64 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("uint64")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_uint64>>: "i" ~> Flows.pure (var "i")]++uint8 :: TBinding (Term -> Flow Graph I.Int16)+uint8 = define "uint8" $+ doc "Extract an 8-bit unsigned integer value from a term" $+ "t" ~>+ "l" <<~ literal @@ var "t" $+ "i" <<~ integerLiteral @@ var "l" $+ uint8Value @@ var "i"++uint8Value :: TBinding (IntegerValue -> Flow Graph I.Int16)+uint8Value = define "uint8Value" $+ doc "Extract a uint8 value from an IntegerValue" $+ "v" ~> Phantoms.cases _IntegerValue (var "v")+ (Just (Monads.unexpected+ @@ ("uint8")+ @@ (ShowCore.integerValue @@ var "v"))) [+ _IntegerValue_uint8>>: "i" ~> Flows.pure (var "i")]++-- TODO: nonstandard; move me+unionType :: TBinding (Name -> Type -> Flow s [FieldType])+unionType = define "unionType" $+ doc "Extract the field types from a union type" $+ "ename" ~> "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("union type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_union>>: "rowType" ~>+ Logic.ifElse (Equality.equal (Core.rowTypeTypeName (var "rowType")) (var "ename"))+ (Flows.pure (Core.rowTypeFields (var "rowType")))+ (Monads.unexpected+ @@ (("union of type ") ++ (Core.unName (var "ename")))+ @@ (("union of type ") ++ (Core.unName (Core.rowTypeTypeName (var "rowType")))))]++unit :: TBinding (Term -> Flow Graph ())+unit = define "unit" $+ doc "Extract a unit value from a term" $+ "term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ "unit"+ @@ (ShowCore.term @@ var "term"))) [+ _Term_unit>>: constant (Flows.pure Phantoms.unit)]++unitVariant :: TBinding (Name -> Term -> Flow Graph Name)+unitVariant = define "unitVariant" $+ doc "Extract a unit variant (a variant with an empty record value) from a union term" $+ "tname" ~> "term" ~>+ "field" <<~ injection @@ var "tname" @@ var "term" $+ "ignored" <<~ unit @@ (Core.fieldTerm (var "field")) $+ produce (Core.fieldName (var "field"))++-- TODO: nonstandard; move me+wrap :: TBinding (Name -> Term -> Flow Graph Term)+wrap = define "wrap" $+ doc "Extract the wrapped value from a wrapped term" $+ "expected" ~> "term0" ~>+ "extract" <~ ("term" ~> Phantoms.cases _Term (var "term")+ (Just (Monads.unexpected+ @@ (("wrap(") ++ (Core.unName (var "expected")) ++ (")"))+ @@ (ShowCore.term @@ var "term"))) [+ _Term_wrap>>: "wrappedTerm" ~>+ Logic.ifElse (Core.equalName_ (Core.wrappedTermTypeName (var "wrappedTerm")) (var "expected"))+ (Flows.pure (Core.wrappedTermBody (var "wrappedTerm")))+ (Monads.unexpected+ @@ (("wrapper of type ") ++ (Core.unName (var "expected")))+ @@ (Core.unName (Core.wrappedTermTypeName (var "wrappedTerm"))))]) $+ "term" <<~ Lexical.stripAndDereferenceTerm @@ var "term0" $+ var "extract" @@ var "term"++-- TODO: nonstandard; move me+wrappedType :: TBinding (Name -> Type -> Flow s Type)+wrappedType = define "wrappedType" $+ doc "Extract the wrapped type from a wrapper type" $+ "ename" ~> "typ" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "typ" $+ Phantoms.cases _Type (var "stripped")+ (Just (Monads.unexpected+ @@ ("wrapped type")+ @@ (ShowCore.type_ @@ var "typ"))) [+ _Type_wrap>>: "wrappedType" ~>+ Logic.ifElse (Core.equalName_ (Core.wrappedTypeTypeName (var "wrappedType")) (var "ename"))+ (Flows.pure (Core.wrappedTypeBody (var "wrappedType")))+ (Monads.unexpected+ @@ (("wrapped type ") ++ (Core.unName (var "ename")))+ @@ (("wrapped type ") ++ (Core.unName (Core.wrappedTypeTypeName (var "wrappedType")))))]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Helpers.hs view
@@ -0,0 +1,229 @@+{-# LANGUAGE FlexibleContexts #-}++module Hydra.Sources.Kernel.Terms.Extract.Helpers where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (literalType, matchRecord, matchUnion)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+--import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Dsl.Meta.DeepCore as DC+import Hydra.Dsl.Meta.DeepCore ((@@@))+++ns :: Namespace+ns = Namespace "hydra.extract.helpers"++module_ :: Module+module_ = Module ns elements+ [Lexical.ns]+ kernelTypesNamespaces $+ Just "Helper functions for decoding terms to domain types"+ where+ elements = [+ toBinding decodeEither,+ toBinding decodeList,+ toBinding decodeMap,+ toBinding decodeMaybe,+ toBinding decodePair,+ toBinding decodeSet,+ toBinding decodeUnit,+ toBinding decodeWrapped,+ toBinding requireField,+ toBinding toFieldMap]++define :: String -> TTerm x -> TBinding x+define = definitionInModule module_++--------------------------------------------------------------------------------+-- Helper functions+--------------------------------------------------------------------------------++-- | Helper to convert Either String Term to Either DecodingError Term+stripWithDecodingError :: TTerm Graph -> TTerm Term -> TTerm (Either DecodingError Term)+stripWithDecodingError g term = Eithers.bimap+ (unaryFunction Util.decodingError)+ ("x" ~> var "x")+ (Lexical.stripAndDereferenceTermEither @@ g @@ term)++--------------------------------------------------------------------------------+-- Main decoder functions+--------------------------------------------------------------------------------++-- | Decode an Either value using the provided left and right decoders+decodeEither :: TBinding ((Graph -> Term -> Either DecodingError a) -> (Graph -> Term -> Either DecodingError b) -> Graph -> Term -> Either DecodingError (Either a b))+decodeEither = define "decodeEither" $+ doc "Decode an Either value using the provided left and right decoders" $+ "leftDecoder" ~> "rightDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected either value") [+ _Term_either>>: "e" ~>+ Eithers.either_+ -- Left case: decode the left value, then wrap result in Left+ ("lv" ~> Eithers.map ("x" ~> left (var "x")) (var "leftDecoder" @@ var "g" @@ var "lv"))+ -- Right case: decode the right value, then wrap result in Right+ ("rv" ~> Eithers.map ("x" ~> right (var "x")) (var "rightDecoder" @@ var "g" @@ var "rv"))+ (var "e")])++-- | Decode a list of elements using the provided element decoder+decodeList :: TBinding ((Graph -> Term -> Either DecodingError a) -> Graph -> Term -> Either DecodingError [a])+decodeList = define "decodeList" $+ doc "Decode a list of elements using the provided element decoder" $+ "elemDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected list") [+ _Term_list>>: "els" ~> Eithers.mapList (var "elemDecoder" @@ var "g") $ var "els"])++-- | Decode a Map using the provided key and value decoders+decodeMap :: TBinding ((Graph -> Term -> Either DecodingError k) -> (Graph -> Term -> Either DecodingError v) -> Graph -> Term -> Either DecodingError (M.Map k v))+decodeMap = define "decodeMap" $+ doc "Decode a Map using the provided key and value decoders" $+ "keyDecoder" ~> "valDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected map") [+ _Term_map>>: "m" ~>+ Eithers.map (unaryFunction Maps.fromList)+ (Eithers.mapList+ ("kv" ~>+ Eithers.bind (var "keyDecoder" @@ var "g" @@ (Pairs.first $ var "kv"))+ ("k" ~> Eithers.map ("v" ~> pair (var "k") (var "v"))+ (var "valDecoder" @@ var "g" @@ (Pairs.second $ var "kv"))))+ (Maps.toList $ var "m"))])++-- | Decode a Maybe value using the provided element decoder+decodeMaybe :: TBinding ((Graph -> Term -> Either DecodingError a) -> Graph -> Term -> Either DecodingError (Maybe a))+decodeMaybe = define "decodeMaybe" $+ doc "Decode a Maybe value using the provided element decoder" $+ "elemDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected optional value") [+ _Term_maybe>>: "opt" ~> Eithers.mapMaybe (var "elemDecoder" @@ var "g") $ var "opt"])++-- | Decode a Pair using the provided first and second decoders+decodePair :: TBinding ((Graph -> Term -> Either DecodingError a) -> (Graph -> Term -> Either DecodingError b) -> Graph -> Term -> Either DecodingError (a, b))+decodePair = define "decodePair" $+ doc "Decode a Pair using the provided first and second decoders" $+ "firstDecoder" ~> "secondDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected pair") [+ _Term_pair>>: "p" ~>+ Eithers.bind (var "firstDecoder" @@ var "g" @@ (Pairs.first $ var "p"))+ ("f" ~> Eithers.map ("s" ~> pair (var "f") (var "s"))+ (var "secondDecoder" @@ var "g" @@ (Pairs.second $ var "p")))])++-- | Decode a Set using the provided element decoder+decodeSet :: TBinding ((Graph -> Term -> Either DecodingError a) -> Graph -> Term -> Either DecodingError (S.Set a))+decodeSet = define "decodeSet" $+ doc "Decode a Set using the provided element decoder" $+ "elemDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected set") [+ _Term_set>>: "s" ~>+ Eithers.map (unaryFunction Sets.fromList)+ (Eithers.mapList (var "elemDecoder" @@ var "g") (Sets.toList $ var "s"))])++-- | Decode a unit value+decodeUnit :: TBinding (Graph -> Term -> Either DecodingError ())+decodeUnit = define "decodeUnit" $+ doc "Decode a unit value" $+ "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected a unit value") [+ _Term_unit>>: constant $ right unit])++-- | Decode a wrapped value using the provided body decoder+decodeWrapped :: TBinding ((Graph -> Term -> Either DecodingError a) -> Graph -> Term -> Either DecodingError a)+decodeWrapped = define "decodeWrapped" $+ doc "Decode a wrapped value using the provided body decoder" $+ "bodyDecoder" ~> "g" ~> "term" ~>+ Eithers.bind+ (stripWithDecodingError (var "g") (var "term"))+ ("stripped" ~> cases _Term (var "stripped")+ (Just $ left $ Util.decodingError $ string "expected wrapped value") [+ _Term_wrap>>: "wt" ~>+ var "bodyDecoder" @@ var "g" @@ (Core.wrappedTermBody (var "wt"))])++-- | Require a field from a field map and decode it using the provided decoder+-- Returns Left with a "missing field" error if the field is not present+requireField :: TBinding (String -> (Graph -> Term -> Either DecodingError a) -> M.Map Name Term -> Graph -> Either DecodingError a)+requireField = define "requireField" $+ doc "Require a field from a record's field map and decode it" $+ "fieldName" ~> "decoder" ~> "fieldMap" ~> "g" ~>+ Maybes.maybe+ (left $ Util.decodingError $ Strings.cat $ list [string "missing field ", var "fieldName", string " in record"])+ ("fieldTerm" ~> var "decoder" @@ var "g" @@ var "fieldTerm")+ (Maps.lookup (Phantoms.wrap _Name $ var "fieldName") $ var "fieldMap")++-- | Convert a Record to a Map from field Name to Term+toFieldMap :: TBinding (Record -> M.Map Name Term)+toFieldMap = define "toFieldMap" $+ doc "Convert a Record's fields to a Map from Name to Term" $+ "record" ~>+ Maps.fromList $+ Lists.map+ ("f" ~> pair (Core.fieldName $ var "f") (Core.fieldTerm $ var "f"))+ (Core.recordFields $ var "record")
− src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Mantle.hs
@@ -1,72 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Extract.Mantle where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads---module_ :: Module-module_ = Module (Namespace "hydra.extract.mantle") elements- [ExtractCore.module_, Monads.module_]- kernelTypesModules $- Just ("A DSL for decoding and validating Hydra terms at runtime. This module provides functions to extract typed values from Hydra terms with appropriate error handling.")- where- elements = [- el comparisonDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--comparisonDef :: TBinding (Term -> Flow Graph Comparison)-comparisonDef = define "comparison" $- doc "Extract a comparison from a term" $- lambda "term" $- Flows.bind (ref ExtractCore.unitVariantDef @@ Core.nameLift _Comparison @@ var "term") $- lambda "fname" $- Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_equalTo))- (Flows.pure Graph.comparisonEqualTo)- (Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_lessThan))- (Flows.pure Graph.comparisonLessThan)- (Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_greaterThan))- (Flows.pure Graph.comparisonGreaterThan)- (ref Monads.unexpectedDef @@ string "comparison" @@ Core.unName (var "fname"))))
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Extract/Util.hs view
@@ -0,0 +1,88 @@++module Hydra.Sources.Kernel.Terms.Extract.Util where++-- Standard imports for kernel terms modules+import Hydra.Kernel+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+++ns :: Namespace+ns = Namespace "hydra.extract.util"++module_ :: Module+module_ = Module ns elements+ [ExtractCore.ns, Monads.ns]+ kernelTypesNamespaces $+ Just ("Extraction and validation for hydra.util types")+ where+ elements = [+ toBinding comparison]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++comparison :: TBinding (Term -> Flow Graph Comparison)+comparison = define "comparison" $+ doc "Extract a comparison from a term" $+ lambda "term" $+ Flows.bind (ExtractCore.unitVariant @@ Core.nameLift _Comparison @@ var "term") $+ lambda "fname" $+ Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_equalTo))+ (Flows.pure Graph.comparisonEqualTo)+ (Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_lessThan))+ (Flows.pure Graph.comparisonLessThan)+ (Logic.ifElse (Equality.equal (Core.unName $ var "fname") (string $ unName _Comparison_greaterThan))+ (Flows.pure Graph.comparisonGreaterThan)+ (Monads.unexpected @@ string "comparison" @@ Core.unName (var "fname"))))
src/main/haskell/Hydra/Sources/Kernel/Terms/Formatting.hs view
@@ -1,88 +1,109 @@ module Hydra.Sources.Kernel.Terms.Formatting where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ capitalize, convertCase, convertCaseCamelToLowerSnake, convertCaseCamelToUpperSnake,+ convertCasePascalToUpperSnake, decapitalize, escapeWithUnderscore, indentLines,+ javaStyleComment, mapFirstLetter, nonAlnumToUnderscores, sanitizeWithUnderscores,+ showList, stripLeadingAndTrailingWhitespace, withCharacterAliases, wrapLine) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import Prelude hiding ((++), showList)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.formatting"+ module_ :: Module-module_ = Module (Namespace "hydra.formatting") elements+module_ = Module ns elements []- kernelTypesModules $+ kernelTypesNamespaces $ Just "String formatting types and functions." where elements = [- el capitalizeDef,- el convertCaseDef,- el convertCaseCamelToLowerSnakeDef,- el convertCaseCamelToUpperSnakeDef,- el convertCasePascalToUpperSnakeDef,- el decapitalizeDef,- el escapeWithUnderscoreDef,- el indentLinesDef,- el javaStyleCommentDef,- el mapFirstLetterDef,- el nonAlnumToUnderscoresDef,- el sanitizeWithUnderscoresDef,- el showListDef,- el stripLeadingAndTrailingWhitespaceDef,- el withCharacterAliasesDef,- el wrapLineDef]+ toBinding capitalize,+ toBinding convertCase,+ toBinding convertCaseCamelToLowerSnake,+ toBinding convertCaseCamelToUpperSnake,+ toBinding convertCasePascalToUpperSnake,+ toBinding decapitalize,+ toBinding escapeWithUnderscore,+ toBinding indentLines,+ toBinding javaStyleComment,+ toBinding mapFirstLetter,+ toBinding nonAlnumToUnderscores,+ toBinding sanitizeWithUnderscores,+ toBinding showList,+ toBinding stripLeadingAndTrailingWhitespace,+ toBinding withCharacterAliases,+ toBinding wrapLine] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -capitalizeDef :: TBinding (String -> String)-capitalizeDef = define "capitalize" $+capitalize :: TBinding (String -> String)+capitalize = define "capitalize" $ doc "Capitalize the first letter of a string" $- ref mapFirstLetterDef @@ primitive _strings_toUpper+ mapFirstLetter @@ primitive _strings_toUpper -convertCaseDef :: TBinding (CaseConvention -> CaseConvention -> String -> String)-convertCaseDef = define "convertCase" $+convertCase :: TBinding (CaseConvention -> CaseConvention -> String -> String)+convertCase = define "convertCase" $ doc "Convert a string from one case convention to another" $ lambdas ["from", "to", "original"] $ lets [ "parts">: lets [ "byCaps">: lets [ "splitOnUppercase">: lambda "acc" $ lambda "c" $ Lists.concat2- (Logic.ifElse (Chars.isUpper $ var "c") emptyParts (list []))+ (Logic.ifElse (Chars.isUpper $ var "c") emptyParts (list ([] :: [TTerm [Char]]))) (Lists.cons (Lists.cons (var "c") (Lists.head $ var "acc")) (Lists.tail $ var "acc"))] $ Lists.map (primitive _strings_fromList) $ Lists.foldl (var "splitOnUppercase") emptyParts- $ Lists.reverse $ Strings.toList (ref decapitalizeDef @@ var "original"),+ $ Lists.reverse $ Strings.toList (decapitalize @@ var "original"), "byUnderscores">: Strings.splitOn (string "_") $ var "original"] $ (match _CaseConvention Nothing [ _CaseConvention_camel>>: constant $ var "byCaps",@@ -90,54 +111,57 @@ _CaseConvention_lowerSnake>>: constant $ var "byUnderscores", _CaseConvention_upperSnake>>: constant $ var "byUnderscores"]) @@ var "from"] $ (match _CaseConvention Nothing [- _CaseConvention_camel>>: constant $ ref decapitalizeDef @@ (Strings.cat (Lists.map (ref capitalizeDef <.> primitive _strings_toLower) $ var "parts")),- _CaseConvention_pascal>>: constant $ Strings.cat (Lists.map (ref capitalizeDef <.> primitive _strings_toLower) $ var "parts"),+ _CaseConvention_camel>>: constant $ decapitalize @@ (Strings.cat (Lists.map (capitalize <.> primitive _strings_toLower) $ var "parts")),+ _CaseConvention_pascal>>: constant $ Strings.cat (Lists.map (capitalize <.> primitive _strings_toLower) $ var "parts"), _CaseConvention_lowerSnake>>: constant $ Strings.intercalate (string "_") (Lists.map (primitive _strings_toLower) $ var "parts"), _CaseConvention_upperSnake>>: constant $ Strings.intercalate (string "_") (Lists.map (primitive _strings_toUpper) $ var "parts") ]) @@ var "to" where- emptyParts = list [list []]+ emptyParts = list [list ([] :: [TTerm Char])] -convertCaseCamelToLowerSnakeDef :: TBinding (String -> String)-convertCaseCamelToLowerSnakeDef = define "convertCaseCamelToLowerSnake" $+convertCaseCamelToLowerSnake :: TBinding (String -> String)+convertCaseCamelToLowerSnake = define "convertCaseCamelToLowerSnake" $ doc "Convert a string from camel case to lower snake case" $- ref convertCaseDef @@ Mantle.caseConventionCamel @@ Mantle.caseConventionLowerSnake+ convertCase @@ Util.caseConventionCamel @@ Util.caseConventionLowerSnake -convertCaseCamelToUpperSnakeDef :: TBinding (String -> String)-convertCaseCamelToUpperSnakeDef = define "convertCaseCamelToUpperSnake" $+convertCaseCamelToUpperSnake :: TBinding (String -> String)+convertCaseCamelToUpperSnake = define "convertCaseCamelToUpperSnake" $ doc "Convert a string from camel case to upper snake case" $- ref convertCaseDef @@ Mantle.caseConventionCamel @@ Mantle.caseConventionUpperSnake+ convertCase @@ Util.caseConventionCamel @@ Util.caseConventionUpperSnake -convertCasePascalToUpperSnakeDef :: TBinding (String -> String)-convertCasePascalToUpperSnakeDef = define "convertCasePascalToUpperSnake" $+convertCasePascalToUpperSnake :: TBinding (String -> String)+convertCasePascalToUpperSnake = define "convertCasePascalToUpperSnake" $ doc "Convert a string from pascal case to upper snake case" $- ref convertCaseDef @@ Mantle.caseConventionPascal @@ Mantle.caseConventionUpperSnake+ convertCase @@ Util.caseConventionPascal @@ Util.caseConventionUpperSnake -decapitalizeDef :: TBinding (String -> String)-decapitalizeDef = define "decapitalize" $+decapitalize :: TBinding (String -> String)+decapitalize = define "decapitalize" $ doc "Decapitalize the first letter of a string" $- ref mapFirstLetterDef @@ primitive _strings_toLower+ mapFirstLetter @@ primitive _strings_toLower -escapeWithUnderscoreDef :: TBinding (S.Set String -> String -> String)-escapeWithUnderscoreDef = define "escapeWithUnderscore" $+escapeWithUnderscore :: TBinding (S.Set String -> String -> String)+escapeWithUnderscore = define "escapeWithUnderscore" $+ doc "Escape reserved words by appending an underscore" $ lambdas ["reserved", "s"] $ Logic.ifElse (Sets.member (var "s") (var "reserved")) (var "s" ++ string "_") (var "s") -indentLinesDef :: TBinding (String -> String)-indentLinesDef = define "indentLines" $+indentLines :: TBinding (String -> String)+indentLines = define "indentLines" $+ doc "Indent each line of a string with four spaces" $ lambda "s" $ lets [ "indent">: lambda "l" $ string " " ++ var "l"] $ Strings.unlines $ Lists.map (var "indent") $ Strings.lines $ var "s" -javaStyleCommentDef :: TBinding (String -> String)-javaStyleCommentDef = define "javaStyleComment" $+javaStyleComment :: TBinding (String -> String)+javaStyleComment = define "javaStyleComment" $+ doc "Format a string as a Java-style block comment" $ lambda "s" $ string "/**\n" ++ string " * " ++ var "s" ++ string "\n */" -- TODO: simplify this helper-mapFirstLetterDef :: TBinding ((String -> String) -> String -> String)-mapFirstLetterDef = define "mapFirstLetter" $+mapFirstLetter :: TBinding ((String -> String) -> String -> String)+mapFirstLetter = define "mapFirstLetter" $ doc "A helper which maps the first letter of a string to another string" $ "mapping" ~> "s" ~> "list" <~ Strings.toList (var "s") $@@ -147,8 +171,9 @@ (var "s") (Strings.cat2 (var "firstLetter") (Strings.fromList (Lists.tail $ var "list"))) -nonAlnumToUnderscoresDef :: TBinding (String -> String)-nonAlnumToUnderscoresDef = define "nonAlnumToUnderscores" $+nonAlnumToUnderscores :: TBinding (String -> String)+nonAlnumToUnderscores = define "nonAlnumToUnderscores" $+ doc "Replace sequences of non-alphanumeric characters with single underscores" $ "input" ~> "isAlnum" <~ ("c" ~> Logic.or (Logic.and (Equality.gte (var "c") (char 'A')) (Equality.lte (var "c") (char 'Z')))@@ -156,34 +181,38 @@ (Logic.and (Equality.gte (var "c") (char 'a')) (Equality.lte (var "c") (char 'z'))) (Logic.and (Equality.gte (var "c") (char '0')) (Equality.lte (var "c") (char '9'))))) $ "replace" <~ ("p" ~> "c" ~>- "s" <~ first (var "p") $- "b" <~ second (var "p") $+ "s" <~ Pairs.first (var "p") $+ "b" <~ Pairs.second (var "p") $ Logic.ifElse (var "isAlnum" @@ var "c") (pair (Lists.cons (var "c") (var "s")) (boolean False)) (Logic.ifElse (var "b") (pair (var "s") (boolean True)) (pair (Lists.cons (char '_') (var "s")) (boolean True)))) $- "result" <~ Lists.foldl (var "replace") (pair (list []) (boolean False)) (Strings.toList $ var "input") $- Strings.fromList $ Lists.reverse $ first $ var "result"+ "result" <~ Lists.foldl (var "replace") (pair (list ([] :: [TTerm Char])) (boolean False)) (Strings.toList $ var "input") $+ Strings.fromList $ Lists.reverse $ Pairs.first $ var "result" -sanitizeWithUnderscoresDef :: TBinding (S.Set String -> String -> String)-sanitizeWithUnderscoresDef = define "sanitizeWithUnderscores" $- "reserved" ~> "s" ~> ref escapeWithUnderscoreDef @@ var "reserved" @@ (ref nonAlnumToUnderscoresDef @@ var "s")+sanitizeWithUnderscores :: TBinding (S.Set String -> String -> String)+sanitizeWithUnderscores = define "sanitizeWithUnderscores" $+ doc "Sanitize a string by replacing non-alphanumeric characters and escaping reserved words" $+ "reserved" ~> "s" ~> escapeWithUnderscore @@ var "reserved" @@ (nonAlnumToUnderscores @@ var "s") -showListDef :: TBinding ((a -> String) -> [a] -> String)-showListDef = define "showList" $+showList :: TBinding ((a -> String) -> [a] -> String)+showList = define "showList" $+ doc "Format a list of elements as a bracketed, comma-separated string" $ "f" ~> "els" ~> Strings.cat $ list [ string "[", Strings.intercalate (string ", ") $ Lists.map (var "f") $ var "els", string "]"] -stripLeadingAndTrailingWhitespaceDef :: TBinding (String -> String)-stripLeadingAndTrailingWhitespaceDef = define "stripLeadingAndTrailingWhitespace" $+stripLeadingAndTrailingWhitespace :: TBinding (String -> String)+stripLeadingAndTrailingWhitespace = define "stripLeadingAndTrailingWhitespace" $+ doc "Remove leading and trailing whitespace from a string" $ "s" ~> Strings.fromList $ Lists.dropWhile (unaryFunction Chars.isSpace) $ Lists.reverse $ Lists.dropWhile (unaryFunction Chars.isSpace) $ Lists.reverse $ Strings.toList $ var "s" -withCharacterAliasesDef :: TBinding (String -> String)-withCharacterAliasesDef = define "withCharacterAliases" $+withCharacterAliases :: TBinding (String -> String)+withCharacterAliases = define "withCharacterAliases" $+ doc "Replace special characters with their alphanumeric aliases" $ lambda "original" $ lets [ -- Taken from: https://cs.stanford.edu/people/miles/iso8859.html "aliases">: Maps.fromList $ list [@@ -220,24 +249,26 @@ pair (int32 124) (string "verbar"), pair (int32 125) (string "rcub"), pair (int32 126) (string "tilde")],- "alias">: lambda "c" $ Optionals.fromMaybe+ "alias">: lambda "c" $ Maybes.fromMaybe (Lists.pure $ var "c")- (Optionals.map (unaryFunction Strings.toList) $ Maps.lookup (var "c") (var "aliases"))]+ (Maybes.map (unaryFunction Strings.toList) $ Maps.lookup (var "c") (var "aliases"))] $ Strings.fromList $ Lists.filter (unaryFunction Chars.isAlphaNum) $ Lists.concat $ Lists.map (var "alias") $ Strings.toList $ var "original" -wrapLineDef :: TBinding (Int -> String -> String)-wrapLineDef = define "wrapLine" $+wrapLine :: TBinding (Int -> String -> String)+wrapLine = define "wrapLine" $ doc "A simple soft line wrap which is suitable for code comments" $ lambdas ["maxlen", "input"] $ lets [ "helper">: lambdas ["prev", "rem"] $ lets [ "trunc">: Lists.take (var "maxlen") (var "rem"),- "spanResult">: Lists.span (lambda "c" $ Logic.and (Logic.not $ Equality.equal (var "c") (char ' ')) (Logic.not $ Equality.equal (var "c") (char '\t'))) (Lists.reverse $ var "trunc"),- "prefix">: Lists.reverse $ second $ var "spanResult",- "suffix">: Lists.reverse $ first $ var "spanResult"]+ "spanResult">: Lists.span+ (lambda "c" $ Logic.and (Logic.not $ Equality.equal (var "c") (char ' ')) (Logic.not $ Equality.equal (var "c") (char '\t')))+ (Lists.reverse $ var "trunc"),+ "prefix">: Lists.reverse $ Pairs.second $ var "spanResult",+ "suffix">: Lists.reverse $ Pairs.first $ var "spanResult"] $ Logic.ifElse (Equality.lte (Lists.length $ var "rem") (var "maxlen")) (Lists.reverse $ Lists.cons (var "rem") (var "prev")) (Logic.ifElse (Lists.null $ var "prefix") (var "helper" @@ (Lists.cons (var "trunc") (var "prev")) @@ (Lists.drop (var "maxlen") (var "rem"))) (var "helper" @@ (Lists.cons (Lists.init $ var "prefix") (var "prev")) @@ (Lists.concat2 (var "suffix") ((Lists.drop (var "maxlen") (var "rem"))))))]- $ Strings.fromList $ Lists.intercalate (list [char '\n']) $ var "helper" @@ (list []) @@ (Strings.toList $ var "input")+ $ Strings.fromList $ Lists.intercalate (list [char '\n']) $ var "helper" @@ (list ([] :: [TTerm Char])) @@ (Strings.toList $ var "input")
src/main/haskell/Hydra/Sources/Kernel/Terms/Grammars.hs view
@@ -1,45 +1,58 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Grammars where --- Standard imports for term-level kernel modules+-- Standard imports for kernel terms modules import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations import qualified Hydra.Sources.Kernel.Terms.Constants as Constants@@ -49,180 +62,188 @@ import Hydra.Grammar as G +ns :: Namespace+ns = Namespace "hydra.grammars"+ module_ :: Module-module_ = Module (Namespace "hydra.grammars") elements- [Annotations.module_, Formatting.module_, Names.module_]- kernelTypesModules $+module_ = Module ns elements+ [Annotations.ns, Formatting.ns, Names.ns]+ kernelTypesNamespaces $ Just ("A utility for converting a BNF grammar to a Hydra module.") where elements = [- el childNameDef,- el findNamesDef,- el grammarToModuleDef,- el isComplexDef,- el isNontrivialDef,- el makeElementsDef,- el rawNameDef,- el simplifyDef,- el toNameDef,- el wrapTypeDef]+ toBinding childName,+ toBinding findNames,+ toBinding grammarToModule,+ toBinding isComplex,+ toBinding isNontrivial,+ toBinding makeElements,+ toBinding rawName,+ toBinding simplify,+ toBinding toName,+ toBinding wrapType] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -childNameDef :: TBinding (String -> String -> String)-childNameDef = define "childName" $+childName :: TBinding (String -> String -> String)+childName = define "childName" $ doc "Generate child name" $- lambda "lname" $ lambda "n" $- Strings.cat $ list [var "lname", string "_", ref Formatting.capitalizeDef @@ var "n"]+ "lname" ~> "n" ~>+ Strings.cat (list [var "lname", string "_", Formatting.capitalize @@ var "n"]) -findNamesDef :: TBinding ([G.Pattern] -> [String])-findNamesDef = define "findNames" $+findNames :: TBinding ([G.Pattern] -> [String])+findNames = define "findNames" $ doc "Find unique names for patterns" $- lambda "pats" $ lets [- "nextName">: lambda "acc" $ lambda "pat" $ lets [- "names">: first $ var "acc",- "nameMap">: second $ var "acc",- "rn">: ref rawNameDef @@ var "pat",- "nameAndIndex">: Optionals.maybe- (pair (var "rn") (int32 1))- (lambda "i" $ pair (Strings.cat2 (var "rn") (Literals.showInt32 $ Math.add (var "i") (int32 1))) (Math.add (var "i") (int32 1)))- (Maps.lookup (var "rn") (var "nameMap")),- "nn">: first $ var "nameAndIndex",- "ni">: second $ var "nameAndIndex"]- $ pair- (Lists.cons (var "nn") (var "names"))- (Maps.insert (var "rn") (var "ni") (var "nameMap"))]- $ Lists.reverse $ first $ Lists.foldl (var "nextName") (pair (list []) Maps.empty) (var "pats")+ "pats" ~>+ "nextName" <~ ("acc" ~> "pat" ~>+ "names" <~ Pairs.first (var "acc") $+ "nameMap" <~ Pairs.second (var "acc") $+ "rn" <~ rawName @@ var "pat" $+ "nameAndIndex" <~ Maybes.maybe+ (pair (var "rn") (int32 1))+ ("i" ~> pair (Strings.cat2 (var "rn") (Literals.showInt32 (Math.add (var "i") (int32 1)))) (Math.add (var "i") (int32 1)))+ (Maps.lookup (var "rn") (var "nameMap")) $+ "nn" <~ Pairs.first (var "nameAndIndex") $+ "ni" <~ Pairs.second (var "nameAndIndex") $+ pair+ (Lists.cons (var "nn") (var "names"))+ (Maps.insert (var "rn") (var "ni") (var "nameMap"))) $+ Lists.reverse (Pairs.first (Lists.foldl (var "nextName") (pair (list ([] :: [TTerm Name])) Maps.empty) (var "pats"))) -grammarToModuleDef :: TBinding (Namespace -> G.Grammar -> Maybe String -> Module)-grammarToModuleDef = define "grammarToModule" $+grammarToModule :: TBinding (Namespace -> G.Grammar -> Maybe String -> Module)+grammarToModule = define "grammarToModule" $ doc "Convert a BNF grammar to a Hydra module" $- lambda "ns" $ lambda "grammar" $ lambda "desc" $ lets [- "prodPairs">: Lists.map- (lambda "prod" $ pair- (Grammar.unSymbol $ Grammar.productionSymbol $ var "prod")- (Grammar.productionPattern $ var "prod"))- (Grammar.unGrammar $ var "grammar"),- "capitalizedNames">: Lists.map (lambda "pair" $ ref Formatting.capitalizeDef @@ (first $ var "pair")) (var "prodPairs"),- "patterns">: Lists.map (lambda "pair" $ second $ var "pair") (var "prodPairs"),- "elementPairs">: Lists.concat $ Lists.zipWith- (ref makeElementsDef @@ false @@ var "ns")- (var "capitalizedNames")- (var "patterns"),- "elements">: Lists.map- (lambda "pair" $ lets [- "lname">: first $ var "pair",- "typ">: ref wrapTypeDef @@ (second $ var "pair")]- $ ref Annotations.typeElementDef @@ (ref toNameDef @@ var "ns" @@ var "lname") @@ var "typ")- (var "elementPairs")]- $ Module.module_ (var "ns") (var "elements") (list []) (list []) (var "desc")+ "ns" ~> "grammar" ~> "desc" ~>+ "prodPairs" <~ Lists.map+ ("prod" ~> pair+ (Grammar.unSymbol (Grammar.productionSymbol (var "prod")))+ (Grammar.productionPattern (var "prod")))+ (Grammar.unGrammar (var "grammar")) $+ "capitalizedNames" <~ Lists.map ("pair" ~> Formatting.capitalize @@ (Pairs.first (var "pair"))) (var "prodPairs") $+ "patterns" <~ Lists.map ("pair" ~> Pairs.second (var "pair")) (var "prodPairs") $+ "elementPairs" <~ Lists.concat (Lists.zipWith+ (makeElements @@ false @@ var "ns")+ (var "capitalizedNames")+ (var "patterns")) $+ "elements" <~ Lists.map+ ("pair" ~>+ "lname" <~ Pairs.first (var "pair") $+ "typ" <~ wrapType @@ (Pairs.second (var "pair")) $+ Annotations.typeElement @@ (toName @@ var "ns" @@ var "lname") @@ var "typ")+ (var "elementPairs") $+ Module.module_ (var "ns") (var "elements") (list ([] :: [TTerm Namespace])) (list ([] :: [TTerm Namespace])) (var "desc") -isComplexDef :: TBinding (G.Pattern -> Bool)-isComplexDef = define "isComplex" $+isComplex :: TBinding (G.Pattern -> Bool)+isComplex = define "isComplex" $ doc "Check if pattern is complex" $- lambda "pat" $ match G._Pattern (Just false) [- _Pattern_labeled>>: lambda "lp" $ ref isComplexDef @@ (Grammar.labeledPatternPattern $ var "lp"),- _Pattern_sequence>>: lambda "pats" $ ref isNontrivialDef @@ true @@ var "pats",- _Pattern_alternatives>>: lambda "pats" $ ref isNontrivialDef @@ false @@ var "pats"]+ "pat" ~> match G._Pattern (Just false) [+ _Pattern_labeled>>: "lp" ~> isComplex @@ (Grammar.labeledPatternPattern (var "lp")),+ _Pattern_sequence>>: "pats" ~> isNontrivial @@ true @@ var "pats",+ _Pattern_alternatives>>: "pats" ~> isNontrivial @@ false @@ var "pats"] @@ var "pat" -isNontrivialDef :: TBinding (Bool -> [G.Pattern] -> Bool)-isNontrivialDef = define "isNontrivial" $+isNontrivial :: TBinding (Bool -> [G.Pattern] -> Bool)+isNontrivial = define "isNontrivial" $ doc "Check if patterns are nontrivial" $- lambda "isRecord" $ lambda "pats" $ lets [- "minPats">: ref simplifyDef @@ var "isRecord" @@ var "pats"]- $ Logic.ifElse (Equality.equal (Lists.length $ var "minPats") (int32 1))- (match G._Pattern (Just false) [- _Pattern_labeled>>: constant true] @@ Lists.head (var "minPats"))- true+ "isRecord" ~> "pats" ~>+ "minPats" <~ simplify @@ var "isRecord" @@ var "pats" $+ "isLabeled" <~ ("p" ~> cases G._Pattern (var "p")+ (Just false) [+ _Pattern_labeled>>: constant true]) $+ Logic.ifElse (Equality.equal (Lists.length (var "minPats")) (int32 1))+ (var "isLabeled" @@ (Lists.head $ var "minPats"))+ true -makeElementsDef :: TBinding (Bool -> Namespace -> String -> G.Pattern -> [(String, Type)])-makeElementsDef = define "makeElements" $+makeElements :: TBinding (Bool -> Namespace -> String -> G.Pattern -> [(String, Type)])+makeElements = define "makeElements" $ doc "Create elements from pattern" $- lambda "omitTrivial" $ lambda "ns" $ lambda "lname" $ lambda "pat" $ lets [- "trivial">: Logic.ifElse (var "omitTrivial") (list []) (list [pair (var "lname") TTypes.unit]),+ "omitTrivial" ~> "ns" ~> "lname" ~> "pat" ~>+ "trivial" <~ Logic.ifElse (var "omitTrivial") (list ([] :: [TTerm (String, Type)])) (list [pair (var "lname") MetaTypes.unit]) $ - "forRecordOrUnion">: lambda "isRecord" $ lambda "construct" $ lambda "pats" $ lets [- "minPats">: ref simplifyDef @@ var "isRecord" @@ var "pats",- "fieldNames">: ref findNamesDef @@ var "minPats",- "toField">: lambda "n" $ lambda "p" $ var "descend" @@ var "n" @@- (lambda "pairs" $ pair (Core.fieldType (Core.name $ var "n") (second $ Lists.head $ var "pairs")) (Lists.tail $ var "pairs")) @@- var "p",- "fieldPairs">: Lists.zipWith (var "toField") (var "fieldNames") (var "minPats"),- "fields">: Lists.map (unaryFunction first) (var "fieldPairs"),- "els">: Lists.concat $ Lists.map (unaryFunction second) (var "fieldPairs")]- $ Logic.ifElse (ref isNontrivialDef @@ var "isRecord" @@ var "pats")- (Lists.cons (pair (var "lname") (var "construct" @@ var "fields")) (var "els"))- (var "forPat" @@ (Lists.head $ var "minPats")),+ "descend" <~ ("n" ~> "f" ~> "p" ~>+ "cpairs" <~ makeElements @@ false @@ var "ns" @@ (childName @@ var "lname" @@ var "n") @@ var "p" $+ var "f" @@ Logic.ifElse (isComplex @@ var "p")+ (Lists.cons (pair (var "lname") (Core.typeVariable (toName @@ var "ns" @@ (Pairs.first (Lists.head (var "cpairs")))))) (var "cpairs"))+ (Logic.ifElse (Lists.null (var "cpairs"))+ (list [pair (var "lname") MetaTypes.unit])+ (Lists.cons (pair (var "lname") (Pairs.second (Lists.head (var "cpairs")))) (Lists.tail (var "cpairs"))))) $ - "mod">: lambda "n" $ lambda "f" $ lambda "p" $ var "descend" @@ var "n" @@- (lambda "pairs" $ Lists.cons (pair (var "lname") (var "f" @@ (second $ Lists.head $ var "pairs"))) (Lists.tail $ var "pairs")) @@- var "p",+ "mod" <~ ("n" ~> "f" ~> "p" ~> var "descend" @@ var "n" @@+ ("pairs" ~> Lists.cons (pair (var "lname") (var "f" @@ (Pairs.second (Lists.head (var "pairs"))))) (Lists.tail (var "pairs"))) @@+ var "p") $ - "descend">: lambda "n" $ lambda "f" $ lambda "p" $ lets [- "cpairs">: ref makeElementsDef @@ false @@ var "ns" @@ (ref childNameDef @@ var "lname" @@ var "n") @@ var "p"]- $ var "f" @@ Logic.ifElse (ref isComplexDef @@ var "p")- (Lists.cons (pair (var "lname") (Core.typeVariable $ ref toNameDef @@ var "ns" @@ (first $ Lists.head $ var "cpairs"))) (var "cpairs"))- (Logic.ifElse (Lists.null $ var "cpairs")- (list [pair (var "lname") TTypes.unit])- (Lists.cons (pair (var "lname") (second $ Lists.head $ var "cpairs")) (Lists.tail $ var "cpairs"))),+ lets [+ "forPat">: ("pat" ~> match G._Pattern Nothing [+ _Pattern_alternatives>>: "pats" ~> var "forRecordOrUnion" @@ false @@+ ("fields" ~> Core.typeUnion (Core.rowType (Constants.placeholderName) (var "fields"))) @@ var "pats",+ _Pattern_constant>>: constant (var "trivial"),+ _Pattern_ignored>>: constant (list ([] :: [TTerm (String, Type)])),+ _Pattern_labeled>>: "lp" ~> var "forPat" @@ Grammar.labeledPatternPattern (var "lp"),+ _Pattern_nil>>: constant (var "trivial"),+ _Pattern_nonterminal>>: "s" ~> list [pair (var "lname") (Core.typeVariable (+ toName @@ var "ns" @@ Grammar.unSymbol (var "s")))],+ _Pattern_option>>: "p" ~> var "mod" @@ string "Option" @@ (unaryFunction MetaTypes.optional) @@ var "p",+ _Pattern_plus>>: "p" ~> var "mod" @@ string "Elmt" @@ (unaryFunction MetaTypes.list) @@ var "p",+ _Pattern_regex>>: constant (list [pair (var "lname") MetaTypes.string]),+ _Pattern_sequence>>: "pats" ~> var "forRecordOrUnion" @@ true @@+ ("fields" ~> Core.typeRecord (Core.rowType (Constants.placeholderName) (var "fields"))) @@ var "pats",+ _Pattern_star>>: "p" ~> var "mod" @@ string "Elmt" @@ (unaryFunction MetaTypes.list) @@ var "p"]+ @@ var "pat"), - "forPat">: lambda "pat" $ match G._Pattern Nothing [- _Pattern_alternatives>>: lambda "pats" $ var "forRecordOrUnion" @@ false @@- (lambda "fields" $ Core.typeUnion $ Core.rowType (ref Constants.placeholderNameDef) (var "fields")) @@ var "pats",- _Pattern_constant>>: constant $ var "trivial",- _Pattern_ignored>>: constant $ list [],- _Pattern_labeled>>: lambda "lp" $ var "forPat" @@ Grammar.labeledPatternPattern (var "lp"),- _Pattern_nil>>: constant $ var "trivial",- _Pattern_nonterminal>>: lambda "s" $ list [pair (var "lname") $ Core.typeVariable $- ref toNameDef @@ var "ns" @@ Grammar.unSymbol (var "s")],- _Pattern_option>>: lambda "p" $ var "mod" @@ string "Option" @@ (unaryFunction TTypes.optional) @@ var "p",- _Pattern_plus>>: lambda "p" $ var "mod" @@ string "Elmt" @@ (unaryFunction TTypes.list) @@ var "p",- _Pattern_regex>>: constant $ list [pair (var "lname") TTypes.string],- _Pattern_sequence>>: lambda "pats" $ var "forRecordOrUnion" @@ true @@- (lambda "fields" $ Core.typeRecord $ Core.rowType (ref Constants.placeholderNameDef) (var "fields")) @@ var "pats",- _Pattern_star>>: lambda "p" $ var "mod" @@ string "Elmt" @@ (unaryFunction TTypes.list) @@ var "p"]- @@ var "pat"]- $ var "forPat" @@ var "pat"+ "forRecordOrUnion">: ("isRecord" ~> "construct" ~> "pats" ~>+ "minPats" <~ simplify @@ var "isRecord" @@ var "pats" $+ "fieldNames" <~ findNames @@ var "minPats" $+ "toField" <~ ("n" ~> "p" ~> var "descend" @@ var "n" @@+ ("pairs" ~> pair (Core.fieldType (Core.name (var "n")) (Pairs.second (Lists.head (var "pairs")))) (Lists.tail (var "pairs"))) @@+ var "p") $+ "fieldPairs" <~ Lists.zipWith (var "toField") (var "fieldNames") (var "minPats") $+ "fields" <~ Lists.map (unaryFunction Pairs.first) (var "fieldPairs") $+ "els" <~ Lists.concat (Lists.map (unaryFunction Pairs.second) (var "fieldPairs")) $+ Logic.ifElse (isNontrivial @@ var "isRecord" @@ var "pats")+ (Lists.cons (pair (var "lname") (var "construct" @@ var "fields")) (var "els"))+ (var "forPat" @@ (Lists.head (var "minPats"))))] $ -rawNameDef :: TBinding (G.Pattern -> String)-rawNameDef = define "rawName" $+ var "forPat" @@ var "pat"++rawName :: TBinding (G.Pattern -> String)+rawName = define "rawName" $ doc "Get raw name from pattern" $- lambda "pat" $ match G._Pattern Nothing [- _Pattern_alternatives>>: constant $ string "alts",- _Pattern_constant>>: lambda "c" $ ref Formatting.capitalizeDef @@ (ref Formatting.withCharacterAliasesDef @@ (Grammar.unConstant $ var "c")),- _Pattern_ignored>>: constant $ string "ignored",- _Pattern_labeled>>: lambda "lp" $ Grammar.unLabel $ Grammar.labeledPatternLabel $ var "lp",- _Pattern_nil>>: constant $ string "none",- _Pattern_nonterminal>>: lambda "s" $ ref Formatting.capitalizeDef @@ (Grammar.unSymbol $ var "s"),- _Pattern_option>>: lambda "p" $ ref Formatting.capitalizeDef @@ (ref rawNameDef @@ var "p"),- _Pattern_plus>>: lambda "p" $ Strings.cat2 (string "listOf") (ref Formatting.capitalizeDef @@ (ref rawNameDef @@ var "p")),- _Pattern_regex>>: constant $ string "regex",- _Pattern_sequence>>: constant $ string "sequence",- _Pattern_star>>: lambda "p" $ Strings.cat2 (string "listOf") (ref Formatting.capitalizeDef @@ (ref rawNameDef @@ var "p"))]+ "pat" ~> match G._Pattern Nothing [+ _Pattern_alternatives>>: constant (string "alts"),+ _Pattern_constant>>: "c" ~> Formatting.capitalize @@ (Formatting.withCharacterAliases @@ (Grammar.unConstant (var "c"))),+ _Pattern_ignored>>: constant (string "ignored"),+ _Pattern_labeled>>: "lp" ~> Grammar.unLabel (Grammar.labeledPatternLabel (var "lp")),+ _Pattern_nil>>: constant (string "none"),+ _Pattern_nonterminal>>: "s" ~> Formatting.capitalize @@ (Grammar.unSymbol (var "s")),+ _Pattern_option>>: "p" ~> Formatting.capitalize @@ (rawName @@ var "p"),+ _Pattern_plus>>: "p" ~> Strings.cat2 (string "listOf") (Formatting.capitalize @@ (rawName @@ var "p")),+ _Pattern_regex>>: constant (string "regex"),+ _Pattern_sequence>>: constant (string "sequence"),+ _Pattern_star>>: "p" ~> Strings.cat2 (string "listOf") (Formatting.capitalize @@ (rawName @@ var "p"))] @@ var "pat" -simplifyDef :: TBinding (Bool -> [G.Pattern] -> [G.Pattern])-simplifyDef = define "simplify" $+simplify :: TBinding (Bool -> [G.Pattern] -> [G.Pattern])+simplify = define "simplify" $ doc "Remove trivial patterns from records" $- lambda "isRecord" $ lambda "pats" $ lets [- "isConstant">: lambda "p" $ match G._Pattern (Just false) [- G._Pattern_constant>>: constant true] @@ var "p"]- $ Logic.ifElse (var "isRecord")- (Lists.filter (lambda "p" $ Logic.not $ var "isConstant" @@ var "p") (var "pats"))- (var "pats")+ "isRecord" ~> "pats" ~>+ "isConstant" <~ ("p" ~> match G._Pattern (Just false) [+ G._Pattern_constant>>: constant true] @@ var "p") $+ Logic.ifElse (var "isRecord")+ (Lists.filter ("p" ~> Logic.not (var "isConstant" @@ var "p")) (var "pats"))+ (var "pats") -toNameDef :: TBinding (Namespace -> String -> Name)-toNameDef = define "toName" $+toName :: TBinding (Namespace -> String -> Name)+toName = define "toName" $ doc "Convert local name to qualified name" $- lambda "ns" $ lambda "local" $- ref Names.unqualifyNameDef @@ (Module.qualifiedName (just $ var "ns") (var "local"))+ "ns" ~> "local" ~>+ Names.unqualifyName @@ (Module.qualifiedName (just (var "ns")) (var "local")) -wrapTypeDef :: TBinding (Type -> Type)-wrapTypeDef = define "wrapType" $+wrapType :: TBinding (Type -> Type)+wrapType = define "wrapType" $ doc "Wrap a type in a placeholder name, unless it is already a wrapper, record, or union type" $- lambda "t" $ cases _Type (var "t") (Just $ Core.typeWrap $ Core.wrappedType (Core.nameLift placeholderName) $ var "t") [- _Type_record>>: constant $ var "t",- _Type_union>>: constant $ var "t",- _Type_wrap>>: constant $ var "t"]+ "t" ~> cases _Type (var "t")+ (Just (Core.typeWrap (Core.wrappedType (Core.nameLift placeholderName) (var "t")))) [+ _Type_record>>: constant (var "t"),+ _Type_union>>: constant (var "t"),+ _Type_wrap>>: constant (var "t")]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Hoisting.hs view
@@ -0,0 +1,1009 @@+module Hydra.Sources.Kernel.Terms.Hoisting where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ augmentBindingsWithNewFreeVars,+ bindingIsPolymorphic, bindingUsesContextTypeVars,+ countVarOccurrences,+ hoistAllLetBindings, hoistCaseStatements, hoistCaseStatementsInGraph, hoistLetBindingsWithContext, hoistLetBindingsWithPredicate, hoistPolymorphicLetBindings, hoistSubterms,+ isApplicationFunction, isEliminationUnion, isLambdaBody, isUnionElimination, isUnionEliminationApplication,+ normalizePathForHoisting,+ rewriteAndFoldTermWithTypeContext, rewriteAndFoldTermWithTypeContextAndPath, rewriteTermWithTypeContext,+ shouldHoistAll, shouldHoistCaseStatement, shouldHoistPolymorphic, updateHoistState)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+++ns :: Namespace+ns = Namespace "hydra.hoisting"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Lexical.ns, Rewriting.ns, Schemas.ns, Sorting.ns, Substitution.ns]+ kernelTypesNamespaces $+ Just "Functions for deep term rewriting operations involving hoisting subterms or bindings into enclosing let terms."+ where+ elements = [+ toBinding augmentBindingsWithNewFreeVars,+ toBinding bindingIsPolymorphic,+ toBinding bindingUsesContextTypeVars,+ toBinding countVarOccurrences,+ toBinding hoistAllLetBindings,+ toBinding hoistCaseStatements,+ toBinding hoistCaseStatementsInGraph,+ toBinding hoistLetBindingsWithContext,+ toBinding hoistLetBindingsWithPredicate,+ toBinding hoistPolymorphicLetBindings,+ toBinding hoistSubterms,+ toBinding isApplicationFunction,+ toBinding isEliminationUnion,+ toBinding isLambdaBody,+ toBinding isUnionElimination,+ toBinding isUnionEliminationApplication,+ toBinding normalizePathForHoisting,+ toBinding rewriteAndFoldTermWithTypeContext,+ toBinding rewriteAndFoldTermWithTypeContextAndPath,+ toBinding rewriteTermWithTypeContext,+ toBinding shouldHoistAll,+ toBinding shouldHoistCaseStatement,+ toBinding shouldHoistPolymorphic,+ toBinding updateHoistState]++-- | Check if a binding has a polymorphic type (non-empty list of type scheme variables)+bindingIsPolymorphic :: TBinding (Binding -> Bool)+bindingIsPolymorphic = define "bindingIsPolymorphic" $+ doc "Check if a binding has a polymorphic type (non-empty list of type scheme variables)" $+ "binding" ~>+ optCases (Core.bindingType $ var "binding")+ false -- No type scheme means monomorphic (or untyped)+ ("ts" ~> Logic.not $ Lists.null $ Core.typeSchemeVariables $ var "ts")++-- | Check if a binding's type uses any type variables from the given TypeContext.+-- This checks if the free type variables in the binding's type intersect with+-- the type variables in scope (typeContextTypeVariables).+bindingUsesContextTypeVars :: TBinding (TypeContext -> Binding -> Bool)+bindingUsesContextTypeVars = define "bindingUsesContextTypeVars" $+ doc ("Check if a binding's type uses any type variables from the given TypeContext."+ <> " Returns True if the free type variables in the binding's type intersect with"+ <> " the type variables in scope (typeContextTypeVariables).") $+ "cx" ~> "binding" ~>+ optCases (Core.bindingType $ var "binding")+ false -- No type scheme means no type variables used+ ("ts" ~>+ "freeInType" <~ Rewriting.freeVariablesInType @@ Core.typeSchemeType (var "ts") $+ "contextTypeVars" <~ Typing.typeContextTypeVariables (var "cx") $+ Logic.not $ Sets.null $ Sets.intersection (var "freeInType") (var "contextTypeVars"))++-- | Count the number of occurrences of a variable name in a term. Assumes no variable shadowing.+countVarOccurrences :: TBinding (Name -> Term -> Int)+countVarOccurrences = define "countVarOccurrences" $+ doc "Count the number of occurrences of a variable name in a term. Assumes no variable shadowing." $+ "name" ~> "term" ~>+ "childCount" <~ Lists.foldl+ ("acc" ~> "t" ~> Math.add (var "acc") (countVarOccurrences @@ var "name" @@ var "t"))+ (int32 0)+ (Rewriting.subterms @@ var "term") $+ cases _Term (var "term")+ (Just $ var "childCount") [+ _Term_variable>>: "v" ~>+ Logic.ifElse (Equality.equal (var "v") (var "name"))+ (Math.add (int32 1) (var "childCount"))+ (var "childCount")]++-- | Augment bindings with new free variables introduced by substitution, wrapping with lambdas after any type lambdas.+augmentBindingsWithNewFreeVars :: TBinding (TypeContext -> S.Set Name -> [Binding] -> ([Binding], TermSubst))+augmentBindingsWithNewFreeVars = define "augmentBindingsWithNewFreeVars" $+ doc "Augment bindings with new free variables introduced by substitution, wrapping with lambdas after any type lambdas." $+ "cx" ~> "boundVars" ~> "bindings" ~>+ "types" <~ Typing.typeContextTypes (var "cx") $+ "wrapAfterTypeLambdas" <~ ("vars" ~> "term" ~>+ cases _Term (var "term")+ -- Default: wrap with lambdas (for any non-type-lambda term)+ (Just $ Lists.foldl+ ("t" ~> "p" ~> Core.termFunction $ Core.functionLambda $+ Core.lambda (Pairs.first $ var "p") (Pairs.second $ var "p") (var "t"))+ (var "term") (Lists.reverse $ var "vars")) [+ -- Recurse through type lambdas+ _Term_typeLambda>>: "tl" ~>+ Core.termTypeLambda $ Core.typeLambda+ (Core.typeLambdaParameter $ var "tl")+ (var "wrapAfterTypeLambdas" @@ var "vars" @@ (Core.typeLambdaBody $ var "tl"))]) $+ "augment" <~ ("b" ~>+ "freeVars" <~ Sets.toList (Sets.intersection (var "boundVars") (Rewriting.freeVariablesInTerm @@ (Core.bindingTerm $ var "b"))) $+ "varTypePairs" <~ Lists.map ("v" ~> pair (var "v") (Maps.lookup (var "v") (var "types"))) (var "freeVars") $+ "varTypes" <~ Maybes.cat (Lists.map (unaryFunction Pairs.second) (var "varTypePairs")) $+ Logic.ifElse (Logic.or (Lists.null $ var "freeVars")+ (Logic.not $ Equality.equal (Lists.length $ var "varTypes") (Lists.length $ var "varTypePairs")))+ (pair (var "b") nothing)+ (pair+ (Core.binding+ (Core.bindingName $ var "b")+ (var "wrapAfterTypeLambdas" @@ var "varTypePairs" @@ (Core.bindingTerm $ var "b"))+ (Maybes.map ("ts" ~> Core.typeScheme+ (Core.typeSchemeVariables $ var "ts")+ (Lists.foldl+ ("acc" ~> "t" ~> Core.typeFunction $ Core.functionType (var "t") (var "acc"))+ (Core.typeSchemeType $ var "ts")+ (Lists.reverse $ var "varTypes"))+ (Core.typeSchemeConstraints $ var "ts")) (Core.bindingType $ var "b")))+ (just $ pair+ (Core.bindingName $ var "b")+ (Lists.foldl+ ("t" ~> "v" ~> Core.termApplication $ Core.application (var "t") (Core.termVariable $ var "v"))+ (Core.termVariable $ Core.bindingName $ var "b")+ (var "freeVars"))))) $+ "results" <~ Lists.map (var "augment") (var "bindings") $+ pair+ (Lists.map (unaryFunction Pairs.first) (var "results"))+ (Typing.termSubst $ Maps.fromList $ Maybes.cat $ Lists.map (unaryFunction Pairs.second) (var "results"))++-- | Predicate for hoisting polymorphic bindings.+-- A binding should be hoisted if it is polymorphic or uses outer type variables.+shouldHoistPolymorphic :: TBinding (TypeContext -> Binding -> Bool)+shouldHoistPolymorphic = define "shouldHoistPolymorphic" $+ doc ("Predicate for hoisting polymorphic bindings."+ <> " Returns True if the binding is polymorphic (has type scheme variables)"+ <> " or if its type uses any type variables from the TypeContext.") $+ "cx" ~> "binding" ~>+ Logic.or (bindingIsPolymorphic @@ var "binding") (bindingUsesContextTypeVars @@ var "cx" @@ var "binding")++-- | Predicate for hoisting all bindings unconditionally.+shouldHoistAll :: TBinding (TypeContext -> Binding -> Bool)+shouldHoistAll = define "shouldHoistAll" $+ doc "Predicate that always returns True, for hoisting all bindings unconditionally." $+ constant (constant true)++hoistLetBindingsWithPredicate :: TBinding ((Binding -> Bool) -> (TypeContext -> Binding -> Bool) -> TypeContext -> Let -> Let)+hoistLetBindingsWithPredicate = define "hoistLetBindingsWithPredicate" $+ doc ("Transform a let-term by pulling let bindings to the top level."+ <> " The isParentBinding predicate applies to top-level bindings and determines whether their subterm bindings are"+ <> " eligible for hoisting."+ <> " The shouldHoistBinding predicate takes the TypeContext and a subterm binding,"+ <> " and returns True if the binding should be hoisted."+ <> " This is useful for targets like Java that cannot have polymorphic definitions in arbitrary positions."+ <> " The TypeContext provides information about type variables and lambda variables in scope."+ <> " If a hoisted binding captures let-bound or lambda-bound variables from an enclosing scope,"+ <> " the binding is wrapped in lambdas for those variables, and references are replaced"+ <> " with applications."+ <> " If a hoisted binding captures type variables from an enclosing type lambda scope,"+ <> " those type variables are added to the binding's type scheme, and references are replaced"+ <> " with type applications."+ <> " Note: we assume that there is no variable shadowing; use hydra.rewriting.unshadowVariables first.") $+ "isParentBinding" ~> "shouldHoistBinding" ~> "cx0" ~> "let0" ~>+ "hoistOne" <~ ("prefix" ~> "cx" ~> "pair" ~> "bindingWithCapturedVars" ~>+ "bindingAndReplacementPairs" <~ Pairs.first (var "pair") $+ "alreadyUsedNames" <~ Pairs.second (var "pair") $+ "b" <~ Pairs.first (var "bindingWithCapturedVars") $+ "capturedTermVars" <~ Pairs.second (var "bindingWithCapturedVars") $+ "types" <~ Typing.typeContextTypes (var "cx") $+ "capturedTermVarTypePairs" <~ Lists.map+ ("v" ~> pair (var "v") (Maps.lookup (var "v") (var "types")))+ (var "capturedTermVars") $+ -- We can only construct a new type scheme if all of the captured term variables have types+ -- If there are any captured term variables, we create a function type+ "capturedTermVarTypes" <~ Lists.map ("typ" ~> Rewriting.deannotateTypeParameters @@ var "typ") (Maybes.cat (Lists.map (unaryFunction Pairs.second) (var "capturedTermVarTypePairs"))) $+ -- Captured type vars include those free in the binding's type AND those free in captured term var types.+ -- The latter is needed because wrapping with lambdas for captured term vars introduces their types+ -- into the hoisted binding's type.+ "freeInBindingType" <~ optCases (Core.bindingType $ var "b")+ Sets.empty+ ("ts" ~> Rewriting.freeVariablesInType @@ (Core.typeSchemeType $ var "ts")) $+ "freeInCapturedVarTypes" <~ Sets.unions (Lists.map ("t" ~> Rewriting.freeVariablesInType @@ var "t") (var "capturedTermVarTypes")) $+ "capturedTypeVars" <~ Sets.toList (Sets.intersection+ (Typing.typeContextTypeVariables $ var "cx")+ (Sets.union (var "freeInBindingType") (var "freeInCapturedVarTypes"))) $+ "globalBindingName" <~ Lexical.chooseUniqueName+ @@ var "alreadyUsedNames"+ @@ (Core.name (Strings.cat2 (var "prefix") (Core.unName $ Core.bindingName $ var "b"))) $+ "newUsedNames" <~ Sets.insert (var "globalBindingName") (var "alreadyUsedNames") $+ "newTypeScheme" <~ Logic.ifElse+ (Equality.equal (Lists.length $ var "capturedTermVarTypes") (Lists.length $ var "capturedTermVarTypePairs"))+ (Maybes.map+ ("ts" ~> Core.typeScheme+ (Lists.nub $ Lists.concat2 (var "capturedTypeVars") (Core.typeSchemeVariables $ var "ts"))+ (Lists.foldl+ ("t" ~> "a" ~> Core.typeFunction $ Core.functionType (var "a") (var "t"))+ (Core.typeSchemeType $ var "ts")+ (Lists.reverse $ var "capturedTermVarTypes"))+ (Core.typeSchemeConstraints $ var "ts"))+ (Core.bindingType $ var "b"))+ nothing $++ -- Strip only outer type lambda wrappers from the original term (preserving type application wrappers).+ -- Then re-add all type scheme variables as type lambdas.+ "strippedTerm" <~ Rewriting.stripTypeLambdas @@ (Core.bindingTerm $ var "b") $+ "termWithLambdas" <~ Lists.foldl+ ("t" ~> "p" ~> Core.termFunction $ Core.functionLambda $+ Core.lambda (Pairs.first $ var "p") (Maybes.map ("dom" ~> Rewriting.deannotateTypeParameters @@ var "dom") (Pairs.second $ var "p")) (var "t"))+ (var "strippedTerm")+ (Lists.reverse $ var "capturedTermVarTypePairs") $+ -- Add type lambdas for all new type scheme variables (captured + original scheme vars)+ "termWithTypeLambdas" <~ Lists.foldl+ ("t" ~> "v" ~> Core.termTypeLambda $ Core.typeLambda (var "v") (var "t"))+ (var "termWithLambdas")+ (Lists.reverse $ Maybes.maybe (list ([] :: [TTerm Name])) (unaryFunction Core.typeSchemeVariables) $ var "newTypeScheme") $++ -- Build the replacement: first apply type variables for captured type vars,+ -- then apply term variables for captured term vars.+ -- E.g. if capturedTypeVars=[a,b] and capturedTermVars=[x], replacement is: f_q⟨a⟩⟨b⟩ x+ "withTypeApps" <~ Lists.foldl+ ("t" ~> "v" ~> Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeVariable $ var "v"))+ (Core.termVariable $ var "globalBindingName")+ (var "capturedTypeVars") $+ "replacement" <~ Lists.foldl+ ("t" ~> "v" ~> Core.termApplication $ Core.application (var "t") (Core.termVariable $ var "v"))+ (var "withTypeApps")+ (var "capturedTermVars") $++ "newBindingAndReplacement" <~ pair+ (Core.binding (var "globalBindingName") (var "termWithTypeLambdas") (var "newTypeScheme"))+ (var "replacement") $++ -- Note: using cons for efficiency; will reverse later so that original bindings come first+ "newPairs" <~ Lists.cons (var "newBindingAndReplacement") (var "bindingAndReplacementPairs") $+ pair (var "newPairs") (var "newUsedNames")) $++ -- Rewriting function for subterms of existing bindings which also produces hoisted bindings+ "rewrite" <~ ("prefix" ~> "recurse" ~> "cx" ~> "bindingsAndNames" ~> "term" ~>+ -- Save previously finished bindings before we recurse; we don't want to apply the same substitutions to these+ "previouslyFinishedBindings" <~ Pairs.first (var "bindingsAndNames") $+ "emptyBindingsAndNames" <~ pair+ (list ([] :: [TBinding Binding]))+ (Pairs.second $ var "bindingsAndNames") $+ -- Recurse to hoist bindings from further subterms. After this, we only need to check for let at the current level.+ "result" <~ var "recurse" @@ var "emptyBindingsAndNames" @@ var "term" $+ "newBindingsAndNames" <~ Pairs.first (var "result") $+ "bindingsSoFar" <~ Pairs.first (var "newBindingsAndNames") $+ "alreadyUsedNames" <~ Pairs.second (var "newBindingsAndNames") $+ "newTerm" <~ Pairs.second (var "result") $+ cases _Term (var "newTerm")+ -- Not a let; we are done with this subterm+ (Just $ pair+ (pair (Lists.concat2 (var "previouslyFinishedBindings") (var "bindingsSoFar")) (var "alreadyUsedNames"))+ (var "newTerm")) [+ -- For a let term, we must process its bindings, hoist any or all of them as needed,+ -- and then we must replace any references to the hoisted bindings+ _Term_let>>: "l" ~>+ "body" <~ Core.letBody (var "l") $++ -- Separate bindings to be hoisted from those to be left in place+ "partitionPair" <~ Lists.partition (var "shouldHoistBinding" @@ var "cx") (Core.letBindings $ var "l") $+ "hoistUs" <~ Pairs.first (var "partitionPair") $+ "keepUs" <~ Pairs.second (var "partitionPair") $++ -- Find all of the term-level variables which are captured by each binding to be hoisted.+ -- Because of dependencies between sibling bindings, this must be done all at once, rather than+ -- individually per binding.+ "hoistedBindingNames" <~ Lists.map (unaryFunction $ Core.bindingName) (var "hoistUs") $++ -- Polymorphic let-bound variables, which are hoisted themselves.+ -- We need to include them for argument propagation, but exclude them from the final list of arguments+ -- for each hoisted binding.+ "polyLetVariables" <~ (Sets.fromList $ Lists.filter+ ("v" ~> optCases (Maps.lookup (var "v") (Typing.typeContextTypes $ var "cx"))+ false -- This function should not be applied to untyped terms, but we make a hopeful guess if it is+ Schemas.fTypeIsPolymorphic)+ (Sets.toList $ Typing.typeContextLetVariables $ var "cx")) $++ "boundTermVariables" <~ Sets.union+ (Typing.typeContextLambdaVariables $ var "cx")+ (Typing.typeContextLetVariables $ var "cx") $+ "freeVariablesInEachBinding" <~ Lists.map+ ("b" ~> Sets.toList $ Sets.intersection+ (var "boundTermVariables")+ (Rewriting.freeVariablesInTerm @@ (Core.bindingTerm $ var "b")))+ (var "hoistUs") $+ "bindingDependencies" <~ Lists.map+ ("vars" ~> Lists.partition+ ("v" ~> Sets.member (var "v") (Sets.fromList $ var "hoistedBindingNames"))+ (var "vars"))+ (var "freeVariablesInEachBinding") $+ "bindingEdges" <~ Lists.zip+ (var "hoistedBindingNames")+ (Lists.map (unaryFunction Pairs.first) (var "bindingDependencies")) $+ "bindingImmediateCapturedVars" <~ Lists.zip+ (var "hoistedBindingNames")+ (Lists.map (unaryFunction Pairs.second) (var "bindingDependencies")) $+ "capturedVarsMap" <~ Maps.fromList (Sorting.propagateTags @@ var "bindingEdges" @@ var "bindingImmediateCapturedVars") $+ "bindingsWithCapturedVars" <~ Lists.map+ ("b" ~> pair (var "b") $ optCases (Maps.lookup (Core.bindingName $ var "b") (var "capturedVarsMap"))+ (list ([] :: [TTerm Name]))+ ("vars" ~> Sets.toList $ Sets.difference (var "vars") (var "polyLetVariables")))+ (var "hoistUs") $++ -- Now hoist each binding, keeping track of the names used so far. We get back a list of+ -- top-level bindings along with replacement terms for each bound name.+ "hoistPairsAndNames" <~ Lists.foldl+ (var "hoistOne" @@ var "prefix" @@ var "cx")+ (pair (list ([] :: [TTerm (Binding, Term)])) (var "alreadyUsedNames"))+ (var "bindingsWithCapturedVars") $+ "hoistPairs" <~ Lists.reverse (Pairs.first $ var "hoistPairsAndNames") $+ "hoistedBindings" <~ Lists.map (unaryFunction Pairs.first) (var "hoistPairs") $+ "replacements" <~ Lists.map (unaryFunction Pairs.second) (var "hoistPairs") $+ "finalUsedNames" <~ Pairs.second (var "hoistPairsAndNames") $++ -- Pair each hoisted name with its replacement+ "hoistNameReplacementPairs" <~ Lists.zip+ (Lists.map (unaryFunction Core.bindingName) (var "hoistUs"))+ (var "replacements") $++ -- Map from binding name to original binding (for checking polymorphism)+ "hoistBindingMap" <~ Maps.fromList (Lists.map+ ("b" ~> pair (Core.bindingName $ var "b") (var "b"))+ (var "hoistUs")) $++ -- A binding is cacheable if: (1) referenced >1 time in body, AND (2) not polymorphic.+ -- Polymorphic bindings (with non-empty typeSchemeVariables) can't be local Java variables.+ -- Non-polymorphic bindings (hoisted only because they use context type vars) are safe to cache.+ "isCacheable" <~ ("name" ~>+ "multiRef" <~ Equality.gte (countVarOccurrences @@ var "name" @@ var "body") (int32 2) $+ "isPoly" <~ optCases (Maps.lookup (var "name") (var "hoistBindingMap"))+ false+ ("b" ~> bindingIsPolymorphic @@ var "b") $+ Logic.and (var "multiRef") (Logic.not $ var "isPoly")) $++ -- Split into single-ref/polymorphic (substitute directly) and cacheable (keep as local let)+ "singleRefPairs" <~ Lists.filter+ ("p" ~> Logic.not $ var "isCacheable" @@ Pairs.first (var "p"))+ (var "hoistNameReplacementPairs") $+ "multiRefPairs" <~ Lists.filter+ ("p" ~> var "isCacheable" @@ Pairs.first (var "p"))+ (var "hoistNameReplacementPairs") $++ -- Full substitution for all hoisted names (used for hoisted bindings, kept bindings, etc.)+ "fullSubst" <~ (Typing.termSubst $ Maps.fromList $ var "hoistNameReplacementPairs") $+ -- Partial substitution for single-ref names only (used for the body)+ "bodyOnlySubst" <~ (Typing.termSubst $ Maps.fromList $ var "singleRefPairs") $++ -- Substitute only single-ref names in the body; multi-ref names stay as variable refs+ "bodySubst" <~ Substitution.substituteInTerm @@ var "bodyOnlySubst" @@ var "body" $++ -- Create local let bindings for multi-ref hoisted names.+ -- These bind the original name to the replacement expression (which calls the hoisted function once).+ -- Carry over the original binding's TypeScheme so that downstream code can use typeOf without inference.+ "cacheBindings" <~ Lists.map+ ("p" ~>+ "origType" <~ optCases (Maps.lookup (Pairs.first $ var "p") (var "hoistBindingMap"))+ nothing+ ("b" ~> Core.bindingType $ var "b") $+ Core.binding (Pairs.first $ var "p") (Pairs.second $ var "p") (var "origType"))+ (var "multiRefPairs") $++ -- Wrap the body in a let with the cache bindings if there are any+ "bodyWithCache" <~ Logic.ifElse (Lists.null $ var "cacheBindings")+ (var "bodySubst")+ (Core.termLet $ Core.let_ (var "cacheBindings") (var "bodySubst")) $++ -- Use full substitution for everything except the body+ "keepUsSubst" <~ Lists.map (Substitution.substituteInBinding @@ var "fullSubst") (var "keepUs") $+ "hoistedBindingsSubst" <~ Lists.map (Substitution.substituteInBinding @@ var "fullSubst") (var "hoistedBindings") $+ "bindingsSoFarSubst" <~ Lists.map (Substitution.substituteInBinding @@ var "fullSubst") (var "bindingsSoFar") $++ -- Augment bindings from inner lets with any new free variables introduced by substitution+ "augmentResult" <~ augmentBindingsWithNewFreeVars @@ var "cx" @@ (Sets.difference (var "boundTermVariables") (var "polyLetVariables")) @@ var "bindingsSoFarSubst" $+ "bindingsSoFarAugmented" <~ Pairs.first (var "augmentResult") $+ "augmentSubst" <~ Pairs.second (var "augmentResult") $++ -- Apply the augment substitution to update references in other bindings and body+ "hoistedBindingsFinal" <~ Lists.map (Substitution.substituteInBinding @@ var "augmentSubst") (var "hoistedBindingsSubst") $+ "bindingsSoFarFinal" <~ Lists.map (Substitution.substituteInBinding @@ var "augmentSubst") (var "bindingsSoFarAugmented") $+ "bodyFinal" <~ Substitution.substituteInTerm @@ var "augmentSubst" @@ var "bodyWithCache" $+ "keepUsFinal" <~ Lists.map (Substitution.substituteInBinding @@ var "augmentSubst") (var "keepUsSubst") $++ "finalTerm" <~ Logic.ifElse (Lists.null (var "keepUsFinal"))+ (var "bodyFinal")+ (Core.termLet $ Core.let_ (var "keepUsFinal") (var "bodyFinal")) $++ pair+ (pair+ (Lists.concat $ list [var "previouslyFinishedBindings", var "hoistedBindingsFinal", var "bindingsSoFarFinal"])+ (var "finalUsedNames"))+ (var "finalTerm")]) $+ "cx1" <~ Schemas.extendTypeContextForLet @@ ("c" ~> "b" ~> nothing) @@ var "cx0" @@ var "let0" $+ -- Each binding becomes a list of bindings: the original one with substitutions in its body,+ -- as well as hoisted bindings from any level. The hoisted bindings share the original binding's namespace.+ -- Since each top-level binding has exclusive access to its hoisted bindings, it can be processed individually.+ "forActiveBinding" <~ ("b" ~>+ -- Note: no possibility of name collisions between groups of hoisted bindings, because the names of the parent+ -- bindings are unique.+ "prefix" <~ (Strings.cat2 (Core.unName (Core.bindingName $ var "b")) (string "_")) $+ "init" <~ pair (list ([] :: [TTerm Binding])) (Sets.singleton $ Core.bindingName $ var "b") $+ "resultPair" <~ rewriteAndFoldTermWithTypeContext+ @@ (var "rewrite" @@ var "prefix") @@ var "cx1" @@ var "init" @@ (Core.bindingTerm $ var "b") $+ "resultBindings" <~ Pairs.first (Pairs.first (var "resultPair")) $+ "resultTerm" <~ Pairs.second (var "resultPair") $+ Lists.cons (Core.bindingWithTerm (var "b") (var "resultTerm")) (var "resultBindings")) $+ "forBinding" <~ ("b" ~> Logic.ifElse (var "isParentBinding" @@ var "b")+ (var "forActiveBinding" @@ var "b")+ (list [var "b"])) $+ Core.let_+ (Lists.concat $ Lists.map (var "forBinding") $ Core.letBindings $ var "let0")+ -- Original let body; hoisting more deeply nested bindings does not introduce additional variables into the body,+ -- and we do not hoist bindings from the body itself.+ -- This function is primarily intended for module-level transformations into targets like Java,+ -- in which we only care about the bindings of a whole-graph let term, while discarding the trivial let body.+ (Core.letBody $ var "let0")++-- | Transform a let-term by pulling all polymorphic let bindings to the top level+hoistPolymorphicLetBindings :: TBinding ((Binding -> Bool) -> Let -> Let)+hoistPolymorphicLetBindings = define "hoistPolymorphicLetBindings" $+ doc ("Transform a let-term by pulling all polymorphic let bindings to the top level."+ <> " This is useful to ensure that polymorphic bindings are not nested within other terms,"+ <> " which is unsupported by certain targets such as Java."+ <> " Polymorphic bindings are those with a non-empty list of type scheme variables."+ <> " If a hoisted binding captures lambda-bound variables from an enclosing scope,"+ <> " the binding is wrapped in lambdas for those variables, and references are replaced"+ <> " with applications."+ <> " Note: Assumes no variable shadowing; use hydra.rewriting.unshadowVariables first.") $+ "isParentBinding" ~> "let0" ~>+ -- Create an empty TypeContext+ "emptyIx" <~ Typing.inferenceContext (Maps.empty) (Maps.empty) (Maps.empty) (Maps.empty) false $+ "emptyCx" <~ Typing.typeContext Maps.empty Maps.empty Sets.empty Sets.empty Sets.empty (var "emptyIx") $+ hoistLetBindingsWithPredicate @@ var "isParentBinding" @@ shouldHoistPolymorphic @@ var "emptyCx" @@ var "let0"++hoistLetBindingsWithContext :: TBinding ((Binding -> Bool) -> TypeContext -> Let -> Let)+hoistLetBindingsWithContext = define "hoistLetBindingsWithContext" $+ doc ("Transform a let-term by pulling polymorphic let bindings to the top level, using TypeContext."+ <> " A binding is hoisted if:"+ <> " (1) It is polymorphic (has non-empty typeSchemeVariables), OR"+ <> " (2) Its type uses type variables from the TypeContext (i.e., from enclosing type lambdas)."+ <> " Bindings which are already at the top level are not hoisted."+ <> " If a hoisted binding captures lambda-bound or let-bound variables from an enclosing scope,"+ <> " the binding is wrapped in lambdas for those variables, and references are replaced"+ <> " with applications."+ <> " If a hoisted binding uses type variables from the context, those type variables are"+ <> " added to the binding's type scheme."+ <> " Note: we assume that there is no variable shadowing; use hydra.rewriting.unshadowVariables first.") $+ "isParentBinding" ~> "cx" ~> "let0" ~>+ hoistLetBindingsWithPredicate @@ var "isParentBinding" @@ shouldHoistPolymorphic @@ var "cx" @@ var "let0"++hoistAllLetBindings :: TBinding (Let -> Let)+hoistAllLetBindings = define "hoistAllLetBindings" $+ doc ("Transform a let-term by pulling ALL let bindings to the top level."+ <> " This is useful for targets like Java that don't support nested let expressions at all."+ <> " If a hoisted binding captures lambda-bound variables from an enclosing scope,"+ <> " the binding is wrapped in lambdas for those variables, and references are replaced"+ <> " with applications."+ <> " Note: Assumes no variable shadowing; use hydra.rewriting.unshadowVariables first.") $+ "let0" ~>+ -- Create an empty TypeContext+ "emptyIx" <~ Typing.inferenceContext (Maps.empty) (Maps.empty) (Maps.empty) (Maps.empty) false $+ "emptyCx" <~ Typing.typeContext Maps.empty Maps.empty Sets.empty Sets.empty Sets.empty (var "emptyIx") $+ hoistLetBindingsWithPredicate @@ constant true @@ shouldHoistAll @@ var "emptyCx" @@ var "let0"++hoistCaseStatements :: TBinding (TypeContext -> Term -> Term)+hoistCaseStatements = define "hoistCaseStatements" $+ doc ("Hoist case statements into local let bindings."+ <> " This is useful for targets such as Python which only support case statements (match) at the top level."+ <> " Case statements are hoisted only when they appear at non-top-level positions."+ <> " Top level = root, or reachable through annotations, let body/binding, lambda bodies, or ONE application LHS."+ <> " Once through an application LHS, lambda bodies no longer count as pass-through.") $+ hoistSubterms @@ shouldHoistCaseStatement++hoistCaseStatementsInGraph :: TBinding (Graph -> Flow Graph Graph)+hoistCaseStatementsInGraph = define "hoistCaseStatementsInGraph" $+ doc ("Hoist case statements into local let bindings for all elements in a graph."+ <> " This version operates prior to inference and uses an empty type context."+ <> " It hoists case statements and their applied arguments into let bindings.") $+ "graph" ~>+ -- Create an empty type context (no lambda variables to track since we're pre-inference)+ "emptyIx" <~ Typing.inferenceContext (Maps.empty) (Maps.empty) (Maps.empty) (Maps.empty) false $+ "emptyTx" <~ Typing.typeContext Maps.empty Maps.empty Sets.empty Sets.empty Sets.empty (var "emptyIx") $+ -- Convert graph to a term, apply hoisting, convert back+ "gterm0" <~ Schemas.graphAsTerm @@ var "graph" $+ "gterm1" <~ hoistCaseStatements @@ var "emptyTx" @@ var "gterm0" $+ "newElements" <~ Schemas.termAsGraph @@ var "gterm1" $+ produce $ Graph.graphWithElements (var "graph") (var "newElements")++-- | Check if a term is a union elimination (case statement)+isUnionElimination :: TBinding (Term -> Bool)+isUnionElimination = define "isUnionElimination" $+ doc "Check if a term is a union elimination (case statement)" $+ "term" ~> cases _Term (var "term")+ (Just false) [+ _Term_function>>: "f" ~> isEliminationUnion @@ var "f"]++-- | Check if a function is an elimination for union types+isEliminationUnion :: TBinding (Function -> Bool)+isEliminationUnion = define "isEliminationUnion" $+ doc "Check if a function is a union elimination" $+ "f" ~> cases _Function (var "f")+ (Just false) [+ _Function_elimination>>: "e" ~> cases _Elimination (var "e")+ (Just false) [+ _Elimination_union>>: constant true]]++-- | Check if a term is a case statement applied to an argument (i.e. Application where the function is a union elimination).+-- This is used for hoisting: we want to hoist the entire application, not just the bare case function.+isUnionEliminationApplication :: TBinding (Term -> Bool)+isUnionEliminationApplication = define "isUnionEliminationApplication" $+ doc "Check if a term is an application of a union elimination (case statement applied to an argument)" $+ "term" ~> cases _Term (var "term")+ (Just false) [+ _Term_application>>: "app" ~>+ isUnionElimination @@ (Rewriting.deannotateAndDetypeTerm @@ (Core.applicationFunction $ var "app"))]++-- | Wrap a list of bindings in a let term, pushing the let inside any leading lambdas.+-- This ensures that hoisted bindings don't break function analysis, which expects+-- lambdas before lets (not the other way around).+-- e.g., instead of Let([h=...], Lambda(p, body)), this produces Lambda(p, Let([h=...], body))+wrapLetInsideLambdas :: TBinding ([Binding] -> Term -> Term)+wrapLetInsideLambdas = define "wrapLetInsideLambdas" $+ doc "Wrap bindings in a let term, pushing the let inside leading lambdas" $+ "bindings" ~> "term" ~>+ cases _Term (var "term") (Just $ Core.termLet $ Core.let_ (var "bindings") (var "term")) [+ _Term_function>>: "f" ~>+ cases _Function (var "f") (Just $ Core.termLet $ Core.let_ (var "bindings") (var "term")) [+ _Function_lambda>>: "lam" ~>+ Core.termFunction $ Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "lam")+ (Core.lambdaDomain $ var "lam")+ (wrapLetInsideLambdas @@ var "bindings" @@ Core.lambdaBody (var "lam"))],+ _Term_annotated>>: "ann" ~>+ Core.termAnnotated $ Core.annotatedTerm+ (wrapLetInsideLambdas @@ var "bindings" @@ Core.annotatedTermBody (var "ann"))+ (Core.annotatedTermAnnotation $ var "ann")]++-- | Update state when traversing an accessor in the path for hoisting logic.+-- State is (stillAtTopLevel, haveUsedAppLHS).+-- Returns updated state after processing one accessor.+updateHoistState :: TBinding (TermAccessor -> (Bool, Bool) -> (Bool, Bool))+updateHoistState = define "updateHoistState" $+ doc ("Update hoisting state when traversing an accessor."+ <> " State is (atTopLevel, usedAppLHS). Returns updated state.") $+ "accessor" ~> "state" ~>+ "atTop" <~ Pairs.first (var "state") $+ "usedApp" <~ Pairs.second (var "state") $+ -- If already not at top level, stay that way+ Logic.ifElse (Logic.not $ var "atTop")+ (pair false (var "usedApp"))+ -- Check this accessor+ (cases _TermAccessor (var "accessor")+ -- Default: any other accessor takes us out of top level+ (Just $ pair false (var "usedApp")) [+ -- Annotations are transparent+ _TermAccessor_annotatedBody>>: constant $ pair true (var "usedApp"),+ -- Let body and binding are pass-through+ _TermAccessor_letBody>>: constant $ pair true (var "usedApp"),+ _TermAccessor_letBinding>>: constant $ pair true (var "usedApp"),+ -- Lambda body: pass-through if we haven't used app LHS yet+ _TermAccessor_lambdaBody>>: constant $+ Logic.ifElse (var "usedApp")+ (pair false true) -- After app LHS, lambda body is not pass-through+ (pair true false), -- Before app LHS, lambda body is pass-through+ -- Case branches: same rules as lambda body+ _TermAccessor_unionCasesBranch>>: constant $+ Logic.ifElse (var "usedApp")+ (pair false true)+ (pair true false),+ _TermAccessor_unionCasesDefault>>: constant $+ Logic.ifElse (var "usedApp")+ (pair false true)+ (pair true false),+ -- Application function (LHS): mark usedApp=true+ _TermAccessor_applicationFunction>>: constant $+ Logic.ifElse (var "usedApp")+ (pair false true) -- Already used app, not at top level+ (pair true true), -- First app, still at top level but mark usedApp+ -- Application argument: takes us out of top level+ _TermAccessor_applicationArgument>>: constant $ pair false (var "usedApp")])++-- | Normalize a path by handling immediately-applied lambdas.+-- The pattern [applicationFunction, lambdaBody, ...] represents (\x -> ...) arg+-- which is semantically equivalent to let x = arg in ...+-- We replace applicationFunction followed by lambdaBody with just letBody,+-- which allows the case inside to remain at "top level".+normalizePathForHoisting :: TBinding ([TermAccessor] -> [TermAccessor])+normalizePathForHoisting = define "normalizePathForHoisting" $+ doc ("Normalize a path for hoisting by treating immediately-applied lambdas as let bindings."+ <> " Replaces [applicationFunction, lambdaBody, ...] with [letBody, ...].") $+ "path" ~>+ -- Helper: process pairs of adjacent accessors+ "go" <~ ("remaining" ~>+ -- If less than 2 elements, return as-is+ Logic.ifElse (Logic.or (Lists.null $ var "remaining")+ (Lists.null $ Lists.tail $ var "remaining"))+ (var "remaining")+ -- Check if first two elements are applicationFunction followed by lambdaBody+ ("first" <~ Lists.head (var "remaining") $+ "second" <~ Lists.head (Lists.tail $ var "remaining") $+ "rest" <~ Lists.tail (Lists.tail $ var "remaining") $+ Logic.ifElse (Logic.and (isApplicationFunction @@ var "first")+ (isLambdaBody @@ var "second"))+ -- Replace with letBody and continue+ (Lists.cons (inject _TermAccessor _TermAccessor_letBody unit)+ (var "go" @@ var "rest"))+ -- Keep first element and continue+ (Lists.cons (var "first") (var "go" @@ Lists.tail (var "remaining"))))) $+ var "go" @@ var "path"++-- | Check if an accessor is applicationFunction+isApplicationFunction :: TBinding (TermAccessor -> Bool)+isApplicationFunction = define "isApplicationFunction" $+ "acc" ~> cases _TermAccessor (var "acc")+ (Just false) [+ _TermAccessor_applicationFunction>>: constant true]++-- | Check if an accessor is lambdaBody+isLambdaBody :: TBinding (TermAccessor -> Bool)+isLambdaBody = define "isLambdaBody" $+ "acc" ~> cases _TermAccessor (var "acc")+ (Just false) [+ _TermAccessor_lambdaBody>>: constant true]++-- | Predicate for hoisting case statement applications (union elimination applied to an argument).+-- Returns True if the term is a case statement application AND it is NOT at "top level".+--+-- Top level means: reachable from root through ONLY these accessor types:+-- - Annotations (transparent, always pass through)+-- - Let body or let binding (equivalent to lambda body for Python defs)+-- - Lambda body (more arguments to the def, as long as not after app LHS)+-- - ONE application function position (the single argument to match)+--+-- Once we've gone through an application function position, we can no longer+-- pass through lambda bodies (we've consumed the one allowed argument slot).+--+-- The path is traversed from the END (deepest/most recent accessor) toward+-- the beginning (root), tracking state:+-- - "atRoot": can pass through annotations, let body/binding, lambda body, or ONE app LHS+-- - "afterAppLHS": have used the one app LHS, can only pass through annotations+-- - Any other accessor: not at top level, should hoist if it's a case+shouldHoistCaseStatement :: TBinding (([TermAccessor], Term) -> Bool)+shouldHoistCaseStatement = define "shouldHoistCaseStatement" $+ doc ("Predicate for case statement hoisting."+ <> " Returns True if term is a union elimination (bare case function) or a case statement application"+ <> " (union elimination applied to an argument) AND not at top level."+ <> " Top level = reachable through annotations, let body/binding, lambda bodies, or ONE app LHS."+ <> " Once through an app LHS, lambda bodies no longer pass through.") $+ "pathAndTerm" ~>+ "path" <~ Pairs.first (var "pathAndTerm") $+ "term" <~ Pairs.second (var "pathAndTerm") $+ -- If not a union elimination or case statement application, don't hoist+ Logic.ifElse (Logic.not $ Logic.or (isUnionElimination @@ var "term") (isUnionEliminationApplication @@ var "term"))+ false+ -- Walk the path from root to deepest, tracking whether we're still at top level+ -- State is (stillAtTopLevel, haveUsedAppLHS)+ -- Initial state: at top level, haven't used app LHS+ ("finalState" <~ Lists.foldl+ ("st" ~> "acc" ~> updateHoistState @@ var "acc" @@ var "st")+ (pair true false)+ (var "path") $+ -- If still at top level, don't hoist. If not at top level, hoist.+ Logic.not $ Pairs.first $ var "finalState")++hoistSubterms :: TBinding ((([TermAccessor], Term) -> Bool) -> TypeContext -> Term -> Term)+hoistSubterms = define "hoistSubterms" $+ doc ("Hoist subterms into local let bindings based on a path-aware predicate."+ <> " The predicate receives a pair of (path, term) where path is the list of TermAccessors"+ <> " from the root to the current term, and returns True if the term should be hoisted."+ <> " For each let term found, the immediate subterms (binding values and body) are processed:"+ <> " matching subterms within each immediate subterm are collected and hoisted into a local let"+ <> " that wraps that immediate subterm."+ <> " If a hoisted term contains free variables that are lambda-bound at an enclosing scope,"+ <> " the hoisted binding is wrapped in lambdas for those variables, and the reference"+ <> " is replaced with an application of those variables.") $+ "shouldHoist" ~> "cx0" ~> "term0" ~>++ -- Process a single immediate subterm: find all hoistable subterms, extract them, wrap in local let+ -- Returns (newCounter, transformedSubterm)+ -- Uses rewriteAndFoldTermWithTypeContextAndPath to track paths and type context+ -- The accumulator is (counter, [Binding])+ -- The namePrefix parameter is used to create stable hoisted binding names (e.g., the parent binding's name)+ -- The pathPrefix parameter provides the path context from enclosing scopes, allowing+ -- shouldHoist to correctly determine whether a term is at top-level or not.+ -- For top-level lets this is empty []; for lets inside case branches of applied cases+ -- it includes the enclosing path, so inner cases are correctly identified for hoisting.+ "processImmediateSubterm" <~ ("cx" ~> "counter" ~> "namePrefix" ~> "pathPrefix" ~> "subterm" ~>+ -- Lambda variables that exist at the level of the let (before processing this subterm)+ -- These don't need to be captured since they're in scope at the hoisting site+ "baselineLambdaVars" <~ Typing.typeContextLambdaVariables (var "cx") $+ -- Collect all hoistable subterms and their replacements using a fold+ -- The accumulator is (counter, [Binding])+ -- Important: We stop at let and type lambda boundaries - nested lets are handled by the outer rewrite loop,+ -- and type lambdas introduce type variables that can't be properly captured for hoisting+ --+ -- The user function receives:+ -- recurse :: a -> Term -> (a, Term) - framework handles subterm iteration+ -- path :: [TermAccessor]+ -- cx :: TypeContext+ -- acc :: (counter, [Binding])+ -- term :: Term+ "collectAndReplace" <~ ("recurse" ~> "path" ~> "cxInner" ~> "acc" ~> "term" ~>+ "currentCounter" <~ Pairs.first (var "acc") $+ "collectedBindings" <~ Pairs.second (var "acc") $+ -- Check if this is a let term or type lambda - if so, don't recurse into it+ cases _Term (var "term")+ (Just $+ -- Default case: let the framework recurse into subterms, then maybe hoist this term+ "result" <~ var "recurse" @@ var "acc" @@ var "term" $+ "newAcc" <~ Pairs.first (var "result") $+ "processedTerm" <~ Pairs.second (var "result") $+ "newCounter" <~ Pairs.first (var "newAcc") $+ "newBindings" <~ Pairs.second (var "newAcc") $+ -- Check if this term should be hoisted, passing the full path (prefix + local)+ "fullPath" <~ Lists.concat2 (var "pathPrefix") (var "path") $+ Logic.ifElse (var "shouldHoist" @@ pair (var "fullPath") (var "processedTerm"))+ -- Hoist: add to collected bindings, return reference+ -- Use the namePrefix to create stable names: _hoist_<prefix>_<counter>+ ("bindingName" <~ Core.name (Strings.cat (list [string "_hoist_", var "namePrefix", string "_", Literals.showInt32 (var "newCounter")])) $+ -- Find lambda-bound variables that need to be captured+ -- Only capture variables that were added INSIDE this subterm (not at the let level)+ "allLambdaVars" <~ Typing.typeContextLambdaVariables (var "cxInner") $+ -- Get names that are new lambda vars (in current scope but not baseline)+ "newLambdaVars" <~ Sets.difference (var "allLambdaVars") (var "baselineLambdaVars") $+ "freeVars" <~ Rewriting.freeVariablesInTerm @@ var "processedTerm" $+ "capturedVars" <~ Sets.toList (Sets.intersection (var "newLambdaVars") (var "freeVars")) $+ -- Wrap the term in lambdas for each captured variable, looking up their types from the context+ "typeMap" <~ Typing.typeContextTypes (var "cxInner") $+ "wrappedTerm" <~ Lists.foldl+ ("body" ~> "varName" ~>+ Core.termFunction $ Core.functionLambda $ Core.lambda (var "varName")+ (Maps.lookup (var "varName") (var "typeMap"))+ (var "body"))+ (var "processedTerm")+ (Lists.reverse $ var "capturedVars") $+ -- Create the reference: apply the binding to all captured variables+ "reference" <~ Lists.foldl+ ("fn" ~> "varName" ~>+ Core.termApplication $ Core.application (var "fn") (Core.termVariable $ var "varName"))+ (Core.termVariable $ var "bindingName")+ (var "capturedVars") $+ -- Add binding to collected list and return reference as the replacement+ "newBinding" <~ Core.binding (var "bindingName") (var "wrappedTerm") nothing $+ -- Return with updated state+ pair (pair (Math.add (var "newCounter") (int32 1))+ (Lists.cons (var "newBinding") (var "newBindings")))+ (var "reference"))+ -- Don't hoist: return (acc, processedTerm) unchanged+ (pair (var "newAcc") (var "processedTerm")))+ -- TermLet: stop here; nested lets are handled by the outer rewrite loop+ -- TermTypeLambda: type lambdas introduce type variables that can't be properly captured+ [_Term_let>>: constant $ pair (var "acc") (var "term"),+ _Term_typeLambda>>: constant $ pair (var "acc") (var "term")]) $+ -- Run the collection/replacement pass using the path-aware rewriter+ -- Initial acc is (counter, []) - counter and empty list of bindings+ "result" <~ rewriteAndFoldTermWithTypeContextAndPath+ @@ var "collectAndReplace"+ @@ var "cx"+ @@ pair (var "counter") (list ([] :: [TTerm Binding]))+ @@ var "subterm" $+ -- result is (finalAcc, transformedSubterm)+ "finalAcc" <~ Pairs.first (var "result") $+ "transformedSubterm" <~ Pairs.second (var "result") $+ "finalCounter" <~ Pairs.first (var "finalAcc") $+ "bindings" <~ Pairs.second (var "finalAcc") $+ -- If any bindings were collected, wrap in a local let+ Logic.ifElse (Lists.null (var "bindings"))+ (pair (var "finalCounter") (var "transformedSubterm"))+ ("localLet" <~ Core.termLet (Core.let_ (Lists.reverse (var "bindings")) (var "transformedSubterm")) $+ pair (var "finalCounter") (var "localLet"))) $++ -- Process a let term: apply hoisting to each immediate subterm+ -- Each binding uses its own name as the prefix for hoisted bindings, providing stable naming.+ -- The prefix ensures uniqueness across siblings, so changes to one binding won't affect+ -- the hoisted names in other bindings.+ -- Each sibling uses the same starting counter (1), and the prefix prevents collisions.+ "processLetTerm" <~ ("cx" ~> "counter" ~> "path" ~> "lt" ~>+ "bindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ -- Process each binding value using its name as the prefix+ -- Each binding starts with counter 1 (reset for each sibling) for stable naming+ -- The prefix ensures uniqueness across siblings+ -- The path from the outer rewrite is passed as pathPrefix so that inner collectAndReplace+ -- knows the full context (e.g., that we're inside a case branch of an applied case)+ "processBinding" <~ ("acc" ~> "binding" ~>+ -- Use the binding name as the prefix for hoisted binding names+ -- Replace dots with underscores to avoid creating module-like names+ "namePrefix" <~ Strings.intercalate (string "_") (Strings.splitOn (string ".") (Core.unName (Core.bindingName (var "binding")))) $+ -- Build the pathPrefix for this binding: outer path + letBinding accessor+ "bindingPathPrefix" <~ Lists.concat2 (var "path") (list [inject _TermAccessor _TermAccessor_letBinding (Core.bindingName $ var "binding")]) $+ -- Each sibling starts fresh with counter 1 - prefix makes names unique+ "result" <~ var "processImmediateSubterm" @@ var "cx" @@ int32 1 @@ var "namePrefix" @@ var "bindingPathPrefix" @@ (Core.bindingTerm (var "binding")) $+ "newValue" <~ Pairs.second (var "result") $+ "newBinding" <~ Core.binding (Core.bindingName (var "binding")) (var "newValue") (Core.bindingType (var "binding")) $+ Lists.cons (var "newBinding") (var "acc")) $+ -- Fold over bindings, starting with empty list+ "newBindingsReversed" <~ Lists.foldl (var "processBinding") (list ([] :: [TTerm Binding])) (var "bindings") $+ "newBindings" <~ Lists.reverse (var "newBindingsReversed") $+ -- Process the body with "_body" as the prefix, also starting with counter 1+ -- Build the pathPrefix for the body: outer path + letBody accessor+ "bodyPathPrefix" <~ Lists.concat2 (var "path") (list [inject _TermAccessor _TermAccessor_letBody unit]) $+ "bodyResult" <~ var "processImmediateSubterm" @@ var "cx" @@ int32 1 @@ string "_body" @@ var "bodyPathPrefix" @@ var "body" $+ "newBody" <~ Pairs.second (var "bodyResult") $+ -- Return the original counter (siblings are independent, so counter doesn't propagate)+ pair (var "counter") (Core.termLet (Core.let_ (var "newBindings") (var "newBody")))) $++ -- Main rewrite: find let terms and process them+ -- Uses rewriteAndFoldTermWithTypeContextAndPath so we have the path context.+ -- The path is passed to processLetTerm, which forwards it as pathPrefix to+ -- processImmediateSubterm, so inner collectAndReplace knows the full context+ -- (e.g., that it's inside a case branch of an applied case).+ "rewrite" <~ ("recurse" ~> "path" ~> "cx" ~> "counter" ~> "term" ~>+ cases _Term (var "term")+ (Just $ var "recurse" @@ var "counter" @@ var "term") [+ _Term_let>>: "lt" ~>+ -- Recurse first (bottom-up), then process the let+ "recursed" <~ var "recurse" @@ var "counter" @@ var "term" $+ "newCounter" <~ Pairs.first (var "recursed") $+ "recursedTerm" <~ Pairs.second (var "recursed") $+ cases _Term (var "recursedTerm")+ (Just $ pair (var "newCounter") (var "recursedTerm")) [+ _Term_let>>: "lt2" ~> var "processLetTerm" @@ var "cx" @@ var "newCounter" @@ var "path" @@ var "lt2"]]) $++ Pairs.second $ rewriteAndFoldTermWithTypeContextAndPath @@ var "rewrite" @@ var "cx0" @@ int32 1 @@ var "term0"++rewriteAndFoldTermWithTypeContext :: TBinding (((a -> Term -> (a, Term)) -> TypeContext -> a -> Term -> (a, Term)) -> TypeContext -> a -> Term -> (a, Term))+rewriteAndFoldTermWithTypeContext = define "rewriteAndFoldTermWithTypeContext" $+ doc ("Rewrite a term while folding to produce a value, with TypeContext updated as we descend into subterms."+ <> " Combines the features of rewriteAndFoldTerm and rewriteTermWithTypeContext."+ <> " The user function f receives a recurse function that handles subterm traversal and TypeContext management.") $+ "f" ~> "cx0" ~> "val0" ~> "term0" ~>+ -- wrapper is the function we pass to rewriteAndFoldTerm+ -- Combined state is (val, cx). The low-level recurse handles term structure traversal.+ "wrapper" <~ ("lowLevelRecurse" ~> "valAndCx" ~> "term" ~>+ "val" <~ Pairs.first (var "valAndCx") $+ "cx" <~ Pairs.second (var "valAndCx") $+ -- Determine updated context based on the current term+ "cx1" <~ (cases _Term (var "term")+ (Just $ var "cx") [+ _Term_function>>: "fun" ~> cases _Function (var "fun")+ (Just $ var "cx") [+ _Function_lambda>>: "l" ~> Schemas.extendTypeContextForLambda @@ var "cx" @@ var "l"],+ _Term_let>>: "l" ~> Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "cx" @@ var "l",+ _Term_typeLambda>>: "tl" ~> Schemas.extendTypeContextForTypeLambda @@ var "cx" @@ var "tl"]) $+ -- Create a recurse function for the user that unwraps/wraps the combined state+ "recurseForUser" <~ ("newVal" ~> "subterm" ~>+ -- Call low-level recurse with combined state (newVal, cx1)+ -- Note: cx1 is the context for subterms of the current term+ "result" <~ var "lowLevelRecurse" @@ pair (var "newVal") (var "cx1") @@ var "subterm" $+ -- Return just (val', term') to the user+ pair (Pairs.first $ Pairs.first $ var "result") (Pairs.second $ var "result")) $+ -- Call the user's function with the context-aware recurse+ "fResult" <~ var "f" @@ var "recurseForUser" @@ var "cx1" @@ var "val" @@ var "term" $+ -- Combine the result with cx (original context, not cx1) so sibling terms don't inherit each other's extensions+ pair (pair (Pairs.first $ var "fResult") (var "cx")) (Pairs.second $ var "fResult")) $+ -- Use rewriteAndFoldTerm to handle the actual traversal, with (val, cx) as combined state+ "result" <~ Rewriting.rewriteAndFoldTerm @@ var "wrapper" @@ pair (var "val0") (var "cx0") @@ var "term0" $+ -- Extract just the val part of the result+ pair (Pairs.first $ Pairs.first $ var "result") (Pairs.second $ var "result")++-- | The most general-purpose term rewriting function, combining:+-- - Folding to produce a value (like rewriteAndFoldTerm)+-- - TypeContext tracking (like rewriteTermWithTypeContext)+-- - Path tracking via TermAccessors (like rewriteAndFoldTermWithPath)+--+-- This function wraps rewriteAndFoldTermWithPath, automatically managing+-- TypeContext updates as the traversal descends into lambdas, lets, and type lambdas.+--+-- The user function receives:+-- - A recurse function: a -> Term -> (a, Term) - called by framework during traversal+-- - The current path (list of TermAccessors from root to current position)+-- - The current TypeContext (updated for the current position)+-- - The current accumulated value+-- - The current term+-- And returns (newVal, newTerm)+rewriteAndFoldTermWithTypeContextAndPath :: TBinding (+ ((a -> Term -> (a, Term)) -> [TermAccessor] -> TypeContext -> a -> Term -> (a, Term))+ -> TypeContext -> a -> Term -> (a, Term))+rewriteAndFoldTermWithTypeContextAndPath = define "rewriteAndFoldTermWithTypeContextAndPath" $+ doc ("Rewrite a term while folding to produce a value, with both TypeContext and accessor path tracked."+ <> " The path is a list of TermAccessors representing the position from the root to the current term."+ <> " Combines the features of rewriteAndFoldTermWithPath and TypeContext tracking."+ <> " The TypeContext is automatically updated when descending into lambdas, lets, and type lambdas.") $+ "f" ~> "cx0" ~> "val0" ~> "term0" ~>+ -- Combined state is (TypeContext, a). We wrap rewriteAndFoldTermWithPath.+ -- The wrapper function receives recurse, path, (cx, val), term and returns ((cx, val), term)+ "wrapper" <~ ("recurse" ~> "path" ~> "cxAndVal" ~> "term" ~>+ "cx" <~ Pairs.first (var "cxAndVal") $+ "val" <~ Pairs.second (var "cxAndVal") $+ -- Determine updated context based on the current term+ "cx1" <~ (cases _Term (var "term")+ (Just $ var "cx") [+ _Term_function>>: "fun" ~> cases _Function (var "fun")+ (Just $ var "cx") [+ _Function_lambda>>: "l" ~> Schemas.extendTypeContextForLambda @@ var "cx" @@ var "l"],+ _Term_let>>: "l" ~> Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "cx" @@ var "l",+ _Term_typeLambda>>: "tl" ~> Schemas.extendTypeContextForTypeLambda @@ var "cx" @@ var "tl"]) $+ -- Create a recurse function for the user that uses the combined state+ -- Note: the user's recurse takes just (val, term) but the framework's recurse+ -- takes (path, val, term). We pass the current path through.+ "recurseForUser" <~ ("valIn" ~> "termIn" ~>+ -- Call the framework recurse with path and combined state (cx1, valIn)+ -- Note: cx1 is the context for subterms of the current term+ "result" <~ var "recurse" @@ var "path" @@ pair (var "cx1") (var "valIn") @@ var "termIn" $+ -- Return just (val', term') to the user - discard the context from result+ pair (Pairs.second $ Pairs.first $ var "result") (Pairs.second $ var "result")) $+ -- Call the user's function with the updated context and user-facing recurse+ "fResult" <~ var "f" @@ var "recurseForUser" @@ var "path" @@ var "cx1" @@ var "val" @@ var "term" $+ -- Return with combined state: ((cx, val'), term')+ -- Note: we return the original cx, not cx1, because cx1 is for subterms+ pair (pair (var "cx") (Pairs.first $ var "fResult")) (Pairs.second $ var "fResult")) $+ -- Use rewriteAndFoldTermWithPath with combined state (cx0, val0)+ "result" <~ Rewriting.rewriteAndFoldTermWithPath @@ var "wrapper" @@ pair (var "cx0") (var "val0") @@ var "term0" $+ -- Extract just the val part of the result+ pair (Pairs.second $ Pairs.first $ var "result") (Pairs.second $ var "result")++rewriteTermWithTypeContext :: TBinding (((Term -> Term) -> TypeContext -> Term -> Term) -> TypeContext -> Term -> Term)+rewriteTermWithTypeContext = define "rewriteTermWithTypeContext" $+ doc "Rewrite a term with the help of a type context which is updated as we descend into subterms" $+ "f" ~> "cx0" ~> "term0" ~>+ -- f2 wraps f to handle TypeContext updates for lambda/let/typeLambda+ "f2" <~ ("recurse" ~> "cx" ~> "term" ~>+ -- recurse1 is what the user sees: it takes just term and handles cx internally+ "recurse1" <~ ("term" ~> var "recurse" @@ var "cx" @@ var "term") $+ -- Determine updated context based on term type, then call user's f+ cases _Term (var "term") (Just $ var "f" @@ var "recurse1" @@ var "cx" @@ var "term") [+ _Term_function>>: "fun" ~> cases _Function (var "fun")+ (Just $ var "f" @@ var "recurse1" @@ var "cx" @@ var "term") [+ _Function_lambda>>: "l" ~>+ "cx1" <~ Schemas.extendTypeContextForLambda @@ var "cx" @@ var "l" $+ "recurse2" <~ ("term" ~> var "recurse" @@ var "cx1" @@ var "term") $+ var "f" @@ var "recurse2" @@ var "cx1" @@ var "term"],+ _Term_let>>: "l" ~>+ "cx1" <~ Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "cx" @@ var "l" $+ "recurse2" <~ ("term" ~> var "recurse" @@ var "cx1" @@ var "term") $+ var "f" @@ var "recurse2" @@ var "cx1" @@ var "term",+ _Term_typeLambda>>: "tl" ~>+ "cx1" <~ Schemas.extendTypeContextForTypeLambda @@ var "cx" @@ var "tl" $+ "recurse2" <~ ("term" ~> var "recurse" @@ var "cx1" @@ var "term") $+ var "f" @@ var "recurse2" @@ var "cx1" @@ var "term"]) $+ -- Local fixpoint that threads context through+ "rewrite" <~ ("cx" ~> "term" ~> var "f2" @@ (var "rewrite") @@ var "cx" @@ var "term") $+ var "rewrite" @@ var "cx0" @@ var "term0"
src/main/haskell/Hydra/Sources/Kernel/Terms/Inference.hs view
@@ -1,1506 +1,1310 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Inference where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Show.Graph as ShowGraph-import qualified Hydra.Sources.Kernel.Terms.Show.Mantle as ShowMantle-import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations-import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution-import qualified Hydra.Sources.Kernel.Terms.Unification as Unification-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants---module_ :: Module-module_ = Module (Namespace "hydra.inference") elements- [Annotations.module_, Lexical.module_, Schemas.module_, Unification.module_,- ShowCore.module_, ShowGraph.module_, ShowMantle.module_, ShowTyping.module_]- kernelTypesModules $- Just "Type inference following Algorithm W, extended for nominal terms and types"- where- elements = [- el bindConstraintsDef,- el checkSameTypeDef,- el checkTypeDef,- el checkTypeVariablesDef,- el debugInferenceDef,- el emptyInferenceContextDef,- el extendContextDef,- el forInferredTermDef,- el freeVariablesInContextDef,- el freshNameDef,- el freshNamesDef,- el freshVariableTypeDef,- el generalizeDef,- el graphToInferenceContextDef,- el inferGraphTypesDef,- el inferInGraphContextDef,- el inferManyDef,- el inferTypeOfAnnotatedTermDef,- el inferTypeOfApplicationDef,- el inferTypeOfCaseStatementDef,- el inferTypeOfCollectionDef,- el inferTypeOfDef,- el inferTypeOfEliminationDef,- el inferTypeOfFunctionDef,- el inferTypeOfInjectionDef,- el inferTypeOfLambdaDef,- el inferTypeOfLetNormalizedDef,- el inferTypeOfLetDef,- el inferTypeOfListDef,- el inferTypeOfLiteralDef,- el inferTypeOfMapDef,- el inferTypeOfOptionalDef,- el inferTypeOfPrimitiveDef,- el inferTypeOfProductDef,- el inferTypeOfProjectionDef,- el inferTypeOfRecordDef,- el inferTypeOfSetDef,- el inferTypeOfSumDef,- el inferTypeOfTermDef,- el inferTypeOfTupleProjectionDef,- el inferTypeOfTypeLambdaDef,- el inferTypeOfTypeApplicationDef,- el inferTypeOfUnwrapDef,- el inferTypeOfVariableDef,- el inferTypeOfWrappedTermDef,- el inferTypesOfTemporaryBindingsDef,- el initialTypeContextDef,- el instantiateTypeSchemeDef,- el isUnboundDef,- el key_vcountDef,- el mapConstraintsDef,- el nominalApplicationDef,- el normalTypeVariableDef,- el requireSchemaTypeDef,- el showInferenceResultDef,- el toFContextDef,- el typeOfDef,- el typeOfInternalDef,- el typeOfNominalDef,- el typeOfUnitDef,- el yieldDef,- el yieldCheckedDef,- el yieldDebugDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_------bindConstraintsDef :: TBinding (InferenceContext -> (TypeSubst -> Flow s a) -> [TypeConstraint] -> Flow s a)-bindConstraintsDef = define "bindConstraints" $- doc "Bind type constraints and continue with substitution" $- "cx" ~> "f" ~> "constraints" ~>- Flows.bind (ref Unification.unifyTypeConstraintsDef @@ Typing.inferenceContextSchemaTypes (var "cx") @@ var "constraints") (var "f")--checkSameTypeDef :: TBinding (String -> [Type] -> Flow s Type)-checkSameTypeDef = define "checkSameType" $- doc "Ensure all types in a list are equal and return the common type" $- "desc" ~> "types" ~>- "h" <~ Lists.head (var "types") $- "allEqual" <~ Lists.foldl- ("b" ~> "t" ~> Logic.and (var "b") (Equality.equal (var "t") (var "h")))- true- (var "types") $- Logic.ifElse (var "allEqual")- (Flows.pure $ var "h")- (Flows.fail $ Strings.cat $ list [- string "unequal types ",- (ref Formatting.showListDef @@ ref ShowCore.typeDef @@ var "types"),- string " in ",- var "desc"])--checkTypeDef :: TBinding (S.Set Name -> InferenceContext -> Type -> Term -> Flow s ())-checkTypeDef = define "checkType" $- doc "Check that a term has the expected type" $- "k" ~> "g" ~> "t" ~> "e" ~>- Logic.ifElse (ref debugInferenceDef)- ("t0" <<~ ref typeOfInternalDef @@ var "g" @@ var "k" @@ (ref toFContextDef @@ var "g") @@ list [] @@ var "e" $- Logic.ifElse (Equality.equal (var "t0") (var "t"))- (Flows.pure unit)- (Flows.fail $ Strings.cat $ list [- string "type checking failed: expected ",- ref ShowCore.typeDef @@ var "t",- string " but found ",- ref ShowCore.typeDef @@ var "t0"]))- (Flows.pure unit)---- W: wfTy-checkTypeVariablesDef :: TBinding (InferenceContext -> S.Set Name -> Type -> Flow s ())-checkTypeVariablesDef = define "checkTypeVariables" $- doc "Check that all type variables in a type are bound" $- "cx" ~> "tyvars" ~> "typ" ~>- trace (Strings.cat $ list [- string "checking variables of: ",- ref ShowCore.typeDef @@ var "typ"]) $- cases _Type (var "typ")- (Just $- "result" <<~ Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "tyvars")- (ref Rewriting.subtypesDef @@ var "typ") $- Flows.pure unit) [- _Type_forall>>: "ft" ~> ref checkTypeVariablesDef- @@ var "cx"- @@ (Sets.insert (Core.forallTypeParameter $ var "ft") (var "tyvars"))- @@ (Core.forallTypeBody $ var "ft"),- _Type_variable>>: "v" ~> Logic.ifElse (Sets.member (var "v") (var "tyvars"))- (Flows.pure unit)- (Logic.ifElse (Maps.member (var "v") (Typing.inferenceContextSchemaTypes (var "cx")))- (Flows.pure unit)- (Flows.fail $ Strings.cat $ list [- string "unbound type variable \"",- Core.unName $ var "v",- string "\" in ",- ref ShowCore.typeDef @@ var "typ"]))]--debugInferenceDef :: TBinding Bool-debugInferenceDef = define "debugInference" $- doc "Disable type checking by default, for better performance" $- true--emptyInferenceContextDef :: TBinding InferenceContext-emptyInferenceContextDef = define "emptyInferenceContext" $- doc "An empty inference context" $- Typing.inferenceContext- (Phantoms.map M.empty)- (Phantoms.map M.empty)- (Phantoms.map M.empty)- false--extendContextDef :: TBinding ([(Name, TypeScheme)] -> InferenceContext -> InferenceContext)-extendContextDef = define "extendContext" $- doc "Add (term variable, type scheme) pairs to the typing environment" $- "pairs" ~> "cx" ~>- Typing.inferenceContextWithDataTypes (var "cx") $ Maps.union- (Maps.fromList $ var "pairs")- (Typing.inferenceContextDataTypes $ var "cx")--forInferredTermDef :: TBinding (InferenceContext -> Term -> String -> (InferenceResult -> a) -> Flow s a)-forInferredTermDef = define "forInferredTerm" $- doc "Infer a term's type and map over the result" $- "cx" ~> "term" ~> "desc" ~> "f" ~>- Flows.map (var "f") $ ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ var "desc"--freeVariablesInContextDef :: TBinding (InferenceContext -> S.Set Name)-freeVariablesInContextDef = define "freeVariablesInContext" $- doc "Get all free variables in an inference context" $- "cx" ~>- Lists.foldl (binaryFunction Sets.union) Sets.empty $- Lists.map (ref Rewriting.freeVariablesInTypeSchemeSimpleDef) $- Maps.elems $ Typing.inferenceContextDataTypes $ var "cx"--freshNameDef :: TBinding (Flow s Name)-freshNameDef = define "freshName" $- doc "Generate a fresh type variable name" $- Flows.map (ref normalTypeVariableDef) (ref Annotations.nextCountDef @@ ref key_vcountDef)--freshNamesDef :: TBinding (Int -> Flow s [Name])-freshNamesDef = define "freshNames" $- doc "Generate multiple fresh type variable names" $- "n" ~> Flows.sequence $ Lists.replicate (var "n") (ref freshNameDef)--freshVariableTypeDef :: TBinding (Flow s Type)-freshVariableTypeDef = define "freshVariableType" $- doc "Generate a fresh type variable" $- Flows.map (unaryFunction Core.typeVariable) (ref freshNameDef)--generalizeDef :: TBinding (InferenceContext -> Type -> TypeScheme)-generalizeDef = define "generalize" $- doc "Generalize a type to a type scheme" $- "cx" ~> "typ" ~>- "vars" <~ Lists.nub (Lists.filter (ref isUnboundDef @@ var "cx") $- ref Rewriting.freeVariablesInTypeOrderedDef @@ var "typ") $- Core.typeScheme (var "vars") (var "typ")--graphToInferenceContextDef :: TBinding (Graph -> Flow s InferenceContext)-graphToInferenceContextDef = define "graphToInferenceContext" $- doc "Convert a graph to an inference context" $- "g0" ~>- "schema" <~ Optionals.fromMaybe (var "g0") (Graph.graphSchema $ var "g0") $- "primTypes" <~ Maps.fromList (Lists.map- ("p" ~> pair (Graph.primitiveName $ var "p") (Graph.primitiveType $ var "p"))- (Maps.elems $ Graph.graphPrimitives $ var "g0")) $- "varTypes" <~ Maps.empty $- "schemaTypes" <<~ ref Schemas.schemaGraphToTypingEnvironmentDef @@ var "schema" $- produce $ Typing.inferenceContext (var "schemaTypes") (var "primTypes") (var "varTypes") false--- Flows.fail ("schema types: " ++ (Strings.intercalate ", " $ Lists.map (unaryFunction Core.unName) $ Maps.keys $ var "schemaTypes")--- ++ (", schema: " ++ (ref ShowGraph.graphDef @@ var "schema")))--inferGraphTypesDef :: TBinding (Graph -> Flow s Graph)-inferGraphTypesDef = define "inferGraphTypes" $- doc "Infer types for all elements in a graph" $- "g0" ~>- "fromLetTerm" <~ ("l" ~>- "bindings" <~ Core.letBindings (var "l") $- "env" <~ Core.letEnvironment (var "l") $- "fromBinding" <~ ("b" ~> pair- (Core.bindingName $ var "b")- (var "b")) $- Graph.graph- (Maps.fromList $ Lists.map (var "fromBinding") (var "bindings"))- (Maps.empty)- (Maps.empty)- (var "env")- (Graph.graphPrimitives $ var "g0")- (Graph.graphSchema $ var "g0")) $- "toLetTerm" <~ ("g" ~>- "toBinding" <~ ("el" ~> Core.binding- (Core.bindingName $ var "el")- (Core.bindingTerm $ var "el")- nothing) $- Core.termLet $ Core.let_- (Lists.map (var "toBinding") $ Maps.elems $ Graph.graphElements $ var "g")- (Graph.graphBody $ var "g")) $- trace "graph inference" $- "cx" <<~ ref graphToInferenceContextDef @@ var "g0" $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ (var "toLetTerm" @@ var "g0") @@ string "graph term" $- "term" <~ Typing.inferenceResultTerm (var "result") $- "ts" <~ Typing.inferenceResultType (var "result") $- cases _Term (ref Rewriting.normalizeTypeVariablesInTermDef @@ var "term")- Nothing [- _Term_let>>: "l" ~> Flows.pure $ var "fromLetTerm" @@ var "l",- _Term_variable>>: constant $ Flows.fail $ string "Expected inferred graph as let term"]---- Note: this operation is expensive, as it creates a new typing environment for each individual term-inferInGraphContextDef :: TBinding (Term -> Flow Graph InferenceResult)-inferInGraphContextDef = define "inferInGraphContext" $- doc "Infer the type of a term in graph context" $- "term" ~>- "g" <<~ ref Monads.getStateDef $- "cx" <<~ ref graphToInferenceContextDef @@ var "g" $- ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ string "single term"--inferManyDef :: TBinding (InferenceContext -> [(Term, String)] -> Flow s ([Term], [Type], TypeSubst))-inferManyDef = define "inferMany" $- doc "Infer types for multiple terms" $- "cx" ~> "pairs" ~>- Logic.ifElse (Lists.null $ var "pairs")- (Flows.pure $ pair (list []) $ pair (list []) (ref Substitution.idTypeSubstDef))- ("e" <~ first (Lists.head $ var "pairs") $- "desc" <~ second (Lists.head $ var "pairs") $- "tl" <~ Lists.tail (var "pairs") $- "result1" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "e" @@ var "desc" $- "e1" <~ Typing.inferenceResultTerm (var "result1") $- "t1" <~ Typing.inferenceResultType (var "result1") $- "s1" <~ Typing.inferenceResultSubst (var "result1") $- "result2" <<~ ref inferManyDef @@ (ref Substitution.substInContextDef @@ var "s1" @@ var "cx") @@ var "tl" $- "e2" <~ first (var "result2") $- "t2" <~ first (second $ var "result2") $- "s2" <~ second (second $ var "result2") $- produce $ pair- (Lists.cons (ref Substitution.substTypesInTermDef @@ var "s2" @@ var "e1") (var "e2"))- (pair- (Lists.cons (ref Substitution.substInTypeDef @@ var "s2" @@ var "t1") (var "t2"))- (ref Substitution.composeTypeSubstDef @@ var "s1" @@ var "s2")))--inferTypeOfDef :: TBinding (InferenceContext -> Term -> Flow s (Term, TypeScheme))-inferTypeOfDef = define "inferTypeOf" $- doc "Infer the type of a term and return a type scheme" $- "cx" ~> "term" ~>- -- Top-level let term which allows us to easily extract an inferred type scheme- "letTerm" <~ Core.termLet (Core.let_- (list [Core.binding (Core.name $ string "ignoredVariableName") (var "term") nothing])- (TTerms.string "ignoredEnvironment")) $- "unifyAndSubst" <~ ("result" ~>- "subst" <~ Typing.inferenceResultSubst (var "result") $- "letResult" <<~ ref Lexical.withEmptyGraphDef @@- (ref ExtractCore.letTermDef @@- (ref Rewriting.normalizeTypeVariablesInTermDef @@- Typing.inferenceResultTerm (var "result"))) $- "bindings" <~ Core.letBindings (var "letResult") $- Logic.ifElse (Equality.equal (int32 1) (Lists.length $ var "bindings"))- ("binding" <~ Lists.head (var "bindings") $- "term1" <~ Core.bindingTerm (var "binding") $- "mts" <~ Core.bindingType (var "binding") $- Optionals.maybe- (Flows.fail $ string "Expected a type scheme")- ("ts" ~> Flows.pure $ pair (var "term1") (var "ts"))- (var "mts"))- (Flows.fail $ Strings.cat $ list [- string "Expected a single binding with a type scheme, but got: ",- Literals.showInt32 $ Lists.length $ var "bindings",- string " bindings"])) $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "letTerm" @@ string "infer type of term" $- var "unifyAndSubst" @@ var "result"--inferTypeOfAnnotatedTermDef :: TBinding (InferenceContext -> AnnotatedTerm -> Flow s InferenceResult)-inferTypeOfAnnotatedTermDef = define "inferTypeOfAnnotatedTerm" $- doc "Infer the type of an annotated term" $- "cx" ~> "at" ~>- "term" <~ Core.annotatedTermSubject (var "at") $- "ann" <~ Core.annotatedTermAnnotation (var "at") $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ string "annotated term" $- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "itype" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- produce $ Typing.inferenceResult- (Core.termAnnotated $ Core.annotatedTerm (var "iterm") (var "ann"))- (var "itype")- (var "isubst")--inferTypeOfApplicationDef :: TBinding (InferenceContext -> Application -> Flow s InferenceResult)-inferTypeOfApplicationDef = define "inferTypeOfApplication" $- doc "Infer the type of a function application" $- "cx" ~> "app" ~>- "e0" <~ Core.applicationFunction (var "app") $- "e1" <~ Core.applicationArgument (var "app") $- "lhsResult" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "e0" @@ string "lhs" $- "a" <~ Typing.inferenceResultTerm (var "lhsResult") $- "t0" <~ Typing.inferenceResultType (var "lhsResult") $- "s0" <~ Typing.inferenceResultSubst (var "lhsResult") $- "rhsResult" <<~ ref inferTypeOfTermDef- @@ (ref Substitution.substInContextDef @@ var "s0" @@ var "cx")- @@ var "e1"- @@ string "rhs" $- "b" <~ Typing.inferenceResultTerm (var "rhsResult") $- "t1" <~ Typing.inferenceResultType (var "rhsResult") $- "s1" <~ Typing.inferenceResultSubst (var "rhsResult") $- "v" <<~ ref freshNameDef $- "s2" <<~ ref Unification.unifyTypesDef- @@ (Typing.inferenceContextSchemaTypes $ var "cx")- @@ (ref Substitution.substInTypeDef @@ var "s1" @@ var "t0")- @@ (Core.typeFunction $ Core.functionType (var "t1") (Core.typeVariable $ var "v"))- @@ string "application lhs" $- "rExpr" <~ Core.termApplication (Core.application- (ref Substitution.substTypesInTermDef @@ (ref Substitution.composeTypeSubstDef @@ var "s1" @@ var "s2") @@ var "a")- (ref Substitution.substTypesInTermDef @@ var "s2" @@ var "b")) $- "rType" <~ ref Substitution.substInTypeDef @@ var "s2" @@ Core.typeVariable (var "v") $- "rSubst" <~ ref Substitution.composeTypeSubstListDef @@ list [var "s0", var "s1", var "s2"] $- produce $ Typing.inferenceResult (var "rExpr") (var "rType") (var "rSubst")--inferTypeOfCaseStatementDef :: TBinding (InferenceContext -> CaseStatement -> Flow s InferenceResult)-inferTypeOfCaseStatementDef = define "inferTypeOfCaseStatement" $- doc "Infer the type of a case statement" $- "cx" ~> "caseStmt" ~>- "tname" <~ Core.caseStatementTypeName (var "caseStmt") $- "dflt" <~ Core.caseStatementDefault (var "caseStmt") $- "cases" <~ Core.caseStatementCases (var "caseStmt") $- "fnames" <~ Lists.map (unaryFunction Core.fieldName) (var "cases") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "sfields" <<~ ref ExtractCore.unionTypeDef @@ var "tname" @@ var "stype" $- "dfltResult" <<~ Flows.mapOptional ("t" ~> ref inferTypeOfTermDef @@ var "cx" @@ var "t" @@- (Strings.cat $ list [string "case ", Core.unName $ var "tname", string ".<default>"])) (var "dflt") $- "caseResults" <<~ ref inferManyDef @@ var "cx" @@ Lists.map- ("f" ~> pair (Core.fieldTerm $ var "f")- (Strings.cat $ list [string "case ", Core.unName $ var "tname", string ".", Core.unName $ Core.fieldName $ var "f"]))- (var "cases") $- "iterms" <~ first (var "caseResults") $- "itypes" <~ first (second $ var "caseResults") $- "isubst" <~ second (second $ var "caseResults") $- "codv" <<~ ref freshNameDef $- "cod" <~ Core.typeVariable (var "codv") $- "caseMap" <~ Maps.fromList (Lists.map- ("ft" ~> pair (Core.fieldTypeName $ var "ft") (Core.fieldTypeType $ var "ft"))- (var "sfields")) $- "dfltConstraints" <~ ref Monads.optionalToListDef @@ (Optionals.map- ("r" ~> Typing.typeConstraint (var "cod") (Typing.inferenceResultType $ var "r") (string "match default"))- (var "dfltResult")) $- "caseConstraints" <~ Optionals.cat (Lists.zipWith- ("fname" ~> "itype" ~> Optionals.map- ("ftype" ~> Typing.typeConstraint- (var "itype")- (Core.typeFunction $ Core.functionType (var "ftype") (var "cod"))- (string "case type"))- (Maps.lookup (var "fname") (var "caseMap")))- (var "fnames") (var "itypes")) $- ref mapConstraintsDef- @@ var "cx"- @@ ("subst" ~> ref yieldDef- @@ (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable (var "v")))- (Core.termFunction $ Core.functionElimination $ Core.eliminationUnion $- Core.caseStatement (var "tname") (Optionals.map (unaryFunction Typing.inferenceResultTerm) $ var "dfltResult") $- Lists.zipWith ("n" ~> "t" ~> Core.field (var "n") (var "t")) (var "fnames") (var "iterms"))- (var "svars"))- @@ (Core.typeFunction $ Core.functionType- (ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))- (var "cod"))- @@ (ref Substitution.composeTypeSubstListDef- @@ (Lists.concat $ list [- ref Monads.optionalToListDef @@ (Optionals.map (unaryFunction Typing.inferenceResultSubst) (var "dfltResult")),- list [var "isubst", var "subst"]])))- @@ (Lists.concat $ list [var "dfltConstraints", var "caseConstraints"])--inferTypeOfCollectionDef :: TBinding (InferenceContext -> (Type -> Type) -> ([Term] -> Term) -> String -> [Term] -> Flow s InferenceResult)-inferTypeOfCollectionDef = define "inferTypeOfCollection" $- doc "Infer the type of a collection" $- "cx" ~> "typCons" ~> "trmCons" ~> "desc" ~> "els" ~>- "var" <<~ ref freshNameDef $- Logic.ifElse (Lists.null $ var "els")- -- Special case: empty collection requires a type application term- (Flows.pure $ ref yieldDef- @@ (Core.termTypeApplication $ Core.typedTerm (var "trmCons" @@ list []) (Core.typeVariable $ var "var"))- @@ (var "typCons" @@ (Core.typeVariable $ var "var"))- @@ (ref Substitution.idTypeSubstDef)) $- -- General case: non-empty collection- "results" <<~ ref inferManyDef @@ var "cx" @@- (Lists.zip (var "els") $ Lists.map ("i" ~> Strings.cat $ list [string "#", Literals.showInt32 $ var "i"]) $- Math.range (int32 1) (Math.add (Lists.length $ var "els") (int32 1))) $- "terms" <~ first (var "results") $- "types" <~ first (second $ var "results") $- "subst1" <~ second (second $ var "results") $- "constraints" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "var") (var "t") (var "desc")) (var "types") $- ref mapConstraintsDef @@ var "cx" @@- ("subst2" ~>- "iterm" <~ var "trmCons" @@ var "terms" $- "itype" <~ var "typCons" @@ (Core.typeVariable $ var "var") $- "isubst" <~ ref Substitution.composeTypeSubstDef @@ var "subst1" @@ var "subst2" $- ref yieldDef @@ var "iterm" @@ var "itype" @@ var "isubst") @@- var "constraints"--inferTypeOfEliminationDef :: TBinding (InferenceContext -> Elimination -> Flow s InferenceResult)-inferTypeOfEliminationDef = define "inferTypeOfElimination" $- doc "Infer the type of an elimination" $- "cx" ~> "elm" ~>- cases _Elimination (var "elm") Nothing [- _Elimination_product>>: "tp" ~> ref inferTypeOfTupleProjectionDef @@ var "cx" @@ var "tp",- _Elimination_record>>: "p" ~> ref inferTypeOfProjectionDef @@ var "cx" @@ var "p",- _Elimination_union>>: "c" ~> ref inferTypeOfCaseStatementDef @@ var "cx" @@ var "c",- _Elimination_wrap>>: "tname" ~> ref inferTypeOfUnwrapDef @@ var "cx" @@ var "tname"]--inferTypeOfFunctionDef :: TBinding (InferenceContext -> Function -> Flow s InferenceResult)-inferTypeOfFunctionDef = define "inferTypeOfFunction" $- doc "Infer the type of a function" $- "cx" ~> "f" ~>- cases _Function (var "f") Nothing [- _Function_elimination>>: "elm" ~> ref inferTypeOfEliminationDef @@ var "cx" @@ var "elm",- _Function_lambda>>: "l" ~> ref inferTypeOfLambdaDef @@ var "cx" @@ var "l",- _Function_primitive>>: "name" ~> ref inferTypeOfPrimitiveDef @@ var "cx" @@ var "name"]--inferTypeOfInjectionDef :: TBinding (InferenceContext -> Injection -> Flow s InferenceResult)-inferTypeOfInjectionDef = define "inferTypeOfInjection" $- doc "Infer the type of a union injection" $- "cx" ~> "injection" ~>- "tname" <~ Core.injectionTypeName (var "injection") $- "field" <~ Core.injectionField (var "injection") $- "fname" <~ Core.fieldName (var "field") $- "term" <~ Core.fieldTerm (var "field") $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ string "injected term" $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "ityp" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- "sfields" <<~ ref ExtractCore.unionTypeDef @@ var "tname" @@ var "stype" $- "ftyp" <<~ ref Schemas.findFieldTypeDef @@ var "fname" @@ var "sfields" $- ref mapConstraintsDef @@ var "cx" @@- ("subst" ~> ref yieldDef- @@ (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable (var "v")))- (Core.termUnion $ Core.injection (var "tname") $ Core.field (var "fname") (var "iterm"))- (var "svars"))- @@ (ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))- @@ (ref Substitution.composeTypeSubstDef @@ var "isubst" @@ var "subst")) @@- list [Typing.typeConstraint (var "ftyp") (var "ityp") (string "schema type of injected field")]--inferTypeOfLambdaDef :: TBinding (InferenceContext -> Lambda -> Flow s InferenceResult)-inferTypeOfLambdaDef = define "inferTypeOfLambda" $- doc "Infer the type of a lambda function" $- "cx" ~> "lambda" ~>- "var" <~ Core.lambdaParameter (var "lambda") $- "body" <~ Core.lambdaBody (var "lambda") $- "vdom" <<~ ref freshNameDef $- "dom" <~ Core.typeVariable (var "vdom") $- "cx2" <~ (ref extendContextDef @@ list [pair (var "var") (Core.typeScheme (list []) (var "dom"))] @@ var "cx") $- "result" <<~ ref inferTypeOfTermDef @@ var "cx2" @@ var "body" @@ string "lambda body" $- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "icod" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- "rdom" <~ ref Substitution.substInTypeDef @@ var "isubst" @@ var "dom" $- "rterm" <~ Core.termFunction (Core.functionLambda $ Core.lambda (var "var") (just $ var "rdom") (var "iterm")) $- "rtype" <~ Core.typeFunction (Core.functionType (var "rdom") (var "icod")) $- "vars" <~ (Sets.unions $ list [- ref Rewriting.freeVariablesInTypeDef @@ var "rdom",- ref Rewriting.freeVariablesInTypeDef @@ var "icod",- ref freeVariablesInContextDef @@ (ref Substitution.substInContextDef @@ var "isubst" @@ var "cx2")]) $- "cx3" <~ ref Substitution.substInContextDef @@ var "isubst" @@ var "cx" $- produce $ Typing.inferenceResult (var "rterm") (var "rtype") (var "isubst")---- | Normalize a let term before inferring its type.-inferTypeOfLetDef :: TBinding (InferenceContext -> Let -> Flow s InferenceResult)-inferTypeOfLetDef = define "inferTypeOfLet" $- doc "Normalize a let term before inferring its type" $- "cx" ~> "let0" ~>- "bindings0" <~ Core.letBindings (var "let0") $- "env0" <~ Core.letEnvironment (var "let0") $- "names" <~ Lists.map (unaryFunction Core.bindingName) (var "bindings0") $- "nameSet" <~ Sets.fromList (var "names") $- "toPair" <~ ("binding" ~>- "name" <~ Core.bindingName (var "binding") $- "term" <~ Core.bindingTerm (var "binding") $- pair (var "name") $ Lists.filter ("n" ~> Sets.member (var "n") (var "nameSet")) $- Sets.toList $ ref Rewriting.freeVariablesInTermDef @@ var "term") $- "adjList" <~ Lists.map (var "toPair") (var "bindings0") $- "groups" <~ ref Sorting.topologicalSortComponentsDef @@ var "adjList" $- "bindingMap" <~ Maps.fromList (Lists.zip (var "names") (var "bindings0")) $- "createLet" <~ ("e" ~> "group" ~> Core.termLet $ Core.let_- (Optionals.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "bindingMap")) (var "group"))- (var "e")) $- -- Note: this rewritten let term will yield success in all cases of dependencies among letrec bindings *except*- -- in cases of polymorphic recursion. In those cases, type hints will be needed (#162).- "rewrittenLet" <~ Lists.foldl (var "createLet") (var "env0") (Lists.reverse $ var "groups") $- "restoreLet" <~ ("iterm" ~>- "helper" <~ ("level" ~> "bins" ~> "term" ~>- Logic.ifElse (Equality.equal (var "level") (int32 0))- (pair (var "bins") (var "term"))- (cases _Term (var "term") Nothing [- _Term_let>>: "l" ~>- "bs" <~ Core.letBindings (var "l") $- "e" <~ Core.letEnvironment (var "l") $- var "helper" @@- (Math.sub (var "level") (int32 1)) @@- (Lists.concat $ list [var "bs", var "bins"]) @@- (var "e")])) $- "result" <~ var "helper" @@ (Lists.length $ var "groups") @@ list [] @@ var "iterm" $- "bindingList" <~ first (var "result") $- "e" <~ second (var "result") $- "bindingMap2" <~ Maps.fromList (Lists.map ("b" ~> pair (Core.bindingName $ var "b") (var "b")) (var "bindingList")) $- Core.termLet $ Core.let_- (Optionals.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "bindingMap2")) (var "names"))- (var "e")) $- "rewriteResult" <~ ("result" ~>- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "itype" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- Typing.inferenceResult (var "restoreLet" @@ var "iterm") (var "itype") (var "isubst")) $- Flows.map (var "rewriteResult") $- cases _Term (var "rewrittenLet")- (Just $ ref inferTypeOfTermDef @@ var "cx" @@ var "rewrittenLet" @@ string "empty let term") [- _Term_let>>: "l" ~> ref inferTypeOfLetNormalizedDef @@ var "cx" @@ var "l"]--inferTypeOfLetNormalizedDef :: TBinding (InferenceContext -> Let -> Flow s InferenceResult)-inferTypeOfLetNormalizedDef = define "inferTypeOfLetNormalized" $- doc "Infer the type of a let (letrec) term which is already in a normal form" $- "cx0" ~> "letTerm" ~>- "bins0" <~ Core.letBindings (var "letTerm") $- "env0" <~ Core.letEnvironment (var "letTerm") $- "bnames" <~ Lists.map (unaryFunction Core.bindingName) (var "bins0") $- "bvars" <<~ ref freshNamesDef @@ (Lists.length $ var "bins0") $- "tbins0" <~ Lists.map (unaryFunction Core.typeVariable) (var "bvars") $- "cx1" <~ (ref extendContextDef- @@ (Lists.zip (var "bnames") $ Lists.map ("t" ~> Core.typeScheme (list []) (var "t")) (var "tbins0"))- @@ (var "cx0")) $- "inferredResult" <<~ ref inferTypesOfTemporaryBindingsDef @@ var "cx1" @@ var "bins0" $- "bterms1" <~ first (var "inferredResult") $- "tbins1" <~ first (second $ var "inferredResult") $- "s1" <~ second (second $ var "inferredResult") $- "s2" <<~ ref Unification.unifyTypeListsDef @@- (Typing.inferenceContextSchemaTypes $ var "cx0") @@- (Lists.map (ref Substitution.substInTypeDef @@ var "s1") (var "tbins0")) @@- (var "tbins1") @@- (string "temporary type bindings") $- "g2" <~ (ref Substitution.substInContextDef @@- (ref Substitution.composeTypeSubstDef @@ var "s1" @@ var "s2") @@- (var "cx0")) $- "tsbins1" <~ (Lists.zip (var "bnames") $- Lists.map ("t" ~> ref generalizeDef @@ var "g2" @@- (ref Substitution.substInTypeDef @@ var "s2" @@ var "t")) (var "tbins1")) $- "envResult" <<~ ref inferTypeOfTermDef @@- (ref extendContextDef @@ var "tsbins1" @@ var "g2") @@- (var "env0") @@- (string "let environment") $- "env1" <~ Typing.inferenceResultTerm (var "envResult") $- "tenv" <~ Typing.inferenceResultType (var "envResult") $- "senv" <~ Typing.inferenceResultSubst (var "envResult") $- "st1" <~ (Typing.termSubst (Maps.fromList $- Lists.map- ("pair" ~>- "name" <~ first (var "pair") $- "ts" <~ second (var "pair") $- pair- (var "name") $- (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable $ var "v"))- (Core.termVariable $ var "name")- (Lists.reverse $ Core.typeSchemeVariables $ var "ts")))- (var "tsbins1"))) $- "createBinding" <~ ("bindingPair" ~>- "nameTsPair" <~ first (var "bindingPair") $- "term" <~ second (var "bindingPair") $- "name" <~ first (var "nameTsPair") $- "ts" <~ second (var "nameTsPair") $- "typeAbstractedTerm" <~ Lists.foldl- ("b" ~> "v" ~> Core.termTypeLambda $ Core.typeLambda (var "v") (var "b"))- (ref Substitution.substituteInTermDef @@ var "st1" @@ var "term")- (Lists.reverse $ Core.typeSchemeVariables $ var "ts") $- Core.binding (var "name")- (ref Substitution.substTypesInTermDef @@- (ref Substitution.composeTypeSubstDef @@ var "senv" @@ var "s2") @@- (var "typeAbstractedTerm"))- (just $ ref Substitution.substInTypeSchemeDef @@ var "senv" @@ var "ts")) $- "bins1" <~ (Lists.map (var "createBinding") $- Lists.zip (var "tsbins1") (var "bterms1")) $- "ret" <~ (Typing.inferenceResult- (Core.termLet $ Core.let_ (var "bins1") (var "env1"))- (var "tenv")- (ref Substitution.composeTypeSubstListDef @@ list [var "s1", var "s2", var "senv"])) $- produce $ var "ret"--inferTypeOfListDef :: TBinding (InferenceContext -> [Term] -> Flow s InferenceResult)-inferTypeOfListDef = define "inferTypeOfList" $- doc "Infer the type of a list" $- "cx" ~> ref inferTypeOfCollectionDef- @@ var "cx"- @@ (unaryFunction Core.typeList)- @@ (unaryFunction Core.termList)- @@ string "list element"--inferTypeOfLiteralDef :: TBinding (InferenceContext -> Literal -> Flow s InferenceResult)-inferTypeOfLiteralDef = define "inferTypeOfLiteral" $- doc "Infer the type of a literal" $- "_" ~> "lit" ~>- produce $ Typing.inferenceResult- (Core.termLiteral $ var "lit")- (Core.typeLiteral $ ref Variants.literalTypeDef @@ var "lit")- (ref Substitution.idTypeSubstDef)--inferTypeOfMapDef :: TBinding (InferenceContext -> M.Map Term Term -> Flow s InferenceResult)-inferTypeOfMapDef = define "inferTypeOfMap" $- doc "Infer the type of a map" $- "cx" ~> "m" ~>- "kvar" <<~ ref freshNameDef $- "vvar" <<~ ref freshNameDef $- Logic.ifElse (Maps.null $ var "m")- -- Special case: empty collection requires a type application term- (Flows.pure $ ref yieldDef- @@ (Core.termTypeApplication $ Core.typedTerm (Core.termTypeApplication $ Core.typedTerm- (Core.termMap Maps.empty) (Core.typeVariable $ var "vvar")) (Core.typeVariable $ var "kvar"))- @@ (Core.typeMap $ Core.mapType (Core.typeVariable $ var "kvar") (Core.typeVariable $ var "vvar"))- @@ ref Substitution.idTypeSubstDef) $- "kresults" <<~ ref inferManyDef @@ var "cx" @@- (Lists.map ("k" ~> pair (var "k") (string "map key")) $ Maps.keys $ var "m") $- "kterms" <~ first (var "kresults") $- "ktypes" <~ first (second $ var "kresults") $- "ksubst" <~ second (second $ var "kresults") $- "vresults" <<~ ref inferManyDef- @@ var "cx"- @@ (Lists.map ("v" ~> pair (var "v") (string "map value")) $ Maps.elems $ var "m") $- "vterms" <~ first (var "vresults") $- "vtypes" <~ first (second $ var "vresults") $- "vsubst" <~ second (second $ var "vresults") $- "kcons" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "kvar") (var "t") (string "map key")) (var "ktypes") $- "vcons" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "vvar") (var "t") (string "map value")) (var "vtypes") $- ref mapConstraintsDef @@ var "cx" @@- ("subst" ~> ref yieldDef- @@ (Core.termMap $ Maps.fromList $ Lists.zip (var "kterms") (var "vterms"))- @@ (Core.typeMap $ Core.mapType (Core.typeVariable $ var "kvar") (Core.typeVariable $ var "vvar"))- @@ (ref Substitution.composeTypeSubstListDef @@ list [var "ksubst", var "vsubst", var "subst"])) @@- (Lists.concat $ list [var "kcons", var "vcons"])--inferTypeOfOptionalDef :: TBinding (InferenceContext -> Maybe Term -> Flow s InferenceResult)-inferTypeOfOptionalDef = define "inferTypeOfOptional" $- doc "Infer the type of an optional" $- "cx" ~> "m" ~>- "trmCons" <~ ("terms" ~> Logic.ifElse (Lists.null $ var "terms")- (Core.termOptional nothing)- (Core.termOptional $ just $ Lists.head $ var "terms")) $- ref inferTypeOfCollectionDef- @@ var "cx"- @@ (unaryFunction Core.typeOptional)- @@ var "trmCons"- @@ string "optional element"- @@ (Optionals.maybe (list []) (unaryFunction Lists.singleton) $ var "m")--inferTypeOfPrimitiveDef :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)-inferTypeOfPrimitiveDef = define "inferTypeOfPrimitive" $- doc "Infer the type of a primitive function" $- "cx" ~> "name" ~>- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "No such primitive: ") (Core.unName $ var "name"))- ( "scheme" ~>- "ts" <<~ ref instantiateTypeSchemeDef @@ var "scheme" $- "vars" <~ Core.typeSchemeVariables (var "ts") $- "itype" <~ Core.typeSchemeType (var "ts") $- "iterm" <~ Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable $ var "v"))- (Core.termFunction $ Core.functionPrimitive $ var "name")- -- Note: the order of variables is confirmed to be correct.- -- E.g. ∀[k,v].map<k, v>) instantiates to (∀[t1,t2].map<t1, t2>),- -- and the inferred term is then hydra.lib.maps.empty!⟨t1⟩⟨t2⟩, i.e. (hydra.lib.maps.empty!⟨t1⟩)⟨t2⟩- (var "vars") $- ref yieldCheckedDef @@ var "cx" @@ var "vars" @@ var "iterm" @@ var "itype" @@ ref Substitution.idTypeSubstDef)- (Maps.lookup (var "name") (Typing.inferenceContextPrimitiveTypes $ var "cx"))--inferTypeOfProductDef :: TBinding (InferenceContext -> [Term] -> Flow s InferenceResult)-inferTypeOfProductDef = define "inferTypeOfProduct" $- doc "Infer the type of a product (tuple)" $- "cx" ~> "els" ~>- Flows.map- ( "results" ~>- "iterms" <~ first (var "results") $- "itypes" <~ first (second $ var "results") $- "isubst" <~ second (second $ var "results") $- ref yieldDef @@ (Core.termProduct $ var "iterms") @@ (Core.typeProduct $ var "itypes") @@ var "isubst")- (ref inferManyDef @@ var "cx" @@ (Lists.map ("e" ~> pair (var "e") (string "tuple element")) $ var "els"))--inferTypeOfProjectionDef :: TBinding (InferenceContext -> Projection -> Flow s InferenceResult)-inferTypeOfProjectionDef = define "inferTypeOfProjection" $- doc "Infer the type of a record projection" $- "cx" ~> "proj" ~>- "tname" <~ Core.projectionTypeName (var "proj") $- "fname" <~ Core.projectionField (var "proj") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "sfields" <<~ ref ExtractCore.recordTypeDef @@ var "tname" @@ var "stype" $- "ftyp" <<~ ref Schemas.findFieldTypeDef @@ var "fname" @@ var "sfields" $- Flows.pure $ ref yieldDef- @@ (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable (var "v")))- (Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $ Core.projection (var "tname") (var "fname"))- (var "svars"))- @@ (Core.typeFunction $ Core.functionType- (ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))- (var "ftyp"))- @@ ref Substitution.idTypeSubstDef--inferTypeOfRecordDef :: TBinding (InferenceContext -> Record -> Flow s InferenceResult)-inferTypeOfRecordDef = define "inferTypeOfRecord" $- doc "Infer the type of a record" $- "cx" ~> "record" ~>- "tname" <~ Core.recordTypeName (var "record") $- "fields" <~ Core.recordFields (var "record") $- "fnames" <~ Lists.map (unaryFunction Core.fieldName) (var "fields") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "results" <<~ ref inferManyDef @@ var "cx" @@ Lists.map- ("f" ~> pair- (Core.fieldTerm $ var "f")- (Strings.cat2 (string "field ") (Core.unName $ Core.fieldName $ var "f")))- (var "fields") $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "iterms" <~ first (var "results") $- "itypes" <~ first (second $ var "results") $- "isubst" <~ second (second $ var "results") $- "ityp" <~ Core.typeRecord (Core.rowType (var "tname") $- Lists.zipWith ("n" ~> "t" ~> Core.fieldType (var "n") (var "t")) (var "fnames") (var "itypes")) $- ref mapConstraintsDef @@ var "cx" @@- ( "subst" ~> ref yieldDef- @@ (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable (var "v")))- (Core.termRecord $ Core.record (var "tname") $ Lists.zipWith- ("n" ~> "t" ~> Core.field (var "n") (var "t"))- (var "fnames")- (var "iterms"))- (var "svars"))- @@ (ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))- @@ (ref Substitution.composeTypeSubstDef @@ var "isubst" @@ var "subst")) @@- list [Typing.typeConstraint (var "stype") (var "ityp") (string "schema type of record")]--inferTypeOfSetDef :: TBinding (InferenceContext -> S.Set Term -> Flow s InferenceResult)-inferTypeOfSetDef = define "inferTypeOfSet" $- doc "Infer the type of a set" $- "cx" ~>- "s" ~>- ref inferTypeOfCollectionDef- @@ var "cx"- @@ (unaryFunction Core.typeSet)- @@ ("terms" ~> Core.termSet $ Sets.fromList $ var "terms")- @@ string "set element"- @@ (Sets.toList $ var "s")--inferTypeOfSumDef :: TBinding (InferenceContext -> Sum -> Flow s InferenceResult)-inferTypeOfSumDef = define "inferTypeOfSum" $- doc "Infer the type of a sum type" $- "cx" ~>- "sum" ~>- "i" <~ Core.sumIndex (var "sum") $- "s" <~ Core.sumSize (var "sum") $- "term" <~ Core.sumTerm (var "sum") $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ string "sum term" $- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "ityp" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- "varOrTerm" <~ ("t" ~> "j" ~> Logic.ifElse (Equality.equal (var "i") (var "j"))- (Flows.pure $ Mantle.eitherLeft $ var "t")- (Flows.map (unaryFunction Mantle.eitherRight) $ ref freshNameDef)) $- "vars" <<~ Flows.mapList (var "varOrTerm" @@ var "ityp") (Math.range (int32 0) (Math.sub (var "s") (int32 1))) $- "toType" <~ ("e" ~> cases _Either (var "e")- Nothing [- _Either_left>>: "t" ~> var "t",- _Either_right>>: "v" ~> Core.typeVariable $ var "v"]) $- produce $ ref yieldDef- @@ Core.termSum (Core.sum (var "i") (var "s") (var "iterm"))- @@ Core.typeSum (Lists.map (var "toType") (var "vars"))- @@ var "isubst"--inferTypeOfTermDef :: TBinding (InferenceContext -> Term -> String -> Flow s InferenceResult)-inferTypeOfTermDef = define "inferTypeOfTerm" $- doc "Infer the type of a given term" $- "cx" ~> "term" ~> "desc" ~>- trace (var "desc") $- cases _Term (var "term") Nothing [- _Term_annotated>>: "a" ~> ref inferTypeOfAnnotatedTermDef @@ var "cx" @@ var "a",- _Term_application>>: "a" ~> ref inferTypeOfApplicationDef @@ var "cx" @@ var "a",- _Term_function>>: "f" ~> ref inferTypeOfFunctionDef @@ var "cx" @@ var "f",- _Term_let>>: "l" ~> ref inferTypeOfLetDef @@ var "cx" @@ var "l",- _Term_list>>: "els" ~> ref inferTypeOfListDef @@ var "cx" @@ var "els",- _Term_literal>>: "l" ~> ref inferTypeOfLiteralDef @@ var "cx" @@ var "l",- _Term_map>>: "m" ~> ref inferTypeOfMapDef @@ var "cx" @@ var "m",- _Term_optional>>: "m" ~> ref inferTypeOfOptionalDef @@ var "cx" @@ var "m",- _Term_product>>: "els" ~> ref inferTypeOfProductDef @@ var "cx" @@ var "els",- _Term_record>>: "r" ~> ref inferTypeOfRecordDef @@ var "cx" @@ var "r",- _Term_set>>: "s" ~> ref inferTypeOfSetDef @@ var "cx" @@ var "s",- _Term_sum>>: "s" ~> ref inferTypeOfSumDef @@ var "cx" @@ var "s",- _Term_typeLambda>>: "ta" ~> ref inferTypeOfTypeLambdaDef @@ var "cx" @@ var "ta",- _Term_typeApplication>>: "tt" ~> ref inferTypeOfTypeApplicationDef @@ var "cx" @@ var "tt",- _Term_union>>: "i" ~> ref inferTypeOfInjectionDef @@ var "cx" @@ var "i",- _Term_unit>>: constant $ Flows.pure $ ref typeOfUnitDef,- _Term_variable>>: "name" ~> ref inferTypeOfVariableDef @@ var "cx" @@ var "name",- _Term_wrap>>: "w" ~> ref inferTypeOfWrappedTermDef @@ var "cx" @@ var "w"]--inferTypeOfTupleProjectionDef :: TBinding (InferenceContext -> TupleProjection -> Flow s InferenceResult)-inferTypeOfTupleProjectionDef = define "inferTypeOfTupleProjection" $- doc "Infer the type of a tuple projection" $- "cx" ~> "tp" ~>- "arity" <~ Core.tupleProjectionArity (var "tp") $- "idx" <~ Core.tupleProjectionIndex (var "tp") $- "vars" <<~ ref freshNamesDef @@ var "arity" $- "types" <~ Lists.map (unaryFunction Core.typeVariable) (var "vars") $- "cod" <~ Lists.at (var "idx") (var "types") $- Flows.pure $ ref yieldDef- @@ (Core.termFunction $ Core.functionElimination $ Core.eliminationProduct $- Core.tupleProjection (var "arity") (var "idx") (just $ var "types"))- @@ (Core.typeFunction $ Core.functionType (Core.typeProduct $ var "types") (var "cod"))- @@ (ref Substitution.idTypeSubstDef)--inferTypeOfTypeLambdaDef :: TBinding (InferenceContext -> TypeLambda -> Flow s InferenceResult)-inferTypeOfTypeLambdaDef = define "inferTypeOfTypeLambda" $- doc "Infer the type of a type abstraction" $- "cx" ~> "ta" ~>- ref inferTypeOfTermDef @@ var "cx" @@ (Core.typeLambdaBody $ var "ta") @@ string "type abstraction"--inferTypeOfTypeApplicationDef :: TBinding (InferenceContext -> TypedTerm -> Flow s InferenceResult)-inferTypeOfTypeApplicationDef = define "inferTypeOfTypeApplication" $- doc "Infer the type of a type application" $- "cx" ~> "tt" ~>- ref inferTypeOfTermDef @@ var "cx" @@ (Core.typedTermTerm $ var "tt") @@ string "type application term"--inferTypeOfUnwrapDef :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)-inferTypeOfUnwrapDef = define "inferTypeOfUnwrap" $- doc "Infer the type of an unwrap operation" $- "cx" ~> "tname" ~>- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "wtyp" <<~ ref ExtractCore.wrappedTypeDef @@ var "tname" @@ var "stype" $- Flows.pure $ ref yieldDef- @@ (Lists.foldl- ("t" ~> "v" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typeVariable (var "v")))- (Core.termFunction $ Core.functionElimination $ Core.eliminationWrap $ var "tname")- (var "svars"))- @@ (Core.typeFunction $ Core.functionType- (ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))- (var "wtyp"))- @@ ref Substitution.idTypeSubstDef--inferTypeOfVariableDef :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)-inferTypeOfVariableDef = define "inferTypeOfVariable" $- doc "Infer the type of a variable" $- "cx" ~> "name" ~>- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "Variable not bound to type: ") (Core.unName $ var "name"))- ( "scheme" ~>- "ts" <<~ ref instantiateTypeSchemeDef @@ var "scheme" $- "vars" <~ Core.typeSchemeVariables (var "ts") $- "itype" <~ Core.typeSchemeType (var "ts") $- "iterm" <~ Lists.foldl ("t" ~> "ty" ~> Core.termTypeApplication $ Core.typedTerm (var "t") (var "ty"))- (Core.termVariable $ var "name") (Lists.map (unaryFunction Core.typeVariable) $ var "vars") $- produce $ Typing.inferenceResult (var "iterm") (var "itype") (ref Substitution.idTypeSubstDef))- (Maps.lookup (var "name") (Typing.inferenceContextDataTypes $ var "cx"))--inferTypeOfWrappedTermDef :: TBinding (InferenceContext -> WrappedTerm -> Flow s InferenceResult)-inferTypeOfWrappedTermDef = define "inferTypeOfWrappedTerm" $- doc "Infer the type of a wrapped term" $- "cx" ~> "wt" ~>- "tname" <~ Core.wrappedTermTypeName (var "wt") $- "term" <~ Core.wrappedTermObject (var "wt") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "result" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "term" @@ string "wrapped term" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "iterm" <~ Typing.inferenceResultTerm (var "result") $- "ityp" <~ Typing.inferenceResultType (var "result") $- "isubst" <~ Typing.inferenceResultSubst (var "result") $- "freshVars" <<~ ref freshNamesDef @@ Lists.length (var "svars") $- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (Lists.map (unaryFunction Core.typeVariable) $ var "freshVars")) $- "stypInst" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "stype" $- "nominalInst" <~ ref nominalApplicationDef @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "freshVars") $- "expected" <~ Core.typeWrap (Core.wrappedType (var "tname") (var "ityp")) $- "freeVars" <~ Sets.toList (Sets.unions $ list [- ref Rewriting.freeVariablesInTypeDef @@ var "ityp",- ref Rewriting.freeVariablesInTermDef @@ var "iterm",- Sets.fromList (var "freshVars")]) $- ref bindConstraintsDef @@ var "cx" @@- ("subst2" ~> ref yieldCheckedDef @@ var "cx" @@ var "freeVars" @@- (Core.termWrap $ Core.wrappedTerm (var "tname") (var "iterm")) @@- var "nominalInst" @@- (ref Substitution.composeTypeSubstDef @@ var "isubst" @@ var "subst2")) @@- list [Typing.typeConstraint (var "stypInst") (var "expected") (string "schema type of wrapper")]--inferTypesOfTemporaryBindingsDef :: TBinding (InferenceContext -> [Binding] -> Flow s ([Term], ([Type], TypeSubst)))-inferTypesOfTemporaryBindingsDef = define "inferTypesOfTemporaryBindings" $- doc "Infer types for temporary let bindings" $- "cx" ~> "bins" ~>- Logic.ifElse (Lists.null $ var "bins")- (Flows.pure $ pair (list []) (pair (list []) (ref Substitution.idTypeSubstDef))) $- "binding" <~ Lists.head (var "bins") $- "k" <~ Core.bindingName (var "binding") $- "v" <~ Core.bindingTerm (var "binding") $- "tl" <~ Lists.tail (var "bins") $- "result1" <<~ ref inferTypeOfTermDef @@ var "cx" @@ var "v" @@- (Strings.cat $ list [- string "temporary let binding '",- Core.unName $ var "k",- string "'"]) $- "j" <~ Typing.inferenceResultTerm (var "result1") $- "u_prime" <~ Typing.inferenceResultType (var "result1") $- "u" <~ Typing.inferenceResultSubst (var "result1") $- "result2" <<~ ref inferTypesOfTemporaryBindingsDef @@- (ref Substitution.substInContextDef @@ var "u" @@ var "cx") @@- var "tl" $- "h" <~ first (var "result2") $- "r_prime" <~ first (second $ var "result2") $- "r" <~ second (second $ var "result2") $- Flows.pure $ pair- (Lists.cons (ref Substitution.substTypesInTermDef @@ var "r" @@ var "j") (var "h"))- (pair- (Lists.cons (ref Substitution.substInTypeDef @@ var "r" @@ var "u_prime") (var "r_prime"))- (ref Substitution.composeTypeSubstDef @@ var "u" @@ var "r"))--initialTypeContextDef :: TBinding (Graph -> Flow s TypeContext)-initialTypeContextDef = define "initialTypeContext" $- doc "Create an initial type context from a graph" $- "g" ~>- "toPair" <~ ("pair" ~>- "name" <~ first (var "pair") $- "el" <~ second (var "pair") $- optCases (Core.bindingType $ var "el")- (Flows.fail $ "untyped element: " ++ Core.unName (var "name"))- ("ts" ~> produce $ pair (var "name") (ref Schemas.typeSchemeToFTypeDef @@ var "ts"))) $- "ix" <<~ ref graphToInferenceContextDef @@ var "g" $- "types" <<~ Flows.map- (unaryFunction Maps.fromList)- (Flows.mapList (var "toPair") (Maps.toList $ Graph.graphElements $ var "g")) $- produce $ Typing.typeContext (var "types") Sets.empty (var "ix")---- W: inst-instantiateTypeSchemeDef :: TBinding (TypeScheme -> Flow s TypeScheme)-instantiateTypeSchemeDef = define "instantiateTypeScheme" $- doc "Instantiate a type scheme with fresh variables" $- "scheme" ~>- "oldVars" <~ Core.typeSchemeVariables (var "scheme") $- "newVars" <<~ ref freshNamesDef @@ Lists.length (var "oldVars") $- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "oldVars") (Lists.map (unaryFunction Core.typeVariable) $ var "newVars")) $- produce $ Core.typeScheme (var "newVars") $- ref Substitution.substInTypeDef @@ var "subst" @@ Core.typeSchemeType (var "scheme")--isUnboundDef :: TBinding (InferenceContext -> Name -> Bool)-isUnboundDef = define "isUnbound" $- doc "Check if a variable is unbound in context" $- "cx" ~> "v" ~>- Logic.and- (Logic.not $ Sets.member (var "v") $ ref freeVariablesInContextDef @@ var "cx")- (Logic.not $ Maps.member (var "v") $ Typing.inferenceContextSchemaTypes $ var "cx")--key_vcountDef :: TBinding Name-key_vcountDef = define "key_vcount" $- doc "Key for inference type variable count" $- Core.name $ string "inferenceTypeVariableCount"--mapConstraintsDef :: TBinding (InferenceContext -> (TypeSubst -> a) -> [TypeConstraint] -> Flow s a)-mapConstraintsDef = define "mapConstraints" $- doc "Map over type constraints after unification" $- "cx" ~> "f" ~> "constraints" ~>- Flows.map (var "f") $- ref Unification.unifyTypeConstraintsDef @@ (Typing.inferenceContextSchemaTypes $ var "cx") @@ var "constraints"--nominalApplicationDef :: TBinding (Name -> [Type] -> Type)-nominalApplicationDef = define "nominalApplication" $- doc "Apply type arguments to a nominal type" $- "tname" ~> "args" ~>- Lists.foldl- ("t" ~> "a" ~> Core.typeApplication $ Core.applicationType (var "t") (var "a"))- (Core.typeVariable $ var "tname")- (var "args")--normalTypeVariableDef :: TBinding (Int -> Name)-normalTypeVariableDef = define "normalTypeVariable" $- doc "Type variable naming convention follows Haskell: t0, t1, etc." $- "i" ~> Core.name (Strings.cat2 (string "t") (Literals.showInt32 $ var "i"))--requireSchemaTypeDef :: TBinding (InferenceContext -> Name -> Flow s TypeScheme)-requireSchemaTypeDef = define "requireSchemaType" $- doc "Require a schema type from the context" $- "cx" ~> "tname" ~>- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "No such schema type: ") (Core.unName $ var "tname"))- ("ts" ~> ref instantiateTypeSchemeDef @@ (ref Rewriting.deannotateTypeSchemeRecursiveDef @@ var "ts"))- (Maps.lookup (var "tname") (Typing.inferenceContextSchemaTypes $ var "cx"))--showInferenceResultDef :: TBinding (InferenceResult -> String)-showInferenceResultDef = define "showInferenceResult" $- doc "Show an inference result for debugging" $- "result" ~>- "term" <~ Typing.inferenceResultTerm (var "result") $- "typ" <~ Typing.inferenceResultType (var "result") $- "subst" <~ Typing.inferenceResultSubst (var "result") $- Strings.cat $ list [- string "{term=",- ref ShowCore.termDef @@ var "term",- string ", type=",- ref ShowCore.typeDef @@ var "typ",- string ", subst=",- ref ShowTyping.typeSubstDef @@ var "subst",- string "}"]--toFContextDef :: TBinding (InferenceContext -> M.Map Name Type)-toFContextDef = define "toFContext" $- doc "Convert inference context to type context" $- "cx" ~> Maps.map (ref Schemas.typeSchemeToFTypeDef) $ Typing.inferenceContextDataTypes $ var "cx"--typeOfDef :: TBinding (TypeContext -> Term -> Flow s Type)-typeOfDef = define "typeOf" $- doc "Given a type context, reconstruct the type of a System F term" $- "tcontext" ~> "term" ~>- ref typeOfInternalDef @@- Typing.typeContextInferenceContext (var "tcontext") @@- Typing.typeContextVariables (var "tcontext") @@- Typing.typeContextTypes (var "tcontext") @@- (list []) @@- var "term"---- W: typeOf-typeOfInternalDef :: TBinding (InferenceContext -> S.Set Name -> M.Map Name Type -> [Type] -> Term -> Flow s Type)-typeOfInternalDef = define "typeOfInternal" $- doc "Given internal context, reconstruct the type of a System F term" $- "cx" ~> "vars" ~> "types" ~> "apptypes" ~> "term" ~>- "checkApplied" <~ ("e" ~> Logic.ifElse (Lists.null $ var "apptypes")- (var "e")- ( "app" <~ ("t" ~> "apptypes" ~>- Logic.ifElse (Lists.null $ var "apptypes")- (Flows.pure $ var "t")- (cases _Type (var "t")- (Just $ Flows.fail $ Strings.cat $ list [- string "not a forall type: ",- ref ShowCore.typeDef @@ var "t",- string " in ",- ref ShowCore.termDef @@ var "term"]) [- _Type_forall>>: "ft" ~>- "v" <~ Core.forallTypeParameter (var "ft") $- "t2" <~ Core.forallTypeBody (var "ft") $- var "app"- @@ (ref Substitution.substInTypeDef @@- (Typing.typeSubst $ Maps.singleton (var "v") (Lists.head $ var "apptypes")) @@- (var "t2"))- @@ (Lists.tail $ var "apptypes")])) $- "t1" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "term" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "t1") $- var "app" @@ var "t1" @@ var "apptypes")) $-- trace (Strings.cat $ list [- string "checking type of: ",- ref ShowCore.termDef @@ var "term",- string " (vars: ",- ref Formatting.showListDef @@ unaryFunction Core.unName @@ (Sets.toList $ var "vars"),- string ", types: ",- ref Formatting.showListDef @@ unaryFunction Core.unName @@ (Maps.keys $ var "types"),- string ")"]) $-- cases _Term (var "term")- (Just $ Flows.fail $ Strings.cat $ list [- "unsupported term variant in typeOf: ",- ref ShowMantle.termVariantDef @@ (ref Variants.termVariantDef @@ var "term")]) [-- _Term_annotated>>: "at" ~> var "checkApplied" @@ (- "term1" <~ Core.annotatedTermSubject (var "at") $- ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ var "apptypes" @@ var "term1"),-- _Term_application>>: "app" ~> var "checkApplied" @@ (- "a" <~ Core.applicationFunction (var "app") $- "b" <~ Core.applicationArgument (var "app") $- "t1" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "a" $- "t2" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "b" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "t1") $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "t2") $- cases _Type (var "t1")- (Just $ Flows.fail $ Strings.cat $ list [- "left hand side of application ",- ref ShowCore.termDef @@ var "term",- " is not a function type: ",- ref ShowCore.typeDef @@ var "t1"]) [- _Type_function>>: "ft" ~>- "p" <~ Core.functionTypeDomain (var "ft") $- "q" <~ Core.functionTypeCodomain (var "ft") $- Logic.ifElse (Equality.equal (var "p") (var "t2"))- (Flows.pure $ var "q")- (Flows.fail $ Strings.cat $ list [- "expected ",- ref ShowCore.typeDef @@ var "p",- " in ",- ref ShowCore.termDef @@ var "term",- " but found ",- ref ShowCore.typeDef @@ var "t2"])]),-- _Term_function>>: "f" ~>- cases _Function (var "f") Nothing [- _Function_elimination>>: "elm" ~>- cases _Elimination (var "elm") Nothing [- _Elimination_product>>: "tp" ~> var "checkApplied" @@ (- "index" <~ Core.tupleProjectionIndex (var "tp") $- "arity" <~ Core.tupleProjectionArity (var "tp") $- "mtypes" <~ Core.tupleProjectionDomain (var "tp") $- Optionals.maybe- (Flows.fail $ Strings.cat $ list [- "untyped tuple projection: ",- ref ShowCore.termDef @@ var "term"])- ( "types" ~>- exec (Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "vars") (var "types")) $- Flows.pure $ Core.typeFunction $ Core.functionType- (Core.typeProduct $ var "types")- (Lists.at (var "index") (var "types")))- (var "mtypes")),-- _Elimination_record>>: "p" ~>- "tname" <~ Core.projectionTypeName (var "p") $- "fname" <~ Core.projectionField (var "p") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "sfields" <<~ ref ExtractCore.recordTypeDef @@ var "tname" @@ var "stype" $- "ftyp" <<~ ref Schemas.findFieldTypeDef @@ var "fname" @@ var "sfields" $- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "apptypes")) $- "sftyp" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "ftyp" $- Flows.pure $ Core.typeFunction $ Core.functionType- (ref nominalApplicationDef @@ var "tname" @@ var "apptypes")- (var "sftyp"),-- _Elimination_union>>: "cs" ~>- "tname" <~ Core.caseStatementTypeName (var "cs") $- "dflt" <~ Core.caseStatementDefault (var "cs") $- "cases" <~ Core.caseStatementCases (var "cs") $- "cterms" <~ Lists.map (unaryFunction Core.fieldTerm) (var "cases") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "sfields" <<~ ref ExtractCore.unionTypeDef @@ var "tname" @@ var "stype" $- "tdflt" <<~ Flows.mapOptional ("e" ~> ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "e") (var "dflt") $- "tcterms" <<~ Flows.mapList ("e" ~> ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "e") (var "cterms") $- "cods" <<~ Flows.mapList ("t" ~> Flows.map (unaryFunction Core.functionTypeCodomain) $ ref ExtractCore.functionTypeDef @@ var "t") (var "tcterms") $- "ts" <~ Optionals.cat (Lists.cons (var "tdflt") $ Lists.map (unaryFunction Optionals.pure) (var "cods")) $- "cod" <<~ ref checkSameTypeDef @@ string "case branches" @@ var "ts" $- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "apptypes")) $- "scod" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "cod" $- Flows.pure $ Core.typeFunction $ Core.functionType- (ref nominalApplicationDef @@ var "tname" @@ var "apptypes")- (var "scod"),-- _Elimination_wrap>>: "tname" ~>- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "wrapped" <<~ ref ExtractCore.wrappedTypeDef @@ var "tname" @@ var "stype" $- "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "svars") (var "apptypes")) $- "swrapped" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "wrapped" $- produce $ TTypes.function- (ref nominalApplicationDef @@ var "tname" @@ var "apptypes")- (var "swrapped")],-- _Function_lambda>>: "l" ~> var "checkApplied" @@ (- "x" <~ Core.lambdaParameter (var "l") $- "mt" <~ Core.lambdaDomain (var "l") $- "e" <~ Core.lambdaBody (var "l") $- Optionals.maybe- (Flows.fail $ Strings.cat $ list [- string "untyped lambda: ",- ref ShowCore.termDef @@ var "term"])- ("t" ~>- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "t") $- "t1" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@- (Maps.insert (var "x") (var "t") (var "types")) @@ list [] @@ var "e" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "t1") $- Flows.pure $ Core.typeFunction $ Core.functionType (var "t") (var "t1"))- (var "mt")),- _Function_primitive>>: "name" ~> var "checkApplied" @@ (- -- Note: no instantiation- "ts" <~ Optionals.maybe- (Flows.fail $ Strings.cat $ list [- string "no such primitive: ",- Core.unName $ var "name"])- (unaryFunction Flows.pure)- (Maps.lookup (var "name") (Typing.inferenceContextPrimitiveTypes $ var "cx")) $- Flows.map (ref Schemas.typeSchemeToFTypeDef) (var "ts"))],-- _Term_let>>: "letTerm" ~> var "checkApplied" @@ (- "bs" <~ Core.letBindings (var "letTerm") $- "env" <~ Core.letEnvironment (var "letTerm") $- "bnames" <~ Lists.map (unaryFunction Core.bindingName) (var "bs") $- "bterms" <~ Lists.map (unaryFunction Core.bindingTerm) (var "bs") $- "btypeOf" <~ ("b" ~>- Optionals.maybe- (Flows.fail $ Strings.cat $ list [- string "untyped let binding in ",- ref ShowCore.termDef @@ var "term"])- ("ts" ~> Flows.pure $ ref Schemas.typeSchemeToFTypeDef @@ var "ts")- (Core.bindingType $ var "b")) $- "btypes" <<~ Flows.mapList (var "btypeOf") (var "bs") $- "types2" <~ Maps.union (Maps.fromList $ Lists.zip (var "bnames") (var "btypes")) (var "types") $- "typeofs" <<~ Flows.mapList (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types2" @@ list []) (var "bterms") $- exec (Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "vars") (var "btypes")) $- exec (Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "vars") (var "typeofs")) $- Logic.ifElse (Equality.equal (var "typeofs") (var "btypes"))- (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types2" @@ list [] @@ var "env")- (Flows.fail $ Strings.cat $ list [- string "binding types disagree: ",- ref Formatting.showListDef @@ ref ShowCore.typeDef @@ var "btypes",- string " and ",- ref Formatting.showListDef @@ ref ShowCore.typeDef @@ var "typeofs",- string " from terms: ",- ref Formatting.showListDef @@ ref ShowCore.termDef @@ var "bterms"])),-- _Term_list>>: "els" ~>- Logic.ifElse (Lists.null $ var "els")- -- Empty list is polymorphic- (Logic.ifElse (Equality.equal (Lists.length $ var "apptypes") (int32 1))- (Flows.pure $ Core.typeList $ Lists.head $ var "apptypes")- (Flows.fail $ "list type applied to more or less than one argument"))- -- Nonempty list must have elements of the same type- ( "eltypes" <<~ Flows.mapList- (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [])- (var "els") $- "unifiedType" <<~ ref checkSameTypeDef @@ string "list elements" @@ var "eltypes" $- -- Verify the unified type is well-formed in the current scope- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "unifiedType") $- Flows.pure $ Core.typeList $ var "unifiedType"),-- _Term_literal>>: "lit" ~> var "checkApplied" @@ (- Flows.pure $ Core.typeLiteral $ ref Variants.literalTypeDef @@ var "lit"),-- _Term_map>>: "m" ~>- Logic.ifElse (Maps.null $ var "m")- -- Empty map is polymorphic- (Logic.ifElse (Equality.equal (Lists.length $ var "apptypes") (int32 2))- (Flows.pure $ Core.typeMap $ Core.mapType- (Lists.at (int32 1) $ var "apptypes")- (Lists.at (int32 0) $ var "apptypes"))- (Flows.fail $ "map type applied to more or less than two arguments"))- -- Nonempty map must have keys and values of the same type- (var "checkApplied" @@ (- "pairs" <~ Maps.toList (var "m") $- "kt" <<~ Flows.bind- (Flows.mapList (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list []) $- Lists.map (unaryFunction first) (var "pairs"))- (ref checkSameTypeDef @@ string "map keys") $- "vt" <<~ Flows.bind- (Flows.mapList (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list []) $- Lists.map (unaryFunction second) (var "pairs"))- (ref checkSameTypeDef @@ string "map values") $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "kt") $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "vt") $- Flows.pure $ Core.typeMap $ Core.mapType (var "kt") (var "vt"))),-- _Term_optional>>: "mt" ~>- Optionals.maybe- -- Nothing case is polymorphic- (Logic.ifElse (Equality.equal (Lists.length $ var "apptypes") (int32 1))- (Flows.pure $ Core.typeOptional $ Lists.head $ var "apptypes")- (Flows.fail $ "optional type applied to more or less than one argument"))- -- Just case: infer type of the contained term- ("term" ~> var "checkApplied" @@ (- "termType" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "term" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "termType") $- Flows.pure $ Core.typeOptional $ var "termType"))- (var "mt"),-- _Term_product>>: "tuple" ~> var "checkApplied" @@ (- "etypes" <<~ Flows.mapList (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list []) (var "tuple") $- exec (Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "vars") (var "etypes")) $- Flows.pure $ Core.typeProduct $ var "etypes"),-- _Term_record>>: "record" ~>- "tname" <~ Core.recordTypeName (var "record") $- "fields" <~ Core.recordFields (var "record") $- "ftypes" <<~ Flows.mapList- (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [])- (Lists.map (unaryFunction Core.fieldTerm) (var "fields")) $- exec (Flows.mapList (ref checkTypeVariablesDef @@ var "cx" @@ var "vars") (var "ftypes")) $- ref typeOfNominalDef- @@ string "record typeOf"- @@ var "cx"- @@ var "tname"- @@ (Core.typeRecord $ Core.rowType (var "tname") $ Lists.zipWith- ("n" ~>- "t" ~>- Core.fieldType (var "n") (var "t"))- (Lists.map (unaryFunction Core.fieldName) (var "fields"))- (var "ftypes")),-- _Term_set>>: "els" ~>- Logic.ifElse (Sets.null $ var "els")- -- Empty set is polymorphic- (Logic.ifElse (Equality.equal (Lists.length $ var "apptypes") (int32 1))- (Flows.pure $ Core.typeSet $ Lists.head $ var "apptypes")- (Flows.fail $ "set type applied to more or less than one argument"))- -- Nonempty set must have elements of the same type- ( "eltypes" <<~ Flows.mapList- (ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [])- (Sets.toList $ var "els") $- "unifiedType" <<~ ref checkSameTypeDef @@ string "set elements" @@ var "eltypes" $- -- Verify the unified type is well-formed in the current scope- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "unifiedType") $- Flows.pure $ Core.typeSet $ var "unifiedType"),-- -- TermSum (Sum idx size term1) is ignored for now. See https://github.com/CategoricalData/hydra/issues/134.-- _Term_typeLambda>>: "ta" ~>- "v" <~ Core.typeLambdaParameter (var "ta") $- "e" <~ Core.typeLambdaBody (var "ta") $- "t1" <<~ ref typeOfInternalDef @@ var "cx" @@ (Sets.insert (var "v") (var "vars")) @@ var "types" @@ list [] @@ var "e" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ (Sets.insert (var "v") (var "vars")) @@ var "t1") $- Flows.pure $ Core.typeForall $ Core.forallType (var "v") (var "t1"),-- _Term_typeApplication>>: "tyapp" ~>- "e" <~ Core.typedTermTerm (var "tyapp") $- "t" <~ Core.typedTermType (var "tyapp") $- ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ Lists.cons (var "t") (var "apptypes") @@ var "e",-- _Term_union>>: "injection" ~>- "tname" <~ Core.injectionTypeName (var "injection") $-- -- Note: the following are only for sanity checking, and are not used in the typeOf result.- "field" <~ Core.injectionField (var "injection") $- "fname" <~ Core.fieldName (var "field") $- "fterm" <~ Core.fieldTerm (var "field") $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "sfields" <<~ ref ExtractCore.unionTypeDef @@ var "tname" @@ var "stype" $- "ftyp" <<~ ref Schemas.findFieldTypeDef @@ var "fname" @@ var "sfields" $-- Flows.pure $ ref nominalApplicationDef @@ var "tname" @@ var "apptypes",-- _Term_unit>>: constant $ var "checkApplied" @@ (Flows.pure Core.typeUnit),-- _Term_variable>>: "name" ~> var "checkApplied" @@ (Optionals.maybe- (Flows.fail $ Strings.cat $ list [- string "unbound variable: ",- Core.unName $ var "name"])- (unaryFunction Flows.pure)- (Maps.lookup (var "name") (var "types"))),-- _Term_wrap>>: "wt" ~>- "tname" <~ Core.wrappedTermTypeName (var "wt") $- "innerTerm" <~ Core.wrappedTermObject (var "wt") $- "innerType" <<~ ref typeOfInternalDef @@ var "cx" @@ var "vars" @@ var "types" @@ list [] @@ var "innerTerm" $- exec (ref checkTypeVariablesDef @@ var "cx" @@ var "vars" @@ var "innerType") $- ref typeOfNominalDef @@ string "wrapper typeOf" @@ var "cx" @@ var "tname" @@- (Core.typeWrap $ Core.wrappedType (var "tname") (var "innerType"))]--typeOfNominalDef :: TBinding (String -> InferenceContext -> Name -> Type -> Flow s Type)-typeOfNominalDef = define "typeOfNominal" $- doc "Infer the type of a nominal type" $- "desc" ~> "cx" ~> "tname" ~> "expected" ~>- "resolveType" <~ ("subst" ~> "v" ~>- Optionals.fromMaybe (Core.typeVariable $ var "v") (Maps.lookup (var "v") (var "subst"))) $- "schemaType" <<~ ref requireSchemaTypeDef @@ var "cx" @@ var "tname" $- "svars" <~ Core.typeSchemeVariables (var "schemaType") $- "stype" <~ Core.typeSchemeType (var "schemaType") $- "substWrapper" <<~ ref Unification.unifyTypesDef @@- (Typing.inferenceContextSchemaTypes $ var "cx") @@- var "stype" @@- var "expected" @@- var "desc" $- "subst" <~ Typing.unTypeSubst (var "substWrapper") $- "tparams" <~ Lists.map (var "resolveType" @@ var "subst") (var "svars") $- Flows.pure $ ref nominalApplicationDef @@ var "tname" @@ var "tparams"--typeOfUnitDef :: TBinding InferenceResult-typeOfUnitDef = define "inferTypeOfUnit" $- doc "The trivial inference result for the unit term" $- Typing.inferenceResult- (Core.termUnit)- (Core.typeUnit)- (ref Substitution.idTypeSubstDef)--yieldDef :: TBinding (Term -> Type -> TypeSubst -> InferenceResult)-yieldDef = define "yield" $- doc "Create an inference result" $- "term" ~> "typ" ~> "subst" ~>- Typing.inferenceResult- (ref Substitution.substTypesInTermDef @@ var "subst" @@ var "term")- (ref Substitution.substInTypeDef @@ var "subst" @@ var "typ")- (var "subst")--yieldCheckedDef :: TBinding (InferenceContext -> [Name] -> Term -> Type -> TypeSubst -> Flow s InferenceResult)-yieldCheckedDef = define "yieldChecked" $- doc "Create a checked inference result" $- "cx" ~> "vars" ~> "term" ~> "typ" ~> "subst" ~>- "iterm" <~ ref Substitution.substTypesInTermDef @@ var "subst" @@ var "term" $- "itype" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "typ" $- produce $ Typing.inferenceResult (var "iterm") (var "itype") (var "subst")--yieldDebugDef :: TBinding (InferenceContext -> String -> Term -> Type -> TypeSubst -> Flow s InferenceResult)-yieldDebugDef = define "yieldDebug" $- doc "Create an inference result with debug output" $- "cx" ~> "debugId" ~> "term" ~> "typ" ~> "subst" ~>- "rterm" <~ ref Substitution.substTypesInTermDef @@ var "subst" @@ var "term" $- "rtyp" <~ ref Substitution.substInTypeDef @@ var "subst" @@ var "typ" $- "result" <<~ ref Annotations.debugIfDef @@ var "debugId" @@- (Strings.cat $ list [- string "\n\tterm: ", ref ShowCore.termDef @@ var "term",- string "\n\ttyp: ", ref ShowCore.typeDef @@ var "typ",- string "\n\tsubst: ", ref ShowTyping.typeSubstDef @@ var "subst",- string "\n\trterm: ", ref ShowCore.termDef @@ var "rterm",- string "\n\trtyp: ", ref ShowCore.typeDef @@ var "rtyp"]) $- produce $ Typing.inferenceResult (var "rterm") (var "rtyp") (var "subst")++module Hydra.Sources.Kernel.Terms.Inference where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ bindConstraints, bindUnboundTypeVariables, buildTypeApplicationTerm, emptyInferenceContext,+ extendContext, finalizeInferredTerm, forInferredTerm, freeVariablesInContext, freshVariableType,+ generalize, inferGraphTypes, inferInGraphContext, inferMany, inferTypeOf, inferTypeOfAnnotatedTerm,+ inferTypeOfApplication, inferTypeOfCaseStatement, inferTypeOfCollection, inferTypeOfEither,+ inferTypeOfElimination, inferTypeOfFunction, inferTypeOfInjection, inferTypeOfLambda, inferTypeOfLet,+ inferTypeOfLetNormalized, inferTypeOfList, inferTypeOfLiteral, inferTypeOfMap, inferTypeOfOptional,+ inferTypeOfPair, inferTypeOfPrimitive, inferTypeOfProjection, inferTypeOfRecord, inferTypeOfSet,+ inferTypeOfTerm, inferTypeOfTypeLambda, inferTypeOfTypeApplication, inferTypeOfUnit, inferTypeOfUnwrap,+ inferTypeOfVariable, inferTypeOfWrappedTerm, inferTypesOfTemporaryBindings, initialTypeContext,+ isUnbound, mapConstraints, mergeClassConstraints, showInferenceResult, yield, yieldChecked,+ yieldCheckedWithConstraints, yieldDebug, yieldWithConstraints)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Show.Typing as ShowTyping+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution+import qualified Hydra.Sources.Kernel.Terms.Unification as Unification+++ns :: Namespace+ns = Namespace "hydra.inference"++module_ :: Module+module_ = Module ns elements+ [Annotations.ns, Checking.ns, ExtractCore.ns, Lexical.ns, Monads.ns, Reflect.ns,+ Rewriting.ns, Schemas.ns, ShowCore.ns, ShowTyping.ns, Sorting.ns, Substitution.ns,+ Unification.ns]+ kernelTypesNamespaces $+ Just "Type inference following Algorithm W, extended for nominal terms and types"+ where+ elements = [+ toBinding bindConstraints,+ toBinding bindUnboundTypeVariables,+ toBinding buildTypeApplicationTerm,+ toBinding emptyInferenceContext,+ toBinding extendContext,+ toBinding finalizeInferredTerm,+ toBinding forInferredTerm,+ toBinding freeVariablesInContext,+ toBinding freshVariableType,+ toBinding generalize,+ toBinding inferGraphTypes,+ toBinding inferInGraphContext,+ toBinding inferMany,+ toBinding inferTypeOfAnnotatedTerm,+ toBinding inferTypeOfApplication,+ toBinding inferTypeOfCaseStatement,+ toBinding inferTypeOfCollection,+ toBinding inferTypeOf,+ toBinding inferTypeOfEither,+ toBinding inferTypeOfElimination,+ toBinding inferTypeOfFunction,+ toBinding inferTypeOfInjection,+ toBinding inferTypeOfLambda,+ toBinding inferTypeOfLetNormalized,+ toBinding inferTypeOfLet,+ toBinding inferTypeOfList,+ toBinding inferTypeOfLiteral,+ toBinding inferTypeOfMap,+ toBinding inferTypeOfOptional,+ toBinding inferTypeOfPair,+ toBinding inferTypeOfPrimitive,+ toBinding inferTypeOfProjection,+ toBinding inferTypeOfRecord,+ toBinding inferTypeOfSet,+ toBinding inferTypeOfTerm,+ toBinding inferTypeOfTypeLambda,+ toBinding inferTypeOfTypeApplication,+ toBinding inferTypeOfUnit,+ toBinding inferTypeOfUnwrap,+ toBinding inferTypeOfVariable,+ toBinding inferTypeOfWrappedTerm,+ toBinding inferTypesOfTemporaryBindings,+ toBinding initialTypeContext,+ toBinding isUnbound,+ toBinding mapConstraints,+ toBinding mergeClassConstraints,+ toBinding showInferenceResult,+ toBinding yield,+ toBinding yieldChecked,+ toBinding yieldCheckedWithConstraints,+ toBinding yieldDebug,+ toBinding yieldWithConstraints]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++--++bindConstraints :: TBinding (InferenceContext -> (TypeSubst -> Flow s a) -> [TypeConstraint] -> Flow s a)+bindConstraints = define "bindConstraints" $+ doc "Bind type constraints and continue with substitution" $+ "cx" ~> "f" ~> "constraints" ~>+ "s" <<~ Unification.unifyTypeConstraints @@ Typing.inferenceContextSchemaTypes (var "cx") @@ var "constraints" $+ exec (Checking.checkTypeSubst @@ var "cx" @@ var "s") $+ var "f" @@ var "s"++bindUnboundTypeVariables :: TBinding (InferenceContext -> Term -> Term)+bindUnboundTypeVariables = define "bindUnboundTypeVariables" $+ doc ("Place unbound type variables appearing anywhere under a typed let binding in the type scheme of that binding."+ <> " These variables may appear in the binding type scheme itself or in that of a subterm,"+ <> " in domain types attached to functions, and in type abstraction and type application terms."+ <> " This process attempts to capture type variables which have escaped unification, e.g. due to unused code."+ <> " However, unbound type variables not appearing beneath any typed let binding remain unbound.") $+ "cx" ~> "term0" ~>+ "svars" <~ Sets.fromList (Maps.keys $ Typing.inferenceContextSchemaTypes $ var "cx") $+ "rewrite" <~ ("recurse" ~> "term" ~> cases _Term (var "term")+ (Just $ var "recurse" @@ var "term") [+ _Term_let>>: "l" ~>+ "forBinding" <~ ("b" ~>+ "bname" <~ (Core.bindingName $ var "b") $+ "bterm" <~ (Core.bindingTerm $ var "b") $+ optCases (Core.bindingType $ var "b")+ (Core.binding (var "bname") (bindUnboundTypeVariables @@ var "cx" @@ var "bterm") nothing)+ ("ts" ~>+ "bvars" <~ Sets.fromList (Core.typeSchemeVariables $ var "ts") $+ "unboundInType" <~ Rewriting.freeVariablesInType @@ (Core.typeSchemeType $ var "ts") $+ "unboundInTerm" <~ Rewriting.freeTypeVariablesInTerm @@ var "bterm" $+ "unbound" <~ Sets.toList (Sets.difference+ (Sets.union (var "unboundInType") (var "unboundInTerm"))+ (Sets.union (var "svars") (var "bvars"))) $+ "ts2" <~ Core.typeScheme+ (Lists.concat2+ (Core.typeSchemeVariables $ var "ts")+ (var "unbound"))+ (Core.typeSchemeType $ var "ts")+ (Core.typeSchemeConstraints $ var "ts") $+ "bterm2" <~ Lists.foldl+ ("t" ~> "v" ~> Core.termTypeLambda+ (Core.typeLambda (var "v") (var "t")))+ (var "bterm")+ (var "unbound") $+ Core.binding (var "bname") (var "bterm2") (just $ var "ts2"))) $+ Core.termLet $ Core.let_+ (Lists.map (var "forBinding") (Core.letBindings $ var "l"))+ (bindUnboundTypeVariables @@ var "cx" @@ (Core.letBody $ var "l"))]) $+ Rewriting.rewriteTerm @@ var "rewrite" @@ var "term0"++buildTypeApplicationTerm :: TBinding ([Name] -> Term -> Term)+buildTypeApplicationTerm = define "buildTypeApplicationTerm" $+ doc "Fold a list of type variables over a term to build a type application term" $+ "tvars" ~> "body" ~> Lists.foldl+ ("t" ~> "v" ~> Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeVariable (var "v")))+ (var "body")+ (var "tvars")++emptyInferenceContext :: TBinding InferenceContext+emptyInferenceContext = define "emptyInferenceContext" $+ doc "An empty inference context" $+ Typing.inferenceContext+ (Maps.empty)+ (Maps.empty)+ (Maps.empty)+ (Maps.empty)+ false++extendContext :: TBinding ([(Name, TypeScheme)] -> InferenceContext -> InferenceContext)+extendContext = define "extendContext" $+ doc "Add (term variable, type scheme) pairs to the typing environment" $+ "pairs" ~> "cx" ~>+ Typing.inferenceContextWithDataTypes (var "cx") $ Maps.union+ (Maps.fromList $ var "pairs")+ (Typing.inferenceContextDataTypes $ var "cx")++finalizeInferredTerm :: TBinding (InferenceContext -> Term -> Flow s Term)+finalizeInferredTerm = define "finalizeInferredTerm" $+ doc "Finalize an inferred term by checking for unbound type variables, then normalizing type variables" $+ "cx" ~> "term" ~>+ -- TODO: restore these (but make sure type checking tests pass)+ "term2" <~ bindUnboundTypeVariables @@ var "cx" @@ var "term" $+ exec (Checking.checkForUnboundTypeVariables @@ var "cx" @@ var "term2") $+-- "term2" <~ var "term" $+ produce $ Rewriting.normalizeTypeVariablesInTerm @@ var "term2"++forInferredTerm :: TBinding (InferenceContext -> Term -> String -> (InferenceResult -> a) -> Flow s a)+forInferredTerm = define "forInferredTerm" $+ doc "Infer a term's type and map over the result" $+ "cx" ~> "term" ~> "desc" ~> "f" ~>+ Flows.map (var "f") $ inferTypeOfTerm @@ var "cx" @@ var "term" @@ var "desc"++freeVariablesInContext :: TBinding (InferenceContext -> S.Set Name)+freeVariablesInContext = define "freeVariablesInContext" $+ doc "Get all free variables in an inference context" $+ "cx" ~>+ Lists.foldl (binaryFunction Sets.union) Sets.empty $+ Lists.map (Rewriting.freeVariablesInTypeSchemeSimple) $+ Maps.elems $ Typing.inferenceContextDataTypes $ var "cx"++freshVariableType :: TBinding (Flow s Type)+freshVariableType = define "freshVariableType" $+ doc "Generate a fresh type variable" $+ Flows.map (unaryFunction Core.typeVariable) (Schemas.freshName)++mergeClassConstraints :: TBinding (M.Map Name TypeVariableMetadata -> M.Map Name TypeVariableMetadata -> M.Map Name TypeVariableMetadata)+mergeClassConstraints = define "mergeClassConstraints" $+ doc "Merge two maps of class constraints. When both maps have constraints for the same variable, union the class sets." $+ "m1" ~> "m2" ~>+ Lists.foldl+ ("acc" ~> "pair" ~>+ "k" <~ Pairs.first (var "pair") $+ "v" <~ Pairs.second (var "pair") $+ Maybes.maybe+ (Maps.insert (var "k") (var "v") (var "acc"))+ ("existing" ~>+ "merged" <~ Core.typeVariableMetadata (Sets.union (Core.typeVariableMetadataClasses $ var "existing") (Core.typeVariableMetadataClasses $ var "v")) $+ Maps.insert (var "k") (var "merged") (var "acc"))+ (Maps.lookup (var "k") (var "acc")))+ (var "m1")+ (Maps.toList $ var "m2")++generalize :: TBinding (InferenceContext -> Type -> TypeScheme)+generalize = define "generalize" $+ doc "Generalize a type to a type scheme" $+ "cx" ~> "typ" ~>+ -- IMPORTANT: freeVariablesInTypeOrdered returns ALL names from Type_variable positions,+ -- including qualified type names (like hydra.compute.Flow) which are NOT actual type variables.+ -- We must filter these out to avoid quantifying over type names.+ "isTypeVarName" <~ ("name" ~>+ "parts" <~ Strings.splitOn (string ".") (Core.unName $ var "name") $+ Equality.lte (Lists.length $ var "parts") (int32 1)) $+ "vars" <~ Lists.nub (Lists.filter ("v" ~> Logic.and (isUnbound @@ var "cx" @@ var "v") (var "isTypeVarName" @@ var "v")) $+ Rewriting.freeVariablesInTypeOrdered @@ var "typ") $+ -- Extract constraints for the generalized variables from the context+ "allConstraints" <~ Typing.inferenceContextClassConstraints (var "cx") $+ "relevantConstraints" <~ Maps.fromList (Maybes.cat $ Lists.map+ ("v" ~> Maybes.map ("meta" ~> pair (var "v") (var "meta")) $ Maps.lookup (var "v") (var "allConstraints"))+ (var "vars")) $+ -- Only include constraints if there are any+ "constraintsMaybe" <~ Logic.ifElse (Maps.null $ var "relevantConstraints") Phantoms.nothing (just $ var "relevantConstraints") $+ Core.typeScheme (var "vars") (var "typ") (var "constraintsMaybe")++inferGraphTypes :: TBinding (Graph -> Flow s Graph)+inferGraphTypes = define "inferGraphTypes" $+ doc "Infer types for all elements in a graph" $+ "g0" ~>+ "fromLetTerm" <~ ("l" ~>+ "bindings" <~ Core.letBindings (var "l") $+ "body" <~ Core.letBody (var "l") $+ Graph.graph+ (var "bindings")+ (Maps.empty)+ (Maps.empty)+ (var "body")+ (Graph.graphPrimitives $ var "g0")+ (Graph.graphSchema $ var "g0")) $+ "toLetTerm" <~ ("g" ~>+ "toBinding" <~ ("el" ~> Core.binding+ (Core.bindingName $ var "el")+ (Core.bindingTerm $ var "el")+ (Core.bindingType $ var "el")) $ -- Preserve original TypeScheme with its constraints+ Core.termLet $ Core.let_+ (Lists.map (var "toBinding") $ Graph.graphElements $ var "g")+ (Graph.graphBody $ var "g")) $+ "forFinal" <~ ("finalized" ~> cases _Term (var "finalized")+ Nothing [+ _Term_let>>: "l" ~> Flows.pure $ var "fromLetTerm" @@ var "l",+ _Term_variable>>: constant $ Flows.fail $ (string "Expected inferred graph as let term")]) $+ trace (string "graph inference") $+ "cx" <<~ Schemas.graphToInferenceContext @@ var "g0" $+ "result" <<~ inferTypeOfTerm @@ var "cx" @@ (var "toLetTerm" @@ var "g0") @@ (string "graph term") $+ "term" <~ Typing.inferenceResultTerm (var "result") $+ "ts" <~ Typing.inferenceResultType (var "result") $+ "finalized" <<~ finalizeInferredTerm @@ var "cx" @@ var "term" $+ var "forFinal" @@ var "finalized"++-- Note: this operation is expensive, as it creates a new typing environment for each individual term+inferInGraphContext :: TBinding (Term -> Flow Graph InferenceResult)+inferInGraphContext = define "inferInGraphContext" $+ doc "Infer the type of a term in graph context" $+ "term" ~>+ "g" <<~ Monads.getState $+ "cx" <<~ Schemas.graphToInferenceContext @@ var "g" $+ inferTypeOfTerm @@ var "cx" @@ var "term" @@ (string "single term")++inferMany :: TBinding (InferenceContext -> [(Term, String)] -> Flow s ([Term], [Type], TypeSubst))+inferMany = define "inferMany" $+ doc "Infer types for multiple terms" $+ "cx" ~> "pairs" ~>+ "dflt" <~ (+ "e" <~ Pairs.first (Lists.head $ var "pairs") $+ "desc" <~ Pairs.second (Lists.head $ var "pairs") $+ "tl" <~ Lists.tail (var "pairs") $+ "result1" <<~ inferTypeOfTerm @@ var "cx" @@ var "e" @@ var "desc" $+ "e1" <~ Typing.inferenceResultTerm (var "result1") $+ "t1" <~ Typing.inferenceResultType (var "result1") $+ "s1" <~ Typing.inferenceResultSubst (var "result1") $+ "result2" <<~ inferMany @@ (Substitution.substInContext @@ var "s1" @@ var "cx") @@ var "tl" $+ "e2" <~ Pairs.first (var "result2") $+ "t2" <~ Pairs.first (Pairs.second $ var "result2") $+ "s2" <~ Pairs.second (Pairs.second $ var "result2") $+ produce $ pair+ (Lists.cons (Substitution.substTypesInTerm @@ var "s2" @@ var "e1") (var "e2"))+ (pair+ (Lists.cons (Substitution.substInType @@ var "s2" @@ var "t1") (var "t2"))+ (Substitution.composeTypeSubst @@ var "s1" @@ var "s2"))) $+ Logic.ifElse (Lists.null $ var "pairs")+ (Flows.pure $ pair (list ([] :: [TTerm Term])) $ pair (list ([] :: [TTerm Type])) (Substitution.idTypeSubst))+ (var "dflt")++inferTypeOf :: TBinding (InferenceContext -> Term -> Flow s (Term, TypeScheme))+inferTypeOf = define "inferTypeOf" $+ doc "Infer the type of a term and return a type scheme" $+ "cx" ~> "term" ~>+ -- Top-level let term which allows us to easily extract an inferred type scheme+ "letTerm" <~ Core.termLet (Core.let_+ (list [Core.binding (Core.name $ (string "ignoredVariableName")) (var "term") nothing])+ (MetaTerms.string "ignoredBody")) $+ "forBindings" <~ ("bindings" ~>+ "binding" <~ Lists.head (var "bindings") $+ "term1" <~ Core.bindingTerm (var "binding") $+ "mts" <~ Core.bindingType (var "binding") $+ Maybes.maybe+ (Flows.fail $ (string "Expected a type scheme"))+ ("ts" ~> Flows.pure $ pair (var "term1") (var "ts"))+ (var "mts")) $+ "unifyAndSubst" <~ ("result" ~>+ "subst" <~ Typing.inferenceResultSubst (var "result") $+ "finalized" <<~ finalizeInferredTerm @@ var "cx" @@ Typing.inferenceResultTerm (var "result") $+ "letResult" <<~ Lexical.withEmptyGraph @@ (ExtractCore.let_ @@ var "finalized") $+ "bindings" <~ Core.letBindings (var "letResult") $+ Logic.ifElse (Equality.equal (int32 1) (Lists.length $ var "bindings"))+ (var "forBindings" @@ var "bindings")+ (Flows.fail $ Strings.cat $ list [+ (string "Expected a single binding with a type scheme, but got: "),+ Literals.showInt32 $ Lists.length $ var "bindings",+ (string " bindings")])) $+ "result" <<~ inferTypeOfTerm @@ var "cx" @@ var "letTerm" @@ (string "infer type of term") $+ var "unifyAndSubst" @@ var "result"++inferTypeOfAnnotatedTerm :: TBinding (InferenceContext -> AnnotatedTerm -> Flow s InferenceResult)+inferTypeOfAnnotatedTerm = define "inferTypeOfAnnotatedTerm" $+ doc "Infer the type of an annotated term" $+ "cx" ~> "at" ~>+ "term" <~ Core.annotatedTermBody (var "at") $+ "ann" <~ Core.annotatedTermAnnotation (var "at") $+ "result" <<~ inferTypeOfTerm @@ var "cx" @@ var "term" @@ (string "annotated term") $+ "iterm" <~ Typing.inferenceResultTerm (var "result") $+ "itype" <~ Typing.inferenceResultType (var "result") $+ "isubst" <~ Typing.inferenceResultSubst (var "result") $+ "iconstraints" <~ Typing.inferenceResultClassConstraints (var "result") $+ produce $ Typing.inferenceResult+ (Core.termAnnotated $ Core.annotatedTerm (var "iterm") (var "ann"))+ (var "itype")+ (var "isubst")+ (var "iconstraints")++inferTypeOfApplication :: TBinding (InferenceContext -> Application -> Flow s InferenceResult)+inferTypeOfApplication = define "inferTypeOfApplication" $+ doc "Infer the type of a function application" $+ "cx" ~> "app" ~>+ "e0" <~ Core.applicationFunction (var "app") $+ "e1" <~ Core.applicationArgument (var "app") $+ "lhsResult" <<~ inferTypeOfTerm @@ var "cx" @@ var "e0" @@ (string "lhs") $+ "a" <~ Typing.inferenceResultTerm (var "lhsResult") $+ "t0" <~ Typing.inferenceResultType (var "lhsResult") $+ "s0" <~ Typing.inferenceResultSubst (var "lhsResult") $+ "c0" <~ Typing.inferenceResultClassConstraints (var "lhsResult") $+ "rhsResult" <<~ inferTypeOfTerm+ @@ (Substitution.substInContext @@ var "s0" @@ var "cx")+ @@ var "e1"+ @@ (string "rhs") $+ "b" <~ Typing.inferenceResultTerm (var "rhsResult") $+ "t1" <~ Typing.inferenceResultType (var "rhsResult") $+ "s1" <~ Typing.inferenceResultSubst (var "rhsResult") $+ "c1" <~ Typing.inferenceResultClassConstraints (var "rhsResult") $+ "v" <<~ Schemas.freshName $+ "s2" <<~ Unification.unifyTypes+ @@ (Typing.inferenceContextSchemaTypes $ var "cx")+ @@ (Substitution.substInType @@ var "s1" @@ var "t0")+ @@ (Core.typeFunction $ Core.functionType (var "t1") (Core.typeVariable $ var "v"))+ @@ (string "application lhs") $+ exec (Checking.checkTypeSubst @@ var "cx" @@ var "s2") $+ "rExpr" <~ Core.termApplication (Core.application+ (Substitution.substTypesInTerm @@ (Substitution.composeTypeSubst @@ var "s1" @@ var "s2") @@ var "a")+ (Substitution.substTypesInTerm @@ var "s2" @@ var "b")) $+ "rType" <~ Substitution.substInType @@ var "s2" @@ Core.typeVariable (var "v") $+ "rSubst" <~ Substitution.composeTypeSubstList @@ list [var "s0", var "s1", var "s2"] $+ -- Apply substitutions to constraints, then merge+ -- c0 needs both s1 and s2 applied (from rhs inference and unification)+ -- c1 needs just s2 applied (from unification)+ "c0Subst" <~ Substitution.substInClassConstraints @@ var "s2" @@ (Substitution.substInClassConstraints @@ var "s1" @@ var "c0") $+ "c1Subst" <~ Substitution.substInClassConstraints @@ var "s2" @@ var "c1" $+ "rConstraints" <~ mergeClassConstraints @@ var "c0Subst" @@ var "c1Subst" $+ produce $ Typing.inferenceResult (var "rExpr") (var "rType") (var "rSubst") (var "rConstraints")++inferTypeOfCaseStatement :: TBinding (InferenceContext -> CaseStatement -> Flow s InferenceResult)+inferTypeOfCaseStatement = define "inferTypeOfCaseStatement" $+ doc "Infer the type of a case statement" $+ "cx" ~> "caseStmt" ~>+ "tname" <~ Core.caseStatementTypeName (var "caseStmt") $+ "dflt" <~ Core.caseStatementDefault (var "caseStmt") $+ "cases" <~ Core.caseStatementCases (var "caseStmt") $+ "fnames" <~ Lists.map (unaryFunction Core.fieldName) (var "cases") $+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "sfields" <<~ ExtractCore.unionType @@ var "tname" @@ var "stype" $+ "dfltResult" <<~ Flows.mapMaybe ("t" ~> inferTypeOfTerm @@ var "cx" @@ var "t" @@+ (Strings.cat $ list [(string "case "), Core.unName $ var "tname", (string ".<default>")])) (var "dflt") $+ "caseResults" <<~ inferMany @@ var "cx" @@ Lists.map+ ("f" ~> pair (Core.fieldTerm $ var "f")+ (Strings.cat $ list [(string "case "), Core.unName $ var "tname", (string "."), Core.unName $ Core.fieldName $ var "f"]))+ (var "cases") $+ "iterms" <~ Pairs.first (var "caseResults") $+ "itypes" <~ Pairs.first (Pairs.second $ var "caseResults") $+ "isubst" <~ Pairs.second (Pairs.second $ var "caseResults") $+ "codv" <<~ Schemas.freshName $+ "cod" <~ Core.typeVariable (var "codv") $+ "caseMap" <~ Maps.fromList (Lists.map+ ("ft" ~> pair (Core.fieldTypeName $ var "ft") (Core.fieldTypeType $ var "ft"))+ (var "sfields")) $+ "dfltConstraints" <~ Monads.maybeToList @@ (Maybes.map+ ("r" ~> Typing.typeConstraint (var "cod")+ (Substitution.substInType @@ var "isubst" @@ (Typing.inferenceResultType $ var "r"))+ (string "match default"))+ (var "dfltResult")) $+ "caseConstraints" <~ Maybes.cat (Lists.zipWith+ ("fname" ~> "itype" ~> Maybes.map+ ("ftype" ~> Typing.typeConstraint+ (var "itype")+ (Core.typeFunction $ Core.functionType (var "ftype") (var "cod"))+ (string "case type"))+ (Maps.lookup (var "fname") (var "caseMap")))+ (var "fnames") (var "itypes")) $+ mapConstraints+ @@ var "cx"+ @@ ("subst" ~> yield+ @@ (buildTypeApplicationTerm @@ var "svars"+ @@ (Core.termFunction $ Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement (var "tname") (Maybes.map (unaryFunction Typing.inferenceResultTerm) $ var "dfltResult") $+ Lists.zipWith ("n" ~> "t" ~> Core.field (var "n") (var "t")) (var "fnames") (var "iterms")))+ @@ (Core.typeFunction $ Core.functionType+ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ (var "cod"))+ @@ (Substitution.composeTypeSubstList+ @@ (Lists.concat $ list [+ Monads.maybeToList @@ (Maybes.map (unaryFunction Typing.inferenceResultSubst) (var "dfltResult")),+ list [var "isubst", var "subst"]])))+ @@ (Lists.concat $ list [var "dfltConstraints", var "caseConstraints"])++inferTypeOfCollection :: TBinding (InferenceContext -> (Type -> Type) -> ([Term] -> Term) -> String -> [Term] -> Flow s InferenceResult)+inferTypeOfCollection = define "inferTypeOfCollection" $+ doc "Infer the type of a collection" $+ "cx" ~> "typCons" ~> "trmCons" ~> "desc" ~> "els" ~>+ "var" <<~ Schemas.freshName $+ Logic.ifElse (Lists.null $ var "els")+ -- Empty collection: add type application for the fresh element type variable+ (Flows.pure $ yield+ @@ (buildTypeApplicationTerm+ @@ list [var "var"]+ @@ (var "trmCons" @@ list ([] :: [TTerm Term])))+ @@ (var "typCons" @@ (Core.typeVariable $ var "var"))+ @@ (Substitution.idTypeSubst))+ -- General case: non-empty collection+ ("results" <<~ inferMany @@ var "cx" @@+ (Lists.zip (var "els") $ Lists.map ("i" ~> Strings.cat $ list [(string "#"), Literals.showInt32 $ var "i"]) $+ Math.range (int32 1) (Math.add (Lists.length $ var "els") (int32 1))) $+ "terms" <~ Pairs.first (var "results") $+ "types" <~ Pairs.first (Pairs.second $ var "results") $+ "subst1" <~ Pairs.second (Pairs.second $ var "results") $+ "constraints" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "var") (var "t") (var "desc")) (var "types") $+ mapConstraints @@ var "cx" @@+ ("subst2" ~>+ "iterm" <~ var "trmCons" @@ var "terms" $+ "itype" <~ var "typCons" @@ (Core.typeVariable $ var "var") $+ "isubst" <~ Substitution.composeTypeSubst @@ var "subst1" @@ var "subst2" $+ yield @@ var "iterm" @@ var "itype" @@ var "isubst") @@+ var "constraints")++inferTypeOfEither :: TBinding (InferenceContext -> Prelude.Either Term Term -> Flow s InferenceResult)+inferTypeOfEither = define "inferTypeOfEither" $+ doc "Infer the type of an either value" $+ "cx" ~> "e" ~>+ Eithers.either_+ ("l" ~>+ "r1" <<~ (inferTypeOfTerm @@ var "cx" @@ var "l" @@ (string "either left value")) $+ "iterm" <~ Typing.inferenceResultTerm (var "r1") $+ "leftType" <~ Typing.inferenceResultType (var "r1") $+ "subst" <~ Typing.inferenceResultSubst (var "r1") $+ "rightType" <<~ freshVariableType $+ "eitherTerm" <~ (Core.termEither $ left $ var "iterm") $+ "termWithLeftType" <~ (Core.termTypeApplication $ Core.typeApplicationTerm (var "eitherTerm") (var "leftType")) $+ "termWithBothTypes" <~ (Core.termTypeApplication $ Core.typeApplicationTerm (var "termWithLeftType") (var "rightType")) $+ "eitherType" <~ (Core.typeEither $ Core.eitherType (var "leftType") (var "rightType")) $+ yieldChecked @@ var "termWithBothTypes" @@ var "eitherType" @@ var "subst")+ ("r" ~>+ "r1" <<~ (inferTypeOfTerm @@ var "cx" @@ var "r" @@ (string "either right value")) $+ "iterm" <~ Typing.inferenceResultTerm (var "r1") $+ "rightType" <~ Typing.inferenceResultType (var "r1") $+ "subst" <~ Typing.inferenceResultSubst (var "r1") $+ "leftType" <<~ freshVariableType $+ "eitherTerm" <~ (Core.termEither $ right $ var "iterm") $+ "termWithLeftType" <~ (Core.termTypeApplication $ Core.typeApplicationTerm (var "eitherTerm") (var "leftType")) $+ "termWithBothTypes" <~ (Core.termTypeApplication $ Core.typeApplicationTerm (var "termWithLeftType") (var "rightType")) $+ "eitherType" <~ (Core.typeEither $ Core.eitherType (var "leftType") (var "rightType")) $+ yieldChecked @@ var "termWithBothTypes" @@ var "eitherType" @@ var "subst")+ (var "e")++inferTypeOfElimination :: TBinding (InferenceContext -> Elimination -> Flow s InferenceResult)+inferTypeOfElimination = define "inferTypeOfElimination" $+ doc "Infer the type of an elimination" $+ "cx" ~> "elm" ~>+ cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "p" ~> inferTypeOfProjection @@ var "cx" @@ var "p",+ _Elimination_union>>: "c" ~> inferTypeOfCaseStatement @@ var "cx" @@ var "c",+ _Elimination_wrap>>: "tname" ~> inferTypeOfUnwrap @@ var "cx" @@ var "tname"]++inferTypeOfFunction :: TBinding (InferenceContext -> Function -> Flow s InferenceResult)+inferTypeOfFunction = define "inferTypeOfFunction" $+ doc "Infer the type of a function" $+ "cx" ~> "f" ~>+ cases _Function (var "f") Nothing [+ _Function_elimination>>: "elm" ~> inferTypeOfElimination @@ var "cx" @@ var "elm",+ _Function_lambda>>: "l" ~> inferTypeOfLambda @@ var "cx" @@ var "l",+ _Function_primitive>>: "name" ~> inferTypeOfPrimitive @@ var "cx" @@ var "name"]++inferTypeOfInjection :: TBinding (InferenceContext -> Injection -> Flow s InferenceResult)+inferTypeOfInjection = define "inferTypeOfInjection" $+ doc "Infer the type of a union injection" $+ "cx" ~> "injection" ~>+ "tname" <~ Core.injectionTypeName (var "injection") $+ "field" <~ Core.injectionField (var "injection") $+ "fname" <~ Core.fieldName (var "field") $+ "term" <~ Core.fieldTerm (var "field") $+ "result" <<~ inferTypeOfTerm @@ var "cx" @@ var "term" @@ (string "injected term") $+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "iterm" <~ Typing.inferenceResultTerm (var "result") $+ "ityp" <~ Typing.inferenceResultType (var "result") $+ "isubst" <~ Typing.inferenceResultSubst (var "result") $+ "sfields" <<~ ExtractCore.unionType @@ var "tname" @@ var "stype" $+ "ftyp" <<~ Schemas.findFieldType @@ var "fname" @@ var "sfields" $+ mapConstraints @@ var "cx" @@+ ("subst" ~> yield+ @@ (buildTypeApplicationTerm @@ var "svars"+ @@ (Core.termUnion $ Core.injection (var "tname") $ Core.field (var "fname") (var "iterm")))+ @@ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ @@ (Substitution.composeTypeSubst @@ var "isubst" @@ var "subst")) @@+ list [Typing.typeConstraint (var "ftyp") (var "ityp") (string "schema type of injected field")]++inferTypeOfLambda :: TBinding (InferenceContext -> Lambda -> Flow s InferenceResult)+inferTypeOfLambda = define "inferTypeOfLambda" $+ doc "Infer the type of a lambda function" $+ "cx" ~> "lambda" ~>+ "var" <~ Core.lambdaParameter (var "lambda") $+ "body" <~ Core.lambdaBody (var "lambda") $+ "vdom" <<~ Schemas.freshName $+ "dom" <~ Core.typeVariable (var "vdom") $+ "cx2" <~ (extendContext @@ list [pair (var "var") (Core.typeScheme (list ([] :: [TTerm Name])) (var "dom") Phantoms.nothing)] @@ var "cx") $+ "result" <<~ inferTypeOfTerm @@ var "cx2" @@ var "body" @@ (string "lambda body") $+ "iterm" <~ Typing.inferenceResultTerm (var "result") $+ "icod" <~ Typing.inferenceResultType (var "result") $+ "isubst" <~ Typing.inferenceResultSubst (var "result") $+ "rdom" <~ Substitution.substInType @@ var "isubst" @@ var "dom" $+ "rterm" <~ Core.termFunction (Core.functionLambda $ Core.lambda (var "var") (just $ var "rdom") (var "iterm")) $+ "rtype" <~ Core.typeFunction (Core.functionType (var "rdom") (var "icod")) $+ "vars" <~ (Sets.unions $ list [+ Rewriting.freeVariablesInType @@ var "rdom",+ Rewriting.freeVariablesInType @@ var "icod",+ freeVariablesInContext @@ (Substitution.substInContext @@ var "isubst" @@ var "cx2")]) $+ "cx3" <~ Substitution.substInContext @@ var "isubst" @@ var "cx" $+ -- Apply substitution to constraints so variable names track through unification+ "iconstraints" <~ Substitution.substInClassConstraints @@ var "isubst" @@ (Typing.inferenceResultClassConstraints $ var "result") $+ produce $ Typing.inferenceResult (var "rterm") (var "rtype") (var "isubst") (var "iconstraints")++-- | Normalize a let term before inferring its type.+inferTypeOfLet :: TBinding (InferenceContext -> Let -> Flow s InferenceResult)+inferTypeOfLet = define "inferTypeOfLet" $+ doc "Normalize a let term before inferring its type" $+ "cx" ~> "let0" ~>+ "bindings0" <~ Core.letBindings (var "let0") $+ "body0" <~ Core.letBody (var "let0") $+ "names" <~ Lists.map (unaryFunction Core.bindingName) (var "bindings0") $+ "nameSet" <~ Sets.fromList (var "names") $+ "toPair" <~ ("binding" ~>+ "name" <~ Core.bindingName (var "binding") $+ "term" <~ Core.bindingTerm (var "binding") $+ pair (var "name") $ Lists.filter ("n" ~> Sets.member (var "n") (var "nameSet")) $+ Sets.toList $ Rewriting.freeVariablesInTerm @@ var "term") $+ "adjList" <~ Lists.map (var "toPair") (var "bindings0") $+ "groups" <~ Sorting.topologicalSortComponents @@ var "adjList" $+ "bindingMap" <~ Maps.fromList (Lists.zip (var "names") (var "bindings0")) $+ "createLet" <~ ("e" ~> "group" ~> Core.termLet $ Core.let_+ (Maybes.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "bindingMap")) (var "group"))+ (var "e")) $+ -- Note: this rewritten let term will yield success in all cases of dependencies among letrec bindings *except*+ -- in cases of polymorphic recursion. In those cases, type hints will be needed (#162).+ "rewrittenLet" <~ Lists.foldl (var "createLet") (var "body0") (Lists.reverse $ var "groups") $+ "restoreLet" <~ ("iterm" ~>+ "helper" <~ ("level" ~> "bins" ~> "term" ~>+ "nonzero" <~ ("term" ~> cases _Term (var "term") Nothing [+ _Term_let>>: "l" ~>+ "bs" <~ Core.letBindings (var "l") $+ "letBody" <~ Core.letBody (var "l") $+ var "helper" @@+ (Math.sub (var "level") (int32 1)) @@+ (Lists.concat $ list [var "bs", var "bins"]) @@+ (var "letBody")]) $+ Logic.ifElse (Equality.equal (var "level") (int32 0))+ (pair (var "bins") (var "term"))+ (var "nonzero" @@ var "term")) $+ "result" <~ var "helper" @@ (Lists.length $ var "groups") @@ list ([] :: [TTerm Binding]) @@ var "iterm" $+ "bindingList" <~ Pairs.first (var "result") $+ "e" <~ Pairs.second (var "result") $+ "bindingMap2" <~ Maps.fromList (Lists.map ("b" ~> pair (Core.bindingName $ var "b") (var "b")) (var "bindingList")) $+ Core.termLet $ Core.let_+ (Maybes.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "bindingMap2")) (var "names"))+ (var "e")) $+ "rewriteResult" <~ ("result" ~>+ "iterm" <~ Typing.inferenceResultTerm (var "result") $+ "itype" <~ Typing.inferenceResultType (var "result") $+ "isubst" <~ Typing.inferenceResultSubst (var "result") $+ "iconstraints" <~ Typing.inferenceResultClassConstraints (var "result") $+ Typing.inferenceResult (var "restoreLet" @@ var "iterm") (var "itype") (var "isubst") (var "iconstraints")) $+ "res" <~ (cases _Term (var "rewrittenLet")+ (Just $ inferTypeOfTerm @@ var "cx" @@ var "rewrittenLet" @@ (string "empty let term")) [+ _Term_let>>: "l" ~> inferTypeOfLetNormalized @@ var "cx" @@ var "l"]) $+ Flows.map (var "rewriteResult") (var "res")++inferTypeOfLetNormalized :: TBinding (InferenceContext -> Let -> Flow s InferenceResult)+inferTypeOfLetNormalized = define "inferTypeOfLetNormalized" $+ doc "Infer the type of a let (letrec) term which is already in a normal form" $+ "cx0" ~> "letTerm" ~>++ -- Extract the bindings and body from the let term+ "bins0" <~ Core.letBindings (var "letTerm") $+ "body0" <~ Core.letBody (var "letTerm") $+ "bnames" <~ Lists.map (unaryFunction Core.bindingName) (var "bins0") $++ -- Phase 1: Create fresh temporary type variables for each binding+ -- These act as placeholders during the initial inference pass+ "bvars" <<~ Schemas.freshNames @@ (Lists.length $ var "bins0") $+ "tbins0" <~ Lists.map (unaryFunction Core.typeVariable) (var "bvars") $+ + -- Extend the context with temporary monomorphic type schemes+ -- This allows recursive references during inference+ "cx1" <~ (extendContext+ @@ (Lists.zip (var "bnames") $ Lists.map ("t" ~> Core.typeScheme (list ([] :: [TTerm Name])) (var "t") Phantoms.nothing) (var "tbins0"))+ @@ (var "cx0")) $+ + -- Phase 2: Infer the actual types of all binding terms+ -- This returns: (inferred terms, (inferred types, (substitution s1, constraints)))+ "inferredResult" <<~ inferTypesOfTemporaryBindings @@ var "cx1" @@ var "bins0" $+ "bterms1" <~ Pairs.first (var "inferredResult") $ -- Terms with type applications embedded+ "tbins1" <~ Pairs.first (Pairs.second $ var "inferredResult") $ -- Actual inferred types+ "substAndConstraints" <~ Pairs.second (Pairs.second $ var "inferredResult") $+ "s1" <~ Pairs.first (var "substAndConstraints") $ -- Substitution from inference+ "inferredConstraints" <~ Pairs.second (var "substAndConstraints") $ -- Constraints from bindings++ -- Phase 3: Unify temporary types with actual inferred types+ -- This ensures the temporary placeholders match what we actually inferred+ -- Returns substitution s2 that maps temporary variables to their actual types+ "s2" <<~ Unification.unifyTypeLists @@+ (Typing.inferenceContextSchemaTypes $ var "cx0") @@+ (Lists.map (Substitution.substInType @@ var "s1") (var "tbins0")) @@+ (var "tbins1") @@+ (string "temporary type bindings") $+ exec (Checking.checkTypeSubst @@ var "cx0" @@ var "s2") $++ -- Apply the composed substitution to the original context+ -- Also merge the inferred constraints into the context's classConstraints+ -- This context will be used for generalization+ "g2base" <~ (Substitution.substInContext @@+ (Substitution.composeTypeSubst @@ var "s1" @@ var "s2") @@+ (var "cx0")) $+ -- Apply s2 to the inferred constraints to rename variables according to unification+ "constraintsWithS2" <~ Substitution.substInClassConstraints @@ var "s2" @@ var "inferredConstraints" $++ -- Extract constraints from the ORIGINAL bindings' TypeSchemes+ -- These are constraints that were specified by the user/generator (e.g., Ord constraints from decoderTypeScheme)+ -- We need to apply the composed substitution to rename variables to match the inferred types+ "composedSubst" <~ Substitution.composeTypeSubst @@ var "s1" @@ var "s2" $+ "originalBindingConstraints" <~ Lists.foldl+ ("acc" ~> "b" ~>+ Maybes.maybe+ (var "acc")+ ("ts" ~> Maybes.maybe+ (var "acc")+ ("c" ~> mergeClassConstraints @@ var "acc" @@ var "c")+ (Core.typeSchemeConstraints $ var "ts"))+ (Core.bindingType $ var "b"))+ Maps.empty+ (var "bins0") $+ -- Apply the composed substitution to the original constraints to rename variables+ "originalConstraintsSubst" <~ Substitution.substInClassConstraints @@ var "composedSubst" @@ var "originalBindingConstraints" $++ -- Merge all constraints: inferred + original binding constraints+ "allInferredConstraints" <~ mergeClassConstraints @@ var "constraintsWithS2" @@ var "originalConstraintsSubst" $+ -- Merge the combined constraints into the context so generalize can see them+ "mergedConstraints" <~ mergeClassConstraints @@ (Typing.inferenceContextClassConstraints $ var "g2base") @@ var "allInferredConstraints" $+ "g2" <~ Typing.inferenceContextWithClassConstraints (var "g2base") (var "mergedConstraints") $++ -- Apply s2 to the terms as well as the types+ -- This ensures type applications in the terms use the same variables as the types+ "bterms1Subst" <~ Lists.map (Substitution.substTypesInTerm @@ var "s2") (var "bterms1") $++ -- Phase 4: Generalize the inferred types into type schemes+ "tsbins1" <~ (Lists.zip (var "bnames") $+ Lists.map ("t" ~> generalize @@ var "g2" @@+ (Substitution.substInType @@ var "s2" @@ var "t")) (var "tbins1")) $++ -- Phase 5: Infer the type of the let body+ -- The body can now reference the bindings with their generalized type schemes+ "bodyResult" <<~ inferTypeOfTerm @@+ (extendContext @@ var "tsbins1" @@ var "g2") @@+ (var "body0") @@+ (string "let body") $+ "body1" <~ Typing.inferenceResultTerm (var "bodyResult") $+ "tbody" <~ Typing.inferenceResultType (var "bodyResult") $+ "sbody" <~ Typing.inferenceResultSubst (var "bodyResult") $+ + -- Phase 6: Create term substitution for polymorphic instantiation+ -- For each binding, create a mapping from its name to a term that applies+ -- all the type variables from its type scheme+ -- e.g., foo becomes foo!<t0><t1> if its scheme is ∀t0,t1. ...+ "st1" <~ (Typing.termSubst (Maps.fromList $+ Lists.map+ ("pair" ~>+ "name" <~ Pairs.first (var "pair") $+ "ts" <~ Pairs.second (var "pair") $+ pair+ (var "name") $+ (buildTypeApplicationTerm+ @@ (Core.typeSchemeVariables $ var "ts")+ @@ (Core.termVariable $ var "name")))+ (var "tsbins1"))) $++ -- Phase 7: Create the final bindings with type lambdas+ "createBinding" <~ ("bindingPair" ~>+ "nameTsPair" <~ Pairs.first (var "bindingPair") $+ "term" <~ Pairs.second (var "bindingPair") $+ "name" <~ Pairs.first (var "nameTsPair") $+ "ts" <~ Pairs.second (var "nameTsPair") $++ -- Apply body substitution to the type scheme FIRST to get final variable names and constraints.+ -- This must happen before creating the type lambdas so the parameter names match the final type scheme.+ "finalTs" <~ Substitution.substInTypeScheme @@ var "sbody" @@ var "ts" $++ -- First, substitute polymorphic references in the term+ -- Then wrap in type lambdas for each variable in the FINAL type scheme.+ -- IMPORTANT: We use finalTs.variables (not ts.variables) so the TypeLambda parameters match the type scheme.+ -- Note: this is the only place -- at the top level of bound terms -- where inference creates type lambda terms.+ "typeLambdaTerm" <~ Lists.foldl+ ("b" ~> "v" ~> Core.termTypeLambda $ Core.typeLambda (var "v") (var "b"))+ (Substitution.substituteInTerm @@ var "st1" @@ var "term")+ (Lists.reverse $ Core.typeSchemeVariables $ var "finalTs") $++ -- Apply remaining substitutions (senv and s2) to the wrapped term+ Core.binding (var "name")+ (Substitution.substTypesInTerm @@+ (Substitution.composeTypeSubst @@ var "sbody" @@ var "s2") @@+ (var "typeLambdaTerm"))+ (just $ var "finalTs")) $+ + "bins1" <~ (Lists.map (var "createBinding") $+ Lists.zip (var "tsbins1") (var "bterms1Subst")) $++ -- Collect constraints from body result, applying the final substitution+ "bodyConstraints" <~ Substitution.substInClassConstraints @@ var "sbody" @@ (Typing.inferenceResultClassConstraints $ var "bodyResult") $++ -- Apply the body substitution to the binding constraints as well+ -- This ensures the constraint variable names are consistent with the final types+ "bindingConstraintsSubst" <~ Substitution.substInClassConstraints @@ var "sbody" @@ var "constraintsWithS2" $++ -- Merge binding constraints with body constraints+ -- This ensures that constraints from Maps.lookup (etc.) inside let bindings propagate up+ "allConstraints" <~ mergeClassConstraints @@ var "bindingConstraintsSubst" @@ var "bodyConstraints" $++ -- Return the final let term with properly typed bindings+ "ret" <~ (Typing.inferenceResult+ (Core.termLet $ Core.let_ (var "bins1") (var "body1"))+ (var "tbody")+ (Substitution.composeTypeSubstList @@ list [var "s1", var "s2", var "sbody"])+ (var "allConstraints")) $+ produce $ var "ret"++inferTypeOfList :: TBinding (InferenceContext -> [Term] -> Flow s InferenceResult)+inferTypeOfList = define "inferTypeOfList" $+ doc "Infer the type of a list" $+ "cx" ~> inferTypeOfCollection+ @@ var "cx"+ @@ (unaryFunction Core.typeList)+ @@ (unaryFunction Core.termList)+ @@ (string "list element")++inferTypeOfLiteral :: TBinding (InferenceContext -> Literal -> Flow s InferenceResult)+inferTypeOfLiteral = define "inferTypeOfLiteral" $+ doc "Infer the type of a literal" $+ "_" ~> "lit" ~>+ produce $ Typing.inferenceResult+ (Core.termLiteral $ var "lit")+ (Core.typeLiteral $ Reflect.literalType @@ var "lit")+ (Substitution.idTypeSubst)+ Maps.empty++inferTypeOfMap :: TBinding (InferenceContext -> M.Map Term Term -> Flow s InferenceResult)+inferTypeOfMap = define "inferTypeOfMap" $+ doc "Infer the type of a map" $+ "cx" ~> "m" ~>+ "kvar" <<~ Schemas.freshName $+ "vvar" <<~ Schemas.freshName $+ Logic.ifElse (Maps.null $ var "m")+ -- Empty map: add type applications for both key and value type variables+ (Flows.pure $ yield+ @@ (buildTypeApplicationTerm+ @@ list [var "kvar", var "vvar"]+ @@ (Core.termMap Maps.empty))+ @@ (Core.typeMap $ Core.mapType (Core.typeVariable $ var "kvar") (Core.typeVariable $ var "vvar"))+ @@ Substitution.idTypeSubst)+ -- Non-empty map: infer and unify key and value types+ ("kresults" <<~ inferMany @@ var "cx" @@+ (Lists.map ("k" ~> pair (var "k") (string "map key")) $ Maps.keys $ var "m") $+ "kterms" <~ Pairs.first (var "kresults") $+ "ktypes" <~ Pairs.first (Pairs.second $ var "kresults") $+ "ksubst" <~ Pairs.second (Pairs.second $ var "kresults") $+ "vresults" <<~ inferMany+ @@ var "cx"+ @@ (Lists.map ("v" ~> pair (var "v") (string "map value")) $ Maps.elems $ var "m") $+ "vterms" <~ Pairs.first (var "vresults") $+ "vtypes" <~ Pairs.first (Pairs.second $ var "vresults") $+ "vsubst" <~ Pairs.second (Pairs.second $ var "vresults") $+ "kcons" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "kvar") (var "t") (string "map key")) (var "ktypes") $+ "vcons" <~ Lists.map ("t" ~> Typing.typeConstraint (Core.typeVariable $ var "vvar") (var "t") (string "map value")) (var "vtypes") $+ mapConstraints @@ var "cx" @@+ ("subst" ~> yield+ @@ (Core.termMap $ Maps.fromList $ Lists.zip (var "kterms") (var "vterms"))+ @@ (Core.typeMap $ Core.mapType (Core.typeVariable $ var "kvar") (Core.typeVariable $ var "vvar"))+ @@ (Substitution.composeTypeSubstList @@ list [var "ksubst", var "vsubst", var "subst"])) @@+ (Lists.concat $ list [var "kcons", var "vcons"]))++inferTypeOfOptional :: TBinding (InferenceContext -> Maybe Term -> Flow s InferenceResult)+inferTypeOfOptional = define "inferTypeOfOptional" $+ doc "Infer the type of an optional" $+ "cx" ~> "m" ~>+ "trmCons" <~ ("terms" ~> Logic.ifElse (Lists.null $ var "terms")+ (Core.termMaybe nothing)+ (Core.termMaybe $ just $ Lists.head $ var "terms")) $+ inferTypeOfCollection+ @@ var "cx"+ @@ (unaryFunction Core.typeMaybe)+ @@ var "trmCons"+ @@ (string "optional element")+ @@ (Maybes.maybe (list ([] :: [TTerm Term])) (unaryFunction Lists.singleton) $ var "m")++inferTypeOfPair :: TBinding (InferenceContext -> (Term, Term) -> Flow s InferenceResult)+inferTypeOfPair = define "inferTypeOfPair" $+ doc "Infer the type of a pair" $+ "cx" ~> "p" ~>+ Flows.map+ ( "results" ~>+ "iterms" <~ Pairs.first (var "results") $+ "itypes" <~ Pairs.first (Pairs.second $ var "results") $+ "isubst" <~ Pairs.second (Pairs.second $ var "results") $+ "ifst" <~ Lists.head (var "iterms") $+ "isnd" <~ Lists.head (Lists.tail $ var "iterms") $+ "tyFst" <~ Lists.head (var "itypes") $+ "tySnd" <~ Lists.head (Lists.tail $ var "itypes") $+ "pairTerm" <~ (Core.termPair $ pair (var "ifst") (var "isnd")) $+ "termWithTypes" <~ (Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.termTypeApplication $ Core.typeApplicationTerm (var "pairTerm") (var "tyFst"))+ (var "tySnd")) $+ yield+ @@ var "termWithTypes"+ @@ (Core.typePair $ Core.pairType (var "tyFst") (var "tySnd"))+ @@ var "isubst")+ (inferMany @@ var "cx" @@ list [+ pair (Pairs.first $ var "p") (string "pair first element"),+ pair (Pairs.second $ var "p") (string "pair second element")])+++++++--inferTypeOfProduct :: TBinding (InferenceContext -> [Term] -> Flow s InferenceResult)+--inferTypeOfProduct = define "inferTypeOfProduct" $+-- doc "Infer the type of a product (tuple)" $+-- "cx" ~> "els" ~>+-- Flows.map+-- ( "results" ~>+-- "iterms" <~ Pairs.first (var "results") $+-- "itypes" <~ Pairs.first (Pairs.second $ var "results") $+-- "isubst" <~ Pairs.second (Pairs.second $ var "results") $+-- yield @@ (Core.termProduct $ var "iterms") @@ (Core.typeProduct $ var "itypes") @@ var "isubst")+-- (inferMany @@ var "cx" @@ (Lists.map ("e" ~> pair (var "e") (string "tuple element")) $ var "els"))+++++++++++inferTypeOfPrimitive :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)+inferTypeOfPrimitive = define "inferTypeOfPrimitive" $+ doc "Infer the type of a primitive function. Class constraints from the primitive's type scheme are propagated to the inference result." $+ "cx" ~> "name" ~>+ Maybes.maybe+ (Flows.fail $ Strings.cat2 (string "No such primitive: ") (Core.unName $ var "name"))+ ("scheme" ~>+ "ts" <<~ Schemas.instantiateTypeScheme @@ var "scheme" $+ -- Extract constraints from the instantiated type scheme and pass them to the result+ "constraints" <~ Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints $ var "ts") $+ yieldCheckedWithConstraints+ @@ (buildTypeApplicationTerm+ @@ Core.typeSchemeVariables (var "ts")+ @@ (Core.termFunction $ Core.functionPrimitive $ var "name"))+ @@ Core.typeSchemeType (var "ts")+ @@ Substitution.idTypeSubst+ @@ var "constraints")+ (Maps.lookup (var "name") (Typing.inferenceContextPrimitiveTypes $ var "cx"))++inferTypeOfProjection :: TBinding (InferenceContext -> Projection -> Flow s InferenceResult)+inferTypeOfProjection = define "inferTypeOfProjection" $+ doc "Infer the type of a record projection" $+ "cx" ~> "proj" ~>+ "tname" <~ Core.projectionTypeName (var "proj") $+ "fname" <~ Core.projectionField (var "proj") $+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "sfields" <<~ ExtractCore.recordType @@ var "tname" @@ var "stype" $+ "ftyp" <<~ Schemas.findFieldType @@ var "fname" @@ var "sfields" $+ Flows.pure $ yield+ @@ (buildTypeApplicationTerm @@ var "svars"+ @@ (Core.termFunction $ Core.functionElimination $ Core.eliminationRecord $ Core.projection (var "tname") (var "fname")))+ @@ (Core.typeFunction $ Core.functionType+ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ (var "ftyp"))+ @@ Substitution.idTypeSubst++inferTypeOfRecord :: TBinding (InferenceContext -> Record -> Flow s InferenceResult)+inferTypeOfRecord = define "inferTypeOfRecord" $+ doc "Infer the type of a record" $+ "cx" ~> "record" ~>+ "tname" <~ Core.recordTypeName (var "record") $+ "fields" <~ Core.recordFields (var "record") $+ "fnames" <~ Lists.map (unaryFunction Core.fieldName) (var "fields") $+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "results" <<~ inferMany @@ var "cx" @@ Lists.map+ ("f" ~> pair+ (Core.fieldTerm $ var "f")+ (Strings.cat2 (string "field ") (Core.unName $ Core.fieldName $ var "f")))+ (var "fields") $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "iterms" <~ Pairs.first (var "results") $+ "itypes" <~ Pairs.first (Pairs.second $ var "results") $+ "isubst" <~ Pairs.second (Pairs.second $ var "results") $+ "ityp" <~ Core.typeRecord (Core.rowType (var "tname") $+ Lists.zipWith ("n" ~> "t" ~> Core.fieldType (var "n") (var "t")) (var "fnames") (var "itypes")) $+ mapConstraints @@ var "cx" @@+ ("subst" ~> yield+ @@ (buildTypeApplicationTerm @@ var "svars" @@+ (Core.termRecord $ Core.record (var "tname") $ Lists.zipWith+ ("n" ~> "t" ~> Core.field (var "n") (var "t"))+ (var "fnames")+ (var "iterms")))+ @@ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ @@ (Substitution.composeTypeSubst @@ var "isubst" @@ var "subst")) @@+ list [Typing.typeConstraint (var "stype") (var "ityp") (string "schema type of record")]++inferTypeOfSet :: TBinding (InferenceContext -> S.Set Term -> Flow s InferenceResult)+inferTypeOfSet = define "inferTypeOfSet" $+ doc "Infer the type of a set" $+ "cx" ~>+ "s" ~>+ inferTypeOfCollection+ @@ var "cx"+ @@ (unaryFunction Core.typeSet)+ @@ ("terms" ~> Core.termSet $ Sets.fromList $ var "terms")+ @@ (string "set element")+ @@ (Sets.toList $ var "s")++inferTypeOfTerm :: TBinding (InferenceContext -> Term -> String -> Flow s InferenceResult)+inferTypeOfTerm = define "inferTypeOfTerm" $+ doc "Infer the type of a given term" $+ "cx" ~> "term" ~> "desc" ~>+ "matchTerm" <~ (cases _Term (var "term") Nothing [+ _Term_annotated>>: "a" ~> inferTypeOfAnnotatedTerm @@ var "cx" @@ var "a",+ _Term_application>>: "a" ~> inferTypeOfApplication @@ var "cx" @@ var "a",+ _Term_either>>: "e" ~> inferTypeOfEither @@ var "cx" @@ var "e",+ _Term_function>>: "f" ~> inferTypeOfFunction @@ var "cx" @@ var "f",+ _Term_let>>: "l" ~> inferTypeOfLet @@ var "cx" @@ var "l",+ _Term_list>>: "els" ~> inferTypeOfList @@ var "cx" @@ var "els",+ _Term_literal>>: "l" ~> inferTypeOfLiteral @@ var "cx" @@ var "l",+ _Term_map>>: "m" ~> inferTypeOfMap @@ var "cx" @@ var "m",+ _Term_maybe>>: "m" ~> inferTypeOfOptional @@ var "cx" @@ var "m",+ _Term_pair>>: "p" ~> inferTypeOfPair @@ var "cx" @@ var "p",+ _Term_record>>: "r" ~> inferTypeOfRecord @@ var "cx" @@ var "r",+ _Term_set>>: "s" ~> inferTypeOfSet @@ var "cx" @@ var "s",+ _Term_typeApplication>>: "tt" ~> inferTypeOfTypeApplication @@ var "cx" @@ var "tt",+ _Term_typeLambda>>: "ta" ~> inferTypeOfTypeLambda @@ var "cx" @@ var "ta",+ _Term_union>>: "i" ~> inferTypeOfInjection @@ var "cx" @@ var "i",+ _Term_unit>>: constant $ produce $ inferTypeOfUnit,+ _Term_variable>>: "name" ~> inferTypeOfVariable @@ var "cx" @@ var "name",+ _Term_wrap>>: "w" ~> inferTypeOfWrappedTerm @@ var "cx" @@ var "w"]) $+ trace (var "desc") (var "matchTerm")++inferTypeOfTypeLambda :: TBinding (InferenceContext -> TypeLambda -> Flow s InferenceResult)+inferTypeOfTypeLambda = define "inferTypeOfTypeLambda" $+ doc "Infer the type of a type abstraction; just pass through to the lambda body." $+ "cx" ~> "ta" ~>+ inferTypeOfTerm @@ var "cx" @@ (Core.typeLambdaBody $ var "ta") @@ (string "type abstraction")++inferTypeOfTypeApplication :: TBinding (InferenceContext -> TypeApplicationTerm -> Flow s InferenceResult)+inferTypeOfTypeApplication = define "inferTypeOfTypeApplication" $+ doc "Infer the type of a type application; just pass through to the inner term." $+ "cx" ~> "tt" ~>+ inferTypeOfTerm @@ var "cx" @@ (Core.typeApplicationTermBody $ var "tt") @@ (string "type application term")++inferTypeOfUnit :: TBinding InferenceResult+inferTypeOfUnit = define "inferTypeOfUnit" $+ doc "The trivial inference rule for the unit term" $+ Typing.inferenceResult+ (Core.termUnit)+ (Core.typeUnit)+ (Substitution.idTypeSubst)+ Maps.empty++inferTypeOfUnwrap :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)+inferTypeOfUnwrap = define "inferTypeOfUnwrap" $+ doc "Infer the type of an unwrap operation" $+ "cx" ~> "tname" ~>+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "wtyp" <<~ ExtractCore.wrappedType @@ var "tname" @@ var "stype" $+ Flows.pure $ yield+ @@ (buildTypeApplicationTerm @@ var "svars"+ @@ (Core.termFunction $ Core.functionElimination $ Core.eliminationWrap $ var "tname"))+ @@ (Core.typeFunction $ Core.functionType+ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ (var "wtyp"))+ @@ Substitution.idTypeSubst++inferTypeOfVariable :: TBinding (InferenceContext -> Name -> Flow s InferenceResult)+inferTypeOfVariable = define "inferTypeOfVariable" $+ doc "Infer the type of a variable" $+ "cx" ~> "name" ~>+ Maybes.maybe+ (Flows.fail $ Strings.cat2 (string "Variable not bound to type: ") (Core.unName $ var "name"))+ ("scheme" ~>+ "ts" <<~ Schemas.instantiateTypeScheme @@ var "scheme" $+ -- Collect constraints from the variable's type scheme (may have constraints if it's a let-bound polymorphic variable)+ "constraints" <~ Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints $ var "ts") $+ produce $ Typing.inferenceResult+ (buildTypeApplicationTerm+ @@ Core.typeSchemeVariables (var "ts")+ @@ Core.termVariable (var "name"))+ (Core.typeSchemeType $ var "ts")+ (Substitution.idTypeSubst)+ (var "constraints"))+ (Maps.lookup (var "name") (Typing.inferenceContextDataTypes $ var "cx"))++inferTypeOfWrappedTerm :: TBinding (InferenceContext -> WrappedTerm -> Flow s InferenceResult)+inferTypeOfWrappedTerm = define "inferTypeOfWrappedTerm" $+ doc "Infer the type of a wrapped term" $+ "cx" ~> "wt" ~>+ "tname" <~ Core.wrappedTermTypeName (var "wt") $+ "term" <~ Core.wrappedTermBody (var "wt") $+ "schemaType" <<~ Schemas.requireSchemaType @@ var "cx" @@ var "tname" $+ "result" <<~ inferTypeOfTerm @@ var "cx" @@ var "term" @@ (string "wrapped term") $+ "svars" <~ Core.typeSchemeVariables (var "schemaType") $+ "stype" <~ Core.typeSchemeType (var "schemaType") $+ "iterm" <~ Typing.inferenceResultTerm (var "result") $+ "itype" <~ Typing.inferenceResultType (var "result") $+ "isubst" <~ Typing.inferenceResultSubst (var "result") $+ "ityp" <~ Core.typeWrap (Core.wrappedType (var "tname") (var "itype")) $+ mapConstraints @@ var "cx"+ @@ ("subst" ~> yield+ @@ (buildTypeApplicationTerm @@ var "svars" @@ (Core.termWrap $ Core.wrappedTerm (var "tname") (var "iterm")))+ @@ (Schemas.nominalApplication @@ var "tname" @@ Lists.map (unaryFunction Core.typeVariable) (var "svars"))+ @@ (Substitution.composeTypeSubst @@ var "isubst" @@ var "subst"))+ @@ list [Typing.typeConstraint (var "stype") (var "ityp") (string "schema type of wrapper")]++inferTypesOfTemporaryBindings :: TBinding (InferenceContext -> [Binding] -> Flow s ([Term], ([Type], (TypeSubst, M.Map Name TypeVariableMetadata))))+-- | Returns: (terms, (types, (subst, constraints)))+inferTypesOfTemporaryBindings = define "inferTypesOfTemporaryBindings" $+ doc "Infer types for temporary let bindings. Returns a 4-tuple of (terms, types, substitution, accumulated constraints)" $+ "cx" ~> "bins" ~>+ "dflt" <~ (+ "binding" <~ Lists.head (var "bins") $+ "k" <~ Core.bindingName (var "binding") $+ "v" <~ Core.bindingTerm (var "binding") $+ "tl" <~ Lists.tail (var "bins") $+ "result1" <<~ inferTypeOfTerm @@ var "cx" @@ var "v" @@+ (Strings.cat $ list [+ (string "temporary let binding '"),+ Core.unName $ var "k",+ (string "'")]) $+ "j" <~ Typing.inferenceResultTerm (var "result1") $+ "u_prime" <~ Typing.inferenceResultType (var "result1") $+ "u" <~ Typing.inferenceResultSubst (var "result1") $+ "c1Inferred" <~ Typing.inferenceResultClassConstraints (var "result1") $++ -- Extract constraints from the original binding's TypeScheme (if present)+ -- These need to be instantiated with fresh variable names and unified with the inferred type+ "originalBindingConstraints" <<~ Maybes.maybe+ (Flows.pure Maps.empty)+ ("ts" ~>+ -- Instantiate the type scheme to get fresh variable names+ -- The constraints in the instantiated scheme will have fresh names that correspond+ -- to the type variables in the instantiated type+ Flows.bind (Schemas.instantiateTypeScheme @@ var "ts") ("instantiatedTs" ~>+ -- Get the constraints from the instantiated type scheme+ "freshConstraints" <~ Maybes.fromMaybe Maps.empty (Core.typeSchemeConstraints $ var "instantiatedTs") $+ -- We also need to unify the instantiated type with the inferred type+ -- so that the fresh constraint variables get mapped to the actual inferred variables+ Flows.bind (Unification.unifyTypes+ @@ (Typing.inferenceContextSchemaTypes $ var "cx")+ @@ (Core.typeSchemeType $ var "instantiatedTs")+ @@ var "u_prime"+ @@ string "original binding type") ("unifySubst" ~>+ -- Apply the unification substitution to the fresh constraints+ -- This maps the fresh constraint variables to the actual inferred type variables+ Flows.pure (Substitution.substInClassConstraints @@ var "unifySubst" @@ var "freshConstraints"))))+ (Core.bindingType $ var "binding") $++ -- Merge the original binding constraints with the inferred constraints+ "c1" <~ mergeClassConstraints @@ var "c1Inferred" @@ var "originalBindingConstraints" $++ "result2" <<~ inferTypesOfTemporaryBindings @@+ (Substitution.substInContext @@ var "u" @@ var "cx") @@+ var "tl" $+ "h" <~ Pairs.first (var "result2") $+ "r_prime" <~ Pairs.first (Pairs.second $ var "result2") $+ "restPair" <~ Pairs.second (Pairs.second $ var "result2") $+ "r" <~ Pairs.first (var "restPair") $+ "c2" <~ Pairs.second (var "restPair") $+ -- Apply the substitution r to c1's variable names before merging+ -- This ensures constraints are tracked under the correct (substituted) variable names+ "c1Subst" <~ Substitution.substInClassConstraints @@ var "r" @@ var "c1" $+ -- Merge the substituted constraints from this binding with constraints from the rest+ "mergedConstraints" <~ mergeClassConstraints @@ var "c1Subst" @@ var "c2" $+ Flows.pure $ pair+ (Lists.cons (Substitution.substTypesInTerm @@ var "r" @@ var "j") (var "h"))+ (pair+ (Lists.cons (Substitution.substInType @@ var "r" @@ var "u_prime") (var "r_prime"))+ (pair (Substitution.composeTypeSubst @@ var "u" @@ var "r") (var "mergedConstraints")))) $+ Logic.ifElse (Lists.null $ var "bins")+ (Flows.pure $ pair (list ([] :: [TTerm Term])) (pair (list ([] :: [TTerm Type])) (pair (Substitution.idTypeSubst) Maps.empty)))+ (var "dflt")++initialTypeContext :: TBinding (Graph -> Flow s TypeContext)+initialTypeContext = define "initialTypeContext" $+ doc "Create an initial type context from a graph" $+ "g" ~>+ "toPair" <~ ("el" ~>+ "name" <~ Core.bindingName (var "el") $+ optCases (Core.bindingType $ var "el")+ (Flows.fail $ (string "untyped element: ") ++ Core.unName (var "name"))+ ("ts" ~> produce $ pair (var "name") (Schemas.typeSchemeToFType @@ var "ts"))) $+ "ix" <<~ Schemas.graphToInferenceContext @@ var "g" $+ "types" <<~ Flows.map+ (unaryFunction Maps.fromList)+ (Flows.mapList (var "toPair") (Graph.graphElements $ var "g")) $+ produce $ Typing.typeContext (var "types") Maps.empty Sets.empty Sets.empty Sets.empty (var "ix")++isUnbound :: TBinding (InferenceContext -> Name -> Bool)+isUnbound = define "isUnbound" $+ doc "Check if a variable is unbound in context" $+ "cx" ~> "v" ~>+ Logic.and+ (Logic.not $ Sets.member (var "v") $ freeVariablesInContext @@ var "cx")+ (Logic.not $ Maps.member (var "v") $ Typing.inferenceContextSchemaTypes $ var "cx")++mapConstraints :: TBinding (InferenceContext -> (TypeSubst -> a) -> [TypeConstraint] -> Flow s a)+mapConstraints = define "mapConstraints" $+ doc "Map over type constraints after unification" $+ "cx" ~> "f" ~> "constraints" ~>+ "s" <<~ Unification.unifyTypeConstraints @@ (Typing.inferenceContextSchemaTypes $ var "cx") @@ var "constraints" $+ exec (Checking.checkTypeSubst @@ var "cx" @@ var "s") $+ produce (var "f" @@ var "s")++showInferenceResult :: TBinding (InferenceResult -> String)+showInferenceResult = define "showInferenceResult" $+ doc "Show an inference result for debugging" $+ "result" ~>+ "term" <~ Typing.inferenceResultTerm (var "result") $+ "typ" <~ Typing.inferenceResultType (var "result") $+ "subst" <~ Typing.inferenceResultSubst (var "result") $+ Strings.cat $ list [+ (string "{term="),+ ShowCore.term @@ var "term",+ (string ", type="),+ ShowCore.type_ @@ var "typ",+ (string ", subst="),+ ShowTyping.typeSubst @@ var "subst",+ (string "}")]++yield :: TBinding (Term -> Type -> TypeSubst -> InferenceResult)+yield = define "yield" $+ doc "Create an inference result with no class constraints" $+ "term" ~> "typ" ~> "subst" ~>+ Typing.inferenceResult+ (Substitution.substTypesInTerm @@ var "subst" @@ var "term")+ (Substitution.substInType @@ var "subst" @@ var "typ")+ (var "subst")+ Maps.empty++yieldWithConstraints :: TBinding (Term -> Type -> TypeSubst -> M.Map Name TypeVariableMetadata -> InferenceResult)+yieldWithConstraints = define "yieldWithConstraints" $+ doc "Create an inference result with class constraints" $+ "term" ~> "typ" ~> "subst" ~> "constraints" ~>+ Typing.inferenceResult+ (Substitution.substTypesInTerm @@ var "subst" @@ var "term")+ (Substitution.substInType @@ var "subst" @@ var "typ")+ (var "subst")+ (var "constraints")++-- TODO: pass context and variables, and actually check types+yieldChecked :: TBinding (Term -> Type -> TypeSubst -> Flow s InferenceResult)+yieldChecked = define "yieldChecked" $+ doc "Create a checked inference result" $+ "term" ~> "typ" ~> "subst" ~>+ "iterm" <~ Substitution.substTypesInTerm @@ var "subst" @@ var "term" $+ "itype" <~ Substitution.substInType @@ var "subst" @@ var "typ" $+ produce $ Typing.inferenceResult (var "iterm") (var "itype") (var "subst") Maps.empty++yieldCheckedWithConstraints :: TBinding (Term -> Type -> TypeSubst -> M.Map Name TypeVariableMetadata -> Flow s InferenceResult)+yieldCheckedWithConstraints = define "yieldCheckedWithConstraints" $+ doc "Create a checked inference result with class constraints" $+ "term" ~> "typ" ~> "subst" ~> "constraints" ~>+ "iterm" <~ Substitution.substTypesInTerm @@ var "subst" @@ var "term" $+ "itype" <~ Substitution.substInType @@ var "subst" @@ var "typ" $+ -- Apply the substitution to constraint keys as well, so they track the final variable names+ "iconstraints" <~ Substitution.substInClassConstraints @@ var "subst" @@ var "constraints" $+ produce $ Typing.inferenceResult (var "iterm") (var "itype") (var "subst") (var "iconstraints")++yieldDebug :: TBinding (InferenceContext -> String -> Term -> Type -> TypeSubst -> Flow s InferenceResult)+yieldDebug = define "yieldDebug" $+ doc "Create an inference result with debug output" $+ "cx" ~> "debugId" ~> "term" ~> "typ" ~> "subst" ~>+ "rterm" <~ Substitution.substTypesInTerm @@ var "subst" @@ var "term" $+ "rtyp" <~ Substitution.substInType @@ var "subst" @@ var "typ" $+ "result" <<~ Annotations.debugIf @@ var "debugId" @@+ (Strings.cat $ list [+ (string "\n\tterm: "), ShowCore.term @@ var "term",+ (string "\n\ttyp: "), ShowCore.type_ @@ var "typ",+ (string "\n\tsubst: "), ShowTyping.typeSubst @@ var "subst",+ (string "\n\trterm: "), ShowCore.term @@ var "rterm",+ (string "\n\trtyp: "), ShowCore.type_ @@ var "rtyp"]) $+ produce $ Typing.inferenceResult (var "rterm") (var "rtyp") (var "subst") Maps.empty
src/main/haskell/Hydra/Sources/Kernel/Terms/Languages.hs view
@@ -1,69 +1,85 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Languages where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (hydraLanguage) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Terms.Variants as Variants+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect +ns :: Namespace+ns = Namespace "hydra.languages"+ module_ :: Module-module_ = Module (Namespace "hydra.languages")- [el hydraLanguageDef]- [Variants.module_]- kernelTypesModules $+module_ = Module ns+ [toBinding hydraLanguage]+ [Reflect.ns]+ kernelTypesNamespaces $ Just "Language constraints for Hydra Core" -hydraLanguageDef :: TBinding Language-hydraLanguageDef = definitionInModule module_ "hydraLanguage" $+hydraLanguage :: TBinding Language+hydraLanguage = definitionInModule module_ "hydraLanguage" $ doc "Language constraints for Hydra Core, i.e. no constraints." $ lets [- "eliminationVariants">: Sets.fromList $ ref Variants.eliminationVariantsDef,- "literalVariants">: Sets.fromList $ ref Variants.literalVariantsDef,- "floatTypes">: Sets.fromList $ ref Variants.floatTypesDef,- "functionVariants">: Sets.fromList $ ref Variants.functionVariantsDef,- "integerTypes">: Sets.fromList $ ref Variants.integerTypesDef,- "termVariants">: Sets.fromList $ ref Variants.termVariantsDef,- "typeVariants">: Sets.fromList $ ref Variants.typeVariantsDef,+ "eliminationVariants">: Sets.fromList Reflect.eliminationVariants,+ "literalVariants">: Sets.fromList Reflect.literalVariants,+ "floatTypes">: Sets.fromList Reflect.floatTypes,+ "functionVariants">: Sets.fromList Reflect.functionVariants,+ "integerTypes">: Sets.fromList Reflect.integerTypes,+ "termVariants">: Sets.fromList Reflect.termVariants,+ "typeVariants">: Sets.fromList Reflect.typeVariants, "types">: "t" ~> cases _Type (var "t") (Just true) []] $ Coders.language- (Coders.languageName "hydra.core")+ (Coders.languageName (string "hydra.core")) (Coders.languageConstraints (var "eliminationVariants") (var "literalVariants")
src/main/haskell/Hydra/Sources/Kernel/Terms/Lexical.hs view
@@ -1,271 +1,365 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Lexical where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (chooseUniqueName, dereferenceElement, dereferenceSchemaType, dereferenceVariable, elementsToGraph, emptyGraph, extendGraphWithBindings, fieldsOf, getField, lookupElement, lookupPrimitive, matchEnum, matchRecord, matchUnion, matchUnitField, requireElement, requirePrimitive, requirePrimitiveType, requireTerm, resolveTerm, schemaContext, stripAndDereferenceTerm, stripAndDereferenceTermEither, withEmptyGraph, withSchemaContext) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Monads as Monads import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore +ns :: Namespace+ns = Namespace "hydra.lexical"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns+ module_ :: Module-module_ = Module (Namespace "hydra.lexical") elements- [Monads.module_, Rewriting.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [Monads.ns, Rewriting.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just ("A module for lexical operations over graphs.") where elements = [- el dereferenceElementDef,- el elementsToGraphDef,- el emptyGraphDef,- el extendGraphWithBindingsDef,- el fieldsOfDef,- el getFieldDef,- el lookupElementDef,- el lookupPrimitiveDef,- el matchEnumDef,- el matchRecordDef,- el matchUnionDef,- el matchUnitFieldDef,- el requireElementDef,- el requirePrimitiveDef,- el requireTermDef,- el resolveTermDef,- el schemaContextDef,- el stripAndDereferenceTermDef,- el typeOfPrimitiveDef,- el withEmptyGraphDef,- el withSchemaContextDef]+ toBinding chooseUniqueName,+ toBinding dereferenceElement,+ toBinding dereferenceSchemaType,+ toBinding dereferenceVariable,+ toBinding elementsToGraph,+ toBinding emptyGraph,+ toBinding extendGraphWithBindings,+ toBinding fieldsOf,+ toBinding getField,+ toBinding lookupElement,+ toBinding lookupPrimitive,+ toBinding matchEnum,+ toBinding matchRecord,+ toBinding matchUnion,+ toBinding matchUnitField,+ toBinding requireElement,+ toBinding requirePrimitive,+ toBinding requirePrimitiveType,+ toBinding requireTerm,+ toBinding resolveTerm,+ toBinding schemaContext,+ toBinding stripAndDereferenceTerm,+ toBinding stripAndDereferenceTermEither,+ toBinding withEmptyGraph,+ toBinding withSchemaContext] -define :: String -> TTerm a -> TBinding a-define = definitionInModule module_+chooseUniqueName :: TBinding (S.Set Name -> Name -> Name)+chooseUniqueName = define "chooseUniqueName" $+ "reserved" ~> "name" ~>+ "tryName" <~ ("index" ~>+ "candidate" <~ Logic.ifElse (Equality.equal (var "index") (int32 1))+ (var "name")+ (Core.name $ (Core.unName (var "name") ++ Literals.showInt32 (var "index"))) $+ Logic.ifElse (Sets.member (var "candidate") (var "reserved"))+ (var "tryName" @@ (Math.add (var "index") (int32 1)))+ (var "candidate")) $+ var "tryName" @@ (int32 1) -dereferenceElementDef :: TBinding (Name -> Flow Graph (Maybe Binding))-dereferenceElementDef = define "dereferenceElement" $- lambda "name" $ Flows.map- (lambda "g" $ ref lookupElementDef @@ var "g" @@ var "name")- (ref Monads.getStateDef)+dereferenceElement :: TBinding (Name -> Flow Graph (Maybe Binding))+dereferenceElement = define "dereferenceElement" $+ doc "Look up an element in the current graph context" $+ "name" ~> Flows.map+ ("g" ~> lookupElement @@ var "g" @@ var "name")+ (Monads.getState) -elementsToGraphDef :: TBinding (Graph -> Maybe Graph -> [Binding] -> Graph)-elementsToGraphDef = define "elementsToGraph" $- lambda "parent" $ lambda "schema" $ lambda "elements" $ lets [- "toPair" >: lambda "el" $ pair (Core.bindingName $ var "el") (var "el")]- $ Graph.graph- (Maps.fromList (Lists.map (var "toPair") $ var "elements"))- (Graph.graphEnvironment $ var "parent")- (Graph.graphTypes $ var "parent")- (Graph.graphBody $ var "parent")- (Graph.graphPrimitives $ var "parent")- (var "schema")+dereferenceSchemaType :: TBinding (Name -> M.Map Name TypeScheme -> Maybe TypeScheme)+dereferenceSchemaType = define "dereferenceSchemaType" $+ doc "Resolve a schema type through a chain of zero or more typedefs" $+ "name" ~> "types" ~>+ "forType" <~ ("t" ~> cases _Type (var "t")+ (Just (just (Core.typeScheme (list ([] :: [TTerm Name])) (var "t") Phantoms.nothing))) [+ _Type_annotated>>: "at" ~> var "forType" @@ (Core.annotatedTypeBody (var "at")),+ _Type_forall>>: "ft" ~> Maybes.map+ ("ts" ~> Core.typeScheme+ -- Note: no alpha-renaming of type variables+ (Lists.cons (Core.forallTypeParameter (var "ft")) (Core.typeSchemeVariables (var "ts")))+ (Core.typeSchemeType (var "ts"))+ (Core.typeSchemeConstraints (var "ts")))+ (var "forType" @@ (Core.forallTypeBody (var "ft"))),+ _Type_variable>>: "v" ~> dereferenceSchemaType @@ var "v" @@ var "types"]) $+ Maybes.bind+ (Maps.lookup (var "name") (var "types"))+ ("ts" ~> Maybes.map+ ("ts2" ~> Core.typeScheme+ -- Note: no alpha-renaming of type variables+ (Lists.concat2 (Core.typeSchemeVariables (var "ts")) (Core.typeSchemeVariables (var "ts2")))+ (Core.typeSchemeType (var "ts2"))+ (Core.typeSchemeConstraints (var "ts2")))+ (var "forType" @@ (Core.typeSchemeType (var "ts")))) -emptyGraphDef :: TBinding Graph-emptyGraphDef = define "emptyGraph" $+-- | Dereference a variable name in a graph, returning Either an error message or the binding+dereferenceVariable :: TBinding (Graph -> Name -> Either String Binding)+dereferenceVariable = define "dereferenceVariable" $+ doc "Look up an element by name in a graph, returning Either an error or the binding" $+ "g" ~> "name" ~>+ Maybes.maybe+ (left ((string "no such element: ") ++ (Core.unName (var "name"))))+ right_+ (lookupElement @@ var "g" @@ var "name")++elementsToGraph :: TBinding (Graph -> Maybe Graph -> [Binding] -> Graph)+elementsToGraph = define "elementsToGraph" $+ doc "Create a graph from a parent graph, optional schema, and list of element bindings" $+ "parent" ~> "schema" ~> "elements" ~>+ Graph.graph+ (var "elements")+ (Graph.graphEnvironment (var "parent"))+ (Graph.graphTypes (var "parent"))+ (Graph.graphBody (var "parent"))+ (Graph.graphPrimitives (var "parent"))+ (var "schema")++emptyGraph :: TBinding Graph+emptyGraph = define "emptyGraph" $ doc "An empty graph; no elements, no primitives, no schema, and an arbitrary body." $ Graph.graph- Maps.empty+ (list ([] :: [TTerm Binding])) Maps.empty Maps.empty- (Core.termLiteral $ Core.literalString "empty graph")+ (Core.termLiteral (Core.literalString (string "empty graph"))) Maps.empty nothing -extendGraphWithBindingsDef :: TBinding ([Binding] -> Graph -> Graph)-extendGraphWithBindingsDef = define "extendGraphWithBindings" $- lambdas ["bindings", "g"] $ lets [- "newEls">: Maps.fromList $ Lists.map (var "toEl") (var "bindings"),- "toEl">: lambda "binding" $ lets [- "name">: Core.bindingName $ var "binding",- "term">: Core.bindingTerm $ var "binding",- "mts">: Core.bindingType $ var "binding"]- $ pair (var "name") (Core.binding (var "name") (var "term") (var "mts"))]- $ Graph.graphWithElements (var "g") (Maps.union (var "newEls") (Graph.graphElements $ var "g"))+extendGraphWithBindings :: TBinding ([Binding] -> Graph -> Graph)+extendGraphWithBindings = define "extendGraphWithBindings" $+ doc "Add bindings to an existing graph" $+ "bindings" ~> "g" ~>+ Graph.graphWithElements (var "g") (Lists.concat2 (var "bindings") (Graph.graphElements (var "g"))) -fieldsOfDef :: TBinding (Type -> [FieldType])-fieldsOfDef = define "fieldsOf" $- lambda "t" $ lets [- "stripped">: ref Rewriting.deannotateTypeDef @@ var "t"]- $ cases _Type (var "stripped") (Just $ list []) [- _Type_forall>>: lambda "forallType" $ ref fieldsOfDef @@ (Core.forallTypeBody $ var "forallType"),- _Type_record>>: lambda "rt" $ Core.rowTypeFields $ var "rt",- _Type_union>>: lambda "rt" $ Core.rowTypeFields $ var "rt"]+fieldsOf :: TBinding (Type -> [FieldType])+fieldsOf = define "fieldsOf" $+ doc "Extract the fields of a record or union type" $+ "t" ~>+ "stripped" <~ Rewriting.deannotateType @@ var "t" $+ cases _Type (var "stripped")+ (Just (list ([] :: [TTerm FieldType]))) [+ _Type_forall>>: "forallType" ~> fieldsOf @@ (Core.forallTypeBody (var "forallType")),+ _Type_record>>: "rt" ~> Core.rowTypeFields (var "rt"),+ _Type_union>>: "rt" ~> Core.rowTypeFields (var "rt")] -getFieldDef :: TBinding (M.Map Name Term -> Name -> (Term -> Flow Graph b) -> Flow Graph b)-getFieldDef = define "getField" $- lambdas ["m", "fname", "decode"] $- Optionals.maybe- (Flows.fail $ "expected field " ++ (Core.unName $ var "fname") ++ " not found")- (var "decode")- (Maps.lookup (var "fname") (var "m"))+getField :: TBinding (M.Map Name Term -> Name -> (Term -> Flow Graph b) -> Flow Graph b)+getField = define "getField" $+ "m" ~> "fname" ~> "decode" ~>+ Maybes.maybe+ (Flows.fail ((string "expected field ") ++ (Core.unName (var "fname")) ++ (string " not found")))+ (var "decode")+ (Maps.lookup (var "fname") (var "m")) -lookupElementDef :: TBinding (Graph -> Name -> Maybe Binding)-lookupElementDef = define "lookupElement" $- lambdas ["g", "name"] $ Maps.lookup (var "name") (Graph.graphElements $ var "g")+lookupElement :: TBinding (Graph -> Name -> Maybe Binding)+lookupElement = define "lookupElement" $+ "g" ~> "name" ~> Lists.find ("b" ~> Equality.equal (Core.bindingName (var "b")) (var "name")) (Graph.graphElements (var "g")) -lookupPrimitiveDef :: TBinding (Graph -> Name -> Maybe Primitive)-lookupPrimitiveDef = define "lookupPrimitive" $- lambda "g" $ lambda "name" $- Maps.lookup (var "name") (Graph.graphPrimitives $ var "g")+lookupPrimitive :: TBinding (Graph -> Name -> Maybe Primitive)+lookupPrimitive = define "lookupPrimitive" $+ "g" ~> "name" ~>+ Maps.lookup (var "name") (Graph.graphPrimitives (var "g")) -matchEnumDef :: TBinding (Name -> [(Name, b)] -> Term -> Flow Graph b)-matchEnumDef = define "matchEnum" $- lambdas ["tname", "pairs"] $- ref matchUnionDef @@ var "tname" @@ (Lists.map (lambda "pair" $- ref matchUnitFieldDef @@ (first $ var "pair") @@ (second $ var "pair")) $ var "pairs")+matchEnum :: TBinding (Name -> [(Name, b)] -> Term -> Flow Graph b)+matchEnum = define "matchEnum" $+ "tname" ~> "pairs" ~>+ matchUnion @@ var "tname" @@ (Lists.map ("pair" ~>+ matchUnitField @@ (Pairs.first (var "pair")) @@ (Pairs.second (var "pair"))) (var "pairs")) -matchRecordDef :: TBinding ((M.Map Name Term -> Flow Graph b) -> Term -> Flow Graph b)-matchRecordDef = define "matchRecord" $- lambdas ["decode", "term"] $ lets [- "stripped">: ref Rewriting.deannotateAndDetypeTermDef @@ var "term"]- $ cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@ string "record" @@ (ref ShowCore.termDef @@ var "term")) [- _Term_record>>: lambda "record" $ var "decode" @@- (Maps.fromList $ Lists.map- (lambda "field" $ pair (Core.fieldName $ var "field") (Core.fieldTerm $ var "field"))- (Core.recordFields $ var "record"))]+matchRecord :: TBinding ((M.Map Name Term -> Flow Graph b) -> Term -> Flow Graph b)+matchRecord = define "matchRecord" $+ "decode" ~> "term" ~>+ "stripped" <~ Rewriting.deannotateAndDetypeTerm @@ var "term" $+ cases _Term (var "stripped")+ (Just (Monads.unexpected @@ (string "record") @@ (ShowCore.term @@ var "term"))) [+ _Term_record>>: "record" ~> var "decode" @@+ (Maps.fromList (Lists.map+ ("field" ~> pair (Core.fieldName (var "field")) (Core.fieldTerm (var "field")))+ (Core.recordFields (var "record"))))] -matchUnionDef :: TBinding (Name -> [(Name, Term -> Flow Graph b)] -> Term -> Flow Graph b)-matchUnionDef = define "matchUnion" $- lambdas ["tname", "pairs", "term"] $ lets [- "stripped">: ref Rewriting.deannotateAndDetypeTermDef @@ var "term",- "mapping">: Maps.fromList $ var "pairs"] $- cases _Term (var "stripped")- (Just $ ref Monads.unexpectedDef @@- ("union with one of {" ++ (Strings.intercalate ", " $ Lists.map (lambda "pair" $ Core.unName $ first $ var "pair") $ var "pairs") ++ "}") @@- (ref ShowCore.termDef @@ var "stripped")) [- _Term_variable>>: lambda "name" $- Flows.bind (ref requireElementDef @@ var "name") $- lambda "el" $ ref matchUnionDef @@ var "tname" @@ var "pairs" @@ (Core.bindingTerm $ var "el"),- _Term_union>>: lambda "injection" $- Logic.ifElse (Core.equalName_ (Core.injectionTypeName $ var "injection") (var "tname"))- (lets [- "fname">: Core.fieldName $ Core.injectionField $ var "injection",- "val">: Core.fieldTerm $ Core.injectionField $ var "injection"] $- Optionals.maybe- (Flows.fail $ "no matching case for field " ++ (Core.unName $ var "fname")- ++ " in union type " ++ (Core.unName $ var "tname"))- (lambda "f" $ var "f" @@ var "val")- (Maps.lookup (var "fname") (var "mapping")))- (ref Monads.unexpectedDef @@ ("injection for type " ++ (Core.unName $ var "tname")) @@ (ref ShowCore.termDef @@ var "term"))]+matchUnion :: TBinding (Name -> [(Name, Term -> Flow Graph b)] -> Term -> Flow Graph b)+matchUnion = define "matchUnion" $+ "tname" ~> "pairs" ~> "term" ~>+ "stripped" <~ Rewriting.deannotateAndDetypeTerm @@ var "term" $+ "mapping" <~ Maps.fromList (var "pairs") $+-- trace "match union" $+ cases _Term (var "stripped")+ (Just (Monads.unexpected @@+ (Strings.cat $ list [+ string "inject(", Core.unName (var "tname"),+ string ") with one of {",+ (Strings.intercalate (string ", ") (Lists.map ("pair" ~> Core.unName (Pairs.first (var "pair"))) (var "pairs"))),+ string "}"]) @@+ (ShowCore.term @@ var "stripped"))) [+ _Term_variable>>: "name" ~>+ "el" <<~ requireElement @@ var "name" $+ matchUnion @@ var "tname" @@ var "pairs" @@ (Core.bindingTerm (var "el")),+ _Term_union>>: "injection" ~>+ "exp" <~ (+ "fname" <~ Core.fieldName (Core.injectionField (var "injection")) $+ "val" <~ Core.fieldTerm (Core.injectionField (var "injection")) $+ Maybes.maybe+ (Flows.fail ((string "no matching case for field \"") ++ (Core.unName (var "fname"))+ ++ (string "\" in union type ") ++ (Core.unName (var "tname"))))+ ("f" ~> var "f" @@ var "val")+ (Maps.lookup (var "fname") (var "mapping"))) $+ Logic.ifElse (Core.equalName_ (Core.injectionTypeName (var "injection")) (var "tname"))+ (var "exp")+ (Monads.unexpected @@ ((string "injection for type ") ++ (Core.unName (var "tname"))) @@ (ShowCore.term @@ var "term"))] -matchUnitFieldDef :: TBinding (Name -> y -> (Name, x -> Flow Graph y))-matchUnitFieldDef = define "matchUnitField" $- lambdas ["fname", "x"] $ pair (var "fname") (lambda "ignored" $ Flows.pure $ var "x")+matchUnitField :: TBinding (Name -> y -> (Name, x -> Flow Graph y))+matchUnitField = define "matchUnitField" $+ "fname" ~> "x" ~> pair (var "fname") ("ignored" ~> produce (var "x")) -requireElementDef :: TBinding (Name -> Flow Graph Binding)-requireElementDef = define "requireElement" $- lambda "name" $ lets [- "showAll">: false,- "ellipsis">: lambda "strings" $- Logic.ifElse (Logic.and (Equality.gt (Lists.length $ var "strings") (int32 3)) (Logic.not $ var "showAll"))- (Lists.concat2 (Lists.take (int32 3) (var "strings")) (list [string "..."]))- (var "strings"),- "err">: lambda "g" $ Flows.fail $- "no such element: " ++ (Core.unName $ var "name") ++- ". Available elements: {" ++- (Strings.intercalate ", " $ var "ellipsis" @@ (Lists.map (lambda "el" $ Core.unName $ Core.bindingName $ var "el") $ Maps.elems $ Graph.graphElements $ var "g")) ++- "}"]- $ Flows.bind (ref dereferenceElementDef @@ var "name") $- lambda "mel" $ Optionals.maybe- (Flows.bind (ref Monads.getStateDef) $ var "err")- (unaryFunction Flows.pure)- (var "mel")+requireElement :: TBinding (Name -> Flow Graph Binding)+requireElement = define "requireElement" $+ "name" ~>+ "showAll" <~ false $+ "ellipsis" <~ ("strings" ~>+ Logic.ifElse (Logic.and (Equality.gt (Lists.length (var "strings")) (int32 3)) (Logic.not (var "showAll")))+ (Lists.concat2 (Lists.take (int32 3) (var "strings")) (list [string "..."]))+ (var "strings")) $+ "err" <~ ("g" ~> Flows.fail (+ (string "no such element: ") ++ (Core.unName (var "name")) +++ (string ". Available elements: {") +++ (Strings.intercalate (string ", ") (var "ellipsis" @@ (Lists.map ("el" ~> Core.unName (Core.bindingName (var "el"))) (Graph.graphElements (var "g"))))) +++ (string "}"))) $+ "mel" <<~ dereferenceElement @@ var "name" $+ Maybes.maybe+ ("g" <<~ Monads.getState $ var "err" @@ var "g")+ (unaryFunction Flows.pure)+ (var "mel") -requirePrimitiveDef :: TBinding (Name -> Flow Graph Primitive)-requirePrimitiveDef = define "requirePrimitive" $- lambda "name" $- Flows.bind (ref Monads.getStateDef) $- lambda "g" $ Optionals.maybe- (Flows.fail $ "no such primitive function: " ++ (Core.unName $ var "name"))- (unaryFunction Flows.pure)- (ref lookupPrimitiveDef @@ var "g" @@ var "name")+requirePrimitive :: TBinding (Name -> Flow Graph Primitive)+requirePrimitive = define "requirePrimitive" $+ "name" ~>+ "g" <<~ Monads.getState $+ Maybes.maybe+ (Flows.fail ((string "no such primitive function: ") ++ (Core.unName (var "name"))))+ (unaryFunction Flows.pure)+ (lookupPrimitive @@ var "g" @@ var "name") -requireTermDef :: TBinding (Name -> Flow Graph Term)-requireTermDef = define "requireTerm" $- lambda "name" $- Flows.bind (ref resolveTermDef @@ var "name") $- lambda "mt" $ Optionals.maybe- (Flows.fail $ "no such element: " ++ (Core.unName $ var "name"))- (unaryFunction Flows.pure)- (var "mt")+requirePrimitiveType :: TBinding (TypeContext -> Name -> Flow s TypeScheme)+requirePrimitiveType = define "requirePrimitiveType" $+ "tx" ~> "name" ~>+ "mts" <~ Maps.lookup+ (var "name" )+ (Typing.inferenceContextPrimitiveTypes $ Typing.typeContextInferenceContext $ var "tx") $+ optCases (var "mts")+ (Flows.fail ((string "no such primitive function: ") ++ (Core.unName (var "name"))))+ ("ts" ~> produce $ var "ts") -resolveTermDef :: TBinding (Name -> Flow Graph (Maybe Term))-resolveTermDef = define "resolveTerm" $+requireTerm :: TBinding (Name -> Flow Graph Term)+requireTerm = define "requireTerm" $+ "name" ~>+ "mt" <<~ resolveTerm @@ var "name" $+ Maybes.maybe+ (Flows.fail ((string "no such element: ") ++ (Core.unName (var "name"))))+ (unaryFunction Flows.pure)+ (var "mt")++resolveTerm :: TBinding (Name -> Flow Graph (Maybe Term))+resolveTerm = define "resolveTerm" $ doc "TODO: distinguish between lambda-bound and let-bound variables" $- lambda "name" $ lets [- "recurse">: lambda "el" $ lets [- "stripped">: ref Rewriting.deannotateTermDef @@ (Core.bindingTerm $ var "el")]- $ cases _Term (var "stripped") (Just $ Flows.pure $ just $ Core.bindingTerm $ var "el") [- _Term_variable>>: lambda "name'" $ ref resolveTermDef @@ var "name'"]]- $ Flows.bind (ref Monads.getStateDef) $- lambda "g" $ Optionals.maybe- (Flows.pure nothing)- (var "recurse")- (Maps.lookup (var "name") (Graph.graphElements $ var "g"))+ "name" ~>+ "recurse" <~ ("el" ~>+ "stripped" <~ Rewriting.deannotateTerm @@ (Core.bindingTerm (var "el")) $+ cases _Term (var "stripped")+ (Just (produce (just (Core.bindingTerm (var "el"))))) [+ _Term_variable>>: "name'" ~> resolveTerm @@ var "name'"]) $+ "g" <<~ Monads.getState $+ Maybes.maybe+ (produce nothing)+ (var "recurse")+ (Lists.find ("b" ~> Equality.equal (Core.bindingName (var "b")) (var "name")) (Graph.graphElements (var "g"))) -schemaContextDef :: TBinding (Graph -> Graph)-schemaContextDef = define "schemaContext" $+schemaContext :: TBinding (Graph -> Graph)+schemaContext = define "schemaContext" $ doc "Note: assuming for now that primitive functions are the same in the schema graph" $- lambda "g" $ Optionals.fromMaybe (var "g") (Graph.graphSchema $ var "g")+ "g" ~> Maybes.fromMaybe (var "g") (Graph.graphSchema (var "g")) -stripAndDereferenceTermDef :: TBinding (Term -> Flow Graph Term)-stripAndDereferenceTermDef = define "stripAndDereferenceTerm" $- lambda "term" $ lets [- "stripped">: ref Rewriting.deannotateAndDetypeTermDef @@ var "term"]- $ cases _Term (var "stripped") (Just $ Flows.pure $ var "stripped") [- _Term_variable>>: lambda "v" $- Flows.bind (ref requireTermDef @@ var "v") $- lambda "t" $ ref stripAndDereferenceTermDef @@ var "t"]+stripAndDereferenceTerm :: TBinding (Term -> Flow Graph Term)+stripAndDereferenceTerm = define "stripAndDereferenceTerm" $+ "term" ~>+ "stripped" <~ Rewriting.deannotateAndDetypeTerm @@ var "term" $+ cases _Term (var "stripped")+ (Just (produce (var "stripped"))) [+ _Term_variable>>: "v" ~>+ "t" <<~ requireTerm @@ var "v" $+ stripAndDereferenceTerm @@ var "t"] -typeOfPrimitiveDef :: TBinding (Name -> Flow Graph TypeScheme)-typeOfPrimitiveDef = define "typeOfPrimitive" $- lambda "name" $ Flows.map (unaryFunction Graph.primitiveType) $ ref requirePrimitiveDef @@ var "name"+-- | Strip annotations and dereference variables, returning Either String Term+-- This is the pure (non-Flow) version for use in generated decoders+stripAndDereferenceTermEither :: TBinding (Graph -> Term -> Either String Term)+stripAndDereferenceTermEither = define "stripAndDereferenceTermEither" $+ doc "Strip annotations and dereference variables, returning Either an error or the resolved term" $+ "g" ~> "term" ~>+ "stripped" <~ Rewriting.deannotateAndDetypeTerm @@ var "term" $+ cases _Term (var "stripped")+ (Just (right (var "stripped"))) [+ _Term_variable>>: "v" ~>+ Eithers.either_+ left_ -- propagate error+ ("binding" ~> stripAndDereferenceTermEither @@ var "g" @@ (Core.bindingTerm (var "binding")))+ (dereferenceVariable @@ var "g" @@ var "v")] -- TODO: move into hydra.lexical-withEmptyGraphDef :: TBinding (Flow Graph a -> Flow s a)-withEmptyGraphDef = define "withEmptyGraph" $+withEmptyGraph :: TBinding (Flow Graph a -> Flow s a)+withEmptyGraph = define "withEmptyGraph" $ doc "Execute flow with empty graph" $- ref Monads.withStateDef @@ ref emptyGraphDef+ Monads.withState @@ emptyGraph -withSchemaContextDef :: TBinding (Flow Graph x -> Flow Graph x)-withSchemaContextDef = define "withSchemaContext" $- lambda "f" $- Flows.bind (ref Monads.getStateDef) $- lambda "g" $ ref Monads.withStateDef @@ (ref schemaContextDef @@ var "g") @@ var "f"+withSchemaContext :: TBinding (Flow Graph x -> Flow Graph x)+withSchemaContext = define "withSchemaContext" $+ "f" ~>+ "g" <<~ Monads.getState $+ Monads.withState @@ (schemaContext @@ var "g") @@ var "f"
src/main/haskell/Hydra/Sources/Kernel/Terms/Literals.hs view
@@ -1,62 +1,80 @@ module Hydra.Sources.Kernel.Terms.Literals where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ bigfloatToFloatValue, bigintToIntegerValue, floatValueToBigfloat, integerValueToBigint) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.literals"+ module_ :: Module-module_ = Module (Namespace "hydra.literals") elements+module_ = Module ns elements []- kernelTypesModules $+ kernelTypesNamespaces $ Just "Conversion functions for literal values." where elements = [- el bigfloatToFloatValueDef,- el bigintToIntegerValueDef,- el floatValueToBigfloatDef,- el integerValueToBigintDef]+ toBinding bigfloatToFloatValue,+ toBinding bigintToIntegerValue,+ toBinding floatValueToBigfloat,+ toBinding integerValueToBigint] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -bigfloatToFloatValueDef :: TBinding (FloatType -> Bigfloat -> FloatValue)-bigfloatToFloatValueDef = define "bigfloatToFloatValue" $+bigfloatToFloatValue :: TBinding (FloatType -> Bigfloat -> FloatValue)+bigfloatToFloatValue = define "bigfloatToFloatValue" $ doc "Convert a bigfloat to a floating-point value of a given type (note: lossy)" $ "ft" ~> "bf" ~> cases _FloatType (var "ft") Nothing [@@ -64,8 +82,8 @@ _FloatType_float32>>: constant $ Core.floatValueFloat32 $ Literals.bigfloatToFloat32 $ var "bf", _FloatType_float64>>: constant $ Core.floatValueFloat64 $ Literals.bigfloatToFloat64 $ var "bf"] -bigintToIntegerValueDef :: TBinding (IntegerType -> Integer -> IntegerValue)-bigintToIntegerValueDef = define "bigintToIntegerValue" $+bigintToIntegerValue :: TBinding (IntegerType -> Integer -> IntegerValue)+bigintToIntegerValue = define "bigintToIntegerValue" $ doc "Convert a bigint to an integer value of a given type (note: lossy)" $ "it" ~> "bi" ~> cases _IntegerType (var "it") Nothing [@@ -79,8 +97,8 @@ _IntegerType_uint32>>: constant $ Core.integerValueUint32 $ Literals.bigintToUint32 $ var "bi", _IntegerType_uint64>>: constant $ Core.integerValueUint64 $ Literals.bigintToUint64 $ var "bi"] -floatValueToBigfloatDef :: TBinding (FloatValue -> Bigfloat)-floatValueToBigfloatDef = define "floatValueToBigfloat" $+floatValueToBigfloat :: TBinding (FloatValue -> Bigfloat)+floatValueToBigfloat = define "floatValueToBigfloat" $ doc "Convert a floating-point value of any precision to a bigfloat" $ match _FloatValue Nothing [@@ -88,8 +106,8 @@ _FloatValue_float32>>: "f32" ~> Literals.float32ToBigfloat $ var "f32", _FloatValue_float64>>: "f64" ~> Literals.float64ToBigfloat $ var "f64"] -integerValueToBigintDef :: TBinding (IntegerValue -> Integer)-integerValueToBigintDef = define "integerValueToBigint" $+integerValueToBigint :: TBinding (IntegerValue -> Integer)+integerValueToBigint = define "integerValueToBigint" $ doc "Convert an integer value of any precision to a bigint" $ match _IntegerValue Nothing [
src/main/haskell/Hydra/Sources/Kernel/Terms/Monads.hs view
@@ -1,287 +1,333 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Monads where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ emptyTrace, flowSucceeds, fromFlow, getState, map, maybeToList, modify, mutateTrace,+ pushError, putState, traceSummary, unexpected, warn, withFlag, withState, withTrace) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (bind, exec, map)+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import Prelude hiding ((++), fail, map, pure)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Constants as Constants import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants -import Hydra.Mantle +ns :: Namespace+ns = Namespace "hydra.monads" module_ :: Module-module_ = Module (Namespace "hydra.monads") elements- [Constants.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [Constants.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just ("Functions for working with Hydra's 'flow' and other monads.") where elements = [- el bindDef,- el emptyTraceDef,- el execDef,- el failDef,- el flowSucceedsDef,- el fromFlowDef,- el getStateDef,- el mapDef,- el modifyDef,- el mutateTraceDef,- el optionalToListDef,- el pureDef,- el pushErrorDef,- el putStateDef,- el traceSummaryDef,- el unexpectedDef,- el warnDef,- el withFlagDef,- el withStateDef,- el withTraceDef]+ toBinding bind,+ toBinding eitherToFlow_,+ toBinding emptyTrace,+ toBinding exec,+ toBinding fail,+ toBinding flowSucceeds,+ toBinding fromFlow,+ toBinding getState,+ toBinding map,+ toBinding modify,+ toBinding mutateTrace,+ toBinding maybeToList,+ toBinding pure,+ toBinding pushError,+ toBinding putState,+ toBinding traceSummary,+ toBinding unexpected,+ toBinding warn,+ toBinding withFlag,+ toBinding withState,+ toBinding withTrace] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -bindDef :: TBinding (Flow s a -> (a -> Flow s b) -> Flow s b)-bindDef = define "bind" $ lambdas ["l", "r"] $ lets [- "q">: lambdas ["s0", "t0"] $ lets [- "fs1">: Compute.unFlow (var "l") (var "s0") (var "t0")] $- Optionals.maybe+bind :: TBinding (Flow s a -> (a -> Flow s b) -> Flow s b)+bind = define "bind" $+ doc "Monadic bind for flows" $+ "l" ~> "r" ~>+ "q" <~ ("s0" ~> "t0" ~>+ "fs1" <~ Compute.unFlow (var "l") (var "s0") (var "t0") $+ Maybes.maybe (Compute.flowState nothing (Compute.flowStateState $ var "fs1") (Compute.flowStateTrace $ var "fs1"))- (lambda "v" $ Compute.unFlow+ ("v" ~> Compute.unFlow (var "r" @@ var "v") (Compute.flowStateState $ var "fs1") (Compute.flowStateTrace $ var "fs1"))- (Compute.flowStateValue $ var "fs1")] $+ (Compute.flowStateValue $ var "fs1")) $ Compute.flow $ var "q" -emptyTraceDef :: TBinding Trace-emptyTraceDef = define "emptyTrace" $ Compute.trace (list []) (list []) Maps.empty+eitherToFlow_ :: TBinding ((a -> String) -> Prelude.Either a b -> Flow s b)+eitherToFlow_ = define "eitherToFlow" $+ doc "Adapt an either to a flow; a left value is mapped to a failure using the provided function" $+ "formatError" ~> "e" ~>+ Eithers.either_+ ("l" ~> fail @@ (var "formatError" @@ var "l"))+ ("r" ~> pure @@ var "r")+ (var "e") -execDef :: TBinding (Flow s a -> s -> s)-execDef = define "exec" $- lambdas ["f", "s0"] $- Compute.flowStateState $ Compute.unFlow (var "f") (var "s0") (ref emptyTraceDef)+emptyTrace :: TBinding Trace+emptyTrace = define "emptyTrace" $+ doc "An empty trace with no stack, messages, or other attributes" $+ Compute.trace (list ([] :: [TTerm String])) (list ([] :: [TTerm String])) Maps.empty -failDef :: TBinding (String -> Flow s a)-failDef = define "fail" $- lambda "msg" $- Compute.flow $ lambdas ["s", "t"] $- Compute.flowState nothing (var "s") (ref pushErrorDef @@ var "msg" @@ var "t")+exec :: TBinding (Flow s a -> s -> s)+exec = define "exec" $+ doc "Execute a flow and return the final state" $+ "f" ~> "s0" ~>+ Compute.flowStateState (Compute.unFlow (var "f") (var "s0") emptyTrace) -flowSucceedsDef :: TBinding (Flow s a -> Bool)-flowSucceedsDef = define "flowSucceeds" $+fail :: TBinding (String -> Flow s a)+fail = define "fail" $+ doc "Fail a flow with an error message" $+ "msg" ~>+ Compute.flow (+ "s" ~> "t" ~>+ Compute.flowState nothing (var "s") (pushError @@ var "msg" @@ var "t"))++flowSucceeds :: TBinding (Flow s a -> Bool)+flowSucceeds = define "flowSucceeds" $ doc "Check whether a flow succeeds" $- lambdas ["s", "f"] $- Optionals.isJust (Compute.flowStateValue $ (Compute.unFlow (var "f") (var "s") (ref emptyTraceDef)))+ "s" ~> "f" ~>+ Maybes.isJust (Compute.flowStateValue (Compute.unFlow (var "f") (var "s") emptyTrace)) -fromFlowDef :: TBinding (a -> s -> Flow s a -> a)-fromFlowDef = define "fromFlow" $+fromFlow :: TBinding (a -> s -> Flow s a -> a)+fromFlow = define "fromFlow" $ doc "Get the value of a flow, or a default value if the flow fails" $- lambdas ["def", "cx", "f"] $ Optionals.maybe+ "def" ~> "cx" ~> "f" ~> Maybes.maybe (var "def")- (lambda "xmo" $ var "xmo")- (Compute.flowStateValue $ (Compute.unFlow (var "f") (var "cx") (ref emptyTraceDef)))+ ("xmo" ~> var "xmo")+ (Compute.flowStateValue (Compute.unFlow (var "f") (var "cx") emptyTrace)) -getStateDef :: TBinding (Flow s s)-getStateDef = define "getState" $+getState :: TBinding (Flow s s)+getState = define "getState" $ doc "Get the state of the current flow" $- Compute.flow $ lambdas ["s0", "t0"] $ lets [- "fs1">: Compute.unFlow (ref pureDef @@ unit) (var "s0") (var "t0"),- "v">: Compute.flowStateValue (var "fs1"),- "s">: Compute.flowStateState (var "fs1"),- "t">: Compute.flowStateTrace (var "fs1")] $- Optionals.maybe+ Compute.flow (+ "s0" ~> "t0" ~>+ "fs1" <~ Compute.unFlow (pure @@ unit) (var "s0") (var "t0") $+ "v" <~ Compute.flowStateValue (var "fs1") $+ "s" <~ Compute.flowStateState (var "fs1") $+ "t" <~ Compute.flowStateTrace (var "fs1") $+ Maybes.maybe (Compute.flowState nothing (var "s") (var "t"))- (constant (Compute.flowState (just $ var "s") (var "s") (var "t")))- (var "v")+ (constant (Compute.flowState (just (var "s")) (var "s") (var "t")))+ (var "v")) -mapDef :: TBinding ((a -> b) -> Flow s a -> Flow s b)-mapDef = define "map" $+map :: TBinding ((a -> b) -> Flow s a -> Flow s b)+map = define "map" $ doc "Map a function over a flow" $- lambdas ["f", "f1"] $- Compute.flow $ lambdas ["s0", "t0"] $ lets [- "f2">: Compute.unFlow (var "f1") (var "s0") (var "t0")] $- Compute.flowState- (Optionals.map (var "f") $ Compute.flowStateValue $ var "f2")- (Compute.flowStateState $ var "f2")- (Compute.flowStateTrace $ var "f2")+ "f" ~> "f1" ~>+ Compute.flow (+ "s0" ~> "t0" ~>+ "f2" <~ Compute.unFlow (var "f1") (var "s0") (var "t0") $+ Compute.flowState+ (Maybes.map (var "f") (Compute.flowStateValue (var "f2")))+ (Compute.flowStateState (var "f2"))+ (Compute.flowStateTrace (var "f2"))) -modifyDef :: TBinding ((s -> s) -> Flow s ())-modifyDef = define "modify" $ lambda "f" $- ref bindDef- @@ (ref getStateDef)- @@ (lambda "s" $ ref putStateDef @@ (var "f" @@ var "s"))+modify :: TBinding ((s -> s) -> Flow s ())+modify = define "modify" $+ doc "Modify the state of a flow using a given function" $+ lambda "f" $+ bind+ @@ (getState)+ @@ (lambda "s" $ putState @@ (var "f" @@ var "s")) -mutateTraceDef :: TBinding ((Trace -> Hydra.Mantle.Either String Trace) -> (Trace -> Trace -> Trace) -> Flow s a -> Flow s a)-mutateTraceDef = define "mutateTrace" $- lambdas ["mutate", "restore", "f"] $- Compute.flow $ lambdas ["s0", "t0"] $ lets [- "forLeft">: lambda "msg" $- Compute.flowState nothing (var "s0") (ref pushErrorDef @@ var "msg" @@ var "t0"),- -- Retain the updated state, but reset the trace after execution- "forRight">: lambda "t1" $ lets [- -- Execute the internal flow after augmenting the trace- "f2">: Compute.unFlow (var "f") (var "s0") (var "t1")] $- Compute.flowState- (Compute.flowStateValue $ var "f2")- (Compute.flowStateState $ var "f2")- (var "restore" @@ var "t0" @@ (Compute.flowStateTrace $ var "f2"))] $- cases _Either (var "mutate" @@ var "t0") Nothing [- _Either_left>>: var "forLeft",- _Either_right>>: var "forRight"]+mutateTrace :: TBinding ((Trace -> Prelude.Either String Trace) -> (Trace -> Trace -> Trace) -> Flow s a -> Flow s a)+mutateTrace = define "mutateTrace" $+ doc "Temporarily mutate the trace for the duration of a flow" $+ "mutate" ~> "restore" ~> "f" ~>+ "choose" <~ ("forLeft" ~> "forRight" ~> "e" ~> Eithers.either_+ ("l" ~> var "forLeft" @@ var "l")+ ("r" ~> var "forRight" @@ var "r")+ (var "e")) $+ "flowFun" <~ ("s0" ~> "t0" ~>+ "forLeft" <~ ("msg" ~>+ Compute.flowState nothing (var "s0") (pushError @@ var "msg" @@ var "t0")) $+ "forRight" <~ ("t1" ~>+ "f2" <~ Compute.unFlow (var "f") (var "s0") (var "t1") $+ Compute.flowState+ (Compute.flowStateValue (var "f2"))+ (Compute.flowStateState (var "f2"))+ (var "restore" @@ var "t0" @@ (Compute.flowStateTrace (var "f2")))) $+ var "choose" @@ var "forLeft" @@ var "forRight" @@ (var "mutate" @@ var "t0")) $+ Compute.flow $ var "flowFun" -optionalToListDef :: TBinding (Maybe a -> [a])-optionalToListDef = define "optionalToList" $+maybeToList :: TBinding (Maybe a -> [a])+maybeToList = define "maybeToList" $ doc "Converts an optional value either to an empty list (if nothing) or a singleton list (if just)." $- lambda "mx" $ Optionals.maybe (list []) (unaryFunction Lists.pure) (var "mx")+ "mx" ~> Maybes.maybe (list ([] :: [TTerm a])) (unaryFunction Lists.pure) (var "mx") -pureDef :: TBinding (a -> Flow s a)-pureDef = define "pure" $ lambda "xp" $- Compute.flow $ lambdas ["s", "t"] $ Compute.flowState (just $ var "xp") (var "s") (var "t")+pure :: TBinding (a -> Flow s a)+pure = define "pure" $+ doc "Lift a value into a flow" $+ "xp" ~>+ Compute.flow (+ "s" ~> "t" ~> Compute.flowState (just (var "xp")) (var "s") (var "t")) -pushErrorDef :: TBinding (String -> Trace -> Trace)-pushErrorDef = define "pushError" $+pushError :: TBinding (String -> Trace -> Trace)+pushError = define "pushError" $ doc "Push an error message" $- lambdas ["msg", "t"] $ lets [- "condenseRepeats">: lets [- "condenseGroup">: lambda "xs" $ lets [- "x">: Lists.head $ var "xs",- "n">: Lists.length $ var "xs"] $- Logic.ifElse (Equality.equal (var "n") (int32 1))- (var "x")- (Strings.cat $ list [var "x", " (x", Literals.showInt32 (var "n"), ")"])] $- lambda "ys" $ Lists.map (var "condenseGroup") $ Lists.group (var "ys" :: TTerm [String]),- "errorMsg">: Strings.concat [- "Error: ", var "msg", " (",- (Strings.intercalate " > " (var "condenseRepeats" @@ (Lists.reverse $ Compute.traceStack $ var "t"))),- ")"]] $- Compute.trace- (Compute.traceStack $ var "t")- (Lists.cons (var "errorMsg") (Compute.traceMessages $ var "t"))- (Compute.traceOther $ var "t")+ "msg" ~> "t" ~>+ "condenseRepeats" <~ (+ "ys" ~>+ "condenseGroup" <~ ("xs" ~>+ "x" <~ Lists.head (var "xs") $+ "n" <~ Lists.length (var "xs") $+ Logic.ifElse (Equality.equal (var "n") (int32 1))+ (var "x")+ (Strings.cat (list [var "x", string " (x", Literals.showInt32 (var "n"), string ")"]))) $+ Lists.map (var "condenseGroup") (Lists.group (var "ys" :: TTerm [String]))) $+ "errorMsg" <~ Strings.concat [+ string "Error: ", var "msg", string " (",+ (Strings.intercalate (string " > ") (var "condenseRepeats" @@ (Lists.reverse (Compute.traceStack (var "t"))))),+ string ")"] $+ Compute.trace+ (Compute.traceStack (var "t"))+ (Lists.cons (var "errorMsg") (Compute.traceMessages (var "t")))+ (Compute.traceOther (var "t")) -putStateDef :: TBinding (s -> Flow s ())-putStateDef = define "putState" $+putState :: TBinding (s -> Flow s ())+putState = define "putState" $ doc "Set the state of a flow" $- lambda "cx" $ Compute.flow $ lambdas ["s0", "t0"] $ lets [- "f1">: Compute.unFlow (ref pureDef @@ unit) (var "s0") (var "t0")] $+ "cx" ~> Compute.flow (+ "s0" ~> "t0" ~>+ "f1" <~ Compute.unFlow (pure @@ unit) (var "s0") (var "t0") $ Compute.flowState- (Compute.flowStateValue $ var "f1")+ (Compute.flowStateValue (var "f1")) (var "cx")- (Compute.flowStateTrace $ var "f1")+ (Compute.flowStateTrace (var "f1"))) -traceSummaryDef :: TBinding (Trace -> String)-traceSummaryDef = define "traceSummary" $+traceSummary :: TBinding (Trace -> String)+traceSummary = define "traceSummary" $ doc "Summarize a trace as a string" $- lambda "t" $ lets [- "messageLines">: (Lists.nub (Compute.traceMessages $ var "t")),- "keyvalLines">: Logic.ifElse (Maps.null (Compute.traceOther $ var "t"))- (list [])- (Lists.cons ("key/value pairs: ")- (Lists.map (var "toLine") (Maps.toList (Compute.traceOther $ var "t")))),- "toLine">:- lambda "pair" $ "\t" ++ (Core.unName $ (first $ var "pair")) ++ ": " ++ (ref ShowCore.termDef @@ (second $ var "pair"))] $- Strings.intercalate "\n" (Lists.concat2 (var "messageLines") (var "keyvalLines"))+ "t" ~>+ "messageLines" <~ (Lists.nub (Compute.traceMessages $ var "t")) $+ "toLine" <~ ("pair" ~>+ string "\t" ++ (Core.unName $ (Pairs.first $ var "pair")) ++ string ": " ++ (ShowCore.term @@ (Pairs.second $ var "pair"))) $+ "keyvalLines" <~ Logic.ifElse (Maps.null (Compute.traceOther $ var "t"))+ (list ([] :: [TTerm String]))+ (Lists.cons (string "key/value pairs: ")+ (Lists.map (var "toLine") (Maps.toList (Compute.traceOther $ var "t")))) $+ Strings.intercalate (string "\n") (Lists.concat2 (var "messageLines") (var "keyvalLines")) -unexpectedDef :: TBinding (String -> String -> Flow s x)-unexpectedDef = define "unexpected" $+unexpected :: TBinding (String -> String -> Flow s x)+unexpected = define "unexpected" $ doc "Fail if an actual value does not match an expected value" $- lambdas ["expected", "actual"] $ ref failDef @@ ("expected " ++ var "expected" ++ " but found: " ++ var "actual")+ "expected" ~> "actual" ~>+ fail @@ (string "expected " ++ var "expected" ++ string " but found " ++ var "actual") -warnDef :: TBinding (String -> Flow s a -> Flow s a)-warnDef = define "warn" $+warn :: TBinding (String -> Flow s a -> Flow s a)+warn = define "warn" $ doc "Continue the current flow after adding a warning message" $- lambdas ["msg", "b"] $ Compute.flow $ lambdas ["s0", "t0"] $ lets [- "f1">: Compute.unFlow (var "b") (var "s0") (var "t0"),- "addMessage">: lambda "t" $ Compute.trace- (Compute.traceStack $ var "t")- (Lists.cons ("Warning: " ++ var "msg") (Compute.traceMessages $ var "t"))- (Compute.traceOther $ var "t")] $+ "msg" ~> "b" ~> Compute.flow (+ "s0" ~> "t0" ~>+ "f1" <~ Compute.unFlow (var "b") (var "s0") (var "t0") $+ "addMessage" <~ ("t" ~> Compute.trace+ (Compute.traceStack (var "t"))+ (Lists.cons (string "Warning: " ++ var "msg") (Compute.traceMessages (var "t")))+ (Compute.traceOther (var "t"))) $ Compute.flowState- (Compute.flowStateValue $ var "f1")- (Compute.flowStateState $ var "f1")- (var "addMessage" @@ (Compute.flowStateTrace $ var "f1"))+ (Compute.flowStateValue (var "f1"))+ (Compute.flowStateState (var "f1"))+ (var "addMessage" @@ (Compute.flowStateTrace (var "f1")))) -withFlagDef :: TBinding (String -> Flow s a -> Flow s a)-withFlagDef = define "withFlag" $+withFlag = define "withFlag" $ doc "Continue the current flow after setting a flag" $- lambda "flag" $ lets [- "mutate">: lambda "t" $ Mantle.eitherRight $ (Compute.trace- (Compute.traceStack $ var "t")- (Compute.traceMessages $ var "t")- (Maps.insert (var "flag") (Core.termLiteral $ Core.literalBoolean $ boolean True) (Compute.traceOther $ var "t"))),- "restore">: lambda "ignored" $ lambda "t1" $ Compute.trace- (Compute.traceStack $ var "t1")- (Compute.traceMessages $ var "t1")- (Maps.remove (var "flag") (Compute.traceOther $ var "t1"))] $- ref mutateTraceDef @@ var "mutate" @@ var "restore"+ "flag" ~> "f" ~>+ "mutate" <~ ("t" ~> Logic.ifElse+ (boolean False)+ (left (string "never happens")) -- Forces the left type to String+ (right (Compute.trace+ (Compute.traceStack (var "t"))+ (Compute.traceMessages (var "t"))+ (Maps.insert (var "flag") (Core.termLiteral (Core.literalBoolean (boolean True))) (Compute.traceOther (var "t")))))) $+ "restore" <~ ("ignored" ~> "t1" ~> Compute.trace+ (Compute.traceStack (var "t1"))+ (Compute.traceMessages (var "t1"))+ (Maps.delete (var "flag") (Compute.traceOther (var "t1")))) $+ mutateTrace @@ var "mutate" @@ var "restore" @@ var "f" -withStateDef :: TBinding (s1 -> Flow s1 a -> Flow s2 a)-withStateDef = define "withState" $+withState :: TBinding (s1 -> Flow s1 a -> Flow s2 a)+withState = define "withState" $ doc "Continue a flow using a given state" $- lambdas ["cx0", "f"] $- Compute.flow $ lambdas ["cx1", "t1"] $ lets [- "f1">: Compute.unFlow (var "f") (var "cx0") (var "t1")] $- Compute.flowState- (Compute.flowStateValue $ var "f1")- (var "cx1")- (Compute.flowStateTrace $ var "f1")+ "cx0" ~> "f" ~>+ Compute.flow (+ "cx1" ~> "t1" ~>+ "f1" <~ Compute.unFlow (var "f") (var "cx0") (var "t1") $+ Compute.flowState+ (Compute.flowStateValue (var "f1"))+ (var "cx1")+ (Compute.flowStateTrace (var "f1"))) -withTraceDef :: TBinding (String -> Flow s a -> Flow s a)-withTraceDef = define "withTrace" $+withTrace :: TBinding (String -> Flow s a -> Flow s a)+withTrace = define "withTrace" $ doc "Continue the current flow after augmenting the trace" $- lambda "msg" $ lets [- -- augment the trace- "mutate">: lambda "t" $ Logic.ifElse (Equality.gte (Lists.length (Compute.traceStack $ var "t")) $ ref Constants.maxTraceDepthDef)- (Mantle.eitherLeft $ string "maximum trace depth exceeded. This may indicate an infinite loop")- (Mantle.eitherRight $ Compute.trace- (Lists.cons (var "msg") (Compute.traceStack $ var "t"))- (Compute.traceMessages $ var "t")- (Compute.traceOther $ var "t")),- -- reset the trace stack after execution- "restore">: lambda "t0" $ lambda "t1" $ Compute.trace- (Compute.traceStack $ var "t0")- (Compute.traceMessages $ var "t1")- (Compute.traceOther $ var "t1")] $- ref mutateTraceDef @@ var "mutate" @@ var "restore"+ "msg" ~> "f" ~>+ "mutate" <~ ("t" ~> Logic.ifElse (Equality.gte (Lists.length (Compute.traceStack (var "t"))) Constants.maxTraceDepth)+ (left (string "maximum trace depth exceeded. This may indicate an infinite loop"))+ (right (Compute.trace+ (Lists.cons (var "msg") (Compute.traceStack (var "t")))+ (Compute.traceMessages (var "t"))+ (Compute.traceOther (var "t"))))) $+ "restore" <~ ("t0" ~> "t1" ~> Compute.trace+ (Compute.traceStack (var "t0"))+ (Compute.traceMessages (var "t1"))+ (Compute.traceOther (var "t1"))) $+ mutateTrace @@ var "mutate" @@ var "restore" @@ var "f"
src/main/haskell/Hydra/Sources/Kernel/Terms/Names.hs view
@@ -1,131 +1,153 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Names where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ compactName, localNameOf, namespaceOf, namespaceToFilePath, qname, qualifyName,+ uniqueLabel, unqualifyName) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting +ns :: Namespace+ns = Namespace "hydra.names"+ module_ :: Module-module_ = Module (Namespace "hydra.names") elements- [Formatting.module_]- kernelTypesModules $+module_ = Module ns elements+ [Formatting.ns]+ kernelTypesNamespaces $ Just ("Functions for working with qualified names.") where elements = [- el compactNameDef,- el localNameOfDef,- el namespaceOfDef,- el namespaceToFilePathDef,- el qnameDef,- el qualifyNameDef,- el uniqueLabelDef,- el unqualifyNameDef]+ toBinding compactName,+ toBinding localNameOf,+ toBinding namespaceOf,+ toBinding namespaceToFilePath,+ toBinding qname,+ toBinding qualifyName,+ toBinding uniqueLabel,+ toBinding unqualifyName] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -compactNameDef :: TBinding (M.Map Namespace String -> Name -> String)-compactNameDef = define "compactName" $+compactName :: TBinding (M.Map Namespace String -> Name -> String)+compactName = define "compactName" $ doc "Given a mapping of namespaces to prefixes, convert a name to a compact string representation" $ lambda "namespaces" $ lambda "name" $ lets [- "qualName">: ref qualifyNameDef @@ var "name",+ "qualName">: qualifyName @@ var "name", "mns">: Module.qualifiedNameNamespace $ var "qualName", "local">: Module.qualifiedNameLocal $ var "qualName"]- $ Optionals.maybe+ $ Maybes.maybe (Core.unName $ var "name") (lambda "ns" $- Optionals.maybe (var "local")+ Maybes.maybe (var "local") (lambda "pre" $ Strings.cat $ list [var "pre", string ":", var "local"]) (Maps.lookup (var "ns") (var "namespaces"))) (var "mns") -localNameOfDef :: TBinding (Name -> String)-localNameOfDef = define "localNameOf" $- unaryFunction Module.qualifiedNameLocal <.> ref qualifyNameDef+localNameOf :: TBinding (Name -> String)+localNameOf = define "localNameOf" $+ doc "Extract the local part of a name" $+ unaryFunction Module.qualifiedNameLocal <.> qualifyName -namespaceOfDef :: TBinding (Name -> Maybe Namespace)-namespaceOfDef = define "namespaceOf" $- unaryFunction Module.qualifiedNameNamespace <.> ref qualifyNameDef+namespaceOf :: TBinding (Name -> Maybe Namespace)+namespaceOf = define "namespaceOf" $+ doc "Extract the namespace of a name, if any" $+ unaryFunction Module.qualifiedNameNamespace <.> qualifyName -namespaceToFilePathDef :: TBinding (CaseConvention -> FileExtension -> Namespace -> String)-namespaceToFilePathDef = define "namespaceToFilePath" $+namespaceToFilePath :: TBinding (CaseConvention -> FileExtension -> Namespace -> String)+namespaceToFilePath = define "namespaceToFilePath" $+ doc "Convert a namespace to a file path with the given case convention and file extension" $ lambda "caseConv" $ lambda "ext" $ lambda "ns" $ lets [ "parts">: Lists.map- (ref Formatting.convertCaseDef @@ Mantle.caseConventionCamel @@ var "caseConv")- (Strings.splitOn "." (Core.unNamespace $ var "ns"))]- $ (Strings.intercalate "/" $ var "parts") ++ "." ++ (Module.unFileExtension $ var "ext")+ (Formatting.convertCase @@ Util.caseConventionCamel @@ var "caseConv")+ (Strings.splitOn (string ".") (Core.unNamespace $ var "ns"))]+ $ (Strings.intercalate (string "/") $ var "parts") ++ string "." ++ (Module.unFileExtension $ var "ext") -qnameDef :: TBinding (Namespace -> String -> Name)-qnameDef = define "qname" $+qname :: TBinding (Namespace -> String -> Name)+qname = define "qname" $ doc "Construct a qualified (dot-separated) name" $ lambda "ns" $ lambda "name" $ wrap _Name $ Strings.cat $ list [apply (unwrap _Namespace) (var "ns"), string ".", var "name"] -qualifyNameDef :: TBinding (Name -> QualifiedName)-qualifyNameDef = define "qualifyName" $+qualifyName :: TBinding (Name -> QualifiedName)+qualifyName = define "qualifyName" $+ doc "Split a dot-separated name into a namespace and local name" $ lambda "name" $ lets [- "parts">: Lists.reverse (Strings.splitOn "." (Core.unName $ var "name"))]+ "parts">: Lists.reverse (Strings.splitOn (string ".") (Core.unName $ var "name"))] $ Logic.ifElse (Equality.equal (int32 1) (Lists.length $ var "parts")) (Module.qualifiedName nothing (Core.unName $ var "name")) (Module.qualifiedName- (just $ wrap _Namespace (Strings.intercalate "." (Lists.reverse (Lists.tail $ var "parts"))))+ (just $ wrap _Namespace (Strings.intercalate (string ".") (Lists.reverse (Lists.tail $ var "parts")))) (Lists.head $ var "parts")) -uniqueLabelDef :: TBinding (S.Set String -> String -> String)-uniqueLabelDef = define "uniqueLabel" $+uniqueLabel :: TBinding (S.Set String -> String -> String)+uniqueLabel = define "uniqueLabel" $ doc "Generate a unique label by appending a suffix if the label is already in use" $ lambda "visited" $ lambda "l" $ Logic.ifElse (Sets.member (var "l") (var "visited"))- (ref uniqueLabelDef @@ var "visited" @@ Strings.cat2 (var "l") (string "'"))+ (uniqueLabel @@ var "visited" @@ Strings.cat2 (var "l") (string "'")) (var "l") -unqualifyNameDef :: TBinding (QualifiedName -> Name)-unqualifyNameDef = define "unqualifyName" $+unqualifyName :: TBinding (QualifiedName -> Name)+unqualifyName = define "unqualifyName" $ doc "Convert a qualified name to a dot-separated name" $ lambda "qname" $ lets [- "prefix">: Optionals.maybe+ "prefix">: Maybes.maybe (string "") (lambda "n" $ (unwrap _Namespace @@ var "n") ++ string ".") (project _QualifiedName _QualifiedName_namespace @@ var "qname")]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Parsers.hs view
@@ -0,0 +1,299 @@++module Hydra.Sources.Kernel.Terms.Parsers where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (map)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (apply, bind, char, map)+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++), pure, fail, map)+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+++ns :: Namespace+ns = Namespace "hydra.parsers"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces $+ Just "General-purpose parser combinators"+ where+ elements = [+ toBinding alt,+ toBinding anyChar,+ toBinding apply,+ toBinding between,+ toBinding bind,+ toBinding char,+ toBinding choice,+ toBinding eof,+ toBinding fail,+ toBinding lazy,+ toBinding many,+ toBinding map,+ toBinding optional,+ toBinding pure,+ toBinding runParser,+ toBinding satisfy,+ toBinding sepBy,+ toBinding sepBy1,+ toBinding some,+ toBinding string_]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- | Try the first parser, if it fails try the second+alt :: TBinding (Parser a -> Parser a -> Parser a)+alt = define "alt" $+ doc "Try the first parser; if it fails without consuming input, try the second" $+ "p1" ~> "p2" ~>+ "parse" <~ ("input" ~> cases _ParseResult (Parsing.runParser (var "p1") (var "input")) Nothing [+ _ParseResult_success>>: "s" ~>+ Parsing.parseResultSuccess (var "s"),+ _ParseResult_failure>>: "e" ~>+ -- Only try alternative if no input was consumed+ Logic.ifElse (Equality.equal (Parsing.parseErrorRemainder $ var "e") (var "input"))+ (Parsing.runParser (var "p2") (var "input"))+ (Parsing.parseResultFailure (var "e"))]) $+ Parsing.parser (var "parse")++-- | Parse any single character (as codepoint)+anyChar :: TBinding (Parser Int)+anyChar = define "anyChar" $+ doc "Parse any single character (codepoint)" $+ satisfy @@ (constant true)++-- | Applicative apply for parsers+apply :: TBinding (Parser (a -> b) -> Parser a -> Parser b)+apply = define "apply" $+ doc "Apply a parser containing a function to a parser containing a value" $+ "pf" ~> "pa" ~>+ "parse" <~ ("input" ~> cases _ParseResult (Parsing.runParser (var "pf") (var "input")) Nothing [+ _ParseResult_success>>: "sf" ~>+ cases _ParseResult (Parsing.runParser (var "pa") (Parsing.parseSuccessRemainder $ var "sf")) Nothing [+ _ParseResult_success>>: "sa" ~>+ Parsing.parseResultSuccess (Parsing.parseSuccess+ ((Parsing.parseSuccessValue $ var "sf") @@ (Parsing.parseSuccessValue $ var "sa"))+ (Parsing.parseSuccessRemainder $ var "sa")),+ _ParseResult_failure>>: "e" ~>+ Parsing.parseResultFailure (var "e")],+ _ParseResult_failure>>: "e" ~>+ Parsing.parseResultFailure (var "e")]) $+ Parsing.parser (var "parse")++-- | Parse something between two other parsers+between :: TBinding (Parser open -> Parser close -> Parser a -> Parser a)+between = define "between" $+ doc "Parse something between an opening and closing parser" $+ "open" ~> "close" ~> "p" ~>+ bind @@ var "open" @@ (constant $+ bind @@ var "p" @@ ("x" ~>+ bind @@ var "close" @@ (constant $+ pure @@ var "x")))++-- | Monadic bind for parsers+bind :: TBinding (Parser a -> (a -> Parser b) -> Parser b)+bind = define "bind" $+ doc "Sequence two parsers, passing the result of the first to a function that produces the second" $+ "pa" ~> "f" ~>+ "parse" <~ ("input" ~> cases _ParseResult (Parsing.runParser (var "pa") (var "input")) Nothing [+ _ParseResult_success>>: "s" ~>+ Parsing.runParser+ (var "f" @@ (Parsing.parseSuccessValue $ var "s"))+ (Parsing.parseSuccessRemainder $ var "s"),+ _ParseResult_failure>>: "e" ~>+ Parsing.parseResultFailure (var "e")]) $+ Parsing.parser (var "parse")++-- | Parse a specific character (as codepoint)+char :: TBinding (Int -> Parser Int)+char = define "char" $+ doc "Parse a specific character (codepoint)" $+ "c" ~>+ satisfy @@ ("x" ~> Equality.equal (var "x") (var "c"))++-- | Try parsers in order until one succeeds+choice :: TBinding ([Parser a] -> Parser a)+choice = define "choice" $+ doc "Try each parser in the list until one succeeds" $+ "ps" ~>+ Lists.foldl alt (fail @@ string "no choice matched") (var "ps")++-- | Parse end of input+eof :: TBinding (Parser ())+eof = define "eof" $+ doc "A parser that succeeds only at the end of input" $+ Parsing.parser ("input" ~>+ Logic.ifElse (Equality.equal (var "input") (string ""))+ (Parsing.parseResultSuccess (Parsing.parseSuccess unit (string "")))+ (Parsing.parseResultFailure (Parsing.parseError (string "expected end of input") (var "input"))))++-- | A parser that always fails with the given message+fail :: TBinding (String -> Parser a)+fail = define "fail" $+ doc "A parser that always fails with the given error message" $+ "msg" ~>+ Parsing.parser ("input" ~>+ Parsing.parseResultFailure (Parsing.parseError (var "msg") (var "input")))++-- | Create a parser that defers construction of another parser until parsing time.+-- This is essential for breaking recursive parser definitions.+lazy :: TBinding ((() -> Parser a) -> Parser a)+lazy = define "lazy" $+ doc ("Create a parser that defers construction of another parser until parsing time."+ <> " This is essential for breaking recursive parser definitions.") $+ "f" ~>+ Parsing.parser ("input" ~>+ Parsing.runParser (var "f" @@ unit) (var "input"))++-- | Parse zero or more occurrences+many :: TBinding (Parser a -> Parser [a])+many = define "many" $+ doc "Parse zero or more occurrences of the given parser" $+ "p" ~>+ alt @@ (some @@ var "p") @@ (pure @@ list ([] :: [TTerm a]))++-- | Map a function over the result of a parser+map :: TBinding ((a -> b) -> Parser a -> Parser b)+map = define "map" $+ doc "Apply a function to the result of a parser" $+ "f" ~> "pa" ~>+ "parse" <~ ("input" ~> cases _ParseResult (Parsing.runParser (var "pa") (var "input")) Nothing [+ _ParseResult_success>>: "s" ~>+ Parsing.parseResultSuccess (Parsing.parseSuccess+ (var "f" @@ (Parsing.parseSuccessValue $ var "s"))+ (Parsing.parseSuccessRemainder $ var "s")),+ _ParseResult_failure>>: "e" ~>+ Parsing.parseResultFailure (var "e")]) $+ Parsing.parser (var "parse")++-- | Optionally parse something+optional :: TBinding (Parser a -> Parser (Maybe a))+optional = define "optional" $+ doc "Optionally parse something, returning Nothing if it fails" $+ "p" ~>+ alt+ @@ (map @@ (unaryFunction just) @@ var "p")+ @@ (pure @@ nothing)++-- | A parser that always succeeds with the given value+pure :: TBinding (a -> Parser a)+pure = define "pure" $+ doc "A parser that always succeeds with the given value without consuming input" $+ "a" ~>+ Parsing.parser ("input" ~>+ Parsing.parseResultSuccess (Parsing.parseSuccess (var "a") (var "input")))++-- | Run a parser on input and return the result+runParser :: TBinding (Parser a -> String -> ParseResult a)+runParser = define "runParser" $+ doc "Run a parser on the given input string" $+ "p" ~> "input" ~>+ Parsing.runParser (var "p") (var "input")++-- | Parse a character that satisfies a predicate (characters represented as codepoints)+satisfy :: TBinding ((Int -> Bool) -> Parser Int)+satisfy = define "satisfy" $+ doc "Parse a character (codepoint) that satisfies the given predicate" $+ "pred" ~>+ "parse" <~ ("input" ~>+ "codes" <~ Strings.toList (var "input") $+ Maybes.maybe+ (Parsing.parseResultFailure (Parsing.parseError (string "unexpected end of input") (var "input")))+ ("c" ~>+ "rest" <~ Strings.fromList (Lists.drop (int32 1) (var "codes")) $+ Logic.ifElse (var "pred" @@ var "c")+ (Parsing.parseResultSuccess (Parsing.parseSuccess (var "c") (var "rest")))+ (Parsing.parseResultFailure (Parsing.parseError (string "character did not satisfy predicate") (var "input"))))+ (Lists.safeHead $ var "codes")) $+ Parsing.parser (var "parse")++-- | Parse zero or more occurrences separated by a separator+sepBy :: TBinding (Parser a -> Parser sep -> Parser [a])+sepBy = define "sepBy" $+ doc "Parse zero or more occurrences separated by a separator" $+ "p" ~> "sep" ~>+ alt @@ (sepBy1 @@ var "p" @@ var "sep") @@ (pure @@ list ([] :: [TTerm a]))++-- | Parse one or more occurrences separated by a separator+sepBy1 :: TBinding (Parser a -> Parser sep -> Parser [a])+sepBy1 = define "sepBy1" $+ doc "Parse one or more occurrences separated by a separator" $+ "p" ~> "sep" ~>+ bind @@ var "p" @@ ("x" ~>+ bind @@ (many @@ (bind @@ var "sep" @@ (constant $ var "p"))) @@ ("xs" ~>+ pure @@ (Lists.cons (var "x") (var "xs"))))++-- | Parse one or more occurrences+some :: TBinding (Parser a -> Parser [a])+some = define "some" $+ doc "Parse one or more occurrences of the given parser" $+ "p" ~>+ bind @@ var "p" @@ ("x" ~>+ bind @@ (many @@ var "p") @@ ("xs" ~>+ pure @@ (Lists.cons (var "x") (var "xs"))))++-- | Parse a specific string+string_ :: TBinding (String -> Parser String)+string_ = define "string" $+ doc "Parse a specific string" $+ "str" ~>+ Parsing.parser ("input" ~>+ "strCodes" <~ Strings.toList (var "str") $+ "inputCodes" <~ Strings.toList (var "input") $+ "strLen" <~ Lists.length (var "strCodes") $+ "inputPrefix" <~ Lists.take (var "strLen") (var "inputCodes") $+ Logic.ifElse (Equality.equal (var "strCodes") (var "inputPrefix"))+ (Parsing.parseResultSuccess (Parsing.parseSuccess+ (var "str")+ (Strings.fromList (Lists.drop (var "strLen") (var "inputCodes")))))+ (Parsing.parseResultFailure (Parsing.parseError+ (string "expected: " ++ var "str")+ (var "input"))))
src/main/haskell/Hydra/Sources/Kernel/Terms/Reduction.hs view
@@ -1,411 +1,944 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Reduction where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Arity as Arity-import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations---module_ :: Module-module_ = Module (Namespace "hydra.reduction") elements- [Arity.module_, ExtractCore.module_, Lexical.module_, Rewriting.module_,- Schemas.module_]- kernelTypesModules $- Just ("Functions for reducing terms and types, i.e. performing computations.")- where- elements = [- el alphaConvertDef,- el betaReduceTypeDef,- el contractTermDef,- el countPrimitiveInvocationsDef,- el etaReduceTermDef,- el expandLambdasDef,- el expansionArityDef,- el reduceTermDef,- el termIsClosedDef,- el termIsValueDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--alphaConvertDef :: TBinding (Name -> Name -> Term -> Term)-alphaConvertDef = define "alphaConvert" $- doc "Alpha convert a variable in a term" $- "vold" ~> "vnew" ~> "term" ~> ref Rewriting.replaceFreeTermVariableDef @@ var "vold" @@ (Core.termVariable $ var "vnew") @@ var "term"---- Note: this is eager beta reduction, in that we always descend into subtypes,--- and always reduce the right-hand side of an application prior to substitution-betaReduceTypeDef :: TBinding (Type -> Flow Graph Type)-betaReduceTypeDef = define "betaReduceType" $- lambda "typ" $ lets [- "mapExpr">: lambdas ["recurse", "t"] $- Flows.bind (var "recurse" @@ var "t") $- lambda "r" $- match _Type (Just $ Flows.pure $ var "r") [- _Type_application>>: lambda "a" $ var "reduceApp" @@ var "a"] @@ var "r",- "reduceApp">: lambda "app" $ lets [- "lhs">: Core.applicationTypeFunction $ var "app",- "rhs">: Core.applicationTypeArgument $ var "app"]- $ match _Type Nothing [- _Type_annotated>>: lambda "at" $- Flows.bind (var "reduceApp" @@ (Core.applicationType- (Core.annotatedTypeSubject $ var "at")- (var "rhs"))) $- lambda "a" $ Flows.pure $ Core.typeAnnotated $ Core.annotatedType (var "a") (Core.annotatedTypeAnnotation $ var "at"),- _Type_forall>>: lambda "ft" $- ref betaReduceTypeDef @@ (ref Rewriting.replaceFreeTypeVariableDef- @@ (Core.forallTypeParameter $ var "ft")- @@ var "rhs"- @@ (Core.forallTypeBody $ var "ft")),- _Type_variable>>: lambda "name" $- Flows.bind (ref Schemas.requireTypeDef @@ var "name") $- lambda "t'" $ ref betaReduceTypeDef @@ (Core.typeApplication $ Core.applicationType (var "t'") (var "rhs"))] @@ var "lhs"]- $ ref Rewriting.rewriteTypeMDef @@ var "mapExpr" @@ var "typ"--contractTermDef :: TBinding (Term -> Term)-contractTermDef = define "contractTerm" $- doc ("Apply the special rules:\n"- <> " ((\\x.e1) e2) == e1, where x does not appear free in e1\n"- <> " and\n"- <> " ((\\x.e1) e2) = e1[x/e2]\n"- <> "These are both limited forms of beta reduction which help to \"clean up\" a term without fully evaluating it.") $- "term" ~> lets [- "rewrite">: "recurse" ~> "t" ~> lets [- "rec">: var "recurse" @@ var "t"] $- cases _Term (var "rec")- (Just $ var "rec") [- _Term_application>>: "app" ~> lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app"] $- cases _Term (ref Rewriting.deannotateTermDef @@ var "lhs")- (Just $ var "rec") [- _Term_function>>: "f" ~> cases _Function (var "f")- (Just $ var "rec") [- _Function_lambda>>: "l" ~> lets [- "v">: Core.lambdaParameter $ var "l",- "body">: Core.lambdaBody $ var "l"] $- Logic.ifElse (ref Rewriting.isFreeVariableInTermDef @@ var "v" @@ var "body")- (var "body")- (ref Rewriting.replaceFreeTermVariableDef @@ var "v" @@ var "rhs" @@ var "body")]]]] $- ref Rewriting.rewriteTermDef @@ var "rewrite" @@ var "term"---- For demo purposes. This should be generalized to enable additional side effects of interest.-countPrimitiveInvocationsDef :: TBinding Bool-countPrimitiveInvocationsDef = define "countPrimitiveInvocations" true---- Note: unused / untested-etaReduceTermDef :: TBinding (Term -> Term)-etaReduceTermDef = define "etaReduceTerm" $- lambda "term" $ lets [- "noChange">: var "term",- "reduceLambda">: lambda "l" $ lets [- "v">: Core.lambdaParameter $ var "l",- "d">: Core.lambdaDomain $ var "l",- "body">: Core.lambdaBody $ var "l"]- $ match _Term (Just $ var "noChange") [- _Term_annotated>>: lambda "at" $- var "reduceLambda" @@ (Core.lambda (var "v") (var "d") (Core.annotatedTermSubject $ var "at")),- _Term_application>>: lambda "app" $ lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app"]- $ match _Term (Just $ var "noChange") [- _Term_annotated>>: lambda "at" $- var "reduceLambda" @@ (Core.lambda (var "v") (var "d") $- Core.termApplication $ Core.application (var "lhs") (Core.annotatedTermSubject $ var "at")),- _Term_variable>>: lambda "v1" $- Logic.ifElse- (Logic.and- (Equality.equal (Core.unName $ var "v") (Core.unName $ var "v1"))- (Logic.not $ ref Rewriting.isFreeVariableInTermDef @@ var "v" @@ var "lhs"))- (ref etaReduceTermDef @@ var "lhs")- (var "noChange")]- @@ (ref etaReduceTermDef @@ var "rhs")]- @@ (ref etaReduceTermDef @@ var "body")]- $ match _Term (Just $ var "noChange") [- _Term_annotated>>: lambda "at" $- Core.termAnnotated $ Core.annotatedTerm- (ref etaReduceTermDef @@ (Core.annotatedTermSubject $ var "at"))- (Core.annotatedTermAnnotation $ var "at"),- _Term_function>>: lambda "f" $- match _Function (Just $ var "noChange") [- _Function_lambda>>: lambda "l" $ var "reduceLambda" @@ var "l"]- @@ var "f"]- @@ var "term"--expandLambdasDef :: TBinding (Graph -> Term -> Term)-expandLambdasDef = define "expandLambdas" $- doc ("Recursively transform arbitrary terms like 'add 42' into terms like '\\x.add 42 x', in which the implicit"- <> " parameters of primitive functions and eliminations are made into explicit lambda parameters."- <> " Variable references are not expanded."- <> " This is useful for targets like Python with weaker support for currying than Hydra or Haskell."- <> " Note: this is a \"trusty\" function which assumes the graph is well-formed, i.e. no dangling references.") $- "graph" ~> "term" ~> lets [- "expand">: "args" ~> "arity" ~> "t" ~> lets [- "apps">: Lists.foldl- ("lhs" ~> "arg" ~> Core.termApplication $ Core.application (var "lhs") (var "arg"))- (var "t")- (var "args"),- "is">: Logic.ifElse (Equality.lte (var "arity") (Lists.length $ var "args"))- (list [])- (Math.range (int32 1) (Math.sub (var "arity") (Lists.length $ var "args"))),- "pad">: "indices" ~> "t" ~>- Logic.ifElse (Lists.null $ var "indices")- (var "t")- (Core.termFunction $ Core.functionLambda $- Core.lambda (Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ Lists.head $ var "indices")) nothing $- var "pad" @@ Lists.tail (var "indices") @@- (Core.termApplication $ Core.application (var "t") $ Core.termVariable $- Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ Lists.head $ var "indices")))] $- var "pad" @@ var "is" @@ var "apps",- "rewrite">: "args" ~> "recurse" ~> "t" ~> lets [- "afterRecursion">: "term" ~>- var "expand" @@ var "args" @@ (ref expansionArityDef @@ var "graph" @@ var "term") @@ var "term"] $- cases _Term (var "t")- (Just $ var "afterRecursion" @@ (var "recurse" @@ var "t")) [- _Term_application>>: "app" ~> lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app",- "erhs">: var "rewrite" @@ (list []) @@ var "recurse" @@ var "rhs"] $- var "rewrite" @@ (Lists.cons (var "erhs") (var "args")) @@ var "recurse" @@ var "lhs"]]- $ ref contractTermDef @@ (ref Rewriting.rewriteTermDef @@ (var "rewrite" @@ (list [])) @@ var "term")--expansionArityDef :: TBinding (Graph -> Term -> Int)-expansionArityDef = define "expansionArity" $- doc "Calculate the arity for lambda expansion" $- "graph" ~> "term" ~>- cases _Term (ref Rewriting.deannotateTermDef @@ var "term")- (Just $ int32 0) [- _Term_application>>: lambda "app" $- Math.sub- (ref expansionArityDef @@ var "graph" @@ Core.applicationFunction (var "app"))- (int32 1),- _Term_function>>: "f" ~> cases _Function (var "f")- Nothing [- _Function_elimination>>: constant $ int32 1,- _Function_lambda>>: constant $ int32 0,- _Function_primitive>>: "name" ~>- ref Arity.primitiveArityDef @@ (Optionals.fromJust (ref Lexical.lookupPrimitiveDef @@ var "graph" @@ var "name"))],- _Term_typeLambda>>: "ta" ~> ref expansionArityDef @@ var "graph" @@ Core.typeLambdaBody (var "ta"),- _Term_typeApplication>>: "tt" ~> ref expansionArityDef @@ var "graph" @@ Core.typedTermTerm (var "tt"),- _Term_variable>>: "name" ~>- Optionals.maybe (int32 0)- ("ts" ~> ref Arity.typeArityDef @@ (Core.typeSchemeType $ var "ts"))- (Optionals.bind- (ref Lexical.lookupElementDef @@ var "graph" @@ var "name")- ("el" ~> Core.bindingType $ var "el"))]--reduceTermDef :: TBinding (Bool -> Term -> Flow Graph Term)-reduceTermDef = define "reduceTerm" $- doc "A term evaluation function which is alternatively lazy or eager" $- lambdas ["eager", "term"] $ lets [- "reduce">: lambda "eager" $ ref reduceTermDef @@ var "eager",-- "doRecurse">: lambdas ["eager", "term"] $- Logic.and (var "eager") $ cases _Term (var "term") (Just true) [- _Term_function>>: match _Function (Just true) [- _Function_lambda>>: constant false]],-- "reduceArg">: lambdas ["eager", "arg"] $- Logic.ifElse (var "eager")- (Flows.pure $ var "arg")- (var "reduce" @@ false @@ var "arg"),-- "applyToArguments">: lambdas ["fun", "args"] $- Logic.ifElse (Lists.null $ var "args")- (var "fun")- (var "applyToArguments" @@- (Core.termApplication $ Core.application (var "fun") (Lists.head $ var "args")) @@- (Lists.tail $ var "args")),-- "replaceFreeTypeVariable">: lambdas ["toReplace", "replacement", "term"] $ lets [- "mapping">: lambdas ["recurse", "inner"] $- match _Term (Just $ var "recurse" @@ var "inner") [- _Term_function>>: match _Function (Just $ var "recurse" @@ var "inner") [- _Function_lambda>>: lambda "l" $ Logic.ifElse- (Equality.equal (Core.lambdaParameter $ var "l") (var "toReplace"))- (var "inner")- (var "recurse" @@ var "inner")],- _Term_variable>>: lambda "name" $ Logic.ifElse- (Equality.equal (var "name") (var "toReplace"))- (var "replacement")- (var "inner")] @@ var "inner"]- $ ref Rewriting.rewriteTermDef @@ var "mapping" @@ var "term",-- "applyElimination">: lambdas ["elm", "reducedArg"] $- match _Elimination Nothing [- _Elimination_record>>: lambda "proj" $- Flows.bind (ref ExtractCore.recordDef @@ (Core.projectionTypeName $ var "proj") @@ (ref Rewriting.deannotateTermDef @@ var "reducedArg")) $- lambda "fields" $ lets [- "matchingFields">: Lists.filter- (lambda "f" $ Equality.equal (Core.fieldName $ var "f") (Core.projectionField $ var "proj"))- (var "fields")]- $ Logic.ifElse- (Lists.null $ var "matchingFields")- (Flows.fail $ Strings.cat $ list [- string "no such field: ",- unwrap _Name @@ (Core.projectionField $ var "proj"),- string " in ",- unwrap _Name @@ (Core.projectionTypeName $ var "proj"),- string " record"])- (Flows.pure $ Core.fieldTerm $ Lists.head $ var "matchingFields"),- _Elimination_union>>: lambda "cs" $- Flows.bind (ref ExtractCore.injectionDef @@ (Core.caseStatementTypeName $ var "cs") @@ var "reducedArg") $- lambda "field" $ lets [- "matchingFields">: Lists.filter- (lambda "f" $ Equality.equal (Core.fieldName $ var "f") (Core.fieldName $ var "field"))- (Core.caseStatementCases $ var "cs")]- $ Logic.ifElse (Lists.null $ var "matchingFields")- (Optionals.maybe- (Flows.fail $ Strings.cat $ list [- string "no such field ",- unwrap _Name @@ (Core.fieldName $ var "field"),- string " in ",- unwrap _Name @@ (Core.caseStatementTypeName $ var "cs"),- string " case statement"])- (unaryFunction Flows.pure)- (Core.caseStatementDefault $ var "cs"))- (Flows.pure $ Core.termApplication $ Core.application- (Core.fieldTerm $ Lists.head $ var "matchingFields")- (Core.fieldTerm $ var "field")),- _Elimination_wrap>>: lambda "name" $ ref ExtractCore.wrapDef @@ var "name" @@ var "reducedArg"] @@ var "elm",-- "applyIfNullary">: lambdas ["eager", "original", "args"] $ lets [- "stripped">: ref Rewriting.deannotateTermDef @@ var "original"]- $ cases _Term (var "stripped") (Just $ Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args") [- _Term_application>>: lambda "app" $ var "applyIfNullary" @@ var "eager" @@- (Core.applicationFunction $ var "app") @@- (Lists.cons (Core.applicationArgument $ var "app") (var "args")),- _Term_function>>: match _Function Nothing [- _Function_elimination>>: lambda "elm" $- Logic.ifElse (Lists.null $ var "args")- (Flows.pure $ var "original")- (lets [- "arg">: Lists.head $ var "args",- "remainingArgs">: Lists.tail $ var "args"]- $ Flows.bind (var "reduceArg" @@ var "eager" @@ (ref Rewriting.deannotateTermDef @@ var "arg")) $- lambda "reducedArg" $- Flows.bind (Flows.bind (var "applyElimination" @@ var "elm" @@ var "reducedArg") (var "reduce" @@ var "eager")) $- lambda "reducedResult" $ var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs"),- _Function_lambda>>: lambda "l" $- Logic.ifElse (Lists.null $ var "args")- (Flows.pure $ var "original")- (lets [- "param">: Core.lambdaParameter $ var "l",- "body">: Core.lambdaBody $ var "l",- "arg">: Lists.head $ var "args",- "remainingArgs">: Lists.tail $ var "args"]- $ Flows.bind (var "reduce" @@ var "eager" @@ (ref Rewriting.deannotateTermDef @@ var "arg")) $- lambda "reducedArg" $- Flows.bind (var "reduce" @@ var "eager" @@ (var "replaceFreeTypeVariable" @@ var "param" @@ var "reducedArg" @@ var "body")) $- lambda "reducedResult" $ var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs"),- _Function_primitive>>: lambda "name" $- Flows.bind (ref Lexical.requirePrimitiveDef @@ var "name") $ lambda "prim" $- lets [- "arity">: ref Arity.primitiveArityDef @@ var "prim"]- $ Logic.ifElse (Equality.gt (var "arity") (Lists.length $ var "args"))- (Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args")- (lets [- "argList">: Lists.take (var "arity") (var "args"),- "remainingArgs">: Lists.drop (var "arity") (var "args")]- $ Flows.bind (Flows.mapList (var "reduceArg" @@ var "eager") (var "argList")) $ lambda "reducedArgs" $- Flows.bind- (Flows.bind- (Graph.primitiveImplementation (var "prim") @@ var "reducedArgs")- (var "reduce" @@ var "eager")) $ lambda "reducedResult" $- var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs")],- _Term_variable>>: lambda "v" $ Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args"],- "mapping">: lambdas ["recurse", "mid"] $- Flows.bind- (Logic.ifElse (var "doRecurse" @@ var "eager" @@ var "mid")- (var "recurse" @@ var "mid")- (Flows.pure $ var "mid")) $- lambda "inner" $ var "applyIfNullary" @@ var "eager" @@ var "inner" @@ (list [])]- $ ref Rewriting.rewriteTermMDef @@ var "mapping" @@ var "term"--termIsClosedDef :: TBinding (Term -> Bool)-termIsClosedDef = define "termIsClosed" $- doc "Whether a term is closed, i.e. represents a complete program" $- lambda "term" $ Sets.null $ ref Rewriting.freeVariablesInTermDef @@ var "term"--termIsValueDef :: TBinding (Graph -> Term -> Bool)-termIsValueDef = define "termIsValue" $- doc "Whether a term has been fully reduced to a value" $- lambda "g" $ lambda "term" $ lets [- "forList">: lambda "els" $ Lists.foldl (lambda "b" $ lambda "t" $ Logic.and (var "b") (ref termIsValueDef @@ var "g" @@ var "t")) true (var "els"),- "checkField">: lambda "f" $ ref termIsValueDef @@ var "g" @@ Core.fieldTerm (var "f"),- "checkFields">: lambda "fields" $ Lists.foldl (lambda "b" $ lambda "f" $ Logic.and (var "b") (var "checkField" @@ var "f")) true (var "fields"),- "functionIsValue">: lambda "f" $- match _Function Nothing [- _Function_elimination>>: lambda "e" $- match _Elimination Nothing [- _Elimination_wrap>>: constant true,- _Elimination_record>>: constant true,- _Elimination_union>>: lambda "cs" $- Logic.and (var "checkFields" @@ Core.caseStatementCases (var "cs"))- (Optionals.maybe true (ref termIsValueDef @@ var "g") (Core.caseStatementDefault $ var "cs"))]- @@ var "e",- _Function_lambda>>: lambda "l" $ ref termIsValueDef @@ var "g" @@ Core.lambdaBody (var "l"),- _Function_primitive>>: constant true]- @@ var "f"]- $ match _Term (Just false) [- _Term_application>>: constant false,- _Term_literal>>: constant true,- _Term_function>>: lambda "f" $ var "functionIsValue" @@ var "f",- _Term_list>>: lambda "els" $ var "forList" @@ var "els",- _Term_map>>: lambda "m" $- Lists.foldl (lambda "b" $ lambda "kv" $- Logic.and (var "b") $ Logic.and- (ref termIsValueDef @@ var "g" @@ first (var "kv"))- (ref termIsValueDef @@ var "g" @@ second (var "kv")))- true $ Maps.toList (var "m"),- _Term_optional>>: lambda "m" $- Optionals.maybe true (ref termIsValueDef @@ var "g") (var "m"),- _Term_record>>: lambda "r" $ var "checkFields" @@ Core.recordFields (var "r"),- _Term_set>>: lambda "s" $ var "forList" @@ Sets.toList (var "s"),- _Term_union>>: lambda "i" $ var "checkField" @@ Core.injectionField (var "i"),- _Term_unit>>: constant true,- _Term_variable>>: constant false]- @@ (ref Rewriting.deannotateTermDef @@ var "term")+module Hydra.Sources.Kernel.Terms.Reduction where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ alphaConvert, betaReduceType, contractTerm, countPrimitiveInvocations, etaReduceTerm, etaExpandTerm, etaExpandTermNew, etaExpansionArity, etaExpandTypedTerm,+ reduceTerm, termIsClosed, termIsValue)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Arity as Arity+import qualified Hydra.Sources.Kernel.Terms.Checking as Checking+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as ExtractCore+import qualified Hydra.Sources.Kernel.Terms.Hoisting as Hoisting+import qualified Hydra.Sources.Kernel.Terms.Inference as Inference+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Schemas as Schemas+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+++ns :: Namespace+ns = Namespace "hydra.reduction"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Arity.ns, Checking.ns, ExtractCore.ns, Hoisting.ns, Inference.ns, Lexical.ns,+ Rewriting.ns,+ Schemas.ns, ShowCore.ns]+ kernelTypesNamespaces $+ Just "Functions for reducing terms and types, i.e. performing computations."+ where+ elements = [+ toBinding alphaConvert,+ toBinding betaReduceType,+ toBinding contractTerm,+ toBinding countPrimitiveInvocations,+ toBinding etaReduceTerm,+ toBinding etaExpandTerm,+ toBinding etaExpandTermNew,+ toBinding etaExpansionArity,+ toBinding etaExpandTypedTerm,+ toBinding reduceTerm,+ toBinding termIsClosed,+ toBinding termIsValue]++alphaConvert :: TBinding (Name -> Name -> Term -> Term)+alphaConvert = define "alphaConvert" $+ doc "Alpha convert a variable in a term" $+ "vold" ~> "vnew" ~> "term" ~>+ Rewriting.replaceFreeTermVariable @@ var "vold" @@ (Core.termVariable $ var "vnew") @@ var "term"++-- Note: this is eager beta reduction, in that we always descend into subtypes,+-- and always reduce the right-hand side of an application prior to substitution+betaReduceType :: TBinding (Type -> Flow Graph Type)+betaReduceType = define "betaReduceType" $+ doc "Eagerly beta-reduce a type by substituting type arguments into type lambdas" $+ "typ" ~>+ "reduceApp" <~ ("app" ~>+ "lhs" <~ Core.applicationTypeFunction (var "app") $+ "rhs" <~ Core.applicationTypeArgument (var "app") $+ cases _Type (var "lhs") Nothing [+ _Type_annotated>>: "at" ~>+ "a" <<~ var "reduceApp" @@ (Core.applicationType+ (Core.annotatedTypeBody $ var "at")+ (var "rhs")) $+ Flows.pure $ Core.typeAnnotated $ Core.annotatedType (var "a") (Core.annotatedTypeAnnotation $ var "at"),+ _Type_forall>>: "ft" ~>+ betaReduceType @@ (Rewriting.replaceFreeTypeVariable+ @@ (Core.forallTypeParameter $ var "ft")+ @@ var "rhs"+ @@ (Core.forallTypeBody $ var "ft")),+ _Type_variable>>: "name" ~>+ "t'" <<~ Schemas.requireType @@ var "name" $+ betaReduceType @@ (Core.typeApplication $ Core.applicationType (var "t'") (var "rhs"))]) $+ "mapExpr" <~ ("recurse" ~> "t" ~>+ "findApp" <~ ("r" ~> cases _Type (var "r")+ (Just $ Flows.pure $ var "r") [+ _Type_application>>: "a" ~> var "reduceApp" @@ var "a"]) $+ "r" <<~ var "recurse" @@ var "t" $+ var "findApp" @@ var "r") $+ Rewriting.rewriteTypeM @@ var "mapExpr" @@ var "typ"++contractTerm :: TBinding (Term -> Term)+contractTerm = define "contractTerm" $+ doc ("Apply the special rules:\n"+ <> " ((\\x.e1) e2) == e1, where x does not appear free in e1\n"+ <> " and\n"+ <> " ((\\x.e1) e2) = e1[x/e2]\n"+ <> "These are both limited forms of beta reduction which help to \"clean up\" a term without fully evaluating it.") $+ "term" ~>+ "rewrite" <~ ("recurse" ~> "t" ~>+ "rec" <~ var "recurse" @@ var "t" $+ cases _Term (var "rec")+ (Just $ var "rec") [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ cases _Term (Rewriting.deannotateTerm @@ var "lhs")+ (Just $ var "rec") [+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "rec") [+ _Function_lambda>>: "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ Logic.ifElse (Rewriting.isFreeVariableInTerm @@ var "v" @@ var "body")+ (var "body")+ (Rewriting.replaceFreeTermVariable @@ var "v" @@ var "rhs" @@ var "body")]]]) $+ Rewriting.rewriteTerm @@ var "rewrite" @@ var "term"++-- For demo purposes. This should be generalized to enable additional side effects of interest.+countPrimitiveInvocations :: TBinding Bool+countPrimitiveInvocations = define "countPrimitiveInvocations" true++-- TODO: see notes on etaExpansionArity+etaExpandTerm :: TBinding (Graph -> Term -> Term)+etaExpandTerm = define "etaExpandTerm" $+ doc ("Recursively transform arbitrary terms like 'add 42' into terms like '\\x.add 42 x', in which the implicit"+ <> " parameters of primitive functions and eliminations are made into explicit lambda parameters."+ <> " Variable references are not expanded."+ <> " This is useful for targets like Python with weaker support for currying than Hydra or Haskell."+ <> " Note: this is a \"trusty\" function which assumes the graph is well-formed, i.e. no dangling references.") $+ "graph" ~> "term" ~>+ "expand" <~ ("args" ~> "arity" ~> "t" ~>+ "apps" <~ Lists.foldl+ ("lhs" ~> "arg" ~> Core.termApplication $ Core.application (var "lhs") (var "arg"))+ (var "t")+ (var "args") $+ "is" <~ Logic.ifElse (Equality.lte (var "arity") (Lists.length $ var "args"))+ (list ([] :: [TTerm Int]))+ (Math.range (int32 1) (Math.sub (var "arity") (Lists.length $ var "args"))) $+ "pad" <~ ("indices" ~> "t" ~>+ Logic.ifElse (Lists.null $ var "indices")+ (var "t")+ (Core.termFunction $ Core.functionLambda $+ Core.lambda (Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ Lists.head $ var "indices")) nothing $+ var "pad" @@ Lists.tail (var "indices") @@+ (Core.termApplication $ Core.application (var "t") $ Core.termVariable $+ Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ Lists.head $ var "indices")))) $+ var "pad" @@ var "is" @@ var "apps") $+ "rewrite" <~ ("args" ~> "recurse" ~> "t" ~>+ "afterRecursion" <~ ("term" ~>+ var "expand" @@ var "args" @@ (etaExpansionArity @@ var "graph" @@ var "term") @@ var "term") $+ "t2" <~ Rewriting.detypeTerm @@ var "t" $+ cases _Term (var "t2")+ (Just $ var "afterRecursion" @@ (var "recurse" @@ var "t2")) [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ "erhs" <~ var "rewrite" @@ (list ([] :: [TTerm Term])) @@ var "recurse" @@ var "rhs" $+ var "rewrite" @@ (Lists.cons (var "erhs") (var "args")) @@ var "recurse" @@ var "lhs"]) $+ contractTerm @@ (Rewriting.rewriteTerm @@ (var "rewrite" @@ list ([] :: [TTerm Term])) @@ var "term")++-- | Eta-expand a term using TypeContext for type lookups. This is a pure function that does not+-- require type inference, instead relying on the TypeContext being properly populated with types+-- for all in-scope variables.+--+-- The key differences from etaExpandTypedTerm:+-- 1. Pure (no Flow monad needed) because we look up types directly from the context+-- 2. Manually tracks TypeContext when entering lambdas, lets, and type lambdas+-- 3. Preserves existing type annotations where possible+etaExpandTermNew :: TBinding (TypeContext -> Term -> Term)+etaExpandTermNew = define "etaExpandTermNew" $+ doc ("Recursively transform terms to eliminate partial application, e.g. 'add 42' becomes '\\x.add 42 x'."+ <> " Uses the TypeContext to look up types for arity calculation."+ <> " Bare primitives and variables are NOT expanded; eliminations and partial applications are."+ <> " This version properly tracks the TypeContext through nested scopes.") $+ "tx0" ~> "term0" ~>++ -- termArityWithContext: compute arity of a term using TypeContext for lookups+ "termArityWithContext" <~ ("tx" ~> "term" ~>+ cases _Term (var "term")+ (Just $ int32 0) [+ _Term_annotated>>: "at" ~>+ var "termArityWithContext" @@ var "tx" @@ Core.annotatedTermBody (var "at"),+ _Term_application>>: "app" ~>+ Math.sub (var "termArityWithContext" @@ var "tx" @@ Core.applicationFunction (var "app")) (int32 1),+ _Term_function>>: "f" ~> cases _Function (var "f") Nothing [+ _Function_elimination>>: constant $ int32 1,+ _Function_lambda>>: constant $ int32 0,+ _Function_primitive>>: "name" ~>+ optCases (Maps.lookup (var "name") (Typing.inferenceContextPrimitiveTypes $ Typing.typeContextInferenceContext $ var "tx"))+ (int32 0) Arity.typeSchemeArity],+ _Term_let>>: "l" ~>+ var "termArityWithContext"+ @@ (Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "tx" @@ var "l")+ @@ Core.letBody (var "l"),+ _Term_typeLambda>>: "tl" ~>+ var "termArityWithContext"+ @@ (Schemas.extendTypeContextForTypeLambda @@ var "tx" @@ var "tl")+ @@ Core.typeLambdaBody (var "tl"),+ _Term_typeApplication>>: "tat" ~>+ var "termArityWithContext" @@ var "tx" @@ Core.typeApplicationTermBody (var "tat"),+ _Term_variable>>: "name" ~>+ optCases (Maps.lookup (var "name") (Typing.typeContextTypes $ var "tx"))+ (int32 0) Arity.typeArity]) $++ -- domainTypes: extract domain types from a function type, returning a list of Maybe Type+ -- For a type A -> B -> C with n=2, returns [Just A, Just B]+ "domainTypes" <~ ("n" ~> "mt" ~>+ Logic.ifElse (Equality.lte (var "n") (int32 0))+ (list ([] :: [TTerm (Maybe Type)]))+ (optCases (var "mt")+ -- No type available: return n copies of Nothing+ (Lists.map (constant nothing) (Math.range (int32 1) (var "n")))+ ("typ" ~>+ cases _Type (var "typ")+ (Just $ Lists.map (constant nothing) (Math.range (int32 1) (var "n"))) [+ _Type_function>>: "ftyp" ~>+ Lists.cons (just $ Core.functionTypeDomain $ var "ftyp")+ (var "domainTypes" @@ Math.sub (var "n") (int32 1) @@ just (Core.functionTypeCodomain $ var "ftyp")),+ _Type_annotated>>: "at" ~>+ var "domainTypes" @@ var "n" @@ just (Core.annotatedTypeBody $ var "at"),+ _Type_application>>: "atyp" ~>+ var "domainTypes" @@ var "n" @@ just (Core.applicationTypeFunction $ var "atyp"),+ _Type_forall>>: "ft" ~>+ var "domainTypes" @@ var "n" @@ just (Core.forallTypeBody $ var "ft")]))) $++ -- peelFunctionDomains: given a Maybe Type and a count, peel n function type domains.+ -- Returns the remaining type after stripping n arrow domains.+ -- For Just (A -> B -> C) with n=1, returns Just (B -> C).+ "peelFunctionDomains" <~ ("mtyp" ~> "n" ~>+ Logic.ifElse (Equality.lte (var "n") (int32 0))+ (var "mtyp")+ (optCases (var "mtyp")+ nothing+ ("typ" ~>+ cases _Type (var "typ")+ (Just nothing) [+ _Type_function>>: "ftyp" ~>+ var "peelFunctionDomains" @@ just (Core.functionTypeCodomain $ var "ftyp") @@ Math.sub (var "n") (int32 1),+ _Type_annotated>>: "at" ~>+ var "peelFunctionDomains" @@ just (Core.annotatedTypeBody $ var "at") @@ var "n",+ _Type_application>>: "atyp" ~>+ var "peelFunctionDomains" @@ just (Core.applicationTypeFunction $ var "atyp") @@ var "n",+ _Type_forall>>: "ft" ~>+ var "peelFunctionDomains" @@ just (Core.forallTypeBody $ var "ft") @@ var "n"]))) $++ -- expand: apply args to head and pad with lambdas if needed+ -- alwaysPad: if true, pad even when args is empty (for eliminations)+ -- headTyp: Maybe Type of the head term (before args are applied)+ "expand" <~ ("alwaysPad" ~> "args" ~> "arity" ~> "headTyp" ~> "head" ~>+ "applied" <~ Lists.foldl+ ("lhs" ~> "arg" ~> Core.termApplication (Core.application (var "lhs") (var "arg")))+ (var "head") (var "args") $+ "numArgs" <~ Lists.length (var "args") $+ "needed" <~ Math.sub (var "arity") (var "numArgs") $+ -- Pad if: (needed > 0) AND (alwaysPad OR numArgs > 0)+ Logic.ifElse (Logic.and (Equality.gt (var "needed") (int32 0))+ (Logic.or (var "alwaysPad") (Equality.gt (var "numArgs") (int32 0))))+ -- Pad with lambdas: first build fully applied term, then wrap with lambdas+ ("indices" <~ Math.range (int32 1) (var "needed") $+ -- Compute domain types for the wrapper lambdas from the head's type after applying numArgs+ "remainingType" <~ var "peelFunctionDomains" @@ var "headTyp" @@ var "numArgs" $+ "domains" <~ var "domainTypes" @@ var "needed" @@ var "remainingType" $+ -- Step 1: Build fully applied term: applied v1 v2 ... vn+ -- Also compute the codomain type (type of fullyApplied) for annotation+ "codomainType" <~ var "peelFunctionDomains" @@ var "remainingType" @@ var "needed" $+ "fullyAppliedRaw" <~ Lists.foldl+ ("body" ~> "i" ~>+ "vn" <~ Core.name (Strings.cat2 (string "v") (Literals.showInt32 $ var "i")) $+ Core.termApplication $ Core.application (var "body") (Core.termVariable $ var "vn"))+ (var "applied") (var "indices") $+ -- Annotate fullyApplied with its codomain type so downstream coders can determine the return type+ "fullyApplied" <~ Maybes.maybe (var "fullyAppliedRaw")+ ("ct" ~> Core.termAnnotated $ Core.annotatedTerm (var "fullyAppliedRaw")+ (Maps.singleton (Core.name (string "type")) (Phantoms.encoderFor _Type @@ var "ct")))+ (var "codomainType") $+ -- Step 2: Wrap with lambdas from inside out by reversing indices: \v1 -> \v2 -> ... -> fullyApplied+ -- Using foldl with reversed indices+domains gives us: for [2,1], wrap v2 first (innermost), then v1 (outermost)+ -- Zip indices with domains to pair each lambda with its domain type+ "indexedDomains" <~ Lists.zip (var "indices") (var "domains") $+ Lists.foldl+ ("body" ~> "idPair" ~>+ "i" <~ Pairs.first (var "idPair") $+ "dom" <~ Pairs.second (var "idPair") $+ "vn" <~ Core.name (Strings.cat2 (string "v") (Literals.showInt32 $ var "i")) $+ Core.termFunction $ Core.functionLambda $ Core.lambda (var "vn") (var "dom") (var "body"))+ (var "fullyApplied") (Lists.reverse (var "indexedDomains")))+ (var "applied")) $++ -- rewriteWithArgs: tracks accumulated args as we descend into application spines+ -- This is a recursive let binding that calls itself directly+ "rewriteWithArgs" <~ ("args" ~> "tx" ~> "term" ~>+ -- recurse is shorthand for calling rewriteWithArgs with empty args+ "recurse" <~ ("tx1" ~> "term1" ~> var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx1" @@ var "term1") $++ -- termHeadType: extract the type of a term's "head" (the variable/primitive at its core)+ -- by following annotations, lets, type applications, and type lambdas.+ -- Returns Nothing for terms whose head type can't be determined from the context.+ "termHeadType" <~ ("tx2" ~> "trm2" ~>+ cases _Term (var "trm2")+ (Just nothing) [+ _Term_annotated>>: "at2" ~>+ var "termHeadType" @@ var "tx2" @@ Core.annotatedTermBody (var "at2"),+ _Term_function>>: "f2" ~> cases _Function (var "f2") (Just nothing) [+ _Function_primitive>>: "pn2" ~>+ Maybes.map ("ts2" ~> Core.typeSchemeType $ var "ts2")+ (Maps.lookup (var "pn2") (Typing.inferenceContextPrimitiveTypes $ Typing.typeContextInferenceContext $ var "tx2"))],+ _Term_let>>: "l2" ~>+ var "termHeadType"+ @@ (Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "tx2" @@ var "l2")+ @@ Core.letBody (var "l2"),+ _Term_typeLambda>>: "tl2" ~>+ var "termHeadType"+ @@ (Schemas.extendTypeContextForTypeLambda @@ var "tx2" @@ var "tl2")+ @@ Core.typeLambdaBody (var "tl2"),+ _Term_typeApplication>>: "tat2" ~>+ -- Get the head type of the body, then substitute forall parameter with the type argument+ Maybes.bind (var "termHeadType" @@ var "tx2" @@ Core.typeApplicationTermBody (var "tat2"))+ ("htyp2" ~> cases _Type (var "htyp2") (Just $ just $ var "htyp2") [+ _Type_forall>>: "ft2" ~>+ just $ Rewriting.replaceFreeTypeVariable+ @@ Core.forallTypeParameter (var "ft2")+ @@ Core.typeApplicationTermType (var "tat2")+ @@ Core.forallTypeBody (var "ft2")]),+ _Term_variable>>: "vn2" ~>+ Maps.lookup (var "vn2") (Typing.typeContextTypes $ var "tx2")]) $++ -- afterRecursion: apply expansion logic after subterms have been processed+ "afterRecursion" <~ ("trm" ~>+ "arity" <~ var "termArityWithContext" @@ var "tx" @@ var "trm" $+ "hType" <~ var "termHeadType" @@ var "tx" @@ var "trm" $+ var "expand" @@ false @@ var "args" @@ var "arity" @@ var "hType" @@ var "trm") $++ -- Helper for processing fields (used in records, unions, but NOT case statement branches)+ "forField" <~ ("f" ~> Core.fieldWithTerm (var "recurse" @@ var "tx" @@ Core.fieldTerm (var "f")) (var "f")) $++ -- Helper for case statement branches - forces expansion of the branch body+ -- This is needed because case branches represent partial function values that need full expansion+ "forCaseBranch" <~ ("f" ~>+ "branchBody" <~ var "recurse" @@ var "tx" @@ Core.fieldTerm (var "f") $+ "arty" <~ var "termArityWithContext" @@ var "tx" @@ var "branchBody" $+ "branchHType" <~ var "termHeadType" @@ var "tx" @@ var "branchBody" $+ Core.fieldWithTerm (var "expand" @@ true @@ list ([] :: [TTerm Term]) @@ var "arty" @@ var "branchHType" @@ var "branchBody") (var "f")) $++ -- Helper for eliminations+ "forElimination" <~ ("elm" ~> cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "p" ~> Core.eliminationRecord (var "p"),+ _Elimination_union>>: "cs" ~> Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map ("t1" ~> var "recurse" @@ var "tx" @@ var "t1") (Core.caseStatementDefault $ var "cs"))+ (Lists.map (var "forCaseBranch") (Core.caseStatementCases $ var "cs")),+ _Elimination_wrap>>: "nm" ~> Core.eliminationWrap $ var "nm"]) $++ -- Helper for maps+ "forMap" <~ ("mp" ~>+ "forPair" <~ ("pr" ~> pair (var "recurse" @@ var "tx" @@ Pairs.first (var "pr"))+ (var "recurse" @@ var "tx" @@ Pairs.second (var "pr"))) $+ Maps.fromList $ Lists.map (var "forPair") $ Maps.toList $ var "mp") $++ cases _Term (var "term") Nothing [+ -- Annotated: recurse into body, preserve annotation+ _Term_annotated>>: "at" ~> var "afterRecursion" @@ Core.termAnnotated (Core.annotatedTerm+ (var "recurse" @@ var "tx" @@ Core.annotatedTermBody (var "at"))+ (Core.annotatedTermAnnotation $ var "at")),++ -- Application: process RHS with empty args, then descend into LHS with RHS added to args+ _Term_application>>: "app" ~>+ "rhs" <~ var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx" @@ Core.applicationArgument (var "app") $+ var "rewriteWithArgs" @@ Lists.cons (var "rhs") (var "args") @@ var "tx" @@ Core.applicationFunction (var "app"),++ -- Either: recurse into left or right+ _Term_either>>: "e" ~> var "afterRecursion" @@ Core.termEither (Eithers.either_+ ("l" ~> left $ var "recurse" @@ var "tx" @@ var "l")+ ("r" ~> right $ var "recurse" @@ var "tx" @@ var "r")+ (var "e")),++ -- Function: special handling+ _Term_function>>: "fn" ~> cases _Function (var "fn")+ Nothing [+ _Function_elimination>>: "elm" ~>+ -- Recurse into the elimination, then expand+ -- Only pad union eliminations (case statements); record/wrap eliminations are handled by the language coder+ "padElim" <~ cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "_" ~> false,+ _Elimination_union>>: "_" ~> true,+ _Elimination_wrap>>: "_" ~> false] $+ "elimTerm" <~ (Core.termFunction $ Core.functionElimination $ var "forElimination" @@ var "elm") $+ -- For union eliminations, compute the head type as FunctionType(TypeVariable(typeName), TypeUnit)+ -- This provides the domain type needed for eta-expanded lambda parameters+ "elimHeadType" <~ cases _Elimination (var "elm") (Just nothing) [+ _Elimination_union>>: "cs2" ~>+ just $ Core.typeFunction $ Core.functionType+ (Core.typeVariable $ Core.caseStatementTypeName $ var "cs2")+ Core.typeUnit] $+ var "expand" @@ var "padElim" @@ var "args" @@ (int32 1) @@ var "elimHeadType" @@ var "elimTerm",+ _Function_lambda>>: "lm" ~>+ "tx1" <~ Schemas.extendTypeContextForLambda @@ var "tx" @@ var "lm" $+ "body" <~ var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx1" @@ Core.lambdaBody (var "lm") $+ "result" <~ Core.termFunction (Core.functionLambda $+ Core.lambda (Core.lambdaParameter $ var "lm") (Core.lambdaDomain $ var "lm") (var "body")) $+ "arty" <~ var "termArityWithContext" @@ var "tx" @@ var "result" $+ -- Lambda type is not in the context; pass Nothing (lambdas have arity 0 so expand is a no-op anyway)+ var "expand" @@ false @@ var "args" @@ var "arty" @@ nothing @@ var "result",+ _Function_primitive>>: "pn" ~>+ -- Don't expand if bare; look up primitive type for lambda domain annotations+ "arty" <~ var "termArityWithContext" @@ var "tx" @@ var "term" $+ "primType" <~ Maybes.map ("ts" ~> Core.typeSchemeType $ var "ts")+ (Maps.lookup (var "pn") (Typing.inferenceContextPrimitiveTypes $ Typing.typeContextInferenceContext $ var "tx")) $+ var "expand" @@ false @@ var "args" @@ var "arty" @@ var "primType" @@ var "term"],++ -- Let: extend context for bindings and body+ _Term_let>>: "lt" ~>+ "tx1" <~ Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "tx" @@ var "lt" $+ "mapBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx1" @@ Core.bindingTerm (var "b"))+ (Core.bindingType $ var "b")) $+ "result" <~ Core.termLet (Core.let_+ (Lists.map (var "mapBinding") (Core.letBindings $ var "lt"))+ (var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx1" @@ Core.letBody (var "lt"))) $+ var "afterRecursion" @@ var "result",++ -- List: recurse into elements+ _Term_list>>: "els" ~> var "afterRecursion" @@+ (Core.termList $ Lists.map ("el" ~> var "recurse" @@ var "tx" @@ var "el") (var "els")),++ -- Literal: no recursion needed+ _Term_literal>>: "v" ~> Core.termLiteral $ var "v",++ -- Map: recurse into keys and values+ _Term_map>>: "mp" ~> var "afterRecursion" @@ (Core.termMap $ var "forMap" @@ var "mp"),++ -- Maybe: recurse into value if present+ _Term_maybe>>: "mb" ~> var "afterRecursion" @@+ (Core.termMaybe $ Maybes.map ("v" ~> var "recurse" @@ var "tx" @@ var "v") (var "mb")),++ -- Pair: recurse into both elements+ _Term_pair>>: "pr" ~> var "afterRecursion" @@ (Core.termPair $ pair+ (var "recurse" @@ var "tx" @@ Pairs.first (var "pr"))+ (var "recurse" @@ var "tx" @@ Pairs.second (var "pr"))),++ -- Record: recurse into fields+ _Term_record>>: "rc" ~> var "afterRecursion" @@ (Core.termRecord $ Core.record+ (Core.recordTypeName $ var "rc")+ (Lists.map (var "forField") (Core.recordFields $ var "rc"))),++ -- Set: recurse into elements+ _Term_set>>: "st" ~> var "afterRecursion" @@+ (Core.termSet $ Sets.fromList $ Lists.map ("el" ~> var "recurse" @@ var "tx" @@ var "el") $ Sets.toList (var "st")),++ -- TypeApplication: recurse into body+ _Term_typeApplication>>: "tt" ~> var "afterRecursion" @@ (Core.termTypeApplication $ Core.typeApplicationTerm+ (var "recurse" @@ var "tx" @@ Core.typeApplicationTermBody (var "tt"))+ (Core.typeApplicationTermType $ var "tt")),++ -- TypeLambda: extend context for body+ _Term_typeLambda>>: "tl" ~>+ "tx1" <~ Schemas.extendTypeContextForTypeLambda @@ var "tx" @@ var "tl" $+ "result" <~ Core.termTypeLambda (Core.typeLambda+ (Core.typeLambdaParameter $ var "tl")+ (var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx1" @@ Core.typeLambdaBody (var "tl"))) $+ var "afterRecursion" @@ var "result",++ -- Union: recurse into injection field+ _Term_union>>: "inj" ~> var "afterRecursion" @@ (Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "inj")+ (var "forField" @@ Core.injectionField (var "inj"))),++ -- Unit: no recursion needed+ _Term_unit>>: constant Core.termUnit,++ -- Variable: don't expand if bare; look up type for lambda domain annotations+ _Term_variable>>: "vn" ~>+ "arty" <~ var "termArityWithContext" @@ var "tx" @@ var "term" $+ "varType" <~ Maps.lookup (var "vn") (Typing.typeContextTypes $ var "tx") $+ var "expand" @@ false @@ var "args" @@ var "arty" @@ var "varType" @@ var "term",++ -- Wrap: recurse into body+ _Term_wrap>>: "wt" ~> var "afterRecursion" @@ (Core.termWrap $ Core.wrappedTerm+ (Core.wrappedTermTypeName $ var "wt")+ (var "recurse" @@ var "tx" @@ Core.wrappedTermBody (var "wt")))]) $++ contractTerm @@ (var "rewriteWithArgs" @@ list ([] :: [TTerm Term]) @@ var "tx0" @@ var "term0")++-- TODO: this function probably needs to be replaced with a function which takes not only a Graph, but a TypeContext.+-- etaExpansionArity won't give the correct answer unless it has access to the full lexical environment+-- of each subterm in which it is applied, including lambda-bound variables as well as nested let-bound variables.+-- The new function need not be monadic, because we don't need to call typeOf; it just needs accurate type lookups.+etaExpansionArity :: TBinding (Graph -> Term -> Int)+etaExpansionArity = define "etaExpansionArity" $+ doc ("Calculate the arity for eta expansion"+ <> " Note: this is a \"trusty\" function which assumes the graph is well-formed, i.e. no dangling references.") $+ "graph" ~> "term" ~> cases _Term (var "term")+ (Just $ int32 0) [+ _Term_annotated>>: "at" ~>+ etaExpansionArity @@ var "graph" @@ Core.annotatedTermBody (var "at"),+ _Term_application>>: "app" ~> Math.sub+ (etaExpansionArity @@ var "graph" @@ Core.applicationFunction (var "app"))+ (int32 1),+ _Term_function>>: "f" ~> cases _Function (var "f")+ Nothing [+ _Function_elimination>>: constant $ int32 1,+ _Function_lambda>>: constant $ int32 0,+ _Function_primitive>>: "name" ~> Arity.primitiveArity+ @@ (Maybes.fromJust (Lexical.lookupPrimitive @@ var "graph" @@ var "name"))],+ _Term_typeLambda>>: "ta" ~> etaExpansionArity @@ var "graph" @@ Core.typeLambdaBody (var "ta"),+ _Term_typeApplication>>: "tt" ~> etaExpansionArity @@ var "graph" @@ Core.typeApplicationTermBody (var "tt"),+ _Term_variable>>: "name" ~>+ -- Note: we assume that the graph is fully typed.+ Maybes.maybe (int32 0)+ ("ts" ~> Arity.typeArity @@ (Core.typeSchemeType $ var "ts"))+ (Maybes.bind+ (Lexical.lookupElement @@ var "graph" @@ var "name")+ ("b" ~> Core.bindingType $ var "b"))]++-- TODO: add lambda domains as part of the rewriting process, so inference does not need to be performed again.+etaExpandTypedTerm :: TBinding (TypeContext -> Term -> Flow s Term)+etaExpandTypedTerm = define "etaExpandTypedTerm" $+ doc ("Recursively transform arbitrary terms like 'add 42' into terms like '\\x.add 42 x',"+ <> " eliminating partial application. Variable references are not expanded."+ <> " This is useful for targets like Python with weaker support for currying than Hydra or Haskell."+ <> " Note: this is a \"trusty\" function which assumes the graph is well-formed, i.e. no dangling references."+ <> " It also assumes that type inference has already been performed."+ <> " After eta expansion, type inference needs to be performed again, as new, untyped lambdas may have been added."+ ) $+ "tx0" ~> "term0" ~>+ "rewrite" <~ ("topLevel" ~> "forced" ~> "typeArgs" ~> "recurse" ~> "tx" ~> "term" ~>+ "rewriteSpine" <~ ("term" ~> cases _Term (var "term")+ (Just $ var "rewrite" @@ false @@ false @@ list ([] :: [TTerm Type]) @@ var "recurse" @@ var "tx" @@ var "term") [+ _Term_annotated>>: "at" ~>+ "body" <<~ var "rewriteSpine" @@ Core.annotatedTermBody (var "at") $+ "ann" <~ Core.annotatedTermAnnotation (var "at") $+ produce (Core.termAnnotated $ Core.annotatedTerm (var "body") (var "ann")),+ _Term_application>>: "a" ~>+ "l" <~ Logic.ifElse false (list [Core.typeLiteral Core.literalTypeString]) (list ([] :: [TTerm Type])) $ -- TODO: hack for type checking+ "lhs" <<~ var "rewriteSpine" @@ Core.applicationFunction (var "a") $+ "rhs" <<~ var "rewrite" @@ true @@ false @@ var "l" @@ var "recurse" @@ var "tx" @@ Core.applicationArgument (var "a") $+ produce (Core.termApplication $ Core.application (var "lhs") (var "rhs")),+ _Term_typeApplication>>: "tat" ~>+ "body" <<~ var "rewriteSpine" @@ Core.typeApplicationTermBody (var "tat") $+ "typ" <~ Core.typeApplicationTermType (var "tat") $+ produce (Core.termTypeApplication $ Core.typeApplicationTerm (var "body") (var "typ"))]) $++ -- Arity as provided by type checking, but with exceptions which give us the desired behavior for+ -- targets including Python. Remove the special cases and see which regression tests fail.+ -- TODO: this function is moving toward "syntactic" arity which does not require type checking; only+ -- type lookups.+ "arityOf" <~ ("tx" ~> "term" ~>+ "dflt" <~ Flows.map Arity.typeArity (Checking.typeOf @@ var "tx" @@ list ([] :: [TTerm Type]) @@ var "term") $+ "forFunction" <~ ("tx" ~> "f" ~> cases _Function (var "f")+ Nothing [+ _Function_elimination>>: constant $ produce $ int32 1,+ _Function_lambda>>: "l" ~>+ "txl" <~ Schemas.extendTypeContextForLambda @@ var "tx" @@ var "l" $+ var "arityOf" @@ var "txl" @@ Core.lambdaBody (var "l"),+ _Function_primitive>>: "name" ~> Flows.map+ (Arity.typeSchemeArity)+ (Lexical.requirePrimitiveType @@ var "tx" @@ var "name")]) $+-- trace ("arityOf(" ++ (ShowCore.term @@ var "term") ++ ")") $+ cases _Term (var "term")+ (Just $ var "dflt") [+ _Term_annotated>>: "at" ~> var "arityOf" @@ var "tx" @@ Core.annotatedTermBody (var "at"),+ -- Note: No _Term_application case - the dflt fallback using typeOf is correct.+ -- We can't use arityOf(f) - 1 because that doesn't account for higher-order functions+ -- like identity where (id x) has the same arity as x.+ _Term_function>>: "f" ~> var "forFunction" @@ var "tx" @@ var "f",+ _Term_let>>: "l" ~>+ "txl" <~ Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "tx" @@ var "l" $+ var "arityOf" @@ var "txl" @@ Core.letBody (var "l"),+ _Term_typeApplication>>: "tat" ~> var "arityOf" @@ var "tx" @@ Core.typeApplicationTermBody (var "tat"),+ _Term_typeLambda>>: "tl" ~>+ "txt" <~ Schemas.extendTypeContextForTypeLambda @@ var "tx" @@ var "tl" $+ var "arityOf" @@ var "txt" @@ Core.typeLambdaBody (var "tl"),+ _Term_variable>>: "name" ~> optCases (Maps.lookup (var "name") (Typing.typeContextTypes $ var "tx"))+ -- Variable not in typeContextTypes; use typeOf with CURRENT context and variable term as fallback+ -- This can happen with local let bindings that aren't yet in scope during eta expansion+ (Flows.map Arity.typeArity (Checking.typeOf @@ var "tx" @@ list ([] :: [TTerm Type]) @@ Core.termVariable (var "name")))+ ("t" ~> produce $ Arity.typeArity @@ var "t")]) $++-- "arityOf" <~ ("term" ~> Flows.map+-- (Arity.typeArity)+-- (Checking.typeOf @@ var "tx" @@ list ([] :: [TTerm Type]) @@ var "term")) $++ "extraVariables" <~ ("n" ~> Lists.map ("i" ~> Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ var "i")) $+ Math.range (int32 1) (var "n")) $+ "pad" <~ ("vars" ~> "body" ~>+ Logic.ifElse (Lists.null $ var "vars")+ (var "body")+ (Core.termFunction $ Core.functionLambda $ Core.lambda (Lists.head $ var "vars") nothing $ var "pad"+ @@ Lists.tail (var "vars")+ @@ (Core.termApplication $ Core.application (var "body") $ Core.termVariable $ Lists.head $ var "vars"))) $+ "padn" <~ ("n" ~> "body" ~> var "pad" @@ (var "extraVariables" @@ var "n") @@ var "body") $++ "unwind" <~ ("term" ~> Lists.foldl+ ("e" ~> "t" ~> Core.termTypeApplication (Core.typeApplicationTerm (var "e") (var "t")))+ (var "term") (var "typeArgs")) $++ "forceExpansion" <~ ("t" ~>+ "typ" <<~ Checking.typeOf @@ var "tx" @@ list ([] :: [TTerm Type]) @@ var "t" $+ "arity" <~ Arity.typeArity @@ var "typ" $+ produce $ var "padn" @@ var "arity" @@ (var "unwind" @@ var "t")) $++ "recurseOrForce" <~ ("term" ~> Logic.ifElse (var "forced")+ (var "forceExpansion" @@ var "term")+ (var "recurse" @@ var "tx" @@ (var "unwind" @@ var "term"))) $++ "forCase" <~ ("f" ~>+ "r" <<~ var "rewrite" @@ false @@ true @@ list ([] :: [TTerm Type]) @@ var "recurse" @@ var "tx" @@ Core.fieldTerm (var "f") $+ produce $ Core.fieldWithTerm (var "r") (var "f")) $++ -- Forcing case statement branches is intended for Python, where we cannot accept a branch which is simply+ -- a variable or a primitive reference; we need to expand these to lambdas.+ -- TODO: make this behavior configurable+ "forCaseStatement" <~ ("cs" ~>+ "tname" <~ Core.caseStatementTypeName (var "cs") $+ "dflt" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "rdflt" <<~ Flows.mapMaybe (var "rewrite" @@ false @@ false @@ list ([] :: [TTerm Type]) @@ var "recurse" @@ var "tx") (var "dflt") $+ "rcases" <<~ Flows.mapList (var "forCase") (var "cases") $+ produce $ Core.termFunction $ Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement (var "tname") (var "rdflt") (var "rcases")) $++ "forElimination" <~ ("elm" ~>+ "checkBase" <~ ("elm" ~> cases _Elimination (var "elm")+ (Just $ var "recurse" @@ var "tx" @@ var "term") [+ _Elimination_union>>: "cs" ~> var "forCaseStatement" @@ var "cs"]) $+ "base" <<~ Flows.map (var "unwind") (var "checkBase" @@ var "elm") $+ produce $ Logic.ifElse (Logic.or (var "topLevel") (var "forced"))+ (var "padn" @@ int32 1 @@ var "base")+ (var "base")) $++ cases _Term (var "term")+ (Just $ var "recurseOrForce" @@ var "term") [+ _Term_application>>: "a" ~>+ "lhs" <~ Core.applicationFunction (var "a") $+ "rhs" <~ Core.applicationArgument (var "a") $+ "rhs2" <<~ var "rewrite" @@ true @@ false @@ list ([] :: [TTerm Type]) @@ var "recurse" @@ var "tx" @@ var "rhs" $+ "lhsarity" <<~ var "arityOf" @@ var "tx" @@ var "lhs" $+ "lhs2" <<~ var "rewriteSpine" @@ var "lhs" $+ "a2" <~ Core.termApplication (Core.application (var "lhs2") (var "rhs2")) $+ produce $ Logic.ifElse (Equality.gt (var "lhsarity") (int32 1))+ (var "padn" @@ (Math.sub (var "lhsarity") (int32 1)) @@ var "a2")+ (var "a2"),+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "recurseOrForce" @@ var "term") [+ _Function_elimination>>: "elm" ~> var "forElimination" @@ var "elm",+ _Function_lambda>>: "l" ~>+ "txl" <~ Schemas.extendTypeContextForLambda @@ var "tx" @@ var "l" $+ Flows.map (var "unwind") (var "recurse" @@ var "txl" @@ var "term")],+ _Term_let>>: "l" ~>+ "txlt" <~ Schemas.extendTypeContextForLet @@ constant (constant nothing) @@ var "tx" @@ var "l" $+ var "recurse" @@ var "txlt" @@ var "term",+ _Term_typeApplication>>: "tat" ~> var "rewrite" @@ var "topLevel" @@ var "forced"+ @@ (Lists.cons (Core.typeApplicationTermType $ var "tat") (var "typeArgs"))+ @@ var "recurse" @@ var "tx"+ @@ Core.typeApplicationTermBody (var "tat"),+ _Term_typeLambda>>: "tl" ~>+ "txt" <~ Schemas.extendTypeContextForTypeLambda @@ var "tx" @@ var "tl" $+ var "recurse" @@ var "txt" @@ var "term"]) $+-- trace ("term0: " ++ (ShowCore.term @@ var "term0")) $+ Rewriting.rewriteTermWithContextM @@ (var "rewrite" @@ true @@ false @@ list ([] :: [TTerm Type])) @@ var "tx0" @@ var "term0"++etaReduceTerm :: TBinding (Term -> Term)+etaReduceTerm = define "etaReduceTerm" $+ doc "Eta-reduce a term by removing redundant lambda abstractions" $+ "term" ~>+ "noChange" <~ var "term" $+ "reduceLambda" <~ ("l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "d" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ cases _Term (etaReduceTerm @@ var "body")+ (Just $ var "noChange") [+ _Term_annotated>>: "at" ~>+ var "reduceLambda" @@ (Core.lambda (var "v") (var "d") (Core.annotatedTermBody $ var "at")),+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ cases _Term (etaReduceTerm @@ var "rhs")+ (Just $ var "noChange") [+ _Term_annotated>>: "at" ~>+ var "reduceLambda" @@ (Core.lambda (var "v") (var "d") $+ Core.termApplication $ Core.application (var "lhs") (Core.annotatedTermBody $ var "at")),+ _Term_variable>>: "v1" ~>+ Logic.ifElse+ (Logic.and+ (Equality.equal (Core.unName $ var "v") (Core.unName $ var "v1"))+ (Logic.not $ Rewriting.isFreeVariableInTerm @@ var "v" @@ var "lhs"))+ (etaReduceTerm @@ var "lhs")+ (var "noChange")]]) $+ cases _Term (var "term")+ (Just $ var "noChange") [+ _Term_annotated>>: "at" ~>+ Core.termAnnotated $ Core.annotatedTerm+ (etaReduceTerm @@ (Core.annotatedTermBody $ var "at"))+ (Core.annotatedTermAnnotation $ var "at"),+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ var "noChange") [+ _Function_lambda>>: "l" ~> var "reduceLambda" @@ var "l"]]++reduceTerm :: TBinding (Bool -> Term -> Flow Graph Term)+reduceTerm = define "reduceTerm" $+ doc "A term evaluation function which is alternatively lazy or eager" $+ "eager" ~> "term" ~>+ "reduce" <~ ("eager" ~> reduceTerm @@ var "eager") $+ "doRecurse" <~ ("eager" ~> "term" ~>+ "isNonLambda" <~ ("f" ~> cases _Function (var "f")+ (Just true) [+ _Function_lambda>>: constant false]) $+ "isNonLambdaTerm" <~ cases _Term (var "term")+ (Just true) [+ _Term_function>>: "f" ~> var "isNonLambda" @@ var "f",+ -- Don't recurse into let; handle in applyIfNullary+ _Term_let>>: constant false] $+ Logic.and (var "eager") (var "isNonLambdaTerm")) $+ "reduceArg" <~ ("eager" ~> "arg" ~>+ Logic.ifElse (var "eager")+ (Flows.pure $ var "arg")+ (var "reduce" @@ false @@ var "arg")) $+ "applyToArguments" <~ ("fun" ~> "args" ~>+ Logic.ifElse (Lists.null $ var "args")+ (var "fun")+ (var "applyToArguments" @@+ (Core.termApplication $ Core.application (var "fun") (Lists.head $ var "args")) @@+ (Lists.tail $ var "args"))) $+ "applyElimination" <~ ("elm" ~> "reducedArg" ~>+ cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "proj" ~>+ "fields" <<~ ExtractCore.record @@ (Core.projectionTypeName $ var "proj") @@ (Rewriting.deannotateTerm @@ var "reducedArg") $+ "matchingFields" <~ Lists.filter+ ("f" ~> Equality.equal (Core.fieldName $ var "f") (Core.projectionField $ var "proj"))+ (var "fields") $+ Logic.ifElse+ (Lists.null $ var "matchingFields")+ (Flows.fail $ Strings.cat $ list [+ string "no such field: ",+ unwrap _Name @@ (Core.projectionField $ var "proj"),+ string " in ",+ unwrap _Name @@ (Core.projectionTypeName $ var "proj"),+ string " record"])+ (Flows.pure $ Core.fieldTerm $ Lists.head $ var "matchingFields"),+ _Elimination_union>>: "cs" ~>+ "field" <<~ ExtractCore.injection @@ (Core.caseStatementTypeName $ var "cs") @@ var "reducedArg" $+ "matchingFields" <~ Lists.filter+ ("f" ~> Equality.equal (Core.fieldName $ var "f") (Core.fieldName $ var "field"))+ (Core.caseStatementCases $ var "cs") $+ Logic.ifElse (Lists.null $ var "matchingFields")+ (Maybes.maybe+ (Flows.fail $ Strings.cat $ list [+ string "no such field ",+ unwrap _Name @@ (Core.fieldName $ var "field"),+ string " in ",+ unwrap _Name @@ (Core.caseStatementTypeName $ var "cs"),+ string " case statement"])+ (unaryFunction Flows.pure)+ (Core.caseStatementDefault $ var "cs"))+ (Flows.pure $ Core.termApplication $ Core.application+ (Core.fieldTerm $ Lists.head $ var "matchingFields")+ (Core.fieldTerm $ var "field")),+ _Elimination_wrap>>: "name" ~> ExtractCore.wrap @@ var "name" @@ var "reducedArg"]) $+ "applyIfNullary" <~ ("eager" ~> "original" ~> "args" ~>+ "stripped" <~ Rewriting.deannotateTerm @@ var "original" $+ "forElimination" <~ ("elm" ~> "args" ~>+ "arg" <~ Lists.head (var "args") $+ "remainingArgs" <~ Lists.tail (var "args") $+ "reducedArg" <<~ var "reduceArg" @@ var "eager" @@ (Rewriting.deannotateTerm @@ var "arg") $+ "reducedResult" <<~ Flows.bind (var "applyElimination" @@ var "elm" @@ var "reducedArg") (var "reduce" @@ var "eager") $+ var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs") $+ "forLambda" <~ ("l" ~> "args" ~>+ "param" <~ Core.lambdaParameter (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "arg" <~ Lists.head (var "args") $+ "remainingArgs" <~ Lists.tail (var "args") $+ "reducedArg" <<~ var "reduce" @@ var "eager" @@ (Rewriting.deannotateTerm @@ var "arg") $+ "reducedResult" <<~ var "reduce" @@ var "eager"+ @@ (Rewriting.replaceFreeTermVariable @@ var "param" @@ var "reducedArg" @@ var "body") $+ var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs") $+ "forPrimitive" <~ ("prim" ~> "arity" ~> "args" ~>+ "argList" <~ Lists.take (var "arity") (var "args") $+ "remainingArgs" <~ Lists.drop (var "arity") (var "args") $+ "reducedArgs" <<~ Flows.mapList (var "reduceArg" @@ var "eager") (var "argList") $+ -- Strip annotations from reduced args so primitives can extract values properly+ "strippedArgs" <~ Lists.map Rewriting.deannotateTerm (var "reducedArgs") $+ "reducedResult" <<~ Flows.bind+ (Graph.primitiveImplementation (var "prim") @@ var "strippedArgs")+ (var "reduce" @@ var "eager") $+ var "applyIfNullary" @@ var "eager" @@ var "reducedResult" @@ var "remainingArgs") $+ cases _Term (var "stripped")+ (Just $ Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args") [+ _Term_application>>: "app" ~> var "applyIfNullary" @@ var "eager" @@+ (Core.applicationFunction $ var "app") @@+ (Lists.cons (Core.applicationArgument $ var "app") (var "args")),+ _Term_function>>: match _Function Nothing [+ _Function_elimination>>: "elm" ~>+ Logic.ifElse (Lists.null $ var "args")+ (Flows.pure $ var "original")+ (var "forElimination" @@ var "elm" @@ var "args"),+ _Function_lambda>>: "l" ~>+ Logic.ifElse (Lists.null $ var "args")+ (Flows.pure $ var "original")+ (var "forLambda" @@ var "l" @@ var "args"),+ _Function_primitive>>: "name" ~>+ "prim" <<~ Lexical.requirePrimitive @@ var "name" $+ "arity" <~ Arity.primitiveArity @@ var "prim" $+ Logic.ifElse (Equality.gt (var "arity") (Lists.length $ var "args"))+ (Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args")+ (var "forPrimitive" @@ var "prim" @@ var "arity" @@ var "args")],+ _Term_variable>>: "v" ~>+ -- Look up the variable in the graph; if found, reduce its definition+ "mBinding" <<~ Lexical.dereferenceElement @@ var "v" $+ Maybes.maybe+ -- Not found: lambda-bound variable, return with args applied+ (Flows.pure $ var "applyToArguments" @@ var "original" @@ var "args")+ -- Found: reduce the element's term with the accumulated args+ ("binding" ~> var "applyIfNullary" @@ var "eager" @@ (Core.bindingTerm $ var "binding") @@ var "args")+ (var "mBinding"),+ _Term_let>>: "lt" ~>+ -- For recursive let bindings, wrap self-references with `let f = <value> in f`+ -- This allows recursive functions to be properly evaluated+ "bindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ -- Create a let expression that wraps a binding: let b = <value> in b+ "letExpr" <~ ("b" ~>+ Core.termLet $ Core.let_+ (list [var "b"])+ (Core.termVariable (Core.bindingName $ var "b"))) $+ -- Expand a binding by replacing self-references with the let wrapper+ "expandBinding" <~ ("b" ~>+ Core.binding+ (Core.bindingName $ var "b")+ (Rewriting.replaceFreeTermVariable+ @@ (Core.bindingName $ var "b")+ @@ (var "letExpr" @@ var "b")+ @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b")) $+ "expandedBindings" <~ Lists.map (var "expandBinding") (var "bindings") $+ -- Substitute each binding into the term (foldl takes acc -> elem -> acc)+ "substituteBinding" <~ ("term" ~> "b" ~>+ Rewriting.replaceFreeTermVariable+ @@ (Core.bindingName $ var "b")+ @@ (Core.bindingTerm $ var "b")+ @@ var "term") $+ "substituteAll" <~ ("bs" ~> "term" ~>+ Lists.foldl (var "substituteBinding") (var "term") (var "bs")) $+ "expandedBody" <~ var "substituteAll" @@ var "expandedBindings" @@ var "body" $+ "reducedBody" <<~ var "reduce" @@ var "eager" @@ var "expandedBody" $+ var "applyIfNullary" @@ var "eager" @@ var "reducedBody" @@ var "args"]) $+ "mapping" <~ ("recurse" ~> "mid" ~>+ "inner" <<~ Logic.ifElse (var "doRecurse" @@ var "eager" @@ var "mid")+ (var "recurse" @@ var "mid")+ (Flows.pure $ var "mid") $+ var "applyIfNullary" @@ var "eager" @@ var "inner" @@ (list ([] :: [TTerm Term]))) $+ Rewriting.rewriteTermM @@ var "mapping" @@ var "term"++termIsClosed :: TBinding (Term -> Bool)+termIsClosed = define "termIsClosed" $+ doc "Whether a term is closed, i.e. represents a complete program" $+ "term" ~> Sets.null $ Rewriting.freeVariablesInTerm @@ var "term"++termIsValue :: TBinding (Graph -> Term -> Bool)+termIsValue = define "termIsValue" $+ doc "Whether a term has been fully reduced to a value" $+ "g" ~> "term" ~>+ "forList" <~ ("els" ~> Lists.foldl ("b" ~> "t" ~> Logic.and (var "b") (termIsValue @@ var "g" @@ var "t")) true (var "els")) $+ "checkField" <~ ("f" ~> termIsValue @@ var "g" @@ Core.fieldTerm (var "f")) $+ "checkFields" <~ ("fields" ~> Lists.foldl ("b" ~> "f" ~> Logic.and (var "b") (var "checkField" @@ var "f")) true (var "fields")) $+ "functionIsValue" <~ ("f" ~> cases _Function (var "f") Nothing [+ _Function_elimination>>: "e" ~>+ cases _Elimination (var "e") Nothing [+ _Elimination_wrap>>: constant true,+ _Elimination_record>>: constant true,+ _Elimination_union>>: "cs" ~>+ Logic.and (var "checkFields" @@ Core.caseStatementCases (var "cs"))+ (Maybes.maybe true (termIsValue @@ var "g") (Core.caseStatementDefault $ var "cs"))],+ _Function_lambda>>: "l" ~> termIsValue @@ var "g" @@ Core.lambdaBody (var "l"),+ _Function_primitive>>: constant true]) $+ cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just false) [+ _Term_application>>: constant false,+ _Term_either>>: "e" ~>+ Eithers.either_+ ("l" ~> termIsValue @@ var "g" @@ var "l")+ ("r" ~> termIsValue @@ var "g" @@ var "r")+ (var "e"),+ _Term_literal>>: constant true,+ _Term_function>>: "f" ~> var "functionIsValue" @@ var "f",+ _Term_list>>: "els" ~> var "forList" @@ var "els",+ _Term_map>>: "m" ~>+ Lists.foldl ("b" ~> "kv" ~>+ Logic.and (var "b") $ Logic.and+ (termIsValue @@ var "g" @@ Pairs.first (var "kv"))+ (termIsValue @@ var "g" @@ Pairs.second (var "kv")))+ true $ Maps.toList (var "m"),+ _Term_maybe>>: "m" ~>+ Maybes.maybe true (termIsValue @@ var "g") (var "m"),+ _Term_record>>: "r" ~> var "checkFields" @@ Core.recordFields (var "r"),+ _Term_set>>: "s" ~> var "forList" @@ Sets.toList (var "s"),+ _Term_union>>: "i" ~> var "checkField" @@ Core.injectionField (var "i"),+ _Term_unit>>: constant true,+ _Term_variable>>: constant false]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Reflect.hs view
@@ -0,0 +1,340 @@++module Hydra.Sources.Kernel.Terms.Reflect where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ eliminationVariant, eliminationVariants, floatTypePrecision, floatTypes, floatValueType,+ functionVariant, functionVariants, integerTypeIsSigned, integerTypePrecision, integerTypes,+ integerValueType, literalType, literalTypeVariant, literalTypes, literalVariant, literalVariants,+ termVariant, termVariants, typeVariant, typeVariants)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+++ns :: Namespace+ns = Namespace "hydra.reflect"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces $+ Just ("Reflection functions for working with term, type, and literal type variants, as well as numeric precision.")+ where+ elements = [+ toBinding eliminationVariant,+ toBinding eliminationVariants,+ toBinding floatTypePrecision,+ toBinding floatTypes,+ toBinding floatValueType,+ toBinding functionVariant,+ toBinding functionVariants,+ toBinding integerTypeIsSigned,+ toBinding integerTypePrecision,+ toBinding integerTypes,+ toBinding integerValueType,+ toBinding literalType,+ toBinding literalTypeVariant,+ toBinding literalTypes,+ toBinding literalVariant,+ toBinding literalVariants,+ toBinding termVariant,+ toBinding termVariants,+ toBinding typeVariant,+ toBinding typeVariants]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++eliminationVariant :: TBinding (Elimination -> EliminationVariant)+eliminationVariant = define "eliminationVariant" $+ doc "Find the elimination inject (constructor) for a given elimination term" $+ match _Elimination Nothing [+ _Elimination_record>>: constant Variants.eliminationVariantRecord,+ _Elimination_union>>: constant Variants.eliminationVariantUnion,+ _Elimination_wrap>>: constant Variants.eliminationVariantWrap]++eliminationVariants :: TBinding [EliminationVariant]+eliminationVariants = define "eliminationVariants" $+ doc "All elimination variants (constructors), in a canonical order" $+ list $ injectUnit _EliminationVariant <$> [+ _EliminationVariant_record,+ _EliminationVariant_union,+ _EliminationVariant_wrap]++floatTypePrecision :: TBinding (FloatType -> Precision)+floatTypePrecision = define "floatTypePrecision" $+ doc "Find the precision of a given floating-point type" $+ match _FloatType Nothing [+ _FloatType_bigfloat>>: constant Util.precisionArbitrary,+ _FloatType_float32>>: constant $ Util.precisionBits $ int32 32,+ _FloatType_float64>>: constant $ Util.precisionBits $ int32 64]++floatTypes :: TBinding [FloatType]+floatTypes = define "floatTypes" $+ doc "All floating-point types in a canonical order" $+ list $ injectUnit _FloatType <$> [+ _FloatType_bigfloat,+ _FloatType_float32,+ _FloatType_float64]++floatValueType :: TBinding (FloatValue -> FloatType)+floatValueType = define "floatValueType" $+ doc "Find the float type for a given floating-point value" $+ match _FloatValue Nothing [+ _FloatValue_bigfloat>>: constant Core.floatTypeBigfloat,+ _FloatValue_float32>>: constant Core.floatTypeFloat32,+ _FloatValue_float64>>: constant Core.floatTypeFloat64]++functionVariant :: TBinding (Function -> FunctionVariant)+functionVariant = define "functionVariant" $+ doc "Find the function inject (constructor) for a given function" $+ match _Function Nothing [+ _Function_elimination>>: constant Variants.functionVariantElimination,+ _Function_lambda>>: constant Variants.functionVariantLambda,+ _Function_primitive>>: constant Variants.functionVariantPrimitive]++functionVariants :: TBinding [FunctionVariant]+functionVariants = define "functionVariants" $+ doc "All function variants (constructors), in a canonical order" $+ list $ injectUnit _FunctionVariant <$> [+ _FunctionVariant_elimination,+ _FunctionVariant_lambda,+ _FunctionVariant_primitive]++integerTypeIsSigned :: TBinding (IntegerType -> Bool)+integerTypeIsSigned = define "integerTypeIsSigned" $+ doc "Find whether a given integer type is signed (true) or unsigned (false)" $+ match _IntegerType Nothing [+ _IntegerType_bigint>>: constant true,+ _IntegerType_int8>>: constant true,+ _IntegerType_int16>>: constant true,+ _IntegerType_int32>>: constant true,+ _IntegerType_int64>>: constant true,+ _IntegerType_uint8>>: constant false,+ _IntegerType_uint16>>: constant false,+ _IntegerType_uint32>>: constant false,+ _IntegerType_uint64>>: constant false]++integerTypePrecision :: TBinding (IntegerType -> Precision)+integerTypePrecision = define "integerTypePrecision" $+ doc "Find the precision of a given integer type" $+ match _IntegerType Nothing [+ _IntegerType_bigint>>: constant Util.precisionArbitrary,+ _IntegerType_int8>>: constant $ Util.precisionBits $ int32 8,+ _IntegerType_int16>>: constant $ Util.precisionBits $ int32 16,+ _IntegerType_int32>>: constant $ Util.precisionBits $ int32 32,+ _IntegerType_int64>>: constant $ Util.precisionBits $ int32 64,+ _IntegerType_uint8>>: constant $ Util.precisionBits $ int32 8,+ _IntegerType_uint16>>: constant $ Util.precisionBits $ int32 16,+ _IntegerType_uint32>>: constant $ Util.precisionBits $ int32 32,+ _IntegerType_uint64>>: constant $ Util.precisionBits $ int32 64]++integerTypes :: TBinding [IntegerType]+integerTypes = define "integerTypes" $+ doc "All integer types, in a canonical order" $+ list $ injectUnit _IntegerType <$> [+ _IntegerType_bigint,+ _IntegerType_int8,+ _IntegerType_int16,+ _IntegerType_int32,+ _IntegerType_int64,+ _IntegerType_uint8,+ _IntegerType_uint16,+ _IntegerType_uint32,+ _IntegerType_uint64]++integerValueType :: TBinding (IntegerValue -> IntegerType)+integerValueType = define "integerValueType" $+ doc "Find the integer type for a given integer value" $+ match _IntegerValue Nothing [+ _IntegerValue_bigint>>: constant Core.integerTypeBigint,+ _IntegerValue_int8>>: constant Core.integerTypeInt8,+ _IntegerValue_int16>>: constant Core.integerTypeInt16,+ _IntegerValue_int32>>: constant Core.integerTypeInt32,+ _IntegerValue_int64>>: constant Core.integerTypeInt64,+ _IntegerValue_uint8>>: constant Core.integerTypeUint8,+ _IntegerValue_uint16>>: constant Core.integerTypeUint16,+ _IntegerValue_uint32>>: constant Core.integerTypeUint32,+ _IntegerValue_uint64>>: constant Core.integerTypeUint64]++literalType :: TBinding (Literal -> LiteralType)+literalType = define "literalType" $+ doc "Find the literal type for a given literal value" $+ match _Literal Nothing [+ _Literal_binary>>: constant $ inject _LiteralType _LiteralType_binary unit,+ _Literal_boolean>>: constant $ inject _LiteralType _LiteralType_boolean unit,+ _Literal_float>>: injectLambda _LiteralType _LiteralType_float <.> floatValueType,+ _Literal_integer>>: injectLambda _LiteralType _LiteralType_integer <.> integerValueType,+ _Literal_string>>: constant $ inject _LiteralType _LiteralType_string unit]++literalTypeVariant :: TBinding (LiteralType -> LiteralVariant)+literalTypeVariant = define "literalTypeVariant" $+ doc "Find the literal type inject (constructor) for a given literal value" $+ match _LiteralType Nothing [+ _LiteralType_binary>>: constant $ Variants.literalVariantBinary,+ _LiteralType_boolean>>: constant $ Variants.literalVariantBoolean,+ _LiteralType_float>>: constant $ Variants.literalVariantFloat,+ _LiteralType_integer>>: constant $ Variants.literalVariantInteger,+ _LiteralType_string>>: constant $ Variants.literalVariantString]++literalTypes :: TBinding [LiteralType]+literalTypes = define "literalTypes" $+ doc "All literal types, in a canonical order" $+ Lists.concat $ list [+ list [+ Core.literalTypeBinary,+ Core.literalTypeBoolean],+ Lists.map (unaryFunction Core.literalTypeFloat) (floatTypes),+ Lists.map (unaryFunction Core.literalTypeInteger) (integerTypes),+ list [+ Core.literalTypeString]]++literalVariant :: TBinding (Literal -> LiteralVariant)+literalVariant = define "literalVariant" $+ doc "Find the literal inject (constructor) for a given literal value" $+ literalTypeVariant <.> literalType++literalVariants :: TBinding [LiteralVariant]+literalVariants = define "literalVariants" $+ doc "All literal variants, in a canonical order" $+ list $ injectUnit _LiteralVariant <$> [+ _LiteralVariant_binary,+ _LiteralVariant_boolean,+ _LiteralVariant_float,+ _LiteralVariant_integer,+ _LiteralVariant_string]++termVariant :: TBinding (Term -> TermVariant)+termVariant = define "termVariant" $+ doc "Find the term inject (constructor) for a given term" $+ match _Term Nothing [+ _Term_annotated>>: constant Variants.termVariantAnnotated,+ _Term_application>>: constant Variants.termVariantApplication,+ _Term_either>>: constant Variants.termVariantEither,+ _Term_function>>: constant Variants.termVariantFunction,+ _Term_let>>: constant Variants.termVariantLet,+ _Term_list>>: constant Variants.termVariantList,+ _Term_literal>>: constant Variants.termVariantLiteral,+ _Term_map>>: constant Variants.termVariantMap,+ _Term_maybe>>: constant Variants.termVariantMaybe,+ _Term_pair>>: constant Variants.termVariantPair,+ _Term_record>>: constant Variants.termVariantRecord,+ _Term_set>>: constant Variants.termVariantSet,+ _Term_typeApplication>>: constant Variants.termVariantTypeApplication,+ _Term_typeLambda>>: constant Variants.termVariantTypeLambda,+ _Term_union>>: constant Variants.termVariantUnion,+ _Term_unit>>: constant Variants.termVariantUnit,+ _Term_variable>>: constant Variants.termVariantVariable,+ _Term_wrap>>: constant Variants.termVariantWrap]++termVariants :: TBinding [TermVariant]+termVariants = define "termVariants" $+ doc "All term (expression) variants, in a canonical order" $+ list $ injectUnit _TermVariant <$> [+ _TermVariant_annotated,+ _TermVariant_application,+ _TermVariant_either,+ _TermVariant_function,+ _TermVariant_list,+ _TermVariant_literal,+ _TermVariant_map,+ _TermVariant_maybe,+ _TermVariant_pair,+ _TermVariant_record,+ _TermVariant_set,+ _TermVariant_typeLambda,+ _TermVariant_typeApplication,+ _TermVariant_union,+ _TermVariant_unit,+ _TermVariant_variable,+ _TermVariant_wrap]++typeVariant :: TBinding (Type -> TypeVariant)+typeVariant = define "typeVariant" $+ doc "Find the type inject (constructor) for a given type" $+ match _Type Nothing [+ _Type_annotated>>: constant Variants.typeVariantAnnotated,+ _Type_application>>: constant Variants.typeVariantApplication,+ _Type_either>>: constant Variants.typeVariantEither,+ _Type_function>>: constant Variants.typeVariantFunction,+ _Type_forall>>: constant Variants.typeVariantForall,+ _Type_list>>: constant Variants.typeVariantList,+ _Type_literal>>: constant Variants.typeVariantLiteral,+ _Type_map>>: constant Variants.typeVariantMap,+ _Type_maybe>>: constant Variants.typeVariantMaybe,+ _Type_pair>>: constant Variants.typeVariantPair,+ _Type_record>>: constant Variants.typeVariantRecord,+ _Type_set>>: constant Variants.typeVariantSet,+ _Type_union>>: constant Variants.typeVariantUnion,+ _Type_unit>>: constant Variants.typeVariantUnit,+ _Type_variable>>: constant Variants.typeVariantVariable,+ _Type_wrap>>: constant Variants.typeVariantWrap]++typeVariants :: TBinding [TypeVariant]+typeVariants = define "typeVariants" $+ doc "All type variants, in a canonical order" $+ list $ injectUnit _TypeVariant <$> [+ _TypeVariant_annotated,+ _TypeVariant_application,+ _TypeVariant_either,+ _TypeVariant_function,+ _TypeVariant_forall,+ _TypeVariant_list,+ _TypeVariant_literal,+ _TypeVariant_map,+ _TypeVariant_wrap,+ _TypeVariant_maybe,+ _TypeVariant_pair,+ _TypeVariant_record,+ _TypeVariant_set,+ _TypeVariant_union,+ _TypeVariant_unit,+ _TypeVariant_variable]
src/main/haskell/Hydra/Sources/Kernel/Terms/Rewriting.hs view
@@ -1,1173 +1,2281 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Rewriting where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting---module_ :: Module-module_ = Module (Namespace "hydra.rewriting") elements- [Names.module_, Sorting.module_]- kernelTypesModules $- Just ("Utilities for type and term rewriting and analysis.")- where- elements = [- el deannotateAndDetypeTermDef,- el deannotateTermDef,- el deannotateTypeDef,- el deannotateTypeParametersDef,- el deannotateTypeRecursiveDef,- el deannotateTypeSchemeRecursiveDef,- el expandTypedLambdasDef,- el flattenLetTermsDef,- el foldOverTermDef,- el foldOverTypeDef,- el freeVariablesInTermDef,- el freeVariablesInTypeDef,- el freeVariablesInTypeOrderedDef,- el freeVariablesInTypeSchemeSimpleDef,- el freeVariablesInTypeSchemeDef,- el freeVariablesInTypeSimpleDef,- el inlineTypeDef,- el isFreeVariableInTermDef,- el isLambdaDef,- el mapBeneathTypeAnnotationsDef,- el normalizeTypeVariablesInTermDef,- el removeTermAnnotationsDef,- el removeTypeAnnotationsDef,- el removeTypesFromTermDef,- el replaceFreeTermVariableDef,- el replaceFreeTypeVariableDef,- el rewriteDef,- el rewriteTermDef,- el rewriteTermMDef,- el rewriteTypeDef,- el rewriteTypeMDef,- el simplifyTermDef,- el substituteTypeVariablesDef,- el substituteVariableDef,- el substituteVariablesDef,- el subtermsDef,- el subtermsWithAccessorsDef,- el subtypesDef,- el termDependencyNamesDef,- el toShortNamesDef,- el topologicalSortBindingMapDef,- el topologicalSortBindingsDef,- el typeDependencyNamesDef,- el typeNamesInTypeDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--deannotateAndDetypeTermDef :: TBinding (Term -> Term)-deannotateAndDetypeTermDef = define "deannotateAndDetypeTerm" $- doc "Strip type annotations from the top levels of a term" $- lambda "t" $ cases _Term (var "t")- (Just $ var "t") [- _Term_annotated>>: lambda "at" $ ref deannotateAndDetypeTermDef @@ (Core.annotatedTermSubject $ var "at"),- _Term_typeApplication>>: lambda "tt" $ ref deannotateAndDetypeTermDef @@ (Core.typedTermTerm $ var "tt"),- _Term_typeLambda>>: lambda "ta" $ ref deannotateAndDetypeTermDef @@ (Core.typeLambdaBody $ var "ta")]--deannotateTermDef :: TBinding (Term -> Term)-deannotateTermDef = define "deannotateTerm" $- doc "Strip all annotations (including System F type annotations) from the top levels of a term" $- lambda "t" $ cases _Term (var "t")- (Just $ var "t") [- _Term_annotated>>: "at" ~> ref deannotateTermDef @@ (Core.annotatedTermSubject $ var "at")]--deannotateTypeDef :: TBinding (Type -> Type)-deannotateTypeDef = define "deannotateType" $- doc "Strip all annotations from a term" $- lambda "t" $ cases _Type (var "t")- (Just $ var "t") [- _Type_annotated>>: ref deannotateTypeDef <.> (project _AnnotatedType _AnnotatedType_subject)]--deannotateTypeParametersDef :: TBinding (Type -> Type)-deannotateTypeParametersDef = define "deannotateTypeParameters" $- doc "Strip any top-level type lambdas from a type, extracting the (possibly nested) type body" $- lambda "t" $ cases _Type (ref deannotateTypeDef @@ var "t")- (Just $ var "t") [- _Type_forall>>: lambda "lt" (ref deannotateTypeParametersDef @@ (project _ForallType _ForallType_body @@ var "lt"))]--deannotateTypeRecursiveDef :: TBinding (Type -> Type)-deannotateTypeRecursiveDef = define "deannotateTypeRecursive" $- doc "Recursively strip all annotations from a type" $- lambda "typ" $ lets [- "strip">: lambdas ["recurse", "typ"] $ lets [- "rewritten">: var "recurse" @@ var "typ"] $- cases _Type (var "rewritten")- (Just $ var "rewritten") [- _Type_annotated>>: lambda "at" $ Core.annotatedTypeSubject $ var "at"]] $- ref rewriteTypeDef @@ var "strip" @@ var "typ"--deannotateTypeSchemeRecursiveDef :: TBinding (TypeScheme -> TypeScheme)-deannotateTypeSchemeRecursiveDef = define "deannotateTypeSchemeRecursive" $- doc "Recursively strip all annotations from a type scheme" $- lambda "ts" $ lets [- "vars">: Core.typeSchemeVariables $ var "ts",- "typ">: Core.typeSchemeType $ var "ts"] $- Core.typeScheme (var "vars") (ref deannotateTypeRecursiveDef @@ var "typ")--expandTypedLambdasDef :: TBinding (Term -> Term)-expandTypedLambdasDef = define "expandTypedLambdas" $- doc "A variation of expandLambdas which also attaches type annotations when padding function terms" $- lambda "term" $ lets [- "toNaryFunType">: lambda "typ" $ lets [- "helper">: lambda "t" $- cases _Type (var "t")- (Just $ pair (list []) (var "t")) [- _Type_function>>: lambda "ft" $ lets [- "dom0">: Core.functionTypeDomain $ var "ft",- "cod0">: Core.functionTypeCodomain $ var "ft",- "recursive">: var "helper" @@ var "cod0",- "doms">: first $ var "recursive",- "cod1">: second $ var "recursive"]- $ pair (Lists.cons (var "dom0") (var "doms")) (var "cod1")]]- $ var "helper" @@ (ref deannotateTypeDef @@ var "typ"),- "padTerm">: lambdas ["i", "doms", "cod", "term"] $- Logic.ifElse (Lists.null $ var "doms")- (var "term")- (lets [- "dom">: Lists.head $ var "doms",- "var">: Core.name $ Strings.cat2 (string "v") (Literals.showInt32 $ var "i"),- "tailDoms">: Lists.tail $ var "doms",- "toFunctionType">: lambdas ["doms", "cod"] $- Lists.foldl- (lambda "c" $ lambda "d" $ Core.typeFunction $ Core.functionType (var "d") (var "c"))- (var "cod")- (var "doms")]- $ Core.termFunction $ Core.functionLambda $ Core.lambda (var "var") (just $ var "dom") $- var "padTerm"- @@ (Math.add (var "i") (int32 1))- @@ (var "tailDoms")- @@ (var "cod")- @@ (Core.termApplication $ Core.application- (var "term")- (Core.termVariable $ var "var"))),- "expand">: lambdas ["doms", "cod", "term"] $- cases _Term (var "term")- (Just $ ref rewriteTermDef @@ var "rewrite" @@ var "term") [- _Term_annotated>>: lambda "at" $ Core.termAnnotated $ Core.annotatedTerm- (var "expand" @@ var "doms" @@ var "cod" @@ (Core.annotatedTermSubject $ var "at"))- (Core.annotatedTermAnnotation $ var "at"),- _Term_application>>: lambda "app" $ lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app"]- $ ref rewriteTermDef @@ var "rewrite" @@ var "term",- _Term_function>>: match _Function- (Just $ var "padTerm" @@ int32 1 @@ var "doms" @@ var "cod" @@ var "term") [- _Function_lambda>>: lambda "l" $ Core.termFunction $ Core.functionLambda $ Core.lambda- (Core.lambdaParameter $ var "l")- (Core.lambdaDomain $ var "l")- (var "expand" @@ (Lists.tail $ var "doms") @@ var "cod" @@ (Core.lambdaBody $ var "l"))],- _Term_let>>: lambda "lt" $ lets [- "expandBinding">: lambda "b" $ Core.binding- (Core.bindingName $ var "b")- (ref expandTypedLambdasDef @@ (Core.bindingTerm $ var "b"))- (Core.bindingType $ var "b")]- $ Core.termLet $ Core.let_- (Lists.map (var "expandBinding") (Core.letBindings $ var "lt"))- (var "expand" @@ var "doms" @@ var "cod" @@ (Core.letEnvironment $ var "lt"))],- "rewrite">: lambdas ["recurse", "term"] $ var "recurse" @@ var "term"]- $ ref rewriteTermDef @@ var "rewrite" @@ var "term"--flattenLetTermsDef :: TBinding (Term -> Term)-flattenLetTermsDef = define "flattenLetTerms" $- doc "Flatten nested let expressions" $- lambda "term" $ lets [- "rewriteBinding">: lambda "binding" $ lets [- "key0">: Core.bindingName $ var "binding",- "val0">: Core.bindingTerm $ var "binding",- "t">: Core.bindingType $ var "binding"] $- cases _Term (var "val0")- (Just $ pair (Core.binding (var "key0") (var "val0") (var "t")) (list [])) [- _Term_annotated>>: lambda "at" $ lets [- "val1">: Core.annotatedTermSubject $ var "at",- "ann">: Core.annotatedTermAnnotation $ var "at",- "recursive">: var "rewriteBinding" @@ (Core.binding (var "key0") (var "val1") (var "t")),- "innerBinding">: first $ var "recursive",- "deps">: second $ var "recursive",- "val2">: Core.bindingTerm $ var "innerBinding"]- $ pair- (Core.binding (var "key0") (Core.termAnnotated $ Core.annotatedTerm (var "val2") (var "ann")) (var "t"))- (var "deps"),- _Term_let>>: lambda "innerLet" $ lets [- "bindings1">: Core.letBindings $ var "innerLet",- "body1">: Core.letEnvironment $ var "innerLet",- "prefix">: Strings.cat2 (unwrap _Name @@ var "key0") (string "_"),- "qualify">: lambda "n" $ Core.name $ Strings.cat2 (var "prefix") (unwrap _Name @@ var "n"),- "toSubstPair">: lambda "b" $ pair (Core.bindingName $ var "b") (var "qualify" @@ (Core.bindingName $ var "b")),- "subst">: Maps.fromList $ Lists.map (var "toSubstPair") (var "bindings1"),- "replaceVars">: ref substituteVariablesDef @@ var "subst",- "newBody">: var "replaceVars" @@ var "body1",- "newBinding">: lambda "b" $ Core.binding- (var "qualify" @@ (Core.bindingName $ var "b"))- (var "replaceVars" @@ (Core.bindingTerm $ var "b"))- (Core.bindingType $ var "b")]- $ pair- (Core.binding (var "key0") (var "newBody") (var "t"))- (Lists.map (var "newBinding") (var "bindings1"))],- "flatten">: lambdas ["recurse", "term"] $ lets [- "rewritten">: var "recurse" @@ var "term"] $- cases _Term (var "rewritten")- (Just $ var "rewritten") [- _Term_let>>: lambda "lt" $ lets [- "bindings">: Core.letBindings $ var "lt",- "body">: Core.letEnvironment $ var "lt",- "forResult">: lambda "hr" $ Lists.cons (first $ var "hr") (second $ var "hr"),- "newBindings">: Lists.concat $ Lists.map (var "forResult" <.> var "rewriteBinding") (var "bindings")] $- Core.termLet $ Core.let_ (var "newBindings") (var "body")]]- $ ref rewriteTermDef @@ var "flatten" @@ var "term"--foldOverTermDef :: TBinding (TraversalOrder -> (x -> Term -> x) -> x -> Term -> x)-foldOverTermDef = define "foldOverTerm" $- doc "Fold over a term, traversing its subterms in the specified order" $- lambdas ["order", "fld", "b0", "term"] $ cases _TraversalOrder (var "order") Nothing [- _TraversalOrder_pre>>: constant (Phantoms.fold (ref foldOverTermDef @@ var "order" @@ var "fld")- @@ (var "fld" @@ var "b0" @@ var "term")- @@ (ref subtermsDef @@ var "term")),- _TraversalOrder_post>>: constant (var "fld"- @@ (Phantoms.fold (ref foldOverTermDef @@ var "order" @@ var "fld")- @@ (var "b0")- @@ (ref subtermsDef @@ var "term"))- @@ var "term")]--foldOverTypeDef :: TBinding (TraversalOrder -> (x -> Type -> x) -> x -> Type -> x)-foldOverTypeDef = define "foldOverType" $- doc "Fold over a type, traversing its subtypes in the specified order" $- lambdas ["order", "fld", "b0", "typ"] $ cases _TraversalOrder (var "order") Nothing [- _TraversalOrder_pre>>: constant (Phantoms.fold (ref foldOverTypeDef @@ var "order" @@ var "fld")- @@ (var "fld" @@ var "b0" @@ var "typ")- @@ (ref subtypesDef @@ var "typ")),- _TraversalOrder_post>>: constant (var "fld"- @@ (Phantoms.fold (ref foldOverTypeDef @@ var "order" @@ var "fld")- @@ (var "b0")- @@ (ref subtypesDef @@ var "typ"))- @@ var "typ")]--freeVariablesInTermDef :: TBinding (Term -> S.Set Name)-freeVariablesInTermDef = define "freeVariablesInTerm" $- doc "Find the free variables (i.e. variables not bound by a lambda or let) in a term" $- lambda "term" $ lets [- "dfltVars">: Phantoms.fold (lambda "s" $ lambda "t" $ Sets.union (var "s") (ref freeVariablesInTermDef @@ var "t"))- @@ Sets.empty- @@ (ref subtermsDef @@ var "term")] $- cases _Term (var "term")- (Just $ var "dfltVars") [- _Term_function>>: match _Function (Just $ var "dfltVars") [- _Function_lambda>>: lambda "l" (Sets.delete- (Core.lambdaParameter $ var "l")- (ref freeVariablesInTermDef @@ (Core.lambdaBody $ var "l")))],--- TODO: restore the following--- _Term_let>>: lambda "l" (Sets.difference--- @@ (ref freeVariablesInTermDef @@ (Core.letEnvironment $ var "l"))--- @@ (Sets.fromList (Lists.map first (Maps.toList (Core.letBindings $ var "l"))))),- _Term_variable>>: lambda "v" (Sets.singleton $ var "v")]--freeVariablesInTypeDef :: TBinding (Type -> S.Set Name)-freeVariablesInTypeDef = define "freeVariablesInType" $- doc "Find the free variables (i.e. variables not bound by a lambda or let) in a type" $- lambda "typ" $ lets [- "dfltVars">: Phantoms.fold (lambda "s" $ lambda "t" $ Sets.union (var "s") (recurse @@ var "t"))- @@ Sets.empty- @@ (ref subtypesDef @@ var "typ")] $- cases _Type (var "typ")- (Just $ var "dfltVars") [- _Type_forall>>: lambda "lt" (Sets.delete- (Core.forallTypeParameter $ var "lt")- (recurse @@ (Core.forallTypeBody $ var "lt"))),- -- TODO: let-types- _Type_variable>>: lambda "v" (Sets.singleton $ var "v")]- where- recurse = ref freeVariablesInTypeDef--freeVariablesInTypeOrderedDef :: TBinding (Type -> [Name])-freeVariablesInTypeOrderedDef = define "freeVariablesInTypeOrdered" $- doc "Find the free variables in a type in deterministic left-to-right order" $- lambda "typ" $ lets [- "collectVars">: lambdas ["boundVars", "t"] $- cases _Type (var "t")- (Just $ Lists.concat $ Lists.map (var "collectVars" @@ var "boundVars") $- ref subtypesDef @@ var "t") [- _Type_variable>>: lambda "v" $- Logic.ifElse (Sets.member (var "v") (var "boundVars"))- (list [])- (list [var "v"]),- _Type_forall>>: lambda "ft" $- var "collectVars" @@- (Sets.insert (Core.forallTypeParameter $ var "ft") (var "boundVars")) @@- (Core.forallTypeBody $ var "ft")]] $- (Lists.nub :: TTerm [Name] -> TTerm [Name]) $ var "collectVars" @@ Sets.empty @@ var "typ"--freeVariablesInTypeSimpleDef :: TBinding (Type -> S.Set Name)-freeVariablesInTypeSimpleDef = define "freeVariablesInTypeSimple" $- doc "Same as freeVariablesInType, but ignores the binding action of lambda types" $- lambda "typ" $ lets [- "helper">: lambdas ["types", "typ"] $ cases _Type (var "typ")- (Just $ var "types") [- _Type_variable>>: lambda "v" $ Sets.insert (var "v") (var "types")]] $- ref foldOverTypeDef @@ Coders.traversalOrderPre @@ var "helper" @@ Sets.empty @@ var "typ"--freeVariablesInTypeSchemeDef :: TBinding (TypeScheme -> S.Set Name)-freeVariablesInTypeSchemeDef = define "freeVariablesInTypeScheme" $- doc "Find free variables in a type scheme" $- lambda "ts" $ lets [- "vars">: Core.typeSchemeVariables $ var "ts",- "t">: Core.typeSchemeType $ var "ts"]- $ Sets.difference (ref freeVariablesInTypeDef @@ var "t") (Sets.fromList $ var "vars")--freeVariablesInTypeSchemeSimpleDef :: TBinding (TypeScheme -> S.Set Name)-freeVariablesInTypeSchemeSimpleDef = define "freeVariablesInTypeSchemeSimple" $- doc "Find free variables in a type scheme (simple version)" $- lambda "ts" $ lets [- "vars">: Core.typeSchemeVariables $ var "ts",- "t">: Core.typeSchemeType $ var "ts"]- $ Sets.difference (ref freeVariablesInTypeSimpleDef @@ var "t") (Sets.fromList $ var "vars")--inlineTypeDef :: TBinding (M.Map Name Type -> Type -> Flow s Type)-inlineTypeDef = define "inlineType" $- doc "Inline all type variables in a type using the provided schema. Note: this function is only appropriate for nonrecursive type definitions" $- lambdas ["schema", "typ"] $ lets [- "f">: lambdas ["recurse", "typ"] $ binds [- "tr">: var "recurse" @@ var "typ"] $- cases _Type (var "tr")- (Just $ produce $ var "tr") [- _Type_variable>>: lambda "v" $- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "No such type in schema: ") (unwrap _Name @@ var "v"))- (ref inlineTypeDef @@ var "schema")- (Maps.lookup (var "v") (var "schema"))]] $- ref rewriteTypeMDef @@ var "f" @@ var "typ"--isFreeVariableInTermDef :: TBinding (Name -> Term -> Bool)-isFreeVariableInTermDef = define "isFreeVariableInTerm" $- doc "Check whether a variable is free (not bound) in a term" $- lambda "v" $ lambda "term" $- Logic.not $ Sets.member (var "v") (ref freeVariablesInTermDef @@ var "term")--isLambdaDef :: TBinding (Term -> Bool)-isLambdaDef = define "isLambda" $- doc "Check whether a term is a lambda, possibly nested within let and/or annotation terms" $- lambda "term" $ cases _Term (ref deannotateTermDef @@ var "term")- (Just false) [- _Term_function>>: match _Function- (Just false) [- _Function_lambda>>: constant true],- _Term_let>>: lambda "lt" (ref isLambdaDef @@ (project _Let _Let_environment @@ var "lt"))]--mapBeneathTypeAnnotationsDef :: TBinding ((Type -> Type) -> Type -> Type)-mapBeneathTypeAnnotationsDef = define "mapBeneathTypeAnnotations" $- doc "Apply a transformation to the first type beneath a chain of annotations" $- lambdas ["f", "t"] $ cases _Type (var "t")- (Just $ var "f" @@ var "t") [- _Type_annotated>>: lambda "at" $ Core.typeAnnotated $ Core.annotatedType- (ref mapBeneathTypeAnnotationsDef @@ var "f" @@ (Core.annotatedTypeSubject $ var "at"))- (Core.annotatedTypeAnnotation $ var "at")]--normalizeTypeVariablesInTermDef :: TBinding (Term -> Term)-normalizeTypeVariablesInTermDef = define "normalizeTypeVariablesInTerm" $- doc "Recursively replace the type variables of let bindings with the systematic type variables t0, t1, t2, ..." $- lambda "term" $ lets [- "substType">: lambdas ["subst", "typ"] $ lets [- "rewrite">: lambdas ["recurse", "typ"] $ cases _Type (var "typ")- (Just $ var "recurse" @@ var "typ") [- _Type_variable>>: lambda "v" $ Core.typeVariable $ var "replaceName" @@ var "subst" @@ var "v"]] $- ref rewriteTypeDef @@ var "rewrite" @@ var "typ",- "replaceName">: lambdas ["subst", "v"] $ Optionals.fromMaybe (var "v") $ Maps.lookup (var "v") (var "subst"),- "rewriteWithSubst">: lambda "substAndBound" $ lets [- "subst">: first $ var "substAndBound",- "boundVars">: second $ var "substAndBound",- "rewrite">: lambdas ["recurse", "term"] $ cases _Term (var "term")- (Just $ var "recurse" @@ var "term") [- _Term_function>>: match _Function- (Just $ var "recurse" @@ var "term") [- _Function_elimination>>: match _Elimination- (Just $ var "recurse" @@ var "term") [- _Elimination_product>>: lambda "tproj" $ lets [- "arity">: Core.tupleProjectionArity $ var "tproj",- "index">: Core.tupleProjectionIndex $ var "tproj",- "domain">: Core.tupleProjectionDomain $ var "tproj"] $- Core.termFunction $ Core.functionElimination $ Core.eliminationProduct $ Core.tupleProjection- (var "arity")- (var "index")- (Optionals.map- (lambda "types" $ Lists.map (var "substType" @@ var "subst") (var "types"))- (var "domain"))],- _Function_lambda>>: lambda "l" $ Core.termFunction $ Core.functionLambda $ Core.lambda- (Core.lambdaParameter $ var "l")- (Optionals.map (var "substType" @@ var "subst") (Core.lambdaDomain $ var "l"))- (var "rewriteWithSubst" @@ (pair (var "subst") (var "boundVars")) @@ (Core.lambdaBody $ var "l"))],- _Term_let>>: lambda "lt" $ lets [- "bindings">: Core.letBindings $ var "lt",- "env">: Core.letEnvironment $ var "lt",- "rewriteBinding">: lambda "b" $- Optionals.maybe- (var "b")- (lambda "ts" $ lets [- "vars">: Core.typeSchemeVariables $ var "ts",- "typ">: Core.typeSchemeType $ var "ts",- "varsLen">: Lists.length $ var "vars",- "boundVarsLen">: Sets.size $ var "boundVars",- "normalVariables">: Lists.map (lambda "i" $ Core.name $ Strings.cat2 (string "t") (Literals.showInt32 $ var "i")) $- Math.range (int32 0) (Math.add (var "varsLen") (var "boundVarsLen")),- "newVars">: Lists.take (Lists.length $ var "vars") $ Lists.filter- (lambda "n" $ Logic.not $ Sets.member (var "n") (var "boundVars"))- (var "normalVariables"),- "newSubst">: Maps.union (Maps.fromList $ Lists.zip (var "vars") (var "newVars")) (var "subst"),- "newValue">: var "rewriteWithSubst"- @@ (pair (var "newSubst") (Sets.union (var "boundVars") (Sets.fromList $ var "newVars")))- @@ (Core.bindingTerm $ var "b")] $- Core.binding- (Core.bindingName $ var "b")- (var "newValue")- (just $ Core.typeScheme (var "newVars") (var "substType" @@ var "newSubst" @@ var "typ")))- (Core.bindingType $ var "b")] $- Core.termLet $ Core.let_- (Lists.map (var "rewriteBinding") (var "bindings"))- (var "rewriteWithSubst" @@ (pair (var "subst") (var "boundVars")) @@ var "env"),- _Term_typeApplication>>: lambda "tt" $ Core.termTypeApplication $ Core.typedTerm- (var "rewriteWithSubst" @@ (pair (var "subst") (var "boundVars")) @@ (Core.typedTermTerm $ var "tt"))- (var "substType" @@ var "subst" @@ (Core.typedTermType $ var "tt")),- _Term_typeLambda>>: lambda "ta" $ Core.termTypeLambda $ Core.typeLambda- (var "replaceName" @@ var "subst" @@ (Core.typeLambdaParameter $ var "ta"))- (var "rewriteWithSubst" @@ (pair (var "subst") (var "boundVars")) @@ (Core.typeLambdaBody $ var "ta"))]] $- ref rewriteTermDef @@ var "rewrite"] $- var "rewriteWithSubst" @@ (pair Maps.empty Sets.empty) @@ var "term"--removeTermAnnotationsDef :: TBinding (Term -> Term)-removeTermAnnotationsDef = define "removeTermAnnotations" $- doc "Recursively remove term annotations, including within subterms" $- lambda "term" $ lets [- "remove">: lambdas ["recurse", "term"] $ lets [- "rewritten">: var "recurse" @@ var "term"] $- cases _Term (var "term")- (Just $ var "rewritten") [- _Term_annotated>>: lambda "at" $ Core.annotatedTermSubject $ var "at"]]- $ ref rewriteTermDef @@ var "remove" @@ var "term"--removeTypeAnnotationsDef :: TBinding (Type -> Type)-removeTypeAnnotationsDef = define "removeTypeAnnotations" $- doc "Recursively remove type annotations, including within subtypes" $- lambda "typ" $ lets [- "remove">: lambdas ["recurse", "typ"] $ lets [- "rewritten">: var "recurse" @@ var "typ"] $- cases _Type (var "rewritten")- (Just $ var "rewritten") [- _Type_annotated>>: lambda "at" $ Core.annotatedTypeSubject $ var "at"]] $- ref rewriteTypeDef @@ var "remove" @@ var "typ"--removeTypesFromTermDef :: TBinding (Term -> Term)-removeTypesFromTermDef = define "removeTypesFromTerm" $- doc "Strip type annotations from terms while preserving other annotations" $- lambda "term" $ lets [- "strip">: lambdas ["recurse", "term"] $ lets [- "rewritten">: var "recurse" @@ var "term",- "stripBinding">: lambda "b" $ Core.binding- (Core.bindingName $ var "b")- (Core.bindingTerm $ var "b")- nothing] $- cases _Term (var "rewritten")- (Just $ var "rewritten") [- _Term_function>>: lambda "f" $ cases _Function (var "f")- (Just $ Core.termFunction $ var "f") [- _Function_elimination>>: lambda "e" $ cases _Elimination (var "e")- (Just $ Core.termFunction $ Core.functionElimination $ var "e") [- _Elimination_product>>: lambda "tp" $ Core.termFunction $ Core.functionElimination $ Core.eliminationProduct $- Core.tupleProjection- (Core.tupleProjectionIndex $ var "tp")- (Core.tupleProjectionArity $ var "tp")- nothing],- _Function_lambda>>: lambda "l" $ Core.termFunction $ Core.functionLambda $ Core.lambda- (Core.lambdaParameter $ var "l")- nothing- (Core.lambdaBody $ var "l")],- _Term_let>>: lambda "lt" $ Core.termLet $ Core.let_- (Lists.map (var "stripBinding") (Core.letBindings $ var "lt"))- (Core.letEnvironment $ var "lt"),- _Term_typeApplication>>: lambda "tt" $ Core.typedTermTerm $ var "tt",- _Term_typeLambda>>: lambda "ta" $ Core.typeLambdaBody $ var "ta"]]- $ ref rewriteTermDef @@ var "strip" @@ var "term"--replaceFreeTermVariableDef :: TBinding (Name -> Term -> Term -> Term)-replaceFreeTermVariableDef = define "replaceFreeTermVariable" $- doc "Replace a free variable in a term" $- "vold" ~> "tnew" ~> "term" ~>- "rewrite" <~ ("recurse" ~> "t" ~> cases _Term (var "t")- (Just $ var "recurse" @@ var "t") [- _Term_function>>: lambda "f" $- cases _Function (var "f")- (Just $ var "recurse" @@ var "t") [- _Function_lambda>>: "l" ~> (- "v" <~ Core.lambdaParameter (var "l") $- Logic.ifElse (Equality.equal (var "v") (var "vold"))- (var "t")- (var "recurse" @@ var "t"))],- _Term_variable>>: "v" ~>- Logic.ifElse (Equality.equal (var "v") (var "vold"))- (var "tnew")- (Core.termVariable $ var "v")]) $- ref rewriteTermDef @@ var "rewrite" @@ var "term"--rewriteDef :: TBinding (((x -> y) -> x -> y) -> ((x -> y) -> x -> y) -> x -> y)-rewriteDef = define "rewrite" $ lambdas ["fsub", "f"] $ lets [- "recurse">: var "f" @@ (var "fsub" @@ var "recurse")] $- var "recurse"--replaceFreeTypeVariableDef :: TBinding (Name -> Type -> Type -> Type)-replaceFreeTypeVariableDef = define "replaceFreeTypeVariable" $- doc "Replace free occurrences of a name in a type" $- lambdas ["v", "rep", "typ"] $ lets [- "mapExpr">: lambdas ["recurse", "t"] $ cases _Type (var "t")- (Just $ var "recurse" @@ var "t") [- _Type_forall>>: lambda "ft" $ Logic.ifElse- (Equality.equal (var "v") (Core.forallTypeParameter $ var "ft"))- (var "t")- (Core.typeForall $ Core.forallType- (Core.forallTypeParameter $ var "ft")- (var "recurse" @@ (Core.forallTypeBody $ var "ft"))),- _Type_variable>>: lambda "v'" $ Logic.ifElse- (Equality.equal (var "v") (var "v'"))- (var "rep")- (var "t")]] $- ref rewriteTypeDef @@ var "mapExpr" @@ var "typ"--rewriteTermDef :: TBinding (((Term -> Term) -> Term -> Term) -> Term -> Term)-rewriteTermDef = define "rewriteTerm" $ lambda "f" $ lets [- "fsub">: lambdas ["recurse", "term"] $ lets [- "forElimination">: lambda "elm" $ cases _Elimination (var "elm") Nothing [- _Elimination_product>>: lambda "tp" $ Core.eliminationProduct $ var "tp",- _Elimination_record>>: lambda "p" $ Core.eliminationRecord $ var "p",- _Elimination_union>>: lambda "cs" $ Core.eliminationUnion $ Core.caseStatement- (Core.caseStatementTypeName $ var "cs")- (Optionals.map (var "recurse") (Core.caseStatementDefault $ var "cs"))- (Lists.map (var "forField") (Core.caseStatementCases $ var "cs")),- _Elimination_wrap>>: lambda "name" $ Core.eliminationWrap $ var "name"],- "forField">: lambda "f" $ Core.fieldWithTerm (var "recurse" @@ (Core.fieldTerm $ var "f")) (var "f"),- "forFunction">: lambda "fun" $ cases _Function (var "fun") Nothing [- _Function_elimination>>: lambda "elm" $ Core.functionElimination $ var "forElimination" @@ var "elm",- _Function_lambda>>: lambda "l" $ Core.functionLambda $ Core.lambda- (Core.lambdaParameter $ var "l")- (Core.lambdaDomain $ var "l")- (var "recurse" @@ (Core.lambdaBody $ var "l")),- _Function_primitive>>: lambda "name" $ Core.functionPrimitive $ var "name"],- "forLet">: lambda "lt" $ lets [- "mapBinding">: lambda "b" $ Core.binding- (Core.bindingName $ var "b")- (var "recurse" @@ (Core.bindingTerm $ var "b"))- (Core.bindingType $ var "b")] $- Core.let_- (Lists.map (var "mapBinding") (Core.letBindings $ var "lt"))- (var "recurse" @@ (Core.letEnvironment $ var "lt")),- "forMap">: lambda "m" $ lets [- "forPair">: lambda "p" $ pair (var "recurse" @@ (untuple 2 0 @@ var "p")) (var "recurse" @@ (untuple 2 1 @@ var "p"))] $- Maps.fromList $ Lists.map (var "forPair") $ Maps.toList $ var "m"] $- cases _Term (var "term") Nothing [- _Term_annotated>>: lambda "at" $ Core.termAnnotated $ Core.annotatedTerm- (var "recurse" @@ (Core.annotatedTermSubject $ var "at"))- (Core.annotatedTermAnnotation $ var "at"),- _Term_application>>: lambda "a" $ Core.termApplication $ Core.application- (var "recurse" @@ (Core.applicationFunction $ var "a"))- (var "recurse" @@ (Core.applicationArgument $ var "a")),- _Term_function>>: lambda "fun" $ Core.termFunction $ var "forFunction" @@ var "fun",- _Term_let>>: lambda "lt" $ Core.termLet $ var "forLet" @@ var "lt",- _Term_list>>: lambda "els" $ Core.termList $ Lists.map (var "recurse") (var "els"),- _Term_literal>>: lambda "v" $ Core.termLiteral $ var "v",- _Term_map>>: lambda "m" $ Core.termMap $ var "forMap" @@ var "m",- _Term_wrap>>: lambda "wt" $ Core.termWrap $ Core.wrappedTerm- (Core.wrappedTermTypeName $ var "wt")- (var "recurse" @@ (Core.wrappedTermObject $ var "wt")),- _Term_optional>>: lambda "m" $ Core.termOptional $ Optionals.map (var "recurse") (var "m"),- _Term_product>>: lambda "tuple" $ Core.termProduct $ Lists.map (var "recurse") (var "tuple"),- _Term_record>>: lambda "r" $ Core.termRecord $ Core.record- (Core.recordTypeName $ var "r")- (Lists.map (var "forField") (Core.recordFields $ var "r")),- _Term_set>>: lambda "s" $ Core.termSet $ Sets.fromList $ Lists.map (var "recurse") $ Sets.toList (var "s"),- _Term_sum>>: lambda "s" $ Core.termSum $ Core.sum- (Core.sumIndex $ var "s")- (Core.sumSize $ var "s")- (var "recurse" @@ (Core.sumTerm $ var "s")),- _Term_typeApplication>>: lambda "tt" $ Core.termTypeApplication $ Core.typedTerm- (var "recurse" @@ (Core.typedTermTerm $ var "tt"))- (Core.typedTermType $ var "tt"),- _Term_typeLambda>>: lambda "ta" $ Core.termTypeLambda $ Core.typeLambda- (Core.typeLambdaParameter $ var "ta")- (var "recurse" @@ (Core.typeLambdaBody $ var "ta")),- _Term_union>>: lambda "i" $ Core.termUnion $ Core.injection- (Core.injectionTypeName $ var "i")- (var "forField" @@ (Core.injectionField $ var "i")),- _Term_unit>>: constant Core.termUnit,- _Term_variable>>: lambda "v" $ Core.termVariable $ var "v"]] $- ref rewriteDef @@ var "fsub" @@ var "f"- where- foo = emit--emit :: String-emit = "pure"--rewriteTermMDef :: TBinding (((Term -> Flow s Term) -> Term -> Flow s Term) -> Term -> Flow s Term)-rewriteTermMDef = define "rewriteTermM" $- doc "Monadic term rewriting with custom transformation function" $- lambda "f" $ lets [- "fsub">: lambda "recurse" $ lambda "term" $ lets [- "forField">: lambda "f" $ Flows.map- (lambda "t" $ Core.fieldWithTerm (var "t") (var "f"))- (var "recurse" @@ Core.fieldTerm (var "f")),- "forPair">: lambda "kv" $ lets [- "k">: first $ var "kv",- "v">: second $ var "kv"] $ binds [- "km">: var "recurse" @@ var "k",- "vm">: var "recurse" @@ var "v"] $- produce $ pair (var "km") (var "vm"),- "mapBinding">: lambda "binding" $ lets [- "k">: Core.bindingName $ var "binding",- "v">: Core.bindingTerm $ var "binding",- "t">: Core.bindingType $ var "binding"] $ binds [- "v'">: var "recurse" @@ var "v"] $- produce $ Core.binding (var "k") (var "v'") (var "t")] $- cases _Term (var "term") Nothing [- _Term_annotated>>: lambda "at" $ binds [- "ex">: var "recurse" @@ Core.annotatedTermSubject (var "at")] $- produce $ Core.termAnnotated $ Core.annotatedTerm (var "ex") (Core.annotatedTermAnnotation $ var "at"),- _Term_application>>: lambda "app" $ binds [- "lhs">: var "recurse" @@ Core.applicationFunction (var "app"),- "rhs">: var "recurse" @@ Core.applicationArgument (var "app")] $- produce $ Core.termApplication $ Core.application (var "lhs") (var "rhs"),- _Term_function>>: lambda "fun" $ binds [- "rfun">: cases _Function (var "fun") Nothing [- _Function_elimination>>: lambda "e" $- cases _Elimination (var "e") Nothing [- _Elimination_product>>: lambda "tp" $ produce $ Core.functionElimination $ Core.eliminationProduct $ var "tp",- _Elimination_record>>: lambda "p" $ produce $ Core.functionElimination $ Core.eliminationRecord $ var "p",- _Elimination_union>>: lambda "cs" $ lets [- "n">: Core.caseStatementTypeName $ var "cs",- "def">: Core.caseStatementDefault $ var "cs",- "cases">: Core.caseStatementCases $ var "cs"]- $ Flows.bind- (Optionals.maybe (produce nothing)- (lambda "t" $ Flows.map (unaryFunction just) $ var "recurse" @@ var "t")- (var "def")) $- lambda "rdef" $- Flows.map- (lambda "rcases" $ Core.functionElimination $ Core.eliminationUnion $- Core.caseStatement (var "n") (var "rdef") (var "rcases"))- (Flows.mapList (var "forField") (var "cases")),- _Elimination_wrap>>: lambda "name" $ produce $ Core.functionElimination $ Core.eliminationWrap $ var "name"],- _Function_lambda>>: lambda "l" $ lets [- "v">: Core.lambdaParameter $ var "l",- "d">: Core.lambdaDomain $ var "l",- "body">: Core.lambdaBody $ var "l"] $ binds [- "rbody">: var "recurse" @@ var "body"] $- produce $ Core.functionLambda $ Core.lambda (var "v") (var "d") (var "rbody"),- _Function_primitive>>: lambda "name" $ produce $ Core.functionPrimitive $ var "name"]] $- produce $ Core.termFunction $ var "rfun",- _Term_let>>: lambda "lt" $ lets [- "bindings">: Core.letBindings $ var "lt",- "env">: Core.letEnvironment $ var "lt"] $ binds [- "rbindings">: Flows.mapList (var "mapBinding") (var "bindings"),- "renv">: var "recurse" @@ var "env"] $- produce $ Core.termLet $ Core.let_ (var "rbindings") (var "renv"),- _Term_list>>: lambda "els" $ binds [- "rels">: Flows.mapList (var "recurse") (var "els")] $- produce $ Core.termList $ var "rels",- _Term_literal>>: lambda "v" $ produce $ Core.termLiteral $ var "v",- _Term_map>>: lambda "m" $ binds [- "pairs">: Flows.mapList (var "forPair") $ Maps.toList $ var "m"] $- produce $ Core.termMap $ Maps.fromList $ var "pairs",- _Term_optional>>: lambda "m" $ binds [- "rm">: Flows.mapOptional (var "recurse") (var "m")] $- produce $ Core.termOptional $ var "rm",- _Term_product>>: lambda "tuple" $ Flows.map- (lambda "rtuple" $ Core.termProduct $ var "rtuple")- (Flows.mapList (var "recurse") (var "tuple")),- _Term_record>>: lambda "r" $ lets [- "n">: Core.recordTypeName $ var "r",- "fields">: Core.recordFields $ var "r"] $- Flows.map- (lambda "rfields" $ Core.termRecord $ Core.record (var "n") (var "rfields"))- (Flows.mapList (var "forField") (var "fields")),- _Term_set>>: lambda "s" $ binds [- "rlist">: Flows.mapList (var "recurse") $ Sets.toList $ var "s"] $- produce $ Core.termSet $ Sets.fromList $ var "rlist",- _Term_sum>>: lambda "sum" $ lets [- "i">: Core.sumIndex $ var "sum",- "s">: Core.sumSize $ var "sum",- "trm">: Core.sumTerm $ var "sum"] $ binds [- "rtrm">: var "recurse" @@ var "trm"] $- produce $ Core.termSum $ Core.sum (var "i") (var "s") (var "rtrm"),- _Term_typeApplication>>: lambda "tt" $ binds [- "t">: var "recurse" @@ Core.typedTermTerm (var "tt")] $- produce $ Core.termTypeApplication $ Core.typedTerm (var "t") (Core.typedTermType (var "tt")),- _Term_typeLambda>>: lambda "tl" $ lets [- "v">: Core.typeLambdaParameter $ var "tl",- "body">: Core.typeLambdaBody $ var "tl"] $ binds [- "rbody">: var "recurse" @@ var "body"] $- produce $ Core.termTypeLambda $ Core.typeLambda (var "v") (var "rbody"),- _Term_union>>: lambda "i" $ lets [- "n">: Core.injectionTypeName $ var "i",- "field">: Core.injectionField $ var "i"] $- Flows.map- (lambda "rfield" $ Core.termUnion $ Core.injection (var "n") (var "rfield"))- (var "forField" @@ var "field"),- _Term_unit>>: constant $ produce Core.termUnit,- _Term_variable>>: lambda "v" $ produce $ Core.termVariable $ var "v",- _Term_wrap>>: lambda "wt" $ lets [- "name">: Core.wrappedTermTypeName $ var "wt",- "t">: Core.wrappedTermObject $ var "wt"] $ binds [- "rt">: var "recurse" @@ var "t"] $- produce $ Core.termWrap $ Core.wrappedTerm (var "name") (var "rt")]] $- ref rewriteDef @@ var "fsub" @@ var "f"--rewriteTypeDef :: TBinding (((Type -> Type) -> Type -> Type) -> Type -> Type)-rewriteTypeDef = define "rewriteType" $ lambda "f" $ lets [- "fsub">: lambdas ["recurse", "typ"] $ lets [- "forField">: lambda "f" $ Core.fieldTypeWithType (var "f") (var "recurse" @@ (Core.fieldTypeType $ var "f"))] $- cases _Type (var "typ") Nothing [- _Type_annotated>>: lambda "at" $ Core.typeAnnotated $ Core.annotatedType- (var "recurse" @@ (Core.annotatedTypeSubject $ var "at"))- (Core.annotatedTypeAnnotation $ var "at"),- _Type_application>>: lambda "app" $ Core.typeApplication $ Core.applicationType- (var "recurse" @@ (Core.applicationTypeFunction $ var "app"))- (var "recurse" @@ (Core.applicationTypeArgument $ var "app")),- _Type_function>>: lambda "fun" $ Core.typeFunction $ Core.functionType- (var "recurse" @@ (Core.functionTypeDomain $ var "fun"))- (var "recurse" @@ (Core.functionTypeCodomain $ var "fun")),- _Type_forall>>: lambda "lt" $ Core.typeForall $ Core.forallType- (Core.forallTypeParameter $ var "lt")- (var "recurse" @@ (Core.forallTypeBody $ var "lt")),- _Type_list>>: lambda "t" $ Core.typeList $ var "recurse" @@ var "t",- _Type_literal>>: lambda "lt" $ Core.typeLiteral $ var "lt",- _Type_map>>: lambda "mt" $ Core.typeMap $ Core.mapType- (var "recurse" @@ (Core.mapTypeKeys $ var "mt"))- (var "recurse" @@ (Core.mapTypeValues $ var "mt")),- _Type_optional>>: lambda "t" $ Core.typeOptional $ var "recurse" @@ var "t",- _Type_product>>: lambda "ts" $ Core.typeProduct $ Lists.map (var "recurse") (var "ts"),- _Type_record>>: lambda "rt" $ Core.typeRecord $ Core.rowType- (Core.rowTypeTypeName $ var "rt")- (Lists.map (var "forField") (Core.rowTypeFields $ var "rt")),- _Type_set>>: lambda "t" $ Core.typeSet $ var "recurse" @@ var "t",- _Type_sum>>: lambda "ts" $ Core.typeSum $ Lists.map (var "recurse") (var "ts"),- _Type_union>>: lambda "rt" $ Core.typeUnion $ Core.rowType- (Core.rowTypeTypeName $ var "rt")- (Lists.map (var "forField") (Core.rowTypeFields $ var "rt")),- _Type_unit>>: constant Core.typeUnit,- _Type_variable>>: lambda "v" $ Core.typeVariable $ var "v",- _Type_wrap>>: lambda "wt" $ Core.typeWrap $ Core.wrappedType- (Core.wrappedTypeTypeName $ var "wt")- (var "recurse" @@ (Core.wrappedTypeObject $ var "wt"))]] $- ref rewriteDef @@ var "fsub" @@ var "f"--rewriteTypeMDef :: TBinding (((Type -> Flow s Type) -> Type -> Flow s Type) -> Type -> Flow s Type)-rewriteTypeMDef = define "rewriteTypeM" $- doc "Monadic type rewriting" $ lets [- "fsub">: lambdas ["recurse", "typ"] $ cases _Type (var "typ") Nothing [- _Type_annotated>>: lambda "at" $ binds [- "t">: var "recurse" @@ (Core.annotatedTypeSubject $ var "at")] $- produce $ Core.typeAnnotated $ Core.annotatedType (var "t") (Core.annotatedTypeAnnotation $ var "at"),- _Type_application>>: lambda "at" $ binds [- "lhs">: var "recurse" @@ (Core.applicationTypeFunction $ var "at"),- "rhs">: var "recurse" @@ (Core.applicationTypeArgument $ var "at")] $- produce $ Core.typeApplication $ Core.applicationType (var "lhs") (var "rhs"),- _Type_function>>: lambda "ft" $ binds [- "dom">: var "recurse" @@ (Core.functionTypeDomain $ var "ft"),- "cod">: var "recurse" @@ (Core.functionTypeCodomain $ var "ft")] $- produce $ Core.typeFunction $ Core.functionType (var "dom") (var "cod"),- _Type_forall>>: lambda "ft" $ binds [- "b">: var "recurse" @@ (Core.forallTypeBody $ var "ft")] $- produce $ Core.typeForall $ Core.forallType (Core.forallTypeParameter $ var "ft") (var "b"),- _Type_list>>: lambda "t" $ binds [- "rt">: var "recurse" @@ var "t"] $- produce $ Core.typeList $ var "rt",- _Type_literal>>: lambda "lt" $ produce $ Core.typeLiteral $ var "lt",- _Type_map>>: lambda "mt" $ binds [- "kt">: var "recurse" @@ (Core.mapTypeKeys $ var "mt"),- "vt">: var "recurse" @@ (Core.mapTypeValues $ var "mt")] $- produce $ Core.typeMap $ Core.mapType (var "kt") (var "vt"),- _Type_optional>>: lambda "t" $ binds [- "rt">: var "recurse" @@ var "t"] $- produce $ Core.typeOptional $ var "rt",- _Type_product>>: lambda "types" $ binds [- "rtypes">: Flows.mapList (var "recurse") (var "types")] $- produce $ Core.typeProduct $ var "rtypes",- _Type_record>>: lambda "rt" $ lets [- "name">: Core.rowTypeTypeName $ var "rt",- "fields">: Core.rowTypeFields $ var "rt",- "forField">: lambda "f" $ binds [- "t">: var "recurse" @@ (Core.fieldTypeType $ var "f")] $- produce $ Core.fieldTypeWithType (var "f") (var "t")] $ binds [- "rfields">: Flows.mapList (var "forField") (var "fields")] $- produce $ Core.typeRecord $ Core.rowType (var "name") (var "rfields"),- _Type_set>>: lambda "t" $ binds [- "rt">: var "recurse" @@ var "t"] $- produce $ Core.typeSet $ var "rt",- _Type_sum>>: lambda "types" $ binds [- "rtypes">: Flows.mapList (var "recurse") (var "types")] $- produce $ Core.typeSum $ var "rtypes",- _Type_union>>: lambda "rt" $ lets [- "name">: Core.rowTypeTypeName $ var "rt",- "fields">: Core.rowTypeFields $ var "rt",- "forField">: lambda "f" $ binds [- "t">: var "recurse" @@ (Core.fieldTypeType $ var "f")] $- produce $ Core.fieldTypeWithType (var "f") (var "t")] $ binds [- "rfields">: Flows.mapList (var "forField") (var "fields")] $- produce $ Core.typeUnion $ Core.rowType (var "name") (var "rfields"),- _Type_unit>>: constant $ produce Core.typeUnit,- _Type_variable>>: lambda "v" $ produce $ Core.typeVariable $ var "v",- _Type_wrap>>: lambda "wt" $ binds [- "t">: var "recurse" @@ (Core.wrappedTypeObject $ var "wt")] $- produce $ Core.typeWrap $ Core.wrappedType (Core.wrappedTypeTypeName $ var "wt") (var "t")]] $- lambda "f" $ ref rewriteDef @@ var "fsub" @@ var "f"--simplifyTermDef :: TBinding (Term -> Term)-simplifyTermDef = define "simplifyTerm" $- doc "Simplify terms by applying beta reduction where possible" $- lambda "term" $ lets [- "simplify">: lambdas ["recurse", "term"] $ lets [- "stripped">: ref deannotateTermDef @@ var "term"] $- var "recurse" @@ (cases _Term (var "stripped")- (Just $ var "term") [- _Term_application>>: lambda "app" $ lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app",- "strippedLhs">: ref deannotateTermDef @@ var "lhs"] $- cases _Term (var "strippedLhs")- (Just $ var "term") [- _Term_function>>: match _Function- (Just $ var "term") [- _Function_lambda>>: lambda "l" $ lets [- "var">: Core.lambdaParameter $ var "l",- "body">: Core.lambdaBody $ var "l"] $- Logic.ifElse (Sets.member (var "var") (ref freeVariablesInTermDef @@ var "body"))- (lets [- "strippedRhs">: ref deannotateTermDef @@ var "rhs"] $- cases _Term (var "strippedRhs")- (Just $ var "term") [- _Term_variable>>: lambda "v" $- ref simplifyTermDef @@ (ref substituteVariableDef @@ var "var" @@ var "v" @@ var "body")])- (ref simplifyTermDef @@ var "body")]]])] $- ref rewriteTermDef @@ var "simplify" @@ var "term"--substituteTypeVariablesDef :: TBinding (M.Map Name Name -> Type -> Type)-substituteTypeVariablesDef = define "substituteTypeVariables" $- doc "Substitute type variables in a type" $- lambdas ["subst", "typ"] $ lets [- "replace">: lambdas ["recurse", "typ"] $ cases _Type (var "typ")- (Just $ var "recurse" @@ var "typ") [- _Type_variable>>: lambda "n" $- Core.typeVariable $ Optionals.fromMaybe (var "n") $ Maps.lookup (var "n") (var "subst")]] $- ref rewriteTypeDef @@ var "replace" @@ var "typ"--substituteVariableDef :: TBinding (Name -> Name -> Term -> Term)-substituteVariableDef = define "substituteVariable" $- doc "Substitute one variable for another in a term" $- lambdas ["from", "to", "term"] $ lets [- "replace">: lambdas ["recurse", "term"] $- cases _Term (var "term")- (Just $ var "recurse" @@ var "term") [- _Term_variable>>: lambda "x" $- Core.termVariable $ Logic.ifElse (Equality.equal (var "x") (var "from")) (var "to") (var "x"),- _Term_function>>: match _Function- (Just $ var "recurse" @@ var "term") [- _Function_lambda>>: lambda "l" $ Logic.ifElse- (Equality.equal (Core.lambdaParameter $ var "l") (var "from"))- (var "term")- (var "recurse" @@ var "term")]]] $- ref rewriteTermDef @@ var "replace" @@ var "term"--substituteVariablesDef :: TBinding (M.Map Name Name -> Term -> Term)-substituteVariablesDef = define "substituteVariables" $- doc "Substitute multiple variables in a term" $- lambdas ["subst", "term"] $ lets [- "replace">: lambdas ["recurse", "term"] $- cases _Term (var "term")- (Just $ var "recurse" @@ var "term") [- _Term_variable>>: lambda "n" $- Core.termVariable $ Optionals.fromMaybe (var "n") $ Maps.lookup (var "n") (var "subst"),- _Term_function>>: match _Function- (Just $ var "recurse" @@ var "term") [- _Function_lambda>>: lambda "l" $- Optionals.maybe- (var "recurse" @@ var "term")- (constant $ var "term")- (Maps.lookup (Core.lambdaParameter $ var "l") (var "subst"))]]] $- ref rewriteTermDef @@ var "replace" @@ var "term"--subtermsDef :: TBinding (Term -> [Term])-subtermsDef = define "subterms" $- doc "Find the children of a given term" $- match _Term Nothing [- _Term_annotated>>: lambda "at" $ list [Core.annotatedTermSubject $ var "at"],- _Term_application>>: lambda "p" $ list [- Core.applicationFunction $ var "p",- Core.applicationArgument $ var "p"],- _Term_function>>: match _Function- (Just $ list []) [- _Function_elimination>>: match _Elimination- (Just $ list []) [- _Elimination_union>>: lambda "cs" $ Lists.concat2- (Optionals.maybe (list []) (lambda "t" $ list [var "t"]) (Core.caseStatementDefault $ var "cs"))- (Lists.map (unaryFunction Core.fieldTerm) (Core.caseStatementCases $ var "cs"))],- _Function_lambda>>: lambda "l" $ list [Core.lambdaBody $ var "l"]],- _Term_let>>: lambda "lt" $ Lists.cons- (Core.letEnvironment $ var "lt")- (Lists.map (unaryFunction Core.bindingTerm) (Core.letBindings $ var "lt")),- _Term_list>>: lambda "l" $ var "l",- _Term_literal>>: constant $ list [],- _Term_map>>: lambda "m" $ Lists.concat $ Lists.map- (lambda "p" $ list [first $ var "p", second $ var "p"])- (Maps.toList $ var "m"),- _Term_optional>>: lambda "m" $ Optionals.maybe (list []) (lambda "t" $ list [var "t"]) (var "m"),- _Term_product>>: lambda "tuple" $ var "tuple",- _Term_record>>: lambda "rt" (Lists.map (unaryFunction Core.fieldTerm) (Core.recordFields $ var "rt")),- _Term_set>>: lambda "l" $ Sets.toList $ var "l",- _Term_sum>>: lambda "st" $ list [Core.sumTerm $ var "st"],- _Term_typeApplication>>: lambda "ta" $ list [Core.typedTermTerm $ var "ta"],- _Term_typeLambda>>: lambda "ta" $ list [Core.typeLambdaBody $ var "ta"],- _Term_union>>: lambda "ut" $ list [Core.fieldTerm $ (Core.injectionField $ var "ut")],- _Term_unit>>: constant $ list [],- _Term_variable>>: constant $ list [],- _Term_wrap>>: lambda "n" $ list [Core.wrappedTermObject $ var "n"]]--subtermsWithAccessorsDef :: TBinding (Term -> [(TermAccessor, Term)])-subtermsWithAccessorsDef = define "subtermsWithAccessors" $- doc "Find the children of a given term" $- match _Term Nothing [- _Term_annotated>>: lambda "at" $ single Mantle.termAccessorAnnotatedSubject $ Core.annotatedTermSubject $ var "at",- _Term_application>>: lambda "p" $ list [- result Mantle.termAccessorApplicationFunction $ Core.applicationFunction $ var "p",- result Mantle.termAccessorApplicationArgument $ Core.applicationArgument $ var "p"],- _Term_function>>: match _Function- (Just none) [- _Function_elimination>>: match _Elimination- (Just none) [- _Elimination_union>>: lambda "cs" $ Lists.concat2- (Optionals.maybe none- (lambda "t" $ single Mantle.termAccessorUnionCasesDefault $ var "t")- (Core.caseStatementDefault $ var "cs"))- (Lists.map- (lambda "f" $ result (Mantle.termAccessorUnionCasesBranch $ Core.fieldName $ var "f") $ Core.fieldTerm $ var "f")- (Core.caseStatementCases $ var "cs"))],- _Function_lambda>>: lambda "l" $ single Mantle.termAccessorLambdaBody $ Core.lambdaBody $ var "l"],- _Term_let>>: lambda "lt" $ Lists.cons- (result Mantle.termAccessorLetEnvironment $ Core.letEnvironment $ var "lt")- (Lists.map- (lambda "b" $ result (Mantle.termAccessorLetBinding $ Core.bindingName $ var "b") $ Core.bindingTerm $ var "b")- (Core.letBindings $ var "lt")),- _Term_list>>: lambda "l" $ Lists.map- -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0- (lambda "e" $ result (Mantle.termAccessorListElement $ int32 0) $ var "e")- (var "l"),- _Term_literal>>: constant none,- _Term_map>>: lambda "m" (Lists.concat- (Lists.map- (lambda "p" $ list [- -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0- result (Mantle.termAccessorMapKey $ int32 0) $ first $ var "p",- result (Mantle.termAccessorMapValue $ int32 0) $ second $ var "p"])- (Maps.toList $ var "m"))),- _Term_optional>>: lambda "m" $ Optionals.maybe none- (lambda "t" $ single Mantle.termAccessorOptionalTerm $ var "t")- (var "m"),- _Term_product>>: lambda "p" $ Lists.map- -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0- (lambda "e" $ result (Mantle.termAccessorProductTerm $ int32 0) $ var "e")- (var "p"),- _Term_record>>: lambda "rt" (Lists.map- (lambda "f" $ result (Mantle.termAccessorRecordField $ Core.fieldName $ var "f") $ Core.fieldTerm $ var "f")- (Core.recordFields $ var "rt")),- _Term_set>>: lambda "s" $ Lists.map- -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0- (lambda "e" $ result (Mantle.termAccessorListElement $ int32 0) $ var "e")- (Sets.toList $ var "s"),- _Term_sum>>: lambda "st" $- single Mantle.termAccessorSumTerm $- Core.sumTerm $ var "st",- _Term_typeApplication>>: lambda "ta" $- single Mantle.termAccessorTypeApplicationTerm $- Core.typedTermTerm $ var "ta",- _Term_typeLambda>>: lambda "ta" $- single Mantle.termAccessorTypeLambdaBody $- Core.typeLambdaBody $ var "ta",- _Term_union>>: lambda "ut" $- single Mantle.termAccessorInjectionTerm $- Core.fieldTerm $ (Core.injectionField $ var "ut"),- _Term_unit>>: constant none,- _Term_variable>>: constant none,- _Term_wrap>>: lambda "n" $ single Mantle.termAccessorWrappedTerm $ Core.wrappedTermObject $ var "n"]- where- none = list []- single accessor term = list [result accessor term]- result accessor term = pair accessor term- simple term = result Mantle.termAccessorAnnotatedSubject term--subtypesDef :: TBinding (Type -> [Type])-subtypesDef = define "subtypes" $- doc "Find the children of a given type expression" $- match _Type Nothing [- _Type_annotated>>: lambda "at" $ list [Core.annotatedTypeSubject $ var "at"],- _Type_application>>: lambda "at" $ list [- Core.applicationTypeFunction $ var "at",- Core.applicationTypeArgument $ var "at"],- _Type_function>>: lambda "ft" $ list [- Core.functionTypeDomain $ var "ft",- Core.functionTypeCodomain $ var "ft"],- _Type_forall>>: lambda "lt" $ list [Core.forallTypeBody $ var "lt"],- _Type_list>>: lambda "lt" $ list [var "lt"],- _Type_literal>>: constant $ list [],- _Type_map>>: lambda "mt" $ list [- Core.mapTypeKeys $ var "mt",- Core.mapTypeValues $ var "mt"],- _Type_optional>>: lambda "ot" $ list [var "ot"],- _Type_product>>: lambda "pt" $ var "pt",- _Type_record>>: lambda "rt" (Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields $ var "rt")),- _Type_set>>: lambda "st" $ list [var "st"],- _Type_sum>>: lambda "st" $ var "st",- _Type_union>>: lambda "rt" (Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields $ var "rt")),- _Type_unit>>: constant $ list [],- _Type_variable>>: constant $ list [],- _Type_wrap>>: lambda "nt" $ list [Core.wrappedTypeObject $ var "nt"]]--termDependencyNamesDef :: TBinding (Bool -> Bool -> Bool -> Term -> S.Set Name)-termDependencyNamesDef = define "termDependencyNames" $- doc "Note: does not distinguish between bound and free variables; use freeVariablesInTerm for that" $- lambdas ["binds", "withPrims", "withNoms"] $ lets [- "addNames">: lambdas ["names", "term"] $ lets [- "nominal">: lambda "name" $ Logic.ifElse (var "withNoms")- (Sets.insert (var "name") (var "names"))- (var "names"),- "prim">: lambda "name" $ Logic.ifElse (var "withPrims")- (Sets.insert (var "name") (var "names"))- (var "names"),- "var">: lambda "name" $ Logic.ifElse (var "binds")- (Sets.insert (var "name") (var "names"))- (var "names")]- $ cases _Term (var "term")- (Just $ var "names") [- _Term_function>>: lambda "f" $ cases _Function (var "f")- (Just $ var "names") [- _Function_primitive>>: lambda "name" $ var "prim" @@ var "name",- _Function_elimination>>: lambda "e" $ cases _Elimination (var "e")- (Just $ var "names") [- _Elimination_record>>: lambda "proj" $ var "nominal" @@ (Core.projectionTypeName $ var "proj"),- _Elimination_union>>: lambda "caseStmt" $ var "nominal" @@ (Core.caseStatementTypeName $ var "caseStmt"),- _Elimination_wrap>>: lambda "name" $ var "nominal" @@ var "name"]],- _Term_record>>: lambda "record" $ var "nominal" @@ (Core.recordTypeName $ var "record"),- _Term_union>>: lambda "injection" $ var "nominal" @@ (Core.injectionTypeName $ var "injection"),- _Term_variable>>: lambda "name" $ var "var" @@ var "name",- _Term_wrap>>: lambda "wrappedTerm" $ var "nominal" @@ (Core.wrappedTermTypeName $ var "wrappedTerm")]]- $ ref foldOverTermDef @@ Coders.traversalOrderPre @@ var "addNames" @@ Sets.empty--toShortNamesDef :: TBinding ([Name] -> M.Map Name Name)-toShortNamesDef = define "toShortNames" $- doc "Generate short names from a list of fully qualified names" $- lambda "original" $ lets [- "groupNamesByLocal">: lambda "names" $ Lists.foldl (var "addName") Maps.empty (var "names"),- "addName">: lambda "acc" $ lambda "name" $ lets [- "local">: ref Names.localNameOfDef @@ var "name",- "group">: Optionals.fromMaybe Sets.empty $ Maps.lookup (var "local") (var "acc")]- $ Maps.insert (var "local") (Sets.insert (var "name") (var "group")) (var "acc"),- "groups">: var "groupNamesByLocal" @@ var "original",- "renameGroup">: lambda "localNames" $ lets [- "local">: first $ var "localNames",- "names">: second $ var "localNames",- "rangeFrom">: lambda "start" $ Lists.cons (var "start") (var "rangeFrom" @@ (Math.add (var "start") (int32 1))),- "rename">: lambda "name" $ lambda "i" $ pair (var "name") $ Core.name $- Logic.ifElse (Equality.gt (var "i") (int32 1))- (Strings.cat2 (var "local") (Literals.showInt32 $ var "i"))- (var "local")]- $ Lists.zipWith (var "rename") (Sets.toList $ var "names") (var "rangeFrom" @@ int32 1)]- $ Maps.fromList $ Lists.concat $ Lists.map (var "renameGroup") $ Maps.toList $ var "groups"--topologicalSortBindingMapDef :: TBinding (M.Map Name Term -> [[(Name, Term)]])-topologicalSortBindingMapDef = define "topologicalSortBindingMap" $- doc "Topological sort of connected components, in terms of dependencies between variable/term binding pairs" $- lambda "bindingMap" $ lets [- "bindings">: Maps.toList $ var "bindingMap",- "keys">: Sets.fromList $ Lists.map (unaryFunction first) (var "bindings"),- "hasTypeAnnotation">: lambda "term" $- cases _Term (var "term")- (Just false) [- _Term_annotated>>: lambda "at" $ var "hasTypeAnnotation" @@ (Core.annotatedTermSubject $ var "at")],- "depsOf">: lambda "nameAndTerm" $ lets [- "name">: first $ var "nameAndTerm",- "term">: second $ var "nameAndTerm"]- $ pair (var "name") $ Logic.ifElse (var "hasTypeAnnotation" @@ var "term")- (list [])- (Sets.toList $ Sets.intersection (var "keys") $ ref freeVariablesInTermDef @@ var "term"),- "toPair">: lambda "name" $ pair (var "name") $ Optionals.fromMaybe- (Core.termLiteral $ Core.literalString $ string "Impossible!")- (Maps.lookup (var "name") (var "bindingMap"))]- $ Lists.map (unaryFunction $ Lists.map $ var "toPair") (ref Sorting.topologicalSortComponentsDef @@ Lists.map (var "depsOf") (var "bindings"))--topologicalSortBindingsDef :: TBinding ([Binding] -> Either [[Name]] [Name])-topologicalSortBindingsDef = define "topologicalSortBindings" $- doc "Topological sort of elements based on their dependencies" $- lambda "els" $ lets [- "adjlist">: lambda "e" $ pair- (Core.bindingName $ var "e")- (Sets.toList $ ref termDependencyNamesDef @@ false @@ true @@ true @@ (Core.bindingTerm $ var "e"))]- $ ref Sorting.topologicalSortDef @@ Lists.map (var "adjlist") (var "els")--typeDependencyNamesDef :: TBinding (Bool -> Type -> S.Set Name)-typeDependencyNamesDef = define "typeDependencyNames" $- lambdas ["withSchema", "typ"] $- Logic.ifElse (var "withSchema")- (Sets.union- (ref freeVariablesInTypeDef @@ var "typ")- (ref typeNamesInTypeDef @@ var "typ"))- (ref freeVariablesInTypeDef @@ var "typ")--typeNamesInTypeDef :: TBinding (Type -> S.Set Name)-typeNamesInTypeDef = define "typeNamesInType" $ lets [- "addNames">: lambdas ["names", "typ"] $ cases _Type (var "typ")- (Just $ var "names") [- _Type_record>>: lambda "rowType" $ lets [- "tname">: Core.rowTypeTypeName $ var "rowType"] $- Sets.insert (var "tname") (var "names"),- _Type_union>>: lambda "rowType" $ lets [- "tname">: Core.rowTypeTypeName $ var "rowType"] $- Sets.insert (var "tname") (var "names"),- _Type_wrap>>: lambda "wrappedType" $ lets [- "tname">: Core.wrappedTypeTypeName $ var "wrappedType"] $- Sets.insert (var "tname") (var "names")]] $- ref foldOverTypeDef @@ Coders.traversalOrderPre @@ var "addNames" @@ Sets.empty++module Hydra.Sources.Kernel.Terms.Rewriting where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ applyInsideTypeLambdasAndAnnotations,+ deannotateAndDetypeTerm,+ deannotateTerm,+ deannotateType,+ deannotateTypeParameters,+ deannotateTypeRecursive,+ deannotateTypeSchemeRecursive,+ detypeTerm,+ flattenLetTerms,+ stripTypeLambdas,+ foldOverTerm,+ foldOverType,+ freeTypeVariablesInTerm,+ freeVariablesInTerm,+ freeVariablesInType,+ freeVariablesInTypeOrdered,+ freeVariablesInTypeSimple,+ freeVariablesInTypeScheme,+ freeVariablesInTypeSchemeSimple,+ inlineType,+ isFreeVariableInTerm,+ isLambda,+ liftLambdaAboveLet,+ mapBeneathTypeAnnotations,+ normalizeTypeVariablesInTerm,+ pruneLet,+ removeTermAnnotations,+ removeTypeAnnotations,+ removeTypeAnnotationsFromTerm,+ removeTypesFromTerm,+ replaceFreeTermVariable,+ replaceFreeTypeVariable,+ replaceTypedefs,+ rewriteAndFoldTerm,+ rewriteAndFoldTermM,+ rewriteAndFoldTermWithPath,+ rewriteTerm,+ rewriteTermM,+ rewriteTermWithContext,+ rewriteTermWithContextM,+ rewriteType,+ rewriteTypeM,+ simplifyTerm,+ substituteTypeVariables,+ substituteVariable,+ substituteVariables,+ subterms,+ subtermsWithAccessors,+ subtypes,+ termDependencyNames,+ toShortNames,+ topologicalSortBindingMap,+ topologicalSortBindings,+ typeDependencyNames,+ typeNamesInType,+ unshadowVariables)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+++ns :: Namespace+ns = Namespace "hydra.rewriting"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Names.ns, Sorting.ns]+ kernelTypesNamespaces $+ Just ("Utilities for type and term rewriting and analysis.")+ where+ elements = [+ toBinding applyInsideTypeLambdasAndAnnotations,+ toBinding deannotateAndDetypeTerm,+ toBinding deannotateTerm,+ toBinding deannotateType,+ toBinding deannotateTypeParameters,+ toBinding deannotateTypeRecursive,+ toBinding deannotateTypeSchemeRecursive,+ toBinding detypeTerm,+ toBinding flattenLetTerms,+ toBinding foldOverTerm,+ toBinding foldOverType,+ toBinding freeTypeVariablesInTerm,+ toBinding freeVariablesInTerm,+-- toBinding freeVariablesInTermOpt,+ toBinding freeVariablesInType,+ toBinding freeVariablesInTypeOrdered,+ toBinding freeVariablesInTypeSchemeSimple,+ toBinding freeVariablesInTypeScheme,+ toBinding freeVariablesInTypeSimple,+ toBinding inlineType,+ toBinding isFreeVariableInTerm,+ toBinding isLambda,+ toBinding liftLambdaAboveLet,+ toBinding mapBeneathTypeAnnotations,+ toBinding normalizeTypeVariablesInTerm,+ toBinding pruneLet,+ toBinding removeTermAnnotations,+ toBinding removeTypeAnnotations,+ toBinding removeTypeAnnotationsFromTerm,+ toBinding removeTypesFromTerm,+ toBinding replaceFreeTermVariable,+ toBinding replaceFreeTypeVariable,+ toBinding replaceTypedefs,+-- toBinding rewrite,+ toBinding rewriteAndFoldTerm,+ toBinding rewriteAndFoldTermM,+ toBinding rewriteAndFoldTermWithPath,+ toBinding rewriteTerm,+ toBinding rewriteTermM,+ toBinding rewriteTermWithContext,+ toBinding rewriteTermWithContextM,+ toBinding rewriteType,+ toBinding rewriteTypeM,+ toBinding simplifyTerm,+ toBinding substituteTypeVariables,+ toBinding substituteVariable,+ toBinding substituteVariables,+ toBinding stripTypeLambdas,+ toBinding subterms,+ toBinding subtermsWithAccessors,+ toBinding subtypes,+ toBinding termDependencyNames,+ toBinding toShortNames,+ toBinding topologicalSortBindingMap,+ toBinding topologicalSortBindings,+ toBinding typeDependencyNames,+ toBinding typeNamesInType,+ toBinding unshadowVariables]++applyInsideTypeLambdasAndAnnotations :: TBinding ((Term -> Term) -> Term -> Term)+applyInsideTypeLambdasAndAnnotations = define "applyInsideTypeLambdasAndAnnotations" $+ doc "Apply a term-level function inside any leading type lambdas" $+ "f" ~> "term0" ~> cases _Term (var "term0")+ (Just $ var "f" @@ var "term0") [+ _Term_annotated>>: "at" ~> Core.termAnnotated $ Core.annotatedTermWithBody (var "at")+ (applyInsideTypeLambdasAndAnnotations @@ var "f" @@ (Core.annotatedTermBody $ var "at")),+ _Term_typeLambda>>: "tl" ~> Core.termTypeLambda $ Core.typeLambdaWithBody (var "tl")+ (applyInsideTypeLambdasAndAnnotations @@ var "f" @@ (Core.typeLambdaBody $ var "tl"))]++deannotateAndDetypeTerm :: TBinding (Term -> Term)+deannotateAndDetypeTerm = define "deannotateAndDetypeTerm" $+ doc "Strip type annotations from the top levels of a term" $+ "t" ~> cases _Term (var "t")+ (Just $ var "t") [+ _Term_annotated>>: "at" ~> deannotateAndDetypeTerm @@ (Core.annotatedTermBody $ var "at"),+ _Term_typeApplication>>: "tt" ~> deannotateAndDetypeTerm @@ (Core.typeApplicationTermBody $ var "tt"),+ _Term_typeLambda>>: "ta" ~> deannotateAndDetypeTerm @@ (Core.typeLambdaBody $ var "ta")]++deannotateTerm :: TBinding (Term -> Term)+deannotateTerm = define "deannotateTerm" $+ doc "Strip all annotations (including System F type annotations) from the top levels of a term" $+ "t" ~> cases _Term (var "t")+ (Just $ var "t") [+ _Term_annotated>>: "at" ~> deannotateTerm @@ (Core.annotatedTermBody $ var "at")]++deannotateType :: TBinding (Type -> Type)+deannotateType = define "deannotateType" $+ doc "Strip all annotations from a term" $+ "t" ~> cases _Type (var "t")+ (Just $ var "t") [+ _Type_annotated>>: deannotateType <.> (project _AnnotatedType _AnnotatedType_body)]++deannotateTypeParameters :: TBinding (Type -> Type)+deannotateTypeParameters = define "deannotateTypeParameters" $+ doc "Strip any top-level type lambdas from a type, extracting the (possibly nested) type body" $+ "t" ~> cases _Type (deannotateType @@ var "t")+ (Just $ var "t") [+ _Type_forall>>: "lt" ~> deannotateTypeParameters @@ (project _ForallType _ForallType_body @@ var "lt")]++deannotateTypeRecursive :: TBinding (Type -> Type)+deannotateTypeRecursive = define "deannotateTypeRecursive" $+ doc "Recursively strip all annotations from a type" $+ "typ" ~>+ "strip" <~ ("recurse" ~> "typ" ~>+ "rewritten" <~ var "recurse" @@ var "typ" $+ cases _Type (var "rewritten")+ (Just $ var "rewritten") [+ _Type_annotated>>: "at" ~> Core.annotatedTypeBody $ var "at"]) $+ rewriteType @@ var "strip" @@ var "typ"++deannotateTypeSchemeRecursive :: TBinding (TypeScheme -> TypeScheme)+deannotateTypeSchemeRecursive = define "deannotateTypeSchemeRecursive" $+ doc "Recursively strip all annotations from a type scheme" $+ "ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "typ" <~ Core.typeSchemeType (var "ts") $+ "constraints" <~ Core.typeSchemeConstraints (var "ts") $+ Core.typeScheme (var "vars") (deannotateTypeRecursive @@ var "typ") (var "constraints")++detypeTerm :: TBinding (Term -> Term)+detypeTerm = define "detypeTerm" $+ doc "Strip System F type annotations from the top levels of a term, but leave application-specific annotations intact" $+ "t" ~> cases _Term (var "t")+ (Just $ var "t") [+ _Term_annotated>>: "at" ~>+ "subj" <~ Core.annotatedTermBody (var "at") $+ "ann" <~ Core.annotatedTermAnnotation (var "at") $+ Core.termAnnotated $ Core.annotatedTerm (detypeTerm @@ var "subj") (var "ann"),+ _Term_typeApplication>>: "tt" ~> deannotateAndDetypeTerm @@ (Core.typeApplicationTermBody $ var "tt"),+ _Term_typeLambda>>: "ta" ~> deannotateAndDetypeTerm @@ (Core.typeLambdaBody $ var "ta")]++stripTypeLambdas :: TBinding (Term -> Term)+stripTypeLambdas = define "stripTypeLambdas" $+ doc "Strip outer type lambda wrappers from a term, preserving type application wrappers and annotations" $+ "t" ~> cases _Term (var "t")+ (Just $ var "t") [+ _Term_annotated>>: "at" ~>+ "subj" <~ Core.annotatedTermBody (var "at") $+ "ann" <~ Core.annotatedTermAnnotation (var "at") $+ Core.termAnnotated $ Core.annotatedTerm (stripTypeLambdas @@ var "subj") (var "ann"),+ _Term_typeLambda>>: "ta" ~> stripTypeLambdas @@ (Core.typeLambdaBody $ var "ta")]++flattenLetTerms :: TBinding (Term -> Term)+flattenLetTerms = define "flattenLetTerms" $+ doc "Flatten nested let expressions" $+ "term" ~>+ "rewriteBinding" <~ ("binding" ~>+ "key0" <~ Core.bindingName (var "binding") $+ "val0" <~ Core.bindingTerm (var "binding") $+ "t" <~ Core.bindingType (var "binding") $+ cases _Term (var "val0")+ (Just $ pair (Core.binding (var "key0") (var "val0") (var "t")) (list ([] :: [TTerm Binding]))) [+ _Term_annotated>>: "at" ~>+ "val1" <~ Core.annotatedTermBody (var "at") $+ "ann" <~ Core.annotatedTermAnnotation (var "at") $+ "recursive" <~ var "rewriteBinding" @@ (Core.binding (var "key0") (var "val1") (var "t")) $+ "innerBinding" <~ Pairs.first (var "recursive") $+ "deps" <~ Pairs.second (var "recursive") $+ "val2" <~ Core.bindingTerm (var "innerBinding") $+ pair+ (Core.binding (var "key0") (Core.termAnnotated $ Core.annotatedTerm (var "val2") (var "ann")) (var "t"))+ (var "deps"),+ _Term_let>>: "innerLet" ~>+ "bindings1" <~ Core.letBindings (var "innerLet") $+ "body1" <~ Core.letBody (var "innerLet") $+ "prefix" <~ Strings.cat2 (unwrap _Name @@ var "key0") (string "_") $+ "qualify" <~ ("n" ~> Core.name $ Strings.cat2 (var "prefix") (unwrap _Name @@ var "n")) $+ "toSubstPair" <~ ("b" ~> pair (Core.bindingName $ var "b") (var "qualify" @@ (Core.bindingName $ var "b"))) $+ "subst" <~ Maps.fromList (Lists.map (var "toSubstPair") (var "bindings1")) $+ "replaceVars" <~ substituteVariables @@ var "subst" $+ "newBody" <~ var "replaceVars" @@ var "body1" $+ "newBinding" <~ ("b" ~> Core.binding+ (var "qualify" @@ (Core.bindingName $ var "b"))+ (var "replaceVars" @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b")) $+ pair+ (Core.binding (var "key0") (var "newBody") (var "t"))+ (Lists.map (var "newBinding") (var "bindings1"))]) $+ -- flattenBodyLet: if body is a let, merge its bindings into the outer let+ -- Note: The default case uses concat2 with empty list to force bindings to have type [Binding]+ -- This ensures proper type inference and prevents incorrect generalization+ "flattenBodyLet" <~ ("bindings" ~> "body" ~>+ cases _Term (var "body") (Just $ pair (Lists.concat2 (list ([] :: [TTerm Binding])) (var "bindings")) (var "body")) [+ _Term_let>>: "innerLt" ~>+ "innerBindings" <~ Core.letBindings (var "innerLt") $+ "innerBody" <~ Core.letBody (var "innerLt") $+ var "flattenBodyLet" @@ Lists.concat2 (var "bindings") (var "innerBindings") @@ var "innerBody"]) $+ "flatten" <~ ("recurse" ~> "term" ~>+ "rewritten" <~ var "recurse" @@ var "term" $+ cases _Term (var "rewritten")+ (Just $ var "rewritten") [+ _Term_let>>: "lt" ~>+ "bindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ -- Put dependencies BEFORE the binding that depends on them+ -- This is important for hoisting: dependencies need to be hoisted first+ -- so that transitive capture works correctly+ "forResult" <~ ("hr" ~> Lists.concat2 (Pairs.second $ var "hr") (Lists.pure (Pairs.first $ var "hr"))) $+ "flattenedBindings" <~ Lists.concat (Lists.map (var "forResult" <.> var "rewriteBinding") (var "bindings")) $+ -- Now check if body is also a let and merge those bindings too+ "merged" <~ var "flattenBodyLet" @@ var "flattenedBindings" @@ var "body" $+ "newBindings" <~ Pairs.first (var "merged") $+ "newBody" <~ Pairs.second (var "merged") $+ Core.termLet $ Core.let_ (var "newBindings") (var "newBody")]) $+ rewriteTerm @@ var "flatten" @@ var "term"++foldOverTerm :: TBinding (TraversalOrder -> (x -> Term -> x) -> x -> Term -> x)+foldOverTerm = define "foldOverTerm" $+ doc "Fold over a term, traversing its subterms in the specified order" $+ "order" ~> "fld" ~> "b0" ~> "term" ~> cases _TraversalOrder (var "order") Nothing [+ _TraversalOrder_pre>>: constant (Phantoms.fold (foldOverTerm @@ var "order" @@ var "fld")+ @@ (var "fld" @@ var "b0" @@ var "term")+ @@ (subterms @@ var "term")),+ _TraversalOrder_post>>: constant (var "fld"+ @@ (Phantoms.fold (foldOverTerm @@ var "order" @@ var "fld")+ @@ (var "b0")+ @@ (subterms @@ var "term"))+ @@ var "term")]++foldOverType :: TBinding (TraversalOrder -> (x -> Type -> x) -> x -> Type -> x)+foldOverType = define "foldOverType" $+ doc "Fold over a type, traversing its subtypes in the specified order" $+ "order" ~> "fld" ~> "b0" ~> "typ" ~> cases _TraversalOrder (var "order") Nothing [+ _TraversalOrder_pre>>: constant (Phantoms.fold (foldOverType @@ var "order" @@ var "fld")+ @@ (var "fld" @@ var "b0" @@ var "typ")+ @@ (subtypes @@ var "typ")),+ _TraversalOrder_post>>: constant (var "fld"+ @@ (Phantoms.fold (foldOverType @@ var "order" @@ var "fld")+ @@ (var "b0")+ @@ (subtypes @@ var "typ"))+ @@ var "typ")]++--freeTypeVariablesInTerm :: TBinding (Term -> S.Set Name)+--freeTypeVariablesInTerm = define "freeTypeVariablesInTerm" $+-- doc "Find free type variables introduced by type applications within a term." $+-- "term" ~> cases _Term (var "term")+-- (Just $ Lists.foldl (binaryFunction Sets.union) Sets.empty $+-- Lists.map (freeTypeVariablesInTerm) (subterms @@ var "term")) [+-- _Term_typeApplication>>: "tt" ~> Sets.union+-- (freeVariablesInType @@ (Core.typeApplicationTermType $ var "tt"))+-- (freeTypeVariablesInTerm @@ (Core.typeApplicationTermBody $ var "tt")),+-- _Term_typeLambda>>: "tl" ~>+-- "tmp" <~ freeTypeVariablesInTerm @@ (Core.typeLambdaBody $ var "tl") $+-- Sets.delete (Core.typeLambdaParameter $ var "tl") (var "tmp")]++freeTypeVariablesInTerm :: TBinding (Term -> S.Set Name)+freeTypeVariablesInTerm = define "freeTypeVariablesInTerm" $+ doc ("Get the set of free type variables in a term (including schema names, where they appear in type annotations)."+ <> " In this context, only the type schemes of let bindings can bind type variables; type lambdas do not.") $+ "term0" ~>+ "allOf" <~ ("sets" ~> Lists.foldl (binaryFunction Sets.union) Sets.empty $ var "sets") $+ "tryType" <~ ("tvars" ~> "typ" ~> Sets.difference (freeVariablesInType @@ var "typ") (var "tvars")) $+ "getAll" <~ ("vars" ~> "term" ~>+ "recurse" <~ var "getAll" @@ var "vars" $+ "dflt" <~ (var "allOf" @@ Lists.map (var "recurse") (subterms @@ var "term")) $+ cases _Term (var "term")+ (Just $ var "dflt") [+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "dflt") [+ _Function_elimination>>: "e" ~> var "dflt",+ _Function_lambda>>: "l" ~>+ "domt" <~ optCases (Core.lambdaDomain $ var "l") (Sets.empty) (var "tryType" @@ var "vars") $+ Sets.union (var "domt") (var "recurse" @@ (Core.lambdaBody $ var "l"))],+ _Term_let>>: "l" ~>+ "forBinding" <~ ("b" ~>+ "newVars" <~ optCases (Core.bindingType $ var "b")+ (var "vars")+ ("ts" ~> Sets.union (var "vars") (Sets.fromList $ Core.typeSchemeVariables $ var "ts")) $+ Sets.union+ (var "getAll" @@ var "newVars" @@ (Core.bindingTerm $ var "b"))+ (optCases (Core.bindingType $ var "b")+ Sets.empty+ ("ts" ~> var "tryType" @@ var "newVars" @@ (Core.typeSchemeType $ var "ts")))) $+ Sets.union+ (var "allOf" @@ Lists.map (var "forBinding") (Core.letBindings $ var "l"))+ (var "recurse" @@ (Core.letBody $ var "l")),+ _Term_typeApplication>>: "tt" ~>+ Sets.union+ (var "tryType" @@ var "vars" @@ (Core.typeApplicationTermType $ var "tt"))+ (var "recurse" @@ (Core.typeApplicationTermBody $ var "tt")),+ _Term_typeLambda>>: "tl" ~>+ Sets.union+ -- The type variable introduced by a type lambda is considered unbound unless it is also introduced in an+ -- enclosing let binding, as all type lambda terms are in Hydra.+ (var "tryType" @@ var "vars" @@ (Core.typeVariable $ Core.typeLambdaParameter $ var "tl"))+ (var "recurse" @@ (Core.typeLambdaBody $ var "tl"))]) $+ var "getAll" @@ Sets.empty @@ var "term0"++freeVariablesInTerm :: TBinding (Term -> S.Set Name)+freeVariablesInTerm = define "freeVariablesInTerm" $+ doc "Find the free variables (i.e. variables not bound by a lambda or let) in a term" $+ "term" ~>+ "dfltVars" <~ Lists.foldl ("s" ~> "t" ~> Sets.union (var "s") (freeVariablesInTerm @@ var "t"))+ Sets.empty+ (subterms @@ var "term") $+ cases _Term (var "term")+ (Just $ var "dfltVars") [+ _Term_function>>: match _Function (Just $ var "dfltVars") [+ _Function_lambda>>: "l" ~> Sets.delete+ (Core.lambdaParameter $ var "l")+ (freeVariablesInTerm @@ (Core.lambdaBody $ var "l"))],+ _Term_let>>: "l" ~> (Sets.difference+ (var "dfltVars")+ (Sets.fromList (Lists.map (unaryFunction Core.bindingName) (Core.letBindings $ var "l")))),+ _Term_variable>>: "v" ~> Sets.singleton $ var "v"]++--freeVariablesInTermOpt :: TBinding (Term -> S.Set Name)+--freeVariablesInTermOpt = define "freeVariablesInTermOpt" $+-- doc ("A possibly more efficient function to find the free variables (i.e. variables not bound by a lambda or let) in a term") $+-- "term0" ~>+-- "gather" ~> ("s" ~> "locallyBound" ~> "term" ~>+-- "dflt" <~ (Lists.foldl+-- ("s1" ~> "term1" ~> var "gather" @@ var "s1" @@ var "locallyBound" @@ var "term1")+-- (var "s")+-- (subterms @@ var "term")) $+-- cases _Term (var "term")+-- (Just $ var "dflt") [+-- _Term_function>>: "f" ~> cases _Function (var "f")+-- (Just $ var "dflt") [+-- _Function_lambda>>: "l" ~> var "gather" @@ var "s"+-- @@ (S.insert (Core.lambdaParameter $ var "l") (var "locallyBound"))+-- @@ (Core.lambdaBody $ var "l")],+-- _Term_let>>: "l" ~>+-- "locallyBound1" <~ S.union (var "locallyBound") (Sets.fromList $ Lists.map (unaryFunction Core.bindingName) (Core.letBindings $ var "l")) $+-- "forBinding" <~ ("s1" ~> "b" ~> var "gather" @@ var "s1" @@ var "locallyBound1" @@ (Core.bindingTerm $ var "b")) $+-- Lists.foldl+-- (var "forBinding")+-- (var "gather"+-- @@ var "s"+-- @@ var "locallyBound1"+-- @@ (Core.letBody $ var "l"))+-- (Core.letBindings $ var "l"),+-- _Term_variable>>: "name" ~> Logic.ifElse (Sets.member (var "name") (var "locallyBound"))+-- (var "s")+-- (Sets.insert (var "name") (var "s"))]) $+-- "gather" @@ Sets.empty @@ Sets.empty @@ var "term0"++freeVariablesInType :: TBinding (Type -> S.Set Name)+freeVariablesInType = define "freeVariablesInType" $+ doc "Find the free variables (i.e. variables not bound by a lambda or let) in a type" $+ "typ" ~>+ "dfltVars" <~ Phantoms.fold ("s" ~> "t" ~> Sets.union (var "s") (recurse @@ var "t"))+ @@ Sets.empty+ @@ (subtypes @@ var "typ") $+ cases _Type (var "typ")+ (Just $ var "dfltVars") [+ _Type_forall>>: "lt" ~> Sets.delete+ (Core.forallTypeParameter $ var "lt")+ (recurse @@ (Core.forallTypeBody $ var "lt")),+ -- TODO: let-types+ _Type_variable>>: "v" ~> Sets.singleton $ var "v"]+ where+ recurse = freeVariablesInType++freeVariablesInTypeOrdered :: TBinding (Type -> [Name])+freeVariablesInTypeOrdered = define "freeVariablesInTypeOrdered" $+ doc "Find the free variables in a type in deterministic left-to-right order" $+ "typ" ~>+ "collectVars" <~ ("boundVars" ~> "t" ~>+ cases _Type (var "t")+ (Just $ Lists.concat $ Lists.map (var "collectVars" @@ var "boundVars") $+ subtypes @@ var "t") [+ _Type_variable>>: "v" ~>+ Logic.ifElse (Sets.member (var "v") (var "boundVars"))+ (list ([] :: [TTerm Name]))+ (list [var "v"]),+ _Type_forall>>: "ft" ~>+ var "collectVars" @@+ (Sets.insert (Core.forallTypeParameter $ var "ft") (var "boundVars")) @@+ (Core.forallTypeBody $ var "ft")]) $+ (Lists.nub :: TTerm [Name] -> TTerm [Name]) $ var "collectVars" @@ Sets.empty @@ var "typ"++freeVariablesInTypeSimple :: TBinding (Type -> S.Set Name)+freeVariablesInTypeSimple = define "freeVariablesInTypeSimple" $+ doc "Same as freeVariablesInType, but ignores the binding action of lambda types" $+ "typ" ~>+ "helper" <~ ("types" ~> "typ" ~> cases _Type (var "typ")+ (Just $ var "types") [+ _Type_variable>>: "v" ~> Sets.insert (var "v") (var "types")]) $+ foldOverType @@ Coders.traversalOrderPre @@ var "helper" @@ Sets.empty @@ var "typ"++freeVariablesInTypeScheme :: TBinding (TypeScheme -> S.Set Name)+freeVariablesInTypeScheme = define "freeVariablesInTypeScheme" $+ doc "Find free variables in a type scheme" $+ "ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "t" <~ Core.typeSchemeType (var "ts") $+ Sets.difference (freeVariablesInType @@ var "t") (Sets.fromList $ var "vars")++freeVariablesInTypeSchemeSimple :: TBinding (TypeScheme -> S.Set Name)+freeVariablesInTypeSchemeSimple = define "freeVariablesInTypeSchemeSimple" $+ doc "Find free variables in a type scheme (simple version)" $+ "ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "t" <~ Core.typeSchemeType (var "ts") $+ Sets.difference (freeVariablesInTypeSimple @@ var "t") (Sets.fromList $ var "vars")++inlineType :: TBinding (M.Map Name Type -> Type -> Flow s Type)+inlineType = define "inlineType" $+ doc "Inline all type variables in a type using the provided schema. Note: this function is only appropriate for nonrecursive type definitions" $+ "schema" ~> "typ" ~>+ "f" <~ ("recurse" ~> "typ" ~>+ "afterRecurse" <~ ("tr" ~> cases _Type (var "tr")+ (Just $ produce $ var "tr") [+ _Type_variable>>: "v" ~>+ Maybes.maybe+ (Flows.fail $ Strings.cat2 (string "No such type in schema: ") (unwrap _Name @@ var "v"))+ (inlineType @@ var "schema")+ (Maps.lookup (var "v") (var "schema"))]) $+ "tr" <<~ var "recurse" @@ var "typ" $+ var "afterRecurse" @@ var "tr") $+ rewriteTypeM @@ var "f" @@ var "typ"++isFreeVariableInTerm :: TBinding (Name -> Term -> Bool)+isFreeVariableInTerm = define "isFreeVariableInTerm" $+ doc "Check whether a variable is free (not bound) in a term" $+ "v" ~> "term" ~>+ Logic.not $ Sets.member (var "v") (freeVariablesInTerm @@ var "term")++isLambda :: TBinding (Term -> Bool)+isLambda = define "isLambda" $+ doc "Check whether a term is a lambda, possibly nested within let and/or annotation terms" $+ "term" ~> cases _Term (deannotateTerm @@ var "term")+ (Just false) [+ _Term_function>>: match _Function+ (Just false) [+ _Function_lambda>>: constant true],+ _Term_let>>: "lt" ~> isLambda @@ (project _Let _Let_body @@ var "lt")]++-- TODO: account for shadowing among let- and lambda-bound variables+liftLambdaAboveLet :: TBinding (Term -> Term)+liftLambdaAboveLet = define "liftLambdaAboveLet" $+ doc ("Rewrite terms like `let foo = bar in λx.baz` to `λx.let foo = bar in baz`, lifting lambda-bound variables"+ <> " above let-bound variables, recursively. This is helpful for targets such as Python.") $+ "term0" ~>+ "rewrite" <~ ("recurse" ~> "term" ~>+ "rewriteBinding" <~ ("b" ~> Core.bindingWithTerm (var "b") $ var "rewrite" @@ var "recurse" @@ Core.bindingTerm (var "b")) $+ "rewriteBindings" <~ ("bs" ~> Lists.map (var "rewriteBinding") (var "bs")) $+ "digForLambdas" <~ ("original" ~> "cons" ~> "term" ~> cases _Term (var"term")+ (Just $ var "recurse" @@ var "original") [+ _Term_annotated>>: "at" ~> var "digForLambdas"+ @@ var "original"+ @@ ("t" ~> Core.termAnnotated $ Core.annotatedTermWithBody (var "at") (var "cons" @@ var "t"))+ @@ (Core.annotatedTermBody $ var "at"),+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "recurse" @@ var "original") [+ _Function_lambda>>: "l" ~> Core.termFunction $ Core.functionLambda $ Core.lambdaWithBody (var "l") $+ var "digForLambdas"+ @@ (var "cons" @@ (Core.lambdaBody $ var "l"))+ @@ ("t" ~> var "cons" @@ var "t")+ @@ (Core.lambdaBody $ var "l")],+ _Term_let>>: "l" ~> var "digForLambdas"+ @@ var "original"+ @@ ("t" ~> var "cons" @@ (Core.termLet $ Core.let_ (var "rewriteBindings" @@ (Core.letBindings $ var "l")) (var "t")))+ @@ Core.letBody (var "l")]) $+ -- Note: we match *before* recursing for the sake of efficiency.+ cases _Term (var "term")+ (Just $ var "recurse" @@ var "term") [+ _Term_let>>: "l" ~> var "digForLambdas"+ @@ var "term"+ @@ ("t" ~> Core.termLet $ Core.let_ (var "rewriteBindings" @@ (Core.letBindings $ var "l")) (var "t"))+ @@ Core.letBody (var "l")]) $+ rewriteTerm @@ var "rewrite" @@ var "term0"++mapBeneathTypeAnnotations :: TBinding ((Type -> Type) -> Type -> Type)+mapBeneathTypeAnnotations = define "mapBeneathTypeAnnotations" $+ doc "Apply a transformation to the first type beneath a chain of annotations" $+ "f" ~> "t" ~> cases _Type (var "t")+ (Just $ var "f" @@ var "t") [+ _Type_annotated>>: "at" ~> Core.typeAnnotated $ Core.annotatedType+ (mapBeneathTypeAnnotations @@ var "f" @@ (Core.annotatedTypeBody $ var "at"))+ (Core.annotatedTypeAnnotation $ var "at")]++normalizeTypeVariablesInTerm :: TBinding (Term -> Term)+normalizeTypeVariablesInTerm = define "normalizeTypeVariablesInTerm" $+ doc "Recursively replace the type variables of let bindings with the systematic type variables t0, t1, t2, ..." $+ "term" ~>+ "replaceName" <~ ("subst" ~> "v" ~> Maybes.fromMaybe (var "v") $ Maps.lookup (var "v") (var "subst")) $+ "substType" <~ ("subst" ~> "typ" ~>+ "rewrite" <~ ("recurse" ~> "typ" ~> cases _Type (var "typ")+ (Just $ var "recurse" @@ var "typ") [+ _Type_variable>>: "v" ~> Core.typeVariable $ var "replaceName" @@ var "subst" @@ var "v"]) $+ rewriteType @@ var "rewrite" @@ var "typ") $+ -- Thread a triple: ((subst, boundVars), next)+ "rewriteWithSubst" <~ ("state" ~> "term0" ~>+ "sb" <~ Pairs.first (var "state") $+ "next" <~ Pairs.second (var "state") $+ "subst" <~ Pairs.first (var "sb") $+ "boundVars" <~ Pairs.second (var "sb") $+ "rewrite" <~ ("recurse" ~> "term" ~> cases _Term (var "term")+ (Just $ var "recurse" @@ var "term") [+ -- Lambdas have a "domain" type which needs to be rewritten+ _Term_function>>: match _Function+ (Just $ var "recurse" @@ var "term") [+ _Function_elimination>>: constant $ var "recurse" @@ var "term",+ _Function_lambda>>: "l" ~>+ "domain" <~ Core.lambdaDomain (var "l") $+ Core.termFunction $ Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Maybes.map (var "substType" @@ var "subst") (var "domain"))+ (var "rewriteWithSubst" @@ (pair (pair (var "subst") (var "boundVars")) (var "next")) @@ (Core.lambdaBody $ var "l"))],+ -- Let bindings each have a type which needs to be rewritten+ _Term_let>>: "lt" ~>+ "bindings0" <~ Core.letBindings (var "lt") $+ "body0" <~ Core.letBody (var "lt") $+ -- Sequentially rewrite bindings without advancing 'next' across siblings+ "step" <~ ("acc" ~> "bs" ~>+ "b" <~ Lists.head (var "bs") $+ "tl" <~ Lists.tail (var "bs") $+ "noType" <~ (+ "newVal" <~ var "rewriteWithSubst" @@ (pair (pair (var "subst") (var "boundVars")) (var "next")) @@ (Core.bindingTerm $ var "b") $+ "b1" <~ Core.binding (Core.bindingName $ var "b") (var "newVal") nothing $+ var "step" @@ (Lists.cons (var "b1") (var "acc")) @@ var "tl") $+ "withType" <~ ("ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "typ" <~ Core.typeSchemeType (var "ts") $+ "k" <~ Lists.length (var "vars") $+ -- Build exactly k fresh names t{next}, t{next+1}, ...+ "gen" <~ ("i" ~> "rem" ~> "acc2" ~>+ "ti" <~ Core.name (Strings.cat2 (string "t") (Literals.showInt32 (Math.add (var "next") (var "i")))) $+ Logic.ifElse (Equality.equal (var "rem") (int32 0))+ (Lists.reverse (var "acc2"))+ (var "gen"+ @@ (Math.add (var "i") (int32 1))+ @@ (Math.sub (var "rem") (int32 1))+ @@ (Lists.cons (var "ti") (var "acc2")))) $+ "newVars" <~ var "gen" @@ (int32 0) @@ (var "k") @@ (list ([] :: [TTerm Name])) $+ "newSubst" <~ Maps.union (Maps.fromList $ Lists.zip (var "vars") (var "newVars")) (var "subst") $+ "newBound" <~ Sets.union (var "boundVars") (Sets.fromList (var "newVars")) $+ "newVal" <~ var "rewriteWithSubst" @@ (pair (pair (var "newSubst") (var "newBound")) (Math.add (var "next") (var "k"))) @@ (Core.bindingTerm $ var "b") $+ -- Rename constraint keys using newSubst (a Map Name Name)+ -- For each (varName, metadata), if varName is in newSubst, use the new name+ "renameConstraintKeys" <~ ("constraintMap" ~>+ Maps.fromList $ Lists.map+ ("p" ~>+ "oldName" <~ Pairs.first (var "p") $+ "meta" <~ Pairs.second (var "p") $+ "newName" <~ Maybes.fromMaybe (var "oldName") (Maps.lookup (var "oldName") (var "newSubst")) $+ pair (var "newName") (var "meta"))+ (Maps.toList $ var "constraintMap")) $+ "oldConstraints" <~ Core.typeSchemeConstraints (var "ts") $+ "newConstraints" <~ Maybes.map (var "renameConstraintKeys") (var "oldConstraints") $+ "b1" <~ Core.binding+ (Core.bindingName $ var "b")+ (var "newVal")+ (just $ Core.typeScheme (var "newVars") (var "substType" @@ var "newSubst" @@ var "typ") (var "newConstraints")) $+ -- Note: do not advance 'next' for the next sibling; keep current 'next'+ var "step" @@ (Lists.cons (var "b1") (var "acc")) @@ var "tl") $+ Logic.ifElse (Lists.null (var "bs"))+ (Lists.reverse (var "acc"))+ (optCases (Core.bindingType $ var "b")+ -- Untyped binding: rewrite its term with current state; 'next' unchanged for siblings+ (var "noType")+ -- Typed binding: allocate |vars| fresh t{next+i}; bump 'next' only for the binding's TERM+ ("ts" ~> var "withType" @@ var "ts"))) $+ "bindings1" <~ var "step" @@ (list ([] :: [TTerm Binding])) @@ (var "bindings0") $+ Core.termLet $ Core.let_+ (var "bindings1")+ -- Body sees the original 'next' (binding lambdas don't bind in the body)+ (var "rewriteWithSubst" @@ (pair (pair (var "subst") (var "boundVars")) (var "next")) @@ var "body0"),+ -- Type application terms have a type which needs to be rewritten, and we also recurse into the body term.+ _Term_typeApplication>>: "tt" ~> Core.termTypeApplication $ Core.typeApplicationTerm+ (var "rewriteWithSubst" @@ (pair (pair (var "subst") (var "boundVars")) (var "next")) @@ (Core.typeApplicationTermBody $ var "tt"))+ (var "substType" @@ var "subst" @@ (Core.typeApplicationTermType $ var "tt")),+ -- Type lambdas introduce a type variable which needs to be replaced, and we also recurse into the body term.+ -- Note: in Hydra currently, type lambdas are exclusively created during type inference in combination with+ -- polymorphic let bindings, so the type variable should already be present in the substitution.+ -- If "free-standing" type lambdas are ever supported in the future, we will have to create a fresh type variable here.+ _Term_typeLambda>>: "ta" ~> Core.termTypeLambda $ Core.typeLambda+ (var "replaceName" @@ var "subst" @@ (Core.typeLambdaParameter $ var "ta"))+ (var "rewriteWithSubst" @@ (pair (pair (var "subst") (var "boundVars")) (var "next")) @@ (Core.typeLambdaBody $ var "ta"))]) $+ rewriteTerm @@ var "rewrite" @@ var "term0") $+ -- initial state: ((emptySubst, emptyBound), next=0)+ var "rewriteWithSubst" @@ (pair (pair Maps.empty Sets.empty) (int32 0)) @@ var "term"++pruneLet :: TBinding (Let -> Let)+pruneLet = define "pruneLet" $+ doc ("Given a let expression, remove any unused bindings. The resulting expression is still a let,"+ <> " even if has no remaining bindings") $+ "l" ~>+ "bindingMap" <~ Maps.fromList (Lists.map+ ("b" ~> pair (Core.bindingName $ var "b") (Core.bindingTerm $ var "b")) $ Core.letBindings $ var "l") $+ "rootName" <~ Core.name (string "[[[root]]]") $+ "adj" <~ ("n" ~> Sets.intersection (Sets.fromList $ Maps.keys $ var "bindingMap")+ (freeVariablesInTerm @@ (Logic.ifElse (Equality.equal (var "n") (var "rootName"))+ (Core.letBody $ var "l")+ (Maybes.fromJust $ Maps.lookup (var "n") (var "bindingMap"))))) $+ "reachable" <~ Sorting.findReachableNodes @@ var "adj" @@ var "rootName" $+ "prunedBindings" <~ Lists.filter+ ("b" ~> Sets.member (Core.bindingName $ var "b") (var "reachable"))+ (Core.letBindings $ var "l") $+ Core.let_+ (var "prunedBindings")+ (Core.letBody $ var "l")++removeTermAnnotations :: TBinding (Term -> Term)+removeTermAnnotations = define "removeTermAnnotations" $+ doc "Recursively remove term annotations, including within subterms" $+ "term" ~>+ "remove" <~ ("recurse" ~> "term" ~>+ "rewritten" <~ var "recurse" @@ var "term" $+ cases _Term (var "term")+ (Just $ var "rewritten") [+ _Term_annotated>>: "at" ~> Core.annotatedTermBody $ var "at"]) $+ rewriteTerm @@ var "remove" @@ var "term"++removeTypeAnnotations :: TBinding (Type -> Type)+removeTypeAnnotations = define "removeTypeAnnotations" $+ doc "Recursively remove type annotations, including within subtypes" $+ "typ" ~>+ "remove" <~ ("recurse" ~> "typ" ~>+ "rewritten" <~ var "recurse" @@ var "typ" $+ cases _Type (var "rewritten")+ (Just $ var "rewritten") [+ _Type_annotated>>: "at" ~> Core.annotatedTypeBody $ var "at"]) $+ rewriteType @@ var "remove" @@ var "typ"++removeTypesFromTerm :: TBinding (Term -> Term)+removeTypesFromTerm = define "removeTypesFromTerm" $+ doc "Strip type annotations from terms while preserving other annotations" $+ "term" ~>+ "strip" <~ ("recurse" ~> "term" ~>+ "rewritten" <~ var "recurse" @@ var "term" $+ "stripBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (Core.bindingTerm $ var "b")+ nothing) $+ cases _Term (var "rewritten")+ (Just $ var "rewritten") [+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ Core.termFunction $ var "f") [+ _Function_elimination>>: "e" ~> Core.termFunction $ Core.functionElimination $ var "e",+ _Function_lambda>>: "l" ~> Core.termFunction $ Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ nothing+ (Core.lambdaBody $ var "l")],+ _Term_let>>: "lt" ~> Core.termLet $ Core.let_+ (Lists.map (var "stripBinding") (Core.letBindings $ var "lt"))+ (Core.letBody $ var "lt"),+ _Term_typeApplication>>: "tt" ~> Core.typeApplicationTermBody $ var "tt",+ _Term_typeLambda>>: "ta" ~> Core.typeLambdaBody $ var "ta"]) $+ rewriteTerm @@ var "strip" @@ var "term"++removeTypeAnnotationsFromTerm :: TBinding (Term -> Term)+removeTypeAnnotationsFromTerm = define "removeTypeAnnotationsFromTerm" $+ doc "Strip type annotations (TypeLambda, TypeApplication, binding type schemes) from terms while preserving lambda domain types and other annotations" $+ "term" ~>+ "strip" <~ ("recurse" ~> "term" ~>+ "rewritten" <~ var "recurse" @@ var "term" $+ "stripBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (Core.bindingTerm $ var "b")+ nothing) $+ cases _Term (var "rewritten")+ (Just $ var "rewritten") [+ _Term_let>>: "lt" ~> Core.termLet $ Core.let_+ (Lists.map (var "stripBinding") (Core.letBindings $ var "lt"))+ (Core.letBody $ var "lt"),+ _Term_typeApplication>>: "tt" ~> Core.typeApplicationTermBody $ var "tt",+ _Term_typeLambda>>: "ta" ~> Core.typeLambdaBody $ var "ta"]) $+ rewriteTerm @@ var "strip" @@ var "term"++replaceFreeTermVariable :: TBinding (Name -> Term -> Term -> Term)+replaceFreeTermVariable = define "replaceFreeTermVariable" $+ doc "Replace a free variable in a term" $+ "vold" ~> "tnew" ~> "term" ~>+ "rewrite" <~ ("recurse" ~> "t" ~> cases _Term (var "t")+ (Just $ var "recurse" @@ var "t") [+ _Term_function>>: "f" ~>+ cases _Function (var "f")+ (Just $ var "recurse" @@ var "t") [+ _Function_lambda>>: "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ Logic.ifElse (Equality.equal (var "v") (var "vold"))+ (var "t")+ (var "recurse" @@ var "t")],+ _Term_variable>>: "v" ~>+ Logic.ifElse (Equality.equal (var "v") (var "vold"))+ (var "tnew")+ (Core.termVariable $ var "v")]) $+ rewriteTerm @@ var "rewrite" @@ var "term"++replaceFreeTypeVariable :: TBinding (Name -> Type -> Type -> Type)+replaceFreeTypeVariable = define "replaceFreeTypeVariable" $+ doc "Replace free occurrences of a name in a type" $+ "v" ~> "rep" ~> "typ" ~>+ "mapExpr" <~ ("recurse" ~> "t" ~> cases _Type (var "t")+ (Just $ var "recurse" @@ var "t") [+ _Type_forall>>: "ft" ~> Logic.ifElse+ (Equality.equal (var "v") (Core.forallTypeParameter $ var "ft"))+ (var "t")+ (Core.typeForall $ Core.forallType+ (Core.forallTypeParameter $ var "ft")+ (var "recurse" @@ (Core.forallTypeBody $ var "ft"))),+ _Type_variable>>: "v'" ~> Logic.ifElse+ (Equality.equal (var "v") (var "v'"))+ (var "rep")+ (var "t")]) $+ rewriteType @@ var "mapExpr" @@ var "typ"++replaceTypedefs :: TBinding (M.Map Name TypeScheme -> Type -> Type)+replaceTypedefs = define "replaceTypedefs" $+ doc "Replace all occurrences of simple typedefs (type aliases) with the aliased types, recursively" $+ "types" ~> "typ0" ~>+ "rewrite" <~ ("recurse" ~> "typ" ~>+ -- Note: dflt (recurse @@ typ) is NOT bound as a let here, because in strict languages (Java, Python)+ -- this would eagerly recurse into Record/Union/Wrap fields, causing infinite recursion on recursive types.+ -- Instead, we inline (recurse @@ typ) only where needed.+ cases _Type (var "typ")+ (Just $ var "recurse" @@ var "typ") [+-- _Type_forall>>: "ft" ~> ... -- TODO: shadowing via forall-bound variables+ _Type_annotated>>: "at" ~> Core.typeAnnotated $ Core.annotatedType+ (var "rewrite" @@ var "recurse" @@ (Core.annotatedTypeBody $ var "at"))+ (Core.annotatedTypeAnnotation $ var "at"),+ _Type_record>>: constant $ var "typ",+ _Type_union>>: constant $ var "typ",+ _Type_variable>>: "v" ~>+ "forMono" <~ ("t" ~> cases _Type (var "t")+ (Just $ var "rewrite" @@ var "recurse" @@ var "t") [+ _Type_record>>: constant $ var "typ",+ _Type_union>>: constant $ var "typ",+ _Type_wrap>>: constant $ var "typ"]) $+ "forTypeScheme" <~ ("ts" ~>+ "t" <~ Core.typeSchemeType (var "ts") $+ Logic.ifElse (Lists.null $ Core.typeSchemeVariables $ var "ts")+ (var "forMono" @@ var "t")+ (var "typ")) $ -- TODO: this may be too simple+ optCases (Maps.lookup (var "v") (var "types"))+ (var "typ")+ ("ts" ~> var "forTypeScheme" @@ var "ts"),+ _Type_wrap>>: constant $ var "typ"]) $+ rewriteType @@ var "rewrite" @@ var "typ0"++-- TODO: this is a fixpoint combinator, but its type is sometimes incorrectly inferred based on how it is used.+-- For now, we generally define local "rewrite"/"recurse" helper functions rather than using this global one.+--rewrite :: TBinding (((x -> y) -> x -> y) -> ((x -> y) -> x -> y) -> x -> y)+--rewrite = define "rewrite" $ "fsub" ~> "f" ~>+-- "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+-- var "recurse"++rewriteAndFoldTerm :: TBinding (((a -> Term -> (a, Term)) -> a -> Term -> (a, Term)) -> a -> Term -> (a, Term))+rewriteAndFoldTerm = define "rewriteAndFoldTerm" $+ doc "Rewrite a term, and at the same time, fold a function over it, accumulating a value" $+ "f" ~> "term0" ~>+ "fsub" <~ ("recurse" ~> "val0" ~> "term0" ~>+ "forSingle" <~ ("rec" ~> "cons" ~> "val" ~> "term" ~>+ "r" <~ var "rec" @@ var "val" @@ var "term" $+ pair (Pairs.first $ var "r") (var "cons" @@ (Pairs.second $ var "r"))) $+ "forMany" <~ ("rec" ~> "cons" ~> "val" ~> "els" ~>+ "rr" <~ Lists.foldl+ ("r" ~> "el" ~>+ "r2" <~ var "rec" @@ (Pairs.first $ var "r") @@ var "el" $+ pair (Pairs.first $ var "r2") (Lists.cons (Pairs.second $ var "r2") (Pairs.second $ var "r")))+ (pair (var "val") (list ([] :: [TTerm Term])))+ (var "els") $+ pair (Pairs.first $ var "rr") (var "cons" @@ (Lists.reverse $ Pairs.second $ var "rr"))) $+ "forField" <~ ("val" ~> "field" ~>+ "r" <~ var "recurse" @@ var "val" @@ Core.fieldTerm (var "field") $+ pair (Pairs.first $ var "r") (Core.field (Core.fieldName $ var "field") (Pairs.second $ var "r"))) $+ "forFields" <~ var "forMany" @@ var "forField" @@ ("x" ~> var "x") $+ "forPair" <~ ("val" ~> "kv" ~>+ "rk" <~ var "recurse" @@ var "val" @@ (Pairs.first $ var "kv") $+ "rv" <~ var "recurse" @@ (Pairs.first $ var "rk") @@ (Pairs.second $ var "kv") $+ pair+ (Pairs.first $ var "rv")+ (pair (Pairs.second $ var "rk") (Pairs.second $ var "rv"))) $+ "forBinding" <~ ("val" ~> "binding" ~>+ "r" <~ var "recurse" @@ var "val" @@ Core.bindingTerm (var "binding") $+ pair+ (Pairs.first $ var "r")+ (Core.binding+ (Core.bindingName $ var "binding")+ (Pairs.second $ var "r")+ (Core.bindingType $ var "binding"))) $+ "forElimination" <~ ("val" ~> "elm" ~>+ "r" <~ cases _Elimination (var "elm")+ (Just $ pair (var "val") (var "elm")) [+ _Elimination_union>>: "cs" ~>+ "rmd" <~ Maybes.map (var "recurse" @@ var "val") (Core.caseStatementDefault $ var "cs") $+ "val1" <~ optCases (var "rmd")+ (var "val")+ (unaryFunction Pairs.first) $+ "rcases" <~ var "forFields" @@ var "val1" @@ (Core.caseStatementCases $ var "cs") $+ pair+ (Pairs.first $ var "rcases")+ (Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (unaryFunction Pairs.second) (var "rmd"))+ (Pairs.second $ var "rcases"))] $+ pair (Pairs.first $ var "r") (Pairs.second $ var "r")) $+ "forFunction" <~ ("val" ~> "fun" ~> cases _Function (var "fun")+ (Just $ pair (var "val") (var "fun")) [+ _Function_elimination>>: "elm" ~>+ "re" <~ var "forElimination" @@ var "val" @@ var "elm" $+ pair (Pairs.first $ var "re") (Core.functionElimination (Pairs.second $ var "re")),+ _Function_lambda>>: "l" ~>+ "rl" <~ var "recurse" @@ var "val" @@ (Core.lambdaBody $ var "l") $+ pair+ (Pairs.first $ var "rl")+ (Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (Pairs.second $ var "rl"))]) $+ "dflt" <~ pair (var "val0") (var "term0") $+ cases _Term (var "term0")+ (Just $ var "dflt") [+ _Term_annotated>>: "at" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termAnnotated $ Core.annotatedTerm (var "t") (Core.annotatedTermAnnotation $ var "at"))+ @@ var "val0"+ @@ (Core.annotatedTermBody $ var "at"),+ _Term_application>>: "a" ~>+ "rlhs" <~ var "recurse" @@ var "val0" @@ (Core.applicationFunction $ var "a") $+ "rrhs" <~ var "recurse" @@ (Pairs.first $ var "rlhs") @@ (Core.applicationArgument $ var "a") $+ pair+ (Pairs.first $ var "rrhs")+ (Core.termApplication $ Core.application+ (Pairs.second $ var "rlhs")+ (Pairs.second $ var "rrhs")),+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~>+ "rl" <~ var "recurse" @@ var "val0" @@ var "l" $+ pair (Pairs.first $ var "rl") (Core.termEither $ left $ Pairs.second $ var "rl"))+ ("r" ~>+ "rr" <~ var "recurse" @@ var "val0" @@ var "r" $+ pair (Pairs.first $ var "rr") (Core.termEither $ right $ Pairs.second $ var "rr"))+ (var "e"),+ _Term_function>>: "f" ~> var "forSingle"+ @@ var "forFunction"+ @@ ("f" ~> Core.termFunction $ var "f")+ @@ var "val0"+ @@ var "f",+ _Term_let>>: "l" ~>+ "renv" <~ var "recurse" @@ var "val0" @@ (Core.letBody $ var "l") $+ var "forMany" @@ var "forBinding"+ @@ ("bins" ~> Core.termLet $ Core.let_ (var "bins") (Pairs.second $ var "renv"))+ @@ Pairs.first (var "renv") @@ (Core.letBindings $ var "l"),+ _Term_list>>: "els" ~> var "forMany" @@ var "recurse" @@ (unaryFunction Core.termList) @@ var "val0" @@ var "els",+ _Term_map>>: "m" ~> var "forMany" @@ var "forPair"+ @@ ("pairs" ~> Core.termMap $ Maps.fromList $ var "pairs") @@ var "val0" @@ Maps.toList (var "m"),+ _Term_maybe>>: "mt" ~> optCases (var "mt")+ (var "dflt")+ ("t" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t1" ~> Core.termMaybe $ just $ var "t1")+ @@ var "val0"+ @@ var "t"),+ _Term_pair>>: "p" ~>+ "rf" <~ var "recurse" @@ var "val0" @@ (Pairs.first $ var "p") $+ "rs" <~ var "recurse" @@ (Pairs.first $ var "rf") @@ (Pairs.second $ var "p") $+ pair (Pairs.first $ var "rs") (Core.termPair $ pair (Pairs.second $ var "rf") (Pairs.second $ var "rs")),+ _Term_record>>: "r" ~> var "forMany"+ @@ var "forField"+ @@ ("fields" ~> Core.termRecord $ Core.record (Core.recordTypeName $ var "r") (var "fields"))+ @@ var "val0"+ @@ Core.recordFields (var "r" ),+ _Term_set>>: "els" ~> var "forMany"+ @@ var "recurse"+ @@ ("e" ~> Core.termSet $ Sets.fromList $ var "e")+ @@ var "val0"+ @@ (Sets.toList $ var "els"),+ _Term_typeApplication>>: "ta" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeApplicationTermType $ var "ta"))+ @@ var "val0"+ @@ (Core.typeApplicationTermBody $ var "ta"),+ _Term_typeLambda>>: "tl" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeLambda $ Core.typeLambda (Core.typeLambdaParameter $ var "tl") (var "t"))+ @@ var "val0"+ @@ (Core.typeLambdaBody $ var "tl"),+ _Term_union>>: "inj" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "inj")+ (Core.field (Core.fieldName $ Core.injectionField $ var "inj") (var "t")))+ @@ var "val0"+ @@ (Core.fieldTerm $ Core.injectionField $ var "inj"),+ _Term_wrap>>: "wt" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termWrap $ Core.wrappedTerm (Core.wrappedTermTypeName $ var "wt") (var "t"))+ @@ var "val0"+ @@ (Core.wrappedTermBody $ var "wt")]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "term0"++-- | Rewrite a term with path tracking, and fold a function over it.+-- The path is the list of accessors from the root to the current term.+-- The function f receives: (recurse path acc term -> (acc', term')) -> path -> acc -> term -> (acc', term')+rewriteAndFoldTermWithPath :: TBinding ((([TermAccessor] -> a -> Term -> (a, Term)) -> [TermAccessor] -> a -> Term -> (a, Term)) -> a -> Term -> (a, Term))+rewriteAndFoldTermWithPath = define "rewriteAndFoldTermWithPath" $+ doc "Rewrite a term with path tracking, and fold a function over it, accumulating a value. The path is a list of TermAccessors from root to current position." $+ "f" ~> "term0" ~>+ "fsub" <~ ("recurse" ~> "path" ~> "val0" ~> "term0" ~>+ -- Helper to recurse into a single subterm with a given accessor+ "forSingleWithAccessor" <~ ("rec" ~> "cons" ~> "accessor" ~> "val" ~> "term" ~>+ "r" <~ var "rec" @@ Lists.concat2 (var "path") (list [var "accessor"]) @@ var "val" @@ var "term" $+ pair (Pairs.first $ var "r") (var "cons" @@ (Pairs.second $ var "r"))) $+ -- Helper to recurse into multiple subterms, each with its own accessor+ "forManyWithAccessors" <~ ("rec" ~> "cons" ~> "val" ~> "accessorTermPairs" ~>+ "rr" <~ Lists.foldl+ ("r" ~> "atp" ~>+ "r2" <~ var "rec"+ @@ Lists.concat2 (var "path") (list [Pairs.first $ var "atp"])+ @@ (Pairs.first $ var "r")+ @@ (Pairs.second $ var "atp") $+ pair (Pairs.first $ var "r2") (Lists.cons (Pairs.second $ var "r2") (Pairs.second $ var "r")))+ (pair (var "val") (list ([] :: [TTerm Term])))+ (var "accessorTermPairs") $+ pair (Pairs.first $ var "rr") (var "cons" @@ (Lists.reverse $ Pairs.second $ var "rr"))) $+ -- Helper for record/case fields with accessors+ "forFieldWithAccessor" <~ ("mkAccessor" ~> "val" ~> "field" ~>+ "r" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [var "mkAccessor" @@ (Core.fieldName $ var "field")])+ @@ var "val"+ @@ Core.fieldTerm (var "field") $+ pair (Pairs.first $ var "r") (Core.field (Core.fieldName $ var "field") (Pairs.second $ var "r"))) $+ "forFieldsWithAccessor" <~ ("mkAccessor" ~> var "forManyWithAccessors" @@+ ("path1" ~> "val1" ~> "field1" ~> var "forFieldWithAccessor" @@ var "mkAccessor" @@ var "val1" @@ var "field1")+ @@ ("x" ~> var "x")) $+ -- Helper for map key/value pairs+ "forPairWithAccessors" <~ ("keyAccessor" ~> "valAccessor" ~> "val" ~> "kv" ~>+ "rk" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [var "keyAccessor"])+ @@ var "val"+ @@ (Pairs.first $ var "kv") $+ "rv" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [var "valAccessor"])+ @@ (Pairs.first $ var "rk")+ @@ (Pairs.second $ var "kv") $+ pair+ (Pairs.first $ var "rv")+ (pair (Pairs.second $ var "rk") (Pairs.second $ var "rv"))) $+ -- Helper for let bindings+ "forBindingWithAccessor" <~ ("val" ~> "binding" ~>+ "r" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorLetBinding $ Core.bindingName $ var "binding"])+ @@ var "val"+ @@ Core.bindingTerm (var "binding") $+ pair+ (Pairs.first $ var "r")+ (Core.binding+ (Core.bindingName $ var "binding")+ (Pairs.second $ var "r")+ (Core.bindingType $ var "binding"))) $+ -- Helper for elimination+ "forElimination" <~ ("val" ~> "elm" ~>+ "r" <~ cases _Elimination (var "elm")+ (Just $ pair (var "val") (var "elm")) [+ _Elimination_union>>: "cs" ~>+ "rmd" <~ Maybes.map+ ("def" ~> var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorUnionCasesDefault])+ @@ var "val"+ @@ var "def")+ (Core.caseStatementDefault $ var "cs") $+ "val1" <~ optCases (var "rmd")+ (var "val")+ (unaryFunction Pairs.first) $+ "rcases" <~ var "forManyWithAccessors"+ @@ var "recurse"+ @@ ("x" ~> var "x")+ @@ var "val1"+ @@ Lists.map+ ("f" ~> pair+ (Accessors.termAccessorUnionCasesBranch $ Core.fieldName $ var "f")+ (Core.fieldTerm $ var "f"))+ (Core.caseStatementCases $ var "cs") $+ pair+ (Pairs.first $ var "rcases")+ (Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (unaryFunction Pairs.second) (var "rmd"))+ (Lists.map+ ("ft" ~> Core.field+ (Pairs.first $ var "ft")+ (Pairs.second $ var "ft"))+ (Lists.zip+ (Lists.map (unaryFunction Core.fieldName) (Core.caseStatementCases $ var "cs"))+ (Pairs.second $ var "rcases"))))] $+ pair (Pairs.first $ var "r") (Pairs.second $ var "r")) $+ -- Helper for function+ "forFunction" <~ ("val" ~> "fun" ~> cases _Function (var "fun")+ (Just $ pair (var "val") (var "fun")) [+ _Function_elimination>>: "elm" ~>+ "re" <~ var "forElimination" @@ var "val" @@ var "elm" $+ pair (Pairs.first $ var "re") (Core.functionElimination (Pairs.second $ var "re")),+ _Function_lambda>>: "l" ~>+ "rl" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorLambdaBody])+ @@ var "val"+ @@ (Core.lambdaBody $ var "l") $+ pair+ (Pairs.first $ var "rl")+ (Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (Pairs.second $ var "rl"))]) $+ "dflt" <~ pair (var "val0") (var "term0") $+ cases _Term (var "term0")+ (Just $ var "dflt") [+ _Term_annotated>>: "at" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t" ~> Core.termAnnotated $ Core.annotatedTerm (var "t") (Core.annotatedTermAnnotation $ var "at"))+ @@ Accessors.termAccessorAnnotatedBody+ @@ var "val0"+ @@ (Core.annotatedTermBody $ var "at"),+ _Term_application>>: "a" ~>+ "rlhs" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorApplicationFunction])+ @@ var "val0"+ @@ (Core.applicationFunction $ var "a") $+ "rrhs" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorApplicationArgument])+ @@ (Pairs.first $ var "rlhs")+ @@ (Core.applicationArgument $ var "a") $+ pair+ (Pairs.first $ var "rrhs")+ (Core.termApplication $ Core.application+ (Pairs.second $ var "rlhs")+ (Pairs.second $ var "rrhs")),+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~>+ "rl" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorSumTerm])+ @@ var "val0"+ @@ var "l" $+ pair (Pairs.first $ var "rl") (Core.termEither $ left $ Pairs.second $ var "rl"))+ ("r" ~>+ "rr" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorSumTerm])+ @@ var "val0"+ @@ var "r" $+ pair (Pairs.first $ var "rr") (Core.termEither $ right $ Pairs.second $ var "rr"))+ (var "e"),+ _Term_function>>: "f" ~>+ "rf" <~ var "forFunction" @@ var "val0" @@ var "f" $+ pair (Pairs.first $ var "rf") (Core.termFunction $ Pairs.second $ var "rf"),+ _Term_let>>: "l" ~>+ "renv" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorLetEnvironment])+ @@ var "val0"+ @@ (Core.letBody $ var "l") $+ "rbindings" <~ Lists.foldl+ ("r" ~> "binding" ~>+ "rb" <~ var "forBindingWithAccessor" @@ (Pairs.first $ var "r") @@ var "binding" $+ pair (Pairs.first $ var "rb") (Lists.cons (Pairs.second $ var "rb") (Pairs.second $ var "r")))+ (pair (Pairs.first $ var "renv") (list ([] :: [TTerm Binding])))+ (Core.letBindings $ var "l") $+ pair+ (Pairs.first $ var "rbindings")+ (Core.termLet $ Core.let_ (Lists.reverse $ Pairs.second $ var "rbindings") (Pairs.second $ var "renv")),+ _Term_list>>: "els" ~>+ "idx" <~ int32 0 $+ "rr" <~ Lists.foldl+ ("r" ~> "el" ~>+ "r2" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorListElement $ Pairs.first $ var "r"])+ @@ (Pairs.first $ Pairs.second $ var "r")+ @@ var "el" $+ pair+ (Math.add (Pairs.first $ var "r") (int32 1))+ (pair (Pairs.first $ var "r2") (Lists.cons (Pairs.second $ var "r2") (Pairs.second $ Pairs.second $ var "r"))))+ (pair (var "idx") (pair (var "val0") (list ([] :: [TTerm Term]))))+ (var "els") $+ pair (Pairs.first $ Pairs.second $ var "rr") (Core.termList $ Lists.reverse $ Pairs.second $ Pairs.second $ var "rr"),+ _Term_map>>: "m" ~>+ "idx" <~ int32 0 $+ "rr" <~ Lists.foldl+ ("r" ~> "kv" ~>+ "rk" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorMapKey $ Pairs.first $ var "r"])+ @@ (Pairs.first $ Pairs.second $ var "r")+ @@ (Pairs.first $ var "kv") $+ "rv" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorMapValue $ Pairs.first $ var "r"])+ @@ (Pairs.first $ var "rk")+ @@ (Pairs.second $ var "kv") $+ pair+ (Math.add (Pairs.first $ var "r") (int32 1))+ (pair+ (Pairs.first $ var "rv")+ (Lists.cons (pair (Pairs.second $ var "rk") (Pairs.second $ var "rv")) (Pairs.second $ Pairs.second $ var "r"))))+ (pair (var "idx") (pair (var "val0") (list ([] :: [TTerm (Term, Term)]))))+ (Maps.toList $ var "m") $+ pair (Pairs.first $ Pairs.second $ var "rr") (Core.termMap $ Maps.fromList $ Lists.reverse $ Pairs.second $ Pairs.second $ var "rr"),+ _Term_maybe>>: "mt" ~> optCases (var "mt")+ (var "dflt")+ ("t" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t1" ~> Core.termMaybe $ just $ var "t1")+ @@ Accessors.termAccessorOptionalTerm+ @@ var "val0"+ @@ var "t"),+ _Term_pair>>: "p" ~>+ "rf" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorProductTerm $ int32 0])+ @@ var "val0"+ @@ (Pairs.first $ var "p") $+ "rs" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorProductTerm $ int32 1])+ @@ (Pairs.first $ var "rf")+ @@ (Pairs.second $ var "p") $+ pair (Pairs.first $ var "rs") (Core.termPair $ pair (Pairs.second $ var "rf") (Pairs.second $ var "rs")),+ _Term_record>>: "r" ~>+ "rfields" <~ var "forManyWithAccessors"+ @@ var "recurse"+ @@ ("x" ~> var "x")+ @@ var "val0"+ @@ Lists.map+ ("f" ~> pair+ (Accessors.termAccessorRecordField $ Core.fieldName $ var "f")+ (Core.fieldTerm $ var "f"))+ (Core.recordFields $ var "r") $+ pair+ (Pairs.first $ var "rfields")+ (Core.termRecord $ Core.record+ (Core.recordTypeName $ var "r")+ (Lists.map+ ("ft" ~> Core.field (Pairs.first $ var "ft") (Pairs.second $ var "ft"))+ (Lists.zip+ (Lists.map (unaryFunction Core.fieldName) (Core.recordFields $ var "r"))+ (Pairs.second $ var "rfields")))),+ _Term_set>>: "els" ~>+ "idx" <~ int32 0 $+ "rr" <~ Lists.foldl+ ("r" ~> "el" ~>+ "r2" <~ var "recurse"+ @@ Lists.concat2 (var "path") (list [Accessors.termAccessorSetElement $ Pairs.first $ var "r"])+ @@ (Pairs.first $ Pairs.second $ var "r")+ @@ var "el" $+ pair+ (Math.add (Pairs.first $ var "r") (int32 1))+ (pair (Pairs.first $ var "r2") (Lists.cons (Pairs.second $ var "r2") (Pairs.second $ Pairs.second $ var "r"))))+ (pair (var "idx") (pair (var "val0") (list ([] :: [TTerm Term]))))+ (Sets.toList $ var "els") $+ pair (Pairs.first $ Pairs.second $ var "rr") (Core.termSet $ Sets.fromList $ Lists.reverse $ Pairs.second $ Pairs.second $ var "rr"),+ _Term_typeApplication>>: "ta" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeApplicationTermType $ var "ta"))+ @@ Accessors.termAccessorTypeApplicationTerm+ @@ var "val0"+ @@ (Core.typeApplicationTermBody $ var "ta"),+ _Term_typeLambda>>: "tl" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeLambda $ Core.typeLambda (Core.typeLambdaParameter $ var "tl") (var "t"))+ @@ Accessors.termAccessorTypeLambdaBody+ @@ var "val0"+ @@ (Core.typeLambdaBody $ var "tl"),+ _Term_union>>: "inj" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "inj")+ (Core.field (Core.fieldName $ Core.injectionField $ var "inj") (var "t")))+ @@ Accessors.termAccessorInjectionTerm+ @@ var "val0"+ @@ (Core.fieldTerm $ Core.injectionField $ var "inj"),+ _Term_wrap>>: "wt" ~> var "forSingleWithAccessor"+ @@ var "recurse"+ @@ ("t" ~> Core.termWrap $ Core.wrappedTerm (Core.wrappedTermTypeName $ var "wt") (var "t"))+ @@ Accessors.termAccessorWrappedTerm+ @@ var "val0"+ @@ (Core.wrappedTermBody $ var "wt")]) $+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ list ([] :: [TTerm TermAccessor]) @@ var "term0"++rewriteAndFoldTermM :: TBinding (((a -> Term -> Flow s (a, Term)) -> a -> Term -> Flow s (a, Term)) -> a -> Term -> Flow s (a, Term))+rewriteAndFoldTermM = define "rewriteAndFoldTermM" $+ doc "Monadic version: rewrite a term and fold a function over it, accumulating a value" $+ "f" ~> "term0" ~>+ "fsub" <~ ("recurse" ~> "val0" ~> "term0" ~>+ "forSingle" <~ ("rec" ~> "cons" ~> "val" ~> "term" ~>+ "r" <<~ var "rec" @@ var "val" @@ var "term" $+ produce $ pair (Pairs.first $ var "r") (var "cons" @@ (Pairs.second $ var "r"))) $+ "forMany" <~ ("rec" ~> "cons" ~> "val" ~> "els" ~>+ "rr" <<~ Flows.foldl+ ("r" ~> "el" ~>+ "r2" <<~ var "rec" @@ (Pairs.first $ var "r") @@ var "el" $+ produce $ pair (Pairs.first $ var "r2") (Lists.cons (Pairs.second $ var "r2") (Pairs.second $ var "r")))+ (pair (var "val") (list ([] :: [TTerm Term])))+ (var "els") $+ produce $ pair (Pairs.first $ var "rr") (var "cons" @@ (Lists.reverse $ Pairs.second $ var "rr"))) $+ "forField" <~ ("val" ~> "field" ~>+ "r" <<~ var "recurse" @@ var "val" @@ Core.fieldTerm (var "field") $+ produce $ pair (Pairs.first $ var "r") (Core.field (Core.fieldName $ var "field") (Pairs.second $ var "r"))) $+ "forFields" <~ var "forMany" @@ var "forField" @@ ("x" ~> var "x") $+ "forPair" <~ ("val" ~> "kv" ~>+ "rk" <<~ var "recurse" @@ var "val" @@ (Pairs.first $ var "kv") $+ "rv" <<~ var "recurse" @@ (Pairs.first $ var "rk") @@ (Pairs.second $ var "kv") $+ produce $ pair+ (Pairs.first $ var "rv")+ (pair (Pairs.second $ var "rk") (Pairs.second $ var "rv"))) $+ "forBinding" <~ ("val" ~> "binding" ~>+ "r" <<~ var "recurse" @@ var "val" @@ Core.bindingTerm (var "binding") $+ produce $ pair+ (Pairs.first $ var "r")+ (Core.binding+ (Core.bindingName $ var "binding")+ (Pairs.second $ var "r")+ (Core.bindingType $ var "binding"))) $+ "forElimination" <~ ("val" ~> "elm" ~>+ "rw" <~ ("elm" ~> cases _Elimination (var "elm")+ (Just $ produce $ pair (var "val") (var "elm")) [+ _Elimination_union>>: "cs" ~>+ "rmd" <<~ Maybes.maybe (produce nothing)+ ("def" ~> Flows.map (unaryFunction just) (var "recurse" @@ var "val" @@ var "def"))+ (Core.caseStatementDefault $ var "cs") $+ "val1" <~ Maybes.maybe (var "val") (unaryFunction Pairs.first) (var "rmd") $+ "rcases" <<~ var "forFields" @@ var "val1" @@ (Core.caseStatementCases $ var "cs") $+ produce $ pair+ (Pairs.first $ var "rcases")+ (Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (unaryFunction Pairs.second) (var "rmd"))+ (Pairs.second $ var "rcases"))]) $+ "r" <<~ var "rw" @@ var "elm" $+ produce $ pair (Pairs.first $ var "r") (Pairs.second $ var "r")) $+ "forFunction" <~ ("val" ~> "fun" ~> cases _Function (var "fun")+ (Just $ produce $ pair (var "val") (var "fun")) [+ _Function_elimination>>: "elm" ~>+ "r" <<~ var "forElimination" @@ var "val" @@ var "elm" $+ produce $ pair (Pairs.first $ var "r") (Core.functionElimination (Pairs.second $ var "r")),+ _Function_lambda>>: "l" ~>+ "r" <<~ var "recurse" @@ var "val" @@ (Core.lambdaBody $ var "l") $+ produce $ pair+ (Pairs.first $ var "r")+ (Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (Pairs.second $ var "r"))]) $+ "dflt" <~ produce (pair (var "val0") (var "term0")) $+ cases _Term (var "term0")+ (Just $ var "dflt") [+ _Term_annotated>>: "at" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termAnnotated $ Core.annotatedTerm (var "t") (Core.annotatedTermAnnotation $ var "at"))+ @@ var "val0"+ @@ (Core.annotatedTermBody $ var "at"),+ _Term_application>>: "a" ~>+ "rlhs" <<~ var "recurse" @@ var "val0" @@ (Core.applicationFunction $ var "a") $+ "rrhs" <<~ var "recurse" @@ (Pairs.first $ var "rlhs") @@ (Core.applicationArgument $ var "a") $+ produce $ pair+ (Pairs.first $ var "rrhs")+ (Core.termApplication $ Core.application+ (Pairs.second $ var "rlhs")+ (Pairs.second $ var "rrhs")),+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~>+ "rl" <<~ var "recurse" @@ var "val0" @@ var "l" $+ produce $ pair (Pairs.first $ var "rl") (Core.termEither $ left $ Pairs.second $ var "rl"))+ ("r" ~>+ "rr" <<~ var "recurse" @@ var "val0" @@ var "r" $+ produce $ pair (Pairs.first $ var "rr") (Core.termEither $ right $ Pairs.second $ var "rr"))+ (var "e"),+ _Term_function>>: "f" ~> var "forSingle"+ @@ var "forFunction"+ @@ ("f" ~> Core.termFunction $ var "f")+ @@ var "val0"+ @@ var "f",+ _Term_let>>: "l" ~>+ "renv" <<~ var "recurse" @@ var "val0" @@ (Core.letBody $ var "l") $+ var "forMany" @@ var "forBinding"+ @@ ("bins" ~> Core.termLet $ Core.let_ (var "bins") (Pairs.second $ var "renv"))+ @@ Pairs.first (var "renv") @@ (Core.letBindings $ var "l"),+ _Term_list>>: "els" ~> var "forMany" @@ var "recurse" @@ (unaryFunction Core.termList) @@ var "val0" @@ var "els",+ _Term_map>>: "m" ~> var "forMany" @@ var "forPair"+ @@ ("pairs" ~> Core.termMap $ Maps.fromList $ var "pairs") @@ var "val0" @@ Maps.toList (var "m"),+ _Term_maybe>>: "mt" ~> Maybes.maybe+ (var "dflt")+ ("t" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t1" ~> Core.termMaybe $ just $ var "t1")+ @@ var "val0"+ @@ var "t")+ (var "mt"),+ _Term_pair>>: "p" ~>+ "rf" <<~ var "recurse" @@ var "val0" @@ (Pairs.first $ var "p") $+ "rs" <<~ var "recurse" @@ (Pairs.first $ var "rf") @@ (Pairs.second $ var "p") $+ produce $ pair (Pairs.first $ var "rs") (Core.termPair $ pair (Pairs.second $ var "rf") (Pairs.second $ var "rs")),+ _Term_record>>: "r" ~> var "forMany"+ @@ var "forField"+ @@ ("fields" ~> Core.termRecord $ Core.record (Core.recordTypeName $ var "r") (var "fields"))+ @@ var "val0"+ @@ Core.recordFields (var "r"),+ _Term_set>>: "els" ~> var "forMany"+ @@ var "recurse"+ @@ ("e" ~> Core.termSet $ Sets.fromList $ var "e")+ @@ var "val0"+ @@ (Sets.toList $ var "els"),+ _Term_typeApplication>>: "ta" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeApplicationTermType $ var "ta"))+ @@ var "val0"+ @@ (Core.typeApplicationTermBody $ var "ta"),+ _Term_typeLambda>>: "tl" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termTypeLambda $ Core.typeLambda (Core.typeLambdaParameter $ var "tl") (var "t"))+ @@ var "val0"+ @@ (Core.typeLambdaBody $ var "tl"),+ _Term_union>>: "inj" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "inj")+ (Core.field (Core.fieldName $ Core.injectionField $ var "inj") (var "t")))+ @@ var "val0"+ @@ (Core.fieldTerm $ Core.injectionField $ var "inj"),+ _Term_wrap>>: "wt" ~> var "forSingle"+ @@ var "recurse"+ @@ ("t" ~> Core.termWrap $ Core.wrappedTerm (Core.wrappedTermTypeName $ var "wt") (var "t"))+ @@ var "val0"+ @@ (Core.wrappedTermBody $ var "wt")]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "term0"++rewriteTerm :: TBinding (((Term -> Term) -> Term -> Term) -> Term -> Term)+rewriteTerm = define "rewriteTerm" $ "f" ~> "term0" ~>+ "fsub" <~ ("recurse" ~> "term" ~>+ "forField" <~ ("f" ~> Core.fieldWithTerm (var "recurse" @@ (Core.fieldTerm $ var "f")) (var "f")) $+ "forElimination" <~ ("elm" ~> cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "p" ~> Core.eliminationRecord (var "p"),+ _Elimination_union>>: "cs" ~> Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (var "recurse") (Core.caseStatementDefault $ var "cs"))+ (Lists.map (var "forField") (Core.caseStatementCases $ var "cs")),+ _Elimination_wrap>>: "name" ~> Core.eliminationWrap $ var "name"]) $+ "forFunction" <~ ("fun" ~> cases _Function (var "fun") Nothing [+ _Function_elimination>>: "elm" ~> Core.functionElimination $ var "forElimination" @@ var "elm",+ _Function_lambda>>: "l" ~> Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (var "recurse" @@ (Core.lambdaBody $ var "l")),+ _Function_primitive>>: "name" ~> Core.functionPrimitive $ var "name"]) $+ "forLet" <~ ("lt" ~>+ "mapBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (var "recurse" @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b")) $+ Core.let_+ (Lists.map (var "mapBinding") (Core.letBindings $ var "lt"))+ (var "recurse" @@ (Core.letBody $ var "lt"))) $+ "forMap" <~ ("m" ~>+ "forPair" <~ ("p" ~> pair (var "recurse" @@ (Pairs.first $ var "p")) (var "recurse" @@ (Pairs.second $ var "p"))) $+ Maps.fromList $ Lists.map (var "forPair") $ Maps.toList $ var "m") $+ cases _Term (var "term") Nothing [+ _Term_annotated>>: "at" ~> Core.termAnnotated $ Core.annotatedTerm+ (var "recurse" @@ (Core.annotatedTermBody $ var "at"))+ (Core.annotatedTermAnnotation $ var "at"),+ _Term_application>>: "a" ~> Core.termApplication $ Core.application+ (var "recurse" @@ (Core.applicationFunction $ var "a"))+ (var "recurse" @@ (Core.applicationArgument $ var "a")),+ _Term_either>>: "e" ~> Core.termEither $ Eithers.either_+ ("l" ~> left $ var "recurse" @@ var "l")+ ("r" ~> right $ var "recurse" @@ var "r")+ (var "e"),+ _Term_function>>: "fun" ~> Core.termFunction $ var "forFunction" @@ var "fun",+ _Term_let>>: "lt" ~> Core.termLet $ var "forLet" @@ var "lt",+ _Term_list>>: "els" ~> Core.termList $ Lists.map (var "recurse") (var "els"),+ _Term_literal>>: "v" ~> Core.termLiteral $ var "v",+ _Term_map>>: "m" ~> Core.termMap $ var "forMap" @@ var "m",+ _Term_maybe>>: "m" ~> Core.termMaybe $ Maybes.map (var "recurse") (var "m"),+ _Term_pair>>: "p" ~> Core.termPair $ pair+ (var "recurse" @@ (Pairs.first $ var "p"))+ (var "recurse" @@ (Pairs.second $ var "p")),+ _Term_record>>: "r" ~> Core.termRecord $ Core.record+ (Core.recordTypeName $ var "r")+ (Lists.map (var "forField") (Core.recordFields $ var "r")),+ _Term_set>>: "s" ~> Core.termSet $ Sets.fromList $ Lists.map (var "recurse") $ Sets.toList (var "s"),+ _Term_typeApplication>>: "tt" ~> Core.termTypeApplication $ Core.typeApplicationTerm+ (var "recurse" @@ (Core.typeApplicationTermBody $ var "tt"))+ (Core.typeApplicationTermType $ var "tt"),+ _Term_typeLambda>>: "ta" ~> Core.termTypeLambda $ Core.typeLambda+ (Core.typeLambdaParameter $ var "ta")+ (var "recurse" @@ (Core.typeLambdaBody $ var "ta")),+ _Term_union>>: "i" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "i")+ (var "forField" @@ (Core.injectionField $ var "i")),+ _Term_unit>>: constant Core.termUnit,+ _Term_variable>>: "v" ~> Core.termVariable $ var "v",+ _Term_wrap>>: "wt" ~> Core.termWrap $ Core.wrappedTerm+ (Core.wrappedTermTypeName $ var "wt")+ (var "recurse" @@ (Core.wrappedTermBody $ var "wt"))]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "term0"++rewriteTermM :: TBinding (((Term -> Flow s Term) -> Term -> Flow s Term) -> Term -> Flow s Term)+rewriteTermM = define "rewriteTermM" $+ doc "Monadic term rewriting with custom transformation function" $+ "f" ~> "term0" ~>+ "fsub" <~ ("recurse" ~> "term" ~>+ "forField" <~ ("field" ~>+ "t" <<~ var "recurse" @@ Core.fieldTerm (var "field") $+ produce $ Core.fieldWithTerm (var "t") (var "field")) $+ "forPair" <~ ("kv" ~>+ "k" <<~ var "recurse" @@ (Pairs.first $ var "kv") $+ "v" <<~ var "recurse" @@ (Pairs.second $ var "kv") $+ produce $ pair (var "k") (var "v")) $+ "mapBinding" <~ ("b" ~>+ "v" <<~ var "recurse" @@ (Core.bindingTerm $ var "b") $+ produce $ Core.binding (Core.bindingName $ var "b") (var "v") (Core.bindingType $ var "b")) $+ cases _Term (var "term") Nothing [+ _Term_annotated>>: "at" ~>+ "ex" <<~ var "recurse" @@ Core.annotatedTermBody (var "at") $+ produce $ Core.termAnnotated $ Core.annotatedTerm (var "ex") (Core.annotatedTermAnnotation $ var "at"),+ _Term_application>>: "app" ~>+ "lhs" <<~ var "recurse" @@ Core.applicationFunction (var "app") $+ "rhs" <<~ var "recurse" @@ Core.applicationArgument (var "app") $+ produce $ Core.termApplication $ Core.application (var "lhs") (var "rhs"),+ _Term_either>>: "e" ~>+ "re" <<~ Eithers.either_+ ("l" ~> Flows.map (unaryFunction left) $ var "recurse" @@ var "l")+ ("r" ~> Flows.map (unaryFunction right) $ var "recurse" @@ var "r")+ (var "e") $+ produce $ Core.termEither $ var "re",+ _Term_function>>: "fun" ~>+ "forElm" <~ ("e" ~> cases _Elimination (var "e") Nothing [+ _Elimination_record>>: "p" ~> produce $ Core.functionElimination $ Core.eliminationRecord $ var "p",+ _Elimination_union>>: "cs" ~>+ "n" <~ Core.caseStatementTypeName (var "cs") $+ "def" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "rdef" <<~ Maybes.maybe (produce nothing)+ ("t" ~> Flows.map (unaryFunction just) $ var "recurse" @@ var "t")+ (var "def") $+ Flows.map+ ("rcases" ~> Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement (var "n") (var "rdef") (var "rcases"))+ (Flows.mapList (var "forField") (var "cases")),+ _Elimination_wrap>>: "name" ~> produce $ Core.functionElimination $ Core.eliminationWrap $ var "name"]) $+ "forFun" <~ ("fun" ~> cases _Function (var "fun") Nothing [+ _Function_elimination>>: "e" ~> var "forElm" @@ var "e",+ _Function_lambda>>: "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "d" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "rbody" <<~ var "recurse" @@ var "body" $+ produce $ Core.functionLambda $ Core.lambda (var "v") (var "d") (var "rbody"),+ _Function_primitive>>: "name" ~> produce $ Core.functionPrimitive $ var "name"]) $+ "rfun" <<~ var "forFun" @@ var "fun" $+ produce $ Core.termFunction $ var "rfun",+ _Term_let>>: "lt" ~>+ "bindings" <~ Core.letBindings (var "lt") $+ "env" <~ Core.letBody (var "lt") $+ "rbindings" <<~ Flows.mapList (var "mapBinding") (var "bindings") $+ "renv" <<~ var "recurse" @@ var "env" $+ produce $ Core.termLet $ Core.let_ (var "rbindings") (var "renv"),+ _Term_list>>: "els" ~>+ "rels" <<~ Flows.mapList (var "recurse") (var "els") $+ produce $ Core.termList $ var "rels",+ _Term_literal>>: "v" ~> produce $ Core.termLiteral $ var "v",+ _Term_map>>: "m" ~>+ "pairs" <<~ Flows.mapList (var "forPair") (Maps.toList $ var "m") $+ produce $ Core.termMap $ Maps.fromList $ var "pairs",+ _Term_maybe>>: "m" ~>+ "rm" <<~ Flows.mapMaybe (var "recurse") (var "m") $+ produce $ Core.termMaybe $ var "rm",+ _Term_pair>>: "p" ~>+ "rf" <<~ var "recurse" @@ (Pairs.first $ var "p") $+ "rs" <<~ var "recurse" @@ (Pairs.second $ var "p") $+ produce $ Core.termPair $ pair (var "rf") (var "rs"),+ _Term_record>>: "r" ~>+ "n" <~ Core.recordTypeName (var "r") $+ "fields" <~ Core.recordFields (var "r") $+ Flows.map+ ("rfields" ~> Core.termRecord $ Core.record (var "n") (var "rfields"))+ (Flows.mapList (var "forField") (var "fields")),+ _Term_set>>: "s" ~>+ "rlist" <<~ Flows.mapList (var "recurse") (Sets.toList $ var "s") $+ produce $ Core.termSet $ Sets.fromList $ var "rlist",+ _Term_typeApplication>>: "tt" ~>+ "t" <<~ var "recurse" @@ Core.typeApplicationTermBody (var "tt") $+ produce $ Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeApplicationTermType (var "tt")),+ _Term_typeLambda>>: "tl" ~>+ "v" <~ Core.typeLambdaParameter (var "tl") $+ "body" <~ Core.typeLambdaBody (var "tl") $+ "rbody" <<~ var "recurse" @@ var "body" $+ produce $ Core.termTypeLambda $ Core.typeLambda (var "v") (var "rbody"),+ _Term_union>>: "i" ~>+ "n" <~ Core.injectionTypeName (var "i") $+ "field" <~ Core.injectionField (var "i") $+ Flows.map+ ("rfield" ~> Core.termUnion $ Core.injection (var "n") (var "rfield"))+ (var "forField" @@ var "field"),+ _Term_unit>>: constant $ produce Core.termUnit,+ _Term_variable>>: "v" ~> produce $ Core.termVariable $ var "v",+ _Term_wrap>>: "wt" ~>+ "name" <~ Core.wrappedTermTypeName (var "wt") $+ "t" <~ Core.wrappedTermBody (var "wt") $+ "rt" <<~ var "recurse" @@ var "t" $+ produce $ Core.termWrap $ Core.wrappedTerm (var "name") (var "rt")]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "term0"++rewriteTermWithContext :: TBinding (((a -> Term -> Term) -> a -> Term -> Term) -> a -> Term -> Term)+rewriteTermWithContext = define "rewriteTermWithContext" $+ doc ("A variant of rewriteTerm which allows a context (e.g. a TypeContext)"+ <> " to be passed down to all subterms during rewriting") $+ "f" ~> "cx0" ~> "term0" ~>+ "forSubterms" <~ ("recurse0" ~> "cx" ~> "term" ~>+ "recurse" <~ var "recurse0" @@ var "cx" $+ "forField" <~ ("field" ~> Core.fieldWithTerm (var "recurse" @@ (Core.fieldTerm $ var "field")) (var "field")) $+ "forElimination" <~ ("elm" ~> cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "p" ~> Core.eliminationRecord (var "p"),+ _Elimination_union>>: "cs" ~> Core.eliminationUnion $ Core.caseStatement+ (Core.caseStatementTypeName $ var "cs")+ (Maybes.map (var "recurse") (Core.caseStatementDefault $ var "cs"))+ (Lists.map (var "forField") (Core.caseStatementCases $ var "cs")),+ _Elimination_wrap>>: "name" ~> Core.eliminationWrap $ var "name"]) $+ "forFunction" <~ ("fun" ~> cases _Function (var "fun") Nothing [+ _Function_elimination>>: "elm" ~> Core.functionElimination $ var "forElimination" @@ var "elm",+ _Function_lambda>>: "l" ~> Core.functionLambda $ Core.lambda+ (Core.lambdaParameter $ var "l")+ (Core.lambdaDomain $ var "l")+ (var "recurse" @@ (Core.lambdaBody $ var "l")),+ _Function_primitive>>: "name" ~> Core.functionPrimitive $ var "name"]) $+ "forLet" <~ ("lt" ~>+ "mapBinding" <~ ("b" ~> Core.binding+ (Core.bindingName $ var "b")+ (var "recurse" @@ (Core.bindingTerm $ var "b"))+ (Core.bindingType $ var "b")) $+ Core.let_+ (Lists.map (var "mapBinding") (Core.letBindings $ var "lt"))+ (var "recurse" @@ (Core.letBody $ var "lt"))) $+ "forMap" <~ ("m" ~>+ "forPair" <~ ("p" ~> pair (var "recurse" @@ (Pairs.first $ var "p")) (var "recurse" @@ (Pairs.second $ var "p"))) $+ Maps.fromList $ Lists.map (var "forPair") $ Maps.toList $ var "m") $+ cases _Term (var "term") Nothing [+ _Term_annotated>>: "at" ~> Core.termAnnotated $ Core.annotatedTerm+ (var "recurse" @@ (Core.annotatedTermBody $ var "at"))+ (Core.annotatedTermAnnotation $ var "at"),+ _Term_application>>: "a" ~> Core.termApplication $ Core.application+ (var "recurse" @@ (Core.applicationFunction $ var "a"))+ (var "recurse" @@ (Core.applicationArgument $ var "a")),+ _Term_either>>: "e" ~> Core.termEither $ Eithers.either_+ ("l" ~> left $ var "recurse" @@ var "l")+ ("r" ~> right $ var "recurse" @@ var "r")+ (var "e"),+ _Term_function>>: "fun" ~> Core.termFunction $ var "forFunction" @@ var "fun",+ _Term_let>>: "lt" ~> Core.termLet $ var "forLet" @@ var "lt",+ _Term_list>>: "els" ~> Core.termList $ Lists.map (var "recurse") (var "els"),+ _Term_literal>>: "v" ~> Core.termLiteral $ var "v",+ _Term_map>>: "m" ~> Core.termMap $ var "forMap" @@ var "m",+ _Term_maybe>>: "m" ~> Core.termMaybe $ Maybes.map (var "recurse") (var "m"),+ _Term_pair>>: "p" ~> Core.termPair $ pair+ (var "recurse" @@ (Pairs.first $ var "p"))+ (var "recurse" @@ (Pairs.second $ var "p")),+ _Term_record>>: "r" ~> Core.termRecord $ Core.record+ (Core.recordTypeName $ var "r")+ (Lists.map (var "forField") (Core.recordFields $ var "r")),+ _Term_set>>: "s" ~> Core.termSet $ Sets.fromList $ Lists.map (var "recurse") $ Sets.toList (var "s"),+ _Term_typeApplication>>: "tt" ~> Core.termTypeApplication $ Core.typeApplicationTerm+ (var "recurse" @@ (Core.typeApplicationTermBody $ var "tt"))+ (Core.typeApplicationTermType $ var "tt"),+ _Term_typeLambda>>: "ta" ~> Core.termTypeLambda $ Core.typeLambda+ (Core.typeLambdaParameter $ var "ta")+ (var "recurse" @@ (Core.typeLambdaBody $ var "ta")),+ _Term_union>>: "i" ~> Core.termUnion $ Core.injection+ (Core.injectionTypeName $ var "i")+ (var "forField" @@ (Core.injectionField $ var "i")),+ _Term_unit>>: constant Core.termUnit,+ _Term_variable>>: "v" ~> Core.termVariable $ var "v",+ _Term_wrap>>: "wt" ~> Core.termWrap $ Core.wrappedTerm+ (Core.wrappedTermTypeName $ var "wt")+ (var "recurse" @@ (Core.wrappedTermBody $ var "wt"))]) $+ "rewrite" <~ ("cx" ~> "term" ~> var "f" @@ (var "forSubterms" @@ var "rewrite") @@ var "cx" @@ var "term") $+ var "rewrite" @@ var "cx0" @@ var "term0"++rewriteTermWithContextM :: TBinding (((a -> Term -> Flow s Term) -> a -> Term -> Flow s Term) -> a -> Term -> Flow s Term)+rewriteTermWithContextM = define "rewriteTermWithContextM" $+ doc ("A variant of rewriteTermM which allows a context (e.g. a TypeContext)"+ <> " to be passed down to all subterms during rewriting") $+ "f" ~> "cx0" ~> "term0" ~>+ "forSubterms" <~ ("recurse0" ~> "cx" ~> "term" ~>+ "recurse" <~ var "recurse0" @@ var "cx" $+ "forField" <~ ("field" ~>+ "t" <<~ var "recurse" @@ Core.fieldTerm (var "field") $+ produce $ Core.fieldWithTerm (var "t") (var "field")) $+ "forPair" <~ ("kv" ~>+ "k" <<~ var "recurse" @@ (Pairs.first $ var "kv") $+ "v" <<~ var "recurse" @@ (Pairs.second $ var "kv") $+ produce $ pair (var "k") (var "v")) $+ "forElimination" <~ ("e" ~> cases _Elimination (var "e") Nothing [+ _Elimination_record>>: "p" ~> produce $ Core.functionElimination $ Core.eliminationRecord $ var "p",+ _Elimination_union>>: "cs" ~>+ "n" <~ Core.caseStatementTypeName (var "cs") $+ "def" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "rdef" <<~ Maybes.maybe (produce nothing)+ ("t" ~> Flows.map (unaryFunction just) $ var "recurse" @@ var "t")+ (var "def") $+ Flows.map+ ("rcases" ~> Core.functionElimination $ Core.eliminationUnion $+ Core.caseStatement (var "n") (var "rdef") (var "rcases"))+ (Flows.mapList (var "forField") (var "cases")),+ _Elimination_wrap>>: "name" ~> produce $ Core.functionElimination $ Core.eliminationWrap $ var "name"]) $+ "forFunction" <~ ("fun" ~> cases _Function (var "fun") Nothing [+ _Function_elimination>>: "e" ~> var "forElimination" @@ var "e",+ _Function_lambda>>: "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "d" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "rbody" <<~ var "recurse" @@ var "body" $+ produce $ Core.functionLambda $ Core.lambda (var "v") (var "d") (var "rbody"),+ _Function_primitive>>: "name" ~> produce $ Core.functionPrimitive $ var "name"]) $+ "mapBinding" <~ ("b" ~>+ "v" <<~ var "recurse" @@ (Core.bindingTerm $ var "b") $+ produce $ Core.binding (Core.bindingName $ var "b") (var "v") (Core.bindingType $ var "b")) $+ cases _Term (var "term") Nothing [+ _Term_annotated>>: "at" ~>+ "ex" <<~ var "recurse" @@ Core.annotatedTermBody (var "at") $+ produce $ Core.termAnnotated $ Core.annotatedTerm (var "ex") (Core.annotatedTermAnnotation $ var "at"),+ _Term_application>>: "app" ~>+ "lhs" <<~ var "recurse" @@ Core.applicationFunction (var "app") $+ "rhs" <<~ var "recurse" @@ Core.applicationArgument (var "app") $+ produce $ Core.termApplication $ Core.application (var "lhs") (var "rhs"),+ _Term_either>>: "e" ~>+ "re" <<~ Eithers.either_+ ("l" ~> Flows.map (unaryFunction left) $ var "recurse" @@ var "l")+ ("r" ~> Flows.map (unaryFunction right) $ var "recurse" @@ var "r")+ (var "e") $+ produce $ Core.termEither $ var "re",+ _Term_function>>: "fun" ~>+ "rfun" <<~ var "forFunction" @@ var "fun" $+ produce $ Core.termFunction $ var "rfun",+ _Term_let>>: "lt" ~>+ "bindings" <~ Core.letBindings (var "lt") $+ "body" <~ Core.letBody (var "lt") $+ "rbindings" <<~ Flows.mapList (var "mapBinding") (var "bindings") $+ "rbody" <<~ var "recurse" @@ var "body" $+ produce $ Core.termLet $ Core.let_ (var "rbindings") (var "rbody"),+ _Term_list>>: "els" ~>+ "rels" <<~ Flows.mapList (var "recurse") (var "els") $+ produce $ Core.termList $ var "rels",+ _Term_literal>>: "v" ~> produce $ Core.termLiteral $ var "v",+ _Term_map>>: "m" ~>+ "pairs" <<~ Flows.mapList (var "forPair") (Maps.toList $ var "m") $+ produce $ Core.termMap $ Maps.fromList $ var "pairs",+ _Term_maybe>>: "m" ~>+ "rm" <<~ Flows.mapMaybe (var "recurse") (var "m") $+ produce $ Core.termMaybe $ var "rm",+ _Term_pair>>: "p" ~>+ "rfirst" <<~ var "recurse" @@ Pairs.first (var "p") $+ "rsecond" <<~ var "recurse" @@ Pairs.second (var "p") $+ produce $ Core.termPair $ pair (var "rfirst") (var "rsecond"),+ _Term_record>>: "r" ~>+ "n" <~ Core.recordTypeName (var "r") $+ "fields" <~ Core.recordFields (var "r") $+ Flows.map+ ("rfields" ~> Core.termRecord $ Core.record (var "n") (var "rfields"))+ (Flows.mapList (var "forField") (var "fields")),+ _Term_set>>: "s" ~>+ "rlist" <<~ Flows.mapList (var "recurse") (Sets.toList $ var "s") $+ produce $ Core.termSet $ Sets.fromList $ var "rlist",+ _Term_typeApplication>>: "tt" ~>+ "t" <<~ var "recurse" @@ Core.typeApplicationTermBody (var "tt") $+ produce $ Core.termTypeApplication $ Core.typeApplicationTerm (var "t") (Core.typeApplicationTermType (var "tt")),+ _Term_typeLambda>>: "tl" ~>+ "v" <~ Core.typeLambdaParameter (var "tl") $+ "body" <~ Core.typeLambdaBody (var "tl") $+ "rbody" <<~ var "recurse" @@ var "body" $+ produce $ Core.termTypeLambda $ Core.typeLambda (var "v") (var "rbody"),+ _Term_union>>: "i" ~>+ "n" <~ Core.injectionTypeName (var "i") $+ "field" <~ Core.injectionField (var "i") $+ Flows.map+ ("rfield" ~> Core.termUnion $ Core.injection (var "n") (var "rfield"))+ (var "forField" @@ var "field"),+ _Term_unit>>: constant $ produce Core.termUnit,+ _Term_variable>>: "v" ~> produce $ Core.termVariable $ var "v",+ _Term_wrap>>: "wt" ~>+ "name" <~ Core.wrappedTermTypeName (var "wt") $+ "t" <~ Core.wrappedTermBody (var "wt") $+ "rt" <<~ var "recurse" @@ var "t" $+ produce $ Core.termWrap $ Core.wrappedTerm (var "name") (var "rt")]) $++ "rewrite" <~ ("cx" ~> "term" ~> var "f" @@ (var "forSubterms" @@ var "rewrite") @@ var "cx" @@ var "term") $+ var "rewrite" @@ var "cx0" @@ var "term0"++rewriteType :: TBinding (((Type -> Type) -> Type -> Type) -> Type -> Type)+rewriteType = define "rewriteType" $ "f" ~> "typ0" ~>+ "fsub" <~ ("recurse" ~> "typ" ~>+ "forField" <~ ("field" ~> Core.fieldTypeWithType (var "field") (var "recurse" @@ (Core.fieldTypeType $ var "field"))) $+ cases _Type (var "typ") Nothing [+ _Type_annotated>>: "at" ~> Core.typeAnnotated $ Core.annotatedType+ (var "recurse" @@ (Core.annotatedTypeBody $ var "at"))+ (Core.annotatedTypeAnnotation $ var "at"),+ _Type_application>>: "app" ~> Core.typeApplication $ Core.applicationType+ (var "recurse" @@ (Core.applicationTypeFunction $ var "app"))+ (var "recurse" @@ (Core.applicationTypeArgument $ var "app")),+ _Type_either>>: "et" ~> Core.typeEither $ Core.eitherType+ (var "recurse" @@ (Core.eitherTypeLeft $ var "et"))+ (var "recurse" @@ (Core.eitherTypeRight $ var "et")),+ _Type_pair>>: "pt" ~> Core.typePair $ Core.pairType+ (var "recurse" @@ (Core.pairTypeFirst $ var "pt"))+ (var "recurse" @@ (Core.pairTypeSecond $ var "pt")),+ _Type_function>>: "fun" ~> Core.typeFunction $ Core.functionType+ (var "recurse" @@ (Core.functionTypeDomain $ var "fun"))+ (var "recurse" @@ (Core.functionTypeCodomain $ var "fun")),+ _Type_forall>>: "lt" ~> Core.typeForall $ Core.forallType+ (Core.forallTypeParameter $ var "lt")+ (var "recurse" @@ (Core.forallTypeBody $ var "lt")),+ _Type_list>>: "t" ~> Core.typeList $ var "recurse" @@ var "t",+ _Type_literal>>: "lt" ~> Core.typeLiteral $ var "lt",+ _Type_map>>: "mt" ~> Core.typeMap $ Core.mapType+ (var "recurse" @@ (Core.mapTypeKeys $ var "mt"))+ (var "recurse" @@ (Core.mapTypeValues $ var "mt")),+ _Type_maybe>>: "t" ~> Core.typeMaybe $ var "recurse" @@ var "t",+ _Type_record>>: "rt" ~> Core.typeRecord $ Core.rowType+ (Core.rowTypeTypeName $ var "rt")+ (Lists.map (var "forField") (Core.rowTypeFields $ var "rt")),+ _Type_set>>: "t" ~> Core.typeSet $ var "recurse" @@ var "t",+ _Type_union>>: "rt" ~> Core.typeUnion $ Core.rowType+ (Core.rowTypeTypeName $ var "rt")+ (Lists.map (var "forField") (Core.rowTypeFields $ var "rt")),+ _Type_unit>>: constant Core.typeUnit,+ _Type_variable>>: "v" ~> Core.typeVariable $ var "v",+ _Type_wrap>>: "wt" ~> Core.typeWrap $ Core.wrappedType+ (Core.wrappedTypeTypeName $ var "wt")+ (var "recurse" @@ (Core.wrappedTypeBody $ var "wt"))]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "typ0"++rewriteTypeM :: TBinding (((Type -> Flow s Type) -> Type -> Flow s Type) -> Type -> Flow s Type)+rewriteTypeM = define "rewriteTypeM" $+ doc "Monadic type rewriting" $+ "f" ~> "typ0" ~>+ "fsub" <~ ("recurse" ~> "typ" ~> cases _Type (var "typ") Nothing [+ _Type_annotated>>: "at" ~>+ "t" <<~ var "recurse" @@ (Core.annotatedTypeBody $ var "at") $+ produce $ Core.typeAnnotated $ Core.annotatedType (var "t") (Core.annotatedTypeAnnotation $ var "at"),+ _Type_application>>: "at" ~>+ "lhs" <<~ var "recurse" @@ (Core.applicationTypeFunction $ var "at") $+ "rhs" <<~ var "recurse" @@ (Core.applicationTypeArgument $ var "at") $+ produce $ Core.typeApplication $ Core.applicationType (var "lhs") (var "rhs"),+ _Type_either>>: "et" ~>+ "left" <<~ var "recurse" @@ (Core.eitherTypeLeft $ var "et") $+ "right" <<~ var "recurse" @@ (Core.eitherTypeRight $ var "et") $+ produce $ Core.typeEither $ Core.eitherType (var "left") (var "right"),+ _Type_pair>>: "pt" ~>+ "pairFirst" <<~ var "recurse" @@ (Core.pairTypeFirst $ var "pt") $+ "pairSecond" <<~ var "recurse" @@ (Core.pairTypeSecond $ var "pt") $+ produce $ Core.typePair $ Core.pairType (var "pairFirst") (var "pairSecond"),+ _Type_function>>: "ft" ~>+ "dom" <<~ var "recurse" @@ (Core.functionTypeDomain $ var "ft") $+ "cod" <<~ var "recurse" @@ (Core.functionTypeCodomain $ var "ft") $+ produce $ Core.typeFunction $ Core.functionType (var "dom") (var "cod"),+ _Type_forall>>: "ft" ~>+ "b" <<~ var "recurse" @@ (Core.forallTypeBody $ var "ft") $+ produce $ Core.typeForall $ Core.forallType (Core.forallTypeParameter $ var "ft") (var "b"),+ _Type_list>>: "t" ~>+ "rt" <<~ var "recurse" @@ var "t" $+ produce $ Core.typeList $ var "rt",+ _Type_literal>>: "lt" ~> produce $ Core.typeLiteral $ var "lt",+ _Type_map>>: "mt" ~>+ "kt" <<~ var "recurse" @@ (Core.mapTypeKeys $ var "mt") $+ "vt" <<~ var "recurse" @@ (Core.mapTypeValues $ var "mt") $+ produce $ Core.typeMap $ Core.mapType (var "kt") (var "vt"),+ _Type_maybe>>: "t" ~>+ "rt" <<~ var "recurse" @@ var "t" $+ produce $ Core.typeMaybe $ var "rt",+ _Type_record>>: "rt" ~>+ "name" <~ Core.rowTypeTypeName (var "rt") $+ "fields" <~ Core.rowTypeFields (var "rt") $+ "forField" <~ ("f" ~>+ "t" <<~ var "recurse" @@ (Core.fieldTypeType $ var "f") $+ produce $ Core.fieldTypeWithType (var "f") (var "t")) $+ "rfields" <<~ Flows.mapList (var "forField") (var "fields") $+ produce $ Core.typeRecord $ Core.rowType (var "name") (var "rfields"),+ _Type_set>>: "t" ~>+ "rt" <<~ var "recurse" @@ var "t" $+ produce $ Core.typeSet $ var "rt",+ _Type_union>>: "rt" ~>+ "name" <~ Core.rowTypeTypeName (var "rt") $+ "fields" <~ Core.rowTypeFields (var "rt") $+ "forField" <~ ("f" ~>+ "t" <<~ var "recurse" @@ (Core.fieldTypeType $ var "f") $+ produce $ Core.fieldTypeWithType (var "f") (var "t")) $+ "rfields" <<~ Flows.mapList (var "forField") (var "fields") $+ produce $ Core.typeUnion $ Core.rowType (var "name") (var "rfields"),+ _Type_unit>>: constant $ produce Core.typeUnit,+ _Type_variable>>: "v" ~> produce $ Core.typeVariable $ var "v",+ _Type_wrap>>: "wt" ~>+ "t" <<~ var "recurse" @@ (Core.wrappedTypeBody $ var "wt") $+ produce $ Core.typeWrap $ Core.wrappedType (Core.wrappedTypeTypeName $ var "wt") (var "t")]) $+-- rewrite @@ var "fsub" @@ var "f" -- TODO: restore global rewrite/fix instead of the local definition+ "recurse" <~ var "f" @@ (var "fsub" @@ var "recurse") $+ var "recurse" @@ var "typ0"++simplifyTerm :: TBinding (Term -> Term)+simplifyTerm = define "simplifyTerm" $+ doc "Simplify terms by applying beta reduction where possible" $+ "term" ~>+ "simplify" <~ ("recurse" ~> "term" ~>+ "forRhs" <~ ("rhs" ~> "var" ~> "body" ~> cases _Term (deannotateTerm @@ var "rhs")+ (Just $ var "term") [+ _Term_variable>>: "v" ~>+ simplifyTerm @@ (substituteVariable @@ var "var" @@ var "v" @@ var "body")]) $+ "forLhs" <~ ("lhs" ~> "rhs" ~>+ "forFun" <~ ("fun" ~> cases _Function (var "fun")+ (Just $ var "term") [+ _Function_lambda>>: "l" ~>+ "var" <~ Core.lambdaParameter (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ Logic.ifElse (Sets.member (var "var") (freeVariablesInTerm @@ var "body"))+ (var "forRhs" @@ var "rhs" @@ var "var" @@ var "body")+ (simplifyTerm @@ var "body")]) $+ cases _Term (deannotateTerm @@ var "lhs")+ (Just $ var "term") [+ _Term_function>>: "fun" ~> var "forFun" @@ var "fun"]) $+ "forTerm" <~ ("stripped" ~> cases _Term (var "stripped")+ (Just $ var "term") [+ _Term_application>>: "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ var "forLhs" @@ var "lhs" @@ var "rhs"]) $+ "stripped" <~ deannotateTerm @@ var "term" $+ var "recurse" @@ (var "forTerm" @@ var "stripped")) $+ rewriteTerm @@ var "simplify" @@ var "term"++substituteTypeVariables :: TBinding (M.Map Name Name -> Type -> Type)+substituteTypeVariables = define "substituteTypeVariables" $+ doc "Substitute type variables in a type" $+ "subst" ~> "typ" ~>+ "replace" <~ ("recurse" ~> "typ" ~> cases _Type (var "typ")+ (Just $ var "recurse" @@ var "typ") [+ _Type_variable>>: "n" ~>+ Core.typeVariable $ Maybes.fromMaybe (var "n") $ Maps.lookup (var "n") (var "subst")]) $+ rewriteType @@ var "replace" @@ var "typ"++substituteVariable :: TBinding (Name -> Name -> Term -> Term)+substituteVariable = define "substituteVariable" $+ doc "Substitute one variable for another in a term" $+ "from" ~> "to" ~> "term" ~>+ "replace" <~ ("recurse" ~> "term" ~>+ cases _Term (var "term")+ (Just $ var "recurse" @@ var "term") [+ _Term_variable>>: "x" ~>+ Core.termVariable $ Logic.ifElse (Equality.equal (var "x") (var "from")) (var "to") (var "x"),+ _Term_function>>: match _Function+ (Just $ var "recurse" @@ var "term") [+ _Function_lambda>>: "l" ~> Logic.ifElse+ (Equality.equal (Core.lambdaParameter $ var "l") (var "from"))+ (var "term")+ (var "recurse" @@ var "term")]]) $+ rewriteTerm @@ var "replace" @@ var "term"++substituteVariables :: TBinding (M.Map Name Name -> Term -> Term)+substituteVariables = define "substituteVariables" $+ doc "Substitute multiple variables in a term" $+ "subst" ~> "term" ~>+ "replace" <~ ("recurse" ~> "term" ~>+ cases _Term (var "term")+ (Just $ var "recurse" @@ var "term") [+ _Term_variable>>: "n" ~>+ Core.termVariable $ Maybes.fromMaybe (var "n") $ Maps.lookup (var "n") (var "subst"),+ _Term_function>>: match _Function+ (Just $ var "recurse" @@ var "term") [+ _Function_lambda>>: "l" ~>+ Maybes.maybe+ (var "recurse" @@ var "term")+ (constant $ var "term")+ (Maps.lookup (Core.lambdaParameter $ var "l") (var "subst"))]]) $+ rewriteTerm @@ var "replace" @@ var "term"++subterms :: TBinding (Term -> [Term])+subterms = define "subterms" $+ doc "Find the children of a given term" $+ match _Term Nothing [+ _Term_annotated>>: "at" ~> list [Core.annotatedTermBody $ var "at"],+ _Term_application>>: "p" ~> list [+ Core.applicationFunction $ var "p",+ Core.applicationArgument $ var "p"],+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~> list [var "l"])+ ("r" ~> list [var "r"])+ (var "e"),+ _Term_function>>: match _Function+ (Just $ list ([] :: [TTerm Term])) [+ _Function_elimination>>: match _Elimination+ (Just $ list ([] :: [TTerm Term])) [+ _Elimination_union>>: "cs" ~> Lists.concat2+ (Maybes.maybe (list ([] :: [TTerm Term])) ("t" ~> list [var "t"]) (Core.caseStatementDefault $ var "cs"))+ (Lists.map (unaryFunction Core.fieldTerm) (Core.caseStatementCases $ var "cs"))],+ _Function_lambda>>: "l" ~> list [Core.lambdaBody $ var "l"]],+ _Term_let>>: "lt" ~> Lists.cons+ (Core.letBody $ var "lt")+ (Lists.map (unaryFunction Core.bindingTerm) (Core.letBindings $ var "lt")),+ _Term_list>>: "l" ~> var "l",+ _Term_literal>>: constant $ list ([] :: [TTerm Term]),+ _Term_map>>: "m" ~> Lists.concat $ Lists.map+ ("p" ~> list [Pairs.first $ var "p", Pairs.second $ var "p"])+ (Maps.toList $ var "m"),+ _Term_maybe>>: "m" ~> Maybes.maybe (list ([] :: [TTerm Term])) ("t" ~> list [var "t"]) (var "m"),+ _Term_pair>>: "p" ~> list [Pairs.first $ var "p", Pairs.second $ var "p"],+ _Term_record>>: "rt" ~> Lists.map (unaryFunction Core.fieldTerm) (Core.recordFields $ var "rt"),+ _Term_set>>: "l" ~> Sets.toList $ var "l",+ _Term_typeApplication>>: "ta" ~> list [Core.typeApplicationTermBody $ var "ta"],+ _Term_typeLambda>>: "ta" ~> list [Core.typeLambdaBody $ var "ta"],+ _Term_union>>: "ut" ~> list [Core.fieldTerm $ (Core.injectionField $ var "ut")],+ _Term_unit>>: constant $ list ([] :: [TTerm Term]),+ _Term_variable>>: constant $ list ([] :: [TTerm Term]),+ _Term_wrap>>: "n" ~> list [Core.wrappedTermBody $ var "n"]]++subtermsWithAccessors :: TBinding (Term -> [(TermAccessor, Term)])+subtermsWithAccessors = define "subtermsWithAccessors" $+ doc "Find the children of a given term" $+ match _Term Nothing [+ _Term_annotated>>: "at" ~> single Accessors.termAccessorAnnotatedBody $ Core.annotatedTermBody $ var "at",+ _Term_application>>: "p" ~> list [+ result Accessors.termAccessorApplicationFunction $ Core.applicationFunction $ var "p",+ result Accessors.termAccessorApplicationArgument $ Core.applicationArgument $ var "p"],+ _Term_either>>: "e" ~> none, -- TODO: add accessors when TermAccessor type is updated+ _Term_function>>: match _Function+ (Just none) [+ _Function_elimination>>: match _Elimination+ (Just none) [+ _Elimination_union>>: "cs" ~> Lists.concat2+ (Maybes.maybe none+ ("t" ~> single Accessors.termAccessorUnionCasesDefault $ var "t")+ (Core.caseStatementDefault $ var "cs"))+ (Lists.map+ ("f" ~> result (Accessors.termAccessorUnionCasesBranch $ Core.fieldName $ var "f") $ Core.fieldTerm $ var "f")+ (Core.caseStatementCases $ var "cs"))],+ _Function_lambda>>: "l" ~> single Accessors.termAccessorLambdaBody $ Core.lambdaBody $ var "l"],+ _Term_let>>: "lt" ~> Lists.cons+ (result Accessors.termAccessorLetEnvironment $ Core.letBody $ var "lt")+ (Lists.map+ ("b" ~> result (Accessors.termAccessorLetBinding $ Core.bindingName $ var "b") $ Core.bindingTerm $ var "b")+ (Core.letBindings $ var "lt")),+ _Term_list>>: "l" ~> Lists.map+ -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0+ ("e" ~> result (Accessors.termAccessorListElement $ int32 0) $ var "e")+ (var "l"),+ _Term_literal>>: constant none,+ _Term_map>>: "m" ~> Lists.concat+ (Lists.map+ ("p" ~> list [+ -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0+ result (Accessors.termAccessorMapKey $ int32 0) $ Pairs.first $ var "p",+ result (Accessors.termAccessorMapValue $ int32 0) $ Pairs.second $ var "p"])+ (Maps.toList $ var "m")),+ _Term_maybe>>: "m" ~> Maybes.maybe none+ ("t" ~> single Accessors.termAccessorOptionalTerm $ var "t")+ (var "m"),+ _Term_pair>>: "p" ~> none, -- TODO: add accessors when TermAccessor type is updated+ _Term_record>>: "rt" ~> Lists.map+ ("f" ~> result (Accessors.termAccessorRecordField $ Core.fieldName $ var "f") $ Core.fieldTerm $ var "f")+ (Core.recordFields $ var "rt"),+ _Term_set>>: "s" ~> Lists.map+ -- TODO: use a range of indexes from 0 to len(l)-1, rather than just 0+ ("e" ~> result (Accessors.termAccessorListElement $ int32 0) $ var "e")+ (Sets.toList $ var "s"),+ _Term_typeApplication>>: "ta" ~>+ single Accessors.termAccessorTypeApplicationTerm $+ Core.typeApplicationTermBody $ var "ta",+ _Term_typeLambda>>: "ta" ~>+ single Accessors.termAccessorTypeLambdaBody $+ Core.typeLambdaBody $ var "ta",+ _Term_union>>: "ut" ~>+ single Accessors.termAccessorInjectionTerm $+ Core.fieldTerm $ (Core.injectionField $ var "ut"),+ _Term_unit>>: constant none,+ _Term_variable>>: constant none,+ _Term_wrap>>: "n" ~> single Accessors.termAccessorWrappedTerm $ Core.wrappedTermBody $ var "n"]+ where+ none = list ([] :: [TTerm (TermAccessor, Term)])+ single accessor term = list [result accessor term]+ result accessor term = pair accessor term+ simple term = result Accessors.termAccessorAnnotatedBody term++subtypes :: TBinding (Type -> [Type])+subtypes = define "subtypes" $+ doc "Find the children of a given type expression" $+ match _Type Nothing [+ _Type_annotated>>: "at" ~> list [Core.annotatedTypeBody $ var "at"],+ _Type_application>>: "at" ~> list [+ Core.applicationTypeFunction $ var "at",+ Core.applicationTypeArgument $ var "at"],+ _Type_either>>: "et" ~> list [+ Core.eitherTypeLeft $ var "et",+ Core.eitherTypeRight $ var "et"],+ _Type_pair>>: "pt" ~> list [+ Core.pairTypeFirst $ var "pt",+ Core.pairTypeSecond $ var "pt"],+ _Type_function>>: "ft" ~> list [+ Core.functionTypeDomain $ var "ft",+ Core.functionTypeCodomain $ var "ft"],+ _Type_forall>>: "lt" ~> list [Core.forallTypeBody $ var "lt"],+ _Type_list>>: "lt" ~> list [var "lt"],+ _Type_literal>>: constant $ list ([] :: [TTerm Type]),+ _Type_map>>: "mt" ~> list [+ Core.mapTypeKeys $ var "mt",+ Core.mapTypeValues $ var "mt"],+ _Type_maybe>>: "ot" ~> list [var "ot"],+ _Type_record>>: "rt" ~> Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields $ var "rt"),+ _Type_set>>: "st" ~> list [var "st"],+ _Type_union>>: "rt" ~> Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields $ var "rt"),+ _Type_unit>>: constant $ list ([] :: [TTerm Type]),+ _Type_variable>>: constant $ list ([] :: [TTerm Type]),+ _Type_wrap>>: "nt" ~> list [Core.wrappedTypeBody $ var "nt"]]++termDependencyNames :: TBinding (Bool -> Bool -> Bool -> Term -> S.Set Name)+termDependencyNames = define "termDependencyNames" $+ doc "Note: does not distinguish between bound and free variables; use freeVariablesInTerm for that" $+ "binds" ~> "withPrims" ~> "withNoms" ~> "term0" ~>+ "addNames" <~ ("names" ~> "term" ~>+ "nominal" <~ ("name" ~> Logic.ifElse (var "withNoms")+ (Sets.insert (var "name") (var "names"))+ (var "names")) $+ "prim" <~ ("name" ~> Logic.ifElse (var "withPrims")+ (Sets.insert (var "name") (var "names"))+ (var "names")) $+ "var" <~ ("name" ~> Logic.ifElse (var "binds")+ (Sets.insert (var "name") (var "names"))+ (var "names")) $+ cases _Term (var "term")+ (Just $ var "names") [+ _Term_function>>: "f" ~> cases _Function (var "f")+ (Just $ var "names") [+ _Function_primitive>>: "name" ~> var "prim" @@ var "name",+ _Function_elimination>>: "e" ~> cases _Elimination (var "e")+ Nothing [+ _Elimination_record>>: "proj" ~> var "nominal" @@ (Core.projectionTypeName $ var "proj"),+ _Elimination_union>>: "caseStmt" ~> var "nominal" @@ (Core.caseStatementTypeName $ var "caseStmt"),+ _Elimination_wrap>>: "name" ~> var "nominal" @@ var "name"]],+ _Term_record>>: "record" ~> var "nominal" @@ (Core.recordTypeName $ var "record"),+ _Term_union>>: "injection" ~> var "nominal" @@ (Core.injectionTypeName $ var "injection"),+ _Term_variable>>: "name" ~> var "var" @@ var "name",+ _Term_wrap>>: "wrappedTerm" ~> var "nominal" @@ (Core.wrappedTermTypeName $ var "wrappedTerm")]) $+ foldOverTerm @@ Coders.traversalOrderPre @@ var "addNames" @@ Sets.empty @@ var "term0"++toShortNames :: TBinding ([Name] -> M.Map Name Name)+toShortNames = define "toShortNames" $+ doc "Generate short names from a list of fully qualified names" $+ "original" ~>+ "addName" <~ ("acc" ~> "name" ~>+ "local" <~ Names.localNameOf @@ var "name" $+ "group" <~ Maybes.fromMaybe Sets.empty (Maps.lookup (var "local") (var "acc")) $+ Maps.insert (var "local") (Sets.insert (var "name") (var "group")) (var "acc")) $+ "groupNamesByLocal" <~ ("names" ~> Lists.foldl (var "addName") Maps.empty (var "names")) $+ "groups" <~ var "groupNamesByLocal" @@ var "original" $+ "renameGroup" <~ ("localNames" ~>+ "local" <~ Pairs.first (var "localNames") $+ "names" <~ Pairs.second (var "localNames") $+ "rangeFrom" <~ ("start" ~> Lists.cons (var "start") (var "rangeFrom" @@ (Math.add (var "start") (int32 1)))) $+ "rename" <~ ("name" ~> "i" ~> pair (var "name") $ Core.name $+ Logic.ifElse (Equality.gt (var "i") (int32 1))+ (Strings.cat2 (var "local") (Literals.showInt32 $ var "i"))+ (var "local")) $+ Lists.zipWith (var "rename") (Sets.toList $ var "names") (var "rangeFrom" @@ int32 1)) $+ Maps.fromList $ Lists.concat $ Lists.map (var "renameGroup") $ Maps.toList $ var "groups"++topologicalSortBindingMap :: TBinding (M.Map Name Term -> [[(Name, Term)]])+topologicalSortBindingMap = define "topologicalSortBindingMap" $+ doc "Topological sort of connected components, in terms of dependencies between variable/term binding pairs" $+ "bindingMap" ~>+ "bindings" <~ Maps.toList (var "bindingMap") $+ "keys" <~ Sets.fromList (Lists.map (unaryFunction Pairs.first) (var "bindings")) $+ -- TODO: this function currently serves no purpose; it always yields false+ "hasTypeAnnotation" <~ ("term" ~>+ cases _Term (var "term")+ (Just false) [+ _Term_annotated>>: "at" ~> var "hasTypeAnnotation" @@ (Core.annotatedTermBody $ var "at")]) $+ "depsOf" <~ ("nameAndTerm" ~>+ "name" <~ Pairs.first (var "nameAndTerm") $+ "term" <~ Pairs.second (var "nameAndTerm") $+ pair (var "name") $ Logic.ifElse (var "hasTypeAnnotation" @@ var "term")+ (list ([] :: [TTerm Name]))+ (Sets.toList $ Sets.intersection (var "keys") $ freeVariablesInTerm @@ var "term")) $+ "toPair" <~ ("name" ~> pair (var "name") $ Maybes.fromMaybe+ (Core.termLiteral $ Core.literalString $ string "Impossible!")+ (Maps.lookup (var "name") (var "bindingMap"))) $+ Lists.map (unaryFunction $ Lists.map $ var "toPair") (Sorting.topologicalSortComponents @@ Lists.map (var "depsOf") (var "bindings"))++topologicalSortBindings :: TBinding ([Binding] -> Either [[Name]] [Name])+topologicalSortBindings = define "topologicalSortBindings" $+ doc "Topological sort of elements based on their dependencies" $+ "els" ~>+ "adjlist" <~ ("e" ~> pair+ (Core.bindingName $ var "e")+ (Sets.toList $ termDependencyNames @@ false @@ true @@ true @@ (Core.bindingTerm $ var "e"))) $+ Sorting.topologicalSort @@ Lists.map (var "adjlist") (var "els")++typeDependencyNames :: TBinding (Bool -> Type -> S.Set Name)+typeDependencyNames = define "typeDependencyNames" $+ "withSchema" ~> "typ" ~> Logic.ifElse (var "withSchema")+ (Sets.union+ (freeVariablesInType @@ var "typ")+ (typeNamesInType @@ var "typ"))+ (freeVariablesInType @@ var "typ")++typeNamesInType :: TBinding (Type -> S.Set Name)+typeNamesInType = define "typeNamesInType" $+ "typ0" ~>+ "addNames" <~ ("names" ~> "typ" ~> cases _Type (var "typ")+ (Just $ var "names") [+ _Type_record>>: "rowType" ~>+ "tname" <~ Core.rowTypeTypeName (var "rowType") $+ Sets.insert (var "tname") (var "names"),+ _Type_union>>: "rowType" ~>+ "tname" <~ Core.rowTypeTypeName (var "rowType") $+ Sets.insert (var "tname") (var "names"),+ _Type_wrap>>: "wrappedType" ~>+ "tname" <~ Core.wrappedTypeTypeName (var "wrappedType") $+ Sets.insert (var "tname") (var "names")]) $+ foldOverType @@ Coders.traversalOrderPre @@ var "addNames" @@ Sets.empty @@ var "typ0"++unshadowVariables :: TBinding (Term -> Term)+unshadowVariables = define "unshadowVariables" $+ doc ("Rename all shadowed variables (both lambda parameters and let-bound variables"+ <> " that shadow lambda parameters) in a term.") $+ "term0" ~>+ -- Find a fresh name not in the key set of the map, trying base2, base3, etc.+ "freshName" <~ ("base" ~> "i" ~> "m" ~>+ "candidate" <~ Core.name (Strings.cat2 (Core.unName $ var "base") (Literals.showInt32 $ var "i")) $+ Logic.ifElse (Maps.member (var "candidate") (var "m"))+ (var "freshName" @@ var "base" @@ Math.add (var "i") (int32 1) @@ var "m")+ (var "candidate")) $+ "f" <~ ("recurse" ~> "m" ~> "term" ~>+ cases _Term (var "term") (Just $ var "recurse" @@ var "m" @@ var "term") [+ _Term_function>>: "fn" ~> cases _Function (var "fn")+ (Just $ var "recurse" @@ var "m" @@ var "term") [+ _Function_lambda>>: "l" ~>+ "v" <~ Core.lambdaParameter (var "l") $+ "domain" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ Logic.ifElse (Maps.member (var "v") (var "m"))+ -- Shadowed: find a fresh name, add v -> fresh to map, recurse into body+ ("v2" <~ var "freshName" @@ var "v" @@ int32 2 @@ var "m" $+ "m2" <~ Maps.insert (var "v") (var "v2") (Maps.insert (var "v2") (var "v2") (var "m")) $+ Core.termFunction $ Core.functionLambda $ Core.lambda (var "v2") (var "domain")+ (var "f" @@ var "recurse" @@ var "m2" @@ var "body"))+ -- First occurrence: register v -> v (identity), recurse into body+ (Core.termFunction $ Core.functionLambda $ Core.lambda (var "v") (var "domain")+ (var "f" @@ var "recurse" @@ Maps.insert (var "v") (var "v") (var "m") @@ var "body"))],+ _Term_let>>: "lt" ~>+ -- Register all let-bound names as in-scope (identity mapping) so inner lambdas know about them+ "m2" <~ Lists.foldl ("acc" ~> "b" ~>+ "bname" <~ Core.bindingName (var "b") $+ Logic.ifElse (Maps.member (var "bname") (var "acc"))+ (var "acc")+ (Maps.insert (var "bname") (var "bname") (var "acc")))+ (var "m") (Core.letBindings $ var "lt") $+ var "recurse" @@ var "m2" @@ var "term",+ _Term_variable>>: "v" ~> Core.termVariable $ optCases (Maps.lookup (var "v") (var "m"))+ (var "v")+ ("renamed" ~> var "renamed")]) $+ rewriteTermWithContext @@ var "f" @@ Maps.empty @@ var "term0"
src/main/haskell/Hydra/Sources/Kernel/Terms/Schemas.hs view
@@ -1,502 +1,918 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Schemas where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Constants as Constants-import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore-import qualified Hydra.Sources.Kernel.Terms.Encode.Core as EncodeCore-import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical-import qualified Hydra.Sources.Kernel.Terms.Monads as Monads-import qualified Hydra.Sources.Kernel.Terms.Names as Names-import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting-import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting-import qualified Hydra.Sources.Kernel.Terms.Variants as Variants---module_ :: Module-module_ = Module (Namespace "hydra.schemas") elements- [DecodeCore.module_, EncodeCore.module_, Names.module_, Rewriting.module_,- ShowCore.module_, Sorting.module_, Variants.module_]- kernelTypesModules $- Just ("Various functions for dereferencing and decoding schema types.")- where- elements = [- el definitionDependencyNamespacesDef,- el dependencyNamespacesDef,- el dereferenceTypeDef,- el elementAsTypedTermDef,- el elementsWithDependenciesDef,- el extendTypeContextForLambdaDef,- el extendTypeContextForLetDef,- el extendTypeContextForTypeLambdaDef,- el fieldMapDef,- el fieldTypeMapDef,- el findFieldTypeDef,- el fieldTypesDef,- el fTypeToTypeSchemeDef,- el fullyStripTypeDef,- el graphAsTermDef,- el graphAsTypesDef,- el isEnumRowTypeDef,- el isEnumTypeDef,- el isSerializableDef,- el moduleDependencyNamespacesDef,- el namespacesForDefinitionsDef,- el requireRecordTypeDef,- el requireRowTypeDef,- el requireTypeDef,- el requireUnionTypeDef,- el resolveTypeDef,- el schemaGraphToTypingEnvironmentDef,- el termAsGraphDef,- el topologicalSortTypeDefinitionsDef,- el typeDependenciesDef,- el typeSchemeToFTypeDef,- el typesToElementsDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--definitionDependencyNamespacesDef :: TBinding ([Definition] -> S.Set Namespace)-definitionDependencyNamespacesDef = define "definitionDependencyNamespaces" $- doc "Get dependency namespaces from definitions" $- lambdas ["defs"] $ lets [- "defNames">: lambda "def" $- match _Definition Nothing [- _Definition_type>>: lambda "typeDef" $- ref Rewriting.typeDependencyNamesDef @@ true @@ Module.typeDefinitionType (var "typeDef"),- _Definition_term>>: lambda "termDef" $- ref Rewriting.termDependencyNamesDef @@ true @@ true @@ true @@ Module.termDefinitionTerm (var "termDef")]- @@ var "def",- "allNames">: Sets.unions $ Lists.map (var "defNames") (var "defs")]- $ Sets.fromList $ Optionals.cat $ Lists.map (ref Names.namespaceOfDef) (Sets.toList $ var "allNames")--dependencyNamespacesDef :: TBinding (Bool -> Bool -> Bool -> Bool -> [Binding] -> Flow Graph (S.Set Namespace))-dependencyNamespacesDef = define "dependencyNamespaces" $- doc "Find dependency namespaces in all of a set of terms" $- lambdas ["binds", "withPrims", "withNoms", "withSchema", "els"] $ lets [- "depNames">: lambda "el" $ lets [- "term">: Core.bindingTerm $ var "el",- "dataNames">: ref Rewriting.termDependencyNamesDef @@ var "binds" @@ var "withPrims" @@ var "withNoms" @@ var "term",- "schemaNames">: Logic.ifElse (var "withSchema")- (Optionals.maybe Sets.empty- (lambda "ts" $ ref Rewriting.typeDependencyNamesDef @@ true @@ Core.typeSchemeType (var "ts"))- (Core.bindingType $ var "el"))- Sets.empty]- $ Logic.ifElse (ref EncodeCore.isEncodedTypeDef @@ (ref Rewriting.deannotateTermDef @@ var "term"))- (Flows.bind (ref DecodeCore.typeDef @@ var "term") $- lambda "typ" $ Flows.pure $ Sets.unions $ list [- var "dataNames", var "schemaNames",- ref Rewriting.typeDependencyNamesDef @@ true @@ var "typ"])- (Flows.pure $ Sets.unions $ list [var "dataNames", var "schemaNames"])]- $ Flows.bind (Flows.mapList (var "depNames") (var "els")) $- lambda "namesList" $ Flows.pure $ Sets.fromList $ Optionals.cat $ Lists.map (ref Names.namespaceOfDef) $- Sets.toList $ Sets.delete (ref Constants.placeholderNameDef) $ Sets.unions $ var "namesList"--dereferenceTypeDef :: TBinding (Name -> Flow Graph (Maybe Type))-dereferenceTypeDef = define "dereferenceType" $- doc "Dereference a type name to get the actual type" $- "name" ~>- "mel" <<~ ref Lexical.dereferenceElementDef @@ var "name" $- optCases (var "mel")- (Flows.pure nothing)- ("el" ~> Flows.map (unaryFunction just) $ ref DecodeCore.typeDef @@ Core.bindingTerm (var "el"))--elementAsTypedTermDef :: TBinding (Binding -> Flow Graph TypedTerm)-elementAsTypedTermDef = define "elementAsTypedTerm" $- doc "Convert an element to a typed term" $- lambda "el" $- Optionals.maybe (Flows.fail $ string "missing element type")- (lambda "ts" $ Flows.pure $ Core.typedTerm (Core.bindingTerm $ var "el") (Core.typeSchemeType $ var "ts"))- (Core.bindingType $ var "el")--elementsWithDependenciesDef :: TBinding ([Binding] -> Flow Graph [Binding])-elementsWithDependenciesDef = define "elementsWithDependencies" $- doc "Get elements with their dependencies" $- lambda "original" $ lets [- "depNames">: lambda "el" $ Sets.toList $ ref Rewriting.termDependencyNamesDef @@ true @@ false @@ false @@ (Core.bindingTerm $ var "el"),- "allDepNames">: Lists.nub $ Lists.concat2- (Lists.map (unaryFunction Core.bindingName) (var "original"))- (Lists.concat $ Lists.map (var "depNames") (var "original"))]- $ Flows.mapList (ref Lexical.requireElementDef) (var "allDepNames")--extendTypeContextForLambdaDef :: TBinding (TypeContext -> Lambda -> TypeContext)-extendTypeContextForLambdaDef = define "extendTypeContextForLambda" $- doc "Extend a type context by descending into a System F lambda body" $- "tcontext" ~> "lam" ~>- "var" <~ Core.lambdaParameter (var "lam") $- "dom" <~ Optionals.fromJust (Core.lambdaDomain (var "lam")) $- Typing.typeContextWithTypes- (var "tcontext")- (Maps.insert (var "var") (var "dom") (Typing.typeContextTypes (var "tcontext")))--extendTypeContextForLetDef :: TBinding (TypeContext -> Let -> TypeContext)-extendTypeContextForLetDef = define "extendTypeContextForLet" $- doc "Extend a type context by descending into a let body" $- "tcontext" ~> "letrec" ~>- "bindings" <~ Core.letBindings (var "letrec") $- Typing.typeContextWithTypes- (var "tcontext")- (Maps.union- (Typing.typeContextTypes (var "tcontext"))- (Maps.fromList $ Lists.map- ("b" ~> pair- (Core.bindingName $ var "b")- (ref typeSchemeToFTypeDef @@ (Optionals.fromJust $ Core.bindingType $ var "b")))- (var "bindings")))--extendTypeContextForTypeLambdaDef :: TBinding (TypeContext -> TypeLambda -> TypeContext)-extendTypeContextForTypeLambdaDef = define "extendTypeContextForTypeLambda" $- doc "Extend a type context by descending into a System F type lambda body" $- "tcontext" ~> "tlam" ~>- "name" <~ Core.typeLambdaParameter (var "tlam") $- Typing.typeContextWithVariables- (var "tcontext")- (Sets.insert (var "name") (Typing.typeContextVariables (var "tcontext")))--fieldMapDef :: TBinding ([Field] -> M.Map Name Term)-fieldMapDef = define "fieldMap" $- "toPair" <~ ("f" ~> pair (Core.fieldName $ var "f") (Core.fieldTerm $ var "f")) $- "fields" ~> Maps.fromList $ Lists.map (var "toPair") (var "fields")--fieldTypeMapDef :: TBinding ([FieldType] -> M.Map Name Type)-fieldTypeMapDef = define "fieldTypeMap" $- "toPair" <~ ("f" ~> pair (Core.fieldTypeName $ var "f") (Core.fieldTypeType $ var "f")) $- "fields" ~> Maps.fromList $ Lists.map (var "toPair") (var "fields")--fieldTypesDef :: TBinding (Type -> Flow Graph (M.Map Name Type))-fieldTypesDef = define "fieldTypes" $- doc "Get field types from a record or union type" $- lambda "t" $ lets [- "toMap">: lambda "fields" $ Maps.fromList $ Lists.map- (lambda "ft" $ pair (Core.fieldTypeName $ var "ft") (Core.fieldTypeType $ var "ft"))- (var "fields")]- $ match _Type (Just $ ref Monads.unexpectedDef @@ string "record or union type" @@ (ref ShowCore.typeDef @@ var "t")) [- _Type_forall>>: lambda "ft" $ ref fieldTypesDef @@ Core.forallTypeBody (var "ft"),- _Type_record>>: lambda "rt" $ Flows.pure $ var "toMap" @@ Core.rowTypeFields (var "rt"),- _Type_union>>: lambda "rt" $ Flows.pure $ var "toMap" @@ Core.rowTypeFields (var "rt"),- _Type_variable>>: lambda "name" $- trace (Strings.cat2 (string "field types of ") (Core.unName $ var "name")) $- Flows.bind (ref Lexical.requireElementDef @@ var "name") $- lambda "el" $- Flows.bind (ref DecodeCore.typeDef @@ Core.bindingTerm (var "el")) $- ref fieldTypesDef]- @@ (ref Rewriting.deannotateTypeDef @@ var "t")--findFieldTypeDef :: TBinding (Name -> [FieldType] -> Flow s Type)-findFieldTypeDef = define "findFieldType" $- doc "Find a field type by name in a list of field types" $- lambda "fname" $ lambda "fields" $ lets [- "matchingFields">: Lists.filter- (lambda "ft" $ Equality.equal (Core.unName $ Core.fieldTypeName $ var "ft") (Core.unName $ var "fname"))- (var "fields")]- $ Logic.ifElse (Lists.null $ var "matchingFields")- (Flows.fail $ Strings.cat2 (string "No such field: ") (Core.unName $ var "fname"))- (Logic.ifElse (Equality.equal (Lists.length $ var "matchingFields") (int32 1))- (Flows.pure $ Core.fieldTypeType $ Lists.head $ var "matchingFields")- (Flows.fail $ Strings.cat2 (string "Multiple fields named ") (Core.unName $ var "fname")))--fTypeToTypeSchemeDef :: TBinding (Type -> TypeScheme)-fTypeToTypeSchemeDef = define "fTypeToTypeScheme" $- doc "Convert a forall type to a type scheme" $- "gatherForall" <~ ("vars" ~> "typ" ~> cases _Type (ref Rewriting.deannotateTypeDef @@ var "typ")- (Just $ Core.typeScheme (Lists.reverse $ var "vars") (var "typ")) [- _Type_forall>>: "ft" ~> var "gatherForall" @@- (Lists.cons (Core.forallTypeParameter $ var "ft") (var "vars")) @@- (Core.forallTypeBody $ var "ft")]) $- "typ" ~> var "gatherForall" @@ list [] @@ var "typ"--fullyStripTypeDef :: TBinding (Type -> Type)-fullyStripTypeDef = define "fullyStripType" $- doc "Fully strip a type of forall quantifiers" $- lambda "typ" $- match _Type (Just $ var "typ") [- _Type_forall>>: lambda "ft" $ ref fullyStripTypeDef @@ Core.forallTypeBody (var "ft")]- @@ (ref Rewriting.deannotateTypeDef @@ var "typ")--graphAsTermDef :: TBinding (Graph -> Term)-graphAsTermDef = define "graphAsTerm" $- doc "Convert a graph to a term, taking advantage of the built-in duality between graphs and terms" $- "g" ~>- "toBinding" <~ ("el" ~>- "name" <~ Core.bindingName (var "el") $- "term" <~ Core.bindingTerm (var "el") $- "mts" <~ Core.bindingType (var "el") $- Core.binding (var "name") (var "term") (var "mts")) $- Core.termLet $ Core.let_- (Lists.map (var "toBinding") (Maps.elems $ Graph.graphElements (var "g")))- (Graph.graphBody (var "g"))--graphAsTypesDef :: TBinding (Graph -> Flow s (M.Map Name Type))-graphAsTypesDef = define "graphAsTypes" $- doc "Decode a schema graph which encodes a set of named types" $- "sg" ~>- "els" <~ Maps.elems (Graph.graphElements (var "sg")) $- "toPair" <~ ("el" ~>- "typ" <<~ ref DecodeCore.typeDef @@ (Core.bindingTerm $ var "el") $- produce $ pair (Core.bindingName $ var "el") (var "typ")) $- "pairs" <<~ Flows.mapList (var "toPair") (var "els") $- produce $ Maps.fromList $ var "pairs"--isEnumRowTypeDef :: TBinding (RowType -> Bool)-isEnumRowTypeDef = define "isEnumRowType" $- doc "Check if a row type represents an enum (all fields are unit-typed)" $- lambda "rt" $ Lists.foldl (binaryFunction Logic.and) true $- Lists.map (lambda "f" $ ref EncodeCore.isUnitTypeDef @@ (Core.fieldTypeType $ var "f")) $- Core.rowTypeFields $ var "rt"--isEnumTypeDef :: TBinding (Type -> Bool)-isEnumTypeDef = define "isEnumType" $- doc "Check if a type is an enum type" $- lambda "typ" $- match _Type (Just false) [- _Type_union>>: lambda "rt" $ ref isEnumRowTypeDef @@ var "rt"]- @@ (ref Rewriting.deannotateTypeDef @@ var "typ")--isSerializableDef :: TBinding (Binding -> Flow Graph Bool)-isSerializableDef = define "isSerializable" $- doc "Check if an element is serializable (no function types in dependencies)" $- lambda "el" $ lets [- "variants">: lambda "typ" $- Lists.map (ref Variants.typeVariantDef) $ ref Rewriting.foldOverTypeDef @@ Coders.traversalOrderPre @@- (lambda "m" $ lambda "t" $ Lists.cons (var "t") (var "m")) @@ list [] @@ var "typ"]- $ Flows.map- (lambda "deps" $ lets [- "allVariants">: Sets.fromList $ Lists.concat $ Lists.map (var "variants") $ Maps.elems $ var "deps"]- $ Logic.not $ Sets.member Mantle.typeVariantFunction $ var "allVariants")- (ref typeDependenciesDef @@ false @@ (unaryFunction Equality.identity) @@ Core.bindingName (var "el"))--moduleDependencyNamespacesDef :: TBinding (Bool -> Bool -> Bool -> Bool -> Module -> Flow Graph (S.Set Namespace))-moduleDependencyNamespacesDef = define "moduleDependencyNamespaces" $- doc "Find dependency namespaces in all elements of a module, excluding the module's own namespace" $- lambdas ["binds", "withPrims", "withNoms", "withSchema", "mod"] $- Flows.bind (ref dependencyNamespacesDef @@ var "binds" @@ var "withPrims" @@ var "withNoms" @@ var "withSchema" @@- Module.moduleElements (var "mod")) $- lambda "deps" $ Flows.pure $ Sets.delete (Module.moduleNamespace $ var "mod") (var "deps")--namespacesForDefinitionsDef :: TBinding ((Namespace -> a) -> Namespace -> [Definition] -> Namespaces a)-namespacesForDefinitionsDef = define "namespacesForDefinitions" $- doc "Create namespaces mapping for definitions" $- lambdas ["encodeNamespace", "focusNs", "defs"] $ lets [- "nss">: Sets.delete (var "focusNs") $ ref definitionDependencyNamespacesDef @@ var "defs",- "toPair">: lambda "ns" $ pair (var "ns") (var "encodeNamespace" @@ var "ns")]- $ Module.namespaces (var "toPair" @@ var "focusNs") $ Maps.fromList $ Lists.map (var "toPair") $ Sets.toList $ var "nss"--requireRecordTypeDef :: TBinding (Name -> Flow Graph RowType)-requireRecordTypeDef = define "requireRecordType" $- doc "Require a name to resolve to a record type" $- ref requireRowTypeDef @@ string "record type" @@- (lambda "t" $- cases _Type (var "t") (Just nothing) [- _Type_record>>: lambda "rt" $ just $ var "rt"])--requireRowTypeDef :: TBinding (String -> (Type -> Maybe RowType) -> Name -> Flow Graph RowType)-requireRowTypeDef = define "requireRowType" $- doc "Require a name to resolve to a row type" $- lambdas ["label", "getter", "name"] $ lets [- "rawType">: lambda "t" $ cases _Type (var "t") (Just $ var "t") [- _Type_annotated>>: lambda "at" $ var "rawType" @@ Core.annotatedTypeSubject (var "at"),- _Type_forall>>: lambda "ft" $ var "rawType" @@ Core.forallTypeBody (var "ft")]]- $ Flows.bind (ref requireTypeDef @@ var "name") $- lambda "t" $- Optionals.maybe- (Flows.fail $ Strings.cat $ list [- Core.unName $ var "name",- string " does not resolve to a ",- var "label",- string " type: ",- ref ShowCore.typeDef @@ var "t"])- (unaryFunction Flows.pure)- (var "getter" @@ (var "rawType" @@ var "t"))--requireTypeDef :: TBinding (Name -> Flow Graph Type)-requireTypeDef = define "requireType" $- doc "Require a type by name" $- lambda "name" $- trace (Strings.cat2 (string "require type ") (Core.unName $ var "name")) $- Flows.bind (ref Lexical.withSchemaContextDef @@ (ref Lexical.requireElementDef @@ var "name")) $- lambda "el" $ ref DecodeCore.typeDef @@ Core.bindingTerm (var "el")--requireUnionTypeDef :: TBinding (Name -> Flow Graph RowType)-requireUnionTypeDef = define "requireUnionType" $- doc "Require a name to resolve to a union type" $- ref requireRowTypeDef @@ string "union" @@- (lambda "t" $- match _Type (Just nothing) [- _Type_union>>: lambda "rt" $ just $ var "rt"]- @@ var "t")--resolveTypeDef :: TBinding (Type -> Flow Graph (Maybe Type))-resolveTypeDef = define "resolveType" $- doc "Resolve a type, dereferencing type variables" $- lambda "typ" $- match _Type (Just $ Flows.pure $ just $ var "typ") [- _Type_variable>>: lambda "name" $- ref Lexical.withSchemaContextDef @@- (Flows.bind (ref Lexical.resolveTermDef @@ var "name") $- lambda "mterm" $- Optionals.maybe (Flows.pure nothing)- (lambda "t" $ Flows.map (unaryFunction just) $ ref DecodeCore.typeDef @@ var "t")- (var "mterm"))]- @@ (ref Rewriting.deannotateTypeDef @@ var "typ")--schemaGraphToTypingEnvironmentDef :: TBinding (Graph -> Flow s (M.Map Name TypeScheme))-schemaGraphToTypingEnvironmentDef = define "schemaGraphToTypingEnvironment" $- doc "Convert a schema graph to a typing environment" $- "g" ~>- "toTypeScheme" <~ ("vars" ~> "typ" ~> cases _Type (ref Rewriting.deannotateTypeDef @@ var "typ")- (Just $ Core.typeScheme (Lists.reverse $ var "vars") (var "typ")) [- _Type_forall>>: "ft" ~> var "toTypeScheme"- @@ Lists.cons (Core.forallTypeParameter $ var "ft") (var "vars")- @@ Core.forallTypeBody (var "ft")]) $- "toPair" <~ ("el" ~> Flows.map- ("mts" ~> Optionals.map ("ts" ~> pair (Core.bindingName $ var "el") (var "ts")) (var "mts"))- (optCases (Core.bindingType $ var "el")--- (Flows.pure nothing)- ( "typ" <<~ ref DecodeCore.typeDef @@ (Core.bindingTerm $ var "el") $- "ts" <~ ref fTypeToTypeSchemeDef @@ var "typ" $- produce $ just $ var "ts")- -- TODO: the following is a legacy solution; type schemes are encoded as types now, and do not need System F annotations- ("ts" ~> Logic.ifElse- (Equality.equal (var "ts") (Core.typeScheme (list []) (Core.typeVariable $ Core.nameLift _TypeScheme)))- (Flows.map (unaryFunction just) $ ref DecodeCore.typeSchemeDef @@ Core.bindingTerm (var "el"))- (Logic.ifElse- (Equality.equal (var "ts") (Core.typeScheme (list []) (Core.typeVariable $ Core.nameLift _Type)))- (Flows.map (lambda "decoded" $ just $ var "toTypeScheme" @@ list [] @@ var "decoded") $ ref DecodeCore.typeDef @@ Core.bindingTerm (var "el"))- (cases _Term (ref Rewriting.deannotateTermDef @@ (Core.bindingTerm $ var "el")) (Just $ Flows.pure nothing) [- _Term_record>>: lambda "r" $- Logic.ifElse- (Equality.equal (Core.recordTypeName $ var "r") (Core.nameLift _TypeScheme))- (Flows.map- (unaryFunction just)- (ref DecodeCore.typeSchemeDef @@ Core.bindingTerm (var "el")))- (Flows.pure nothing),- _Term_union>>: lambda "i" $- Logic.ifElse (Equality.equal (Core.injectionTypeName $ var "i") (Core.nameLift _Type))- (Flows.map- (lambda "decoded" $ just $ var "toTypeScheme" @@ list [] @@ var "decoded")- (ref DecodeCore.typeDef @@ Core.bindingTerm (var "el")))- (Flows.pure nothing)]))))) $- ref Monads.withStateDef @@ var "g" @@- (Flows.bind (Flows.mapList (var "toPair") $ Maps.elems $ Graph.graphElements $ var "g") $- lambda "mpairs" $ Flows.pure $ Maps.fromList $ Optionals.cat $ var "mpairs")---- Note: this is lossy, as it throws away the term body-termAsGraphDef :: TBinding (Term -> (M.Map Name Term, Term))-termAsGraphDef = define "termAsGraph" $- doc "Find the equivalent graph representation of a term" $- "term" ~> cases _Term (ref Rewriting.deannotateTermDef @@ var "term")- (Just Maps.empty) [- _Term_let>>: "lt" ~>- "bindings" <~ Core.letBindings (var "lt") $- "fromBinding" <~ ("b" ~>- "name" <~ Core.bindingName (var "b") $- "term" <~ Core.bindingTerm (var "b") $- "ts" <~ Core.bindingType (var "b") $- pair (var "name") (Core.binding (var "name") (var "term") (var "ts"))) $- Maps.fromList $ Lists.map (var "fromBinding") (var "bindings")]--topologicalSortTypeDefinitionsDef :: TBinding ([TypeDefinition] -> [[TypeDefinition]])-topologicalSortTypeDefinitionsDef = define "topologicalSortTypeDefinitions" $- doc "Topologically sort type definitions by dependencies" $- lambda "defs" $ lets [- "toPair">: lambda "def" $ pair- (Module.typeDefinitionName $ var "def")- (Sets.toList $ ref Rewriting.typeDependencyNamesDef @@ false @@ Module.typeDefinitionType (var "def")),- "nameToDef">: Maps.fromList $ Lists.map- (lambda "d" $ pair (Module.typeDefinitionName $ var "d") (var "d"))- (var "defs"),- "sorted">: ref Sorting.topologicalSortComponentsDef @@ Lists.map (var "toPair") (var "defs")]- $ Lists.map (lambda "names" $ Optionals.cat $ Lists.map (lambda "n" $ Maps.lookup (var "n") (var "nameToDef")) (var "names")) $- var "sorted"--typeDependenciesDef :: TBinding (Bool -> (Type -> Type) -> Name -> Flow Graph (M.Map Name Type))-typeDependenciesDef = define "typeDependencies" $- doc "Get all type dependencies for a given type name" $- lambdas ["withSchema", "transform", "name"] $ lets [- "requireType">: lambda "name" $- trace (Strings.cat2 (string "type dependencies of ") (Core.unName $ var "name")) $- Flows.bind (ref Lexical.requireElementDef @@ var "name") $- lambda "el" $ ref DecodeCore.typeDef @@ Core.bindingTerm (var "el"),- "toPair">: lambda "name" $- Flows.bind (var "requireType" @@ var "name") $- lambda "typ" $ Flows.pure $ pair (var "name") (var "transform" @@ var "typ"),- "deps">: lambda "seeds" $ lambda "names" $- Logic.ifElse (Sets.null $ var "seeds")- (Flows.pure $ var "names")- (Flows.bind (Flows.mapList (var "toPair") $ Sets.toList $ var "seeds") $- lambda "pairs" $ lets [- "newNames">: Maps.union (var "names") $ Maps.fromList $ var "pairs",- "refs">: Lists.foldl (binaryFunction Sets.union) Sets.empty $ Lists.map- (lambda "pair" $ ref Rewriting.typeDependencyNamesDef @@ var "withSchema" @@ second (var "pair"))- (var "pairs"),- "visited">: Sets.fromList $ Maps.keys $ var "names",- "newSeeds">: Sets.difference (var "refs") (var "visited")]- $ var "deps" @@ var "newSeeds" @@ var "newNames")] $- var "deps" @@ Sets.singleton (var "name") @@ Maps.empty--typeSchemeToFTypeDef :: TBinding (TypeScheme -> Type)-typeSchemeToFTypeDef = define "typeSchemeToFType" $- doc "Convert a type scheme to a forall type" $- "ts" ~>- "vars" <~ Core.typeSchemeVariables (var "ts") $- "body" <~ Core.typeSchemeType (var "ts") $- Lists.foldl- ("t" ~> "v" ~> Core.typeForall $ Core.forallType (var "v") (var "t"))- (var "body")- -- Put the variables in the same order in which they are introduced by the type scheme.- (Lists.reverse $ var "vars")--typesToElementsDef :: TBinding (M.Map Name Type -> M.Map Name Binding)-typesToElementsDef = define "typesToElements" $- doc "Encode a map of named types to a map of elements" $- "typeMap" ~>- "toElement" <~ ("pair" ~>- "name" <~ first (var "pair") $- pair- (var "name")- (Core.binding- (var "name")- (ref EncodeCore.typeDef @@ (second $ var "pair"))- nothing)) $- Maps.fromList $ Lists.map (var "toElement") $ Maps.toList $ var "typeMap"++module Hydra.Sources.Kernel.Terms.Schemas where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ addNamesToNamespaces,+ definitionDependencyNamespaces,+ dependencyNamespaces,+ dereferenceType,+ elementAsTypeApplicationTerm,+ elementsWithDependencies,+ extendTypeContextForLambda,+ extendTypeContextForLet,+ extendTypeContextForTypeLambda,+ fTypeIsPolymorphic,+ fTypeToTypeScheme,+ fieldMap,+ fieldTypeMap,+ fieldTypes,+ findFieldType,+ freshName,+ freshNames,+ fullyStripAndNormalizeType,+ fullyStripType,+ graphAsLet,+ graphAsTerm,+ graphAsTypes,+ graphToInferenceContext,+ graphToTypeContext,+ instantiateType,+ instantiateTypeScheme,+ isEncodedTerm,+ isEncodedType,+ isEnumRowType,+ isEnumType,+ isSerializable,+ isSerializableByName,+ isSerializableType,+ isUnitTerm,+ isUnitType,+ isType,+ moduleContainsBinaryLiterals,+ moduleDependencyNamespaces,+ namespacesForDefinitions,+ nominalApplication,+ normalTypeVariable,+ partitionDefinitions,+ requireRecordType,+ requireRowType,+ requireSchemaType,+ requireType,+ requireUnionType,+ resolveType,+ schemaGraphToTypingEnvironment,+ termAsGraph,+ topologicalSortTypeDefinitions,+ typeDependencies,+ typeSchemeToFType,+ typeToTypeScheme,+ typesToElements,+ withLambdaContext,+ withLetContext,+ withTypeLambdaContext)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y++import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Names as Names+import qualified Hydra.Sources.Kernel.Terms.Reflect as Reflect+import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting+import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore+import qualified Hydra.Sources.Kernel.Terms.Sorting as Sorting+import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution++import qualified Hydra.Sources.Encode.Core as EncodeCore+++ns :: Namespace+ns = Namespace "hydra.schemas"++define :: String -> TTerm a -> TBinding a+define = definitionInNamespace ns++module_ :: Module+module_ = Module ns elements+ [Annotations.ns, Constants.ns, moduleNamespace DecodeCore.module_, moduleNamespace EncodeCore.module_, Lexical.ns, Monads.ns,+ Names.ns, Reflect.ns, Rewriting.ns, ShowCore.ns, Sorting.ns, Substitution.ns]+ kernelTypesNamespaces $+ Just ("Various functions for dereferencing and decoding schema types.")+ where+ elements = [+ toBinding addNamesToNamespaces,+ toBinding definitionDependencyNamespaces,+ toBinding dependencyNamespaces,+ toBinding dereferenceType,+ toBinding elementAsTypeApplicationTerm,+ toBinding elementsWithDependencies,+ toBinding extendTypeContextForLambda,+ toBinding extendTypeContextForLet,+ toBinding extendTypeContextForTypeLambda,+ toBinding fieldMap,+ toBinding fieldTypeMap,+ toBinding fieldTypes,+ toBinding findFieldType,+ toBinding freshName,+ toBinding freshNames,+ toBinding fTypeIsPolymorphic,+ toBinding fTypeToTypeScheme,+ toBinding fullyStripAndNormalizeType,+ toBinding fullyStripType,+ toBinding graphAsLet,+ toBinding graphAsTerm,+ toBinding graphAsTypes,+ toBinding graphToInferenceContext,+ toBinding graphToTypeContext,+ toBinding instantiateType,+ toBinding instantiateTypeScheme,+ toBinding isEncodedTerm,+ toBinding isEncodedType,+ toBinding isEnumRowType,+ toBinding isEnumType,+ toBinding isSerializable,+ toBinding isSerializableType,+ toBinding isSerializableByName,+ toBinding isType,+ toBinding isUnitTerm,+ toBinding isUnitType,+ toBinding moduleContainsBinaryLiterals,+ toBinding moduleDependencyNamespaces,+ toBinding namespacesForDefinitions,+ toBinding nominalApplication,+ toBinding normalTypeVariable,+ toBinding partitionDefinitions,+ toBinding requireRecordType,+ toBinding requireRowType,+ toBinding requireSchemaType,+ toBinding requireType,+ toBinding requireUnionField_,+ toBinding requireUnionType,+ toBinding resolveType,+ toBinding schemaGraphToTypingEnvironment,+ toBinding termAsGraph,+ toBinding topologicalSortTypeDefinitions,+ toBinding typeDependencies,+ toBinding typeSchemeToFType,+ toBinding typeToTypeScheme,+ toBinding typesToElements,+ toBinding withLambdaContext,+ toBinding withLetContext,+ toBinding withTypeLambdaContext]++addNamesToNamespaces :: TBinding ((Namespace -> a) -> S.Set Name -> Namespaces a -> Namespaces a)+addNamesToNamespaces = define "addNamesToNamespaces" $+ doc "Add names to existing namespaces mapping" $+ "encodeNamespace" ~> "names" ~> "ns0" ~>+-- "nss" <~ Sets.empty $+ "nss" <~ Sets.fromList (Maybes.cat $ Lists.map (Names.namespaceOf) $ Sets.toList $ var "names") $+ "toPair" <~ ("ns" ~> pair (var "ns") (var "encodeNamespace" @@ var "ns")) $+ Module.namespacesWithMapping (var "ns0") $ Maps.union+ (Module.namespacesMapping $ var "ns0")+ (Maps.fromList $ Lists.map (var "toPair") $ Sets.toList $ var "nss")++definitionDependencyNamespaces :: TBinding ([Definition] -> S.Set Namespace)+definitionDependencyNamespaces = define "definitionDependencyNamespaces" $+ doc "Get dependency namespaces from definitions" $+ "defs" ~>+ "defNames" <~ ("def" ~> cases _Definition (var "def")+ Nothing [+ _Definition_type>>: "typeDef" ~>+ Rewriting.typeDependencyNames @@ true @@ Module.typeDefinitionType (var "typeDef"),+ _Definition_term>>: "termDef" ~>+ Rewriting.termDependencyNames @@ true @@ true @@ true @@ Module.termDefinitionTerm (var "termDef")]) $+ "allNames" <~ Sets.unions (Lists.map (var "defNames") (var "defs")) $+ Sets.fromList (Maybes.cat (Lists.map (Names.namespaceOf) (Sets.toList (var "allNames"))))++dependencyNamespaces :: TBinding (Bool -> Bool -> Bool -> Bool -> [Binding] -> Flow Graph (S.Set Namespace))+dependencyNamespaces = define "dependencyNamespaces" $+ doc "Find dependency namespaces in all of a set of terms" $+ "binds" ~> "withPrims" ~> "withNoms" ~> "withSchema" ~> "els" ~>+ "cx" <<~ Monads.getState $+ "depNames" <~ ("el" ~>+ "term" <~ Core.bindingTerm (var "el") $+ "deannotatedTerm" <~ Rewriting.deannotateTerm @@ var "term" $+ "dataNames" <~ Rewriting.termDependencyNames @@ var "binds" @@ var "withPrims" @@ var "withNoms" @@ var "term" $+ "schemaNames" <~ Logic.ifElse (var "withSchema")+ (Maybes.maybe Sets.empty+ ("ts" ~> Rewriting.typeDependencyNames @@ true @@ Core.typeSchemeType (var "ts"))+ (Core.bindingType (var "el")))+ Sets.empty $+ -- Handle encoded types: decode as Type and extract type dependency names+ Logic.ifElse (isEncodedType @@ var "deannotatedTerm")+ (Flows.bind (trace (string "dependency namespace (type)") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ var "term")) (+ "typ" ~> Flows.pure (Sets.unions (list [+ var "dataNames", var "schemaNames",+ Rewriting.typeDependencyNames @@ true @@ var "typ"]))))+ -- Handle encoded terms: decode as Term and extract term dependency names+ (Logic.ifElse (isEncodedTerm @@ var "deannotatedTerm")+ (Flows.bind (trace (string "dependency namespace (term)") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Term @@ var "cx" @@ var "term")) (+ "decodedTerm" ~> Flows.pure (Sets.unions (list [+ var "dataNames", var "schemaNames",+ Rewriting.termDependencyNames @@ var "binds" @@ var "withPrims" @@ var "withNoms" @@ var "decodedTerm"]))))+ (Flows.pure (Sets.unions (list [var "dataNames", var "schemaNames"]))))) $+ Flows.bind (Flows.mapList (var "depNames") (var "els")) (+ "namesList" ~> Flows.pure (Sets.fromList (Maybes.cat (Lists.map (Names.namespaceOf) (+ Sets.toList (Sets.delete (Constants.placeholderName) (Sets.unions (var "namesList"))))))))++dereferenceType :: TBinding (Name -> Flow Graph (Maybe Type))+dereferenceType = define "dereferenceType" $+ doc "Dereference a type name to get the actual type" $+ "name" ~>+ "cx" <<~ Monads.getState $+ "mel" <<~ Lexical.dereferenceElement @@ var "name" $+ optCases (var "mel")+ (Flows.pure nothing)+ ("el" ~> Flows.map (unaryFunction just) $ (trace (string "dereference type") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el"))))++elementAsTypeApplicationTerm :: TBinding (Binding -> Flow Graph TypeApplicationTerm)+elementAsTypeApplicationTerm = define "elementAsTypeApplicationTerm" $+ doc "Convert an element to a typed term" $+ "el" ~>+ Maybes.maybe (Flows.fail (string "missing element type"))+ ("ts" ~> Flows.pure (Core.typeApplicationTerm (Core.bindingTerm (var "el")) (Core.typeSchemeType (var "ts"))))+ (Core.bindingType (var "el"))++elementsWithDependencies :: TBinding ([Binding] -> Flow Graph [Binding])+elementsWithDependencies = define "elementsWithDependencies" $+ doc "Get elements with their dependencies" $+ "original" ~>+ "depNames" <~ ("el" ~> Sets.toList (Rewriting.termDependencyNames @@ true @@ false @@ false @@ (Core.bindingTerm (var "el")))) $+ "allDepNames" <~ Lists.nub (Lists.concat2+ (Lists.map (unaryFunction Core.bindingName) (var "original"))+ (Lists.concat (Lists.map (var "depNames") (var "original")))) $+ Flows.mapList (Lexical.requireElement) (var "allDepNames")++extendTypeContextForLambda :: TBinding (TypeContext -> Lambda -> TypeContext)+extendTypeContextForLambda = define "extendTypeContextForLambda" $+ doc "Extend a type context by descending into a System F lambda body" $+ "tcontext" ~> "lam" ~>+ "var" <~ Core.lambdaParameter (var "lam") $+ Typing.typeContext+ (optCases (Core.lambdaDomain $ var "lam")+ (Typing.typeContextTypes $ var "tcontext")+ -- Note: if the domain is missing, we have nothing to add here+ ("dom" ~> Maps.insert (var "var") (var "dom") $ Typing.typeContextTypes $ var "tcontext"))+ (Maps.delete (var "var") (Typing.typeContextMetadata $ var "tcontext"))+ (Typing.typeContextTypeVariables $ var "tcontext")+ -- Add the variable to lambda variables+ (Sets.insert (var "var") $ Typing.typeContextLambdaVariables $ var "tcontext")+ -- Remove the variable from let variables if it exists there; it is shadowed if so+ (Sets.delete (var "var") $ Typing.typeContextLetVariables $ var "tcontext")+ (Typing.typeContextInferenceContext $ var "tcontext")++extendTypeContextForLet :: TBinding ((TypeContext -> Binding -> Maybe Term) -> TypeContext -> Let -> TypeContext)+extendTypeContextForLet = define "extendTypeContextForLet" $+ doc "Extend a type context by descending into a let body" $+ "forBinding" ~> "tcontext" ~> "letrec" ~>+ "bindings" <~ Core.letBindings (var "letrec") $+ Typing.typeContext+ -- Note: Maps.union prefers the left argument when keys conflict, so we put the new bindings first+ -- to allow inner bindings to shadow outer ones with the same name.+ (Maps.union+ -- Add all bindings to typeContextTypes. Use the type scheme if available, otherwise use a placeholder type.+ -- This ensures that isComplexVariable can distinguish defined local bindings from undefined variables.+ (Maps.fromList $ Maybes.cat $ Lists.map+ ("b" ~>+ (Maybes.map+ ("ts" ~> pair (Core.bindingName $ var "b") (typeSchemeToFType @@ var "ts")))+ (Core.bindingType $ var "b"))+ (var "bindings"))+ (Typing.typeContextTypes (var "tcontext")))+ (Lists.foldl+ ("m" ~> "b" ~> optCases (var "forBinding" @@ var "tcontext" @@ var "b")+ (Maps.delete (Core.bindingName $ var "b") (var "m"))+ ("t" ~> Maps.insert (Core.bindingName $ var "b") (var "t") (var "m")))+ (Typing.typeContextMetadata $ var "tcontext")+ (var "bindings"))+ (Typing.typeContextTypeVariables $ var "tcontext")+ -- Remove all binding names from lambda variables; they are shadowed if so+ (Lists.foldl+ ("s" ~> "b" ~> Sets.delete (Core.bindingName $ var "b") (var "s"))+ (Typing.typeContextLambdaVariables $ var "tcontext")+ (var "bindings"))+ -- Add all binding names to let variables+ (Lists.foldl+ ("s" ~> "b" ~> Sets.insert (Core.bindingName $ var "b") (var "s"))+ (Typing.typeContextLetVariables $ var "tcontext")+ (var "bindings"))+ (Typing.typeContextInferenceContext $ var "tcontext")++extendTypeContextForTypeLambda :: TBinding (TypeContext -> TypeLambda -> TypeContext)+extendTypeContextForTypeLambda = define "extendTypeContextForTypeLambda" $+ doc "Extend a type context by descending into a System F type lambda body" $+ "tcontext" ~> "tlam" ~>+ "name" <~ Core.typeLambdaParameter (var "tlam") $+ Typing.typeContextWithTypeVariables+ (var "tcontext")+ (Sets.insert (var "name") (Typing.typeContextTypeVariables (var "tcontext")))++fieldMap :: TBinding ([Field] -> M.Map Name Term)+fieldMap = define "fieldMap" $+ "fields" ~>+ "toPair" <~ ("f" ~> pair (Core.fieldName $ var "f") (Core.fieldTerm $ var "f")) $+ Maps.fromList $ Lists.map (var "toPair") (var "fields")++fieldTypeMap :: TBinding ([FieldType] -> M.Map Name Type)+fieldTypeMap = define "fieldTypeMap" $+ "fields" ~>+ "toPair" <~ ("f" ~> pair (Core.fieldTypeName $ var "f") (Core.fieldTypeType $ var "f")) $+ Maps.fromList $ Lists.map (var "toPair") (var "fields")++fieldTypes :: TBinding (Type -> Flow Graph (M.Map Name Type))+fieldTypes = define "fieldTypes" $+ doc "Get field types from a record or union type" $+ "t" ~>+ "cx" <<~ Monads.getState $+ "toMap" <~ ("fields" ~> Maps.fromList (Lists.map+ ("ft" ~> pair (Core.fieldTypeName (var "ft")) (Core.fieldTypeType (var "ft")))+ (var "fields"))) $+ match _Type (Just (Monads.unexpected @@ string "record or union type" @@ (ShowCore.type_ @@ var "t"))) [+ _Type_forall>>: "ft" ~> fieldTypes @@ Core.forallTypeBody (var "ft"),+ _Type_record>>: "rt" ~> Flows.pure (var "toMap" @@ Core.rowTypeFields (var "rt")),+ _Type_union>>: "rt" ~> Flows.pure (var "toMap" @@ Core.rowTypeFields (var "rt")),+ _Type_variable>>: "name" ~>+ trace (Strings.cat2 (string "field types of ") (Core.unName (var "name"))) (+ Flows.bind (Lexical.requireElement @@ var "name") (+ "el" ~>+ Flows.bind (trace (string "field types") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el"))) (+ fieldTypes)))]+ @@ (Rewriting.deannotateType @@ var "t")++findFieldType :: TBinding (Name -> [FieldType] -> Flow s Type)+findFieldType = define "findFieldType" $+ doc "Find a field type by name in a list of field types" $+ "fname" ~> "fields" ~>+ "matchingFields" <~ Lists.filter+ ("ft" ~> Equality.equal (Core.unName (Core.fieldTypeName (var "ft"))) (Core.unName (var "fname")))+ (var "fields") $+ Logic.ifElse (Lists.null (var "matchingFields"))+ (Flows.fail (Strings.cat2 (string "No such field: ") (Core.unName (var "fname"))))+ (Logic.ifElse (Equality.equal (Lists.length (var "matchingFields")) (int32 1))+ (Flows.pure (Core.fieldTypeType (Lists.head (var "matchingFields"))))+ (Flows.fail (Strings.cat2 (string "Multiple fields named ") (Core.unName (var "fname")))))++fTypeIsPolymorphic :: TBinding (Type -> Bool)+fTypeIsPolymorphic = define "fTypeIsPolymorphic" $+ doc "Test whether a given System F type is polymorphic (i.e., a forall type)" $+ "typ" ~> cases _Type (var "typ")+ (Just false) [+ _Type_annotated>>: "at" ~> fTypeIsPolymorphic @@ Core.annotatedTypeBody (var "at"),+ _Type_forall>>: "ft" ~> true]++fTypeToTypeScheme :: TBinding (Type -> TypeScheme)+fTypeToTypeScheme = define "fTypeToTypeScheme" $+ doc "Convert a forall type to a type scheme" $+ "typ" ~>+ "gatherForall" <~ ("vars" ~> "typ" ~> cases _Type (Rewriting.deannotateType @@ var "typ")+ (Just $ Core.typeScheme (Lists.reverse $ var "vars") (var "typ") Phantoms.nothing) [+ _Type_forall>>: "ft" ~> var "gatherForall" @@+ (Lists.cons (Core.forallTypeParameter $ var "ft") (var "vars")) @@+ (Core.forallTypeBody $ var "ft")]) $+ var "gatherForall" @@ list ([] :: [TTerm Name]) @@ var "typ"++freshName :: TBinding (Flow s Name)+freshName = define "freshName" $+ doc "Generate a fresh type variable name" $+ Flows.map (normalTypeVariable) (Annotations.nextCount @@ Constants.key_freshTypeVariableCount)++freshNames :: TBinding (Int -> Flow s [Name])+freshNames = define "freshNames" $+ doc "Generate multiple fresh type variable names" $+ "n" ~> Flows.sequence $ Lists.replicate (var "n") (freshName)++fullyStripAndNormalizeType :: TBinding (Type -> Type)+fullyStripAndNormalizeType = define "fullyStripAndNormalizeType" $+ doc "Fully strip a type of forall quantifiers, normalizing bound variable names for alpha-equivalence comparison" $+ "typ" ~>+ -- Collect forall-bound variables and the body in one pass+ "go" <~ ("depth" ~> "subst" ~> "t" ~> cases _Type (Rewriting.deannotateType @@ var "t")+ (Just $ pair (var "subst") (var "t")) [+ _Type_forall>>: "ft" ~>+ "oldVar" <~ Core.forallTypeParameter (var "ft") $+ "newVar" <~ Core.name (Strings.cat2 (string "_") (Literals.showInt32 $ var "depth")) $+ var "go"+ @@ (Math.add (var "depth") (int32 1))+ @@ (Maps.insert (var "oldVar") (var "newVar") (var "subst"))+ @@ (Core.forallTypeBody (var "ft"))]) $+ "result" <~ var "go" @@ int32 0 @@ Maps.empty @@ var "typ" $+ "subst" <~ Pairs.first (var "result") $+ "body" <~ Pairs.second (var "result") $+ -- Apply the renaming substitution+ Rewriting.substituteTypeVariables @@ var "subst" @@ var "body"++fullyStripType :: TBinding (Type -> Type)+fullyStripType = define "fullyStripType" $+ doc "Fully strip a type of forall quantifiers" $+ "typ" ~>+ match _Type (Just (var "typ")) [+ _Type_forall>>: "ft" ~> fullyStripType @@ Core.forallTypeBody (var "ft")]+ @@ (Rewriting.deannotateType @@ var "typ")++graphAsLet :: TBinding (Graph -> Let)+graphAsLet = define "graphAsLet" $+ doc "Convert a graph to a let expression" $+ "g" ~>+ Core.let_+ (Graph.graphElements $ var "g")+ (Graph.graphBody $ var "g")++graphAsTerm :: TBinding (Graph -> Term)+graphAsTerm = define "graphAsTerm" $+ doc "Convert a graph to a term, taking advantage of the built-in duality between graphs and terms" $+ "g" ~> Core.termLet (graphAsLet @@ var "g")++graphAsTypes :: TBinding (Graph -> Flow s (M.Map Name Type))+graphAsTypes = define "graphAsTypes" $+ doc "Decode a schema graph which encodes a set of named types" $+ "sg" ~>+ "cx" <<~ Monads.getState $+ "els" <~ Graph.graphElements (var "sg") $+ "toPair" <~ ("el" ~>+ "typ" <<~ (trace ((string "graph as types: ") ++ Core.unName (Core.bindingName $ var "el")) $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ (Core.bindingTerm $ var "el"))) $+ produce $ pair (Core.bindingName $ var "el") (var "typ")) $+ "pairs" <<~ Flows.mapList (var "toPair") (var "els") $+ produce $ Maps.fromList $ var "pairs"++graphToInferenceContext :: TBinding (Graph -> Flow s InferenceContext)+graphToInferenceContext = define "graphToInferenceContext" $+ doc "Convert a graph to an inference context" $+ "graph" ~>+ "schema" <~ Maybes.fromMaybe (var "graph") (Graph.graphSchema $ var "graph") $+ "primTypes" <~ Maps.fromList (Lists.map+ ("p" ~> pair (Graph.primitiveName $ var "p") (Graph.primitiveType $ var "p"))+ (Maps.elems $ Graph.graphPrimitives $ var "graph")) $+ "varTypes" <~ Maps.fromList (Maybes.cat $ Lists.map+ ("b" ~> Maybes.map ("ts" ~> pair (Core.bindingName $ var "b") (var "ts")) $ Core.bindingType $ var "b")+ (Graph.graphElements $ var "graph")) $+ "schemaTypes" <<~ schemaGraphToTypingEnvironment @@ var "schema" $+ produce $ Typing.inferenceContext (var "schemaTypes") (var "primTypes") (var "varTypes") Maps.empty false++graphToTypeContext :: TBinding (Graph -> Flow s TypeContext)+graphToTypeContext = define "graphToTypeContext" $+ doc "Convert a graph to a type context including the graph's element types" $+ "graph" ~>+ "ix" <<~ graphToInferenceContext @@ var "graph" $+ -- Populate typeContextTypes from graph elements' type schemes (converted to System F types)+ -- This ensures variables are resolvable during eta expansion and other processing+ "elementTypes" <~ Maps.fromList (Maybes.cat $ Lists.map+ ("b" ~> Maybes.map ("ts" ~> pair (Core.bindingName $ var "b") (typeSchemeToFType @@ var "ts")) $ Core.bindingType $ var "b")+ (Graph.graphElements $ var "graph")) $+ produce $ Typing.typeContext (var "elementTypes") Maps.empty Sets.empty Sets.empty Sets.empty (var "ix")++instantiateType :: TBinding (Type -> Flow s Type)+instantiateType = define "instantiateType" $+ doc "Instantiate a type by replacing all forall-bound type variables with fresh variables" $+ "typ" ~>+ "ts" <<~ instantiateTypeScheme @@ (typeToTypeScheme @@ var "typ") $+ produce $ typeSchemeToFType @@ var "ts"++instantiateTypeScheme :: TBinding (TypeScheme -> Flow s TypeScheme)+instantiateTypeScheme = define "instantiateTypeScheme" $+ doc "Instantiate a type scheme with fresh variables" $+ "scheme" ~>+ "oldVars" <~ Core.typeSchemeVariables (var "scheme") $+ "newVars" <<~ freshNames @@ Lists.length (var "oldVars") $+ "subst" <~ Typing.typeSubst (Maps.fromList $ Lists.zip (var "oldVars") (Lists.map (unaryFunction Core.typeVariable) $ var "newVars")) $+ -- Build a name-to-name substitution for renaming constraint keys+ "nameSubst" <~ Maps.fromList (Lists.zip (var "oldVars") (var "newVars")) $+ -- Rename the keys in the constraints map using the name substitution+ "renamedConstraints" <~ Maybes.map+ ("oldConstraints" ~> Maps.fromList (Lists.map+ ("kv" ~> pair+ (Maybes.fromMaybe (Pairs.first $ var "kv") (Maps.lookup (Pairs.first $ var "kv") (var "nameSubst")))+ (Pairs.second $ var "kv"))+ (Maps.toList $ var "oldConstraints")))+ (Core.typeSchemeConstraints (var "scheme")) $+ produce $ Core.typeScheme (var "newVars")+ (Substitution.substInType @@ var "subst" @@ Core.typeSchemeType (var "scheme"))+ (var "renamedConstraints")++isEnumRowType :: TBinding (RowType -> Bool)+isEnumRowType = define "isEnumRowType" $+ doc "Check if a row type represents an enum (all fields are unit-typed)" $+ "rt" ~> Lists.foldl (binaryFunction Logic.and) true $+ Lists.map ("f" ~> isUnitType @@ (Rewriting.deannotateType @@ (Core.fieldTypeType (var "f")))) $+ Core.rowTypeFields $ var "rt"++isEncodedType :: TBinding (Term -> Bool)+isEncodedType = define "isEncodedType" $+ doc "Determines whether a given term is an encoded type" $+ "t" ~> cases _Term (Rewriting.deannotateTerm @@ var "t") (Just false) [+ _Term_application>>: "a" ~>+ isEncodedType @@ (Core.applicationFunction (var "a")),+ _Term_union>>: "i" ~>+ Equality.equal (string (unName _Type)) (Core.unName (Core.injectionTypeName (var "i")))]++isEncodedTerm :: TBinding (Term -> Bool)+isEncodedTerm = define "isEncodedTerm" $+ doc "Determines whether a given term is an encoded term (meta-level term)" $+ "t" ~> cases _Term (Rewriting.deannotateTerm @@ var "t") (Just false) [+ _Term_application>>: "a" ~>+ isEncodedTerm @@ (Core.applicationFunction (var "a")),+ _Term_union>>: "i" ~>+ Equality.equal (string (unName _Term)) (Core.unName (Core.injectionTypeName (var "i")))]++isEnumType :: TBinding (Type -> Bool)+isEnumType = define "isEnumType" $+ doc "Check if a type is an enum type" $+ "typ" ~>+ match _Type (Just false) [+ _Type_union>>: "rt" ~> isEnumRowType @@ var "rt"]+ @@ (Rewriting.deannotateType @@ var "typ")++isSerializable :: TBinding (Binding -> Flow Graph Bool)+isSerializable = define "isSerializable" $+ doc "Check if an element is serializable (no function types in dependencies)" $+ "el" ~>+ "variants" <~ ("typ" ~>+ Lists.map (Reflect.typeVariant) (Rewriting.foldOverType @@ Coders.traversalOrderPre @@+ ("m" ~> "t" ~> Lists.cons (var "t") (var "m")) @@ list ([] :: [TTerm Type]) @@ var "typ")) $+ Flows.map+ ("deps" ~>+ "allVariants" <~ Sets.fromList (Lists.concat (Lists.map (var "variants") (Maps.elems (var "deps")))) $+ Logic.not (Sets.member Variants.typeVariantFunction (var "allVariants")))+ (typeDependencies @@ false @@ (unaryFunction Equality.identity) @@ Core.bindingName (var "el"))++isSerializableType :: TBinding (Type -> Bool)+isSerializableType = define "isSerializableType" $+ doc "Check if a type is serializable (no function types in the type itself)" $+ "typ" ~>+ "allVariants" <~ Sets.fromList (Lists.map (Reflect.typeVariant)+ (Rewriting.foldOverType @@ Coders.traversalOrderPre @@+ ("m" ~> "t" ~> Lists.cons (var "t") (var "m")) @@ list ([] :: [TTerm Type]) @@ var "typ")) $+ Logic.not (Sets.member Variants.typeVariantFunction (var "allVariants"))++isSerializableByName :: TBinding (Name -> Flow Graph Bool)+isSerializableByName = define "isSerializableByName" $+ doc "Check if a type (by name) is serializable, resolving all type dependencies" $+ "name" ~>+ "variants" <~ ("typ" ~>+ Lists.map (Reflect.typeVariant) (Rewriting.foldOverType @@ Coders.traversalOrderPre @@+ ("m" ~> "t" ~> Lists.cons (var "t") (var "m")) @@ list ([] :: [TTerm Type]) @@ var "typ")) $+ Flows.map+ ("deps" ~>+ "allVariants" <~ Sets.fromList (Lists.concat (Lists.map (var "variants") (Maps.elems (var "deps")))) $+ Logic.not (Sets.member Variants.typeVariantFunction (var "allVariants")))+ (typeDependencies @@ false @@ (unaryFunction Equality.identity) @@ var "name")++isType :: TBinding (Type -> Bool)+isType = define "isType" $+ doc "Check whether a type is a type (always true for non-encoded types)" $+ "t" ~> cases _Type (Rewriting.deannotateType @@ var "t") (Just false) [+ _Type_application>>: "a" ~>+ isType @@ (Core.applicationTypeFunction (var "a")),+ _Type_forall>>: "l" ~>+ isType @@ (Core.forallTypeBody (var "l")),+ _Type_union>>: "rt" ~>+ Equality.equal (string (unName _Type)) (Core.unName (Core.rowTypeTypeName (var "rt"))),+ _Type_variable>>: "v" ~> Equality.equal (var "v") (Core.nameLift _Type)]++isUnitTerm :: TBinding (Term -> Bool)+isUnitTerm = define "isUnitTerm" $+ doc "Check whether a term is the unit term" $+ match _Term (Just false) [_Term_unit>>: constant true]++isUnitType :: TBinding (Type -> Bool)+isUnitType = define "isUnitType" $+ doc "Check whether a type is the unit type" $+ match _Type (Just false) [_Type_unit>>: constant true]++moduleContainsBinaryLiterals :: TBinding (Module -> Bool)+moduleContainsBinaryLiterals = define "moduleContainsBinaryLiterals" $+ doc "Check whether a module contains any binary literal values" $+ "mod" ~>+ "checkTerm" <~ ("found" ~> "term" ~> Logic.or (var "found") $+ cases _Term (var "term") (Just false) [+ _Term_literal>>: "lit" ~>+ cases _Literal (var "lit") (Just false) [+ _Literal_binary>>: constant true]]) $+ "termContainsBinary" <~ ("term" ~>+ Rewriting.foldOverTerm @@ Coders.traversalOrderPre @@ var "checkTerm" @@ false @@ var "term") $+ Lists.foldl+ ("acc" ~> "el" ~> Logic.or (var "acc") (var "termContainsBinary" @@ Core.bindingTerm (var "el")))+ false+ (Module.moduleElements (var "mod"))++moduleDependencyNamespaces :: TBinding (Bool -> Bool -> Bool -> Bool -> Module -> Flow Graph (S.Set Namespace))+moduleDependencyNamespaces = define "moduleDependencyNamespaces" $+ doc "Find dependency namespaces in all elements of a module, excluding the module's own namespace" $+ "binds" ~> "withPrims" ~> "withNoms" ~> "withSchema" ~> "mod" ~>+ Flows.bind (dependencyNamespaces @@ var "binds" @@ var "withPrims" @@ var "withNoms" @@ var "withSchema" @@+ Module.moduleElements (var "mod")) (+ "deps" ~> Flows.pure (Sets.delete (Module.moduleNamespace (var "mod")) (var "deps")))++namespacesForDefinitions :: TBinding ((Namespace -> a) -> Namespace -> [Definition] -> Namespaces a)+namespacesForDefinitions = define "namespacesForDefinitions" $+ doc "Create namespaces mapping for definitions" $+ "encodeNamespace" ~> "focusNs" ~> "defs" ~>+ "nss" <~ Sets.delete (var "focusNs") (definitionDependencyNamespaces @@ var "defs") $+ "toPair" <~ ("ns" ~> pair (var "ns") (var "encodeNamespace" @@ var "ns")) $+ Module.namespaces (var "toPair" @@ var "focusNs") (Maps.fromList (Lists.map (var "toPair") (Sets.toList (var "nss"))))++nominalApplication :: TBinding (Name -> [Type] -> Type)+nominalApplication = define "nominalApplication" $+ doc "Apply type arguments to a nominal type" $+ "tname" ~> "args" ~>+ Lists.foldl+ ("t" ~> "a" ~> Core.typeApplication $ Core.applicationType (var "t") (var "a"))+ (Core.typeVariable $ var "tname")+ (var "args")++normalTypeVariable :: TBinding (Int -> Name)+normalTypeVariable = define "normalTypeVariable" $+ doc "Type variable naming convention follows Haskell: t0, t1, etc." $+ "i" ~> Core.name (Strings.cat2 (string "t") (Literals.showInt32 $ var "i"))++partitionDefinitions :: TBinding ([Definition] -> ([TypeDefinition], [TermDefinition]))+partitionDefinitions = define "partitionDefinitions" $+ doc "Partition a list of definitions into type definitions and term definitions" $+ "defs" ~>+ "getType" <~ ("def" ~> cases _Definition (var "def") Nothing [+ _Definition_type>>: "td" ~> just (var "td"),+ _Definition_term>>: "_" ~> nothing]) $+ "getTerm" <~ ("def" ~> cases _Definition (var "def") Nothing [+ _Definition_type>>: "_" ~> nothing,+ _Definition_term>>: "td" ~> just (var "td")]) $+ pair+ (Maybes.cat $ Lists.map (var "getType") (var "defs"))+ (Maybes.cat $ Lists.map (var "getTerm") (var "defs"))++requireRecordType :: TBinding (Name -> Flow Graph RowType)+requireRecordType = define "requireRecordType" $+ doc "Require a name to resolve to a record type" $+ "name" ~>+ "toRecord" <~ ("t" ~> cases _Type (var "t") (Just nothing) [+ _Type_record>>: "rt" ~> just (var "rt")]) $+ requireRowType @@ string "record type" @@ var "toRecord" @@ var "name"++requireRowType :: TBinding (String -> (Type -> Maybe RowType) -> Name -> Flow Graph RowType)+requireRowType = define "requireRowType" $+ doc "Require a name to resolve to a row type" $+ "label" ~> "getter" ~> "name" ~>+ "rawType" <~ ("t" ~> cases _Type (var "t") (Just (var "t")) [+ _Type_annotated>>: "at" ~> var "rawType" @@ Core.annotatedTypeBody (var "at"),+ _Type_forall>>: "ft" ~> var "rawType" @@ Core.forallTypeBody (var "ft")]) $+ Flows.bind (requireType @@ var "name") (+ "t" ~>+ Maybes.maybe+ (Flows.fail (Strings.cat (list [+ Core.unName (var "name"),+ (string " does not resolve to a "),+ var "label",+ (string " type: "),+ ShowCore.type_ @@ var "t"])))+ (unaryFunction Flows.pure)+ (var "getter" @@ (var "rawType" @@ var "t")))++requireSchemaType :: TBinding (InferenceContext -> Name -> Flow s TypeScheme)+requireSchemaType = define "requireSchemaType" $+ doc "Look up a schema type in the context and instantiate it" $+ "cx" ~> "tname" ~>+ "types" <~ (Typing.inferenceContextSchemaTypes $ var "cx") $+ Maybes.maybe+ (Flows.fail $ Strings.cat $ list [+ (string "No such schema type: "),+ Core.unName $ var "tname",+ (string ". Available types are: "),+ Strings.intercalate (string ", ") (Lists.map (unaryFunction Core.unName) $ Maps.keys $ var "types")])+ -- TODO: the deannotation is probably superfluous+ ("ts" ~> instantiateTypeScheme @@ (Rewriting.deannotateTypeSchemeRecursive @@ var "ts"))+ (Maps.lookup (var "tname") (var "types"))++requireType :: TBinding (Name -> Flow Graph Type)+requireType = define "requireType" $+ doc "Require a type by name" $+ "name" ~>+ "cx" <<~ Monads.getState $+ trace (Strings.cat2 (string "require type ") (Core.unName (var "name"))) $+ Flows.bind (Lexical.withSchemaContext @@ (Lexical.requireElement @@ var "name")) (+ "el" ~> Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el")))++requireUnionField_ :: TBinding (Name -> Name -> Flow Graph Type)+requireUnionField_ = define "requireUnionField" $+ doc "Require a field type from a union type" $+ "tname" ~> "fname" ~>+ "withRowType" <~ ("rt" ~>+ "matches" <~ (Lists.filter+ ("ft" ~> Equality.equal (Core.fieldTypeName $ var "ft") (var "fname"))+ (Core.rowTypeFields $ var "rt")) $+ Logic.ifElse (Lists.null $ var "matches")+ (Flows.fail $ Strings.cat $ list [+ string "no field \"",+ Core.unName (var "fname"),+ string "\" in union type \"",+ Core.unName (var "tname")])+ (produce $ Core.fieldTypeType $ Lists.head $ var "matches")) $+ Flows.bind (requireUnionType @@ var "tname") (var "withRowType")++requireUnionType :: TBinding (Name -> Flow Graph RowType)+requireUnionType = define "requireUnionType" $+ doc "Require a name to resolve to a union type" $+ "name" ~>+ "toUnion" <~ ("t" ~> cases _Type (var "t")+ (Just nothing) [+ _Type_union>>: "rt" ~> just (var "rt")]) $+ requireRowType @@ string "union" @@ var "toUnion" @@ var "name"++resolveType :: TBinding (Type -> Flow Graph (Maybe Type))+resolveType = define "resolveType" $+ doc "Resolve a type, dereferencing type variables" $+ "typ" ~>+ "cx" <<~ Monads.getState $+-- trace "resolve type" $+ match _Type (Just (Flows.pure (just (var "typ")))) [+ _Type_variable>>: "name" ~>+ Lexical.withSchemaContext @@+ (Flows.bind (Lexical.resolveTerm @@ var "name") (+ "mterm" ~>+ Maybes.maybe (Flows.pure nothing)+ ("t" ~> Flows.map (unaryFunction just) (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ var "t")))+ (var "mterm")))]+ @@ (Rewriting.deannotateType @@ var "typ")++schemaGraphToTypingEnvironment :: TBinding (Graph -> Flow s (M.Map Name TypeScheme))+schemaGraphToTypingEnvironment = define "schemaGraphToTypingEnvironment" $+ doc "Convert a schema graph to a typing environment" $+ "g" ~>+ "toTypeScheme" <~ ("vars" ~> "typ" ~> cases _Type (Rewriting.deannotateType @@ var "typ")+ (Just (Core.typeScheme (Lists.reverse (var "vars")) (var "typ") Phantoms.nothing)) [+ _Type_forall>>: "ft" ~> var "toTypeScheme"+ @@ Lists.cons (Core.forallTypeParameter (var "ft")) (var "vars")+ @@ Core.forallTypeBody (var "ft")]) $+ "toPair" <~ ("el" ~>+ "cx" <<~ Monads.getState $+ "forTerm" <~ ("term" ~> cases _Term (var "term") (Just (Flows.pure nothing)) [+ _Term_record>>: "r" ~>+ Logic.ifElse+ (Equality.equal (Core.recordTypeName (var "r")) (Core.nameLift _TypeScheme))+ (Flows.map+ (unaryFunction just)+ (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _TypeScheme @@ var "cx" @@ Core.bindingTerm (var "el"))))+ (Flows.pure nothing),+ _Term_union>>: "i" ~>+ Logic.ifElse (Equality.equal (Core.injectionTypeName (var "i")) (Core.nameLift _Type))+ (Flows.map+ ("decoded" ~> just (var "toTypeScheme" @@ list ([] :: [TTerm Name]) @@ var "decoded"))+ (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el"))))+ (Flows.pure nothing)]) $+ "mts" <<~ optCases (Core.bindingType (var "el"))+ (Flows.map ("typ" ~> just $ fTypeToTypeScheme @@ var "typ") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ (Core.bindingTerm (var "el"))))+ ("ts" ~> Logic.ifElse+ (Equality.equal (var "ts") (Core.typeScheme (list ([] :: [TTerm Name])) (Core.typeVariable (Core.nameLift _TypeScheme)) Phantoms.nothing))+ (Flows.map (unaryFunction just) (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _TypeScheme @@ var "cx" @@ Core.bindingTerm (var "el"))))+ (Logic.ifElse+ (Equality.equal (var "ts") (Core.typeScheme (list ([] :: [TTerm Name])) (Core.typeVariable (Core.nameLift _Type)) Phantoms.nothing))+ (Flows.map ("decoded" ~> just (var "toTypeScheme" @@ list ([] :: [TTerm Name]) @@ var "decoded")) (Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el"))))+ (var "forTerm" @@ (Rewriting.deannotateTerm @@ (Core.bindingTerm (var "el")))))) $+ produce $ Maybes.map ("ts" ~> pair (Core.bindingName (var "el")) (var "ts")) (var "mts")) $+ trace (string "schema graph to typing environment") $+ Monads.withState @@ var "g" @@+ (Flows.bind (Flows.mapList (var "toPair") (Graph.graphElements (var "g"))) (+ "mpairs" ~> Flows.pure (Maps.fromList (Maybes.cat (var "mpairs")))))++-- Note: this is lossy, as it throws away the term body+termAsGraph :: TBinding (Term -> [Binding])+termAsGraph = define "termAsGraph" $+ doc "Find the equivalent graph representation of a term" $+ "term" ~> cases _Term (Rewriting.deannotateTerm @@ var "term")+ (Just (list ([] :: [TTerm Binding]))) [+ _Term_let>>: "lt" ~> Core.letBindings (var "lt")]++topologicalSortTypeDefinitions :: TBinding ([TypeDefinition] -> [[TypeDefinition]])+topologicalSortTypeDefinitions = define "topologicalSortTypeDefinitions" $+ doc "Topologically sort type definitions by dependencies" $+ "defs" ~>+ "toPair" <~ ("def" ~> pair+ (Module.typeDefinitionName (var "def"))+ (Sets.toList (Rewriting.typeDependencyNames @@ false @@ Module.typeDefinitionType (var "def")))) $+ "nameToDef" <~ Maps.fromList (Lists.map+ ("d" ~> pair (Module.typeDefinitionName (var "d")) (var "d"))+ (var "defs")) $+ "sorted" <~ Sorting.topologicalSortComponents @@ Lists.map (var "toPair") (var "defs") $+ Lists.map ("names" ~> Maybes.cat (Lists.map ("n" ~> Maps.lookup (var "n") (var "nameToDef")) (var "names"))) (+ var "sorted")++typeDependencies :: TBinding (Bool -> (Type -> Type) -> Name -> Flow Graph (M.Map Name Type))+typeDependencies = define "typeDependencies" $+ doc "Get all type dependencies for a given type name" $+ "withSchema" ~> "transform" ~> "name" ~>+ "cx" <<~ Monads.getState $+ "requireType" <~ ("name" ~>+ trace (Strings.cat2 (string "type dependencies of ") (Core.unName (var "name"))) (+ Flows.bind (Lexical.requireElement @@ var "name") (+ "el" ~> Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ Core.bindingTerm (var "el"))))) $+ "toPair" <~ ("name" ~>+ Flows.bind (var "requireType" @@ var "name") (+ "typ" ~> Flows.pure (pair (var "name") (var "transform" @@ var "typ")))) $+ "deps" <~ ("seeds" ~> "names" ~>+ Logic.ifElse (Sets.null (var "seeds"))+ (Flows.pure (var "names"))+ (Flows.bind (Flows.mapList (var "toPair") (Sets.toList (var "seeds"))) (+ "pairs" ~>+ "newNames" <~ Maps.union (var "names") (Maps.fromList (var "pairs")) $+ "refs" <~ Lists.foldl (binaryFunction Sets.union) Sets.empty (Lists.map+ ("pair" ~> Rewriting.typeDependencyNames @@ var "withSchema" @@ Pairs.second (var "pair"))+ (var "pairs")) $+ "visited" <~ Sets.fromList (Maps.keys (var "names")) $+ "newSeeds" <~ Sets.difference (var "refs") (var "visited") $+ var "deps" @@ var "newSeeds" @@ var "newNames"))) $+ trace (string "type dependencies") $+ var "deps" @@ Sets.singleton (var "name") @@ Maps.empty++typeSchemeToFType :: TBinding (TypeScheme -> Type)+typeSchemeToFType = define "typeSchemeToFType" $+ doc "Convert a type scheme to a forall type" $+ "ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "body" <~ Core.typeSchemeType (var "ts") $+ Lists.foldl+ ("t" ~> "v" ~> Core.typeForall $ Core.forallType (var "v") (var "t"))+ (var "body")+ -- Put the variables in the same order in which they are introduced by the type scheme.+ (Lists.reverse $ var "vars")++typeToTypeScheme :: TBinding (Type -> TypeScheme)+typeToTypeScheme = define "typeToTypeScheme" $+ doc "Convert a (System F -style) type to a type scheme" $+ "t0" ~>+ "helper" <~ ("vars" ~> "t" ~> cases _Type (Rewriting.deannotateType @@ var "t")+ (Just $ Core.typeScheme (Lists.reverse $ var "vars") (var "t") Phantoms.nothing) [+ _Type_forall>>: "ft" ~> var "helper"+ @@ (Lists.cons (Core.forallTypeParameter $ var "ft") $ var "vars")+ @@ (Core.forallTypeBody $ var "ft")]) $+ var "helper" @@ list ([] :: [TTerm Name]) @@ var "t0"++typesToElements :: TBinding (M.Map Name Type -> [Binding])+typesToElements = define "typesToElements" $+ doc "Encode a map of named types to a list of elements" $+ "typeMap" ~>+ "toElement" <~ ("pair" ~>+ "name" <~ Pairs.first (var "pair") $+ Core.binding+ (var "name")+ (encoderFor _Type @@ (Pairs.second $ var "pair"))+ nothing) $+ Lists.map (var "toElement") $ Maps.toList $ var "typeMap"++withLambdaContext :: TBinding ((e -> TypeContext) -> (TypeContext -> e -> e) -> e -> Lambda -> (e -> Flow s a) -> Flow s a)+withLambdaContext = define "withLambdaContext" $+ doc "Execute a computation in the context of a lambda body, extending the type context with the lambda parameter" $+ "getContext" ~> "setContext" ~> "env" ~> "lam" ~> "body" ~>+ "newContext" <~ extendTypeContextForLambda @@ (var "getContext" @@ var "env") @@ var "lam" $+ var "body" @@ (var "setContext" @@ var "newContext" @@ var "env")++withLetContext :: TBinding ((e -> TypeContext) -> (TypeContext -> e -> e) -> (TypeContext -> Binding -> Maybe Term) -> e -> Let -> (e -> Flow s a) -> Flow s a)+withLetContext = define "withLetContext" $+ doc "Execute a computation in the context of a let body, extending the type context with the let bindings" $+ "getContext" ~> "setContext" ~> "forBinding" ~> "env" ~> "letrec" ~> "body" ~>+ "newContext" <~ extendTypeContextForLet @@ var "forBinding" @@ (var "getContext" @@ var "env") @@ var "letrec" $+ var "body" @@ (var "setContext" @@ var "newContext" @@ var "env")++withTypeLambdaContext :: TBinding ((e -> TypeContext) -> (TypeContext -> e -> e) -> e -> TypeLambda -> (e -> Flow s a) -> Flow s a)+withTypeLambdaContext = define "withTypeLambdaContext" $+ doc "Execute a computation in the context of a type lambda body, extending the type context with the type parameter" $+ "getContext" ~> "setContext" ~> "env" ~> "tlam" ~> "body" ~>+ "newContext" <~ extendTypeContextForTypeLambda @@ (var "getContext" @@ var "env") @@ var "tlam" $+ var "body" @@ (var "setContext" @@ var "newContext" @@ var "env")
src/main/haskell/Hydra/Sources/Kernel/Terms/Serialization.hs view
@@ -1,585 +1,606 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Serialization where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ angleBraces, angleBracesList, braces, bracesList, brackets, bracketsList, bracesListAdaptive,+ bracketList, bracketListAdaptive, cat, commaSep, cst, curlyBlock, curlyBraces, curlyBracesList,+ customIndent, customIndentBlock, dotSep, doubleNewlineSep, doubleQuoted, doubleSpace,+ expressionLength, fullBlockStyle, fullName, halfBlockStyle, halfIndent, ifx, indent, indentBlock,+ indentLines, indentSubsequentLines, infixWs, infixWsList, inlineStyle, newline, newlineSep, noSep,+ noPad, noPadding, num, op, orOp, orSep, parenList, parens, parensList, parentheses, parenthesize,+ prefix, printExpr, printGraph, semicolonSep, sep, singleQuoted, space, spaceSep, squareBrackets,+ suffix, sym, symbolSep, tabIndent, tabIndentDoubleSpace, tabIndentSingleSpace, unsupportedType,+ unsupportedVariant, withComma, withSemi) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import Hydra.Ast +ns :: Namespace+ns = Namespace "hydra.serialization"+ module_ :: Module-module_ = Module (Namespace "hydra.serialization") elements+module_ = Module ns elements []- kernelTypesModules $+ kernelTypesNamespaces $ Just ("Utilities for constructing generic program code ASTs, used for the serialization phase of source code generation.") where elements = [- el angleBracesDef,- el angleBracesListDef,- el bracesListAdaptiveDef,- el bracketListDef,- el bracketListAdaptiveDef,- el bracketsDef,- el commaSepDef,- el curlyBlockDef,- el curlyBracesDef,- el curlyBracesListDef,- el cstDef,- el customIndentDef,- el customIndentBlockDef,- el dotSepDef,- el doubleNewlineSepDef,- el doubleSpaceDef,- el expressionLengthDef,- el fullBlockStyleDef,- el halfBlockStyleDef,- el ifxDef,- el indentDef,- el indentBlockDef,- el indentSubsequentLinesDef,- el infixWsDef,- el infixWsListDef,- el inlineStyleDef,- el newlineSepDef,- el noPaddingDef,- el noSepDef,- el numDef,- el opDef,- el orOpDef,- el orSepDef,- el parenListDef,- el parensDef,- el parenthesesDef,- el parenthesizeDef,- el prefixDef,- el printExprDef,- el semicolonSepDef,- el sepDef,- el spaceSepDef,- el squareBracketsDef,- el symDef,- el symbolSepDef,- el tabIndentDef,- el tabIndentDoubleSpaceDef,- el tabIndentSingleSpaceDef,- el unsupportedTypeDef,- el unsupportedVariantDef,- el withCommaDef,- el withSemiDef]+ toBinding angleBraces,+ toBinding angleBracesList,+ toBinding bracesListAdaptive,+ toBinding bracketList,+ toBinding bracketListAdaptive,+ toBinding brackets,+ toBinding commaSep,+ toBinding curlyBlock,+ toBinding curlyBraces,+ toBinding curlyBracesList,+ toBinding cst,+ toBinding customIndent,+ toBinding customIndentBlock,+ toBinding dotSep,+ toBinding doubleNewlineSep,+ toBinding doubleSpace,+ toBinding expressionLength,+ toBinding fullBlockStyle,+ toBinding halfBlockStyle,+ toBinding ifx,+ toBinding indent,+ toBinding indentBlock,+ toBinding indentSubsequentLines,+ toBinding infixWs,+ toBinding infixWsList,+ toBinding inlineStyle,+ toBinding newlineSep,+ toBinding noPadding,+ toBinding noSep,+ toBinding num,+ toBinding op,+ toBinding orOp,+ toBinding orSep,+ toBinding parenList,+ toBinding parens,+ toBinding parentheses,+ toBinding parenthesize,+ toBinding prefix,+ toBinding printExpr,+ toBinding semicolonSep,+ toBinding sep,+ toBinding spaceSep,+ toBinding squareBrackets,+ toBinding suffix,+ toBinding sym,+ toBinding symbolSep,+ toBinding tabIndent,+ toBinding tabIndentDoubleSpace,+ toBinding tabIndentSingleSpace,+ toBinding unsupportedType,+ toBinding unsupportedVariant,+ toBinding withComma,+ toBinding withSemi] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -angleBracesDef :: TBinding Brackets-angleBracesDef = define "angleBraces" $- Ast.brackets (ref symDef @@ string "<") (ref symDef @@ string ">")+angleBraces :: TBinding Brackets+angleBraces = define "angleBraces" $+ Ast.brackets (sym @@ string "<") (sym @@ string ">") -angleBracesListDef :: TBinding (BlockStyle -> [Expr] -> Expr)-angleBracesListDef = define "angleBracesList" $- lambdas ["style", "els"] $+angleBracesList :: TBinding (BlockStyle -> [Expr] -> Expr)+angleBracesList = define "angleBracesList" $+ "style" ~> "els" ~> Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "<>")- (ref bracketsDef @@ ref angleBracesDef @@ var "style" @@ (ref commaSepDef @@ var "style" @@ var "els"))+ (cst @@ string "<>")+ (brackets @@ angleBraces @@ var "style" @@ (commaSep @@ var "style" @@ var "els")) -bracesListAdaptiveDef :: TBinding ([Expr] -> Expr)-bracesListAdaptiveDef = define "bracesListAdaptive" $+bracesListAdaptive :: TBinding ([Expr] -> Expr)+bracesListAdaptive = define "bracesListAdaptive" $ doc "Produce a bracketed list which separates elements by spaces or newlines depending on the estimated width of the expression." $- lambda "els" $ lets [- "inlineList">: ref curlyBracesListDef @@ nothing @@ ref inlineStyleDef @@ var "els"]- $ Logic.ifElse (Equality.gt (ref expressionLengthDef @@ var "inlineList") (int32 70))- (ref curlyBracesListDef @@ nothing @@ ref halfBlockStyleDef @@ var "els")- (var "inlineList")+ "els" ~>+ "inlineList" <~ curlyBracesList @@ nothing @@ inlineStyle @@ var "els" $+ Logic.ifElse (Equality.gt (expressionLength @@ var "inlineList") (int32 70))+ (curlyBracesList @@ nothing @@ halfBlockStyle @@ var "els")+ (var "inlineList") -bracketListAdaptiveDef :: TBinding ([Expr] -> Expr)-bracketListAdaptiveDef = define "bracketListAdaptive" $+bracketListAdaptive :: TBinding ([Expr] -> Expr)+bracketListAdaptive = define "bracketListAdaptive" $ doc "Produce a bracketed list which separates elements by spaces or newlines depending on the estimated width of the expression." $- lambda "els" $ lets [- "inlineList">: ref bracketListDef @@ ref inlineStyleDef @@ var "els"]- $ Logic.ifElse (Equality.gt (ref expressionLengthDef @@ var "inlineList") (int32 70))- (ref bracketListDef @@ ref halfBlockStyleDef @@ var "els")- (var "inlineList")+ "els" ~>+ "inlineList" <~ bracketList @@ inlineStyle @@ var "els" $+ Logic.ifElse (Equality.gt (expressionLength @@ var "inlineList") (int32 70))+ (bracketList @@ halfBlockStyle @@ var "els")+ (var "inlineList") -bracketListDef :: TBinding (BlockStyle -> [Expr] -> Expr)-bracketListDef = define "bracketList" $- lambdas ["style", "els"] $+bracketList :: TBinding (BlockStyle -> [Expr] -> Expr)+bracketList = define "bracketList" $+ "style" ~> "els" ~> Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "[]")- (ref bracketsDef @@ ref squareBracketsDef @@ var "style" @@ (ref commaSepDef @@ var "style" @@ var "els"))+ (cst @@ string "[]")+ (brackets @@ squareBrackets @@ var "style" @@ (commaSep @@ var "style" @@ var "els")) -bracketsDef :: TBinding (Brackets -> BlockStyle -> Expr -> Expr)-bracketsDef = define "brackets" $- lambdas ["br", "style", "e"] $+brackets :: TBinding (Brackets -> BlockStyle -> Expr -> Expr)+brackets = define "brackets" $+ "br" ~> "style" ~> "e" ~> Ast.exprBrackets $ Ast.bracketExpr (var "br") (var "e") (var "style") -commaSepDef :: TBinding (BlockStyle -> [Expr] -> Expr)-commaSepDef = define "commaSep" $- ref symbolSepDef @@ string ","+commaSep :: TBinding (BlockStyle -> [Expr] -> Expr)+commaSep = define "commaSep" $+ symbolSep @@ string "," -cstDef :: TBinding (String -> Expr)-cstDef = define "cst" $- lambda "s" $ Ast.exprConst $ ref symDef @@ var "s"+cst :: TBinding (String -> Expr)+cst = define "cst" $+ "s" ~> Ast.exprConst $ sym @@ var "s" -curlyBlockDef :: TBinding (BlockStyle -> Expr -> Expr)-curlyBlockDef = define "curlyBlock" $- lambdas ["style", "e"] $- ref curlyBracesListDef @@ nothing @@ var "style" @@ (list [var "e"])+curlyBlock :: TBinding (BlockStyle -> Expr -> Expr)+curlyBlock = define "curlyBlock" $+ "style" ~> "e" ~>+ curlyBracesList @@ nothing @@ var "style" @@ (list [var "e"]) -curlyBracesDef :: TBinding Brackets-curlyBracesDef = define "curlyBraces" $- Ast.brackets (ref symDef @@ string "{") (ref symDef @@ string "}")+curlyBraces :: TBinding Brackets+curlyBraces = define "curlyBraces" $+ Ast.brackets (sym @@ string "{") (sym @@ string "}") -curlyBracesListDef :: TBinding (Maybe String -> BlockStyle -> [Expr] -> Expr)-curlyBracesListDef = define "curlyBracesList" $- lambdas ["msymb", "style", "els"] $+curlyBracesList :: TBinding (Maybe String -> BlockStyle -> [Expr] -> Expr)+curlyBracesList = define "curlyBracesList" $+ "msymb" ~> "style" ~> "els" ~> Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "{}")- (ref bracketsDef @@ ref curlyBracesDef @@ var "style" @@- (ref symbolSepDef @@ (Optionals.fromMaybe (string ",") (var "msymb")) @@ var "style" @@ var "els"))+ (cst @@ string "{}")+ (brackets @@ curlyBraces @@ var "style" @@+ (symbolSep @@ (Maybes.fromMaybe (string ",") (var "msymb")) @@ var "style" @@ var "els")) -customIndentBlockDef :: TBinding (String -> [Expr] -> Expr)-customIndentBlockDef = define "customIndentBlock" $- lambdas ["idt", "els"] $- Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "")- (Logic.ifElse (Equality.equal (Lists.length $ var "els") (int32 1))- (Lists.head $ var "els")- (lets [- "head">: Lists.head $ var "els",- "rest">: Lists.tail $ var "els",- "idtOp">: Ast.op- (ref symDef @@ string "")- (Ast.padding Ast.wsSpace (Ast.wsBreakAndIndent $ var "idt"))- (Ast.precedence $ int32 0)- Ast.associativityNone]- $ ref ifxDef @@ var "idtOp" @@ var "head" @@ (ref newlineSepDef @@ var "rest")))+customIndentBlock :: TBinding (String -> [Expr] -> Expr)+customIndentBlock = define "customIndentBlock" $+ "idt" ~> "els" ~>+ "idtOp" <~ (Ast.op+ (sym @@ string "")+ (Ast.padding Ast.wsSpace (Ast.wsBreakAndIndent $ var "idt"))+ (Ast.precedence $ int32 0)+ Ast.associativityNone) $+ Maybes.maybe (cst @@ string "")+ ("head" ~> Logic.ifElse (Equality.equal (Lists.length $ var "els") (int32 1))+ (var "head")+ (ifx @@ var "idtOp" @@ var "head" @@ (newlineSep @@ Lists.drop (int32 1) (var "els"))))+ (Lists.safeHead $ var "els") -customIndentDef :: TBinding (String -> String -> String)-customIndentDef = define "customIndent" $- lambdas ["idt", "s"] $ Strings.cat $- Lists.intersperse (string "\n") $ Lists.map (lambda "line" $ var "idt" ++ var "line") $ Strings.lines $ var "s"+customIndent :: TBinding (String -> String -> String)+customIndent = define "customIndent" $+ "idt" ~> "s" ~> Strings.cat $+ Lists.intersperse (string "\n") $ Lists.map ("line" ~> var "idt" ++ var "line") $ Strings.lines $ var "s" -dotSepDef :: TBinding ([Expr] -> Expr)-dotSepDef = define "dotSep" $- ref sepDef @@ (Ast.op- (ref symDef @@ string ".")+dotSep :: TBinding ([Expr] -> Expr)+dotSep = define "dotSep" $+ sep @@ (Ast.op+ (sym @@ string ".") (Ast.padding Ast.wsNone Ast.wsNone) (Ast.precedence $ int32 0) Ast.associativityNone) -doubleNewlineSepDef :: TBinding ([Expr] -> Expr)-doubleNewlineSepDef = define "doubleNewlineSep" $- ref sepDef @@ (Ast.op- (ref symDef @@ string "")+doubleNewlineSep :: TBinding ([Expr] -> Expr)+doubleNewlineSep = define "doubleNewlineSep" $+ sep @@ (Ast.op+ (sym @@ string "") (Ast.padding Ast.wsBreak Ast.wsBreak) (Ast.precedence $ int32 0) Ast.associativityNone) -doubleSpaceDef :: TBinding String-doubleSpaceDef = define "doubleSpace" $+doubleSpace :: TBinding String+doubleSpace = define "doubleSpace" $ string " " -expressionLengthDef :: TBinding (Expr -> Int)-expressionLengthDef = define "expressionLength" $+expressionLength :: TBinding (Expr -> Int)+expressionLength = define "expressionLength" $ doc "Find the approximate length (number of characters, including spaces and newlines) of an expression without actually printing it." $- lambda "e" $ lets [- "symbolLength">: lambda "s" $ Strings.length $ Ast.unSymbol $ var "s",- "wsLength">: lambda "ws" $ cases _Ws (var "ws") Nothing [- _Ws_none>>: constant $ int32 0,- _Ws_space>>: constant $ int32 1,- _Ws_break>>: constant $ int32 1,- _Ws_breakAndIndent>>: lambda "s" $ Math.add (int32 1) (Strings.length $ var "s"),- _Ws_doubleBreak>>: constant $ int32 2],- "blockStyleLength">: lambda "style" $ lets [- "mindentLen">: Optionals.maybe (int32 0) (unaryFunction Strings.length) (Ast.blockStyleIndent $ var "style"),- "nlBeforeLen">: Logic.ifElse (Ast.blockStyleNewlineBeforeContent $ var "style") (int32 1) (int32 0),- "nlAfterLen">: Logic.ifElse (Ast.blockStyleNewlineAfterContent $ var "style") (int32 1) (int32 0)]- $ Math.add (var "mindentLen") $ Math.add (var "nlBeforeLen") (var "nlAfterLen"),- "bracketsLength">: lambda "brackets" $- Math.add- (var "symbolLength" @@ (Ast.bracketsOpen $ var "brackets"))- (var "symbolLength" @@ (Ast.bracketsClose $ var "brackets")),- "bracketExprLength">: lambda "be" $- Math.add- (var "bracketsLength" @@ (Ast.bracketExprBrackets $ var "be"))- (Math.add- (ref expressionLengthDef @@ (Ast.bracketExprEnclosed $ var "be"))- (var "blockStyleLength" @@ (Ast.bracketExprStyle $ var "be"))),- "indentedExpressionLength">: lambda "ie" $ lets [- "baseLen">: ref expressionLengthDef @@ (Ast.indentedExpressionExpr $ var "ie"),- "indentLen">: cases _IndentStyle (Ast.indentedExpressionStyle $ var "ie") Nothing [- _IndentStyle_allLines>>: lambda "s" $ Strings.length $ var "s",- _IndentStyle_subsequentLines>>: lambda "s" $ Strings.length $ var "s"]]- $ Math.add (var "baseLen") (var "indentLen"),- "opLength">: lambda "op" $ lets [- "symLen">: var "symbolLength" @@ (Ast.opSymbol $ var "op"),- "padding">: Ast.opPadding $ var "op",- "leftLen">: var "wsLength" @@ (Ast.paddingLeft $ var "padding"),- "rightLen">: var "wsLength" @@ (Ast.paddingRight $ var "padding")]- $ Math.add (var "symLen") $ Math.add (var "leftLen") (var "rightLen"),- "opExprLength">: lambda "oe" $ lets [- "opLen">: var "opLength" @@ (Ast.opExprOp $ var "oe"),- "leftLen">: ref expressionLengthDef @@ (Ast.opExprLhs $ var "oe"),- "rightLen">: ref expressionLengthDef @@ (Ast.opExprRhs $ var "oe")]- $ Math.add (var "opLen") $ Math.add (var "leftLen") (var "rightLen")]- $ cases _Expr (var "e") Nothing [- _Expr_const>>: lambda "s" $ var "symbolLength" @@ var "s",- _Expr_indent>>: lambda "ie" $ var "indentedExpressionLength" @@ var "ie",- _Expr_op>>: lambda "oe" $ var "opExprLength" @@ var "oe",- _Expr_brackets>>: lambda "be" $ var "bracketExprLength" @@ var "be"]+ "e" ~>+ "symbolLength" <~ ("s" ~> Strings.length $ Ast.unSymbol $ var "s") $+ "wsLength" <~ ("ws" ~> cases _Ws (var "ws") Nothing [+ _Ws_none>>: constant $ int32 0,+ _Ws_space>>: constant $ int32 1,+ _Ws_break>>: constant $ int32 1,+ _Ws_breakAndIndent>>: "s" ~> Math.add (int32 1) (Strings.length $ var "s"),+ _Ws_doubleBreak>>: constant $ int32 2]) $+ "blockStyleLength" <~ ("style" ~>+ "mindentLen" <~ Maybes.maybe (int32 0) (unaryFunction Strings.length) (Ast.blockStyleIndent $ var "style") $+ "nlBeforeLen" <~ Logic.ifElse (Ast.blockStyleNewlineBeforeContent $ var "style") (int32 1) (int32 0) $+ "nlAfterLen" <~ Logic.ifElse (Ast.blockStyleNewlineAfterContent $ var "style") (int32 1) (int32 0) $+ Math.add (var "mindentLen") $ Math.add (var "nlBeforeLen") (var "nlAfterLen")) $+ "bracketsLength" <~ ("brackets" ~>+ Math.add+ (var "symbolLength" @@ (Ast.bracketsOpen $ var "brackets"))+ (var "symbolLength" @@ (Ast.bracketsClose $ var "brackets"))) $+ "bracketExprLength" <~ ("be" ~>+ Math.add+ (var "bracketsLength" @@ (Ast.bracketExprBrackets $ var "be"))+ (Math.add+ (expressionLength @@ (Ast.bracketExprEnclosed $ var "be"))+ (var "blockStyleLength" @@ (Ast.bracketExprStyle $ var "be")))) $+ "indentedExpressionLength" <~ ("ie" ~>+ "baseLen" <~ expressionLength @@ (Ast.indentedExpressionExpr $ var "ie") $+ "indentLen" <~ cases _IndentStyle (Ast.indentedExpressionStyle $ var "ie") Nothing [+ _IndentStyle_allLines>>: "s" ~> Strings.length $ var "s",+ _IndentStyle_subsequentLines>>: "s" ~> Strings.length $ var "s"] $+ Math.add (var "baseLen") (var "indentLen")) $+ "opLength" <~ ("op" ~>+ "symLen" <~ var "symbolLength" @@ (Ast.opSymbol $ var "op") $+ "padding" <~ Ast.opPadding (var "op") $+ "leftLen" <~ var "wsLength" @@ (Ast.paddingLeft $ var "padding") $+ "rightLen" <~ var "wsLength" @@ (Ast.paddingRight $ var "padding") $+ Math.add (var "symLen") $ Math.add (var "leftLen") (var "rightLen")) $+ "opExprLength" <~ ("oe" ~>+ "opLen" <~ var "opLength" @@ (Ast.opExprOp $ var "oe") $+ "leftLen" <~ expressionLength @@ (Ast.opExprLhs $ var "oe") $+ "rightLen" <~ expressionLength @@ (Ast.opExprRhs $ var "oe") $+ Math.add (var "opLen") $ Math.add (var "leftLen") (var "rightLen")) $+ cases _Expr (var "e") Nothing [+ _Expr_const>>: "s" ~> var "symbolLength" @@ var "s",+ _Expr_indent>>: "ie" ~> var "indentedExpressionLength" @@ var "ie",+ _Expr_op>>: "oe" ~> var "opExprLength" @@ var "oe",+ _Expr_brackets>>: "be" ~> var "bracketExprLength" @@ var "be"] -fullBlockStyleDef :: TBinding BlockStyle-fullBlockStyleDef = define "fullBlockStyle" $- Ast.blockStyle (just $ ref doubleSpaceDef) true true+fullBlockStyle :: TBinding BlockStyle+fullBlockStyle = define "fullBlockStyle" $+ Ast.blockStyle (just doubleSpace) true true -halfBlockStyleDef :: TBinding BlockStyle-halfBlockStyleDef = define "halfBlockStyle" $- Ast.blockStyle (just $ ref doubleSpaceDef) true false+halfBlockStyle :: TBinding BlockStyle+halfBlockStyle = define "halfBlockStyle" $+ Ast.blockStyle (just doubleSpace) true false -ifxDef :: TBinding (Op -> Expr -> Expr -> Expr)-ifxDef = define "ifx" $- lambdas ["op", "lhs", "rhs"] $+ifx :: TBinding (Op -> Expr -> Expr -> Expr)+ifx = define "ifx" $+ "op" ~> "lhs" ~> "rhs" ~> Ast.exprOp $ Ast.opExpr (var "op") (var "lhs") (var "rhs") -indentBlockDef :: TBinding ([Expr] -> Expr)-indentBlockDef = define "indentBlock" $- ref customIndentBlockDef @@ ref doubleSpaceDef+indentBlock :: TBinding ([Expr] -> Expr)+indentBlock = define "indentBlock" $+ customIndentBlock @@ doubleSpace -indentDef :: TBinding (String -> String)-indentDef = define "indent" $- ref customIndentDef @@ ref doubleSpaceDef+indent :: TBinding (String -> String)+indent = define "indent" $+ customIndent @@ doubleSpace -indentSubsequentLinesDef :: TBinding (String -> Expr -> Expr)-indentSubsequentLinesDef = define "indentSubsequentLines" $- lambdas ["idt", "e"] $+indentSubsequentLines :: TBinding (String -> Expr -> Expr)+indentSubsequentLines = define "indentSubsequentLines" $+ "idt" ~> "e" ~> Ast.exprIndent $ Ast.indentedExpression (Ast.indentStyleSubsequentLines $ var "idt") (var "e") -infixWsDef :: TBinding (String -> Expr -> Expr -> Expr)-infixWsDef = define "infixWs" $- lambdas ["op", "l", "r"] $- ref spaceSepDef @@ list [var "l", ref cstDef @@ var "op", var "r"]+infixWs :: TBinding (String -> Expr -> Expr -> Expr)+infixWs = define "infixWs" $+ "op" ~> "l" ~> "r" ~>+ spaceSep @@ list [var "l", cst @@ var "op", var "r"] -infixWsListDef :: TBinding (String -> [Expr] -> Expr)-infixWsListDef = define "infixWsList" $- lambdas ["op", "opers"] $ lets [- "opExpr">: ref cstDef @@ var "op",- "foldFun">: lambdas ["e", "r"] $- Logic.ifElse (Lists.null $ var "e")- (list [var "r"])- (Lists.cons (var "r") $ Lists.cons (var "opExpr") (var "e"))]- $ ref spaceSepDef @@ (Lists.foldl (var "foldFun") (list []) $ Lists.reverse $ var "opers")+infixWsList :: TBinding (String -> [Expr] -> Expr)+infixWsList = define "infixWsList" $+ "op" ~> "opers" ~>+ "opExpr" <~ cst @@ var "op" $+ "foldFun" <~ ("e" ~> "r" ~>+ Logic.ifElse (Lists.null $ var "e")+ (list [var "r"])+ (Lists.cons (var "r") $ Lists.cons (var "opExpr") (var "e"))) $+ spaceSep @@ (Lists.foldl (var "foldFun") (list ([] :: [TTerm Expr])) $ Lists.reverse $ var "opers") -inlineStyleDef :: TBinding BlockStyle-inlineStyleDef = define "inlineStyle" $+inlineStyle :: TBinding BlockStyle+inlineStyle = define "inlineStyle" $ Ast.blockStyle nothing false false -newlineSepDef :: TBinding ([Expr] -> Expr)-newlineSepDef = define "newlineSep" $- ref sepDef @@ (Ast.op- (ref symDef @@ string "")+newlineSep :: TBinding ([Expr] -> Expr)+newlineSep = define "newlineSep" $+ sep @@ (Ast.op+ (sym @@ string "") (Ast.padding Ast.wsNone Ast.wsBreak) (Ast.precedence $ int32 0) Ast.associativityNone) -noPaddingDef :: TBinding Padding-noPaddingDef = define "noPadding" $+noPadding :: TBinding Padding+noPadding = define "noPadding" $ Ast.padding Ast.wsNone Ast.wsNone -noSepDef :: TBinding ([Expr] -> Expr)-noSepDef = define "noSep" $- ref sepDef @@ (Ast.op- (ref symDef @@ string "")+noSep :: TBinding ([Expr] -> Expr)+noSep = define "noSep" $+ sep @@ (Ast.op+ (sym @@ string "") (Ast.padding Ast.wsNone Ast.wsNone) (Ast.precedence $ int32 0) Ast.associativityNone) -numDef :: TBinding (Int -> Expr)-numDef = define "num" $- lambda "i" $ ref cstDef @@ (Literals.showInt32 $ var "i")+num :: TBinding (Int -> Expr)+num = define "num" $+ "i" ~> cst @@ (Literals.showInt32 $ var "i") -opDef :: TBinding (String -> Int -> Associativity -> Op)-opDef = define "op" $- lambdas ["s", "p", "assoc"] $+op :: TBinding (String -> Int -> Associativity -> Op)+op = define "op" $+ "s" ~> "p" ~> "assoc" ~> Ast.op- (ref symDef @@ var "s")+ (sym @@ var "s") (Ast.padding Ast.wsSpace Ast.wsSpace) (Ast.precedence $ var "p") (var "assoc") -orOpDef :: TBinding (Bool -> Op)-orOpDef = define "orOp" $- lambda "newlines" $- Ast.op- (ref symDef @@ string "|")- (Ast.padding Ast.wsSpace (Logic.ifElse (var "newlines") Ast.wsBreak Ast.wsSpace))- (Ast.precedence $ int32 0)- Ast.associativityNone+orOp :: TBinding (Bool -> Op)+orOp = define "orOp" $+ "newlines" ~> Ast.op+ (sym @@ string "|")+ (Ast.padding Ast.wsSpace (Logic.ifElse (var "newlines") Ast.wsBreak Ast.wsSpace))+ (Ast.precedence $ int32 0)+ Ast.associativityNone -orSepDef :: TBinding (BlockStyle -> [Expr] -> Expr)-orSepDef = define "orSep" $- lambdas ["style", "l"] $- Logic.ifElse (Lists.null $ var "l")- (ref cstDef @@ string "")- (Logic.ifElse (Equality.equal (Lists.length $ var "l") (int32 1))- (Lists.head $ var "l")- (lets [- "h">: Lists.head $ var "l",- "r">: Lists.tail $ var "l",- "newlines">: Ast.blockStyleNewlineBeforeContent $ var "style"]- $ ref ifxDef @@ (ref orOpDef @@ var "newlines") @@ var "h" @@ (ref orSepDef @@ var "style" @@ var "r")))+orSep :: TBinding (BlockStyle -> [Expr] -> Expr)+orSep = define "orSep" $+ "style" ~> "l" ~>+ "newlines" <~ Ast.blockStyleNewlineBeforeContent (var "style") $+ Maybes.maybe (cst @@ string "")+ ("h" ~> Lists.foldl ("acc" ~> "el" ~> ifx @@ (orOp @@ var "newlines") @@ var "acc" @@ var "el") (var "h") (Lists.drop (int32 1) (var "l")))+ (Lists.safeHead $ var "l") -parenListDef :: TBinding (Bool -> [Expr] -> Expr)-parenListDef = define "parenList" $- lambdas ["newlines", "els"] $+parenList :: TBinding (Bool -> [Expr] -> Expr)+parenList = define "parenList" $+ "newlines" ~> "els" ~>+ "style" <~ (Logic.ifElse (Logic.and (var "newlines") (Equality.gt (Lists.length $ var "els") (int32 1)))+ (halfBlockStyle)+ (inlineStyle)) $ Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "()")- (lets [- "style">: Logic.ifElse (Logic.and (var "newlines") (Equality.gt (Lists.length $ var "els") (int32 1)))- (ref halfBlockStyleDef)- (ref inlineStyleDef)]- $ ref bracketsDef @@ ref parenthesesDef @@ var "style" @@ (ref commaSepDef @@ var "style" @@ var "els"))+ (cst @@ string "()")+ (brackets @@ parentheses @@ var "style" @@ (commaSep @@ var "style" @@ var "els")) -parensDef :: TBinding (Expr -> Expr)-parensDef = define "parens" $- ref bracketsDef @@ ref parenthesesDef @@ ref inlineStyleDef+parens :: TBinding (Expr -> Expr)+parens = define "parens" $+ brackets @@ parentheses @@ inlineStyle -parenthesesDef :: TBinding Brackets-parenthesesDef = define "parentheses" $- Ast.brackets (ref symDef @@ string "(") (ref symDef @@ string ")")+parentheses :: TBinding Brackets+parentheses = define "parentheses" $+ Ast.brackets (sym @@ string "(") (sym @@ string ")") -parenthesizeDef :: TBinding (Expr -> Expr)-parenthesizeDef = define "parenthesize" $- lambda "exp" $ lets [- "assocLeft">: lambda "a" $ cases _Associativity (var "a") (Just true) [- _Associativity_right>>: constant false],- "assocRight">: lambda "a" $ cases _Associativity (var "a") (Just true) [- _Associativity_left>>: constant false]]- $ cases _Expr (var "exp") Nothing [- _Expr_brackets>>: lambda "bracketExpr" $+parenthesize :: TBinding (Expr -> Expr)+parenthesize = define "parenthesize" $+ "exp" ~>+ "assocLeft" <~ ("a" ~> cases _Associativity (var "a")+ (Just true) [+ _Associativity_right>>: constant false]) $+ "assocRight" <~ ("a" ~> cases _Associativity (var "a")+ (Just true) [+ _Associativity_left>>: constant false]) $+ cases _Expr (var "exp") Nothing [+ _Expr_brackets>>: "bracketExpr" ~> Ast.exprBrackets $ Ast.bracketExpr (Ast.bracketExprBrackets $ var "bracketExpr")- (ref parenthesizeDef @@ (Ast.bracketExprEnclosed $ var "bracketExpr"))+ (parenthesize @@ (Ast.bracketExprEnclosed $ var "bracketExpr")) (Ast.bracketExprStyle $ var "bracketExpr"),- _Expr_const>>: lambda "ignored" $ var "exp",- _Expr_indent>>: lambda "indentExpr" $+ _Expr_const>>: "ignored" ~> var "exp",+ _Expr_indent>>: "indentExpr" ~> Ast.exprIndent $ Ast.indentedExpression (Ast.indentedExpressionStyle $ var "indentExpr")- (ref parenthesizeDef @@ (Ast.indentedExpressionExpr $ var "indentExpr")),- _Expr_op>>: lambda "opExpr" $ lets [- "op">: Ast.opExprOp $ var "opExpr",- "prec">: Ast.unPrecedence $ Ast.opPrecedence $ var "op",- "assoc">: Ast.opAssociativity $ var "op",- "lhs">: Ast.opExprLhs $ var "opExpr",- "rhs">: Ast.opExprRhs $ var "opExpr",- "lhs'">: ref parenthesizeDef @@ var "lhs",- "rhs'">: ref parenthesizeDef @@ var "rhs",- "lhs2">: cases _Expr (var "lhs'") (Just $ var "lhs'") [- _Expr_op>>: lambda "lopExpr" $ lets [- "lop">: Ast.opExprOp $ var "lopExpr",- "lprec">: Ast.unPrecedence $ Ast.opPrecedence $ var "lop",- "lassoc">: Ast.opAssociativity $ var "lop",- "comparison">: Equality.compare (var "prec") (var "lprec")]- $ cases _Comparison (var "comparison") Nothing [+ (parenthesize @@ (Ast.indentedExpressionExpr $ var "indentExpr")),+ _Expr_op>>: "opExpr" ~>+ "op" <~ Ast.opExprOp (var "opExpr") $+ "prec" <~ Ast.unPrecedence (Ast.opPrecedence $ var "op") $+ "assoc" <~ Ast.opAssociativity (var "op") $+ "lhs" <~ Ast.opExprLhs (var "opExpr") $+ "rhs" <~ Ast.opExprRhs (var "opExpr") $+ "lhs'" <~ parenthesize @@ var "lhs" $+ "rhs'" <~ parenthesize @@ var "rhs" $+ "lhs2" <~ cases _Expr (var "lhs'")+ (Just $ var "lhs'") [+ _Expr_op>>: "lopExpr" ~>+ "lop" <~ Ast.opExprOp (var "lopExpr") $+ "lprec" <~ Ast.unPrecedence (Ast.opPrecedence $ var "lop") $+ "lassoc" <~ Ast.opAssociativity (var "lop") $+ "comparison" <~ Equality.compare (var "prec") (var "lprec") $+ cases _Comparison (var "comparison") Nothing [ _Comparison_lessThan>>: constant $ var "lhs'",- _Comparison_greaterThan>>: constant (ref parensDef @@ var "lhs'"),+ _Comparison_greaterThan>>: constant (parens @@ var "lhs'"), _Comparison_equalTo>>: constant $ Logic.ifElse (Logic.and (var "assocLeft" @@ var "assoc") (var "assocLeft" @@ var "lassoc")) (var "lhs'")- (ref parensDef @@ var "lhs'")]],- "rhs2">: cases _Expr (var "rhs'") (Just $ var "rhs'") [- _Expr_op>>: lambda "ropExpr" $ lets [- "rop">: Ast.opExprOp $ var "ropExpr",- "rprec">: Ast.unPrecedence $ Ast.opPrecedence $ var "rop",- "rassoc">: Ast.opAssociativity $ var "rop",- "comparison">: Equality.compare (var "prec") (var "rprec")]- $ cases _Comparison (var "comparison") Nothing [+ (parens @@ var "lhs'")]] $+ "rhs2" <~ cases _Expr (var "rhs'") (Just $ var "rhs'") [+ _Expr_op>>: "ropExpr" ~>+ "rop" <~ Ast.opExprOp (var "ropExpr") $+ "rprec" <~ Ast.unPrecedence (Ast.opPrecedence $ var "rop") $+ "rassoc" <~ Ast.opAssociativity (var "rop") $+ "comparison" <~ Equality.compare (var "prec") (var "rprec") $+ cases _Comparison (var "comparison") Nothing [ _Comparison_lessThan>>: constant $ var "rhs'",- _Comparison_greaterThan>>: constant (ref parensDef @@ var "rhs'"),+ _Comparison_greaterThan>>: constant (parens @@ var "rhs'"), _Comparison_equalTo>>: constant $ Logic.ifElse (Logic.and (var "assocRight" @@ var "assoc") (var "assocRight" @@ var "rassoc")) (var "rhs'")- (ref parensDef @@ var "rhs'")]]]- $ Ast.exprOp $ Ast.opExpr (var "op") (var "lhs2") (var "rhs2")]+ (parens @@ var "rhs'")]] $+ Ast.exprOp $ Ast.opExpr (var "op") (var "lhs2") (var "rhs2")] -prefixDef :: TBinding (String -> Expr -> Expr)-prefixDef = define "prefix" $- lambdas ["p", "expr"] $ lets [- "preOp">: Ast.op- (ref symDef @@ var "p")- (Ast.padding Ast.wsNone Ast.wsNone)- (Ast.precedence $ int32 0)- Ast.associativityNone]- $ ref ifxDef @@ var "preOp" @@ (ref cstDef @@ string "") @@ var "expr"+prefix :: TBinding (String -> Expr -> Expr)+prefix = define "prefix" $+ "p" ~> "expr" ~>+ "preOp" <~ Ast.op+ (sym @@ var "p")+ (Ast.padding Ast.wsNone Ast.wsNone)+ (Ast.precedence $ int32 0)+ Ast.associativityNone $+ ifx @@ var "preOp" @@ (cst @@ string "") @@ var "expr" -printExprDef :: TBinding (Expr -> String)-printExprDef = define "printExpr" $- lambda "e" $ lets [- "pad">: lambda "ws" $ cases _Ws (var "ws") Nothing [- _Ws_none>>: constant $ string "",- _Ws_space>>: constant $ string " ",- _Ws_break>>: constant $ string "\n",- _Ws_breakAndIndent>>: lambda "ignored" $ string "\n",- _Ws_doubleBreak>>: constant $ string "\n\n"],- "idt">: lambdas ["ws", "s"] $ cases _Ws (var "ws") (Just $ var "s") [- _Ws_breakAndIndent>>: lambda "indentStr" $ ref customIndentDef @@ var "indentStr" @@ var "s"]]- $ cases _Expr (var "e") Nothing [- _Expr_const>>: lambda "symbol" $ Ast.unSymbol $ var "symbol",- _Expr_indent>>: lambda "indentExpr" $ lets [- "style">: Ast.indentedExpressionStyle $ var "indentExpr",- "expr">: Ast.indentedExpressionExpr $ var "indentExpr",- "lns">: Strings.lines $ ref printExprDef @@ var "expr"]- $ Strings.intercalate (string "\n") $ cases _IndentStyle (var "style") Nothing [- _IndentStyle_allLines>>: lambda "idt" $ Lists.map (lambda "line" $ var "idt" ++ var "line") (var "lns"),- _IndentStyle_subsequentLines>>: lambda "idt" $- Logic.ifElse (Equality.equal (Lists.length $ var "lns") (int32 1))- (var "lns")- (Lists.cons (Lists.head $ var "lns") $ Lists.map (lambda "line" $ var "idt" ++ var "line") $ Lists.tail $ var "lns")],- _Expr_op>>: lambda "opExpr" $ lets [- "op">: Ast.opExprOp $ var "opExpr",- "sym">: Ast.unSymbol $ Ast.opSymbol $ var "op",- "padding">: Ast.opPadding $ var "op",- "padl">: Ast.paddingLeft $ var "padding",- "padr">: Ast.paddingRight $ var "padding",- "l">: Ast.opExprLhs $ var "opExpr",- "r">: Ast.opExprRhs $ var "opExpr",- "lhs">: var "idt" @@ var "padl" @@ (ref printExprDef @@ var "l"),- "rhs">: var "idt" @@ var "padr" @@ (ref printExprDef @@ var "r")]- $ var "lhs" ++ (var "pad" @@ var "padl") ++ var "sym" ++ (var "pad" @@ var "padr") ++ var "rhs",- _Expr_brackets>>: lambda "bracketExpr" $ lets [- "brackets">: Ast.bracketExprBrackets $ var "bracketExpr",- "l">: Ast.unSymbol $ Ast.bracketsOpen $ var "brackets",- "r">: Ast.unSymbol $ Ast.bracketsClose $ var "brackets",- "e">: Ast.bracketExprEnclosed $ var "bracketExpr",- "style">: Ast.bracketExprStyle $ var "bracketExpr",- "body">: ref printExprDef @@ var "e",- "doIndent">: Ast.blockStyleIndent $ var "style",- "nlBefore">: Ast.blockStyleNewlineBeforeContent $ var "style",- "nlAfter">: Ast.blockStyleNewlineAfterContent $ var "style",- "ibody">: Optionals.maybe (var "body") (lambda "idt" $ ref customIndentDef @@ var "idt" @@ var "body") (var "doIndent"),- "pre">: Logic.ifElse (var "nlBefore") (string "\n") (string ""),- "suf">: Logic.ifElse (var "nlAfter") (string "\n") (string "")]- $ var "l" ++ var "pre" ++ var "ibody" ++ var "suf" ++ var "r"]+printExpr :: TBinding (Expr -> String)+printExpr = define "printExpr" $+ "e" ~>+ "pad" <~ ("ws" ~> cases _Ws (var "ws") Nothing [+ _Ws_none>>: constant $ string "",+ _Ws_space>>: constant $ string " ",+ _Ws_break>>: constant $ string "\n",+ _Ws_breakAndIndent>>: "ignored" ~> string "\n",+ _Ws_doubleBreak>>: constant $ string "\n\n"]) $+ "idt" <~ ("ws" ~> "s" ~> cases _Ws (var "ws") (Just $ var "s") [+ _Ws_breakAndIndent>>: "indentStr" ~> customIndent @@ var "indentStr" @@ var "s"]) $+ cases _Expr (var "e") Nothing [+ _Expr_const>>: "symbol" ~> Ast.unSymbol $ var "symbol",+ _Expr_indent>>: "indentExpr" ~>+ "style" <~ Ast.indentedExpressionStyle (var "indentExpr") $+ "expr" <~ Ast.indentedExpressionExpr (var "indentExpr") $+ "lns" <~ Strings.lines (printExpr @@ var "expr") $+ "ilns" <~ cases _IndentStyle (var "style") Nothing [+ _IndentStyle_allLines>>: "idt" ~> Lists.map ("line" ~> var "idt" ++ var "line") (var "lns"),+ _IndentStyle_subsequentLines>>: "idt" ~>+ Logic.ifElse (Equality.equal (Lists.length $ var "lns") (int32 1))+ (var "lns")+ (Lists.cons (Lists.head $ var "lns") $ Lists.map ("line" ~> var "idt" ++ var "line") $ Lists.tail $ var "lns")] $+ Strings.intercalate (string "\n") (var "ilns"),+ _Expr_op>>: "opExpr" ~>+ "op" <~ Ast.opExprOp (var "opExpr") $+ "sym" <~ Ast.unSymbol (Ast.opSymbol $ var "op") $+ "padding" <~ Ast.opPadding (var "op") $+ "padl" <~ Ast.paddingLeft (var "padding") $+ "padr" <~ Ast.paddingRight (var "padding") $+ "l" <~ Ast.opExprLhs (var "opExpr") $+ "r" <~ Ast.opExprRhs (var "opExpr") $+ "lhs" <~ var "idt" @@ var "padl" @@ (printExpr @@ var "l") $+ "rhs" <~ var "idt" @@ var "padr" @@ (printExpr @@ var "r") $+ var "lhs" ++ (var "pad" @@ var "padl") ++ var "sym" ++ (var "pad" @@ var "padr") ++ var "rhs",+ _Expr_brackets>>: "bracketExpr" ~>+ "brackets" <~ Ast.bracketExprBrackets (var "bracketExpr") $+ "l" <~ Ast.unSymbol (Ast.bracketsOpen $ var "brackets") $+ "r" <~ Ast.unSymbol (Ast.bracketsClose $ var "brackets") $+ "e" <~ Ast.bracketExprEnclosed (var "bracketExpr") $+ "style" <~ Ast.bracketExprStyle (var "bracketExpr") $+ "body" <~ printExpr @@ var "e" $+ "doIndent" <~ Ast.blockStyleIndent (var "style") $+ "nlBefore" <~ Ast.blockStyleNewlineBeforeContent (var "style") $+ "nlAfter" <~ Ast.blockStyleNewlineAfterContent (var "style") $+ "ibody" <~ Maybes.maybe (var "body") ("idt" ~> customIndent @@ var "idt" @@ var "body") (var "doIndent") $+ "pre" <~ Logic.ifElse (var "nlBefore") (string "\n") (string "") $+ "suf" <~ Logic.ifElse (var "nlAfter") (string "\n") (string "") $+ var "l" ++ var "pre" ++ var "ibody" ++ var "suf" ++ var "r"] -semicolonSepDef :: TBinding ([Expr] -> Expr)-semicolonSepDef = define "semicolonSep" $- ref symbolSepDef @@ string ";" @@ ref inlineStyleDef+semicolonSep :: TBinding ([Expr] -> Expr)+semicolonSep = define "semicolonSep" $+ symbolSep @@ string ";" @@ inlineStyle -sepDef :: TBinding (Op -> [Expr] -> Expr)-sepDef = define "sep" $- lambdas ["op", "els"] $- Logic.ifElse (Lists.null $ var "els")- (ref cstDef @@ string "")- (Logic.ifElse (Equality.equal (Lists.length $ var "els") (int32 1))- (Lists.head $ var "els")- (lets [- "h">: Lists.head $ var "els",- "r">: Lists.tail $ var "els"]- $ ref ifxDef @@ var "op" @@ var "h" @@ (ref sepDef @@ var "op" @@ var "r")))+sep :: TBinding (Op -> [Expr] -> Expr)+sep = define "sep" $+ "op" ~> "els" ~>+ Maybes.maybe (cst @@ string "")+ ("h" ~> Lists.foldl ("acc" ~> "el" ~> ifx @@ var "op" @@ var "acc" @@ var "el") (var "h") (Lists.drop (int32 1) (var "els")))+ (Lists.safeHead $ var "els") -spaceSepDef :: TBinding ([Expr] -> Expr)-spaceSepDef = define "spaceSep" $- ref sepDef @@ (Ast.op- (ref symDef @@ string "")+spaceSep :: TBinding ([Expr] -> Expr)+spaceSep = define "spaceSep" $+ sep @@ (Ast.op+ (sym @@ string "") (Ast.padding Ast.wsSpace Ast.wsNone) (Ast.precedence $ int32 0) Ast.associativityNone) -squareBracketsDef :: TBinding Brackets-squareBracketsDef = define "squareBrackets" $- Ast.brackets (ref symDef @@ string "[") (ref symDef @@ string "]")+squareBrackets :: TBinding Brackets+squareBrackets = define "squareBrackets" $+ Ast.brackets (sym @@ string "[") (sym @@ string "]") -symDef :: TBinding (String -> Symbol)-symDef = define "sym" $- lambda "s" $ Ast.symbol $ var "s"+suffix :: TBinding (String -> Expr -> Expr)+suffix = define "suffix" $+ doc "Append a suffix string to an expression" $+ "s" ~> "expr" ~>+ "sufOp" <~ Ast.op+ (sym @@ var "s")+ (Ast.padding Ast.wsNone Ast.wsNone)+ (Ast.precedence $ int32 0)+ Ast.associativityNone $+ ifx @@ var "sufOp" @@ var "expr" @@ (cst @@ string "") -symbolSepDef :: TBinding (String -> BlockStyle -> [Expr] -> Expr)-symbolSepDef = define "symbolSep" $- lambdas ["symb", "style", "l"] $- Logic.ifElse (Lists.null $ var "l")- (ref cstDef @@ string "")- (Logic.ifElse (Equality.equal (Lists.length $ var "l") (int32 1))- (Lists.head $ var "l")- (lets [- "h">: Lists.head $ var "l",- "r">: Lists.tail $ var "l",- "breakCount">: Lists.length $ Lists.filter identity $ list [- Ast.blockStyleNewlineBeforeContent $ var "style",- Ast.blockStyleNewlineAfterContent $ var "style"],- "break">: Logic.ifElse (Equality.equal (var "breakCount") (int32 0))- Ast.wsSpace- (Logic.ifElse (Equality.equal (var "breakCount") (int32 1))- Ast.wsBreak- Ast.wsDoubleBreak),- "commaOp">: Ast.op- (ref symDef @@ var "symb")- (Ast.padding Ast.wsNone (var "break"))- (Ast.precedence $ int32 0)- Ast.associativityNone]- $ ref ifxDef @@ var "commaOp" @@ var "h" @@ (ref symbolSepDef @@ var "symb" @@ var "style" @@ var "r")))+sym :: TBinding (String -> Symbol)+sym = define "sym" $+ "s" ~> Ast.symbol (var "s") -tabIndentDef :: TBinding (Expr -> Expr)-tabIndentDef = define "tabIndent" $- lambda "e" $ Ast.exprIndent $ Ast.indentedExpression+symbolSep :: TBinding (String -> BlockStyle -> [Expr] -> Expr)+symbolSep = define "symbolSep" $+ "symb" ~> "style" ~> "l" ~>+ "breakCount" <~ (Lists.length $ Lists.filter identity $ list [+ Ast.blockStyleNewlineBeforeContent $ var "style",+ Ast.blockStyleNewlineAfterContent $ var "style"]) $+ "break" <~ (Logic.ifElse (Equality.equal (var "breakCount") (int32 0))+ Ast.wsSpace+ (Logic.ifElse (Equality.equal (var "breakCount") (int32 1))+ Ast.wsBreak+ Ast.wsDoubleBreak)) $+ "commaOp" <~ (Ast.op+ (sym @@ var "symb")+ (Ast.padding Ast.wsNone (var "break"))+ (Ast.precedence $ int32 0)+ Ast.associativityNone) $+ Maybes.maybe (cst @@ string "")+ ("h" ~> Lists.foldl ("acc" ~> "el" ~> ifx @@ var "commaOp" @@ var "acc" @@ var "el") (var "h") (Lists.drop (int32 1) (var "l")))+ (Lists.safeHead $ var "l")++tabIndent :: TBinding (Expr -> Expr)+tabIndent = define "tabIndent" $+ "e" ~> Ast.exprIndent $ Ast.indentedExpression (Ast.indentStyleAllLines $ string " ") (var "e") -tabIndentDoubleSpaceDef :: TBinding ([Expr] -> Expr)-tabIndentDoubleSpaceDef = define "tabIndentDoubleSpace" $- lambda "exprs" $ ref tabIndentDef @@ (ref doubleNewlineSepDef @@ var "exprs")+tabIndentDoubleSpace :: TBinding ([Expr] -> Expr)+tabIndentDoubleSpace = define "tabIndentDoubleSpace" $+ "exprs" ~> tabIndent @@ (doubleNewlineSep @@ var "exprs") -tabIndentSingleSpaceDef :: TBinding ([Expr] -> Expr)-tabIndentSingleSpaceDef = define "tabIndentSingleSpace" $- lambda "exprs" $ ref tabIndentDef @@ (ref newlineSepDef @@ var "exprs")+tabIndentSingleSpace :: TBinding ([Expr] -> Expr)+tabIndentSingleSpace = define "tabIndentSingleSpace" $+ "exprs" ~> tabIndent @@ (newlineSep @@ var "exprs") -unsupportedTypeDef :: TBinding (String -> Expr)-unsupportedTypeDef = define "unsupportedType" $- lambda "label" $ ref cstDef @@ ("[" ++ var "label" ++ "]")+unsupportedType :: TBinding (String -> Expr)+unsupportedType = define "unsupportedType" $+ "label" ~> cst @@ (string "[" ++ var "label" ++ string "]") -unsupportedVariantDef :: TBinding (String -> a -> Expr)-unsupportedVariantDef = define "unsupportedVariant" $- lambdas ["label", "obj"] $ ref cstDef @@- ("[unsupported " ++ var "label" ++ ": " ++ (Literals.showString $ var "obj") ++ "]")+unsupportedVariant :: TBinding (String -> a -> Expr)+unsupportedVariant = define "unsupportedVariant" $+ "label" ~> "obj" ~>+ cst @@ (string "[unsupported " ++ var "label" ++ string ": " ++ (Literals.showString $ var "obj") ++ string "]") -withCommaDef :: TBinding (Expr -> Expr)-withCommaDef = define "withComma" $- lambda "e" $ ref noSepDef @@ list [var "e", ref cstDef @@ string ","]+withComma :: TBinding (Expr -> Expr)+withComma = define "withComma" $+ "e" ~> noSep @@ list [var "e", cst @@ string ","] -withSemiDef :: TBinding (Expr -> Expr)-withSemiDef = define "withSemi" $- lambda "e" $ ref noSepDef @@ list [var "e", ref cstDef @@ string ";"]+withSemi :: TBinding (Expr -> Expr)+withSemi = define "withSemi" $+ "e" ~> noSep @@ list [var "e", cst @@ string ";"]
src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Accessors.hs view
@@ -1,125 +1,139 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Terms.Show.Accessors where --- Standard imports for term-level kernel modules+-- Standard imports for kernel terms modules import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Names as Names import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting +ns :: Namespace+ns = Namespace "hydra.show.accessors"+ module_ :: Module-module_ = Module (Namespace "hydra.show.accessors") elements- [Names.module_, Rewriting.module_]- kernelTypesModules $+module_ = Module ns elements+ [Names.ns, Rewriting.ns]+ kernelTypesNamespaces $ Just ("Utilities for working with term accessors.") where elements = [- el termAccessorDef,- el termToAccessorGraphDef] -- TODO: move out of hydra.show.accessors+ toBinding termAccessor,+ toBinding termToAccessorGraph] -- TODO: move out of hydra.show.accessors define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -termAccessorDef :: TBinding (TermAccessor -> Maybe String)-termAccessorDef = define "termAccessor" $+termAccessor :: TBinding (TermAccessor -> Maybe String)+termAccessor = define "termAccessor" $ doc "Convert a term accessor to a string representation" $- lambda "accessor" $ lets [- "idx">: lambda "i" nothing, -- TODO: restore index functionality- "idxSuff">: lambda "suffix" $ lambda "i" $- Optionals.map (lambda "s" $ Strings.cat2 (var "s") (var "suffix")) (var "idx" @@ var "i")]- $ match _TermAccessor Nothing [- _TermAccessor_annotatedSubject>>: constant nothing,- _TermAccessor_applicationFunction>>: constant $ just $ string "fun",- _TermAccessor_applicationArgument>>: constant $ just $ string "arg",- _TermAccessor_lambdaBody>>: constant $ just $ string "body",- _TermAccessor_unionCasesDefault>>: constant $ just $ string "default",- _TermAccessor_unionCasesBranch>>: lambda "name" $ just $- Strings.cat2 (string ".") (Core.unName $ var "name"),- _TermAccessor_letEnvironment>>: constant $ just $ string "in",- _TermAccessor_letBinding>>: lambda "name" $ just $- Strings.cat2 (Core.unName $ var "name") (string "="),- _TermAccessor_listElement>>: lambda "i" $ var "idx" @@ var "i",- _TermAccessor_mapKey>>: lambda "i" $ var "idxSuff" @@ string ".key" @@ var "i",- _TermAccessor_mapValue>>: lambda "i" $ var "idxSuff" @@ string ".value" @@ var "i",- _TermAccessor_optionalTerm>>: constant $ just $ string "just",- _TermAccessor_productTerm>>: lambda "i" $ var "idx" @@ var "i",- _TermAccessor_recordField>>: lambda "name" $ just $- Strings.cat2 (string ".") (Core.unName $ var "name"),- _TermAccessor_setElement>>: lambda "i" $ var "idx" @@ var "i",- _TermAccessor_sumTerm>>: constant nothing,- _TermAccessor_typeLambdaBody>>: constant nothing,- _TermAccessor_typeApplicationTerm>>: constant nothing,- _TermAccessor_injectionTerm>>: constant nothing,- _TermAccessor_wrappedTerm>>: constant nothing] @@ var "accessor"+ "accessor" ~>+ "idx" <~ ("i" ~> nothing) $ -- TODO: restore index functionality+ "idxSuff" <~ ("suffix" ~> "i" ~>+ Maybes.map ("s" ~> Strings.cat2 (var "s") (var "suffix")) (var "idx" @@ var "i")) $+ cases _TermAccessor (var "accessor")+ Nothing [+ _TermAccessor_annotatedBody>>: constant nothing,+ _TermAccessor_applicationFunction>>: constant (just (string "fun")),+ _TermAccessor_applicationArgument>>: constant (just (string "arg")),+ _TermAccessor_lambdaBody>>: constant (just (string "body")),+ _TermAccessor_unionCasesDefault>>: constant (just (string "default")),+ _TermAccessor_unionCasesBranch>>: "name" ~> just (Strings.cat2 (string ".") (Core.unName (var "name"))),+ _TermAccessor_letBody>>: constant (just (string "in")),+ _TermAccessor_letBinding>>: "name" ~> just (Strings.cat2 (Core.unName (var "name")) (string "=")),+ _TermAccessor_listElement>>: "i" ~> var "idx" @@ var "i",+ _TermAccessor_mapKey>>: "i" ~> var "idxSuff" @@ (string ".key") @@ var "i",+ _TermAccessor_mapValue>>: "i" ~> var "idxSuff" @@ (string ".value") @@ var "i",+ _TermAccessor_maybeTerm>>: constant (just (string "just")),+ _TermAccessor_productTerm>>: "i" ~> var "idx" @@ var "i",+ _TermAccessor_recordField>>: "name" ~> just (Strings.cat2 (string ".") (Core.unName (var "name"))),+ _TermAccessor_setElement>>: "i" ~> var "idx" @@ var "i",+ _TermAccessor_sumTerm>>: constant nothing,+ _TermAccessor_typeLambdaBody>>: constant nothing,+ _TermAccessor_typeApplicationTerm>>: constant nothing,+ _TermAccessor_injectionTerm>>: constant nothing,+ _TermAccessor_wrappedTerm>>: constant nothing] -termToAccessorGraphDef :: TBinding (M.Map Namespace String -> Term -> AccessorGraph)-termToAccessorGraphDef = define "termToAccessorGraph" $+-- TODO: move out of hydra.show.accessors; this is not strictly a "show" function+termToAccessorGraph :: TBinding (M.Map Namespace String -> Term -> AccessorGraph)+termToAccessorGraph = define "termToAccessorGraph" $ doc "Build an accessor graph from a term" $ lambda "namespaces" $ lambda "term" $ lets [- "dontCareAccessor">: Mantle.termAccessorAnnotatedSubject,+ "dontCareAccessor">: Accessors.termAccessorAnnotatedBody, "helper">: lambdas ["ids", "mroot", "path", "state", "accessorTerm"] $ lets [- "accessor">: first $ var "accessorTerm",- "currentTerm">: second $ var "accessorTerm",- "nodesEdges">: first $ var "state",- "visited">: second $ var "state",- "nodes">: first $ var "nodesEdges",- "edges">: second $ var "nodesEdges",+ "accessor">: Pairs.first $ var "accessorTerm",+ "currentTerm">: Pairs.second $ var "accessorTerm",+ "nodesEdges">: Pairs.first $ var "state",+ "visited">: Pairs.second $ var "state",+ "nodes">: Pairs.first $ var "nodesEdges",+ "edges">: Pairs.second $ var "nodesEdges", "nextPath">: Lists.cons (var "accessor") (var "path")] $ match _Term (Just $ Lists.foldl (var "helper" @@ var "ids" @@ var "mroot" @@ var "nextPath") (var "state")- (ref Rewriting.subtermsWithAccessorsDef @@ var "currentTerm")) [+ (Rewriting.subtermsWithAccessors @@ var "currentTerm")) [ _Term_let>>: lambda "letExpr" $ lets [ "bindings">: Core.letBindings $ var "letExpr",- "env">: Core.letEnvironment $ var "letExpr",+ "env">: Core.letBody $ var "letExpr", "bindingNames">: Lists.map (unaryFunction Core.bindingName) (var "bindings"), -- First fold: build nodes and update ids for each binding name "addBindingName">: lambdas ["nodesVisitedIds", "name"] $ lets [- "currentNodesVisited">: first $ var "nodesVisitedIds",- "currentIds">: second $ var "nodesVisitedIds",- "currentNodes">: first $ var "currentNodesVisited",- "currentVisited">: second $ var "currentNodesVisited",- "rawLabel">: ref Names.compactNameDef @@ var "namespaces" @@ var "name",- "uniqueLabel">: ref Names.uniqueLabelDef @@ var "currentVisited" @@ var "rawLabel",+ "currentNodesVisited">: Pairs.first $ var "nodesVisitedIds",+ "currentIds">: Pairs.second $ var "nodesVisitedIds",+ "currentNodes">: Pairs.first $ var "currentNodesVisited",+ "currentVisited">: Pairs.second $ var "currentNodesVisited",+ "rawLabel">: Names.compactName @@ var "namespaces" @@ var "name",+ "uniqueLabel">: Names.uniqueLabel @@ var "currentVisited" @@ var "rawLabel", "node">: Accessors.accessorNode (var "name") (var "rawLabel") (var "uniqueLabel"), "newVisited">: Sets.insert (var "uniqueLabel") (var "currentVisited"), "newNodes">: Lists.cons (var "node") (var "currentNodes"),@@ -127,17 +141,17 @@ $ pair (pair (var "newNodes") (var "newVisited")) (var "newIds"), "nodesVisitedIds1">: Lists.foldl (var "addBindingName")- (pair (pair (list []) (var "visited")) (var "ids"))+ (pair (pair (list ([] :: [TTerm AccessorNode])) (var "visited")) (var "ids")) (var "bindingNames"),- "nodes1">: first $ first $ var "nodesVisitedIds1",- "visited1">: second $ first $ var "nodesVisitedIds1",- "ids1">: second $ var "nodesVisitedIds1",+ "nodes1">: Pairs.first $ Pairs.first $ var "nodesVisitedIds1",+ "visited1">: Pairs.second $ Pairs.first $ var "nodesVisitedIds1",+ "ids1">: Pairs.second $ var "nodesVisitedIds1", -- Second fold: process each binding term "addBindingTerm">: lambdas ["currentState", "nodeBinding"] $ lets [- "root">: first $ var "nodeBinding",- "binding">: second $ var "nodeBinding",+ "root">: Pairs.first $ var "nodeBinding",+ "binding">: Pairs.second $ var "nodeBinding", "term1">: Core.bindingTerm $ var "binding"]- $ var "helper" @@ var "ids1" @@ just (var "root") @@ list [] @@ var "currentState" @@+ $ var "helper" @@ var "ids1" @@ just (var "root") @@ list ([] :: [TTerm TermAccessor]) @@ var "currentState" @@ pair (var "dontCareAccessor") (var "term1"), "nodeBindingPairs">: Lists.zip (var "nodes1") (var "bindings"), "stateAfterBindings">: Lists.foldl@@ -145,11 +159,11 @@ (pair (pair (Lists.concat2 (var "nodes1") (var "nodes")) (var "edges")) (var "visited1")) (var "nodeBindingPairs")] $ var "helper" @@ var "ids1" @@ var "mroot" @@ var "nextPath" @@ var "stateAfterBindings" @@- pair Mantle.termAccessorLetEnvironment (var "env"),+ pair Accessors.termAccessorLetEnvironment (var "env"), _Term_variable>>: lambda "name" $- Optionals.maybe (var "state")+ Maybes.maybe (var "state") (lambda "root" $- Optionals.maybe (var "state")+ Maybes.maybe (var "state") (lambda "node" $ lets [ "edge">: Accessors.accessorEdge (var "root") (Accessors.accessorPath $ Lists.reverse $ var "nextPath") (var "node"),@@ -158,10 +172,10 @@ (Maps.lookup (var "name") (var "ids"))) (var "mroot")] @@ var "currentTerm",- "initialState">: pair (pair (list []) (list [])) Sets.empty,- "result">: var "helper" @@ Maps.empty @@ nothing @@ list [] @@ var "initialState" @@+ "initialState">: pair (pair (list ([] :: [TTerm AccessorNode])) (list ([] :: [TTerm AccessorEdge]))) Sets.empty,+ "result">: var "helper" @@ Maps.empty @@ nothing @@ list ([] :: [TTerm TermAccessor]) @@ var "initialState" @@ pair (var "dontCareAccessor") (var "term"),- "finalNodesEdges">: first $ var "result",- "finalNodes">: first $ var "finalNodesEdges",- "finalEdges">: second $ var "finalNodesEdges"]- $ Accessors.accessorGraph (var "finalNodes") (var "finalEdges")+ "finalNodesEdges">: Pairs.first $ var "result",+ "finalNodes">: Pairs.first $ var "finalNodesEdges",+ "finalEdges">: Pairs.second $ var "finalNodesEdges"] $+ Accessors.accessorGraph (var "finalNodes") (var "finalEdges")
src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Core.hs view
@@ -1,178 +1,203 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Show.Core where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules (slightly modified for conflict avoidance)+import Hydra.Kernel hiding (literalType) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding (+ binding, elimination, field, fields, fieldType, floatType, floatValue, function, injection, integerType,+ integerValue, lambda, literal, literalType, term, type_, typeScheme)+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.show.core"+ module_ :: Module-module_ = Module (Namespace "hydra.show.core") elements+module_ = Module ns elements []- kernelTypesModules $+ kernelTypesNamespaces $ Just "String representations of hydra.core types" where elements = [- el readTermDef, -- TODO: move this to hydra.read.core- el bindingDef,- el eliminationDef,- el fieldsDef,- el floatValueDef,- el floatTypeDef,- el functionDef,- el injectionDef,- el integerValueDef,- el integerTypeDef,- el lambdaDef,- el listDef,- el literalDef,- el literalTypeDef,- el termDef,- el typeDef,- el typeSchemeDef]+ toBinding readTerm, -- TODO: move this to hydra.read.core+ toBinding binding,+ toBinding elimination,+ toBinding field,+ toBinding fieldType,+ toBinding fields,+ toBinding floatValue,+ toBinding floatType,+ toBinding function,+ toBinding injection,+ toBinding integerValue,+ toBinding integerType,+ toBinding lambda,+ toBinding let_,+ toBinding list_,+ toBinding literal,+ toBinding literalType,+ toBinding term,+ toBinding type_,+ toBinding typeScheme] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -readTermDef :: TBinding (String -> Maybe Term)-readTermDef = define "readTerm" $+readTerm :: TBinding (String -> Maybe Term)+readTerm = define "readTerm" $ doc "A placeholder for reading terms from their serialized form. Not implemented." $- constant nothing+ "s" ~> just $ Core.termLiteral $ Core.literalString $ var "s" -bindingDef :: TBinding (Binding -> String)-bindingDef = define "binding" $+binding :: TBinding (Binding -> String)+binding = define "binding" $ doc "Show a binding as a string" $- lambda "el" $ lets [- "name">: unwrap _Name @@ (Core.bindingName $ var "el"),- "t">: Core.bindingTerm $ var "el",- "typeStr">: Optionals.maybe- (string "")- (lambda "ts" $ Strings.cat2 (string " : ") (ref typeSchemeDef @@ var "ts"))- (Core.bindingType $ var "el")] $- Strings.cat $ list [- var "name",- string " = ",- ref termDef @@ var "t",- var "typeStr"]+ "el" ~>+ "name" <~ unwrap _Name @@ (Core.bindingName $ var "el") $+ "t" <~ Core.bindingTerm (var "el") $+ "typeStr" <~ Maybes.maybe+ (string "")+ ("ts" ~> Strings.concat [string ":(", typeScheme @@ var "ts", string ")"])+ (Core.bindingType $ var "el") $+ Strings.cat $ list [+ var "name",+ var "typeStr",+ string " = ",+ term @@ var "t"] -eliminationDef :: TBinding (Elimination -> String)-eliminationDef = define "elimination" $+elimination :: TBinding (Elimination -> String)+elimination = define "elimination" $ doc "Show an elimination as a string" $- lambda "elm" $ cases _Elimination (var "elm") Nothing [- _Elimination_product>>: lambda "tp" $ lets [- "arity">: Core.tupleProjectionArity $ var "tp",- "index">: Core.tupleProjectionIndex $ var "tp",- "domain">: Core.tupleProjectionDomain $ var "tp"] $ -- TODO: show domain if present- Strings.cat $ list [- string "[",- Literals.showInt32 $ var "index",- string "/",- Literals.showInt32 $ var "arity",- string "]"],- _Elimination_record>>: lambda "proj" $ lets [- "tname">: unwrap _Name @@ (Core.projectionTypeName $ var "proj"),- "fname">: unwrap _Name @@ (Core.projectionField $ var "proj")] $+ "elm" ~>+ cases _Elimination (var "elm") Nothing [+ _Elimination_record>>: "proj" ~>+ "tname" <~ unwrap _Name @@ (Core.projectionTypeName $ var "proj") $+ "fname" <~ unwrap _Name @@ (Core.projectionField $ var "proj") $ Strings.cat $ list [ string "project(", var "tname", string "){", var "fname", string "}"],- _Elimination_union>>: lambda "cs" $ lets [- "tname">: unwrap _Name @@ (Core.caseStatementTypeName $ var "cs"),- "mdef">: Core.caseStatementDefault $ var "cs",- "cases">: Core.caseStatementCases $ var "cs",- "defaultField">: Optionals.maybe- (list [])- (lambda "d" $ list [Core.field (Core.name $ string "[default]") (var "d")])- (var "mdef"),- "allFields">: Lists.concat $ list [var "cases", var "defaultField"]] $+ _Elimination_union>>: "cs" ~>+ "tname" <~ unwrap _Name @@ (Core.caseStatementTypeName $ var "cs") $+ "mdef" <~ Core.caseStatementDefault (var "cs") $+ "cases" <~ Core.caseStatementCases (var "cs") $+ "defaultField" <~ Maybes.maybe+ (list ([] :: [TTerm Field]))+ ("d" ~> list [Core.field (Core.name $ string "[default]") (var "d")])+ (var "mdef") $+ "allFields" <~ Lists.concat (list [var "cases", var "defaultField"]) $ Strings.cat $ list [ string "case(", var "tname", string ")",- ref fieldsDef @@ var "allFields"],- _Elimination_wrap>>: lambda "tname" $ Strings.cat $ list [+ fields @@ var "allFields"],+ _Elimination_wrap>>: "tname" ~> Strings.cat $ list [ string "unwrap(", unwrap _Name @@ var "tname", string ")"]] -fieldsDef :: TBinding ([Field] -> String)-fieldsDef = define "fields" $+field :: TBinding (Field -> String)+field = define "field" $+ "field" ~>+ "fname" <~ unwrap _Name @@ (Core.fieldName $ var "field") $+ "fterm" <~ Core.fieldTerm (var "field") $+ Strings.cat $ list [var "fname", string "=", term @@ var "fterm"]++fieldType :: TBinding (FieldType -> String)+fieldType = define "fieldType" $+ "ft" ~>+ "fname" <~ unwrap _Name @@ (Core.fieldTypeName $ var "ft") $+ "ftyp" <~ Core.fieldTypeType (var "ft") $+ Strings.cat $ list [+ var "fname",+ string ":",+ type_ @@ var "ftyp"]++fields :: TBinding ([Field] -> String)+fields = define "fields" $ doc "Show a list of fields as a string" $- lambda "flds" $ lets [- "showField">: lambda "field" $ lets [- "fname">: unwrap _Name @@ (Core.fieldName $ var "field"),- "fterm">: Core.fieldTerm $ var "field"] $- Strings.cat2 (var "fname") $ Strings.cat2 (string "=") (ref termDef @@ var "fterm"),- "fieldStrs">: Lists.map (var "showField") (var "flds")] $- Strings.cat $ list [- string "{",- Strings.intercalate (string ", ") (var "fieldStrs"),- string "}"]+ "flds" ~>+ "fieldStrs" <~ Lists.map field (var "flds") $+ Strings.cat $ list [+ string "{",+ Strings.intercalate (string ", ") (var "fieldStrs"),+ string "}"] -floatValueDef :: TBinding (FloatValue -> String)-floatValueDef = define "float" $+floatValue :: TBinding (FloatValue -> String)+floatValue = define "float" $ doc "Show a float value as a string" $- lambda "fv" $ cases _FloatValue (var "fv") Nothing [- _FloatValue_bigfloat>>: "v" ~> Literals.showBigfloat (var "v") ++ ":bigfloat",- _FloatValue_float32>>: "v" ~> Literals.showFloat32 (var "v") ++ ":float32",- _FloatValue_float64>>: "v" ~> Literals.showFloat64 (var "v") ++ ":float64"]+ "fv" ~> cases _FloatValue (var "fv") Nothing [+ _FloatValue_bigfloat>>: "v" ~> Literals.showBigfloat (var "v") ++ (string ":bigfloat"),+ _FloatValue_float32>>: "v" ~> Literals.showFloat32 (var "v") ++ (string ":float32"),+ _FloatValue_float64>>: "v" ~> Literals.showFloat64 (var "v") ++ (string ":float64")] -floatTypeDef :: TBinding (FloatType -> String)-floatTypeDef = define "floatType" $+floatType :: TBinding (FloatType -> String)+floatType = define "floatType" $ doc "Show a float type as a string" $- lambda "ft" $ cases _FloatType (var "ft") Nothing [+ "ft" ~> cases _FloatType (var "ft") Nothing [ _FloatType_bigfloat>>: constant $ string "bigfloat", _FloatType_float32>>: constant $ string "float32", _FloatType_float64>>: constant $ string "float64"] -functionDef :: TBinding (Function -> String)-functionDef = define "function" $+function :: TBinding (Function -> String)+function = define "function" $ doc "Show a function as a string" $- lambda "f" $ cases _Function (var "f") Nothing [- _Function_elimination>>: ref eliminationDef,- _Function_lambda>>: ref lambdaDef,- _Function_primitive>>: lambda "name" $ Strings.cat2 (unwrap _Name @@ var "name") (string "!")]+ "f" ~> cases _Function (var "f") Nothing [+ _Function_elimination>>: elimination,+ _Function_lambda>>: lambda,+ _Function_primitive>>: "name" ~> Strings.cat2 (unwrap _Name @@ var "name") (string "!")] -injectionDef :: TBinding (Injection -> String)-injectionDef = define "injection" $+injection :: TBinding (Injection -> String)+injection = define "injection" $ doc "Show an injection as a string" $ "inj" ~> "tname" <~ Core.injectionTypeName (var "inj") $@@ -181,26 +206,26 @@ string "inject(", unwrap _Name @@ var "tname", string ")",- ref fieldsDef @@ (list [var "f"])]+ fields @@ (list [var "f"])] -integerValueDef :: TBinding (IntegerValue -> String)-integerValueDef = define "integer" $+integerValue :: TBinding (IntegerValue -> String)+integerValue = define "integer" $ doc "Show an integer value as a string" $- lambda "iv" $ cases _IntegerValue (var "iv") Nothing [- _IntegerValue_bigint>>: "v" ~> Literals.showBigint (var "v") ++ ":bigint",- _IntegerValue_int8>>: "v" ~> Literals.showInt8 (var "v") ++ ":int8",- _IntegerValue_int16>>: "v" ~> Literals.showInt16 (var "v") ++ ":int16",- _IntegerValue_int32>>: "v" ~> Literals.showInt32 (var "v") ++ ":int32",- _IntegerValue_int64>>: "v" ~> Literals.showInt64 (var "v") ++ ":int64",- _IntegerValue_uint8>>: "v" ~> Literals.showUint8 (var "v") ++ ":uint8",- _IntegerValue_uint16>>: "v" ~> Literals.showUint16 (var "v") ++ ":uint16",- _IntegerValue_uint32>>: "v" ~> Literals.showUint32 (var "v") ++ ":uint32",- _IntegerValue_uint64>>: "v" ~> Literals.showUint64 (var "v") ++ ":uint64"]+ "iv" ~> cases _IntegerValue (var "iv") Nothing [+ _IntegerValue_bigint>>: "v" ~> Literals.showBigint (var "v") ++ (string ":bigint"),+ _IntegerValue_int8>>: "v" ~> Literals.showInt8 (var "v") ++ (string ":int8"),+ _IntegerValue_int16>>: "v" ~> Literals.showInt16 (var "v") ++ (string ":int16"),+ _IntegerValue_int32>>: "v" ~> Literals.showInt32 (var "v") ++ (string ":int32"),+ _IntegerValue_int64>>: "v" ~> Literals.showInt64 (var "v") ++ (string ":int64"),+ _IntegerValue_uint8>>: "v" ~> Literals.showUint8 (var "v") ++ (string ":uint8"),+ _IntegerValue_uint16>>: "v" ~> Literals.showUint16 (var "v") ++ (string ":uint16"),+ _IntegerValue_uint32>>: "v" ~> Literals.showUint32 (var "v") ++ (string ":uint32"),+ _IntegerValue_uint64>>: "v" ~> Literals.showUint64 (var "v") ++ (string ":uint64")] -integerTypeDef :: TBinding (IntegerType -> String)-integerTypeDef = define "integerType" $+integerType :: TBinding (IntegerType -> String)+integerType = define "integerType" $ doc "Show an integer type as a string" $- lambda "it" $ cases _IntegerType (var "it") Nothing [+ "it" ~> cases _IntegerType (var "it") Nothing [ _IntegerType_bigint>>: constant $ string "bigint", _IntegerType_int8>>: constant $ string "int8", _IntegerType_int16>>: constant $ string "int16",@@ -211,274 +236,282 @@ _IntegerType_uint32>>: constant $ string "uint32", _IntegerType_uint64>>: constant $ string "uint64"] -lambdaDef :: TBinding (Lambda -> String)-lambdaDef = define "lambda" $+lambda :: TBinding (Lambda -> String)+lambda = define "lambda" $ doc "Show a lambda as a string" $- lambda "l" $ lets [- "v">: unwrap _Name @@ (Core.lambdaParameter $ var "l"),- "mt">: Core.lambdaDomain $ var "l",- "body">: Core.lambdaBody $ var "l",- "typeStr">: Optionals.maybe- (string "")- (lambda "t" $ Strings.cat2 (string ":") (ref typeDef @@ var "t"))- (var "mt")] $- Strings.cat $ list [- string "λ",- var "v",- var "typeStr",- string ".",- ref termDef @@ var "body"]+ "l" ~>+ "v" <~ unwrap _Name @@ (Core.lambdaParameter $ var "l") $+ "mt" <~ Core.lambdaDomain (var "l") $+ "body" <~ Core.lambdaBody (var "l") $+ "typeStr" <~ Maybes.maybe+ (string "")+ ("t" ~> Strings.cat2 (string ":") (type_ @@ var "t"))+ (var "mt") $+ Strings.cat $ list [+ string "λ",+ var "v",+ var "typeStr",+ string ".",+ term @@ var "body"] -listDef :: TBinding ((a -> String) -> [a] -> String)-listDef = define "list" $+let_ :: TBinding (Let -> String)+let_ = define "let" $+ doc "Show a let expression as a string" $+ "l" ~>+ "bindings" <~ Core.letBindings (var "l") $+ "env" <~ Core.letBody (var "l") $+ "bindingStrs" <~ Lists.map binding (var "bindings") $+ Strings.cat $ list [+ string "let ",+ Strings.intercalate (string ", ") (var "bindingStrs"),+ string " in ",+ term @@ var "env"]++list_ :: TBinding ((a -> String) -> [a] -> String)+list_ = define "list" $ doc "Show a list using a given function to show each element" $- lambdas ["f", "xs"] $ lets [- "elementStrs">: Lists.map (var "f") (var "xs")] $- Strings.cat $ list [- string "[",- Strings.intercalate (string ", ") (var "elementStrs"),- string "]"]+ "f" ~> "xs" ~>+ "elementStrs" <~ Lists.map (var "f") (var "xs") $+ Strings.cat $ list [+ string "[",+ Strings.intercalate (string ", ") (var "elementStrs"),+ string "]"] -literalDef :: TBinding (Literal -> String)-literalDef = define "literal" $+literal :: TBinding (Literal -> String)+literal = define "literal" $ doc "Show a literal as a string" $- lambda "l" $ cases _Literal (var "l") Nothing [+ "l" ~> cases _Literal (var "l") Nothing [ _Literal_binary>>: constant $ string "[binary]",- _Literal_boolean>>: lambda "b" $ Logic.ifElse (var "b") (string "true") (string "false"),- _Literal_float>>: lambda "fv" $ ref floatValueDef @@ var "fv",- _Literal_integer>>: lambda "iv" $ ref integerValueDef @@ var "iv",- _Literal_string>>: lambda "s" $ Literals.showString $ var "s"]+ _Literal_boolean>>: "b" ~> Logic.ifElse (var "b") (string "true") (string "false"),+ _Literal_float>>: "fv" ~> floatValue @@ var "fv",+ _Literal_integer>>: "iv" ~> integerValue @@ var "iv",+ _Literal_string>>: "s" ~> Literals.showString $ var "s"] -literalTypeDef :: TBinding (LiteralType -> String)-literalTypeDef = define "literalType" $+literalType :: TBinding (LiteralType -> String)+literalType = define "literalType" $ doc "Show a literal type as a string" $- lambda "lt" $ cases _LiteralType (var "lt") Nothing [+ "lt" ~> cases _LiteralType (var "lt") Nothing [ _LiteralType_binary>>: constant $ string "binary", _LiteralType_boolean>>: constant $ string "boolean",- _LiteralType_float>>: lambda "ft" $ ref floatTypeDef @@ var "ft",- _LiteralType_integer>>: lambda "it" $ ref integerTypeDef @@ var "it",+ _LiteralType_float>>: "ft" ~> floatType @@ var "ft",+ _LiteralType_integer>>: "it" ~> integerType @@ var "it", _LiteralType_string>>: constant $ string "string"] -termDef :: TBinding (Term -> String)-termDef = define "term" $+term :: TBinding (Term -> String)+term = define "term" $ doc "Show a term as a string" $- lambda "t" $ lets [- "gatherTerms">: lambdas ["prev", "app"] $ lets [- "lhs">: Core.applicationFunction $ var "app",- "rhs">: Core.applicationArgument $ var "app"] $- cases _Term (var "lhs")- (Just $ Lists.cons (var "lhs") (Lists.cons (var "rhs") (var "prev"))) [- _Term_application>>: lambda "app2" $ var "gatherTerms" @@ (Lists.cons (var "rhs") (var "prev")) @@ var "app2"]] $- cases _Term (var "t") Nothing [- _Term_annotated>>: lambda "at" $ ref termDef @@ (Core.annotatedTermSubject $ var "at"),- _Term_application>>: lambda "app" $ lets [- "terms">: var "gatherTerms" @@ (list []) @@ var "app",- "termStrs">: Lists.map (ref termDef) (var "terms")] $- Strings.cat $ list [- string "(",- Strings.intercalate (string " @ ") (var "termStrs"),- string ")"],- _Term_function>>: ref functionDef,- _Term_let>>: lambda "l" $ lets [- "bindings">: Core.letBindings $ var "l",- "env">: Core.letEnvironment $ var "l",- "bindingStrs">: Lists.map (ref bindingDef) (var "bindings")] $- Strings.cat $ list [- string "let ",- Strings.intercalate (string ", ") (var "bindingStrs"),- string " in ",- ref termDef @@ var "env"],- _Term_list>>: lambda "els" $ lets [- "termStrs">: Lists.map (ref termDef) (var "els")] $- Strings.cat $ list [- string "[",- Strings.intercalate (string ", ") (var "termStrs"),- string "]"],- _Term_literal>>: lambda "lit" $ ref literalDef @@ var "lit",- _Term_map>>: lambda "m" $ lets [- "entry">: lambda "p" $ Strings.cat $ list [- ref termDef @@ (first $ var "p"),- string "=",- ref termDef @@ (second $ var "p")]] $- Strings.cat $ list [- string "{",- Strings.intercalate (string ", ") $ Lists.map (var "entry") $ Maps.toList $ var "m",- string "}"],- _Term_optional>>: lambda "mt" $ Optionals.maybe- (string "nothing")- (lambda "t" $ Strings.cat $ list [- string "just(",- ref termDef @@ var "t",- string ")"])- (var "mt"),- _Term_product>>: lambda "els" $ lets [- "termStrs">: Lists.map (ref termDef) (var "els")] $- Strings.cat $ list [- string "(",- Strings.intercalate (string ", ") (var "termStrs"),- string ")"],- _Term_record>>: lambda "rec" $ lets [- "tname">: unwrap _Name @@ (Core.recordTypeName $ var "rec"),- "flds">: Core.recordFields $ var "rec"] $- Strings.cat $ list [- string "record(",- var "tname",- string ")",- ref fieldsDef @@ var "flds"],- _Term_set>>: lambda "s" $- Strings.cat $ list [- string "{",- Strings.intercalate (string ", ") (Lists.map (ref termDef) $ Sets.toList $ var "s"),- string "}"],- _Term_sum>>: lambda "s" $ lets [- "index">: Core.sumIndex $ var "s",- "size">: Core.sumSize $ var "s",- "t2">: Core.sumTerm $ var "s"] $- Strings.cat $ list [- string "(",- Literals.showInt32 $ var "index",- string "/",- Literals.showInt32 $ var "size",- string "=",- ref termDef @@ var "t2",- string ")"],- _Term_typeLambda>>: lambda "ta" $ lets [- "param">: unwrap _Name @@ (Core.typeLambdaParameter $ var "ta"),- "body">: Core.typeLambdaBody $ var "ta"] $- Strings.cat $ list [- string "Λ",- var "param",- string ".",- ref termDef @@ var "body"],- _Term_typeApplication>>: lambda "tt" $ lets [- "t2">: Core.typedTermTerm $ var "tt",- "typ">: Core.typedTermType $ var "tt"] $- Strings.cat $ list [- ref termDef @@ var "t2",- string "⟨",- ref typeDef @@ var "typ",- string "⟩"],- _Term_union>>: ref injectionDef,- _Term_unit>>: constant $ string "unit",- _Term_variable>>: lambda "name" $ unwrap _Name @@ var "name",- _Term_wrap>>: lambda "wt" $ lets [- "tname">: unwrap _Name @@ (Core.wrappedTermTypeName $ var "wt"),- "term1">: Core.wrappedTermObject $ var "wt"] $- Strings.cat $ list [- string "wrap(",- var "tname",- string "){",- ref termDef @@ var "term1",- string "}"]]--typeDef :: TBinding (Type -> String)-typeDef = define "type" $- doc "Show a type as a string" $- lambda "typ" $ lets [- "showFieldType">: lambda "ft" $ lets [- "fname">: unwrap _Name @@ (Core.fieldTypeName $ var "ft"),- "ftyp">: Core.fieldTypeType $ var "ft"] $+ "t" ~>+ "gatherTerms" <~ ("prev" ~> "app" ~>+ "lhs" <~ Core.applicationFunction (var "app") $+ "rhs" <~ Core.applicationArgument (var "app") $+ cases _Term (var "lhs")+ (Just $ Lists.cons (var "lhs") (Lists.cons (var "rhs") (var "prev"))) [+ _Term_application>>: "app2" ~> var "gatherTerms" @@ (Lists.cons (var "rhs") (var "prev")) @@ var "app2"]) $+ cases _Term (var "t") Nothing [+ _Term_annotated>>: "at" ~> term @@ (Core.annotatedTermBody $ var "at"),+ _Term_application>>: "app" ~>+ "terms" <~ var "gatherTerms" @@ (list ([] :: [TTerm Term])) @@ var "app" $+ "termStrs" <~ Lists.map term (var "terms") $ Strings.cat $ list [- var "fname",- string ":",- ref typeDef @@ var "ftyp"],- "showRowType">: lambda "rt" $ lets [- "flds">: Core.rowTypeFields $ var "rt",- "fieldStrs">: Lists.map (var "showFieldType") (var "flds")] $+ string "(",+ Strings.intercalate (string " @ ") (var "termStrs"),+ string ")"],+ _Term_either>>: "e" ~> Eithers.either_+ ("l" ~> Strings.cat $ list [+ string "left(",+ term @@ var "l",+ string ")"])+ ("r" ~> Strings.cat $ list [+ string "right(",+ term @@ var "r",+ string ")"])+ (var "e"),+ _Term_function>>: function,+ _Term_let>>: "l" ~> let_ @@ var "l",+ _Term_list>>: "els" ~>+ "termStrs" <~ Lists.map term (var "els") $ Strings.cat $ list [+ string "[",+ Strings.intercalate (string ", ") (var "termStrs"),+ string "]"],+ _Term_literal>>: "lit" ~> literal @@ var "lit",+ _Term_map>>: "m" ~>+ "entry" <~ ("p" ~> Strings.cat $ list [+ term @@ (Pairs.first $ var "p"),+ string "=",+ term @@ (Pairs.second $ var "p")]) $+ Strings.cat $ list [ string "{",- Strings.intercalate (string ", ") (var "fieldStrs"),+ Strings.intercalate (string ", ") $ Lists.map (var "entry") $ Maps.toList $ var "m", string "}"],- "gatherTypes">: lambdas ["prev", "app"] $ lets [- "lhs">: Core.applicationTypeFunction $ var "app",- "rhs">: Core.applicationTypeArgument $ var "app"] $- cases _Type (var "lhs")- (Just $ Lists.cons (var "lhs") (Lists.cons (var "rhs") (var "prev"))) [- _Type_application>>: lambda "app2" $ var "gatherTypes" @@ (Lists.cons (var "rhs") (var "prev")) @@ var "app2"],- "gatherFunctionTypes">: lambdas ["prev", "t"] $- cases _Type (var "t")- (Just $ Lists.reverse $ Lists.cons (var "t") (var "prev")) [- _Type_function>>: lambda "ft" $ lets [- "dom">: Core.functionTypeDomain $ var "ft",- "cod">: Core.functionTypeCodomain $ var "ft"] $- var "gatherFunctionTypes" @@ (Lists.cons (var "dom") (var "prev")) @@ var "cod"]] $- cases _Type (var "typ") Nothing [- _Type_annotated>>: lambda "at" $ ref typeDef @@ (Core.annotatedTypeSubject $ var "at"),- _Type_application>>: lambda "app" $ lets [- "types">: var "gatherTypes" @@ (list []) @@ var "app",- "typeStrs">: Lists.map (ref typeDef) (var "types")] $- Strings.cat $ list [- string "(",- Strings.intercalate (string " @ ") (var "typeStrs"),- string ")"],- _Type_forall>>: lambda "ft" $ lets [- "var">: unwrap _Name @@ (Core.forallTypeParameter $ var "ft"),- "body">: Core.forallTypeBody $ var "ft"] $- Strings.cat $ list [- string "(∀",- var "var",- string ".",- ref typeDef @@ var "body",- string ")"],- _Type_function>>: lambda "ft" $ lets [- "types">: var "gatherFunctionTypes" @@ (list []) @@ var "typ",- "typeStrs">: Lists.map (ref typeDef) (var "types")] $- Strings.cat $ list [- string "(",- Strings.intercalate (string " → ") (var "typeStrs"),- string ")"],- _Type_list>>: lambda "etyp" $ Strings.cat $ list [- string "list<",- ref typeDef @@ var "etyp",- string ">"],- _Type_literal>>: lambda "lt" $ ref literalTypeDef @@ var "lt",- _Type_map>>: lambda "mt" $ lets [- "keyTyp">: Core.mapTypeKeys $ var "mt",- "valTyp">: Core.mapTypeValues $ var "mt"] $- Strings.cat $ list [- string "map<",- ref typeDef @@ var "keyTyp",- string ", ",- ref typeDef @@ var "valTyp",- string ">"],- _Type_optional>>: lambda "etyp" $ Strings.cat $ list [- string "optional<",- ref typeDef @@ var "etyp",+ _Term_maybe>>: "mt" ~> Maybes.maybe+ (string "nothing")+ ("t" ~> Strings.cat $ list [+ string "just(",+ term @@ var "t",+ string ")"])+ (var "mt"),+ _Term_pair>>: "p" ~> Strings.cat $ list [+ string "(",+ term @@ (Pairs.first $ var "p"),+ string ", ",+ term @@ (Pairs.second $ var "p"),+ string ")"],+ _Term_record>>: "rec" ~>+ "tname" <~ unwrap _Name @@ (Core.recordTypeName $ var "rec") $+ "flds" <~ Core.recordFields (var "rec") $+ Strings.cat $ list [+ string "record(",+ var "tname",+ string ")",+ fields @@ var "flds"],+ _Term_set>>: "s" ~>+ Strings.cat $ list [+ string "{",+ Strings.intercalate (string ", ") (Lists.map term $ Sets.toList $ var "s"),+ string "}"],+ _Term_typeLambda>>: "ta" ~>+ "param" <~ unwrap _Name @@ (Core.typeLambdaParameter $ var "ta") $+ "body" <~ Core.typeLambdaBody (var "ta") $+ Strings.cat $ list [+ string "Λ",+ var "param",+ string ".",+ term @@ var "body"],+ _Term_typeApplication>>: "tt" ~>+ "t2" <~ Core.typeApplicationTermBody (var "tt") $+ "typ" <~ Core.typeApplicationTermType (var "tt") $+ Strings.cat $ list [+ term @@ var "t2",+ string "⟨",+ type_ @@ var "typ",+ string "⟩"],+ _Term_union>>: injection,+ _Term_unit>>: constant $ string "unit",+ _Term_variable>>: "name" ~> unwrap _Name @@ var "name",+ _Term_wrap>>: "wt" ~>+ "tname" <~ unwrap _Name @@ (Core.wrappedTermTypeName $ var "wt") $+ "term1" <~ Core.wrappedTermBody (var "wt") $+ Strings.cat $ list [+ string "wrap(",+ var "tname",+ string "){",+ term @@ var "term1",+ string "}"]]++type_ :: TBinding (Type -> String)+type_ = define "type" $+ doc "Show a type as a string" $+ "typ" ~>+ "showRowType" <~ ("rt" ~>+ "flds" <~ Core.rowTypeFields (var "rt") $+ "fieldStrs" <~ Lists.map fieldType (var "flds") $+ Strings.cat $ list [+ string "{",+ Strings.intercalate (string ", ") (var "fieldStrs"),+ string "}"]) $+ "gatherTypes" <~ ("prev" ~> "app" ~>+ "lhs" <~ Core.applicationTypeFunction (var "app") $+ "rhs" <~ Core.applicationTypeArgument (var "app") $+ cases _Type (var "lhs")+ (Just $ Lists.cons (var "lhs") (Lists.cons (var "rhs") (var "prev"))) [+ _Type_application>>: "app2" ~> var "gatherTypes" @@ (Lists.cons (var "rhs") (var "prev")) @@ var "app2"]) $+ "gatherFunctionTypes" <~ ("prev" ~> "t" ~>+ cases _Type (var "t")+ (Just $ Lists.reverse $ Lists.cons (var "t") (var "prev")) [+ _Type_function>>: "ft" ~>+ "dom" <~ Core.functionTypeDomain (var "ft") $+ "cod" <~ Core.functionTypeCodomain (var "ft") $+ var "gatherFunctionTypes" @@ (Lists.cons (var "dom") (var "prev")) @@ var "cod"]) $+ cases _Type (var "typ") Nothing [+ _Type_annotated>>: "at" ~> type_ @@ (Core.annotatedTypeBody $ var "at"),+ _Type_application>>: "app" ~>+ "types" <~ var "gatherTypes" @@ (list ([] :: [TTerm Type])) @@ var "app" $+ "typeStrs" <~ Lists.map type_ (var "types") $+ Strings.cat $ list [+ string "(",+ Strings.intercalate (string " @ ") (var "typeStrs"),+ string ")"],+ _Type_either>>: "et" ~>+ "leftTyp" <~ Core.eitherTypeLeft (var "et") $+ "rightTyp" <~ Core.eitherTypeRight (var "et") $+ Strings.cat $ list [+ string "either<",+ type_ @@ var "leftTyp",+ string ", ",+ type_ @@ var "rightTyp", string ">"],- _Type_product>>: lambda "types" $ lets [- "typeStrs">: Lists.map (ref typeDef) (var "types")] $- Strings.intercalate (string "×") (var "typeStrs"),- _Type_record>>: lambda "rt" $ Strings.cat2 (string "record") (var "showRowType" @@ var "rt"),- _Type_set>>: lambda "etyp" $ Strings.cat $ list [- string "set<",- ref typeDef @@ var "etyp",+ _Type_forall>>: "ft" ~>+ "var" <~ unwrap _Name @@ (Core.forallTypeParameter $ var "ft") $+ "body" <~ Core.forallTypeBody (var "ft") $+ Strings.cat $ list [+ string "(∀",+ var "var",+ string ".",+ type_ @@ var "body",+ string ")"],+ _Type_function>>: "ft" ~>+ "types" <~ var "gatherFunctionTypes" @@ (list ([] :: [TTerm Type])) @@ var "typ" $+ "typeStrs" <~ Lists.map type_ (var "types") $+ Strings.cat $ list [+ string "(",+ Strings.intercalate (string " → ") (var "typeStrs"),+ string ")"],+ _Type_list>>: "etyp" ~> Strings.cat $ list [+ string "list<",+ type_ @@ var "etyp",+ string ">"],+ _Type_literal>>: "lt" ~> literalType @@ var "lt",+ _Type_map>>: "mt" ~>+ "keyTyp" <~ Core.mapTypeKeys (var "mt") $+ "valTyp" <~ Core.mapTypeValues (var "mt") $+ Strings.cat $ list [+ string "map<",+ type_ @@ var "keyTyp",+ string ", ",+ type_ @@ var "valTyp", string ">"],- _Type_sum>>: lambda "types" $ lets [- "typeStrs">: Lists.map (ref typeDef) (var "types")] $- Strings.intercalate (string "+") (var "typeStrs"),- _Type_union>>: lambda "rt" $ Strings.cat2 (string "union") (var "showRowType" @@ var "rt"),- _Type_unit>>: constant $ string "unit",- _Type_variable>>: lambda "name" $ unwrap _Name @@ var "name",- _Type_wrap>>: lambda "wt" $ lets [- "tname">: unwrap _Name @@ (Core.wrappedTypeTypeName $ var "wt"),- "typ1">: Core.wrappedTypeObject $ var "wt"] $- Strings.cat $ list [string "wrap[", var "tname", string "](", ref typeDef @@ var "typ1", string ")"]]+ _Type_maybe>>: "etyp" ~> Strings.cat $ list [+ string "maybe<",+ type_ @@ var "etyp",+ string ">"],+ _Type_pair>>: "pt" ~>+ "firstTyp" <~ Core.pairTypeFirst (var "pt") $+ "secondTyp" <~ Core.pairTypeSecond (var "pt") $+ Strings.cat $ list [+ string "(",+ type_ @@ var "firstTyp",+ string ", ",+ type_ @@ var "secondTyp",+ string ")"],+ _Type_record>>: "rt" ~> Strings.cat2 (string "record") (var "showRowType" @@ var "rt"),+ _Type_set>>: "etyp" ~> Strings.cat $ list [+ string "set<",+ type_ @@ var "etyp",+ string ">"],+ _Type_union>>: "rt" ~> Strings.cat2 (string "union") (var "showRowType" @@ var "rt"),+ _Type_unit>>: constant $ string "unit",+ _Type_variable>>: "name" ~> unwrap _Name @@ var "name",+ _Type_wrap>>: "wt" ~>+ "tname" <~ unwrap _Name @@ (Core.wrappedTypeTypeName $ var "wt") $+ "typ1" <~ Core.wrappedTypeBody (var "wt") $+ Strings.cat $ list [string "wrap[", var "tname", string "](", type_ @@ var "typ1", string ")"]] -typeSchemeDef :: TBinding (TypeScheme -> String)-typeSchemeDef = define "typeScheme" $+typeScheme :: TBinding (TypeScheme -> String)+typeScheme = define "typeScheme" $ doc "Show a type scheme as a string" $- lambda "ts" $ lets [- "vars">: Core.typeSchemeVariables $ var "ts",- "body">: Core.typeSchemeType $ var "ts",- "varNames">: Lists.map (unwrap _Name) (var "vars"),- "fa">: Logic.ifElse (Lists.null $ var "vars")- (string "")- (Strings.cat $ list [- string "∀[",- Strings.intercalate (string ",") (var "varNames"),- string "]."])] $- Strings.cat $ list [- string "(",- var "fa",- ref typeDef @@ var "body",- string ")"]+ "ts" ~>+ "vars" <~ Core.typeSchemeVariables (var "ts") $+ "body" <~ Core.typeSchemeType (var "ts") $+ "varNames" <~ Lists.map (unwrap _Name) (var "vars") $+ "fa" <~ Logic.ifElse (Lists.null $ var "vars")+ (string "")+ (Strings.cat $ list [+ string "∀[",+ Strings.intercalate (string ",") (var "varNames"),+ string "]."]) $+ Strings.cat $ list [+ string "(",+ var "fa",+ type_ @@ var "body",+ string ")"]
src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Graph.hs view
@@ -1,68 +1,82 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Terms.Show.Graph where --- Standard imports for term-level kernel modules+-- Standard imports for kernel terms modules import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations +ns :: Namespace+ns = Namespace "hydra.show.graph"+ module_ :: Module-module_ = Module (Namespace "hydra.show.graph") elements- [Annotations.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [ShowCore.ns]+ kernelTypesNamespaces $ Just "String representations of hydra.graph types" where elements = [- el graphDef]+ toBinding graph] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -graphDef :: TBinding (Graph -> String)-graphDef = define "graph" $+graph :: TBinding (Graph -> String)+graph = define "graph" $ doc "Show a graph as a string" $ lambda "graph" $ lets [- "elements">: Maps.elems $ Graph.graphElements $ var "graph",- "elementStrs">: Lists.map (ref ShowCore.bindingDef) (var "elements")] $+ "elements">: Graph.graphElements $ var "graph",+ "elementStrs">: Lists.map ShowCore.binding (var "elements")] $ Strings.cat $ list [ string "{", Strings.intercalate (string ", ") (var "elementStrs"),
− src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Mantle.hs
@@ -1,102 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Show.Mantle where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations---module_ :: Module-module_ = Module (Namespace "hydra.show.mantle") elements- [Annotations.module_]- kernelTypesModules $- Just "String representations of hydra.mantle types"- where- elements = [- el termVariantDef,- el typeVariantDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--termVariantDef :: TBinding (TermVariant -> String)-termVariantDef = define "termVariant" $- doc "Show a term variant as a string" $- match _TermVariant Nothing [- _TermVariant_annotated>>: constant $ string "annotated",- _TermVariant_application>>: constant $ string "application",- _TermVariant_function>>: constant $ string "function",- _TermVariant_let>>: constant $ string "let",- _TermVariant_list>>: constant $ string "list",- _TermVariant_literal>>: constant $ string "literal",- _TermVariant_map>>: constant $ string "map",- _TermVariant_optional>>: constant $ string "optional",- _TermVariant_product>>: constant $ string "product",- _TermVariant_record>>: constant $ string "record",- _TermVariant_set>>: constant $ string "set",- _TermVariant_sum>>: constant $ string "sum",- _TermVariant_typeLambda>>: constant $ string "typeLambda",- _TermVariant_typeApplication>>: constant $ string "typeApplication",- _TermVariant_union>>: constant $ string "union",- _TermVariant_unit>>: constant $ string "unit",- _TermVariant_variable>>: constant $ string "variable",- _TermVariant_wrap>>: constant $ string "wrap"]--typeVariantDef :: TBinding (TypeVariant -> String)-typeVariantDef = define "typeVariant" $- doc "Show a type variant as a string" $- match _TypeVariant Nothing [- _TypeVariant_annotated>>: constant $ string "annotated",- _TypeVariant_application>>: constant $ string "application",- _TypeVariant_forall>>: constant $ string "forall",- _TypeVariant_function>>: constant $ string "function",- _TypeVariant_list>>: constant $ string "list",- _TypeVariant_literal>>: constant $ string "literal",- _TypeVariant_map>>: constant $ string "map",- _TypeVariant_optional>>: constant $ string "optional",- _TypeVariant_product>>: constant $ string "product",- _TypeVariant_record>>: constant $ string "record",- _TypeVariant_set>>: constant $ string "set",- _TypeVariant_sum>>: constant $ string "sum",- _TypeVariant_union>>: constant $ string "union",- _TypeVariant_unit>>: constant $ string "unit",- _TypeVariant_variable>>: constant $ string "variable",- _TypeVariant_wrap>>: constant $ string "wrap"]
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Meta.hs view
@@ -0,0 +1,116 @@++module Hydra.Sources.Kernel.Terms.Show.Meta where++-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (termVariant, typeVariant)+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+++ns :: Namespace+ns = Namespace "hydra.show.meta"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces $+ Just "String representations of hydra.meta types"+ where+ elements = [+ toBinding termVariant,+ toBinding typeVariant]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++termVariant :: TBinding (TermVariant -> String)+termVariant = define "termVariant" $+ doc "Show a term variant as a string" $+ match _TermVariant Nothing [+ _TermVariant_annotated>>: constant $ string "annotated",+ _TermVariant_application>>: constant $ string "application",+ _TermVariant_either>>: constant $ string "either",+ _TermVariant_function>>: constant $ string "function",+ _TermVariant_let>>: constant $ string "let",+ _TermVariant_list>>: constant $ string "list",+ _TermVariant_literal>>: constant $ string "literal",+ _TermVariant_map>>: constant $ string "map",+ _TermVariant_maybe>>: constant $ string "maybe",+ _TermVariant_pair>>: constant $ string "pair",+ _TermVariant_record>>: constant $ string "record",+ _TermVariant_set>>: constant $ string "set",+ _TermVariant_typeLambda>>: constant $ string "typeLambda",+ _TermVariant_typeApplication>>: constant $ string "typeApplication",+ _TermVariant_union>>: constant $ string "union",+ _TermVariant_unit>>: constant $ string "unit",+ _TermVariant_variable>>: constant $ string "variable",+ _TermVariant_wrap>>: constant $ string "wrap"]++typeVariant :: TBinding (TypeVariant -> String)+typeVariant = define "typeVariant" $+ doc "Show a type variant as a string" $+ match _TypeVariant Nothing [+ _TypeVariant_annotated>>: constant $ string "annotated",+ _TypeVariant_application>>: constant $ string "application",+ _TypeVariant_either>>: constant $ string "either",+ _TypeVariant_forall>>: constant $ string "forall",+ _TypeVariant_function>>: constant $ string "function",+ _TypeVariant_list>>: constant $ string "list",+ _TypeVariant_literal>>: constant $ string "literal",+ _TypeVariant_map>>: constant $ string "map",+ _TypeVariant_maybe>>: constant $ string "maybe",+ _TypeVariant_pair>>: constant $ string "pair",+ _TypeVariant_record>>: constant $ string "record",+ _TypeVariant_set>>: constant $ string "set",+ _TypeVariant_union>>: constant $ string "union",+ _TypeVariant_unit>>: constant $ string "unit",+ _TypeVariant_variable>>: constant $ string "variable",+ _TypeVariant_wrap>>: constant $ string "wrap"]
src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Typing.hs view
@@ -1,87 +1,102 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Show.Typing where --- Standard imports for term-level kernel modules+-- Standard imports for kernel terms modules import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations +ns :: Namespace+ns = Namespace "hydra.show.typing"+ module_ :: Module-module_ = Module (Namespace "hydra.show.typing") elements- [Annotations.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [ShowCore.ns]+ kernelTypesNamespaces $ Just "String representations of hydra.typing types" where elements = [- el typeConstraintDef,- el typeSubstDef]+ toBinding typeConstraint,+ toBinding typeSubst] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -typeConstraintDef :: TBinding (TypeConstraint -> String)-typeConstraintDef = define "typeConstraint" $+typeConstraint :: TBinding (TypeConstraint -> String)+typeConstraint = define "typeConstraint" $ doc "Show a type constraint as a string" $ lambda "tc" $ lets [ "ltyp">: Typing.typeConstraintLeft $ var "tc", "rtyp">: Typing.typeConstraintRight $ var "tc"] $ Strings.cat $ list [- ref ShowCore.typeDef @@ var "ltyp",+ ShowCore.type_ @@ var "ltyp", string "≡",- ref ShowCore.typeDef @@ var "rtyp"]+ ShowCore.type_ @@ var "rtyp"] -typeSubstDef :: TBinding (TypeSubst -> String)-typeSubstDef = define "typeSubst" $+typeSubst :: TBinding (TypeSubst -> String)+typeSubst = define "typeSubst" $ doc "Show a type substitution as a string" $ lambda "ts" $ lets [ "subst">: Typing.unTypeSubst $ var "ts", "pairs">: Maps.toList $ var "subst", "showPair">: lambda "pair" $ lets [- "name">: unwrap _Name @@ (first $ var "pair"),- "typ">: second $ var "pair"] $+ "name">: unwrap _Name @@ (Pairs.first $ var "pair"),+ "typ">: Pairs.second $ var "pair"] $ Strings.cat $ list [ var "name", string "↦",- ref ShowCore.typeDef @@ var "typ"],+ ShowCore.type_ @@ var "typ"], "pairStrs">: Lists.map (var "showPair") (var "pairs")] $ Strings.cat $ list [ string "{",
+ src/main/haskell/Hydra/Sources/Kernel/Terms/Show/Util.hs view
@@ -0,0 +1,80 @@++module Hydra.Sources.Kernel.Terms.Show.Util where++-- Standard imports for kernel terms modules+import Hydra.Kernel+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants+import Hydra.Sources.Kernel.Types.All+import Prelude hiding ((++))+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y+++ns :: Namespace+ns = Namespace "hydra.show.util"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces $+ Just "String representations of hydra.util types"+ where+ elements = [+ toBinding caseConvention]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++caseConvention :: TBinding (CaseConvention -> String)+caseConvention = define "caseConvention" $+ doc "Show a case convention as a string" $+ "c" ~> cases _CaseConvention (var "c") Nothing [+ _CaseConvention_lowerSnake>>: constant (string "lower_snake_case"),+ _CaseConvention_upperSnake>>: constant (string "UPPER_SNAKE_CASE"),+ _CaseConvention_camel>>: constant (string "camelCase"),+ _CaseConvention_pascal>>: constant (string "PascalCase")]
src/main/haskell/Hydra/Sources/Kernel/Terms/Sorting.hs view
@@ -1,107 +1,180 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Sorting where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ adjacencyListToMap, createOrderingIsomorphism, findReachableNodes, propagateTags, topologicalSort,+ topologicalSortComponents, topologicalSortNodes) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Tarjan as Tarjan import qualified Hydra.Topology as Topo +ns :: Namespace+ns = Namespace "hydra.sorting"+ module_ :: Module-module_ = Module (Namespace "hydra.sorting") elements- [Tarjan.module_]- kernelTypesModules $+module_ = Module ns elements+ [Tarjan.ns]+ kernelTypesNamespaces $ Just ("Utilities for sorting.") where elements = [- el createOrderingIsomorphismDef,- el topologicalSortDef,- el topologicalSortComponentsDef,- el topologicalSortNodesDef]+ toBinding adjacencyListToMap,+ toBinding createOrderingIsomorphism,+ toBinding findReachableNodes,+ toBinding propagateTags,+ toBinding topologicalSort,+ toBinding topologicalSortComponents,+ toBinding topologicalSortNodes] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -createOrderingIsomorphismDef :: TBinding ([a] -> [a] -> Topo.OrderingIsomorphism b)-createOrderingIsomorphismDef = define "createOrderingIsomorphism" $- withOrd "t0" $ "sourceOrd" ~> "targetOrd" ~>+adjacencyListToMap :: TBinding ([(a, [b])] -> M.Map a [b])+adjacencyListToMap = define "adjacencyListToMap" $+ doc "Convert an adjacency list to a map, concatenating values for duplicate keys" $+ "pairs" ~>+ Lists.foldl+ ("mp" ~> "p" ~>+ "k" <~ Pairs.first (var "p") $+ "vs" <~ Pairs.second (var "p") $+ "existing" <~ Maybes.maybe (list ([] :: [TTerm a])) (unaryFunction Equality.identity) (Maps.lookup (var "k") (var "mp")) $+ Maps.insert (var "k") (Lists.concat2 (var "existing") (var "vs")) (var "mp"))+ Maps.empty+ (var "pairs")++createOrderingIsomorphism :: TBinding ([a] -> [a] -> Topo.OrderingIsomorphism b)+createOrderingIsomorphism = define "createOrderingIsomorphism" $+ "sourceOrd" ~> "targetOrd" ~> "sourceToTargetMapping" <~ ("els" ~> "mp" <~ Maps.fromList (Lists.zip (var "sourceOrd") (var "els")) $- Optionals.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "mp")) (var "targetOrd")) $+ Maybes.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "mp")) (var "targetOrd")) $ "targetToSourceMapping" <~ ("els" ~> "mp" <~ Maps.fromList (Lists.zip (var "targetOrd") (var "els")) $- Optionals.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "mp")) (var "sourceOrd")) $+ Maybes.cat $ Lists.map ("n" ~> Maps.lookup (var "n") (var "mp")) (var "sourceOrd")) $ Topology.orderingIsomorphism (var "sourceToTargetMapping") (var "targetToSourceMapping") -topologicalSortDef :: TBinding ([(a, [a])] -> Either [[a]] [a])-topologicalSortDef = define "topologicalSort" $+-- Note: not a sorting function+findReachableNodes :: TBinding ((a -> S.Set a) -> a -> S.Set a)+findReachableNodes = define "findReachableNodes" $+ doc "Given an adjacency function and a distinguished root node, find all reachable nodes (including the root node)" $+ "adj" ~> "root" ~>+ "visit" <~ ("visited" ~> "node" ~>+ "toVisit" <~ Sets.difference (var "adj" @@ var "node") (var "visited") $+ Logic.ifElse (Sets.null $ var "toVisit")+ (var "visited")+ (Lists.foldl+ ("v" ~> "n" ~> var "visit" @@ Sets.insert (var "n") (var "v") @@ var "n")+ (var "visited")+ (Sets.toList $ var "toVisit"))) $+ var "visit" @@ Sets.singleton (var "root") @@ var "root"++propagateTags :: TBinding ([(a, [a])] -> [(a, [t])] -> [(a, S.Set t)])+propagateTags = define "propagateTags" $+ doc ("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.") $+ "edges" ~> "nodeTags" ~>+ -- Build adjacency map+ "adjMap" <~ adjacencyListToMap @@ var "edges" $+ -- Build initial tag map: convert each [t] to Set t+ "tagMap" <~ Maps.map (unaryFunction Sets.fromList) (adjacencyListToMap @@ var "nodeTags") $+ -- Collect all nodes+ "allNodes" <~ Sets.toList (Sets.fromList $ Lists.concat2+ (Lists.map (unaryFunction Pairs.first) (var "edges"))+ (Lists.map (unaryFunction Pairs.first) (var "nodeTags"))) $+ -- For each node, find all reachable nodes and collect their tags+ "getTagsForNode" <~ ("node" ~>+ "reachable" <~ findReachableNodes+ @@ ("n" ~> Sets.fromList $ Maybes.maybe (list ([] :: [TTerm a])) (unaryFunction Equality.identity) (Maps.lookup (var "n") (var "adjMap")))+ @@ var "node" $+ Sets.unions $ Lists.map+ ("n" ~> Maybes.maybe Sets.empty (unaryFunction Equality.identity) (Maps.lookup (var "n") (var "tagMap")))+ (Sets.toList $ var "reachable")) $+ Lists.map ("n" ~> pair (var "n") (var "getTagsForNode" @@ var "n")) (var "allNodes")++topologicalSort :: TBinding ([(a, [a])] -> Either [[a]] [a])+topologicalSort = define "topologicalSort" $ doc ("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.") $- withOrd "t0" $ "pairs" ~>- "sccs" <~ ref topologicalSortComponentsDef @@ var "pairs" $+ "pairs" ~>+ "sccs" <~ topologicalSortComponents @@ var "pairs" $ "isCycle" <~ ("scc" ~> Logic.not $ Lists.null $ Lists.tail $ var "scc") $ "withCycles" <~ Lists.filter (var "isCycle") (var "sccs") $ Logic.ifElse (Lists.null $ var "withCycles")- (Mantle.eitherRight $ Lists.concat $ var "sccs")- (Mantle.eitherLeft $ var "withCycles")+ (right $ Lists.concat $ var "sccs")+ (left $ var "withCycles") -topologicalSortComponentsDef :: TBinding ([(a, [a])] -> [[a]])-topologicalSortComponentsDef = define "topologicalSortComponents" $+topologicalSortComponents :: TBinding ([(a, [a])] -> [[a]])+topologicalSortComponents = define "topologicalSortComponents" $ doc ("Find the strongly connected components (including cycles and isolated vertices) of a graph," <> " in (reverse) topological order, i.e. dependencies before dependents") $- withOrd "t0" $ "pairs" ~>- "graphResult" <~ ref Tarjan.adjacencyListsToGraphDef @@ var "pairs" $- "g" <~ first (var "graphResult") $- "getKey" <~ second (var "graphResult") $- Lists.map ("comp" ~> Lists.map (var "getKey") (var "comp")) $- ref Tarjan.stronglyConnectedComponentsDef @@ var "g"+ "pairs" ~>+ "graphResult" <~ Tarjan.adjacencyListsToGraph @@ var "pairs" $+ "g" <~ Pairs.first (var "graphResult") $+ Lists.map ("comp" ~> Lists.map (Pairs.second $ var "graphResult") (var "comp")) $+ Tarjan.stronglyConnectedComponents @@ var "g" -topologicalSortNodesDef :: TBinding ((x -> a) -> (x -> [a]) -> [x] -> [[x]])-topologicalSortNodesDef = define "topologicalSortNodes" $+topologicalSortNodes :: TBinding ((x -> a) -> (x -> [a]) -> [x] -> [[x]])+topologicalSortNodes = define "topologicalSortNodes" $ doc ("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.") $- withOrd "t1" $ "getKey" ~> "getAdj" ~> "nodes" ~>+ "getKey" ~> "getAdj" ~> "nodes" ~> "nodesByKey" <~ Maps.fromList (Lists.map ("n" ~> pair (var "getKey" @@ var "n") (var "n")) (var "nodes")) $ "pairs" <~ Lists.map ("n" ~> pair (var "getKey" @@ var "n") (var "getAdj" @@ var "n")) (var "nodes") $- "comps" <~ ref topologicalSortComponentsDef @@ var "pairs" $- Lists.map ("c" ~> Optionals.cat $ Lists.map ("k" ~> Maps.lookup (var "k") (var "nodesByKey")) (var "c")) (var "comps")+ "comps" <~ topologicalSortComponents @@ var "pairs" $+ Lists.map ("c" ~> Maybes.cat $ Lists.map ("k" ~> Maps.lookup (var "k") (var "nodesByKey")) (var "c")) (var "comps")
src/main/haskell/Hydra/Sources/Kernel/Terms/Substitution.hs view
@@ -1,204 +1,312 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Substitution where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (+ composeTypeSubst, composeTypeSubstNonEmpty, composeTypeSubstList, idTypeSubst, singletonTypeSubst, substituteInBinding,+ substituteInConstraint, substituteInConstraints, substInClassConstraints, substInContext, substituteInTerm,+ substInType, substInTypeNonEmpty, substInTypeScheme, substTypesInTerm) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting ++ns :: Namespace+ns = Namespace "hydra.substitution"+ module_ :: Module-module_ = Module (Namespace "hydra.substitution") elements- [Rewriting.module_]- kernelTypesModules $+module_ = Module ns elements+ [Rewriting.ns]+ kernelTypesNamespaces $ Just ("Variable substitution in type and term expressions.") where elements = [- el composeTypeSubstDef,- el composeTypeSubstListDef,- el idTypeSubstDef,- el singletonTypeSubstDef,- el substituteInConstraintDef,- el substituteInConstraintsDef,- el substInContextDef,- el substituteInTermDef,- el substInTypeDef,- el substInTypeSchemeDef,- el substTypesInTermDef]+ toBinding composeTypeSubst,+ toBinding composeTypeSubstNonEmpty,+ toBinding composeTypeSubstList,+ toBinding idTypeSubst,+ toBinding singletonTypeSubst,+ toBinding substituteInBinding,+ toBinding substituteInConstraint,+ toBinding substituteInConstraints,+ toBinding substInClassConstraints,+ toBinding substInContext,+ toBinding substituteInTerm,+ toBinding substInType,+ toBinding substInTypeNonEmpty,+ toBinding substInTypeScheme,+ toBinding substTypesInTerm] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -composeTypeSubstDef :: TBinding (TypeSubst -> TypeSubst -> TypeSubst)-composeTypeSubstDef = define "composeTypeSubst" $+composeTypeSubst :: TBinding (TypeSubst -> TypeSubst -> TypeSubst)+composeTypeSubst = define "composeTypeSubst" $+ doc "Compose two type substitutions" $+ lambdas ["s1", "s2"] $+ -- Short-circuit: if s1 is empty, return s2+ Logic.ifElse (Maps.null $ Typing.unTypeSubst $ var "s1")+ (var "s2") $+ -- Short-circuit: if s2 is empty, return s1+ Logic.ifElse (Maps.null $ Typing.unTypeSubst $ var "s2")+ (var "s1") $+ -- Otherwise, compose normally+ composeTypeSubstNonEmpty @@ var "s1" @@ var "s2"++-- | Helper for composeTypeSubst when both substitutions are non-empty+composeTypeSubstNonEmpty :: TBinding (TypeSubst -> TypeSubst -> TypeSubst)+composeTypeSubstNonEmpty = define "composeTypeSubstNonEmpty" $+ doc "Compose two non-empty type substitutions (internal helper)" $ lambdas ["s1", "s2"] $ lets [- "isExtra">: lambdas ["k", "v"] $ Optionals.isNothing (Maps.lookup (var "k") (Typing.unTypeSubst $ var "s1")),+ "isExtra">: lambdas ["k", "v"] $ Maybes.isNothing (Maps.lookup (var "k") (Typing.unTypeSubst $ var "s1")), "withExtra">: Maps.filterWithKey (var "isExtra") (Typing.unTypeSubst $ var "s2")] $- Typing.typeSubst $ Maps.union (var "withExtra") $ Maps.map (ref substInTypeDef @@ var "s2") $ Typing.unTypeSubst $ var "s1"+ Typing.typeSubst $ Maps.union (var "withExtra") $ Maps.map (substInType @@ var "s2") $ Typing.unTypeSubst $ var "s1" -composeTypeSubstListDef :: TBinding ([TypeSubst] -> TypeSubst)-composeTypeSubstListDef = define "composeTypeSubstList" $- Phantoms.fold (ref composeTypeSubstDef) @@ ref idTypeSubstDef+composeTypeSubstList :: TBinding ([TypeSubst] -> TypeSubst)+composeTypeSubstList = define "composeTypeSubstList" $+ doc "Compose a list of type substitutions" $+ Phantoms.fold (composeTypeSubst) @@ idTypeSubst -idTypeSubstDef :: TBinding TypeSubst-idTypeSubstDef = define "idTypeSubst" $+idTypeSubst :: TBinding TypeSubst+idTypeSubst = define "idTypeSubst" $+ doc "The identity type substitution" $ Typing.typeSubst Maps.empty -singletonTypeSubstDef :: TBinding (Name -> Type -> TypeSubst)-singletonTypeSubstDef = define "singletonTypeSubst" $+singletonTypeSubst :: TBinding (Name -> Type -> TypeSubst)+singletonTypeSubst = define "singletonTypeSubst" $+ doc "Create a type substitution with a single variable mapping" $ lambdas ["v", "t"] $ Typing.typeSubst $ Maps.singleton (var "v") (var "t") -substituteInConstraintDef :: TBinding (TypeSubst -> TypeConstraint -> TypeConstraint)-substituteInConstraintDef = define "substituteInConstraint" $+substituteInBinding :: TBinding (TermSubst -> Binding -> Binding)+substituteInBinding = define "substituteInBinding" $+ doc "Apply a term substitution to a binding" $+ "subst" ~> "b" ~> Core.bindingWithTerm (var "b") (substituteInTerm @@ var "subst" @@ (Core.bindingTerm $ var "b"))++substituteInConstraint :: TBinding (TypeSubst -> TypeConstraint -> TypeConstraint)+substituteInConstraint = define "substituteInConstraint" $+ doc "Apply a type substitution to a type constraint" $ lambdas ["subst", "c"] $ Typing.typeConstraint- (ref substInTypeDef @@ var "subst" @@ (Typing.typeConstraintLeft $ var "c"))- (ref substInTypeDef @@ var "subst" @@ (Typing.typeConstraintRight $ var "c"))+ (substInType @@ var "subst" @@ (Typing.typeConstraintLeft $ var "c"))+ (substInType @@ var "subst" @@ (Typing.typeConstraintRight $ var "c")) (Typing.typeConstraintComment $ var "c") -substituteInConstraintsDef :: TBinding (TypeSubst -> [TypeConstraint] -> [TypeConstraint])-substituteInConstraintsDef = define "substituteInConstraints" $- lambdas ["subst", "cs"] $ Lists.map (ref substituteInConstraintDef @@ var "subst") (var "cs")+substituteInConstraints :: TBinding (TypeSubst -> [TypeConstraint] -> [TypeConstraint])+substituteInConstraints = define "substituteInConstraints" $+ doc "Apply a type substitution to a list of type constraints" $+ lambdas ["subst", "cs"] $ Lists.map (substituteInConstraint @@ var "subst") (var "cs") -substInContextDef :: TBinding (TypeSubst -> InferenceContext -> InferenceContext)-substInContextDef = define "substInContext" $- lambdas ["subst", "cx"] $ Typing.inferenceContextWithDataTypes- (var "cx")- (Maps.map (ref substInTypeSchemeDef @@ var "subst") (Typing.inferenceContextDataTypes $ var "cx"))+-- | Apply a type substitution to a map of class constraints.+-- When a type variable is mapped to another type variable, the constraint is transferred to the new variable.+-- When a type variable is mapped to a complex type, the constraint is propagated to all free variables in that type.+substInClassConstraints :: TBinding (TypeSubst -> M.Map Name TypeVariableMetadata -> M.Map Name TypeVariableMetadata)+substInClassConstraints = define "substInClassConstraints" $+ doc "Apply a type substitution to class constraints, propagating to free variables" $+ "subst" ~> "constraints" ~>+ "substMap" <~ Typing.unTypeSubst (var "subst") $+ -- Helper to insert a constraint, merging with existing if present+ "insertOrMerge" <~ ("varName" ~> "metadata" ~> "acc" ~>+ Maybes.maybe+ (Maps.insert (var "varName") (var "metadata") (var "acc"))+ ("existing" ~>+ "merged" <~ Core.typeVariableMetadata (Sets.union (Core.typeVariableMetadataClasses $ var "existing") (Core.typeVariableMetadataClasses $ var "metadata")) $+ Maps.insert (var "varName") (var "merged") (var "acc"))+ (Maps.lookup (var "varName") (var "acc"))) $+ -- For each (varName, metadata) in constraints:+ -- 1. Look up varName in the substitution+ -- 2. If not found, keep (varName, metadata) in result+ -- 3. If found, propagate constraint to all free variables in the target type+ Lists.foldl+ ("acc" ~> "pair" ~>+ "varName" <~ Pairs.first (var "pair") $+ "metadata" <~ Pairs.second (var "pair") $+ Maybes.maybe+ -- Not in substitution: keep original+ (var "insertOrMerge" @@ var "varName" @@ var "metadata" @@ var "acc")+ -- In substitution: propagate constraint to all free variables in the target type+ ("targetType" ~>+ "freeVars" <~ Sets.toList (Rewriting.freeVariablesInType @@ var "targetType") $+ Lists.foldl+ ("acc2" ~> "freeVar" ~> var "insertOrMerge" @@ var "freeVar" @@ var "metadata" @@ var "acc2")+ (var "acc")+ (var "freeVars"))+ (Maps.lookup (var "varName") (var "substMap")))+ Maps.empty+ (Maps.toList $ var "constraints") -substituteInTermDef :: TBinding (TermSubst -> Term -> Term)-substituteInTermDef = define "substituteInTerm" $- lambda "subst" $ lets [+substInContext :: TBinding (TypeSubst -> InferenceContext -> InferenceContext)+substInContext = define "substInContext" $+ doc "Apply a type substitution to an inference context" $+ lambdas ["subst", "cx"] $+ "newDataTypes" <~ Maps.map (substInTypeScheme @@ var "subst") (Typing.inferenceContextDataTypes $ var "cx") $+ "newClassConstraints" <~ substInClassConstraints @@ var "subst" @@ (Typing.inferenceContextClassConstraints $ var "cx") $+ Typing.inferenceContext+ (Typing.inferenceContextSchemaTypes $ var "cx")+ (Typing.inferenceContextPrimitiveTypes $ var "cx")+ (var "newDataTypes")+ (var "newClassConstraints")+ (Typing.inferenceContextDebug $ var "cx")++substituteInTerm :: TBinding (TermSubst -> Term -> Term)+substituteInTerm = define "substituteInTerm" $+ doc "Apply a term substitution to a term" $+ "subst" ~> "term0" ~> lets [ "s">: Typing.unTermSubst $ var "subst", "rewrite">: lambdas ["recurse", "term"] $ lets [ "withLambda">: lambda "l" $ lets [ "v">: Core.lambdaParameter $ var "l",- "subst2">: Typing.termSubst $ Maps.remove (var "v") (var "s")] $+ "subst2">: Typing.termSubst $ Maps.delete (var "v") (var "s")] $ Core.termFunction $ Core.functionLambda $- Core.lambda (var "v") (Core.lambdaDomain $ var "l") (ref substituteInTermDef @@ var "subst2" @@ (Core.lambdaBody $ var "l")),+ Core.lambda (var "v") (Core.lambdaDomain $ var "l") (substituteInTerm @@ var "subst2" @@ (Core.lambdaBody $ var "l")), "withLet">: lambda "lt" $ lets [ "bindings">: Core.letBindings $ var "lt", "names">: Sets.fromList $ Lists.map (unaryFunction Core.bindingName) (var "bindings"), "subst2">: Typing.termSubst $ Maps.filterWithKey (lambdas ["k", "v"] $ Logic.not $ Sets.member (var "k") (var "names")) (var "s"), "rewriteBinding">: lambda "b" $ Core.binding (Core.bindingName $ var "b")- (ref substituteInTermDef @@ var "subst2" @@ (Core.bindingTerm $ var "b"))+ (substituteInTerm @@ var "subst2" @@ (Core.bindingTerm $ var "b")) (Core.bindingType $ var "b")] $ Core.termLet $ Core.let_ (Lists.map (var "rewriteBinding") (var "bindings"))- (ref substituteInTermDef @@ var "subst2" @@ (Core.letEnvironment $ var "lt"))] $+ (substituteInTerm @@ var "subst2" @@ (Core.letBody $ var "lt"))] $ cases _Term (var "term") (Just $ var "recurse" @@ var "term") [ _Term_function>>: lambda "fun" $ cases _Function (var "fun") (Just $ var "recurse" @@ var "term") [- _Function_lambda>>: var "withLambda"],- _Term_let>>: var "withLet",- _Term_variable>>: lambda "name" $ Optionals.maybe+ _Function_lambda>>: "l" ~> var "withLambda" @@ var "l"],+ _Term_let>>: "l" ~> var "withLet" @@ var "l",+ _Term_variable>>: lambda "name" $ Maybes.maybe (var "recurse" @@ var "term") (lambda "sterm" $ var "sterm") (Maps.lookup (var "name") (var "s"))]] $- ref Rewriting.rewriteTermDef @@ var "rewrite"+ Rewriting.rewriteTerm @@ var "rewrite" @@ var "term0" -- W: subst'-substInTypeDef :: TBinding (TypeSubst -> Type -> Type)-substInTypeDef = define "substInType" $- lambda "subst" $ lets [- "rewrite">: lambdas ["recurse", "typ"] $ cases _Type (var "typ") (Just $ var "recurse" @@ var "typ") [- _Type_forall>>: lambda "lt" $ Optionals.maybe- (var "recurse" @@ var "typ")- (lambda "styp" $ Core.typeForall $ Core.forallType- (Core.forallTypeParameter $ var "lt")- (ref substInTypeDef- @@ (var "removeVar" @@ (Core.forallTypeParameter $ var "lt"))- @@ (Core.forallTypeBody $ var "lt")))- (Maps.lookup (Core.forallTypeParameter $ var "lt") (Typing.unTypeSubst $ var "subst")),- _Type_variable>>: lambda "v" $ Optionals.maybe- (var "typ")- (lambda "styp" $ var "styp")- (Maps.lookup (var "v") (Typing.unTypeSubst $ var "subst"))],- "removeVar">: lambdas ["v"] $ Typing.typeSubst $ Maps.remove (var "v") (Typing.unTypeSubst $ var "subst")] $- (ref Rewriting.rewriteTypeDef) @@ var "rewrite"+substInType :: TBinding (TypeSubst -> Type -> Type)+substInType = define "substInType" $+ doc "Apply a type substitution to a type" $+ "subst" ~> "typ0" ~>+ -- Short-circuit: if substitution is empty, return type unchanged+ Logic.ifElse (Maps.null $ Typing.unTypeSubst $ var "subst")+ (var "typ0") $+ -- Otherwise, apply the substitution+ substInTypeNonEmpty @@ var "subst" @@ var "typ0" -substInTypeSchemeDef :: TBinding (TypeSubst -> TypeScheme -> TypeScheme)-substInTypeSchemeDef = define "substInTypeScheme" $+-- | Helper for substInType when substitution is non-empty+substInTypeNonEmpty :: TBinding (TypeSubst -> Type -> Type)+substInTypeNonEmpty = define "substInTypeNonEmpty" $+ doc "Apply a non-empty type substitution to a type (internal helper)" $+ "subst" ~> "typ0" ~>+ lets [+ "rewrite">: lambdas ["recurse", "typ"] $ cases _Type (var "typ") (Just $ var "recurse" @@ var "typ") [+ _Type_forall>>: lambda "lt" $ Maybes.maybe+ (var "recurse" @@ var "typ")+ (lambda "styp" $ Core.typeForall $ Core.forallType+ (Core.forallTypeParameter $ var "lt")+ (substInType+ @@ (var "removeVar" @@ (Core.forallTypeParameter $ var "lt"))+ @@ (Core.forallTypeBody $ var "lt")))+ (Maps.lookup (Core.forallTypeParameter $ var "lt") (Typing.unTypeSubst $ var "subst")),+ _Type_variable>>: lambda "v" $ Maybes.maybe+ (var "typ")+ (lambda "styp" $ var "styp")+ (Maps.lookup (var "v") (Typing.unTypeSubst $ var "subst"))],+ "removeVar">: lambdas ["v"] $ Typing.typeSubst $ Maps.delete (var "v") (Typing.unTypeSubst $ var "subst")] $+ (Rewriting.rewriteType) @@ var "rewrite" @@ var "typ0"++substInTypeScheme :: TBinding (TypeSubst -> TypeScheme -> TypeScheme)+substInTypeScheme = define "substInTypeScheme" $+ doc "Apply a type substitution to a type scheme" $ lambdas ["subst", "ts"] $ Core.typeScheme (Core.typeSchemeVariables $ var "ts")- (ref substInTypeDef @@ var "subst" @@ (Core.typeSchemeType $ var "ts"))+ (substInType @@ var "subst" @@ (Core.typeSchemeType $ var "ts"))+ -- Also apply the substitution to the constraints+ (Maybes.map (substInClassConstraints @@ var "subst") (Core.typeSchemeConstraints $ var "ts")) -substTypesInTermDef :: TBinding (TypeSubst -> Term -> Term)-substTypesInTermDef = define "substTypesInTerm" $- lambda "subst" $ lets [+substTypesInTerm :: TBinding (TypeSubst -> Term -> Term)+substTypesInTerm = define "substTypesInTerm" $+ doc "Apply a type substitution to the type annotations within a term" $+ "subst" ~> "term0" ~> lets [ "rewrite">: lambdas ["recurse", "term"] $ lets [- "forElimination">: lambda "elm" $ cases _Elimination (var "elm")- (Just $ var "recurse" @@ var "term") [- _Elimination_product>>: var "forTupleProjection"],+ "dflt">: var "recurse" @@ var "term", "forFunction">: lambda "f" $ cases _Function (var "f")- -- TODO: injections and case statements need a domain field as well, similar to lambdas- (Just $ var "recurse" @@ var "term") [- _Function_elimination>>: var "forElimination",- _Function_lambda>>: var "forLambda"],- "forLambda">: lambda "l" $ var "recurse" @@ (Core.termFunction $ Core.functionLambda $ Core.lambda+ (Just $ var "dflt") [+ _Function_elimination>>: "e" ~> var "dflt",+ _Function_lambda>>: "l" ~> var "forLambda" @@ var "l"],+ "forLambda">: lambda "l" $ Core.termFunction $ Core.functionLambda $ Core.lambda (Core.lambdaParameter $ var "l")- (Optionals.map (ref substInTypeDef @@ var "subst") $ Core.lambdaDomain $ var "l")- (Core.lambdaBody $ var "l")),+ (Maybes.map (substInType @@ var "subst") $ Core.lambdaDomain $ var "l")+ (substTypesInTerm @@ var "subst" @@ (Core.lambdaBody $ var "l")), "forLet">: lambda "l" $ lets [ "rewriteBinding">: lambda "b" $ Core.binding (Core.bindingName $ var "b")- (Core.bindingTerm $ var "b")- (Optionals.map (ref substInTypeSchemeDef @@ var "subst") (Core.bindingType $ var "b"))] $- var "recurse" @@ (Core.termLet $ Core.let_+ (substTypesInTerm @@ var "subst" @@ (Core.bindingTerm $ var "b"))+ (Maybes.map (substInTypeScheme @@ var "subst") (Core.bindingType $ var "b"))] $+ Core.termLet $ Core.let_ (Lists.map (var "rewriteBinding") (Core.letBindings $ var "l"))- (Core.letEnvironment $ var "l")),- "forTupleProjection">: lambda "tp" $ var "recurse" @@ (Core.termFunction $ Core.functionElimination $ Core.eliminationProduct $ Core.tupleProjection- (Core.tupleProjectionArity $ var "tp")- (Core.tupleProjectionIndex $ var "tp")- (Optionals.map (lambda "types" $ Lists.map (ref substInTypeDef @@ var "subst") (var "types")) (Core.tupleProjectionDomain $ var "tp"))),+ (substTypesInTerm @@ var "subst" @@ (Core.letBody $ var "l")),+ "forTypeApplication">: lambda "tt" $+ Core.termTypeApplication $ Core.typeApplicationTerm+ (substTypesInTerm @@ var "subst" @@ (Core.typeApplicationTermBody $ var "tt"))+ (substInType @@ var "subst" @@ (Core.typeApplicationTermType $ var "tt")), "forTypeLambda">: lambda "ta" $ lets [ "param">: Core.typeLambdaParameter $ var "ta",- "subst2">: Typing.typeSubst $ Maps.remove (var "param") (Typing.unTypeSubst $ var "subst")] $+ "subst2">: Typing.typeSubst $ Maps.delete (var "param") (Typing.unTypeSubst $ var "subst")] $ Core.termTypeLambda $ Core.typeLambda (var "param")- (ref substTypesInTermDef @@ var "subst2" @@ (Core.typeLambdaBody $ var "ta"))] $- cases _Term (var "term") (Just $ var "recurse" @@ var "term") [- _Term_function>>: var "forFunction",- _Term_let>>: var "forLet",- _Term_typeLambda>>: var "forTypeLambda",- _Term_typeApplication>>: lambda "tt" $ var "recurse" @@ (Core.termTypeApplication $ Core.typedTerm- (Core.typedTermTerm $ var "tt")- (ref substInTypeDef @@ var "subst" @@ (Core.typedTermType $ var "tt")))]] $- ref Rewriting.rewriteTermDef @@ var "rewrite"+ (substTypesInTerm @@ var "subst2" @@ (Core.typeLambdaBody $ var "ta"))] $+ cases _Term (var "term")+ (Just $ var "dflt") [+ _Term_function>>: "f" ~> var "forFunction" @@ var "f",+ _Term_let>>: "l" ~> var "forLet" @@ var "l",+ _Term_typeApplication>>: "ta" ~> var "forTypeApplication" @@ var "ta",+ _Term_typeLambda>>: "tl" ~> var "forTypeLambda" @@ var "tl"]] $+ Rewriting.rewriteTerm @@ var "rewrite" @@ var "term0"
src/main/haskell/Hydra/Sources/Kernel/Terms/Tarjan.hs view
@@ -1,45 +1,58 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Tarjan where --- Standard imports for term-level kernel modules+-- Standard imports for kernel terms modules import Hydra.Kernel import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Constants as Constants import qualified Hydra.Sources.Kernel.Terms.Monads as Monads@@ -47,147 +60,139 @@ import qualified Hydra.Topology as Topo +ns :: Namespace+ns = Namespace "hydra.tarjan"+ module_ :: Module-module_ = Module (Namespace "hydra.tarjan") elements- [Constants.module_, Monads.module_]- kernelTypesModules $+module_ = Module ns elements+ [Constants.ns, Monads.ns]+ kernelTypesNamespaces $ Just ("This implementation of Tarjan's algorithm was originally based on GraphSCC by Iavor S. Diatchki:" <> " https://hackage.haskell.org/package/GraphSCC.") where elements = [- el adjacencyListsToGraphDef,- el stronglyConnectedComponentsDef,- el initialStateDef,- el popStackUntilDef,- el strongConnectDef]+ toBinding adjacencyListsToGraph,+ toBinding stronglyConnectedComponents,+ toBinding initialState,+ toBinding popStackUntil,+ toBinding strongConnect] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -adjacencyListsToGraphDef :: TBinding ([(key, [key])] -> (Topo.Graph, Topo.Vertex -> key))-adjacencyListsToGraphDef = define "adjacencyListsToGraph" $+adjacencyListsToGraph :: TBinding ([(key, [key])] -> (Topo.Graph, Topo.Vertex -> key))+adjacencyListsToGraph = define "adjacencyListsToGraph" $ doc ("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.") $- withOrd "t0" $- lambda "edges0" $ lets [- "sortedEdges">: Lists.sortOn (unaryFunction first) (var "edges0"),- "indexedEdges">: Lists.zip (Math.range (int32 0) (Lists.length $ var "sortedEdges")) (var "sortedEdges"),- "keyToVertex">: Maps.fromList $ Lists.map- (lambda "vkNeighbors" $ lets [- "v">: first $ var "vkNeighbors",- "kNeighbors">: second $ var "vkNeighbors",- "k">: first $ var "kNeighbors"]- $ pair (var "k") (var "v"))- (var "indexedEdges"),- "vertexMap">: Maps.fromList $ Lists.map- (lambda "vkNeighbors" $ lets [- "v">: first $ var "vkNeighbors",- "kNeighbors">: second $ var "vkNeighbors",- "k">: first $ var "kNeighbors"]- $ pair (var "v") (var "k"))- (var "indexedEdges"),- "graph">: Maps.fromList $ Lists.map- (lambda "vkNeighbors" $ lets [- "v">: first $ var "vkNeighbors",- "kNeighbors">: second $ var "vkNeighbors",- "neighbors">: second $ var "kNeighbors"]- $ pair (var "v") (Optionals.mapMaybe (lambda "k" $ Maps.lookup (var "k") (var "keyToVertex")) (var "neighbors")))- (var "indexedEdges"),- "vertexToKey">: lambda "v" $ Optionals.fromJust $ Maps.lookup (var "v") (var "vertexMap")]- $ pair (var "graph") (var "vertexToKey")+ "edges0" ~>+ "sortedEdges" <~ Lists.sortOn (unaryFunction Pairs.first) (var "edges0") $+ "indexedEdges" <~ Lists.zip (Math.range (int32 0) (Lists.length (var "sortedEdges"))) (var "sortedEdges") $+ "keyToVertex" <~ Maps.fromList (Lists.map+ ("vkNeighbors" ~>+ "v" <~ Pairs.first (var "vkNeighbors") $+ "kNeighbors" <~ Pairs.second (var "vkNeighbors") $+ "k" <~ Pairs.first (var "kNeighbors") $+ pair (var "k") (var "v"))+ (var "indexedEdges")) $+ "vertexMap" <~ Maps.fromList (Lists.map+ ("vkNeighbors" ~>+ "v" <~ Pairs.first (var "vkNeighbors") $+ "kNeighbors" <~ Pairs.second (var "vkNeighbors") $+ "k" <~ Pairs.first (var "kNeighbors") $+ pair (var "v") (var "k"))+ (var "indexedEdges")) $+ "graph" <~ Maps.fromList (Lists.map+ ("vkNeighbors" ~>+ "v" <~ Pairs.first (var "vkNeighbors") $+ "kNeighbors" <~ Pairs.second (var "vkNeighbors") $+ "neighbors" <~ Pairs.second (var "kNeighbors") $+ pair (var "v") (Maybes.mapMaybe ("k" ~> Maps.lookup (var "k") (var "keyToVertex")) (var "neighbors")))+ (var "indexedEdges")) $+ "vertexToKey" <~ ("v" ~> Maybes.fromJust (Maps.lookup (var "v") (var "vertexMap"))) $+ pair (var "graph") (var "vertexToKey") -initialStateDef :: TBinding Topo.TarjanState-initialStateDef = define "initialState" $+initialState :: TBinding Topo.TarjanState+initialState = define "initialState" $ doc "Initial state for Tarjan's algorithm" $- Topology.tarjanState (int32 0) Maps.empty Maps.empty (list []) Sets.empty (list [])+ Topology.tarjanState (int32 0) Maps.empty Maps.empty (list ([] :: [TTerm Topo.Vertex])) Sets.empty (list ([] :: [TTerm [Topo.Vertex]])) -popStackUntilDef :: TBinding (Topo.Vertex -> Flow Topo.TarjanState [Topo.Vertex])-popStackUntilDef = define "popStackUntil" $+popStackUntil :: TBinding (Topo.Vertex -> Flow Topo.TarjanState [Topo.Vertex])+popStackUntil = define "popStackUntil" $ doc "Pop vertices off the stack until the given vertex is reached, collecting the current strongly connected component" $- lambda "v" $ lets [- "go">: lambda "acc" $- Flows.bind (ref Monads.getStateDef) $- lambda "st" $- Logic.ifElse (Lists.null $ Topology.tarjanStateStack $ var "st")- (Flows.fail $ string "popStackUntil: empty stack")- (lets [- "x">: Lists.head $ Topology.tarjanStateStack $ var "st",- "xs">: Lists.tail $ Topology.tarjanStateStack $ var "st",- "newSt">: Topology.tarjanStateWithStack (var "st") (var "xs"),- "newSt2">: Topology.tarjanStateWithOnStack (var "newSt") (Sets.delete (var "x") (Topology.tarjanStateOnStack $ var "st")),- "acc'">: Lists.cons (var "x") (var "acc")]- $ Flows.bind (ref Monads.putStateDef @@ var "newSt2") $- lambda "_" $- Logic.ifElse (Equality.equal (var "x") (var "v"))- (Flows.pure $ Lists.reverse $ var "acc'")- (var "go" @@ var "acc'"))]- $ var "go" @@ list []+ "v" ~>+ "go" <~ ("acc" ~>+ "succeed" <~ ("st" ~>+ "x" <~ Lists.head (Topology.tarjanStateStack (var "st")) $+ "xs" <~ Lists.tail (Topology.tarjanStateStack (var "st")) $+ "newSt" <~ Topology.tarjanStateWithStack (var "st") (var "xs") $+ "newSt2" <~ Topology.tarjanStateWithOnStack (var "newSt") (Sets.delete (var "x") (Topology.tarjanStateOnStack (var "st"))) $+ "acc'" <~ Lists.cons (var "x") (var "acc") $+ exec (Monads.putState @@ var "newSt2") $+ Logic.ifElse (Equality.equal (var "x") (var "v"))+ (produce (Lists.reverse (var "acc'")))+ (var "go" @@ var "acc'")) $+ "st" <<~ Monads.getState $+ Logic.ifElse (Lists.null (Topology.tarjanStateStack (var "st")))+ (Flows.fail (string "popStackUntil: empty stack"))+ (var "succeed" @@ var "st")) $+ var "go" @@ list ([] :: [TTerm Topo.Vertex]) -strongConnectDef :: TBinding (Topo.Graph -> Topo.Vertex -> Flow Topo.TarjanState ())-strongConnectDef = define "strongConnect" $+strongConnect :: TBinding (Topo.Graph -> Topo.Vertex -> Flow Topo.TarjanState ())+strongConnect = define "strongConnect" $ doc "Visit a vertex and recursively explore its successors" $- lambdas ["graph", "v"] $- Flows.bind (ref Monads.getStateDef) $- lambda "st" $ lets [- "i">: Topology.tarjanStateCounter $ var "st",- "newSt">: Topology.tarjanState- (Math.add (var "i") (int32 1))- (Maps.insert (var "v") (var "i") (Topology.tarjanStateIndices $ var "st"))- (Maps.insert (var "v") (var "i") (Topology.tarjanStateLowLinks $ var "st"))- (Lists.cons (var "v") (Topology.tarjanStateStack $ var "st"))- (Sets.insert (var "v") (Topology.tarjanStateOnStack $ var "st"))- (Topology.tarjanStateSccs $ var "st"),- "neighbors">: Maps.findWithDefault (list []) (var "v") (var "graph"),- "processNeighbor">: lambda "w" $- Flows.bind (ref Monads.getStateDef) $- lambda "st'" $- Logic.ifElse (Logic.not $ Maps.member (var "w") (Topology.tarjanStateIndices $ var "st'"))- (Flows.bind (ref strongConnectDef @@ var "graph" @@ var "w") $- lambda "_" $- Flows.bind (ref Monads.getStateDef) $- lambda "stAfter" $ lets [- "low_v">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "v") (Topology.tarjanStateLowLinks $ var "stAfter"),- "low_w">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "w") (Topology.tarjanStateLowLinks $ var "stAfter")]- $ Flows.bind (ref Monads.modifyDef @@ (lambda "s" $- Topology.tarjanStateWithLowLinks (var "s")- (Maps.insert (var "v") (Equality.min (var "low_v") (var "low_w")) (Topology.tarjanStateLowLinks $ var "s")))) $- lambda "_" $ Flows.pure unit)- (Logic.ifElse (Sets.member (var "w") (Topology.tarjanStateOnStack $ var "st'"))- (lets [- "low_v">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "v") (Topology.tarjanStateLowLinks $ var "st'"),- "idx_w">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "w") (Topology.tarjanStateIndices $ var "st'")]- $ Flows.bind (ref Monads.modifyDef @@ (lambda "s" $- Topology.tarjanStateWithLowLinks (var "s")- (Maps.insert (var "v") (Equality.min (var "low_v") (var "idx_w")) (Topology.tarjanStateLowLinks $ var "s")))) $- lambda "_" $ Flows.pure unit)- (Flows.pure unit))]- $ Flows.bind (ref Monads.putStateDef @@ var "newSt") $- lambda "_" $- Flows.bind (Flows.mapList (var "processNeighbor") (var "neighbors")) $- lambda "_" $- Flows.bind (ref Monads.getStateDef) $- lambda "stFinal" $ lets [- "low_v">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "v") (Topology.tarjanStateLowLinks $ var "stFinal"),- "idx_v">: Maps.findWithDefault (ref Constants.maxInt32Def) (var "v") (Topology.tarjanStateIndices $ var "stFinal")]- $ Logic.ifElse (Equality.equal (var "low_v") (var "idx_v"))- (Flows.bind (ref popStackUntilDef @@ var "v") $- lambda "comp" $- Flows.bind (ref Monads.modifyDef @@ (lambda "s" $- Topology.tarjanStateWithSccs (var "s") (Lists.cons (var "comp") (Topology.tarjanStateSccs $ var "s")))) $- lambda "_" $ Flows.pure unit)- (Flows.pure unit)+ "graph" ~> "v" ~>+ "st" <<~ Monads.getState $+ "i" <~ Topology.tarjanStateCounter (var "st") $+ "newSt" <~ Topology.tarjanState+ (Math.add (var "i") (int32 1))+ (Maps.insert (var "v") (var "i") (Topology.tarjanStateIndices (var "st")))+ (Maps.insert (var "v") (var "i") (Topology.tarjanStateLowLinks (var "st")))+ (Lists.cons (var "v") (Topology.tarjanStateStack (var "st")))+ (Sets.insert (var "v") (Topology.tarjanStateOnStack (var "st")))+ (Topology.tarjanStateSccs (var "st")) $+ "neighbors" <~ Maps.findWithDefault (list ([] :: [TTerm Topo.Vertex])) (var "v") (var "graph") $+ "processNeighbor" <~ ("w" ~>+ "lowLink" <~ ("st'" ~>+ "low_v" <~ Maps.findWithDefault Constants.maxInt32 (var "v") (Topology.tarjanStateLowLinks (var "st'")) $+ "idx_w" <~ Maps.findWithDefault Constants.maxInt32 (var "w") (Topology.tarjanStateIndices (var "st'")) $+ exec (Monads.modify @@ ("s" ~> Topology.tarjanStateWithLowLinks (var "s")+ (Maps.insert (var "v") (Equality.min (var "low_v") (var "idx_w")) (Topology.tarjanStateLowLinks (var "s"))))) $+ produce unit) $+ "st'" <<~ Monads.getState $+ Logic.ifElse (Logic.not (Maps.member (var "w") (Topology.tarjanStateIndices (var "st'"))))+ (exec (strongConnect @@ var "graph" @@ var "w") $+ "stAfter" <<~ Monads.getState $+ "low_v" <~ Maps.findWithDefault Constants.maxInt32 (var "v") (Topology.tarjanStateLowLinks (var "stAfter")) $+ "low_w" <~ Maps.findWithDefault Constants.maxInt32 (var "w") (Topology.tarjanStateLowLinks (var "stAfter")) $+ exec (Monads.modify @@ ("s" ~>+ Topology.tarjanStateWithLowLinks (var "s")+ (Maps.insert (var "v") (Equality.min (var "low_v") (var "low_w")) (Topology.tarjanStateLowLinks (var "s"))))) $+ produce unit)+ (Logic.ifElse (Sets.member (var "w") (Topology.tarjanStateOnStack (var "st'")))+ (var "lowLink" @@ var "st'")+ (produce unit))) $+ exec (Monads.putState @@ var "newSt") $+ exec (Flows.mapList (var "processNeighbor") (var "neighbors")) $+ "stFinal" <<~ Monads.getState $+ "low_v" <~ Maps.findWithDefault Constants.maxInt32 (var "v") (Topology.tarjanStateLowLinks (var "stFinal")) $+ "idx_v" <~ Maps.findWithDefault Constants.maxInt32 (var "v") (Topology.tarjanStateIndices (var "stFinal")) $+ Logic.ifElse (Equality.equal (var "low_v") (var "idx_v"))+ ("comp" <<~ popStackUntil @@ var "v" $+ exec (Monads.modify @@ ("s" ~>+ Topology.tarjanStateWithSccs (var "s") (Lists.cons (var "comp") (Topology.tarjanStateSccs (var "s"))))) $+ produce unit)+ (produce unit) -stronglyConnectedComponentsDef :: TBinding (Topo.Graph -> [[Topo.Vertex]])-stronglyConnectedComponentsDef = define "stronglyConnectedComponents" $+stronglyConnectedComponents :: TBinding (Topo.Graph -> [[Topo.Vertex]])+stronglyConnectedComponents = define "stronglyConnectedComponents" $ doc "Compute the strongly connected components of the given graph. The components are returned in reverse topological order" $- lambda "graph" $ lets [- "verts">: Maps.keys $ var "graph",- "processVertex">: lambda "v" $- Flows.bind (Flows.map (lambda "st" $ Maps.member (var "v") (Topology.tarjanStateIndices $ var "st")) $ ref Monads.getStateDef) $- lambda "visited" $- Logic.ifElse (Logic.not $ var "visited")- (ref strongConnectDef @@ var "graph" @@ var "v")- (Flows.pure unit),- "finalState">: ref Monads.execDef @@ (Flows.mapList (var "processVertex") (var "verts")) @@ ref initialStateDef]- $ Lists.reverse $ Lists.map (unaryFunction Lists.sort) $ Topology.tarjanStateSccs $ var "finalState"+ "graph" ~>+ "verts" <~ Maps.keys (var "graph") $+ "processVertex" <~ ("v" ~>+ "visited" <<~ Flows.map ("st" ~> Maps.member (var "v") (Topology.tarjanStateIndices (var "st"))) Monads.getState $+ Logic.ifElse (Logic.not (var "visited"))+ (strongConnect @@ var "graph" @@ var "v")+ (produce unit)) $+ "finalState" <~ Monads.exec @@ (Flows.mapList (var "processVertex") (var "verts")) @@ initialState $+ Lists.reverse (Lists.map (unaryFunction Lists.sort) (Topology.tarjanStateSccs (var "finalState")))
src/main/haskell/Hydra/Sources/Kernel/Terms/Templates.hs view
@@ -1,154 +1,169 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Templates where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (graphToSchema, instantiateTemplate) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Terms.Decode.Core as DecodeCore+import qualified Hydra.Sources.Decode.Core as DecodeCore+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore +ns :: Namespace+ns = Namespace "hydra.templates"+ module_ :: Module-module_ = Module (Namespace "hydra.templates") elements- [DecodeCore.module_, ShowCore.module_]- kernelTypesModules $+module_ = Module ns elements+ [moduleNamespace DecodeCore.module_, Monads.ns, ShowCore.ns]+ kernelTypesNamespaces $ Just "A utility which instantiates a nonrecursive type with default values" where elements = [- el graphToSchemaDef,- el instantiateTemplateDef]+ toBinding graphToSchema,+ toBinding instantiateTemplate] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -graphToSchemaDef :: TBinding (Graph -> Flow Graph (M.Map Name Type))-graphToSchemaDef = define "graphToSchema" $+graphToSchema :: TBinding (Graph -> Flow Graph (M.Map Name Type))+graphToSchema = define "graphToSchema" $ doc "Create a graph schema from a graph which contains nothing but encoded type definitions" $- lambda "g" $ lets [- "toPair">: lambda "nameAndEl" $ lets [- "name">: first $ var "nameAndEl",- "el">: second $ var "nameAndEl"]- $ Flows.bind (ref DecodeCore.typeDef @@ (Core.bindingTerm $ var "el")) $- lambda "t" $ Flows.pure $ pair (var "name") (var "t")]- $ Flows.bind (Flows.mapList (var "toPair") $ Maps.toList $ Graph.graphElements $ var "g") $- lambda "pairs" $ Flows.pure $ Maps.fromList $ var "pairs"+ "g" ~>+ "toPair" <~ ("el" ~>+ "name" <~ Core.bindingName (var "el") $+ "cx" <<~ Monads.getState $+ Flows.bind (trace (string "graph to schema") $ Monads.eitherToFlow_ @@ Util.unDecodingError @@ (decoderFor _Type @@ var "cx" @@ (Core.bindingTerm (var "el")))) (+ "t" ~> Flows.pure (pair (var "name") (var "t")))) $+ Flows.bind (Flows.mapList (var "toPair") (Graph.graphElements (var "g"))) (+ "pairs" ~> Flows.pure (Maps.fromList (var "pairs"))) -instantiateTemplateDef :: TBinding (Bool -> M.Map Name Type -> Type -> Flow s Term)-instantiateTemplateDef = define "instantiateTemplate" $+instantiateTemplate :: TBinding (Bool -> M.Map Name Type -> Type -> Flow s Term)+instantiateTemplate = define "instantiateTemplate" $ doc ("Given a graph schema and a nonrecursive type, instantiate it with default values." <> " If the minimal flag is set, the smallest possible term is produced; otherwise, exactly one subterm" <> " is produced for constructors which do not otherwise require one, e.g. in lists and optionals") $- lambdas ["minimal", "schema", "t"] $ lets [- "inst">: ref instantiateTemplateDef @@ var "minimal" @@ var "schema",- "noPoly">: Flows.fail $ string "Polymorphic and function types are not currently supported"]- $ match _Type Nothing [- _Type_annotated>>: lambda "at" $ var "inst" @@ (Core.annotatedTypeSubject $ var "at"),- _Type_application>>: constant $ var "noPoly",- _Type_function>>: constant $ var "noPoly",- _Type_forall>>: constant $ var "noPoly",- _Type_list>>: lambda "et" $ Logic.ifElse (var "minimal")- (Flows.pure $ Core.termList $ list [])- (Flows.bind (var "inst" @@ var "et") $- lambda "e" $ Flows.pure $ Core.termList $ list [var "e"]),- _Type_literal>>: lambda "lt" $ Flows.pure $ Core.termLiteral $- cases _LiteralType (var "lt") Nothing [- _LiteralType_binary>>: constant $ Core.literalString $ string "",- _LiteralType_boolean>>: constant $ Core.literalBoolean false,- _LiteralType_integer>>: lambda "it" $ Core.literalInteger $- match _IntegerType Nothing [- _IntegerType_bigint>>: constant $ Core.integerValueBigint $ bigint 0,- _IntegerType_int8>>: constant $ Core.integerValueInt8 $ int8 0,- _IntegerType_int16>>: constant $ Core.integerValueInt16 $ int16 0,- _IntegerType_int32>>: constant $ Core.integerValueInt32 $ int32 0,- _IntegerType_int64>>: constant $ Core.integerValueInt64 $ int64 0,- _IntegerType_uint8>>: constant $ Core.integerValueUint8 $ uint8 0,- _IntegerType_uint16>>: constant $ Core.integerValueUint16 $ uint16 0,- _IntegerType_uint32>>: constant $ Core.integerValueUint32 $ uint32 0,- _IntegerType_uint64>>: constant $ Core.integerValueUint64 $ uint64 0] @@ var "it",- _LiteralType_float>>: lambda "ft" $ Core.literalFloat $- cases _FloatType (var "ft") Nothing [- _FloatType_bigfloat>>: constant $ Core.floatValueBigfloat $ bigfloat 0.0,- _FloatType_float32>>: constant $ Core.floatValueFloat32 $ float32 0.0,- _FloatType_float64>>: constant $ Core.floatValueFloat64 $ float64 0.0],- _LiteralType_string>>: constant $ Core.literalString $ string ""],- _Type_map>>: lambda "mt" $ lets [- "kt">: Core.mapTypeKeys $ var "mt",- "vt">: Core.mapTypeValues $ var "mt"]- $ Logic.ifElse (var "minimal")- (Flows.pure $ Core.termMap Maps.empty)- (Flows.bind (var "inst" @@ var "kt") $- lambda "ke" $- Flows.bind (var "inst" @@ var "vt") $- lambda "ve" $ Flows.pure $ Core.termMap $ Maps.singleton (var "ke") (var "ve")),- _Type_optional>>: lambda "ot" $ Logic.ifElse (var "minimal")- (Flows.pure $ Core.termOptional nothing)- (Flows.bind (var "inst" @@ var "ot") $- lambda "e" $ Flows.pure $ Core.termOptional $ just $ var "e"),- _Type_product>>: lambda "types" $- Flows.bind (Flows.mapList (var "inst") (var "types")) $- lambda "es" $ Flows.pure $ Core.termProduct $ var "es",- _Type_record>>: lambda "rt" $ lets [- "tname">: Core.rowTypeTypeName $ var "rt",- "fields">: Core.rowTypeFields $ var "rt",- "toField">: lambda "ft" $- Flows.bind (var "inst" @@ (Core.fieldTypeType $ var "ft")) $- lambda "e" $ Flows.pure $ Core.field (Core.fieldTypeName $ var "ft") (var "e")]- $ Flows.bind (Flows.mapList (var "toField") (var "fields")) $- lambda "dfields" $ Flows.pure $ Core.termRecord $ Core.record (var "tname") (var "dfields"),- _Type_set>>: lambda "et" $ Logic.ifElse (var "minimal")- (Flows.pure $ Core.termSet Sets.empty)- (Flows.bind (var "inst" @@ var "et") $- lambda "e" $ Flows.pure $ Core.termSet $ Sets.fromList $ list [var "e"]),- -- TODO: _Type_sum- -- TODO: _Type_union- -- TODO: _Type_unit>>: constant $ Flows.pure Core.termUnit,- _Type_variable>>: lambda "tname" $- Optionals.maybe- (Flows.fail $ Strings.cat2 (string "Type variable ") $ Strings.cat2 (ref ShowCore.termDef @@ (Core.termVariable $ var "tname")) (string " not found in schema"))- (var "inst")- (Maps.lookup (var "tname") (var "schema")),- _Type_wrap>>: lambda "wt" $ lets [- "tname">: Core.wrappedTypeTypeName $ var "wt",- "t'">: Core.wrappedTypeObject $ var "wt"]- $ Flows.bind (var "inst" @@ var "t'") $- lambda "e" $ Flows.pure $ Core.termWrap $ Core.wrappedTerm (var "tname") (var "e")] @@ var "t"+ "minimal" ~> "schema" ~> "t" ~>+ "inst" <~ instantiateTemplate @@ var "minimal" @@ var "schema" $+ "noPoly" <~ Flows.fail (string "Polymorphic and function types are not currently supported") $+ "forFloat" <~ ("ft" ~> cases _FloatType (var "ft")+ Nothing [+ _FloatType_bigfloat>>: constant (Core.floatValueBigfloat (bigfloat 0.0)),+ _FloatType_float32>>: constant (Core.floatValueFloat32 (float32 0.0)),+ _FloatType_float64>>: constant (Core.floatValueFloat64 (float64 0.0))]) $+ "forInteger" <~ ("it" ~> cases _IntegerType (var "it")+ Nothing [+ _IntegerType_bigint>>: constant (Core.integerValueBigint (bigint 0)),+ _IntegerType_int8>>: constant (Core.integerValueInt8 (int8 0)),+ _IntegerType_int16>>: constant (Core.integerValueInt16 (int16 0)),+ _IntegerType_int32>>: constant (Core.integerValueInt32 (int32 0)),+ _IntegerType_int64>>: constant (Core.integerValueInt64 (int64 0)),+ _IntegerType_uint8>>: constant (Core.integerValueUint8 (uint8 0)),+ _IntegerType_uint16>>: constant (Core.integerValueUint16 (uint16 0)),+ _IntegerType_uint32>>: constant (Core.integerValueUint32 (uint32 0)),+ _IntegerType_uint64>>: constant (Core.integerValueUint64 (uint64 0))]) $+ "forLiteral" <~ ("lt" ~> cases _LiteralType (var "lt")+ Nothing [+ _LiteralType_binary>>: constant (Core.literalString (string "")),+ _LiteralType_boolean>>: constant (Core.literalBoolean false),+ _LiteralType_integer>>: "it" ~> Core.literalInteger (var "forInteger" @@ var "it"),+ _LiteralType_float>>: "ft" ~> Core.literalFloat (var "forFloat" @@ var "ft"),+ _LiteralType_string>>: constant (Core.literalString (string ""))]) $+ cases _Type (var "t")+ Nothing [+ _Type_annotated>>: "at" ~> var "inst" @@ (Core.annotatedTypeBody (var "at")),+ _Type_application>>: constant (var "noPoly"),+ _Type_function>>: constant (var "noPoly"),+ _Type_forall>>: constant (var "noPoly"),+ _Type_list>>: "et" ~> Logic.ifElse (var "minimal")+ (Flows.pure (Core.termList (list ([] :: [TTerm Term]))))+ (Flows.bind (var "inst" @@ var "et") (+ "e" ~> Flows.pure (Core.termList (list [var "e"])))),+ _Type_literal>>: "lt" ~> Flows.pure (Core.termLiteral (var "forLiteral" @@ var "lt")),+ _Type_map>>: "mt" ~>+ "kt" <~ Core.mapTypeKeys (var "mt") $+ "vt" <~ Core.mapTypeValues (var "mt") $+ Logic.ifElse (var "minimal")+ (Flows.pure (Core.termMap Maps.empty))+ (Flows.bind (var "inst" @@ var "kt") (+ "ke" ~>+ Flows.bind (var "inst" @@ var "vt") (+ "ve" ~> Flows.pure (Core.termMap (Maps.singleton (var "ke") (var "ve")))))),+ _Type_maybe>>: "ot" ~> Logic.ifElse (var "minimal")+ (Flows.pure (Core.termMaybe nothing))+ (Flows.bind (var "inst" @@ var "ot") (+ "e" ~> Flows.pure (Core.termMaybe (just (var "e"))))),+ _Type_record>>: "rt" ~>+ "tname" <~ Core.rowTypeTypeName (var "rt") $+ "fields" <~ Core.rowTypeFields (var "rt") $+ "toField" <~ ("ft" ~>+ Flows.bind (var "inst" @@ (Core.fieldTypeType (var "ft"))) (+ "e" ~> Flows.pure (Core.field (Core.fieldTypeName (var "ft")) (var "e")))) $+ Flows.bind (Flows.mapList (var "toField") (var "fields")) (+ "dfields" ~> Flows.pure (Core.termRecord (Core.record (var "tname") (var "dfields")))),+ _Type_set>>: "et" ~> Logic.ifElse (var "minimal")+ (Flows.pure (Core.termSet Sets.empty))+ (Flows.bind (var "inst" @@ var "et") (+ "e" ~> Flows.pure (Core.termSet (Sets.fromList (list [var "e"]))))),+ _Type_variable>>: "tname" ~>+ Maybes.maybe+ (Flows.fail (Strings.cat2 (string "Type variable ") (Strings.cat2 (ShowCore.term @@ (Core.termVariable (var "tname"))) (string " not found in schema"))))+ (var "inst")+ (Maps.lookup (var "tname") (var "schema")),+ _Type_wrap>>: "wt" ~>+ "tname" <~ Core.wrappedTypeTypeName (var "wt") $+ "t'" <~ Core.wrappedTypeBody (var "wt") $+ Flows.bind (var "inst" @@ var "t'") (+ "e" ~> Flows.pure (Core.termWrap (Core.wrappedTerm (var "tname") (var "e"))))] {-
src/main/haskell/Hydra/Sources/Kernel/Terms/Unification.hs view
@@ -1,137 +1,156 @@-{-# LANGUAGE OverloadedStrings #-} module Hydra.Sources.Kernel.Terms.Unification where --- Standard imports for term-level kernel modules-import Hydra.Kernel+-- Standard imports for kernel terms modules+import Hydra.Kernel hiding (joinTypes, unifyTypeConstraints, unifyTypeLists, unifyTypes, variableOccursInType) import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing+import qualified Hydra.Dsl.Meta.Accessors as Accessors+import qualified Hydra.Dsl.Annotations as Annotations+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Dsl.Bootstrap as Bootstrap+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Grammar as Grammar+import qualified Hydra.Dsl.Grammars as Grammars+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Eithers as Eithers+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Flows as Flows+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Pairs as Pairs+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Literals as Literals+import qualified Hydra.Dsl.LiteralTypes as LiteralTypes+import qualified Hydra.Dsl.Meta.Base as MetaBase+import qualified Hydra.Dsl.Meta.Terms as MetaTerms+import qualified Hydra.Dsl.Meta.Types as MetaTypes+import qualified Hydra.Dsl.Meta.Module as Module+import qualified Hydra.Dsl.Meta.Parsing as Parsing+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Prims as Prims+import qualified Hydra.Dsl.Tabular as Tabular+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Tests as Tests+import qualified Hydra.Dsl.Meta.Topology as Topology+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Dsl.Meta.Typing as Typing+import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Dsl.Meta.Variants as Variants import Hydra.Sources.Kernel.Types.All import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Data.Int as I+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y import qualified Hydra.Sources.Kernel.Terms.Rewriting as Rewriting import qualified Hydra.Sources.Kernel.Terms.Show.Core as ShowCore-import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations import qualified Hydra.Sources.Kernel.Terms.Substitution as Substitution +ns :: Namespace+ns = Namespace "hydra.unification"+ module_ :: Module-module_ = Module (Namespace "hydra.unification") elements- [ShowCore.module_, Substitution.module_]- kernelTypesModules $+module_ = Module ns elements+ [Rewriting.ns, ShowCore.ns, Substitution.ns]+ kernelTypesNamespaces $ Just ("Utilities for type unification.") where elements = [- el joinTypesDef,- el unifyTypeConstraintsDef,- el unifyTypeListsDef,- el unifyTypesDef,- el variableOccursInTypeDef]+ toBinding joinTypes,+ toBinding unifyTypeConstraints,+ toBinding unifyTypeLists,+ toBinding unifyTypes,+ toBinding variableOccursInType] define :: String -> TTerm a -> TBinding a define = definitionInModule module_ -joinTypesDef :: TBinding (Type -> Type -> String -> Flow s [TypeConstraint])-joinTypesDef = define "joinTypes" $+joinTypes :: TBinding (Type -> Type -> String -> Flow s [TypeConstraint])+joinTypes = define "joinTypes" $ doc ("Join two types, producing a list of type constraints." <> "The comment is used to provide context for the constraints.") $- lambdas ["left", "right", "comment"] $ lets [- "sleft">: ref Rewriting.deannotateTypeDef @@ var "left",- "sright">: ref Rewriting.deannotateTypeDef @@ var "right",- "joinOne">: lambdas ["l", "r"] $ Typing.typeConstraint (var "l") (var "r") ("join types; " ++ var "comment"),- "cannotUnify">: Flows.fail ("cannot unify " ++ (ref ShowCore.typeDef @@ var "sleft") ++ " with " ++ (ref ShowCore.typeDef @@ var "sright")),- "assertEqual">: Logic.ifElse- (Equality.equal (var "sleft") (var "sright"))- (Flows.pure $ list [])- (var "cannotUnify"),- "joinList">: lambdas ["lefts", "rights"] $ Logic.ifElse- (Equality.equal (Lists.length (var "lefts")) (Lists.length (var "rights")))- (Flows.pure $ Lists.zipWith (var "joinOne") (var "lefts") (var "rights"))- (var "cannotUnify"),- "joinRowTypes">: lambdas ["left", "right"] $ Logic.ifElse- (Logic.and- (Core.equalName_ (Core.rowTypeTypeName $ var "left") (Core.rowTypeTypeName $ var "right"))- (Core.equalNameList_- (Lists.map (unaryFunction Core.fieldTypeName) $ Core.rowTypeFields $ var "left")- (Lists.map (unaryFunction Core.fieldTypeName) $ Core.rowTypeFields $ var "right")))- (var "joinList"- @@ (Lists.map (unaryFunction Core.fieldTypeType) $ Core.rowTypeFields $ var "left")- @@ (Lists.map (unaryFunction Core.fieldTypeType) $ Core.rowTypeFields $ var "right"))- (var "cannotUnify")] $- cases _Type (var "sleft") (Just $ var "cannotUnify") [- _Type_application>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_application>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (Core.applicationTypeFunction $ var "l") @@ (Core.applicationTypeFunction $ var "r"),- var "joinOne" @@ (Core.applicationTypeArgument $ var "l") @@ (Core.applicationTypeArgument $ var "r")]],- _Type_function>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_function>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (Core.functionTypeDomain $ var "l") @@ (Core.functionTypeDomain $ var "r"),- var "joinOne" @@ (Core.functionTypeCodomain $ var "l") @@ (Core.functionTypeCodomain $ var "r")]],- _Type_list>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_list>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (var "l") @@ (var "r")]],- _Type_literal>>: constant $ var "assertEqual",- _Type_map>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_map>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (Core.mapTypeKeys $ var "l") @@ (Core.mapTypeKeys $ var "r"),- var "joinOne" @@ (Core.mapTypeValues $ var "l") @@ (Core.mapTypeValues $ var "r")]],- _Type_optional>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_optional>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (var "l") @@ (var "r")]],- _Type_product>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_product>>: lambda "r" $ var "joinList" @@ (var "l") @@ (var "r")],- _Type_record>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_record>>: lambda "r" $ var "joinRowTypes" @@ (var "l") @@ (var "r")],- _Type_set>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_set>>: lambda "r" $ Flows.pure $ list [- var "joinOne" @@ (var "l") @@ (var "r")]],- _Type_sum>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_sum>>: lambda "r" $ var "joinList" @@ (var "l") @@ (var "r")],- _Type_union>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_union>>: lambda "r" $ var "joinRowTypes" @@ (var "l") @@ (var "r")],- _Type_unit>>: constant $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_unit>>: constant $ Flows.pure $ list []],- _Type_wrap>>: lambda "l" $ cases _Type (var "sright") (Just $ var "cannotUnify") [- _Type_wrap>>: lambda "r" $ Logic.ifElse- (Core.equalName_ (Core.wrappedTypeTypeName $ var "l") (Core.wrappedTypeTypeName $ var "r"))- (Flows.pure $ list [- var "joinOne" @@ (Core.wrappedTypeObject $ var "l") @@ (Core.wrappedTypeObject $ var "r")])- (var "cannotUnify")]]+ "left" ~> "right" ~> "comment" ~>+ "sleft" <~ Rewriting.deannotateType @@ var "left" $+ "sright" <~ Rewriting.deannotateType @@ var "right" $+ "joinOne" <~ ("l" ~> "r" ~> Typing.typeConstraint (var "l") (var "r") ((string "join types; ") ++ var "comment")) $+ "cannotUnify" <~ Flows.fail ((string "cannot unify ") ++ (ShowCore.type_ @@ var "sleft") ++ (string " with ") ++ (ShowCore.type_ @@ var "sright")) $+ "assertEqual" <~ Logic.ifElse+ (Equality.equal (var "sleft") (var "sright"))+ (Flows.pure (list ([] :: [TTerm TypeConstraint])))+ (var "cannotUnify") $+ "joinList" <~ ("lefts" ~> "rights" ~> Logic.ifElse+ (Equality.equal (Lists.length (var "lefts")) (Lists.length (var "rights")))+ (Flows.pure (Lists.zipWith (var "joinOne") (var "lefts") (var "rights")))+ (var "cannotUnify")) $+ "joinRowTypes" <~ ("left" ~> "right" ~> Logic.ifElse+ (Logic.and+ (Core.equalName_ (Core.rowTypeTypeName (var "left")) (Core.rowTypeTypeName (var "right")))+ (Core.equalNameList_+ (Lists.map (unaryFunction Core.fieldTypeName) (Core.rowTypeFields (var "left")))+ (Lists.map (unaryFunction Core.fieldTypeName) (Core.rowTypeFields (var "right")))))+ (var "joinList"+ @@ (Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields (var "left")))+ @@ (Lists.map (unaryFunction Core.fieldTypeType) (Core.rowTypeFields (var "right"))))+ (var "cannotUnify")) $+ cases _Type (var "sleft") (Just (var "cannotUnify")) [+ _Type_application>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_application>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (Core.applicationTypeFunction (var "l")) @@ (Core.applicationTypeFunction (var "r")),+ var "joinOne" @@ (Core.applicationTypeArgument (var "l")) @@ (Core.applicationTypeArgument (var "r"))])],+ _Type_either>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_either>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (Core.eitherTypeLeft (var "l")) @@ (Core.eitherTypeLeft (var "r")),+ var "joinOne" @@ (Core.eitherTypeRight (var "l")) @@ (Core.eitherTypeRight (var "r"))])],+ _Type_function>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_function>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (Core.functionTypeDomain (var "l")) @@ (Core.functionTypeDomain (var "r")),+ var "joinOne" @@ (Core.functionTypeCodomain (var "l")) @@ (Core.functionTypeCodomain (var "r"))])],+ _Type_list>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_list>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (var "l") @@ (var "r")])],+ _Type_literal>>: constant (var "assertEqual"),+ _Type_map>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_map>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (Core.mapTypeKeys (var "l")) @@ (Core.mapTypeKeys (var "r")),+ var "joinOne" @@ (Core.mapTypeValues (var "l")) @@ (Core.mapTypeValues (var "r"))])],+ _Type_maybe>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_maybe>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (var "l") @@ (var "r")])],+ _Type_pair>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_pair>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (Core.pairTypeFirst (var "l")) @@ (Core.pairTypeFirst (var "r")),+ var "joinOne" @@ (Core.pairTypeSecond (var "l")) @@ (Core.pairTypeSecond (var "r"))])],+ _Type_record>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_record>>: "r" ~> var "joinRowTypes" @@ (var "l") @@ (var "r")],+ _Type_set>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_set>>: "r" ~> Flows.pure (list [+ var "joinOne" @@ (var "l") @@ (var "r")])],+ _Type_union>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_union>>: "r" ~> var "joinRowTypes" @@ (var "l") @@ (var "r")],+ _Type_unit>>: constant (cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_unit>>: constant (Flows.pure (list ([] :: [TTerm TypeConstraint])))]),+ _Type_wrap>>: "l" ~> cases _Type (var "sright") (Just (var "cannotUnify")) [+ _Type_wrap>>: "r" ~> Logic.ifElse+ (Core.equalName_ (Core.wrappedTypeTypeName (var "l")) (Core.wrappedTypeTypeName (var "r")))+ (Flows.pure (list [+ var "joinOne" @@ (Core.wrappedTypeBody (var "l")) @@ (Core.wrappedTypeBody (var "r"))]))+ (var "cannotUnify")]] -unifyTypeConstraintsDef :: TBinding (M.Map Name TypeScheme -> [TypeConstraint] -> Flow s TypeSubst)-unifyTypeConstraintsDef = define "unifyTypeConstraints" $+unifyTypeConstraints :: TBinding (M.Map Name TypeScheme -> [TypeConstraint] -> Flow s TypeSubst)+unifyTypeConstraints = define "unifyTypeConstraints" $ doc ("" <> "Robinson's algorithm, following https://www.cs.cornell.edu/courses/cs6110/2017sp/lectures/lec23.pdf\n" <> "Specifically this is an implementation of the following rules:\n"@@ -139,60 +158,59 @@ <> " * Unify(∅) = I (the identity substitution x ↦ x)\n" <> " * Unify({(x, x)} ∪ E) = Unify(E)\n" <> " * Unify({(f(s1, ..., sn), f(t1, ..., tn))} ∪ E) = Unify({(s1, t1), ..., (sn, tn)} ∪ E))") $- lambdas ["schemaTypes", "constraints"] $ lets [- "withConstraint">: lambdas ["c", "rest"] $ lets [- "sleft">: ref Rewriting.deannotateTypeDef @@ (Typing.typeConstraintLeft $ var "c"),- "sright">: ref Rewriting.deannotateTypeDef @@ (Typing.typeConstraintRight $ var "c"),- "comment">: Typing.typeConstraintComment $ var "c",- -- TODO: this occurrence check is expensive; consider delaying it until the time of substitution- "tryBinding">: lambdas ["v", "t"] $ Logic.ifElse (ref variableOccursInTypeDef @@ var "v" @@ var "t")- (Flows.fail $ "Variable " ++ (Core.unName $ var "v") ++ " appears free in type " ++ (ref ShowCore.typeDef @@ var "t")- ++ " (" ++ var "comment" ++ ")")- (var "bind" @@ var "v" @@ var "t"),- "bind">: lambdas ["v", "t"] $ lets [- "subst">: ref Substitution.singletonTypeSubstDef @@ var "v" @@ var "t",- "withResult">: lambda "s" $ ref Substitution.composeTypeSubstDef @@ var "subst" @@ var "s"] $- Flows.map (var "withResult") (ref unifyTypeConstraintsDef @@ var "schemaTypes" @@ (ref Substitution.substituteInConstraintsDef @@ var "subst" @@ var "rest")),- "noVars">: lets [- "withConstraints">: lambda "constraints2" $ ref unifyTypeConstraintsDef @@ var "schemaTypes" @@ (Lists.concat2 (var "constraints2") (var "rest"))] $- Flows.bind (ref joinTypesDef @@ var "sleft" @@ var "sright" @@ var "comment") (var "withConstraints")] $- cases _Type (var "sleft")- (Just $ cases _Type (var "sright")- (Just $ var "noVars") [- _Type_variable>>: lambda "name" $ var "tryBinding" @@ var "name" @@ var "sleft"]) [- _Type_variable>>: lambda "name" $ cases _Type (var "sright")- (Just $ var "tryBinding" @@ var "name" @@ var "sright") [- _Type_variable>>: lambda "name2" $ Logic.ifElse (Core.equalName_ (var "name") (var "name2"))- (ref unifyTypeConstraintsDef @@ var "schemaTypes" @@ var "rest")- -- Avoid replacing schema type references with temporary type variables.- (Logic.ifElse (Optionals.isJust $ Maps.lookup (var "name") (var "schemaTypes"))- (Logic.ifElse (Optionals.isJust $ Maps.lookup (var "name2") (var "schemaTypes"))- (Flows.fail $ "Attempted to unify schema names " ++ (Core.unName $ var "name") ++ " and " ++ (Core.unName $ var "name2")- ++ " (" ++ var "comment" ++ ")")- (var "bind" @@ var "name2" @@ var "sleft"))- (var "bind" @@ var "name" @@ var "sright"))]]] $- Logic.ifElse- (Lists.null $ var "constraints")- (Flows.pure $ ref Substitution.idTypeSubstDef)- (var "withConstraint" @@ (Lists.head $ var "constraints") @@ (Lists.tail $ var "constraints"))+ "schemaTypes" ~> "constraints" ~>+ "withConstraint" <~ ("c" ~> "rest" ~>+ "sleft" <~ Rewriting.deannotateType @@ (Typing.typeConstraintLeft (var "c")) $+ "sright" <~ Rewriting.deannotateType @@ (Typing.typeConstraintRight (var "c")) $+ "comment" <~ Typing.typeConstraintComment (var "c") $+ "bind" <~ ("v" ~> "t" ~>+ "subst" <~ Substitution.singletonTypeSubst @@ var "v" @@ var "t" $+ "withResult" <~ ("s" ~> Substitution.composeTypeSubst @@ var "subst" @@ var "s") $+ Flows.map (var "withResult") (unifyTypeConstraints @@ var "schemaTypes" @@ (Substitution.substituteInConstraints @@ var "subst" @@ var "rest"))) $+ "tryBinding" <~ ("v" ~> "t" ~> Logic.ifElse (variableOccursInType @@ var "v" @@ var "t")+ (Flows.fail ((string "Variable ") ++ (Core.unName (var "v")) ++ (string " appears free in type ") ++ (ShowCore.type_ @@ var "t")+ ++ (string " (") ++ var "comment" ++ (string ")")))+ (var "bind" @@ var "v" @@ var "t")) $+ "noVars" <~ (+ "withConstraints" <~ ("constraints2" ~> unifyTypeConstraints @@ var "schemaTypes" @@ (Lists.concat2 (var "constraints2") (var "rest"))) $+ Flows.bind (joinTypes @@ var "sleft" @@ var "sright" @@ var "comment") (var "withConstraints")) $+ "dflt" <~ cases _Type (var "sright")+ (Just (var "noVars")) [+ _Type_variable>>: "name" ~> var "tryBinding" @@ var "name" @@ var "sleft"] $+ cases _Type (var "sleft")+ (Just $ var "dflt") [+ _Type_variable>>: "name" ~> cases _Type (var "sright")+ (Just (var "tryBinding" @@ var "name" @@ var "sright")) [+ _Type_variable>>: "name2" ~> Logic.ifElse (Core.equalName_ (var "name") (var "name2"))+ (unifyTypeConstraints @@ var "schemaTypes" @@ var "rest")+ (Logic.ifElse (Maybes.isJust (Maps.lookup (var "name") (var "schemaTypes")))+ (Logic.ifElse (Maybes.isJust (Maps.lookup (var "name2") (var "schemaTypes")))+ (Flows.fail ((string "Attempted to unify schema names ") ++ (Core.unName (var "name")) ++ (string " and ") ++ (Core.unName (var "name2"))+ ++ (string " (") ++ var "comment" ++ (string ")")))+ (var "bind" @@ var "name2" @@ var "sleft"))+ (var "bind" @@ var "name" @@ var "sright"))]]) $+ Logic.ifElse+ (Lists.null (var "constraints"))+ (Flows.pure (Substitution.idTypeSubst))+ (var "withConstraint" @@ (Lists.head (var "constraints")) @@ (Lists.tail (var "constraints"))) -unifyTypeListsDef :: TBinding (M.Map Name TypeScheme -> [Type] -> [Type] -> String -> Flow s TypeSubst)-unifyTypeListsDef = define "unifyTypeLists" $- lambdas ["schemaTypes", "l", "r", "comment"] $ lets [- "toConstraint">: lambdas ["l", "r"] $ Typing.typeConstraint (var "l") (var "r") (var "comment")] $- ref unifyTypeConstraintsDef @@ var "schemaTypes" @@ (Lists.zipWith (var "toConstraint") (var "l") (var "r"))+unifyTypeLists :: TBinding (M.Map Name TypeScheme -> [Type] -> [Type] -> String -> Flow s TypeSubst)+unifyTypeLists = define "unifyTypeLists" $+ "schemaTypes" ~> "l" ~> "r" ~> "comment" ~>+ "toConstraint" <~ ("l" ~> "r" ~> Typing.typeConstraint (var "l") (var "r") (var "comment")) $+ unifyTypeConstraints @@ var "schemaTypes" @@ (Lists.zipWith (var "toConstraint") (var "l") (var "r")) -unifyTypesDef :: TBinding (M.Map Name TypeScheme -> Type -> Type -> String -> Flow s TypeSubst)-unifyTypesDef = define "unifyTypes" $- lambdas ["schemaTypes", "l", "r", "comment"] $- ref unifyTypeConstraintsDef @@ var "schemaTypes" @@ list [Typing.typeConstraint (var "l") (var "r") (var "comment")]+unifyTypes :: TBinding (M.Map Name TypeScheme -> Type -> Type -> String -> Flow s TypeSubst)+unifyTypes = define "unifyTypes" $+ "schemaTypes" ~> "l" ~> "r" ~> "comment" ~>+ unifyTypeConstraints @@ var "schemaTypes" @@ list [Typing.typeConstraint (var "l") (var "r") (var "comment")] -variableOccursInTypeDef :: TBinding (Name -> Type -> Bool)-variableOccursInTypeDef = define "variableOccursInType" $+variableOccursInType :: TBinding (Name -> Type -> Bool)+variableOccursInType = define "variableOccursInType" $ doc ("Determine whether a type variable appears within a type expression." <> "No distinction is made between free and bound type variables.") $- lambda "var" $ lets [- "tryType">: lambdas ["b", "typ"] $ match _Type (Just $ var "b") [- _Type_variable>>: lambda "v" $ Logic.or (var "b") (Core.equalName_ (var "v") (var "var"))]- @@ var "typ"] $- ref Rewriting.foldOverTypeDef @@ Coders.traversalOrderPre @@ var "tryType" @@ false+ "var" ~> "typ0" ~>+ "tryType" <~ ("b" ~> "typ" ~> match _Type (Just (var "b")) [+ _Type_variable>>: "v" ~> Logic.or (var "b") (Core.equalName_ (var "v") (var "var"))]+ @@ var "typ") $+ Rewriting.foldOverType @@ Coders.traversalOrderPre @@ var "tryType" @@ false @@ var "typ0"
− src/main/haskell/Hydra/Sources/Kernel/Terms/Variants.hs
@@ -1,322 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Terms.Variants where---- Standard imports for term-level kernel modules-import Hydra.Kernel-import Hydra.Sources.Libraries-import qualified Hydra.Dsl.Accessors as Accessors-import qualified Hydra.Dsl.Ast as Ast-import qualified Hydra.Dsl.Coders as Coders-import qualified Hydra.Dsl.Compute as Compute-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Grammar as Grammar-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Json as Json-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Flows as Flows-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Mantle as Mantle-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as TTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Topology as Topology-import qualified Hydra.Dsl.Types as Types-import qualified Hydra.Dsl.Typing as Typing-import Hydra.Sources.Kernel.Types.All-import Prelude hiding ((++))-import qualified Data.Int as I-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---module_ :: Module-module_ = Module (Namespace "hydra.variants") elements- []- kernelTypesModules $- Just ("Functions for working with term, type, and literal type variants, as well as numeric precision.")- where- elements = [- el eliminationVariantDef,- el eliminationVariantsDef,- el floatTypePrecisionDef,- el floatTypesDef,- el floatValueTypeDef,- el functionVariantDef,- el functionVariantsDef,- el integerTypeIsSignedDef,- el integerTypePrecisionDef,- el integerTypesDef,- el integerValueTypeDef,- el literalTypeDef,- el literalTypeVariantDef,- el literalTypesDef,- el literalVariantDef,- el literalVariantsDef,- el termVariantDef,- el termVariantsDef,- el typeVariantDef,- el typeVariantsDef]--define :: String -> TTerm a -> TBinding a-define = definitionInModule module_--eliminationVariantDef :: TBinding (Elimination -> EliminationVariant)-eliminationVariantDef = define "eliminationVariant" $- doc "Find the elimination variant (constructor) for a given elimination term" $- match _Elimination Nothing [- _Elimination_product>>: constant Mantle.eliminationVariantProduct,- _Elimination_record>>: constant Mantle.eliminationVariantRecord,- _Elimination_union>>: constant Mantle.eliminationVariantUnion,- _Elimination_wrap>>: constant Mantle.eliminationVariantWrap]--eliminationVariantsDef :: TBinding [EliminationVariant]-eliminationVariantsDef = define "eliminationVariants" $- doc "All elimination variants (constructors), in a canonical order" $- list $ unitVariant _EliminationVariant <$> [- _EliminationVariant_product,- _EliminationVariant_record,- _EliminationVariant_union,- _EliminationVariant_wrap]--floatTypePrecisionDef :: TBinding (FloatType -> Precision)-floatTypePrecisionDef = define "floatTypePrecision" $- doc "Find the precision of a given floating-point type" $- match _FloatType Nothing [- _FloatType_bigfloat>>: constant Mantle.precisionArbitrary,- _FloatType_float32>>: constant $ Mantle.precisionBits $ int32 32,- _FloatType_float64>>: constant $ Mantle.precisionBits $ int32 64]--floatTypesDef :: TBinding [FloatType]-floatTypesDef = define "floatTypes" $- doc "All floating-point types in a canonical order" $- list $ unitVariant _FloatType <$> [- _FloatType_bigfloat,- _FloatType_float32,- _FloatType_float64]--floatValueTypeDef :: TBinding (FloatValue -> FloatType)-floatValueTypeDef = define "floatValueType" $- doc "Find the float type for a given floating-point value" $- match _FloatValue Nothing [- _FloatValue_bigfloat>>: constant Core.floatTypeBigfloat,- _FloatValue_float32>>: constant Core.floatTypeFloat32,- _FloatValue_float64>>: constant Core.floatTypeFloat64]--functionVariantDef :: TBinding (Function -> FunctionVariant)-functionVariantDef = define "functionVariant" $- doc "Find the function variant (constructor) for a given function" $- match _Function Nothing [- _Function_elimination>>: constant Mantle.functionVariantElimination,- _Function_lambda>>: constant Mantle.functionVariantLambda,- _Function_primitive>>: constant Mantle.functionVariantPrimitive]--functionVariantsDef :: TBinding [FunctionVariant]-functionVariantsDef = define "functionVariants" $- doc "All function variants (constructors), in a canonical order" $- list $ unitVariant _FunctionVariant <$> [- _FunctionVariant_elimination,- _FunctionVariant_lambda,- _FunctionVariant_primitive]--integerTypeIsSignedDef :: TBinding (IntegerType -> Bool)-integerTypeIsSignedDef = define "integerTypeIsSigned" $- doc "Find whether a given integer type is signed (true) or unsigned (false)" $- match _IntegerType Nothing [- _IntegerType_bigint>>: constant true,- _IntegerType_int8>>: constant true,- _IntegerType_int16>>: constant true,- _IntegerType_int32>>: constant true,- _IntegerType_int64>>: constant true,- _IntegerType_uint8>>: constant false,- _IntegerType_uint16>>: constant false,- _IntegerType_uint32>>: constant false,- _IntegerType_uint64>>: constant false]--integerTypePrecisionDef :: TBinding (IntegerType -> Precision)-integerTypePrecisionDef = define "integerTypePrecision" $- doc "Find the precision of a given integer type" $- match _IntegerType Nothing [- _IntegerType_bigint>>: constant Mantle.precisionArbitrary,- _IntegerType_int8>>: constant $ Mantle.precisionBits $ int32 8,- _IntegerType_int16>>: constant $ Mantle.precisionBits $ int32 16,- _IntegerType_int32>>: constant $ Mantle.precisionBits $ int32 32,- _IntegerType_int64>>: constant $ Mantle.precisionBits $ int32 64,- _IntegerType_uint8>>: constant $ Mantle.precisionBits $ int32 8,- _IntegerType_uint16>>: constant $ Mantle.precisionBits $ int32 16,- _IntegerType_uint32>>: constant $ Mantle.precisionBits $ int32 32,- _IntegerType_uint64>>: constant $ Mantle.precisionBits $ int32 64]--integerTypesDef :: TBinding [IntegerType]-integerTypesDef = define "integerTypes" $- doc "All integer types, in a canonical order" $- list $ unitVariant _IntegerType <$> [- _IntegerType_bigint,- _IntegerType_int8,- _IntegerType_int16,- _IntegerType_int32,- _IntegerType_int64,- _IntegerType_uint8,- _IntegerType_uint16,- _IntegerType_uint32,- _IntegerType_uint64]--integerValueTypeDef :: TBinding (IntegerValue -> IntegerType)-integerValueTypeDef = define "integerValueType" $- doc "Find the integer type for a given integer value" $- match _IntegerValue Nothing [- _IntegerValue_bigint>>: constant Core.integerTypeBigint,- _IntegerValue_int8>>: constant Core.integerTypeInt8,- _IntegerValue_int16>>: constant Core.integerTypeInt16,- _IntegerValue_int32>>: constant Core.integerTypeInt32,- _IntegerValue_int64>>: constant Core.integerTypeInt64,- _IntegerValue_uint8>>: constant Core.integerTypeUint8,- _IntegerValue_uint16>>: constant Core.integerTypeUint16,- _IntegerValue_uint32>>: constant Core.integerTypeUint32,- _IntegerValue_uint64>>: constant Core.integerTypeUint64]--literalTypeDef :: TBinding (Literal -> LiteralType)-literalTypeDef = define "literalType" $- doc "Find the literal type for a given literal value" $- match _Literal Nothing [- _Literal_binary>>: constant $ variant _LiteralType _LiteralType_binary unit,- _Literal_boolean>>: constant $ variant _LiteralType _LiteralType_boolean unit,- _Literal_float>>: injectLambda _LiteralType _LiteralType_float <.> ref floatValueTypeDef,- _Literal_integer>>: injectLambda _LiteralType _LiteralType_integer <.> ref integerValueTypeDef,- _Literal_string>>: constant $ variant _LiteralType _LiteralType_string unit]--literalTypeVariantDef :: TBinding (LiteralType -> LiteralVariant)-literalTypeVariantDef = define "literalTypeVariant" $- doc "Find the literal type variant (constructor) for a given literal value" $- match _LiteralType Nothing [- _LiteralType_binary>>: constant $ Mantle.literalVariantBinary,- _LiteralType_boolean>>: constant $ Mantle.literalVariantBoolean,- _LiteralType_float>>: constant $ Mantle.literalVariantFloat,- _LiteralType_integer>>: constant $ Mantle.literalVariantInteger,- _LiteralType_string>>: constant $ Mantle.literalVariantString]--literalTypesDef :: TBinding [LiteralType]-literalTypesDef = define "literalTypes" $- doc "All literal types, in a canonical order" $- Lists.concat $ list [- list [- Core.literalTypeBinary,- Core.literalTypeBoolean],- Lists.map (unaryFunction Core.literalTypeFloat) (ref floatTypesDef),- Lists.map (unaryFunction Core.literalTypeInteger) (ref integerTypesDef),- list [- Core.literalTypeString]]--literalVariantDef :: TBinding (Literal -> LiteralVariant)-literalVariantDef = define "literalVariant" $- doc "Find the literal variant (constructor) for a given literal value" $- ref literalTypeVariantDef <.> ref literalTypeDef--literalVariantsDef :: TBinding [LiteralVariant]-literalVariantsDef = define "literalVariants" $- doc "All literal variants, in a canonical order" $- list $ unitVariant _LiteralVariant <$> [- _LiteralVariant_binary,- _LiteralVariant_boolean,- _LiteralVariant_float,- _LiteralVariant_integer,- _LiteralVariant_string]--termVariantDef :: TBinding (Term -> TermVariant)-termVariantDef = define "termVariant" $- doc "Find the term variant (constructor) for a given term" $- match _Term Nothing [- _Term_annotated>>: constant Mantle.termVariantAnnotated,- _Term_application>>: constant Mantle.termVariantApplication,- _Term_function>>: constant Mantle.termVariantFunction,- _Term_let>>: constant Mantle.termVariantLet,- _Term_list>>: constant Mantle.termVariantList,- _Term_literal>>: constant Mantle.termVariantLiteral,- _Term_map>>: constant Mantle.termVariantMap,- _Term_optional>>: constant Mantle.termVariantOptional,- _Term_product>>: constant Mantle.termVariantProduct,- _Term_record>>: constant Mantle.termVariantRecord,- _Term_set>>: constant Mantle.termVariantSet,- _Term_sum>>: constant Mantle.termVariantSum,- _Term_typeApplication>>: constant Mantle.termVariantTypeApplication,- _Term_typeLambda>>: constant Mantle.termVariantTypeLambda,- _Term_union>>: constant Mantle.termVariantUnion,- _Term_unit>>: constant Mantle.termVariantUnit,- _Term_variable>>: constant Mantle.termVariantVariable,- _Term_wrap>>: constant Mantle.termVariantWrap]--termVariantsDef :: TBinding [TermVariant]-termVariantsDef = define "termVariants" $- doc "All term (expression) variants, in a canonical order" $- list $ unitVariant _TermVariant <$> [- _TermVariant_annotated,- _TermVariant_application,- _TermVariant_literal,- _TermVariant_function,- _TermVariant_list,- _TermVariant_map,- _TermVariant_optional,- _TermVariant_product,- _TermVariant_record,- _TermVariant_set,- _TermVariant_sum,- _TermVariant_typeLambda,- _TermVariant_typeApplication,- _TermVariant_union,- _TermVariant_unit,- _TermVariant_variable,- _TermVariant_wrap]--typeVariantDef :: TBinding (Type -> TypeVariant)-typeVariantDef = define "typeVariant" $- doc "Find the type variant (constructor) for a given type" $- match _Type Nothing [- _Type_annotated>>: constant Mantle.typeVariantAnnotated,- _Type_application>>: constant Mantle.typeVariantApplication,- _Type_function>>: constant Mantle.typeVariantFunction,- _Type_forall>>: constant Mantle.typeVariantForall,- _Type_list>>: constant Mantle.typeVariantList,- _Type_literal>>: constant Mantle.typeVariantLiteral,- _Type_map>>: constant Mantle.typeVariantMap,- _Type_optional>>: constant Mantle.typeVariantOptional,- _Type_product>>: constant Mantle.typeVariantProduct,- _Type_record>>: constant Mantle.typeVariantRecord,- _Type_set>>: constant Mantle.typeVariantSet,- _Type_sum>>: constant Mantle.typeVariantSum,- _Type_union>>: constant Mantle.typeVariantUnion,- _Type_unit>>: constant Mantle.typeVariantUnit,- _Type_variable>>: constant Mantle.typeVariantVariable,- _Type_wrap>>: constant Mantle.typeVariantWrap]--typeVariantsDef :: TBinding [TypeVariant]-typeVariantsDef = define "typeVariants" $- doc "All type variants, in a canonical order" $- list $ unitVariant _TypeVariant <$> [- _TypeVariant_annotated,- _TypeVariant_application,- _TypeVariant_function,- _TypeVariant_forall,- _TypeVariant_list,- _TypeVariant_literal,- _TypeVariant_map,- _TypeVariant_wrap,- _TypeVariant_optional,- _TypeVariant_product,- _TypeVariant_record,- _TypeVariant_set,- _TypeVariant_sum,- _TypeVariant_union,- _TypeVariant_unit,- _TypeVariant_variable]
src/main/haskell/Hydra/Sources/Kernel/Types/Accessors.hs view
@@ -2,68 +2,135 @@ -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.accessors"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $+module_ = Module ns elements [Core.ns] [Core.ns] $ Just "A model for term access patterns" where- ns = Namespace "hydra.accessors"- def = datatype ns- accessors = typeref ns- core = typeref $ moduleNamespace Core.module_- elements = [+ accessorEdge,+ accessorGraph,+ accessorNode,+ accessorPath,+ termAccessor] - def "AccessorEdge" $- record [- "source">: accessors "AccessorNode",- "path">: accessors "AccessorPath",- "target">: accessors "AccessorNode"],+accessorEdge :: Binding+accessorEdge = define "AccessorEdge" $+ doc "An edge in an accessor graph, connecting two nodes via a path" $+ T.record [+ "source">:+ doc "The source node of the edge"+ accessorNode,+ "path">:+ doc "The accessor path connecting source to target"+ accessorPath,+ "target">:+ doc "The target node of the edge"+ accessorNode] - def "AccessorGraph" $- record [- "nodes">: list $ accessors "AccessorNode",- "edges">: list $ accessors "AccessorEdge"],+accessorGraph :: Binding+accessorGraph = define "AccessorGraph" $+ doc "A graph of accessor nodes and edges, representing term access patterns" $+ T.record [+ "nodes">:+ doc "All nodes in the graph" $+ T.list accessorNode,+ "edges">:+ doc "All edges in the graph" $+ T.list accessorEdge] - def "AccessorNode" $- record [- "name">: core "Name",- "label">: string,- "id" >: string],+accessorNode :: Binding+accessorNode = define "AccessorNode" $+ doc "A node in an accessor graph, representing a term or subterm" $+ T.record [+ "name">:+ doc "The qualified name of the term"+ Core.name,+ "label">:+ doc "A human-readable label for the node"+ T.string,+ "id" >:+ doc "A unique identifier for the node"+ T.string] - def "AccessorPath" $- wrap $ list $ accessors "TermAccessor",+accessorPath :: Binding+accessorPath = define "AccessorPath" $+ doc "A sequence of term accessors forming a path through a term" $+ T.wrap $ T.list termAccessor - def "TermAccessor" $- doc "A function which maps from a term to a particular immediate subterm" $- union [- "annotatedSubject">: unit,- "applicationFunction">: unit,- "applicationArgument">: unit,- "lambdaBody">: unit,- "unionCasesDefault">: unit,- "unionCasesBranch">: core "Name",- "letEnvironment">: unit,- "letBinding">: core "Name",- "listElement">: int32,- "mapKey">: int32,- "mapValue">: int32,- "optionalTerm">: unit,- "productTerm">: int32,- "recordField">: core "Name",- "setElement">: int32,- "sumTerm">: unit,- "typeLambdaBody">: unit,- "typeApplicationTerm">: unit,- "injectionTerm">: unit,- "wrappedTerm">: unit]]+termAccessor :: Binding+termAccessor = define "TermAccessor" $+ doc "A function which maps from a term to a particular immediate subterm" $+ T.union [+ "annotatedBody">:+ doc "Access the body of an annotated term"+ T.unit,+ "applicationFunction">:+ doc "Access the function of an application term"+ T.unit,+ "applicationArgument">:+ doc "Access the argument of an application term"+ T.unit,+ "lambdaBody">:+ doc "Access the body of a lambda term"+ T.unit,+ "unionCasesDefault">:+ doc "Access the default case of a union elimination"+ T.unit,+ "unionCasesBranch">:+ doc "Access a specific branch of a union elimination by field name"+ Core.name,+ "letBody">:+ doc "Access the body of a let term"+ T.unit,+ "letBinding">:+ doc "Access a specific binding in a let term by variable name"+ Core.name,+ "listElement">:+ doc "Access an element of a list by index"+ T.int32,+ "mapKey">:+ doc "Access a key in a map by index"+ T.int32,+ "mapValue">:+ doc "Access a value in a map by index"+ T.int32,+ "maybeTerm">:+ doc "Access the term inside a Just value"+ T.unit,+ "productTerm">:+ doc "Access an element of a product (tuple) by index"+ T.int32,+ "recordField">:+ doc "Access a field of a record by field name"+ Core.name,+ "setElement">:+ doc "Access an element of a set by index"+ T.int32,+ "sumTerm">:+ doc "Access the term inside a sum variant"+ T.unit,+ "typeLambdaBody">:+ doc "Access the body of a type lambda term"+ T.unit,+ "typeApplicationTerm">:+ doc "Access the term being applied to a type"+ T.unit,+ "injectionTerm">:+ doc "Access the term inside a union injection"+ T.unit,+ "wrappedTerm">:+ doc "Access the term inside a wrapped term"+ T.unit]
src/main/haskell/Hydra/Sources/Kernel/Types/All.hs view
@@ -5,15 +5,17 @@ import qualified Hydra.Sources.Kernel.Types.Accessors as Accessors import qualified Hydra.Sources.Kernel.Types.Ast as Ast+import qualified Hydra.Sources.Kernel.Types.Classes as Classes import qualified Hydra.Sources.Kernel.Types.Coders as Coders import qualified Hydra.Sources.Kernel.Types.Compute as Compute import qualified Hydra.Sources.Kernel.Types.Constraints as Constraints import qualified Hydra.Sources.Kernel.Types.Core as Core import qualified Hydra.Sources.Kernel.Types.Grammar as Grammar import qualified Hydra.Sources.Kernel.Types.Graph as Graph-import qualified Hydra.Sources.Kernel.Types.Json as Json-import qualified Hydra.Sources.Kernel.Types.Mantle as Mantle+import qualified Hydra.Sources.Json.Model as JsonModel+import qualified Hydra.Sources.Kernel.Types.Variants as Variants import qualified Hydra.Sources.Kernel.Types.Module as Module+import qualified Hydra.Sources.Kernel.Types.Parsing as Parsing import qualified Hydra.Sources.Kernel.Types.Phantoms as Phantoms import qualified Hydra.Sources.Kernel.Types.Query as Query import qualified Hydra.Sources.Kernel.Types.Relational as Relational@@ -21,6 +23,7 @@ import qualified Hydra.Sources.Kernel.Types.Testing as Testing import qualified Hydra.Sources.Kernel.Types.Topology as Topology import qualified Hydra.Sources.Kernel.Types.Typing as Typing+import qualified Hydra.Sources.Kernel.Types.Util as Util import qualified Hydra.Sources.Kernel.Types.Workflow as Workflow @@ -28,15 +31,16 @@ kernelTypesModules = [ Accessors.module_, Ast.module_,+ Classes.module_, Coders.module_, Compute.module_, Constraints.module_, Core.module_, Grammar.module_, Graph.module_,- Json.module_,- Mantle.module_,+ JsonModel.module_, Module.module_,+ Parsing.module_, Phantoms.module_, Query.module_, Relational.module_,@@ -44,4 +48,10 @@ Testing.module_, Topology.module_, Typing.module_,+ Util.module_,+ Variants.module_, Workflow.module_]++-- | Namespaces of all kernel type modules+kernelTypesNamespaces :: [Namespace]+kernelTypesNamespaces = fmap moduleNamespace kernelTypesModules
src/main/haskell/Hydra/Sources/Kernel/Types/Ast.hs view
@@ -1,106 +1,190 @@ module Hydra.Sources.Kernel.Types.Ast where -- Standard type-level kernel imports-import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Kernel hiding (op, brackets)+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.ast"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [] [Core.module_] $+module_ = Module ns elements [] [Core.ns] $ Just "A model which provides a common syntax tree for Hydra serializers" where- ns = Namespace "hydra.ast"- def = datatype ns- ast = typeref ns- elements = [+ associativity,+ blockStyle,+ bracketExpr,+ brackets,+ expr,+ indentedExpression,+ indentStyle,+ op,+ opExpr,+ padding,+ precedence,+ symbol,+ ws] - def "Associativity" $- doc "Operator associativity" $- enum ["none", "left", "right", "both"],+associativity :: Binding+associativity = define "Associativity" $+ doc "Operator associativity" $+ T.enum ["none", "left", "right", "both"] - def "BlockStyle" $- doc "Formatting option for code blocks" $- record [- "indent">: optional string,- "newlineBeforeContent">: boolean,- "newlineAfterContent">: boolean],+blockStyle :: Binding+blockStyle = define "BlockStyle" $+ doc "Formatting option for code blocks" $+ T.record [+ "indent">:+ doc "An optional indentation string" $+ T.maybe T.string,+ "newlineBeforeContent">:+ doc "Whether to place a newline before the content" $+ T.boolean,+ "newlineAfterContent">:+ doc "Whether to place a newline after the content" $+ T.boolean] - def "BracketExpr" $- doc "An expression enclosed by brackets" $- record [- "brackets">: ast "Brackets",- "enclosed">: ast "Expr",- "style">: ast "BlockStyle"],+bracketExpr :: Binding+bracketExpr = define "BracketExpr" $+ doc "An expression enclosed by brackets" $+ T.record [+ "brackets">:+ doc "The bracket pair enclosing the expression"+ brackets,+ "enclosed">:+ doc "The expression within the brackets"+ expr,+ "style">:+ doc "The formatting style for the bracketed block"+ blockStyle] - def "Brackets" $- doc "Matching open and close bracket symbols" $- record [- "open">: ast "Symbol",- "close">: ast "Symbol"],+brackets :: Binding+brackets = define "Brackets" $+ doc "Matching open and close bracket symbols" $+ T.record [+ "open">:+ doc "The opening bracket symbol"+ symbol,+ "close">:+ doc "The closing bracket symbol"+ symbol] - def "Expr" $- doc "An abstract expression" $- union [- "const">: ast "Symbol",- "indent">: ast "IndentedExpression",- "op">: ast "OpExpr",- "brackets">: ast "BracketExpr"],+expr :: Binding+expr = define "Expr" $+ doc "An abstract expression" $+ T.union [+ "const">:+ doc "A constant symbol"+ symbol,+ "indent">:+ doc "An indented expression"+ indentedExpression,+ "op">:+ doc "An operator expression"+ opExpr,+ "brackets">:+ doc "A bracketed expression"+ bracketExpr] - def "IndentedExpression" $- doc "An expression indented in a certain style" $- record [- "style">: ast "IndentStyle",- "expr">: ast "Expr"],+indentedExpression :: Binding+indentedExpression = define "IndentedExpression" $+ doc "An expression indented in a certain style" $+ T.record [+ "style">:+ doc "The indentation style"+ indentStyle,+ "expr">:+ doc "The expression to be indented"+ expr] - def "IndentStyle" $- doc "Any of several indentation styles" $- union [- "allLines">: string,- "subsequentLines">: string],+indentStyle :: Binding+indentStyle = define "IndentStyle" $+ doc "Any of several indentation styles" $+ T.union [+ "allLines">:+ doc "Indent all lines with the given string" $+ T.string,+ "subsequentLines">:+ doc "Indent only lines after the first with the given string" $+ T.string] - def "Op" $- doc "An operator symbol" $- record [- "symbol">: ast "Symbol",- "padding">: ast "Padding",- "precedence">: ast "Precedence",- "associativity">: ast "Associativity"],+op :: Binding+op = define "Op" $+ doc "An operator symbol" $+ T.record [+ "symbol">:+ doc "The operator symbol"+ symbol,+ "padding">:+ doc "The padding around the operator"+ padding,+ "precedence">:+ doc "The precedence of the operator"+ precedence,+ "associativity">:+ doc "The associativity of the operator"+ associativity] - def "OpExpr" $- doc "An operator expression" $- record [- "op">: ast "Op",- "lhs">: ast "Expr",- "rhs">: ast "Expr"],+opExpr :: Binding+opExpr = define "OpExpr" $+ doc "An operator expression" $+ T.record [+ "op">:+ doc "The operator"+ op,+ "lhs">:+ doc "The left-hand side operand"+ expr,+ "rhs">:+ doc "The right-hand side operand"+ expr] - def "Padding" $- doc "Left and right padding for an operator" $- record [- "left">: ast "Ws",- "right">: ast "Ws"],+padding :: Binding+padding = define "Padding" $+ doc "Left and right padding for an operator" $+ T.record [+ "left">:+ doc "Padding to the left of the operator"+ ws,+ "right">:+ doc "Padding to the right of the operator"+ ws] - def "Precedence" $- doc "Operator precedence" $- wrap int32,+precedence :: Binding+precedence = define "Precedence" $+ doc "Operator precedence" $+ T.wrap T.int32 - def "Symbol" $- doc "Any symbol" $- wrap string,+symbol :: Binding+symbol = define "Symbol" $+ doc "Any symbol" $+ T.wrap T.string - def "Ws" $- doc "One of several classes of whitespace" $- union [- "none">: unit,- "space">: unit,- "break">: unit,- "breakAndIndent">: string,- "doubleBreak">: unit]]+ws :: Binding+ws = define "Ws" $+ doc "One of several classes of whitespace" $+ T.union [+ "none">:+ doc "No whitespace" $+ T.unit,+ "space">:+ doc "A single space" $+ T.unit,+ "break">:+ doc "A line break" $+ T.unit,+ "breakAndIndent">:+ doc "A line break followed by indentation" $+ T.string,+ "doubleBreak">:+ doc "Two line breaks" $+ T.unit]
+ src/main/haskell/Hydra/Sources/Kernel/Types/Classes.hs view
@@ -0,0 +1,30 @@+module Hydra.Sources.Kernel.Types.Classes where++-- Standard type-level kernel imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.classes"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [Core.ns] [Core.ns] $+ Just "Type classes"+ where+ elements = [+ typeClass]++typeClass :: Binding+typeClass = define "TypeClass" $+ doc "Any of a small number of built-in type classes" $+ T.enum [+ "equality",+ "ordering"]
src/main/haskell/Hydra/Sources/Kernel/Types/Coders.hs view
@@ -1,104 +1,120 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Coders where -- Standard type-level kernel imports-import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Kernel hiding (language, languageName, languageConstraints)+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y- import qualified Hydra.Sources.Kernel.Types.Compute as Compute import qualified Hydra.Sources.Kernel.Types.Graph as Graph-import qualified Hydra.Sources.Kernel.Types.Mantle as Mantle+import qualified Hydra.Sources.Kernel.Types.Variants as Variants +ns :: Namespace+ns = Namespace "hydra.coders"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Graph.module_, Compute.module_] [Core.module_] $+module_ = Module ns elements [Graph.ns, Compute.ns, Variants.ns] [Core.ns] $ Just "Abstractions for paired transformations between languages" where- ns = Namespace "hydra.coders"- core = typeref $ moduleNamespace Core.module_- compute = typeref $ moduleNamespace Compute.module_- graph = typeref $ moduleNamespace Graph.module_- mantle = typeref $ moduleNamespace Mantle.module_- coders = typeref ns-- def = datatype ns- elements = [+ adapterContext,+ coderDirection,+ language,+ languageConstraints,+ languageName,+ symmetricAdapter,+ traversalOrder,+ typeAdapter] - def "AdapterContext" $- doc "An evaluation context together with a source language and a target language" $- record [- "graph">: graph "Graph",- "language">: coders "Language",- "adapters">: Types.map (core "Name") (compute "Adapter"- @@ coders "AdapterContext" @@ coders "AdapterContext"- @@ core "Type" @@ core "Type"- @@ core "Term" @@ core "Term")],+adapterContext :: Binding+adapterContext = define "AdapterContext" $+ doc "An evaluation context together with a source language and a target language" $+ T.record [+ "graph">:+ doc "The underlying graph of elements and primitives"+ Graph.graph,+ "language">:+ doc "The language being encoded or decoded"+ language,+ "adapters">:+ doc "A map of type names to adapters for those types" $+ T.map Core.name (Compute.adapter+ @@ adapterContext @@ adapterContext+ @@ Core.type_ @@ Core.type_+ @@ Core.term @@ Core.term)] - def "CoderDirection" $- doc "Indicates either the 'out' or the 'in' direction of a coder" $- enum [- "encode",- "decode"],+coderDirection :: Binding+coderDirection = define "CoderDirection" $+ doc "Indicates either the 'out' or the 'in' direction of a coder" $+ T.enum [+ "encode",+ "decode"] - def "Language" $- doc "A named language together with language-specific constraints" $- record [- "name">: coders "LanguageName",- "constraints">: coders "LanguageConstraints"],+language :: Binding+language = define "Language" $+ doc "A named language together with language-specific constraints" $+ T.record [+ "name">:+ doc "The unique name of the language"+ languageName,+ "constraints">:+ doc "The constraints which characterize the language"+ languageConstraints] - def "LanguageConstraints" $- doc "A set of constraints on valid type and term expressions, characterizing a language" $- record [- "eliminationVariants">:- doc "All supported elimination variants" $- Types.set $ mantle "EliminationVariant",- "literalVariants">:- doc "All supported literal variants" $- Types.set $ mantle "LiteralVariant",- "floatTypes">:- doc "All supported float types" $- Types.set $ core "FloatType",- "functionVariants">:- doc "All supported function variants" $- Types.set $ mantle "FunctionVariant",- "integerTypes">:- doc "All supported integer types" $- Types.set $ core "IntegerType",- "termVariants">:- doc "All supported term variants" $- Types.set $ mantle "TermVariant",- "typeVariants">:- doc "All supported type variants" $- Types.set $ mantle "TypeVariant",- "types">:- doc "A logical set of types, as a predicate which tests a type for inclusion" $- core "Type" --> boolean],+languageConstraints :: Binding+languageConstraints = define "LanguageConstraints" $+ doc "A set of constraints on valid type and term expressions, characterizing a language" $+ T.record [+ "eliminationVariants">:+ doc "All supported elimination variants" $+ T.set Variants.eliminationVariant,+ "literalVariants">:+ doc "All supported literal variants" $+ T.set Variants.literalVariant,+ "floatTypes">:+ doc "All supported float types" $+ T.set Core.floatType,+ "functionVariants">:+ doc "All supported function variants" $+ T.set Variants.functionVariant,+ "integerTypes">:+ doc "All supported integer types" $+ T.set Core.integerType,+ "termVariants">:+ doc "All supported term variants" $+ T.set Variants.termVariant,+ "typeVariants">:+ doc "All supported type variants" $+ T.set Variants.typeVariant,+ "types">:+ doc "A logical set of types, as a predicate which tests a type for inclusion" $+ Core.type_ ~> T.boolean] - def "LanguageName" $- doc "The unique name of a language" $- wrap string,+languageName :: Binding+languageName = define "LanguageName" $+ doc "The unique name of a language" $+ T.wrap T.string - def "SymmetricAdapter" $- doc "A bidirectional encoder which maps between the same type and term languages on either side" $- forAlls ["s", "t", "v"] $ compute "Adapter" @@ "s" @@ "s" @@ "t" @@ "t" @@ "v" @@ "v",+symmetricAdapter :: Binding+symmetricAdapter = define "SymmetricAdapter" $+ doc "A bidirectional encoder which maps between the same type and term languages on either side" $+ T.forAlls ["s", "t", "v"] $ Compute.adapter @@ "s" @@ "s" @@ "t" @@ "t" @@ "v" @@ "v" - def "TraversalOrder" $- doc "Specifies either a pre-order or post-order traversal" $- union [- "pre">: doc "Pre-order traversal" unit,- "post">: doc "Post-order traversal" unit],+traversalOrder :: Binding+traversalOrder = define "TraversalOrder" $+ doc "Specifies either a pre-order or post-order traversal" $+ T.union [+ "pre">: doc "Pre-order traversal" T.unit,+ "post">: doc "Post-order traversal" T.unit] - def "TypeAdapter" $- doc "A function which maps a Hydra type to a symmetric adapter between types and terms" $- core "Type" --> compute "Flow" @@ coders "AdapterContext" @@- (coders "SymmetricAdapter" @@ coders "AdapterContext" @@ core "Type" @@ core "Term")]+typeAdapter :: Binding+typeAdapter = define "TypeAdapter" $+ doc "A function which maps a Hydra type to a symmetric adapter between types and terms" $+ Core.type_ ~> Compute.flow @@ adapterContext @@+ (symmetricAdapter @@ adapterContext @@ Core.type_ @@ Core.term)
src/main/haskell/Hydra/Sources/Kernel/Types/Compute.hs view
@@ -1,69 +1,101 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Compute where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.compute"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $+module_ = Module ns elements [Core.ns] [Core.ns] $ Just "Abstractions for single- and bidirectional transformations" where- ns = Namespace "hydra.compute"- core = typeref $ moduleNamespace Core.module_- compute = typeref ns-- def = datatype ns- elements = [+ adapter,+ bicoder,+ coder,+ flow,+ flowState,+ trace] - def "Adapter" $- doc "A two-level bidirectional encoder which adapts types to types and terms to terms" $- forAlls ["s1", "s2", "t1", "t2", "v1", "v2"] $ record [- "isLossy">: boolean,- "source">: var "t1",- "target">: var "t2",- "coder">: compute "Coder" @@ "s1" @@ "s2" @@ "v1" @@ "v2"],+adapter :: Binding+adapter = define "Adapter" $+ doc "A two-level bidirectional encoder which adapts types to types and terms to terms" $+ T.forAlls ["s1", "s2", "t1", "t2", "v1", "v2"] $ T.record [+ "isLossy">:+ doc "Whether information may be lost in the course of this adaptation"+ T.boolean,+ "source">:+ doc "The source type"+ "t1",+ "target">:+ doc "The target type"+ "t2",+ "coder">:+ doc "The coder for transforming instances of the source type to instances of the target type" $+ coder @@ "s1" @@ "s2" @@ "v1" @@ "v2"] - def "Bicoder" $- doc "A two-level encoder and decoder, operating both at a type level and an instance (data) level" $- forAlls ["s1", "s2", "t1", "t2", "v1", "v2"] $ record [- "encode">: "t1" --> compute "Adapter" @@ "s1" @@ "s2" @@ "t1" @@ "t2" @@ "v1" @@ "v2",- "decode">: "t2" --> compute "Adapter" @@ "s2" @@ "s1" @@ "t2" @@ "t1" @@ "v2" @@ "v1"],+bicoder :: Binding+bicoder = define "Bicoder" $+ doc "A two-level encoder and decoder, operating both at a type level and an instance (data) level" $+ T.forAlls ["s1", "s2", "t1", "t2", "v1", "v2"] $ T.record [+ "encode">:+ doc "A function from source types to adapters" $+ "t1" ~> adapter @@ "s1" @@ "s2" @@ "t1" @@ "t2" @@ "v1" @@ "v2",+ "decode">:+ doc "A function from target types to adapters" $+ "t2" ~> adapter @@ "s2" @@ "s1" @@ "t2" @@ "t1" @@ "v2" @@ "v1"] - def "Coder" $- doc "An encoder and decoder; a bidirectional flow between two types" $- forAlls ["s1", "s2", "v1", "v2"] $ record [- "encode">: ("v1" --> compute "Flow" @@ "s1" @@ "v2"),- "decode">: ("v2" --> compute "Flow" @@ "s2" @@ "v1")],+coder :: Binding+coder = define "Coder" $+ doc "An encoder and decoder; a bidirectional flow between two types" $+ T.forAlls ["s1", "s2", "v1", "v2"] $ T.record [+ "encode">:+ doc "A function from source values to a flow of target values" $+ "v1" ~> flow @@ "s1" @@ "v2",+ "decode">:+ doc "A function from target values to a flow of source values" $+ "v2" ~> flow @@ "s2" @@ "v1"] - def "Flow" $- doc "A variant of the State monad with built-in logging and error handling" $- forAlls ["s", "v"] $ wrap $- function "s" (compute "Trace" --> compute "FlowState" @@ "s" @@ "v"),+flow :: Binding+flow = define "Flow" $+ doc "A variant of the State monad with built-in logging and error handling" $+ T.forAlls ["s", "v"] $ T.wrap $+ "s" ~> trace ~> flowState @@ "s" @@ "v" - def "FlowState" $- doc "The result of evaluating a Flow" $- forAlls ["s", "v"] $ record [- "value">: optional "v",- "state">: "s",- "trace">: compute "Trace"],+flowState :: Binding+flowState = define "FlowState" $+ doc "The result of evaluating a Flow" $+ T.forAlls ["s", "v"] $ T.record [+ "value">:+ doc "The resulting value, or nothing in the case of failure" $+ T.maybe "v",+ "state">:+ doc "The final state"+ "s",+ "trace">:+ doc "The trace (log) produced during evaluation"+ trace] - def "Trace" $- doc "A container for logging and error information" $- record [- "stack">: list string,- "messages">: list string,- "other">:- doc "A map of string keys to arbitrary terms as values, for application-specific use" $- Types.map (core "Name") (core "Term")]]+trace :: Binding+trace = define "Trace" $+ doc "A container for logging and error information" $+ T.record [+ "stack">:+ doc "A stack of context labels" $+ T.list T.string,+ "messages">:+ doc "A log of warnings and/or info messages" $+ T.list T.string,+ "other">:+ doc "A map of string keys to arbitrary terms as values, for application-specific use" $+ T.map Core.name Core.term]
src/main/haskell/Hydra/Sources/Kernel/Types/Constraints.hs view
@@ -1,42 +1,47 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Constraints where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y- import qualified Hydra.Sources.Kernel.Types.Query as Query +ns :: Namespace+ns = Namespace "hydra.constraints"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Query.module_] [Core.module_] $+module_ = Module ns elements [Query.ns] [Core.ns] $ Just "A model for path- and pattern-based graph constraints, which may be considered as part of the schema of a graph" where- ns = Namespace "hydra.constraints"- core = typeref $ moduleNamespace Core.module_- query = typeref $ moduleNamespace Query.module_- constraints = typeref ns- def = datatype ns- elements = [+ pathEquation,+ patternImplication] - def "PathEquation" $- doc "A declared equivalence between two abstract paths in a graph" $- record [- "left">: query "Path",- "right">: query "Path"],+pathEquation :: Binding+pathEquation = define "PathEquation" $+ doc "A declared equivalence between two abstract paths in a graph" $+ T.record [+ "left">:+ doc "The left-hand side of the equation"+ Query.path,+ "right">:+ doc "The right-hand side of the equation"+ Query.path] - def "PatternImplication" $- doc "A pattern which, if it matches in a given graph, implies that another pattern must also match. Query variables are shared between the two patterns." $- record [- "antecedent">: query "Pattern",- "consequent">: query "Pattern"]]+patternImplication :: Binding+patternImplication = define "PatternImplication" $+ doc "A pattern which, if it matches in a given graph, implies that another pattern must also match. Query variables are shared between the two patterns." $+ T.record [+ "antecedent">:+ doc "The pattern which, if it matches, triggers the constraint"+ Query.pattern,+ "consequent">:+ doc "The pattern which must also match when the antecedent matches"+ Query.pattern]
src/main/haskell/Hydra/Sources/Kernel/Types/Core.hs view
@@ -1,401 +1,603 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Core where -import Hydra.Kernel+-- Special "bootstrapping" imports for hydra.core+import Hydra.Kernel hiding (literalType)+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:))+import qualified Hydra.Dsl.Types as T +ns :: Namespace+ns = Namespace "hydra.core"++define :: String -> Type -> Binding+define = defineType ns+ hydraCoreGraph :: Graph hydraCoreGraph = elementsToGraph bootstrapGraph Nothing (moduleElements module_) module_ :: Module-module_ = Module ns elements [] [module_] $ -- Note: hydra.core uniquely takes itself as a type-level dependency+module_ = Module ns elements [] [ns] $ -- Note: hydra.core uniquely takes itself as a type-level dependency Just "Hydra's core data model, consisting of the fundamental hydra.core.Term type and all of its dependencies." where- ns = Namespace "hydra.core"- core = typeref ns- def = datatype ns- doc s = setTypeDescription (Just s)- elements = [+ annotatedTerm,+ annotatedType,+ application,+ applicationType,+ binding,+ caseStatement,+ eitherType,+ pairType,+ elimination,+ field,+ fieldType,+ floatType,+ floatValue,+ forallType,+ function,+ functionType,+ injection,+ integerType,+ integerValue,+ lambda,+ let_,+ literal,+ literalType,+ mapType,+ name,+ projection,+ record,+ rowType,+ term,+ type_,+ typeApplicationTerm,+ typeLambda,+ typeScheme,+ typeVariableMetadata,+ wrappedTerm,+ wrappedType] - def "AnnotatedTerm" $- doc "A term together with an annotation" $- record [- "subject">: core "Term",- "annotation">: Types.map (core "Name") $ core "Term"],+annotatedTerm :: Binding+annotatedTerm = define "AnnotatedTerm" $+ doc "A term together with an annotation" $+ T.record [+ "body">:+ doc "The term being annotated"+ term,+ "annotation">:+ doc "The annotation as a map from keys to values" $+ T.map name term] - def "AnnotatedType" $- doc "A type together with an annotation" $- record [- "subject">: core "Type",- "annotation">: Types.map (core "Name") $ core "Term"],+annotatedType :: Binding+annotatedType = define "AnnotatedType" $+ doc "A type together with an annotation" $+ T.record [+ "body">:+ doc "The type being annotated"+ type_,+ "annotation">:+ doc "The annotation as a map from keys to values" $+ T.map name term] - def "Application" $- doc "A term which applies a function to an argument" $- record [- "function">:- doc "The left-hand side of the application" $- core "Term",- "argument">:- doc "The right-hand side of the application" $- core "Term"],+application :: Binding+application = define "Application" $+ doc "A term which applies a function to an argument" $+ T.record [+ "function">:+ doc "The left-hand side of the application"+ term,+ "argument">:+ doc "The right-hand side of the application"+ term] - def "ApplicationType" $- doc "The type-level analog of an application term" $- record [- "function">:- doc "The left-hand side of the application" $- core "Type",- "argument">:- doc "The right-hand side of the application" $- core "Type"],+applicationType :: Binding+applicationType = define "ApplicationType" $+ doc "The type-level analog of an application term" $+ T.record [+ "function">:+ doc "The left-hand side of the application"+ type_,+ "argument">:+ doc "The right-hand side of the application"+ type_] - def "CaseStatement" $- doc "A union elimination; a case statement" $- record [- "typeName">: core "Name",- "default">: optional (core "Term"),- "cases">: list $ core "Field"],+binding :: Binding+binding = define "Binding" $+ doc "A field with an optional type scheme, used to bind variables to terms in a 'let' expression" $+ T.record [+ "name">:+ doc "The name of the bound variable"+ name,+ "term">:+ doc "The term to which the variable is bound"+ term,+ "type">:+ doc "The optional type of the bound term" $+ T.maybe typeScheme] - def "Elimination" $- doc "A corresponding elimination for an introduction term" $- union [- "product">:- doc "Eliminates a tuple by projecting the component at a given 0-indexed offset" $- core "TupleProjection",- "record">:- doc "Eliminates a record by projecting a given field" $- core "Projection",- "union">:- doc "Eliminates a union term by matching over the fields of the union. This is a case statement." $- core "CaseStatement",- "wrap">:- doc "Unwrap a wrapped term" $- core "Name"],+caseStatement :: Binding+caseStatement = define "CaseStatement" $+ doc "A union elimination; a case statement" $+ T.record [+ "typeName">:+ doc "The name of the union type"+ name,+ "default">:+ doc "An optional default case, used if none of the explicit cases match" $+ T.maybe term,+ "cases">:+ doc "A list of case alternatives, one per union field" $+ T.list field] - def "Field" $- doc "A name/term pair" $- record [- "name">: core "Name",- "term">: core "Term"],+eitherType :: Binding+eitherType = define "EitherType" $+ doc "A type which provides a choice between a 'left' type and a 'right' type" $+ T.record [+ "left">:+ doc "The 'left' alternative"+ type_,+ "right">:+ doc "The 'right' alternative"+ type_] - def "FieldType" $- doc "A name/type pair" $- record [- "name">: core "Name",- "type">: core "Type"],+pairType :: Binding+pairType = define "PairType" $+ doc "A type which pairs a 'first' type and a 'second' type" $+ T.record [+ "first">:+ doc "The first component of the pair"+ type_,+ "second">:+ doc "The second component of the pair"+ type_] - def "FloatType" $- doc "A floating-point type" $- enum [- "bigfloat",- "float32",- "float64"],+elimination :: Binding+elimination = define "Elimination" $+ doc "A corresponding elimination for an introduction term" $+ T.union [+ "record">:+ doc "Eliminates a record by projecting a given field"+ projection,+ "union">:+ doc "Eliminates a union term by matching over the fields of the union. This is a case statement."+ caseStatement,+ "wrap">:+ doc "Unwrap a wrapped term"+ name] - def "FloatValue" $- doc "A floating-point literal value" $- union [- "bigfloat">:- doc "An arbitrary-precision floating-point value" bigfloat,- "float32">:- doc "A 32-bit floating-point value" float32,- "float64">:- doc "A 64-bit floating-point value" float64],+field :: Binding+field = define "Field" $+ doc "A name/term pair" $+ T.record [+ "name">:+ doc "The name of the field"+ name,+ "term">:+ doc "The term value of the field"+ term] - def "ForallType" $- doc "A universally quantified type; the System F equivalent of a type scheme, and the type-level equivalent of a lambda term." $- record [- "parameter">:- doc "The variable which is bound by the lambda" $- core "Name",- "body">:- doc "The body of the lambda" $- core "Type"],+fieldType :: Binding+fieldType = define "FieldType" $+ doc "A name/type pair" $+ T.record [+ "name">:+ doc "The name of the field"+ name,+ "type">:+ doc "The type of the field"+ type_] - def "Function" $- doc "A function" $- union [- "elimination">:- doc "An elimination for any of a few term variants" $- core "Elimination",- "lambda">:- doc "A function abstraction (lambda)" $- core "Lambda",- "primitive">:- doc "A reference to a built-in (primitive) function" $- core "Name"],+floatType :: Binding+floatType = define "FloatType" $+ doc "A floating-point type" $+ T.union [+ "bigfloat">:+ doc "An arbitrary-precision floating-point type" $+ T.unit,+ "float32">:+ doc "A 32-bit floating-point type" $+ T.unit,+ "float64">:+ doc "A 64-bit floating-point type" $+ T.unit] - def "FunctionType" $- doc "A function type, also known as an arrow type" $- record [- "domain">: core "Type",- "codomain">: core "Type"],+floatValue :: Binding+floatValue = define "FloatValue" $+ doc "A floating-point literal value" $+ T.union [+ "bigfloat">:+ doc "An arbitrary-precision floating-point value" T.bigfloat,+ "float32">:+ doc "A 32-bit floating-point value" T.float32,+ "float64">:+ doc "A 64-bit floating-point value" T.float64] - def "Injection" $- doc "An instance of a union type; i.e. a string-indexed generalization of inl() or inr()" $- record [- "typeName">: core "Name",- "field">: core "Field"],+forallType :: Binding+forallType = define "ForallType" $+ doc "A universally quantified type; the System F equivalent of a type scheme, and the type-level equivalent of a lambda term." $+ T.record [+ "parameter">:+ doc "The variable which is bound by the lambda"+ name,+ "body">:+ doc "The body of the lambda"+ type_] - def "IntegerType" $- doc "An integer type" $- enum [- "bigint",- "int8",- "int16",- "int32",- "int64",- "uint8",- "uint16",- "uint32",- "uint64"],+function :: Binding+function = define "Function" $+ doc "A function" $+ T.union [+ "elimination">:+ doc "An elimination for any of a few term variants"+ elimination,+ "lambda">:+ doc "A function abstraction (lambda)"+ lambda,+ "primitive">:+ doc "A reference to a built-in (primitive) function"+ name] - def "IntegerValue" $- doc "An integer literal value" $- union [- "bigint">:- doc "An arbitrary-precision integer value" bigint,- "int8">:- doc "An 8-bit signed integer value" int8,- "int16">:- doc "A 16-bit signed integer value (short value)" int16,- "int32">:- doc "A 32-bit signed integer value (int value)" int32,- "int64">:- doc "A 64-bit signed integer value (long value)" int64,- "uint8">:- doc "An 8-bit unsigned integer value (byte)" uint8,- "uint16">:- doc "A 16-bit unsigned integer value" uint16,- "uint32">:- doc "A 32-bit unsigned integer value (unsigned int)" uint32,- "uint64">:- doc "A 64-bit unsigned integer value (unsigned long)" uint64],+functionType :: Binding+functionType = define "FunctionType" $+ doc "A function type, also known as an arrow type" $+ T.record [+ "domain">:+ doc "The domain (input) type of the function"+ type_,+ "codomain">:+ doc "The codomain (output) type of the function"+ type_] - def "Lambda" $- doc "A function abstraction (lambda)" $- record [- "parameter">:- doc "The parameter of the lambda" $- core "Name",- "domain">:- doc "An optional domain type for the lambda" $- optional $ core "Type",- "body">:- doc "The body of the lambda" $- core "Term"],+injection :: Binding+injection = define "Injection" $+ doc "An instance of a union type; i.e. a string-indexed generalization of inl() or inr()" $+ T.record [+ "typeName">:+ doc "The name of the union type"+ name,+ "field">:+ doc "The field being injected, including its name and value"+ field] - def "Let" $- doc "A set of (possibly recursive) 'let' bindings together with an environment in which they are bound" $- record [- "bindings">: list $ core "Binding",- "environment">: core "Term"],+integerType :: Binding+integerType = define "IntegerType" $+ doc "An integer type" $+ T.union [+ "bigint">:+ doc "An arbitrary-precision integer type" $+ T.unit,+ "int8">:+ doc "An 8-bit signed integer type" $+ T.unit,+ "int16">:+ doc "A 16-bit signed integer type" $+ T.unit,+ "int32">:+ doc "A 32-bit signed integer type" $+ T.unit,+ "int64">:+ doc "A 64-bit signed integer type" $+ T.unit,+ "uint8">:+ doc "An 8-bit unsigned integer type" $+ T.unit,+ "uint16">:+ doc "A 16-bit unsigned integer type" $+ T.unit,+ "uint32">:+ doc "A 32-bit unsigned integer type" $+ T.unit,+ "uint64">:+ doc "A 64-bit unsigned integer type" $+ T.unit] - def "Binding" $- doc "A field with an optional type scheme, used to bind variables to terms in a 'let' expression" $- record [- "name">: core "Name",- "term">: core "Term",- "type">: optional $ core "TypeScheme"],+integerValue :: Binding+integerValue = define "IntegerValue" $+ doc "An integer literal value" $+ T.union [+ "bigint">:+ doc "An arbitrary-precision integer value" T.bigint,+ "int8">:+ doc "An 8-bit signed integer value" T.int8,+ "int16">:+ doc "A 16-bit signed integer value (short value)" T.int16,+ "int32">:+ doc "A 32-bit signed integer value (int value)" T.int32,+ "int64">:+ doc "A 64-bit signed integer value (long value)" T.int64,+ "uint8">:+ doc "An 8-bit unsigned integer value (byte)" T.uint8,+ "uint16">:+ doc "A 16-bit unsigned integer value" T.uint16,+ "uint32">:+ doc "A 32-bit unsigned integer value (unsigned int)" T.uint32,+ "uint64">:+ doc "A 64-bit unsigned integer value (unsigned long)" T.uint64] - def "Literal" $- doc "A term constant; an instance of a literal type" $- union [- "binary">:- doc "A binary literal" binary,- "boolean">:- doc "A boolean literal" boolean,- "float">:- doc "A floating-point literal" $ core "FloatValue",- "integer">:- doc "An integer literal" $- core "IntegerValue",- "string">:- doc "A string literal" string],+lambda :: Binding+lambda = define "Lambda" $+ doc "A function abstraction (lambda)" $+ T.record [+ "parameter">:+ doc "The parameter of the lambda"+ name,+ "domain">:+ doc "An optional domain type for the lambda" $+ T.maybe type_,+ "body">:+ doc "The body of the lambda"+ term] - def "LiteralType" $- doc "Any of a fixed set of literal types, also called atomic types, base types, primitive types, or type constants" $- union [- "binary">:- doc "The type of a binary (byte string) value" unit,- "boolean">:- doc "The type of a boolean (true/false) value" unit,- "float">:- doc "The type of a floating-point value" $- core "FloatType",- "integer">:- doc "The type of an integer value" $- core "IntegerType",- "string">:- doc "The type of a string value" unit],+let_ :: Binding+let_ = define "Let" $+ doc "A set of (possibly recursive) 'let' bindings together with a body in which they are bound" $+ T.record [+ "bindings">:+ doc "The list of variable bindings" $+ T.list binding,+ "body">:+ doc "The body term in which the variables are bound"+ term] - def "MapType" $- doc "A map type" $- record [- "keys">: core "Type",- "values">: core "Type"],+literal :: Binding+literal = define "Literal" $+ doc "A term constant; an instance of a literal type" $+ T.union [+ "binary">:+ doc "A binary literal" T.binary,+ "boolean">:+ doc "A boolean literal" T.boolean,+ "float">:+ doc "A floating-point literal"+ floatValue,+ "integer">:+ doc "An integer literal"+ integerValue,+ "string">:+ doc "A string literal" T.string] - def "Name" $- doc "A unique identifier in some context; a string-valued key"- $ wrap string,+literalType :: Binding+literalType = define "LiteralType" $+ doc "Any of a fixed set of literal types, also called atomic types, base types, primitive types, or type constants" $+ T.union [+ "binary">:+ doc "The type of a binary (byte string) value" T.unit,+ "boolean">:+ doc "The type of a boolean (true/false) value" T.unit,+ "float">:+ doc "The type of a floating-point value"+ floatType,+ "integer">:+ doc "The type of an integer value"+ integerType,+ "string">:+ doc "The type of a string value" T.unit] - def "Projection" $- doc "A record elimination; a projection" $- record [- "typeName">:- doc "The name of the record type" $- core "Name",- "field">:- doc "The name of the projected field" $- core "Name"],+mapType :: Binding+mapType = define "MapType" $+ doc "A map type" $+ T.record [+ "keys">:+ doc "The type of keys in the map"+ type_,+ "values">:+ doc "The type of values in the map"+ type_] - def "Record" $- doc "A record, or labeled tuple; a map of field names to terms" $- record [- "typeName">: core "Name",- "fields">: list $ core "Field"],+name :: Binding+name = define "Name" $+ doc "A unique identifier in some context; a string-valued key" $+ T.wrap T.string - def "RowType" $- doc "A labeled record or union type" $- record [- "typeName">:- doc "The name of the row type, which must correspond to the name of a Type element" $- core "Name",- "fields">:- doc "The fields of this row type, excluding any inherited fields" $- list $ core "FieldType"],+projection :: Binding+projection = define "Projection" $+ doc "A record elimination; a projection" $+ T.record [+ "typeName">:+ doc "The name of the record type"+ name,+ "field">:+ doc "The name of the projected field"+ name] - def "Sum" $- doc "The unlabeled equivalent of an Injection term" $- record [- "index">: int32,- "size">: int32,- "term">: core "Term"],+record :: Binding+record = define "Record" $+ doc "A record, or labeled tuple; a map of field names to terms" $+ T.record [+ "typeName">:+ doc "The name of the record type"+ name,+ "fields">:+ doc "The fields of the record, as a list of name/term pairs" $+ T.list field] - def "Term" $- doc "A data term" $- union [- "annotated">:- doc "A term annotated with metadata" $- core "AnnotatedTerm",- "application">:- doc "A function application" $- core "Application",- "function">:- doc "A function term" $- core "Function",- "let">:- doc "A 'let' term, which binds variables to terms" $- core "Let",- "list">:- doc "A list" $- list $ core "Term",- "literal">:- doc "A literal value" $- core "Literal",- "map">:- doc "A map of keys to values" $- Types.map (core "Term") (core "Term"),- "optional">:- doc "An optional value" $- optional $ core "Term",- "product">:- doc "A tuple" $- list (core "Term"),- "record">:- doc "A record term" $- core "Record",- "set">:- doc "A set of values" $- set $ core "Term",- "sum">:- doc "A variant tuple" $- core "Sum",- "typeApplication">:- doc "A System F type application term" $- core "TypedTerm",- "typeLambda">:- doc "A System F type abstraction term" $- core "TypeLambda",- "union">:- doc "An injection; an instance of a union type" $- core "Injection",- "unit">:- doc "A unit value; a term with no value" $- unit,- "variable">:- doc "A variable reference" $- core "Name",- "wrap">:- doc "A wrapped term; an instance of a wrapper type (newtype)" $- core "WrappedTerm"],+rowType :: Binding+rowType = define "RowType" $+ doc "A labeled record or union type" $+ T.record [+ "typeName">:+ doc "The name of the row type, which must correspond to the name of a Type element"+ name,+ "fields">:+ doc "The fields of this row type, excluding any inherited fields" $+ T.list fieldType] - def "TupleProjection" $- doc "A tuple elimination; a projection from an integer-indexed product" $- record [- "arity">:- doc "The arity of the tuple"- int32,- "index">:- doc "The 0-indexed offset from the beginning of the tuple"- int32,- "domain">:- doc "An optional domain for the projection; this is a list of component types" $- optional $ list $ core "Type"],+term :: Binding+term = define "Term" $+ doc "A data term" $+ T.union [+ "annotated">:+ doc "A term annotated with metadata"+ annotatedTerm,+ "application">:+ doc "A function application"+ application,+ "either">:+ doc "An either value" $+ T.either_ term term,+ "function">:+ doc "A function term"+ function,+ "let">:+ doc "A 'let' term, which binds variables to terms"+ let_,+ "list">:+ doc "A list" $+ T.list term,+ "literal">:+ doc "A literal value"+ literal,+ "map">:+ doc "A map of keys to values" $+ T.map term term,+ "maybe">:+ doc "An optional value" $+ T.maybe term,+ "pair">:+ doc "A pair (2-tuple)" $+ T.pair term term,+ "record">:+ doc "A record term"+ record,+ "set">:+ doc "A set of values" $+ T.set term,+ "typeApplication">:+ doc "A System F type application term"+ typeApplicationTerm,+ "typeLambda">:+ doc "A System F type abstraction term"+ typeLambda,+ "union">:+ doc "An injection; an instance of a union type"+ injection,+ "unit">:+ doc "A unit value; a term with no value" $+ T.unit,+ "variable">:+ doc "A variable reference"+ name,+ "wrap">:+ doc "A wrapped term; an instance of a wrapper type (newtype)"+ wrappedTerm] - def "Type" $- doc "A data type" $- union [- "annotated">: core "AnnotatedType",- "application">: core "ApplicationType",- "forall">: core "ForallType",- "function">: core "FunctionType",- "list">: core "Type",- "literal">: core "LiteralType",- "map">: core "MapType",- "optional">: core "Type",- "product">: list (core "Type"),- "record">: core "RowType",- "set">: core "Type",- "sum">: list (core "Type"),- "union">: core "RowType",- "unit">: unit,- "variable">: core "Name",- "wrap">: core "WrappedType"],+type_ :: Binding+type_ = define "Type" $+ doc "A data type" $+ T.union [+ "annotated">:+ doc "An annotated type"+ annotatedType,+ "application">:+ doc "A type application"+ applicationType,+ "either">:+ doc "An either (sum) type"+ eitherType,+ "forall">:+ doc "A universally quantified (polymorphic) type"+ forallType,+ "function">:+ doc "A function type"+ functionType,+ "list">:+ doc "A list type"+ type_,+ "literal">:+ doc "A literal type"+ literalType,+ "map">:+ doc "A map type"+ mapType,+ "maybe">:+ doc "An optional type"+ type_,+ "pair">:+ doc "A pair (2-tuple) type"+ pairType,+ "record">:+ doc "A record type"+ rowType,+ "set">:+ doc "A set type"+ type_,+ "union">:+ doc "A union type with field names"+ rowType,+ "unit">:+ doc "The unit type" $+ T.unit,+ "variable">:+ doc "A type variable"+ name,+ "wrap">:+ doc "A wrapped type (newtype)"+ wrappedType] - def "TypeLambda" $- doc "A System F type abstraction term" $- record [- "parameter">:- doc "The type variable introduced by the abstraction" $- core "Name",- "body">:- doc "The body of the abstraction" $- core "Term"],+typeApplicationTerm :: Binding+typeApplicationTerm = define "TypeApplicationTerm" $+ doc "A term applied to a type; a type application" $+ T.record [+ "body">:+ doc "The term being applied to a type"+ term,+ "type">:+ doc "The type argument"+ type_] - def "TypedTerm" $- doc "A term applied to a type; a type application" $- record [- "term">: core "Term",- "type">: core "Type"],+typeLambda :: Binding+typeLambda = define "TypeLambda" $+ doc "A System F type abstraction term" $+ T.record [+ "parameter">:+ doc "The type variable introduced by the abstraction"+ name,+ "body">:+ doc "The body of the abstraction"+ term] - def "TypeScheme" $- doc "A type expression together with free type variables occurring in the expression" $- record [- "variables">: list $ core "Name",- "type">: core "Type"],+typeScheme :: Binding+typeScheme = define "TypeScheme" $+ doc "A type expression together with free type variables occurring in the expression" $+ T.record [+ "variables">:+ doc "The free type variables" $+ T.list name,+ "type">:+ doc "The type expression"+ type_,+ "constraints">:+ doc "Optional metadata for type variables, including typeclass constraints. The map keys are type variable names." $+ T.maybe $ T.map name typeVariableMetadata] - def "WrappedTerm" $- doc "A term wrapped in a type name" $- record [- "typeName">: core "Name",- "object">: core "Term"],+typeVariableMetadata :: Binding+typeVariableMetadata = define "TypeVariableMetadata" $+ doc "Metadata associated with a type variable, including typeclass constraints" $+ T.record [+ "classes">:+ doc "The set of typeclass constraints on this type variable" $+ T.set name] - def "WrappedType" $- doc "A type wrapped in a type name; a newtype" $- record [- "typeName">: core "Name",- "object">: core "Type"]]+wrappedTerm :: Binding+wrappedTerm = define "WrappedTerm" $+ doc "A term wrapped in a type name" $+ T.record [+ "typeName">:+ doc "The name of the wrapper type"+ name,+ "body">:+ doc "The wrapped term"+ term]++wrappedType :: Binding+wrappedType = define "WrappedType" $+ doc "A type wrapped in a type name; a newtype" $+ T.record [+ "typeName">:+ doc "The name of the wrapper (newtype)"+ name,+ "body">:+ doc "The wrapped type"+ type_]
src/main/haskell/Hydra/Sources/Kernel/Types/Grammar.hs view
@@ -4,70 +4,114 @@ -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.grammar"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [] [Core.module_] $+module_ = Module ns elements [] [Core.ns] $ Just "A common API for BNF-based grammars, specifying context-free languages" where- ns = Namespace "hydra.grammar"- grammar = typeref ns- def = datatype ns- elements = [+ constant,+ grammar,+ label,+ labeledPattern,+ pattern,+ production,+ regex,+ symbol] - def "Constant" $- doc "A constant pattern" $- wrap string,+constant :: Binding+constant = define "Constant" $+ doc "A constant pattern" $+ T.wrap T.string - def "Grammar" $- doc "An enhanced Backus-Naur form (BNF) grammar" $- wrap $ list $ grammar "Production",+grammar :: Binding+grammar = define "Grammar" $+ doc "An enhanced Backus-Naur form (BNF) grammar" $+ T.wrap $ T.list production - def "Label" $- doc "A name for a pattern" $- wrap string,+label :: Binding+label = define "Label" $+ doc "A name for a pattern" $+ T.wrap T.string - def "LabeledPattern" $- doc "A pattern together with a name (label)" $- record [- "label">: grammar "Label",- "pattern">: grammar "Pattern"],+labeledPattern :: Binding+labeledPattern = define "LabeledPattern" $+ doc "A pattern together with a name (label)" $+ T.record [+ "label">:+ doc "The label for the pattern"+ label,+ "pattern">:+ doc "The pattern being labeled"+ pattern] - def "Pattern" $- doc "A pattern which matches valid expressions in the language" $- union [- "alternatives">: list $ grammar "Pattern",- "constant">: grammar "Constant",- "ignored">: grammar "Pattern",- "labeled">: grammar "LabeledPattern",- "nil">: unit,- "nonterminal">: grammar "Symbol",- "option">: grammar "Pattern",- "plus">: grammar "Pattern",- "regex">: grammar "Regex",- "sequence">: list $ grammar "Pattern",- "star">: grammar "Pattern"],+pattern :: Binding+pattern = define "Pattern" $+ doc "A pattern which matches valid expressions in the language" $+ T.union [+ "alternatives">:+ doc "A choice between alternative patterns" $+ T.list pattern,+ "constant">:+ doc "A constant (terminal) pattern"+ constant,+ "ignored">:+ doc "A pattern to be ignored (not captured)"+ pattern,+ "labeled">:+ doc "A labeled pattern"+ labeledPattern,+ "nil">:+ doc "An empty pattern" $+ T.unit,+ "nonterminal">:+ doc "A nonterminal symbol reference"+ symbol,+ "option">:+ doc "An optional pattern (zero or one occurrence)"+ pattern,+ "plus">:+ doc "One or more occurrences of a pattern"+ pattern,+ "regex">:+ doc "A regular expression pattern"+ regex,+ "sequence">:+ doc "A sequence of patterns" $+ T.list pattern,+ "star">:+ doc "Zero or more occurrences of a pattern"+ pattern] - def "Production" $- doc "A BNF production" $- record [- "symbol">: grammar "Symbol",- "pattern">: grammar "Pattern"],+production :: Binding+production = define "Production" $+ doc "A BNF production" $+ T.record [+ "symbol">:+ doc "The nonterminal symbol being defined"+ symbol,+ "pattern">:+ doc "The pattern which defines the symbol"+ pattern] - def "Regex" $- doc "A regular expression" $- wrap string,+regex :: Binding+regex = define "Regex" $+ doc "A regular expression" $+ T.wrap T.string - def "Symbol" $- doc "A nonterminal symbol" $- wrap string]+symbol :: Binding+symbol = define "Symbol" $+ doc "A nonterminal symbol" $+ T.wrap T.string
src/main/haskell/Hydra/Sources/Kernel/Types/Graph.hs view
@@ -1,74 +1,74 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Graph where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y- import qualified Hydra.Sources.Kernel.Types.Compute as Compute +ns :: Namespace+ns = Namespace "hydra.graph"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Compute.module_] [Core.module_] $+module_ = Module ns elements [Compute.ns] [Core.ns] $ Just "The extension to graphs of Hydra's core type system (hydra.core)" where- ns = Namespace "hydra.graph"- core = typeref $ moduleNamespace Core.module_- compute = typeref $ moduleNamespace Compute.module_- graph = typeref ns- def = datatype ns- elements = [-- def "Graph" $- doc "A graph, or set of name/term bindings together with parameters (annotations, primitives) and a schema graph" $- record [-- -- TODO: remove this; replace it with 'environment'- "elements">:- doc "All of the elements in the graph" $- Types.map (core "Name") (core "Binding"),+ graph,+ primitive,+ termCoder] - "environment">:- doc "The lambda environment of this graph context; it indicates whether a variable is bound by a lambda (Nothing) or a let (Just term)" $- Types.map (core "Name") (optional $ core "Term"),- "types">:- doc "The typing environment of the graph" $- Types.map (core "Name") (core "TypeScheme"),- "body">:- doc "The body of the term which generated this context" $- core "Term",- "primitives">:- doc "All supported primitive constants and functions, by name" $- Types.map (core "Name") (graph "Primitive"),- "schema">:- doc "The schema of this graph. If this parameter is omitted (nothing), the graph is its own schema graph." $- optional $ graph "Graph"],+graph :: Binding+graph = define "Graph" $+ doc "A graph, or set of name/term bindings together with parameters (annotations, primitives) and a schema graph" $+ T.record [+ "elements">:+ doc "All of the elements in the graph" $+ T.list Core.binding,+ "environment">:+ doc "The lambda environment of this graph context; it indicates whether a variable is bound by a lambda (Nothing) or a let (Just term)" $+ T.map Core.name (T.maybe Core.term),+ "types">:+ doc "The typing environment of the graph" $+ T.map Core.name Core.typeScheme,+ "body">:+ doc "The body of the term which generated this context"+ Core.term,+ "primitives">:+ doc "All supported primitive constants and functions, by name" $+ T.map Core.name primitive,+ "schema">:+ doc "The schema of this graph. If this parameter is omitted (nothing), the graph is its own schema graph." $+ T.maybe graph] - def "Primitive" $- doc "A built-in function" $- record [- "name">:- doc "The unique name of the primitive function" $- core "Name",- "type">:- doc "The type signature of the primitive function" $- core "TypeScheme",- "implementation">:- doc "A concrete implementation of the primitive function" $- list (core "Term") --> compute "Flow" @@ graph "Graph" @@ core "Term"],+primitive :: Binding+primitive = define "Primitive" $+ doc "A built-in function" $+ T.record [+ "name">:+ doc "The unique name of the primitive function"+ Core.name,+ "type">:+ doc "The type signature of the primitive function"+ Core.typeScheme,+ "implementation">:+ doc "A concrete implementation of the primitive function" $+ T.list Core.term ~> Compute.flow @@ graph @@ Core.term] - def "TermCoder" $- doc "A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms" $- forAll "a" $ record [- "type">: core "Type",- "coder">: compute "Coder" @@ graph "Graph" @@ graph "Graph" @@ core "Term" @@ "a"]]+termCoder :: Binding+termCoder = define "TermCoder" $+ doc "A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms" $+ T.forAll "a" $ T.record [+ "type">:+ doc "The Hydra type of encoded terms"+ Core.type_,+ "coder">:+ doc "A coder between Hydra terms and instances of the given type" $+ Compute.coder @@ graph @@ graph @@ Core.term @@ "a"]
− src/main/haskell/Hydra/Sources/Kernel/Types/Json.hs
@@ -1,48 +0,0 @@--- | A simple JSON model. This model is part of the Hydra kernel, despite JSON being an external language; JSON support is built in to Hydra--module Hydra.Sources.Kernel.Types.Json where---- Standard type-level kernel imports-import Hydra.Kernel-import Hydra.Dsl.Annotations-import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types-import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---module_ :: Module-module_ = Module ns elements [] [Core.module_] $- Just "A JSON syntax model. See the BNF at https://www.json.org"- where- ns = Namespace "hydra.json"- def = datatype ns- json = typeref ns-- elements = [-- def "Value" $- doc "A JSON value" $- union [- "array">:- doc "A JSON array" $- list $ json "Value",- "boolean">:- doc "A boolean value"- boolean,- "null">:- doc "JSON's null value"- unit,- "number">:- doc "A numeric value"- bigfloat, -- TODO: JSON numbers are decimal-encoded- "object">:- doc "A JSON object as a set of key/value pairs" $- Types.map string (json "Value"),- "string">:- doc "A string value"- string]]
− src/main/haskell/Hydra/Sources/Kernel/Types/Mantle.hs
@@ -1,122 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Hydra.Sources.Kernel.Types.Mantle where---- Standard type-level kernel imports-import Hydra.Kernel-import Hydra.Dsl.Annotations-import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types-import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $- Just ("A set of types which supplement hydra.core, but are not referenced by hydra.core.")- where- ns = Namespace "hydra.mantle"- core = typeref $ moduleNamespace Core.module_- mantle = typeref ns- def = datatype ns-- elements = [-- -- TODO: find another home for CaseConvention; it doesn't really belong in hydra.mantle- def "CaseConvention" $- Types.enum ["camel", "pascal", "lowerSnake", "upperSnake"],-- def "Comparison" $- doc "An equality judgement: less than, equal to, or greater than" $- enum [- "lessThan",- "equalTo",- "greaterThan"],-- def "Either" $- doc "A disjoint union between a 'left' type and a 'right' type" $- forAlls ["a", "b"] $ union [- "left">: "a",- "right">: "b"],-- def "EliminationVariant" $- doc "The identifier of an elimination constructor" $- enum [- "product",- "record",- "union",- "wrap"],-- def "FunctionVariant" $- doc "The identifier of a function constructor" $- enum [- "elimination",- "lambda",- "primitive"],-- def "LiteralVariant" $- doc "The identifier of a literal constructor" $- enum [- "binary",- "boolean",- "float",- "integer",- "string"],-- def "Precision" $- doc "Numeric precision: arbitrary precision, or precision to a specified number of bits" $- union [- "arbitrary">: unit,- "bits">: int32],-- def "TermVariant" $- doc "The identifier of a term expression constructor" $- enum [- "annotated",- "application",- "function",- "let",- "list",- "literal",- "map",- "optional",- "product",- "record",- "set",- "sum",- "typeApplication",- "typeLambda",- "union",- "unit",- "variable",- "wrap"],-- def "TypeClass" $- doc "Any of a small number of built-in type classes" $- enum [- "equality",- "ordering"],-- def "TypeVariant" $- doc "The identifier of a type constructor" $- enum [- "annotated",- "application",- "forall",- "function",- "list",- "literal",- "map",- "optional",- "product",- "record",- "set",- "sum",- "union",- "unit",- "variable",- "wrap"]]
src/main/haskell/Hydra/Sources/Kernel/Types/Module.hs view
@@ -1,102 +1,135 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Module where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y- import qualified Hydra.Sources.Kernel.Types.Graph as Graph +ns :: Namespace+ns = Namespace "hydra.module"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Graph.module_] [Core.module_] $+module_ = Module ns elements [Graph.ns] [Core.ns] $ Just "A model for Hydra namespaces and modules" where- ns = Namespace "hydra.module"- core = typeref $ moduleNamespace Core.module_- graph = typeref $ moduleNamespace Graph.module_- mod = typeref ns- def = datatype ns- elements = [+ definition,+ fileExtension,+ library,+ module',+ namespace,+ namespaces,+ qualifiedName,+ termDefinition,+ typeDefinition] - def "Definition" $- doc "A definition, which may be either a term or type definition" $- union [- "term">: mod "TermDefinition",- "type">: mod "TypeDefinition"],+definition :: Binding+definition = define "Definition" $+ doc "A definition, which may be either a term or type definition" $+ T.union [+ "term">:+ doc "A term definition"+ termDefinition,+ "type">:+ doc "A type definition"+ typeDefinition] - def "FileExtension" $- doc "A file extension (without the dot), e.g. \"json\" or \"py\"" $- wrap string,+fileExtension :: Binding+fileExtension = define "FileExtension" $+ doc "A file extension (without the dot), e.g. \"json\" or \"py\"" $+ T.wrap T.string - def "Library" $- doc "A library of primitive functions" $- record [- "namespace">:- doc "A common prefix for all primitive function names in the library" $- mod "Namespace",- "prefix">:- doc "A preferred namespace prefix for function names in the library"- string,- "primitives">:- doc "The primitives defined in this library" $- list $ graph "Primitive"],+library :: Binding+library = define "Library" $+ doc "A library of primitive functions" $+ T.record [+ "namespace">:+ doc "A common prefix for all primitive function names in the library"+ namespace,+ "prefix">:+ doc "A preferred namespace prefix for function names in the library"+ T.string,+ "primitives">:+ doc "The primitives defined in this library" $+ T.list Graph.primitive] - def "Module" $- doc "A logical collection of elements in the same namespace, having dependencies on zero or more other modules" $- record [- "namespace">:- doc "A common prefix for all element names in the module" $- mod "Namespace",- "elements">:- doc "The elements defined in this module" $- list $ core "Binding",- "termDependencies">:- doc "Any modules which the term expressions of this module directly depend upon" $- list $ mod "Module",- "typeDependencies">:- doc "Any modules which the type expressions of this module directly depend upon" $- list $ mod "Module",- "description">:- doc "An optional human-readable description of the module" $- optional string],+module' :: Binding+module' = define "Module" $+ doc "A logical collection of elements in the same namespace, having dependencies on zero or more other modules" $+ T.record [+ "namespace">:+ doc "A common prefix for all element names in the module"+ namespace,+ "elements">:+ doc "The elements defined in this module" $+ T.list Core.binding,+ "termDependencies">:+ doc "Any modules which the term expressions of this module directly depend upon" $+ T.list namespace,+ "typeDependencies">:+ doc "Any modules which the type expressions of this module directly depend upon" $+ T.list namespace,+ "description">:+ doc "An optional human-readable description of the module" $+ T.maybe T.string] - def "Namespace" $- doc "A prefix for element names" $- wrap string,+namespace :: Binding+namespace = define "Namespace" $+ doc "A prefix for element names" $+ T.wrap T.string - def "Namespaces" $- doc "A mapping from namespaces to values of type n, with a focus on one namespace" $- forAll "n" $ record [- "focus">: pair (mod "Namespace") (var "n"),- "mapping">: Types.map (mod "Namespace") (var "n")],+namespaces :: Binding+namespaces = define "Namespaces" $+ doc "A mapping from namespaces to values of type n, with a focus on one namespace" $+ T.forAll "n" $ T.record [+ "focus">:+ doc "The namespace in focus, together with its associated value" $+ T.pair namespace "n",+ "mapping">:+ doc "A mapping of namespaces to values" $+ T.map namespace "n"] - def "QualifiedName" $- doc "A qualified name consisting of an optional namespace together with a mandatory local name" $- record [- "namespace">: optional $ mod "Namespace",- "local">: string],+qualifiedName :: Binding+qualifiedName = define "QualifiedName" $+ doc "A qualified name consisting of an optional namespace together with a mandatory local name" $+ T.record [+ "namespace">:+ doc "The optional namespace" $+ T.maybe namespace,+ "local">:+ doc "The local name"+ T.string] - def "TermDefinition" $- doc "A term-level definition, including a name, a term, and the type of the term" $- record [- "name">: core "Name",- "term">: core "Term",- "type">: core "Type"],+termDefinition :: Binding+termDefinition = define "TermDefinition" $+ doc "A term-level definition, including a name, a term, and the type scheme of the term" $+ T.record [+ "name">:+ doc "The name of the term"+ Core.name,+ "term">:+ doc "The term being defined"+ Core.term,+ "type">:+ doc "The type scheme of the term, including any class constraints"+ Core.typeScheme] - def "TypeDefinition" $- doc "A type-level definition, including a name and the type" $- record [- "name">: core "Name",- -- TODO: consider using TypeScheme here instead of Type- "type">: core "Type"]]+typeDefinition :: Binding+typeDefinition = define "TypeDefinition" $+ doc "A type-level definition, including a name and the type" $+ T.record [+ "name">:+ doc "The name of the type"+ Core.name,+ -- TODO: consider using TypeScheme here instead of Type+ "type">:+ doc "The type being defined"+ Core.type_]
+ src/main/haskell/Hydra/Sources/Kernel/Types/Parsing.hs view
@@ -0,0 +1,65 @@+module Hydra.Sources.Kernel.Types.Parsing where++-- Standard type-level kernel imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.parsing"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [] [Core.ns] $+ Just "Parser combinator types for text parsing"+ where+ elements = [+ parseError,+ parseResult,+ parseSuccess,+ parser]++parseError :: Binding+parseError = define "ParseError" $+ doc "An error which occurred while parsing" $+ T.record [+ "message">:+ doc "An error message" $+ T.string,+ "remainder">:+ doc "The remaining input at the point of failure" $+ T.string]++parseResult :: Binding+parseResult = define "ParseResult" $+ doc "The result of a parse operation" $+ T.forAll "a" $ T.union [+ "success">:+ doc "A successful parse, with a value and the remaining unparsed input" $+ parseSuccess @@ "a",+ "failure">:+ doc "A failed parse, with an error message and the remaining input"+ parseError]++parseSuccess :: Binding+parseSuccess = define "ParseSuccess" $+ doc "A successful parse result" $+ T.forAll "a" $ T.record [+ "value">:+ doc "The parsed value"+ "a",+ "remainder">:+ doc "The remaining unparsed input" $+ T.string]++parser :: Binding+parser = define "Parser" $+ doc "A parser which consumes characters from a string and produces a value" $+ T.forAll "a" $ T.wrap $+ T.string ~> parseResult @@ "a"
src/main/haskell/Hydra/Sources/Kernel/Types/Phantoms.hs view
@@ -1,37 +1,40 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Phantoms where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.phantoms"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $+module_ = Module ns elements [Core.ns] [Core.ns] $ Just "Phantom types for use with Hydra DSLs" where- ns = Namespace "hydra.phantoms"- core = typeref $ moduleNamespace Core.module_- phantoms = typeref ns- def = datatype ns- elements = [+ tBinding,+ tTerm] - def "TBinding" $- doc "An association of a named term (element) with a phantom type" $- forAll "a" $ record [- "name">: core "Name",- "term">: phantoms "TTerm" @@ "a"],+tBinding :: Binding+tBinding = define "TBinding" $+ doc "An association of a named term (element) with a phantom type" $+ T.forAll "a" $ T.record [+ "name">:+ doc "The name of the term"+ Core.name,+ "term">:+ doc "The term with its phantom type" $+ tTerm @@ "a"] - def "TTerm" $- doc "An association of a term with a phantom type" $- forAll "a" $ wrap $ core "Term"]+tTerm :: Binding+tTerm = define "TTerm" $+ doc "An association of a term with a phantom type" $+ T.forAll "a" $ T.wrap Core.term
src/main/haskell/Hydra/Sources/Kernel/Types/Query.hs view
@@ -1,154 +1,190 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Query where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.query"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $+module_ = Module ns elements [Core.ns] [Core.ns] $ Just "A model for language-agnostic graph pattern queries" where- ns = Namespace "hydra.query"- core = typeref $ moduleNamespace Core.module_- query = typeref ns- def = datatype ns- elements = [- def "ComparisonConstraint" $- doc "One of several comparison operators" $- enum ["equal", "notEqual", "lessThan", "greaterThan", "lessThanOrEqual", "greaterThanOrEqual"],+ comparisonConstraint,+ edge,+ graphPattern,+ node,+ path,+ pattern,+ query,+ range,+ regexQuantifier,+ regexSequence,+ step,+ triplePattern,+ variable] - def "Edge" $- doc "An abstract edge based on a record type" $- record [- "type">:- doc "The name of a record type, for which the edge also specifies an out- and an in- projection" $- core "Name",- "out">:- doc "The field representing the out-projection of the edge. Defaults to 'out'." $- optional $ core "Name",- "in">:- doc "The field representing the in-projection of the edge. Defaults to 'in'." $- optional $ core "Name"],+comparisonConstraint :: Binding+comparisonConstraint = define "ComparisonConstraint" $+ doc "One of several comparison operators" $+ T.enum ["equal", "notEqual", "lessThan", "greaterThan", "lessThanOrEqual", "greaterThanOrEqual"] - def "GraphPattern" $- doc "A query pattern which matches within a designated component subgraph" $- record [- "graph">:- doc "The name of the component graph" $- core "Name",- "patterns">:- doc "The patterns to match within the subgraph" $- list (query "Pattern")],+edge :: Binding+edge = define "Edge" $+ doc "An abstract edge based on a record type" $+ T.record [+ "type">:+ doc "The name of a record type, for which the edge also specifies an out- and an in- projection"+ Core.name,+ "out">:+ doc "The field representing the out-projection of the edge. Defaults to 'out'." $+ T.maybe Core.name,+ "in">:+ doc "The field representing the in-projection of the edge. Defaults to 'in'." $+ T.maybe Core.name] - def "Node" $- doc "A node in a query expression; it may be a term, a variable, or a wildcard" $- union [- "term">:- doc "A graph term; an expression which is valid in the graph being matched" $- core "Term",- "variable">:- doc "A query variable, not to be confused with a variable term" $- query "Variable",- "wildcard">:- doc "An anonymous variable which we do not care to join across patterns" unit],+graphPattern :: Binding+graphPattern = define "GraphPattern" $+ doc "A query pattern which matches within a designated component subgraph" $+ T.record [+ "graph">:+ doc "The name of the component graph"+ Core.name,+ "patterns">:+ doc "The patterns to match within the subgraph" $+ T.list pattern] - def "Path" $- doc "A query path" $- union [- "step">:- doc "A path given by a single step" $- query "Step",- "regex">:- doc "A path given by a regular expression quantifier applied to another path" $- query "RegexSequence",- "inverse">:- doc "A path given by the inverse of another path" $- query "Path"],+node :: Binding+node = define "Node" $+ doc "A node in a query expression; it may be a term, a variable, or a wildcard" $+ T.union [+ "term">:+ doc "A graph term; an expression which is valid in the graph being matched"+ Core.term,+ "variable">:+ doc "A query variable, not to be confused with a variable term"+ variable,+ "wildcard">:+ doc "An anonymous variable which we do not care to join across patterns" T.unit] - def "Pattern" $- doc "A query pattern" $- union [- "triple">:- doc "A subject/predicate/object pattern" $- query "TriplePattern",- "negation">:- doc "The negation of another pattern" $- query "Pattern",- "conjunction">:- doc "The conjunction ('and') of several other patterns" $- list (query "Pattern"),- "disjunction">:- doc "The disjunction (inclusive 'or') of several other patterns" $- list (query "Pattern"),- "graph">:- doc "A pattern which matches within a named subgraph" $- query "GraphPattern"],+path :: Binding+path = define "Path" $+ doc "A query path" $+ T.union [+ "step">:+ doc "A path given by a single step"+ step,+ "regex">:+ doc "A path given by a regular expression quantifier applied to another path"+ regexSequence,+ "inverse">:+ doc "A path given by the inverse of another path"+ path] - def "Query" $- doc "A SELECT-style graph pattern matching query" $- record [- "variables">:- doc "The variables selected by the query" $- list $ query "Variable",- "patterns">:- doc "The patterns to be matched" $- list (query "Pattern")],+pattern :: Binding+pattern = define "Pattern" $+ doc "A query pattern" $+ T.union [+ "triple">:+ doc "A subject/predicate/object pattern"+ triplePattern,+ "negation">:+ doc "The negation of another pattern"+ pattern,+ "conjunction">:+ doc "The conjunction ('and') of several other patterns" $+ T.list pattern,+ "disjunction">:+ doc "The disjunction (inclusive 'or') of several other patterns" $+ T.list pattern,+ "graph">:+ doc "A pattern which matches within a named subgraph"+ graphPattern] - def "Range" $- doc "A range from min to max, inclusive" $- record [- "min">: int32,- "max">: int32],+query :: Binding+query = define "Query" $+ doc "A SELECT-style graph pattern matching query" $+ T.record [+ "variables">:+ doc "The variables selected by the query" $+ T.list variable,+ "patterns">:+ doc "The patterns to be matched" $+ T.list pattern] - def "RegexQuantifier" $- doc "A regular expression quantifier" $- union [- "one">: doc "No quantifier; matches a single occurrence" unit,- "zeroOrOne">: doc "The ? quanifier; matches zero or one occurrence" unit,- "zeroOrMore">: doc "The * quantifier; matches any number of occurrences" unit,- "oneOrMore">: doc "The + quantifier; matches one or more occurrences" unit,- "exactly">: doc "The {n} quantifier; matches exactly n occurrences" int32,- "atLeast">: doc "The {n,} quantifier; matches at least n occurrences" int32,- "range">: doc "The {n, m} quantifier; matches between n and m (inclusive) occurrences" $ query "Range"],+range :: Binding+range = define "Range" $+ doc "A range from min to max, inclusive" $+ T.record [+ "min">:+ doc "The minimum value (inclusive)" $+ T.int32,+ "max">:+ doc "The maximum value (inclusive)" $+ T.int32] - def "RegexSequence" $- doc "A path with a regex quantifier" $- record [- "path">: query "Path",- "quantifier">: query "RegexQuantifier"],+regexQuantifier :: Binding+regexQuantifier = define "RegexQuantifier" $+ doc "A regular expression quantifier" $+ T.union [+ "one">: doc "No quantifier; matches a single occurrence" T.unit,+ "zeroOrOne">: doc "The ? quanifier; matches zero or one occurrence" T.unit,+ "zeroOrMore">: doc "The * quantifier; matches any number of occurrences" T.unit,+ "oneOrMore">: doc "The + quantifier; matches one or more occurrences" T.unit,+ "exactly">: doc "The {n} quantifier; matches exactly n occurrences" T.int32,+ "atLeast">: doc "The {n,} quantifier; matches at least n occurrences" T.int32,+ "range">: doc "The {n, m} quantifier; matches between n and m (inclusive) occurrences" range] - def "Step" $- doc "An atomic function as part of a query. When applied to a graph, steps are typed by function types." $- union [- "edge">:- doc "An out-to-in traversal of an abstract edge" $- query "Edge",- "project">:- doc "A projection from a record through one of its fields" $- core "Projection",- "compare">:- doc "A comparison of two terms" $- query "ComparisonConstraint"],+regexSequence :: Binding+regexSequence = define "RegexSequence" $+ doc "A path with a regex quantifier" $+ T.record [+ "path">:+ doc "The path to which the quantifier applies"+ path,+ "quantifier">:+ doc "The quantifier"+ regexQuantifier] - def "TriplePattern" $- doc "A subject/predicate/object pattern" $- record [- "subject">: query "Node",- "predicate">: query "Path",- "object">: query "Node"],+step :: Binding+step = define "Step" $+ doc "An atomic function as part of a query. When applied to a graph, steps are typed by function types." $+ T.union [+ "edge">:+ doc "An out-to-in traversal of an abstract edge"+ edge,+ "project">:+ doc "A projection from a record through one of its fields"+ Core.projection,+ "compare">:+ doc "A comparison of two terms"+ comparisonConstraint] - def "Variable" $- doc "A query variable" $- wrap string]+triplePattern :: Binding+triplePattern = define "TriplePattern" $+ doc "A subject/predicate/object pattern" $+ T.record [+ "subject">:+ doc "The subject of the pattern"+ node,+ "predicate">:+ doc "The predicate (property) of the pattern"+ path,+ "object">:+ doc "The object of the pattern"+ node]++variable :: Binding+variable = define "Variable" $+ doc "A query variable" $+ T.wrap T.string
src/main/haskell/Hydra/Sources/Kernel/Types/Relational.hs view
@@ -1,90 +1,106 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Relational where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Annotations as Annotations import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.relational"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [] [Core.module_] $+module_ = Module ns elements [] [Core.ns] $ Just ("An interpretation of Codd's Relational Model, " ++ "as described in 'A Relational Model of Data for Large Shared Data Banks' (1970). " ++ "Types ('domains') and values are parameterized so as to allow for application-specific implementations. " ++ "No special support is provided for 'nonsimple' domains; i.e. relations are assumed to be normalized.") where- ns = Namespace "hydra.relational"- def = datatype ns- rm = typeref ns- elements = [- def "ColumnName" $- doc ("A name for a domain which serves to identify the role played by that domain in the given relation;"- ++ " a 'role name' in Codd") $- wrap string,+ columnName,+ columnSchema,+ foreignKey,+ primaryKey,+ relation,+ relationName,+ relationSchema,+ relationship,+ row] - def "ColumnSchema" $- doc "An abstract specification of the domain represented by a column in a relation; a role" $- forAll "t" $ record [- "name">:- doc "A unique name for the column" $- rm "ColumnName",- "domain">:- doc "The domain (type) of the column" $- "t"],+columnName :: Binding+columnName = define "ColumnName" $+ doc ("A name for a domain which serves to identify the role played by that domain in the given relation;"+ ++ " a 'role name' in Codd") $+ T.wrap T.string - def "ForeignKey" $- doc "A mapping from certain columns of a source relation to primary key columns of a target relation" $- record [- "foreignRelation">:- doc "The name of the target relation" $- rm "RelationName",- "keys">:- doc ("The mapping of source column names to target column names."- ++ " The target column names must together make up the primary key of the target relation.") $- nonemptyMap (rm "ColumnName") (rm "ColumnName")],+columnSchema :: Binding+columnSchema = define "ColumnSchema" $+ doc "An abstract specification of the domain represented by a column in a relation; a role" $+ T.forAll "t" $ T.record [+ "name">:+ doc "A unique name for the column"+ columnName,+ "domain">:+ doc "The domain (type) of the column"+ "t"] - def "PrimaryKey" $- doc "A primary key of a relation, specified either as a single column, or as a list of columns" $- wrap $ nonemptyList $ rm "ColumnName",+foreignKey :: Binding+foreignKey = define "ForeignKey" $+ doc "A mapping from certain columns of a source relation to primary key columns of a target relation" $+ T.record [+ "foreignRelation">:+ doc "The name of the target relation"+ relationName,+ "keys">:+ doc ("The mapping of source column names to target column names."+ ++ " The target column names must together make up the primary key of the target relation.") $+ nonemptyMap columnName columnName] - def "Relation" $- doc "A set of distinct n-tuples; a table" $- forAll "v" $ wrap $ list (rm "Row" @@ "v"),+primaryKey :: Binding+primaryKey = define "PrimaryKey" $+ doc "A primary key of a relation, specified either as a single column, or as a list of columns" $+ T.wrap $ nonemptyList columnName - def "RelationName" $- doc "A unique relation (table) name" $- wrap string,+relation :: Binding+relation = define "Relation" $+ doc "A set of distinct n-tuples; a table" $+ T.forAll "v" $ T.wrap $ T.list (row @@ "v") - def "RelationSchema" $ -- Note: this term is not in Codd- doc "An abstract relation; the name and columns of a relation without its actual data" $- forAll "t" $ record [- "name">:- doc "A unique name for the relation" $- rm "RelationName",- "columns">:- doc "A list of column specifications" $- nonemptyList $ rm "ColumnSchema" @@ "t",- "primaryKeys">:- doc "Any number of primary keys for the relation, each of which must be valid for this relation" $- list $ rm "PrimaryKey",- "foreignKeys">:- doc "Any number of foreign keys, each of which must be valid for both this relation and the target relation" $- list $ rm "ForeignKey"],+relationName :: Binding+relationName = define "RelationName" $+ doc "A unique relation (table) name" $+ T.wrap T.string - def "Relationship" $- doc "A domain-unordered (string-indexed, rather than position-indexed) relation" $- forAll "v" $ wrap $ set $ Types.map (rm "ColumnName") "v",+relationSchema :: Binding+relationSchema = define "RelationSchema" $+ doc "An abstract relation; the name and columns of a relation without its actual data" $+ T.forAll "t" $ T.record [+ "name">:+ doc "A unique name for the relation"+ relationName,+ "columns">:+ doc "A list of column specifications" $+ nonemptyList $ columnSchema @@ "t",+ "primaryKeys">:+ doc "Any number of primary keys for the relation, each of which must be valid for this relation" $+ T.list primaryKey,+ "foreignKeys">:+ doc "Any number of foreign keys, each of which must be valid for both this relation and the target relation" $+ T.list foreignKey] - def "Row" $- doc "An n-tuple which is an element of a given relation" $- forAll "v" $ wrap $ nonemptyList "v"]+relationship :: Binding+relationship = define "Relationship" $+ doc "A domain-unordered (string-indexed, rather than position-indexed) relation" $+ T.forAll "v" $ T.wrap $ T.set $ T.map columnName "v"++row :: Binding+row = define "Row" $+ doc "An n-tuple which is an element of a given relation" $+ T.forAll "v" $ T.wrap $ nonemptyList "v"
src/main/haskell/Hydra/Sources/Kernel/Types/Tabular.hs view
@@ -1,44 +1,63 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Tabular where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y+import qualified Hydra.Sources.Kernel.Types.Relational as Relational +ns :: Namespace+ns = Namespace "hydra.tabular"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [] [Core.module_] $- Just ("A simple, untyped tabular data model, suitable for CSVs and TSVs")+module_ = Module ns elements [Core.ns, Relational.ns] [Core.ns] $+ Just "A simple, untyped tabular data model, suitable for CSVs and TSVs" where- ns = Namespace "hydra.tabular"- def = datatype ns- tabular = typeref ns- elements = [+ columnType,+ dataRow,+ headerRow,+ table,+ tableType] - def "DataRow" $- doc "A data row, containing optional-valued cells; one per column" $- forAll "v" $ wrap $ list $ optional "v",+columnType :: Binding+columnType = define "ColumnType" $+ doc "A column type, consisting of a name and a value type" $+ T.record [+ "name">: Relational.columnName,+ "type">: Core.type_] - def "HeaderRow" $- doc "A header row, containing column names (but no types or data)" $- wrap $ list string,+dataRow :: Binding+dataRow = define "DataRow" $+ doc "A data row, containing optional-valued cells; one per column" $+ T.forAll "v" $ T.wrap $ T.list $ T.maybe "v" - def "Table" $- doc "A simple table as in a CSV file, having an optional header row and any number of data rows" $- forAll "v" $ record [- "header">:- doc "The optional header row of the table. If present, the header must have the same number of cells as each data row." $- optional $ tabular "HeaderRow",- "data">:- doc "The data rows of the table. Each row must have the same number of cells." $- list (tabular "DataRow" @@ "v")]]+headerRow :: Binding+headerRow = define "HeaderRow" $+ doc "A header row, containing column names (but no types or data)" $+ T.wrap $ T.list T.string++table :: Binding+table = define "Table" $+ doc "A simple table as in a CSV file, having an optional header row and any number of data rows" $+ T.forAll "v" $ T.record [+ "header">:+ doc "The optional header row of the table. If present, the header must have the same number of cells as each data row." $+ T.maybe headerRow,+ "data">:+ doc "The data rows of the table. Each row must have the same number of cells." $+ T.list (dataRow @@ "v")]++tableType :: Binding+tableType = define "TableType" $+ doc "A type definition for a table, including column names and types" $+ T.record [+ "name">: Relational.relationName,+ "columns">: T.list columnType]
src/main/haskell/Hydra/Sources/Kernel/Types/Testing.hs view
@@ -1,86 +1,851 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Testing where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y -import qualified Hydra.Sources.Kernel.Types.Mantle as Mantle+import qualified Hydra.Sources.Kernel.Types.Ast as Ast+import qualified Hydra.Sources.Kernel.Types.Coders as Coders+import qualified Hydra.Sources.Kernel.Types.Compute as Compute+import qualified Hydra.Sources.Kernel.Types.Graph as Graph+import qualified Hydra.Sources.Json.Model as JsonModel+import qualified Hydra.Sources.Kernel.Types.Module as Module+import qualified Hydra.Sources.Kernel.Types.Parsing as Parsing+import qualified Hydra.Sources.Kernel.Types.Typing as Typing+import qualified Hydra.Sources.Kernel.Types.Util as Util +ns :: Namespace+ns = Namespace "hydra.testing"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Mantle.module_] [Core.module_] $+module_ = Module ns elements [Ast.ns, Coders.ns, Compute.ns, Graph.ns, JsonModel.ns, Module.ns, Parsing.ns, Typing.ns, Util.ns] [Core.ns] $ Just "A model for unit testing" where- ns = Namespace "hydra.testing"- def = datatype ns- core = typeref $ moduleNamespace Core.module_- mantle = typeref $ moduleNamespace Mantle.module_- testing = typeref ns- elements = [+ alphaConversionTestCase,+ evaluationStyle,+ caseConversionTestCase,+ delegatedEvaluationTestCase,+ etaExpansionTestCase,+ deannotateTermTestCase,+ deannotateTypeTestCase,+ flattenLetTermsTestCase,+ foldOperation,+ foldOverTermTestCase,+ freeVariablesTestCase,+ hoistPredicate,+ hoistLetBindingsTestCase,+ hoistPolymorphicLetBindingsTestCase,+ hoistSubtermsTestCase,+ hoistCaseStatementsTestCase,+ termRewriter,+ rewriteTermTestCase,+ typeRewriter,+ rewriteTypeTestCase,+ evaluationTestCase,+ inferenceFailureTestCase,+ inferenceTestCase,+ jsonCoderTestCase,+ jsonDecodeTestCase,+ jsonEncodeTestCase,+ jsonParserTestCase,+ jsonRoundtripTestCase,+ liftLambdaAboveLetTestCase,+ jsonWriterTestCase,+ parserTestCase,+ tag,+ testCodec,+ testCase,+ testCaseWithMetadata,+ testGroup,+ typeCheckingTestCase,+ typeCheckingFailureTestCase,+ topologicalSortBindingsTestCase,+ topologicalSortTestCase,+ topologicalSortSCCTestCase,+ serializationTestCase,+ simplifyTermTestCase,+ normalizeTypeVariablesTestCase,+ typeReductionTestCase,+ writerTestCase,+ substInTypeTestCase,+ variableOccursInTypeTestCase,+ unshadowVariablesTestCase,+ unifyTypesTestCase,+ joinTypesTestCase] - def "EvaluationStyle" $- doc "One of two evaluation styles: eager or lazy" $- enum ["eager", "lazy"],+alphaConversionTestCase :: Binding+alphaConversionTestCase = define "AlphaConversionTestCase" $+ doc "A test case which performs alpha conversion (variable renaming) on a term and compares the result with the expected term" $+ T.record [+ "term">:+ doc "The term on which to perform alpha conversion"+ Core.term,+ "oldVariable">:+ doc "The variable name to replace"+ Core.name,+ "newVariable">:+ doc "The new variable name"+ Core.name,+ "result">:+ doc "The expected result term after alpha conversion"+ Core.term] - def "CaseConversionTestCase" $- doc "A test case which checks that strings are converted between different case conventions correctly" $- record [- "fromConvention">: mantle "CaseConvention",- "toConvention">: mantle "CaseConvention",- "fromString">: string,- "toString">: string],+evaluationStyle :: Binding+evaluationStyle = define "EvaluationStyle" $+ doc "One of two evaluation styles: eager or lazy" $+ T.enum ["eager", "lazy"] - def "EvaluationTestCase" $- doc "A test case which evaluates (reduces) a given term and compares it with the expected result" $- record [- "evaluationStyle">: testing "EvaluationStyle",- "input">: core "Term",- "output">: core "Term"],+caseConversionTestCase :: Binding+caseConversionTestCase = define "CaseConversionTestCase" $+ doc "A test case which checks that strings are converted between different case conventions correctly" $+ T.record [+ "fromConvention">:+ doc "The source case convention"+ Util.caseConvention,+ "toConvention">:+ doc "The target case convention"+ Util.caseConvention,+ "fromString">:+ doc "The input string" $+ T.string,+ "toString">:+ doc "The expected output string" $+ T.string] - def "InferenceFailureTestCase" $- doc "A test case providing a term for which type inference is expected to fail" $- record [- "input">: core "Term"],+delegatedEvaluationTestCase :: Binding+delegatedEvaluationTestCase = define "DelegatedEvaluationTestCase" $+ doc ("A test case in which we delegate evaluation of an input term and an expected output term"+ <> " to a target programming language like Haskell, Java, or Python, checking whether the term evaluates"+ <> " as expected when translated into that language") $+ T.record [+ "input">:+ doc "The first of two terms which should evaluate to the same expression"+ Core.term,+ "output">:+ doc "The second of two terms which should evaluate to the same expression"+ Core.term] - def "InferenceTestCase" $- doc "A test case which performs type inference on a given term and compares the result with an expected type scheme" $- record [- "input">: core "Term",- "output">: core "TypeScheme"],+etaExpansionTestCase :: Binding+etaExpansionTestCase = define "EtaExpansionTestCase" $+ doc ("A test case which performs eta expansion (adding missing lambda abstractions) on a given term"+ <> " and compares the result with the expected result") $+ T.record [+ "input">:+ doc "The term to eta expand"+ Core.term,+ "output">:+ doc "The expected result"+ Core.term] - def "Tag" $ wrap string,+deannotateTermTestCase :: Binding+deannotateTermTestCase = define "DeannotateTermTestCase" $+ doc "A test case which strips all annotations from a term and compares the result with the expected term" $+ T.record [+ "input">:+ doc "The term to deannotate"+ Core.term,+ "output">:+ doc "The expected deannotated term"+ Core.term] - def "TestCase" $- doc "A simple test case with an input and an expected output" $- union [- "caseConversion">: testing "CaseConversionTestCase",- "evaluation">: testing "EvaluationTestCase",- "inference">: testing "InferenceTestCase",- "inferenceFailure">: testing "InferenceFailureTestCase"],+deannotateTypeTestCase :: Binding+deannotateTypeTestCase = define "DeannotateTypeTestCase" $+ doc "A test case which strips all annotations from a type and compares the result with the expected type" $+ T.record [+ "input">:+ doc "The type to deannotate"+ Core.type_,+ "output">:+ doc "The expected deannotated type"+ Core.type_] - def "TestCaseWithMetadata" $- doc "One of a number of test case variants, together with metadata including a test name, an optional description, and optional tags" $- record [- "name">: string,- "case">: testing "TestCase",- "description">: optional string,- "tags">: list $ testing "Tag"],+flattenLetTermsTestCase :: Binding+flattenLetTermsTestCase = define "FlattenLetTermsTestCase" $+ doc ("A test case which flattens nested let terms,"+ <> " lifting inner bindings to the outer let, and compares the result with the expected term") $+ T.record [+ "input">:+ doc "The term to flatten"+ Core.term,+ "output">:+ doc "The expected flattened term"+ Core.term] - def "TestGroup" $- doc "A collection of test cases with a name and optional description" $- record [- "name">: string,- "description">: optional string,- "subgroups">: list (testing "TestGroup"),- "cases">: list (testing "TestCaseWithMetadata")]]+foldOperation :: Binding+foldOperation = define "FoldOperation" $+ doc "A predefined fold operation for testing foldOverTerm" $+ T.union [+ "sumInt32Literals">:+ doc "Sum all Int32 literals in a term" $+ T.unit,+ "collectListLengths">:+ doc "Collect the lengths of all list terms (returns list of integers in traversal order)" $+ T.unit,+ "collectLabels">:+ doc "Collect labels (first element of pairs where first is a string literal)" $+ T.unit]++foldOverTermTestCase :: Binding+foldOverTermTestCase = define "FoldOverTermTestCase" $+ doc "A test case which applies a fold operation over a term and compares the result" $+ T.record [+ "input">:+ doc "The term to fold over"+ Core.term,+ "traversalOrder">:+ doc "The traversal order (pre or post)"+ Coders.traversalOrder,+ "operation">:+ doc "The fold operation to apply"+ foldOperation,+ "output">:+ doc "The expected result of the fold"+ Core.term]++freeVariablesTestCase :: Binding+freeVariablesTestCase = define "FreeVariablesTestCase" $+ doc "A test case which computes the free variables of a term and compares the result with an expected set of names" $+ T.record [+ "input">:+ doc "The term to analyze"+ Core.term,+ "output">:+ doc "The expected set of free variable names" $+ T.set Core.name]++hoistPredicate :: Binding+hoistPredicate = define "HoistPredicate" $+ doc "A predefined predicate for testing hoistSubterms. Each predicate determines which subterms should be hoisted into let bindings." $+ T.union [+ "caseStatements">:+ doc "Hoist case statements (elimination unions) that appear in non-top-level positions" $+ T.unit,+ "applications">:+ doc "Hoist function applications that appear in non-top-level positions" $+ T.unit,+ "lists">:+ doc "Hoist list terms that appear in non-top-level positions" $+ T.unit,+ "nothing">:+ doc "Never hoist anything (identity transformation for let terms)" $+ T.unit]++hoistSubtermsTestCase :: Binding+hoistSubtermsTestCase = define "HoistSubtermsTestCase" $+ doc ("A test case which hoists subterms into let bindings based on a predicate,"+ <> " and compares the result with the expected term."+ <> " The predicate decides which subterms at which positions should be extracted into new bindings.") $+ T.record [+ "predicate">:+ doc "The predicate that determines which subterms to hoist"+ hoistPredicate,+ "input">:+ doc "The input term (must contain a let expression for hoisting to occur)"+ Core.term,+ "output">:+ doc "The expected output term with hoisted subterms as new bindings"+ Core.term]++hoistCaseStatementsTestCase :: Binding+hoistCaseStatementsTestCase = define "HoistCaseStatementsTestCase" $+ doc ("A test case for the hoistCaseStatements function, which hoists case statements"+ <> " into let bindings, but only when they appear inside a lambda body."+ <> " This is used for targets like Python which don't support inline match expressions.") $+ T.record [+ "input">:+ doc "The input term"+ Core.term,+ "output">:+ doc "The expected output term with hoisted case statements"+ Core.term]++hoistPolymorphicLetBindingsTestCase :: Binding+hoistPolymorphicLetBindingsTestCase = define "HoistPolymorphicLetBindingsTestCase" $+ doc ("A test case for the hoistPolymorphicLetBindings function, which hoists polymorphic"+ <> " let bindings to the top level of a let term."+ <> " This is used for targets like Java which don't support polymorphic lambdas.") $+ T.record [+ "input">:+ doc "The input let term"+ Core.let_,+ "output">:+ doc "The expected output let term with polymorphic bindings hoisted to top"+ Core.let_]++hoistLetBindingsTestCase :: Binding+hoistLetBindingsTestCase = define "HoistLetBindingsTestCase" $+ doc ("A test case for hoistLetBindings with hoistAll=True, which hoists ALL nested"+ <> " let bindings to the top level of a let term, not just polymorphic ones."+ <> " This is used for targets like Java that cannot have let expressions in arbitrary positions.") $+ T.record [+ "input">:+ doc "The input let term"+ Core.let_,+ "output">:+ doc "The expected output let term with all nested bindings hoisted to top"+ Core.let_]++termRewriter :: Binding+termRewriter = define "TermRewriter" $+ doc "A predefined term rewriter for testing rewriteTerm" $+ T.union [+ "replaceFooWithBar">:+ doc "Replace all string literal 'foo' with 'bar'" $+ T.unit,+ "replaceInt32WithInt64">:+ doc "Replace all Int32 literals with Int64 literals of the same value" $+ T.unit]++rewriteTermTestCase :: Binding+rewriteTermTestCase = define "RewriteTermTestCase" $+ doc "A test case which applies a term rewriter and compares the result" $+ T.record [+ "input">:+ doc "The term to rewrite"+ Core.term,+ "rewriter">:+ doc "The rewriter to apply"+ termRewriter,+ "output">:+ doc "The expected rewritten term"+ Core.term]++typeRewriter :: Binding+typeRewriter = define "TypeRewriter" $+ doc "A predefined type rewriter for testing rewriteType" $+ T.union [+ "replaceStringWithInt32">:+ doc "Replace all String types with Int32 types" $+ T.unit]++rewriteTypeTestCase :: Binding+rewriteTypeTestCase = define "RewriteTypeTestCase" $+ doc "A test case which applies a type rewriter and compares the result" $+ T.record [+ "input">:+ doc "The type to rewrite"+ Core.type_,+ "rewriter">:+ doc "The rewriter to apply"+ typeRewriter,+ "output">:+ doc "The expected rewritten type"+ Core.type_]++evaluationTestCase :: Binding+evaluationTestCase = define "EvaluationTestCase" $+ doc "A test case which evaluates (reduces) a given term and compares it with the expected result" $+ T.record [+ "evaluationStyle">:+ doc "The evaluation style (eager or lazy)"+ evaluationStyle,+ "input">:+ doc "The term to evaluate"+ Core.term,+ "output">:+ doc "The expected result"+ Core.term]++inferenceFailureTestCase :: Binding+inferenceFailureTestCase = define "InferenceFailureTestCase" $+ doc "A test case providing a term for which type inference is expected to fail" $+ T.record [+ "input">:+ doc "The term for which inference should fail"+ Core.term]++inferenceTestCase :: Binding+inferenceTestCase = define "InferenceTestCase" $+ doc "A test case which performs type inference on a given term and compares the result with an expected type scheme" $+ T.record [+ "input">:+ doc "The term to infer"+ Core.term,+ "output">:+ doc "The expected type scheme"+ Core.typeScheme]++jsonCoderTestCase :: Binding+jsonCoderTestCase = define "JsonCoderTestCase" $+ doc ("A test case which encodes a Hydra term to JSON using a type-directed coder,"+ <> " and verifies that decoding produces the original term (round-trip)") $+ T.record [+ "type">:+ doc "The Hydra type that determines how the term is encoded/decoded"+ Core.type_,+ "term">:+ doc "The Hydra term to encode"+ Core.term,+ "json">:+ doc "The expected JSON value"+ JsonModel.value]++jsonDecodeTestCase :: Binding+jsonDecodeTestCase = define "JsonDecodeTestCase" $+ doc ("A test case for the Either-based JSON decoder."+ <> " Takes a type, input JSON, and expected result (Either String Term).") $+ T.record [+ "type">:+ doc "The Hydra type to decode into"+ Core.type_,+ "json">:+ doc "The input JSON value"+ JsonModel.value,+ "expected">:+ doc "The expected result: Left for error, Right for decoded term" $+ T.either_ T.string Core.term]++jsonEncodeTestCase :: Binding+jsonEncodeTestCase = define "JsonEncodeTestCase" $+ doc ("A test case for the Either-based JSON encoder."+ <> " Takes an input term and expected result (Either String Value).") $+ T.record [+ "term">:+ doc "The Hydra term to encode"+ Core.term,+ "expected">:+ doc "The expected result: Left for error, Right for encoded JSON" $+ T.either_ T.string JsonModel.value]++jsonRoundtripTestCase :: Binding+jsonRoundtripTestCase = define "JsonRoundtripTestCase" $+ doc ("A test case for round-trip encoding/decoding using the Either-based JSON functions."+ <> " Encodes a term, then decodes it back, verifying the result equals the original.") $+ T.record [+ "type">:+ doc "The Hydra type for encoding/decoding"+ Core.type_,+ "term">:+ doc "The Hydra term to round-trip"+ Core.term]++jsonParserTestCase :: Binding+jsonParserTestCase = define "JsonParserTestCase" $+ doc "A test case which parses a JSON string and compares the result with an expected JSON value" $+ parserTestCase @@ JsonModel.value++liftLambdaAboveLetTestCase :: Binding+liftLambdaAboveLetTestCase = define "LiftLambdaAboveLetTestCase" $+ doc ("A test case which lifts lambda abstractions above let expressions"+ <> " and compares the result with the expected term") $+ T.record [+ "input">:+ doc "The term to transform"+ Core.term,+ "output">:+ doc "The expected transformed term"+ Core.term]++jsonWriterTestCase :: Binding+jsonWriterTestCase = define "JsonWriterTestCase" $+ doc "A test case which serializes a JSON value to a string and compares it to the expected string" $+ writerTestCase @@ JsonModel.value++parserTestCase :: Binding+parserTestCase = define "ParserTestCase" $+ doc "A test case which parses an input string and compares the result with an expected value" $+ T.forAll "a" $ T.record [+ "input">:+ doc "The input string to parse" $+ T.string,+ "output">:+ doc "The expected parse result" $+ Parsing.parseResult @@ "a"]++tag :: Binding+tag = define "Tag" $+ doc "A tag for categorizing test cases" $+ T.wrap T.string++testCodec :: Binding+testCodec = define "TestCodec" $+ doc "A codec for generating compiled test files from test groups into a target programming language" $+ T.record [+ "language">:+ doc "The name of the target programming language"+ Coders.languageName,+ "fileExtension">:+ doc "The file extension for test files (e.g., 'hs', 'java', 'py')"+ Module.fileExtension,+ "encodeTerm">:+ doc "A function for encoding Hydra terms into the target language" $+ Core.term ~> Compute.flow @@ Graph.graph @@ T.string,+ "encodeType">:+ doc "A function for encoding Hydra types into the target language" $+ Core.type_ ~> Compute.flow @@ Graph.graph @@ T.string,+ "formatTestName">:+ doc "A function for formatting test case names according to the target language's conventions" $+ T.string ~> T.string,+ "formatModuleName">:+ doc "A function for formatting module names according to the target language's conventions" $+ Module.namespace ~> T.string,+ "testCaseTemplate">:+ doc "A template string for individual test case assertions" $+ T.string,+ "testGroupTemplate">:+ doc "A template string for wrapping a group of test cases" $+ T.string,+ "moduleTemplate">:+ doc "A template string for the overall test module structure" $+ T.string,+ "importTemplate">:+ doc "A template string for import/include statements" $+ T.string,+ "findImports">:+ doc "A function that determines the necessary imports for a given set of dependencies" $+ T.set Core.name ~> T.list T.string]++testCase :: Binding+testCase = define "TestCase" $+ doc "A simple test case with an input and an expected output" $+ T.union [+ "alphaConversion">:+ doc "An alpha conversion test"+ alphaConversionTestCase,+ "caseConversion">:+ doc "A case conversion test"+ caseConversionTestCase,+ "deannotateTerm">:+ doc "A deannotate term test"+ deannotateTermTestCase,+ "deannotateType">:+ doc "A deannotate type test"+ deannotateTypeTestCase,+ "delegatedEvaluation">:+ doc "A delegated evaluation test"+ delegatedEvaluationTestCase,+ "etaExpansion">:+ doc "An eta expansion test"+ etaExpansionTestCase,+ "flattenLetTerms">:+ doc "A flatten let terms test"+ flattenLetTermsTestCase,+ "freeVariables">:+ doc "A free variables test"+ freeVariablesTestCase,+ "evaluation">:+ doc "A term evaluation test"+ evaluationTestCase,+ "inference">:+ doc "A type inference test"+ inferenceTestCase,+ "inferenceFailure">:+ doc "A type inference failure test"+ inferenceFailureTestCase,+ "jsonCoder">:+ doc "A JSON coder (round-trip) test using Flow-based coder"+ jsonCoderTestCase,+ "jsonDecode">:+ doc "A JSON decode test using Either-based decoder"+ jsonDecodeTestCase,+ "jsonEncode">:+ doc "A JSON encode test using Either-based encoder"+ jsonEncodeTestCase,+ "jsonParser">:+ doc "A JSON parser test"+ jsonParserTestCase,+ "jsonRoundtrip">:+ doc "A JSON round-trip test using Either-based encoder/decoder"+ jsonRoundtripTestCase,+ "jsonWriter">:+ doc "A JSON writer test"+ jsonWriterTestCase,+ "liftLambdaAboveLet">:+ doc "A lift lambda above let test"+ liftLambdaAboveLetTestCase,+ "serialization">:+ doc "An AST serialization test"+ serializationTestCase,+ "simplifyTerm">:+ doc "A simplify term test"+ simplifyTermTestCase,+ "topologicalSort">:+ doc "A topological sort test"+ topologicalSortTestCase,+ "topologicalSortBindings">:+ doc "A topological sort bindings test"+ topologicalSortBindingsTestCase,+ "topologicalSortSCC">:+ doc "A topological sort with SCC detection test"+ topologicalSortSCCTestCase,+ "typeChecking">:+ doc "A type checking test"+ typeCheckingTestCase,+ "typeCheckingFailure">:+ doc "A type checking failure test (currently unused)"+ typeCheckingFailureTestCase,+ "typeReduction">:+ doc "A type reduction test"+ typeReductionTestCase,+ "normalizeTypeVariables">:+ doc "A normalize type variables test"+ normalizeTypeVariablesTestCase,+ "foldOverTerm">:+ doc "A fold over term test"+ foldOverTermTestCase,+ "rewriteTerm">:+ doc "A rewrite term test"+ rewriteTermTestCase,+ "rewriteType">:+ doc "A rewrite type test"+ rewriteTypeTestCase,+ "hoistSubterms">:+ doc "A hoist subterms test"+ hoistSubtermsTestCase,+ "hoistCaseStatements">:+ doc "A hoist case statements test"+ hoistCaseStatementsTestCase,+ "hoistLetBindings">:+ doc "A hoist all let bindings test (hoistAll=True, for Java)"+ hoistLetBindingsTestCase,+ "hoistPolymorphicLetBindings">:+ doc "A hoist polymorphic let bindings test"+ hoistPolymorphicLetBindingsTestCase,+ "substInType">:+ doc "A type substitution test"+ substInTypeTestCase,+ "variableOccursInType">:+ doc "An occur check test for type unification"+ variableOccursInTypeTestCase,+ "unifyTypes">:+ doc "A type unification test"+ unifyTypesTestCase,+ "joinTypes">:+ doc "A join types test (produce type constraints)"+ joinTypesTestCase,+ "unshadowVariables">:+ doc "An unshadow variables test"+ unshadowVariablesTestCase]++testCaseWithMetadata :: Binding+testCaseWithMetadata = define "TestCaseWithMetadata" $+ doc "One of a number of test case variants, together with metadata including a test name, an optional description, and optional tags" $+ T.record [+ "name">:+ doc "The name of the test case" $+ T.string,+ "case">:+ doc "The test case itself"+ testCase,+ "description">:+ doc "An optional description of the test" $+ T.maybe T.string,+ "tags">:+ doc "Zero or more tags for categorizing the test" $+ T.list tag]++testGroup :: Binding+testGroup = define "TestGroup" $+ doc "A collection of test cases with a name and optional description" $+ T.record [+ "name">:+ doc "The name of the test group" $+ T.string,+ "description">:+ doc "An optional description of the group" $+ T.maybe T.string,+ "subgroups">:+ doc "Nested test groups" $+ T.list testGroup,+ "cases">:+ doc "The test cases in this group" $+ T.list testCaseWithMetadata]++typeCheckingTestCase :: Binding+typeCheckingTestCase = define "TypeCheckingTestCase" $+ doc "A test case which performs type checking on a given term and compares the result with an expected annotated term and type" $+ T.record [+ "input">:+ doc "An untyped term on which to perform inference, then type check"+ Core.term,+ "outputTerm">:+ doc "The expected fully annotated System F term after type inference"+ Core.term,+ "outputType">:+ doc "The expected inferred type"+ Core.type_]++typeCheckingFailureTestCase :: Binding+typeCheckingFailureTestCase = define "TypeCheckingFailureTestCase" $+ doc "A test case providing a term for which type checking is expected to fail. Note: there are currently no such test cases." $+ T.record [+ "input">:+ doc "The term for which type checking should fail"+ Core.term]++topologicalSortBindingsTestCase :: Binding+topologicalSortBindingsTestCase = define "TopologicalSortBindingsTestCase" $+ doc ("A test case which performs topological sort on a map of bindings (name -> term)"+ <> " and compares the result with expected groups of bindings in topological order") $+ T.record [+ "bindings">:+ doc "The bindings as a list of (name, term) pairs" $+ T.list (T.pair Core.name Core.term),+ "expected">:+ doc "The expected groups of bindings in topological order" $+ T.list (T.list (T.pair Core.name Core.term))]++topologicalSortTestCase :: Binding+topologicalSortTestCase = define "TopologicalSortTestCase" $+ doc ("A test case which performs topological sort on a directed graph and compares the result"+ <> " with either an expected sorted list or expected cycles") $+ T.record [+ "adjacencyList">:+ doc "The directed graph as an adjacency list (node to list of dependencies)" $+ T.list (T.pair T.int32 (T.list T.int32)),+ "expected">:+ doc "The expected result: Left for cycles, Right for sorted nodes" $+ T.either_ (T.list (T.list T.int32)) (T.list T.int32)]++topologicalSortSCCTestCase :: Binding+topologicalSortSCCTestCase = define "TopologicalSortSCCTestCase" $+ doc ("A test case which performs topological sort with strongly connected component detection"+ <> " and compares the result with expected components") $+ T.record [+ "adjacencyList">:+ doc "The directed graph as an adjacency list" $+ T.list (T.pair T.int32 (T.list T.int32)),+ "expected">:+ doc "The expected strongly connected components in topological order" $+ T.list (T.list T.int32)]++serializationTestCase :: Binding+serializationTestCase = define "SerializationTestCase" $+ doc "A test case which serializes an AST expression to a string and compares it with the expected output" $+ T.record [+ "input">:+ doc "The AST expression to serialize"+ Ast.expr,+ "output">:+ doc "The expected serialized string" $+ T.string]++simplifyTermTestCase :: Binding+simplifyTermTestCase = define "SimplifyTermTestCase" $+ doc ("A test case which performs term simplification (beta reduction and optimization)"+ <> " and compares the result with the expected term") $+ T.record [+ "input">:+ doc "The term to simplify"+ Core.term,+ "output">:+ doc "The expected simplified term"+ Core.term]++normalizeTypeVariablesTestCase :: Binding+normalizeTypeVariablesTestCase = define "NormalizeTypeVariablesTestCase" $+ doc ("A test case which normalizes type variables in a term"+ <> " (renaming them to t0, t1, t2, etc.) and compares the result with the expected term") $+ T.record [+ "input">:+ doc "The term with type annotations to normalize"+ Core.term,+ "output">:+ doc "The expected term with normalized type variable names"+ Core.term]++typeReductionTestCase :: Binding+typeReductionTestCase = define "TypeReductionTestCase" $+ doc "A test case which performs beta reduction on a type (reducing type applications) and compares the result with the expected type" $+ T.record [+ "input">:+ doc "The type to reduce"+ Core.type_,+ "output">:+ doc "The expected reduced type"+ Core.type_]++writerTestCase :: Binding+writerTestCase = define "WriterTestCase" $+ doc "A test case which writes a value to a string and compares it to the expected string" $+ T.forAll "a" $ T.record [+ "input">:+ doc "The input value to write"+ "a",+ "output">:+ doc "The expected string" $+ T.string]++substInTypeTestCase :: Binding+substInTypeTestCase = define "SubstInTypeTestCase" $+ doc ("A test case which applies a type substitution to a type and compares the result."+ <> " The substitution is provided as a list of (variable name, replacement type) pairs.") $+ T.record [+ "substitution">:+ doc "The type substitution as a list of (name, type) pairs" $+ T.list (T.pair Core.name Core.type_),+ "input">:+ doc "The type to substitute into"+ Core.type_,+ "output">:+ doc "The expected result type"+ Core.type_]++variableOccursInTypeTestCase :: Binding+variableOccursInTypeTestCase = define "VariableOccursInTypeTestCase" $+ doc ("A test case which checks whether a type variable occurs in a type expression."+ <> " This is the occur check used in type unification.") $+ T.record [+ "variable">:+ doc "The variable name to search for"+ Core.name,+ "type">:+ doc "The type to search within"+ Core.type_,+ "expected">:+ doc "Whether the variable occurs in the type" $+ T.boolean]++unifyTypesTestCase :: Binding+unifyTypesTestCase = define "UnifyTypesTestCase" $+ doc ("A test case which attempts to unify two types and compares the result."+ <> " The expected result is either Left (failure message substring) or Right (substitution).") $+ T.record [+ "schemaTypes">:+ doc "The schema types map (type variable names that should not be bound)" $+ T.list Core.name,+ "left">:+ doc "The left type to unify"+ Core.type_,+ "right">:+ doc "The right type to unify"+ Core.type_,+ "expected">:+ doc "The expected result: Left for failure (substring of error), Right for substitution" $+ T.either_ T.string Typing.typeSubst]++joinTypesTestCase :: Binding+joinTypesTestCase = define "JoinTypesTestCase" $+ doc ("A test case which joins two types (producing type constraints or failing)."+ <> " The expected result is either Left (failure) or Right (list of constraints).") $+ T.record [+ "left">:+ doc "The left type to join"+ Core.type_,+ "right">:+ doc "The right type to join"+ Core.type_,+ "expected">:+ doc "The expected result: Left for failure, Right for constraints" $+ T.either_ T.unit (T.list Typing.typeConstraint)]++unshadowVariablesTestCase :: Binding+unshadowVariablesTestCase = define "UnshadowVariablesTestCase" $+ doc ("A test case which renames shadowed variables in a term"+ <> " and compares the result with the expected term") $+ T.record [+ "input">:+ doc "The term with potentially shadowed variables"+ Core.term,+ "output">:+ doc "The expected term after unshadowing"+ Core.term]
src/main/haskell/Hydra/Sources/Kernel/Types/Topology.hs view
@@ -2,56 +2,67 @@ -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.topology"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [] [Core.module_] $+module_ = Module ns elements [] [Core.ns] $ Just "A model for simple graphs as adjacency lists" where- ns = Namespace "hydra.topology"- topo = typeref ns- def = datatype ns- elements = [+ graph,+ orderingIsomorphism,+ tarjanState,+ vertex] - def "Graph" $ Types.map (topo "Vertex") (list $ topo "Vertex"),+graph :: Binding+graph = define "Graph" $+ doc "A directed graph represented as an adjacency list mapping vertices to their outgoing neighbors" $+ T.map vertex (T.list vertex) - -- Note: useful, but currently unused- def "OrderingIsomorphism" $ forAlls ["a"] $ record [- "encode">:- doc "Mapping from source ordering to target ordering" $- list (var "a") --> list (var "a"),- "decode">:- doc "Mapping from target ordering to source ordering" $- list (var "a") --> list (var "a")],+orderingIsomorphism :: Binding+orderingIsomorphism = define "OrderingIsomorphism" $+ T.forAll "a" $ T.record [+ "encode">:+ doc "Mapping from source ordering to target ordering" $+ T.list "a" ~> T.list "a",+ "decode">:+ doc "Mapping from target ordering to source ordering" $+ T.list "a" ~> T.list "a"] - def "TarjanState" $ record [- "counter">:- doc "Next available index for vertices in the DFS traversal"- int32,- "indices">:- doc "Mapping from vertices to their indices in the DFS traversal" $- Types.map (topo "Vertex") int32,- "lowLinks">:- doc "Mapping from vertices to their lowest reachable index in the DFS traversal" $- Types.map (topo "Vertex") int32,- "stack">:- doc "Current DFS stack, with vertices in reverse order" $- list $ topo "Vertex",- "onStack">:- doc "Set of vertices currently on the stack, for quick lookup" $- Types.set (topo "Vertex"),- "sccs">:- doc "Accumulated strongly connected components, each a list of vertices" $- list $ list $ topo "Vertex"],+tarjanState :: Binding+tarjanState = define "TarjanState" $+ T.record [+ "counter">:+ doc "Next available index for vertices in the DFS traversal"+ T.int32,+ "indices">:+ doc "Mapping from vertices to their indices in the DFS traversal" $+ T.map vertex T.int32,+ "lowLinks">:+ doc "Mapping from vertices to their lowest reachable index in the DFS traversal" $+ T.map vertex T.int32,+ "stack">:+ doc "Current DFS stack, with vertices in reverse order" $+ T.list vertex,+ "onStack">:+ doc "Set of vertices currently on the stack, for quick lookup" $+ T.set vertex,+ "sccs">:+ doc "Accumulated strongly connected components, each a list of vertices" $+ T.list $ T.list vertex] - def "Vertex" $ int32]+vertex :: Binding+vertex = define "Vertex" $+ doc "A graph vertex, represented as a 32-bit integer identifier" $+ T.int32
src/main/haskell/Hydra/Sources/Kernel/Types/Typing.hs view
@@ -1,74 +1,145 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Typing where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y +ns :: Namespace+ns = Namespace "hydra.typing"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Core.module_] [Core.module_] $- Just ("Types supporting type inference and type reconstruction.")+module_ = Module ns elements [Core.ns] [Core.ns] $+ Just "Types supporting type inference and type reconstruction." where- ns = Namespace "hydra.typing"- core = typeref $ moduleNamespace Core.module_- typing = typeref ns- def = datatype ns- elements = [+ functionStructure,+ inferenceContext,+ inferenceResult,+ termSubst,+ typeConstraint,+ typeContext,+ typeSubst] - def "InferenceContext" $- doc "The context provided to type inference, including various typing enviroments." $- record [- "schemaTypes">:- doc "A fixed typing environment which is derived from the schema of the graph." $- Types.map (core "Name") (core "TypeScheme"),- "primitiveTypes">:- doc "A fixed typing environment which is derived from the set of primitives in the graph." $- Types.map (core "Name") (core "TypeScheme"),- "dataTypes">:- doc ("A mutable typing environment which is specific to the current graph being processed."- ++ " This environment is (usually) smaller than the schema and primitive typing environments,"- ++ " and is subject to global substitutions.") $- Types.map (core "Name") (core "TypeScheme"),- "debug">: boolean],+inferenceContext :: Binding+inferenceContext = define "InferenceContext" $+ doc "The context provided to type inference, including various typing environments." $+ T.record [+ "schemaTypes">:+ doc "A fixed typing environment which is derived from the schema of the graph." $+ T.map Core.name Core.typeScheme,+ "primitiveTypes">:+ doc "A fixed typing environment which is derived from the set of primitives in the graph." $+ T.map Core.name Core.typeScheme,+ "dataTypes">:+ doc ("A mutable typing environment which is specific to the current graph being processed."+ ++ " This environment is (usually) smaller than the schema and primitive typing environments,"+ ++ " and is subject to global substitutions.") $+ T.map Core.name Core.typeScheme,+ "classConstraints">:+ doc ("A mutable map from type variable names to their accumulated class constraints."+ ++ " This is populated during type inference when operations requiring Eq or Ord are encountered.") $+ T.map Core.name Core.typeVariableMetadata,+ "debug">:+ doc "Whether to enable debug output during type inference"+ T.boolean] - def "InferenceResult" $- doc "The result of applying inference rules to a term." $- record [- "term">: core "Term",- "type">: core "Type",- "subst">: typing "TypeSubst"],+inferenceResult :: Binding+inferenceResult = define "InferenceResult" $+ doc "The result of applying inference rules to a term." $+ T.record [+ "term">:+ doc "The term which was inferred"+ Core.term,+ "type">:+ doc "The inferred type of the term"+ Core.type_,+ "subst">:+ doc "The type substitution resulting from unification"+ typeSubst,+ "classConstraints">:+ doc "Class constraints discovered during inference (e.g., Ord constraints from Map.lookup)" $+ T.map Core.name Core.typeVariableMetadata] - def "TermSubst" $- doc "A substitution of term variables for terms" $- wrap $ Types.map (core "Name") (core "Term"),+termSubst :: Binding+termSubst = define "TermSubst" $+ doc "A substitution of term variables for terms" $+ T.wrap $ T.map Core.name Core.term - def "TypeConstraint" $- doc "An assertion that two types can be unified into a single type" $- record [- "left">: core "Type",- "right">: core "Type",- "comment">:- doc "A description of the type constraint which may be used for tracing or debugging"- string],+typeConstraint :: Binding+typeConstraint = define "TypeConstraint" $+ doc "An assertion that two types can be unified into a single type" $+ T.record [+ "left">:+ doc "The left-hand side of the constraint"+ Core.type_,+ "right">:+ doc "The right-hand side of the constraint"+ Core.type_,+ "comment">:+ doc "A description of the type constraint which may be used for tracing or debugging"+ T.string] - def "TypeContext" $- doc "A typing environment used for type reconstruction (typeOf) over System F terms" $- record [- "types">: Types.map (core "Name") (core "Type"),- "variables">: Types.set (core "Name"),- "inferenceContext">: typing "InferenceContext"],+typeContext :: Binding+typeContext = define "TypeContext" $+ doc "A typing environment used for type reconstruction (typeOf) over System F terms" $+ T.record [+ "types">:+ doc "A mapping of lambda- and let-bound variables to their types" $+ T.map Core.name Core.type_,+ "metadata">:+ doc "Any additional metadata about lambda- and let-bound variables" $+ T.map Core.name Core.term,+ "typeVariables">:+ doc "The set of type variables introduced by enclosing type lambdas" $+ T.set Core.name,+ "lambdaVariables">:+ doc "The set of term variables introduced by lambdas (even if untyped)" $+ T.set Core.name,+ "letVariables">:+ doc "The set of term variables introduced by let bindings (even if untyped)" $+ T.set Core.name,+ "inferenceContext">:+ doc "The schema types, primitive types, and data types of the graph"+ inferenceContext] - def "TypeSubst" $- doc "A substitution of type variables for types" $- wrap $ Types.map (core "Name") (core "Type")]+typeSubst :: Binding+typeSubst = define "TypeSubst" $+ doc "A substitution of type variables for types" $+ T.wrap $ T.map Core.name Core.type_++functionStructure :: Binding+functionStructure = define "FunctionStructure" $+ doc ("A structured representation of a function term's components, replacing ad-hoc tuples."+ ++ " This captures all the information extracted from peeling lambdas, type lambdas, lets, and"+ ++ " type applications from a term.") $+ T.forAll "env" $+ T.record [+ "typeParams">:+ doc "Type parameters (from type lambdas)" $+ T.list Core.name,+ "params">:+ doc "Value parameters (from lambdas)" $+ T.list Core.name,+ "bindings">:+ doc "Let bindings accumulated from the term" $+ T.list Core.binding,+ "body">:+ doc "The body term after removing all lambdas, lets, etc."+ Core.term,+ "domains">:+ doc "Domain types of the value parameters" $+ T.list Core.type_,+ "codomain">:+ doc "The return type of the function (if type inference succeeded)" $+ T.optional Core.type_,+ "environment">:+ doc "Updated environment after processing all bindings" $+ T.variable "env"]
+ src/main/haskell/Hydra/Sources/Kernel/Types/Util.hs view
@@ -0,0 +1,55 @@+module Hydra.Sources.Kernel.Types.Util where++-- Standard type-level kernel imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.util"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [] [Core.ns] $+ Just "General-purpose utility types used across Hydra."+ where+ elements = [+ caseConvention,+ comparison,+ decodingError,+ precision]++caseConvention :: Binding+caseConvention = define "CaseConvention" $+ doc "A naming convention for symbols, such as camelCase or snake_case" $+ T.enum ["camel", "pascal", "lowerSnake", "upperSnake"]++comparison :: Binding+comparison = define "Comparison" $+ doc "An equality judgement: less than, equal to, or greater than" $+ T.enum [+ "lessThan",+ "equalTo",+ "greaterThan"]++decodingError :: Binding+decodingError = define "DecodingError" $+ doc "An error that occurred during decoding of a term" $+ T.wrap T.string++precision :: Binding+precision = define "Precision" $+ doc "Numeric precision: arbitrary precision, or precision to a specified number of bits" $+ T.union [+ "arbitrary">:+ doc "Arbitrary precision" $+ T.unit,+ "bits">:+ doc "Precision to a specified number of bits" $+ T.int32]
+ src/main/haskell/Hydra/Sources/Kernel/Types/Variants.hs view
@@ -0,0 +1,97 @@+module Hydra.Sources.Kernel.Types.Variants where++-- Standard type-level kernel imports+import Hydra.Kernel hiding (eliminationVariant, functionVariant, literalVariant, termVariant, typeVariant)+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "hydra.variants"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [Core.ns] [Core.ns] $+ Just "Variant types which describe the structure of Hydra core types and terms."+ where+ elements = [+ eliminationVariant,+ functionVariant,+ literalVariant,+ termVariant,+ typeVariant]++eliminationVariant :: Binding+eliminationVariant = define "EliminationVariant" $+ doc "The identifier of an elimination constructor" $+ T.enum [+ "record",+ "union",+ "wrap"]++functionVariant :: Binding+functionVariant = define "FunctionVariant" $+ doc "The identifier of a function constructor" $+ T.enum [+ "elimination",+ "lambda",+ "primitive"]++literalVariant :: Binding+literalVariant = define "LiteralVariant" $+ doc "The identifier of a literal constructor" $+ T.enum [+ "binary",+ "boolean",+ "float",+ "integer",+ "string"]++termVariant :: Binding+termVariant = define "TermVariant" $+ doc "The identifier of a term expression constructor" $+ T.enum [+ "annotated",+ "application",+ "either",+ "function",+ "let",+ "list",+ "literal",+ "map",+ "maybe",+ "pair",+ "record",+ "set",+ "typeApplication",+ "typeLambda",+ "union",+ "unit",+ "variable",+ "wrap"]++typeVariant :: Binding+typeVariant = define "TypeVariant" $+ doc "The identifier of a type constructor" $+ T.enum [+ "annotated",+ "application",+ "either",+ "forall",+ "function",+ "list",+ "literal",+ "map",+ "maybe",+ "pair",+ "record",+ "set",+ "union",+ "unit",+ "variable",+ "wrap"]
src/main/haskell/Hydra/Sources/Kernel/Types/Workflow.hs view
@@ -1,87 +1,86 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Sources.Kernel.Types.Workflow where -- Standard type-level kernel imports import Hydra.Kernel-import Hydra.Dsl.Annotations+import Hydra.Dsl.Annotations (doc) import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Terms as Terms-import Hydra.Dsl.Types as Types+import Hydra.Dsl.Types ((>:), (@@), (~>))+import qualified Hydra.Dsl.Types as T import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y- import qualified Hydra.Sources.Kernel.Types.Compute as Compute import qualified Hydra.Sources.Kernel.Types.Graph as Graph import qualified Hydra.Sources.Kernel.Types.Module as Module +ns :: Namespace+ns = Namespace "hydra.workflow"++define :: String -> Type -> Binding+define = defineType ns+ module_ :: Module-module_ = Module ns elements [Compute.module_, Graph.module_, Module.module_] [Core.module_] $+module_ = Module ns elements [Compute.ns, Graph.ns, Module.ns] [Core.ns] $ Just "A model for Hydra transformation workflows" where- ns = Namespace "hydra.workflow"- mod = typeref $ moduleNamespace Module.module_- compute = typeref $ moduleNamespace Compute.module_- core = typeref $ moduleNamespace Core.module_- graph = typeref $ moduleNamespace Graph.module_- wf = typeref ns- def = datatype ns- elements = [+ hydraSchemaSpec,+ lastMile,+ schemaSpec,+ transformWorkflow] - def "HydraSchemaSpec" $- doc "The specification of a Hydra schema, provided as a set of modules and a distinguished type" $- record [- "modules">:- doc "The modules to include in the schema graph" $- list $ mod "Module",- "typeName">:- doc "The name of the top-level type; all data which passes through the workflow will be instances of this type" $- core "Name"],+hydraSchemaSpec :: Binding+hydraSchemaSpec = define "HydraSchemaSpec" $+ doc "The specification of a Hydra schema, provided as a set of modules and a distinguished type" $+ T.record [+ "modules">:+ doc "The modules to include in the schema graph" $+ T.list Module.module',+ "typeName">:+ doc "The name of the top-level type; all data which passes through the workflow will be instances of this type"+ Core.name] - def "LastMile" $- doc "The last mile of a transformation, which encodes and serializes terms to a file" $- forAlls ["s", "a"] $ record [- "encoder">:- doc "An encoder for terms to a list of output objects" $- core "Type" --> compute "Flow" @@ "s"- @@ (core "Term" --> graph "Graph" --> compute "Flow" @@ "s" @@ list "a"),- "serializer">:- doc "A function which serializes a list of output objects to a string representation" $- list "a" --> compute "Flow" @@ "s" @@ string,- "fileExtension">:- doc "A file extension for the generated file(s)"- string],+lastMile :: Binding+lastMile = define "LastMile" $+ doc "The last mile of a transformation, which encodes and serializes terms to a file" $+ T.forAlls ["s", "a"] $ T.record [+ "encoder">:+ doc "An encoder for terms to a list of output objects" $+ Core.type_ ~> Compute.flow @@ "s"+ @@ (Core.term ~> Graph.graph ~> Compute.flow @@ "s" @@ T.list "a"),+ "serializer">:+ doc "A function which serializes a list of output objects to a string representation" $+ T.list "a" ~> Compute.flow @@ "s" @@ T.string,+ "fileExtension">:+ doc "A file extension for the generated file(s)" $+ T.string] - def "SchemaSpec" $- doc "The specification of a schema at the source end of a workflow" $- union [- "hydra">:- doc "A native Hydra schema" $- wf "HydraSchemaSpec",- "file">:- doc "A schema provided as a file, available at the given file path" $- string,- "provided">:- doc "A schema which will be provided within the workflow" $- unit],+schemaSpec :: Binding+schemaSpec = define "SchemaSpec" $+ doc "The specification of a schema at the source end of a workflow" $+ T.union [+ "hydra">:+ doc "A native Hydra schema"+ hydraSchemaSpec,+ "file">:+ doc "A schema provided as a file, available at the given file path" $+ T.string,+ "provided">:+ doc "A schema which will be provided within the workflow" $+ T.unit] - def "TransformWorkflow" $- doc "The specification of a workflow which takes a schema specification, reads data from a directory, and writes data to another directory" $- record [- "name">:- doc "A descriptive name for the workflow"- string,- "schemaSpec">:- doc "The schema specification" $- wf "SchemaSpec",- "srcDir">:- doc "The source directory"- string,- "destDir">:- doc "The destination directory"- string]]+transformWorkflow :: Binding+transformWorkflow = define "TransformWorkflow" $+ doc "The specification of a workflow which takes a schema specification, reads data from a directory, and writes data to another directory" $+ T.record [+ "name">:+ doc "A descriptive name for the workflow" $+ T.string,+ "schemaSpec">:+ doc "The schema specification"+ schemaSpec,+ "srcDir">:+ doc "The source directory" $+ T.string,+ "destDir">:+ doc "The destination directory" $+ T.string]
src/main/haskell/Hydra/Sources/Libraries.hs view
@@ -1,15 +1,18 @@-{-# LANGUAGE OverloadedStrings #-} -- | Implementations of the Hydra standard libraries in Haskell-module Hydra.Sources.Libraries where+module Hydra.Sources.Libraries (+ module Hydra.Sources.Libraries,+ module Hydra.Staging.Lib.Names,+) where import Hydra.Kernel-import qualified Hydra.Extract.Core as ExtractCore+import Hydra.Staging.Lib.Names import Hydra.Dsl.Prims as Prims import qualified Hydra.Dsl.Terms as Terms import qualified Hydra.Dsl.Types as Types import qualified Hydra.Lib.Chars as Chars+import qualified Hydra.Lib.Eithers as Eithers import qualified Hydra.Lib.Equality as Equality import qualified Hydra.Lib.Flows as Flows import qualified Hydra.Lib.Lists as Lists@@ -17,278 +20,191 @@ import qualified Hydra.Lib.Logic as Logic import qualified Hydra.Lib.Maps as Maps import qualified Hydra.Lib.Math as Math-import qualified Hydra.Lib.Optionals as Optionals+import qualified Hydra.Lib.Maybes as Maybes+import qualified Hydra.Lib.Pairs as Pairs import qualified Hydra.Lib.Sets as Sets import qualified Hydra.Lib.Strings as Strings +import qualified Hydra.Eval.Lib.Eithers as EvalEithers+import qualified Hydra.Eval.Lib.Flows as EvalFlows+import qualified Hydra.Eval.Lib.Lists as EvalLists+import qualified Hydra.Eval.Lib.Maps as EvalMaps+import qualified Hydra.Eval.Lib.Maybes as EvalMaybes+import qualified Hydra.Eval.Lib.Pairs as EvalPairs+import qualified Hydra.Eval.Lib.Sets as EvalSets+ import qualified Data.List as L --- * Hydra standard library+-- Type variables (TypeVar) for primitive type schemes+-- Unconstrained+_a, _b, _c, _d, _k, _k1, _k2, _s, _v, _v1, _v2, _w, _x, _y, _z :: TypeVar+_a = v "a"+_b = v "b"+_c = v "c"+_d = v "d"+_k = v "k"+_k1 = v "k1"+_k2 = v "k2"+_s = v "s"+_v = v "v"+_v1 = v "v1"+_v2 = v "v2"+_w = v "w"+_x = v "x"+_y = v "y"+_z = v "z" -standardLibrary :: Namespace -> [Primitive] -> Library-standardLibrary ns prims = Library {- libraryNamespace = ns,- libraryPrefix = L.drop (L.length ("hydra.lib." :: String)) $ unNamespace ns,- libraryPrimitives = prims}+-- Ord-constrained+_kOrd, _k1Ord, _k2Ord, _xOrd, _yOrd :: TypeVar+_kOrd = vOrd "k"+_k1Ord = vOrd "k1"+_k2Ord = vOrd "k2"+_xOrd = vOrd "x"+_yOrd = vOrd "y" +-- Eq-constrained+_xEq :: TypeVar+_xEq = vEq "x"++-- Term coders for type variables (used in primitive implementations)+a_, b_, c_, d_, k_, k1_, k2_, s_, v_, v1_, v2_, w_, x_, y_, z_ :: TermCoder Term+a_ = variable "a"+b_ = variable "b"+c_ = variable "c"+d_ = variable "d"+k_ = variable "k"+k1_ = variable "k1"+k2_ = variable "k2"+s_ = variable "s"+v_ = variable "v"+v1_ = variable "v1"+v2_ = variable "v2"+w_ = variable "w"+x_ = variable "x"+y_ = variable "y"+z_ = variable "z"+ standardLibraries :: [Library] standardLibraries = [ hydraLibChars,+ hydraLibEithers, hydraLibEquality, hydraLibFlows, hydraLibLists, hydraLibLiterals, hydraLibLogic, hydraLibMaps,+ hydraLibMathFloat64, hydraLibMathInt32,- hydraLibOptionals,+ hydraLibMaybes,+ hydraLibPairs, hydraLibSets, hydraLibStrings] --- * hydra.lib.chars primitives--_hydra_lib_chars :: Namespace-_hydra_lib_chars = Namespace "hydra.lib.chars"+standardLibrary :: Namespace -> [Primitive] -> Library+standardLibrary ns prims = Library {+ libraryNamespace = ns,+ libraryPrefix = L.drop (L.length ("hydra.lib." :: String)) $ unNamespace ns,+ libraryPrimitives = prims} -_chars_isAlphaNum = qname _hydra_lib_chars "isAlphaNum" :: Name-_chars_isLower = qname _hydra_lib_chars "isLower" :: Name-_chars_isSpace = qname _hydra_lib_chars "isSpace" :: Name-_chars_isUpper = qname _hydra_lib_chars "isUpper" :: Name-_chars_toLower = qname _hydra_lib_chars "toLower" :: Name-_chars_toUpper = qname _hydra_lib_chars "toUpper" :: Name+-- | A TermCoder for function types which uses beta reduction to bridge term-level+-- functions to native functions. This allows higher-order primitives like map,+-- filter, foldl, etc. to use native implementations rather than eval-level ones.+fun :: TermCoder x -> TermCoder y -> TermCoder (x -> y)+fun = Prims.functionWithReduce (reduceTerm True) hydraLibChars :: Library-hydraLibChars = standardLibrary _hydra_lib_strings [+hydraLibChars = standardLibrary _hydra_lib_chars [ prim1 _chars_isAlphaNum Chars.isAlphaNum [] int32 boolean,- prim1 _chars_isLower Chars.isLower [] int32 boolean,- prim1 _chars_isSpace Chars.isSpace [] int32 boolean,- prim1 _chars_isUpper Chars.isUpper [] int32 boolean,- prim1 _chars_toLower Chars.toLower [] int32 int32,- prim1 _chars_toUpper Chars.toUpper [] int32 int32]---- * hydra.lib.equality primitives--_hydra_lib_equality :: Namespace-_hydra_lib_equality = Namespace "hydra.lib.equality"+ prim1 _chars_isLower Chars.isLower [] int32 boolean,+ prim1 _chars_isSpace Chars.isSpace [] int32 boolean,+ prim1 _chars_isUpper Chars.isUpper [] int32 boolean,+ prim1 _chars_toLower Chars.toLower [] int32 int32,+ prim1 _chars_toUpper Chars.toUpper [] int32 int32] -_equality_compare = qname _hydra_lib_equality "compare" :: Name-_equality_equal = qname _hydra_lib_equality "equal" :: Name-_equality_gt = qname _hydra_lib_equality "gt" :: Name-_equality_gte = qname _hydra_lib_equality "gte" :: Name-_equality_identity = qname _hydra_lib_equality "identity" :: Name-_equality_lt = qname _hydra_lib_equality "lt" :: Name-_equality_lte = qname _hydra_lib_equality "lte" :: Name-_equality_max = qname _hydra_lib_equality "max" :: Name-_equality_min = qname _hydra_lib_equality "min" :: Name+hydraLibEithers :: Library+hydraLibEithers = standardLibrary _hydra_lib_eithers [+ prim2 _eithers_bind Eithers.bind [_x, _y, _z] (Prims.either_ x_ y_) (fun y_ (Prims.either_ x_ z_)) (Prims.either_ x_ z_),+ prim3 _eithers_bimap Eithers.bimap [_x, _y, _z, _w] (fun x_ z_) (fun y_ w_) (Prims.either_ x_ y_) (Prims.either_ z_ w_),+ prim3 _eithers_either Eithers.either [_x, _y, _z] (fun x_ z_) (fun y_ z_) (Prims.either_ x_ y_) z_,+ prim2 _eithers_fromLeft Eithers.fromLeft [_x, _y] x_ (Prims.either_ x_ y_) x_,+ prim2 _eithers_fromRight Eithers.fromRight [_x, _y] y_ (Prims.either_ x_ y_) y_,+ prim1 _eithers_isLeft Eithers.isLeft [_x, _y] (Prims.either_ x_ y_) boolean,+ prim1 _eithers_isRight Eithers.isRight [_x, _y] (Prims.either_ x_ y_) boolean,+ prim1 _eithers_lefts Eithers.lefts [_x, _y] (list $ Prims.either_ x_ y_) (list x_),+ prim2 _eithers_map Eithers.map [_x, _y, _z] (fun x_ y_) (Prims.either_ z_ x_) (Prims.either_ z_ y_),+ prim2 _eithers_mapList Eithers.mapList [_x, _y, _z] (fun x_ (Prims.either_ z_ y_)) (list x_) (Prims.either_ z_ (list y_)),+ prim2 _eithers_mapMaybe Eithers.mapMaybe [_x, _y, _z] (fun x_ (Prims.either_ z_ y_)) (optional x_) (Prims.either_ z_ (optional y_)),+ prim1 _eithers_partitionEithers Eithers.partitionEithers [_x, _y] (list $ Prims.either_ x_ y_) (pair (list x_) (list y_)),+ prim1 _eithers_rights Eithers.rights [_x, _y] (list $ Prims.either_ x_ y_) (list y_)] hydraLibEquality :: Library hydraLibEquality = standardLibrary _hydra_lib_equality [- prim2 _equality_compare Equality.compare ["x"] x x comparison,- prim2 _equality_equal Equality.equal ["x"] x x boolean,- prim1 _equality_identity Equality.identity ["x"] x x,- prim2 _equality_gt Equality.gt ["x"] x x boolean,- prim2 _equality_gte Equality.gte ["x"] x x boolean,- prim2 _equality_lt Equality.lt ["x"] x x boolean,- prim2 _equality_lte Equality.lte ["x"] x x boolean,- prim2 _equality_max Equality.max ["x"] x x x,- prim2 _equality_min Equality.min ["x"] x x x]- where- x = variable "x"---- * hydra.lib.flows primitives--_hydra_lib_flows :: Namespace-_hydra_lib_flows = Namespace "hydra.lib.flows"--_flows_apply = qname _hydra_lib_flows "apply" :: Name-_flows_bind = qname _hydra_lib_flows "bind" :: Name-_flows_fail = qname _hydra_lib_flows "fail" :: Name-_flows_map = qname _hydra_lib_flows "map" :: Name-_flows_mapElems = qname _hydra_lib_flows "mapElems" :: Name-_flows_mapKeys = qname _hydra_lib_flows "mapKeys" :: Name-_flows_mapList = qname _hydra_lib_flows "mapList" :: Name-_flows_mapOptional = qname _hydra_lib_flows "mapOptional" :: Name-_flows_mapSet = qname _hydra_lib_flows "mapSet" :: Name-_flows_pure = qname _hydra_lib_flows "pure" :: Name-_flows_sequence = qname _hydra_lib_flows "sequence" :: Name+ prim2 _equality_compare Equality.compare [_xOrd] x_ x_ comparison,+ prim2 _equality_equal Equality.equal [_xEq] x_ x_ boolean,+ prim1 _equality_identity Equality.identity [_x] x_ x_,+ prim2 _equality_gt Equality.gt [_xOrd] x_ x_ boolean,+ prim2 _equality_gte Equality.gte [_xOrd] x_ x_ boolean,+ prim2 _equality_lt Equality.lt [_xOrd] x_ x_ boolean,+ prim2 _equality_lte Equality.lte [_xOrd] x_ x_ boolean,+ prim2 _equality_max Equality.max [_xOrd] x_ x_ x_,+ prim2 _equality_min Equality.min [_xOrd] x_ x_ x_] hydraLibFlows :: Library hydraLibFlows = standardLibrary _hydra_lib_flows [- prim2 _flows_apply Flows.apply ["s", "x", "y"] (flow s (function x y)) (flow s x) (flow s y),- prim2 _flows_bind Flows.bind ["s", "x", "y"] (flow s x) (function x (flow s y)) (flow s y),- prim1 _flows_fail Flows.fail ["s", "x"] string (flow s x),- prim2 _flows_map Flows.map ["s", "x", "y"] (function x y) (flow s x) (flow s y),- prim2 _flows_mapElems Flows.mapElems ["s", "k", "v1", "v2"] (function v1 (flow s v2)) (Prims.map k v1) (flow s (Prims.map k v2)),- prim2 _flows_mapKeys Flows.mapKeys ["s", "k1", "k2", "v"] (function k1 (flow s k2)) (Prims.map k1 v) (flow s (Prims.map k2 v)),- prim2 _flows_mapList Flows.mapList ["s", "x", "y"] (function x (flow s y)) (list x) (flow s (list y)),- prim2 _flows_mapOptional Flows.mapOptional ["s", "x", "y"] (function x $ flow s y) (optional x) (flow s $ optional y),- prim2 _flows_mapSet Flows.mapSet ["s", "x", "y"] (function x (flow s y)) (set x) (flow s (set y)),- prim1 _flows_pure Flows.pure ["s", "x"] x (flow s x),- prim1 _flows_sequence Flows.sequence ["s", "x"] (list (flow s x)) (flow s (list x))]- where- s = variable "s"- k = variable "k"- k1 = variable "k1"- k2 = variable "k2"- x = variable "x"- v = variable "v"- v1 = variable "v1"- v2 = variable "v2"- y = variable "y"---- * hydra.lib.lists primitives--_hydra_lib_lists :: Namespace-_hydra_lib_lists = Namespace "hydra.lib.lists"--_lists_apply = qname _hydra_lib_lists "apply" :: Name-_lists_at = qname _hydra_lib_lists "at" :: Name-_lists_bind = qname _hydra_lib_lists "bind" :: Name-_lists_concat = qname _hydra_lib_lists "concat" :: Name-_lists_concat2 = qname _hydra_lib_lists "concat2" :: Name-_lists_cons = qname _hydra_lib_lists "cons" :: Name-_lists_drop = qname _hydra_lib_lists "drop" :: Name-_lists_dropWhile = qname _hydra_lib_lists "dropWhile" :: Name-_lists_elem = qname _hydra_lib_lists "elem" :: Name-_lists_filter = qname _hydra_lib_lists "filter" :: Name-_lists_foldl = qname _hydra_lib_lists "foldl" :: Name-_lists_group = qname _hydra_lib_lists "group" :: Name-_lists_head = qname _hydra_lib_lists "head" :: Name-_lists_init = qname _hydra_lib_lists "init" :: Name-_lists_intercalate = qname _hydra_lib_lists "intercalate" :: Name-_lists_intersperse = qname _hydra_lib_lists "intersperse" :: Name-_lists_last = qname _hydra_lib_lists "last" :: Name-_lists_length = qname _hydra_lib_lists "length" :: Name-_lists_map = qname _hydra_lib_lists "map" :: Name-_lists_nub = qname _hydra_lib_lists "nub" :: Name-_lists_null = qname _hydra_lib_lists "null" :: Name-_lists_pure = qname _hydra_lib_lists "pure" :: Name-_lists_replicate = qname _hydra_lib_lists "replicate" :: Name-_lists_reverse = qname _hydra_lib_lists "reverse" :: Name-_lists_safeHead = qname _hydra_lib_lists "safeHead" :: Name-_lists_singleton = qname _hydra_lib_lists "singleton" :: Name-_lists_sort = qname _hydra_lib_lists "sort" :: Name-_lists_sortOn = qname _hydra_lib_lists "sortOn" :: Name-_lists_span = qname _hydra_lib_lists "span" :: Name-_lists_tail = qname _hydra_lib_lists "tail" :: Name-_lists_take = qname _hydra_lib_lists "take" :: Name-_lists_transpose = qname _hydra_lib_lists "transpose" :: Name-_lists_zip = qname _hydra_lib_lists "zip" :: Name-_lists_zipWith = qname _hydra_lib_lists "zipWith" :: Name+ prim2Eval _flows_apply EvalFlows.apply [_s, _x, _y] (flow s_ (function x_ y_)) (flow s_ x_) (flow s_ y_),+ prim2Eval _flows_bind EvalFlows.bind [_s, _x, _y] (flow s_ x_) (function x_ (flow s_ y_)) (flow s_ y_),+ prim1 _flows_fail Flows.fail [_s, _x] string (flow s_ x_),+ prim3Eval _flows_foldl EvalFlows.foldl [_y, _x, _s] (function y_ (function x_ (flow s_ y_))) y_ (list x_) (flow s_ y_),+ prim2Eval _flows_map EvalFlows.map [_x, _y, _s] (function x_ y_) (flow s_ x_) (flow s_ y_),+ prim2Eval _flows_mapElems EvalFlows.mapElems [_v1, _s, _v2, _kOrd] (function v1_ (flow s_ v2_)) (Prims.map k_ v1_) (flow s_ (Prims.map k_ v2_)),+ prim2Eval _flows_mapKeys EvalFlows.mapKeys [_k1Ord, _s, _k2Ord, _v] (function k1_ (flow s_ k2_)) (Prims.map k1_ v_) (flow s_ (Prims.map k2_ v_)),+ prim2Eval _flows_mapList EvalFlows.mapList [_x, _s, _y] (function x_ (flow s_ y_)) (list x_) (flow s_ (list y_)),+ prim2Eval _flows_mapMaybe EvalFlows.mapMaybe [_x, _s, _y] (function x_ $ flow s_ y_) (optional x_) (flow s_ $ optional y_),+ prim2Eval _flows_mapSet EvalFlows.mapSet [_xOrd, _s, _yOrd] (function x_ (flow s_ y_)) (set x_) (flow s_ (set y_)),+ prim1 _flows_pure Flows.pure [_s, _x] x_ (flow s_ x_),+ prim1 _flows_sequence Flows.sequence [_s, _x] (list (flow s_ x_)) (flow s_ (list x_)),+ prim2Eval _flows_withDefault EvalFlows.withDefault [_s, _x] x_ (flow s_ x_) (flow s_ x_)] hydraLibLists :: Library hydraLibLists = standardLibrary _hydra_lib_lists [- prim2Interp _lists_apply (Just applyInterp) ["x", "y"] (list $ function x y) (list x) (list y),- prim2 _lists_at Lists.at ["x"] int32 (list x) x,- prim2Interp _lists_bind (Just bindInterp) ["x", "y"] (list x) (function x (list y)) (list y),- prim1 _lists_concat Lists.concat ["x"] (list (list x)) (list x),- prim2 _lists_concat2 Lists.concat2 ["x"] (list x) (list x) (list x),- prim2 _lists_cons Lists.cons ["x"] x (list x) (list x),- prim2 _lists_drop Lists.drop ["x"] int32 (list x) (list x),- prim2Interp _lists_dropWhile Nothing ["x"] (function x boolean) (list x) (list x),- prim2 _lists_elem Lists.elem ["x"] x (list x) boolean,- prim2 _lists_filter Lists.filter ["x"] (function x boolean) (list x) (list x),- prim3 _lists_foldl Lists.foldl ["x", "y"] (function y (function x y)) y (list x) y,- prim1 _lists_group Lists.group ["x"] (list x) (list (list x)),- prim1 _lists_head Lists.head ["x"] (list x) x,- prim1 _lists_init Lists.init ["x"] (list x) (list x),- prim2 _lists_intercalate Lists.intercalate ["x"] (list x) (list (list x)) (list x),- prim2 _lists_intersperse Lists.intersperse ["x"] x (list x) (list x),- prim1 _lists_last Lists.last ["x"] (list x) x,- prim1 _lists_length Lists.length ["x"] (list x) int32,- prim2Interp _lists_map (Just mapInterp) ["x", "y"] (function x y) (list x) (list y),- prim1 _lists_nub Lists.nub ["x"] (list x) (list x),- prim1 _lists_null Lists.null ["x"] (list x) boolean,- prim1 _lists_pure Lists.pure ["x"] x (list x),- prim2 _lists_replicate Lists.replicate ["x"] int32 x (list x),- prim1 _lists_reverse Lists.reverse ["x"] (list x) (list x),- prim1 _lists_safeHead Lists.safeHead ["x"] (list x) (optional x),- prim1 _lists_singleton Lists.singleton ["x"] x (list x),- prim2Interp _lists_sortOn Nothing ["x", "y"] (function x y) (list x) (list x),- prim2Interp _lists_span Nothing ["x", "y"] (function x boolean) (list x) (pair (list x) (list x)),- prim1 _lists_sort Lists.sort ["x"] (list x) (list x),- prim1 _lists_tail Lists.tail ["x"] (list x) (list x),- prim2 _lists_take Lists.take ["x"] int32 (list x) (list x),- prim1 _lists_transpose Lists.transpose ["x"] (list (list x)) (list (list x)),- prim2 _lists_zip Lists.zip ["x", "y"] (list x) (list y) (list (pair x y)),- prim3 _lists_zipWith Lists.zipWith ["x", "y", "z"] (function x $ function y z) (list x) (list y) (list z)]- where- x = variable "x"- y = variable "y"- z = variable "z"---- | Interpreted implementation of hydra.lib.lists.apply-applyInterp :: Term -> Term -> Flow Graph Term-applyInterp funs' args' = do- funs <- ExtractCore.list funs'- args <- ExtractCore.list args'- return $ Terms.list $ L.concat (helper args <$> funs)- where- helper args f = Terms.apply f <$> args---- | Interpreted implementation of hydra.lib.lists.bind-bindInterp :: Term -> Term -> Flow Graph Term-bindInterp args' fun = do- args <- ExtractCore.list args'- return $ Terms.apply (Terms.primitive _lists_concat) (Terms.list $ Terms.apply fun <$> args)---- | Interpreted implementation of hydra.lib.lists.map-mapInterp :: Term -> Term -> Flow Graph Term-mapInterp fun args' = do- args <- ExtractCore.list args'- return $ Terms.list (Terms.apply fun <$> args)---- * hydra.lib.literals primitives--_hydra_lib_literals :: Namespace-_hydra_lib_literals = Namespace "hydra.lib.literals"--_literals_bigfloatToBigint = qname _hydra_lib_literals "bigfloatToBigint" :: Name-_literals_bigfloatToFloat32 = qname _hydra_lib_literals "bigfloatToFloat32" :: Name-_literals_bigfloatToFloat64 = qname _hydra_lib_literals "bigfloatToFloat64" :: Name-_literals_bigintToBigfloat = qname _hydra_lib_literals "bigintToBigfloat" :: Name-_literals_bigintToInt8 = qname _hydra_lib_literals "bigintToInt8" :: Name-_literals_bigintToInt16 = qname _hydra_lib_literals "bigintToInt16" :: Name-_literals_bigintToInt32 = qname _hydra_lib_literals "bigintToInt32" :: Name-_literals_bigintToInt64 = qname _hydra_lib_literals "bigintToInt64" :: Name-_literals_bigintToUint8 = qname _hydra_lib_literals "bigintToUint8" :: Name-_literals_bigintToUint16 = qname _hydra_lib_literals "bigintToUint16" :: Name-_literals_bigintToUint32 = qname _hydra_lib_literals "bigintToUint32" :: Name-_literals_bigintToUint64 = qname _hydra_lib_literals "bigintToUint64" :: Name-_literals_binaryToString = qname _hydra_lib_literals "binaryToString" :: Name-_literals_float32ToBigfloat = qname _hydra_lib_literals "float32ToBigfloat" :: Name-_literals_float64ToBigfloat = qname _hydra_lib_literals "float64ToBigfloat" :: Name-_literals_int8ToBigint = qname _hydra_lib_literals "int8ToBigint" :: Name-_literals_int16ToBigint = qname _hydra_lib_literals "int16ToBigint" :: Name-_literals_int32ToBigint = qname _hydra_lib_literals "int32ToBigint" :: Name-_literals_int64ToBigint = qname _hydra_lib_literals "int64ToBigint" :: Name-_literals_readBigfloat = qname _hydra_lib_literals "readBigfloat" :: Name-_literals_readBoolean = qname _hydra_lib_literals "readBoolean" :: Name-_literals_readFloat32 = qname _hydra_lib_literals "readFloat32" :: Name-_literals_readFloat64 = qname _hydra_lib_literals "readFloat64" :: Name-_literals_readInt32 = qname _hydra_lib_literals "readInt32" :: Name-_literals_readInt64 = qname _hydra_lib_literals "readInt64" :: Name-_literals_readString = qname _hydra_lib_literals "readString" :: Name-_literals_showBigfloat = qname _hydra_lib_literals "showBigfloat" :: Name-_literals_showBigint = qname _hydra_lib_literals "showBigint" :: Name-_literals_showBoolean = qname _hydra_lib_literals "show" :: Name-_literals_showFloat32 = qname _hydra_lib_literals "showFloat32" :: Name-_literals_showFloat64 = qname _hydra_lib_literals "showFloat64" :: Name-_literals_showInt8 = qname _hydra_lib_literals "showInt8" :: Name-_literals_showInt16 = qname _hydra_lib_literals "showInt16" :: Name-_literals_showInt32 = qname _hydra_lib_literals "showInt32" :: Name-_literals_showInt64 = qname _hydra_lib_literals "showInt64" :: Name-_literals_showUint8 = qname _hydra_lib_literals "showUint8" :: Name-_literals_showUint16 = qname _hydra_lib_literals "showUint16" :: Name-_literals_showUint32 = qname _hydra_lib_literals "showUint32" :: Name-_literals_showUint64 = qname _hydra_lib_literals "showUint64" :: Name-_literals_showString = qname _hydra_lib_literals "showString" :: Name-_literals_stringToBinary = qname _hydra_lib_literals "stringToBinary" :: Name-_literals_uint8ToBigint = qname _hydra_lib_literals "uint8ToBigint" :: Name-_literals_uint16ToBigint = qname _hydra_lib_literals "uint16ToBigint" :: Name-_literals_uint32ToBigint = qname _hydra_lib_literals "uint32ToBigint" :: Name-_literals_uint64ToBigint = qname _hydra_lib_literals "uint64ToBigint" :: Name+ prim2 _lists_apply Lists.apply [_x, _y] (list $ fun x_ y_) (list x_) (list y_),+ prim2 _lists_at Lists.at [_x] int32 (list x_) x_,+ prim2 _lists_bind Lists.bind [_x, _y] (list x_) (fun x_ (list y_)) (list y_),+ prim1 _lists_concat Lists.concat [_x] (list (list x_)) (list x_),+ prim2 _lists_concat2 Lists.concat2 [_x] (list x_) (list x_) (list x_),+ prim2 _lists_cons Lists.cons [_x] x_ (list x_) (list x_),+ prim2 _lists_drop Lists.drop [_x] int32 (list x_) (list x_),+ prim2 _lists_dropWhile Lists.dropWhile [_x] (fun x_ boolean) (list x_) (list x_),+ prim2 _lists_elem Lists.elem [_xEq] x_ (list x_) boolean,+ prim2 _lists_filter Lists.filter [_x] (fun x_ boolean) (list x_) (list x_),+ prim2 _lists_find Lists.find [_x] (fun x_ boolean) (list x_) (optional x_),+ prim3 _lists_foldl Lists.foldl [_y, _x] (fun y_ (fun x_ y_)) y_ (list x_) y_,+ prim1 _lists_group Lists.group [_xEq] (list x_) (list (list x_)),+ prim1 _lists_head Lists.head [_x] (list x_) x_,+ prim1 _lists_init Lists.init [_x] (list x_) (list x_),+ prim2 _lists_intercalate Lists.intercalate [_x] (list x_) (list (list x_)) (list x_),+ prim2 _lists_intersperse Lists.intersperse [_x] x_ (list x_) (list x_),+ prim1 _lists_last Lists.last [_x] (list x_) x_,+ prim1 _lists_length Lists.length [_x] (list x_) int32,+ prim2 _lists_map Lists.map [_x, _y] (fun x_ y_) (list x_) (list y_),+ prim1 _lists_nub Lists.nub [_xEq] (list x_) (list x_),+ prim1 _lists_null Lists.null [_x] (list x_) boolean,+ prim2 _lists_partition Lists.partition [_x] (fun x_ boolean) (list x_) (pair (list x_) (list x_)),+ prim1 _lists_pure Lists.pure [_x] x_ (list x_),+ prim2 _lists_replicate Lists.replicate [_x] int32 x_ (list x_),+ prim1 _lists_reverse Lists.reverse [_x] (list x_) (list x_),+ prim1 _lists_safeHead Lists.safeHead [_x] (list x_) (optional x_),+ prim1 _lists_singleton Lists.singleton [_x] x_ (list x_),+ prim2 _lists_sortOn Lists.sortOn [_x, _yOrd] (fun x_ y_) (list x_) (list x_),+ prim2 _lists_span Lists.span [_x] (fun x_ boolean) (list x_) (pair (list x_) (list x_)),+ prim1 _lists_sort Lists.sort [_xOrd] (list x_) (list x_),+ prim1 _lists_tail Lists.tail [_x] (list x_) (list x_),+ prim2 _lists_take Lists.take [_x] int32 (list x_) (list x_),+ prim1 _lists_transpose Lists.transpose [_x] (list (list x_)) (list (list x_)),+ prim2 _lists_zip Lists.zip [_x, _y] (list x_) (list y_) (list (pair x_ y_)),+ prim3 _lists_zipWith Lists.zipWith [_x, _y, _z] (fun x_ $ fun y_ z_) (list x_) (list y_) (list z_)] hydraLibLiterals :: Library hydraLibLiterals = standardLibrary _hydra_lib_literals [@@ -304,6 +220,7 @@ prim1 _literals_bigintToUint16 Literals.bigintToUint16 [] bigint uint16, prim1 _literals_bigintToUint32 Literals.bigintToUint32 [] bigint uint32, prim1 _literals_bigintToUint64 Literals.bigintToUint64 [] bigint uint64,+ prim1 _literals_binaryToBytes Literals.binaryToBytes [] binary (list int32), prim1 _literals_binaryToString Literals.binaryToString [] binary string, prim1 _literals_float32ToBigfloat Literals.float32ToBigfloat [] float32 bigfloat, prim1 _literals_float64ToBigfloat Literals.float64ToBigfloat [] float64 bigfloat,@@ -312,12 +229,19 @@ prim1 _literals_int32ToBigint Literals.int32ToBigint [] int32 bigint, prim1 _literals_int64ToBigint Literals.int64ToBigint [] int64 bigint, prim1 _literals_readBigfloat Literals.readBigfloat [] string (optional bigfloat),+ prim1 _literals_readBigint Literals.readBigint [] string (optional bigint), prim1 _literals_readBoolean Literals.readBoolean [] string (optional boolean), prim1 _literals_readFloat32 Literals.readFloat32 [] string (optional float32), prim1 _literals_readFloat64 Literals.readFloat64 [] string (optional float64),+ prim1 _literals_readInt8 Literals.readInt8 [] string (optional int8),+ prim1 _literals_readInt16 Literals.readInt16 [] string (optional int16), prim1 _literals_readInt32 Literals.readInt32 [] string (optional int32), prim1 _literals_readInt64 Literals.readInt64 [] string (optional int64), prim1 _literals_readString Literals.readString [] string (optional string),+ prim1 _literals_readUint8 Literals.readUint8 [] string (optional uint8),+ prim1 _literals_readUint16 Literals.readUint16 [] string (optional uint16),+ prim1 _literals_readUint32 Literals.readUint32 [] string (optional uint32),+ prim1 _literals_readUint64 Literals.readUint64 [] string (optional uint64), prim1 _literals_showBigfloat Literals.showBigfloat [] bigfloat string, prim1 _literals_showBigint Literals.showBigint [] bigint string, prim1 _literals_showBoolean Literals.showBoolean [] boolean string,@@ -338,226 +262,122 @@ prim1 _literals_uint32ToBigint Literals.uint32ToBigint [] uint32 bigint, prim1 _literals_uint64ToBigint Literals.uint64ToBigint [] uint64 bigint] --- * hydra.lib.logic primitives--_hydra_lib_logic :: Namespace-_hydra_lib_logic = Namespace "hydra.lib.logic"--_logic_and = qname _hydra_lib_logic "and" :: Name-_logic_ifElse = qname _hydra_lib_logic "ifElse" :: Name-_logic_not = qname _hydra_lib_logic "not" :: Name-_logic_or = qname _hydra_lib_logic "or" :: Name- hydraLibLogic :: Library hydraLibLogic = standardLibrary _hydra_lib_logic [- prim2 _logic_and Logic.and [] boolean boolean boolean,- prim3 _logic_ifElse Logic.ifElse ["x"] boolean x x x,- prim1 _logic_not Logic.not [] boolean boolean,- prim2 _logic_or Logic.or [] boolean boolean boolean]- where- x = variable "x"---- * hydra.lib.maps primitives--_hydra_lib_maps :: Namespace-_hydra_lib_maps = Namespace "hydra.lib.maps"--_maps_alter = qname _hydra_lib_maps "alter" :: Name-_maps_bimap = qname _hydra_lib_maps "bimap" :: Name-_maps_elems = qname _hydra_lib_maps "elems" :: Name-_maps_empty = qname _hydra_lib_maps "empty" :: Name-_maps_filter = qname _hydra_lib_maps "filter" :: Name-_maps_filterWithKey = qname _hydra_lib_maps "filterWithKey" :: Name-_maps_findWithDefault = qname _hydra_lib_maps "findWithDefault" :: Name-_maps_fromList = qname _hydra_lib_maps "fromList" :: Name-_maps_insert = qname _hydra_lib_maps "insert" :: Name-_maps_keys = qname _hydra_lib_maps "keys" :: Name-_maps_lookup = qname _hydra_lib_maps "lookup" :: Name-_maps_map = qname _hydra_lib_maps "map" :: Name-_maps_mapKeys = qname _hydra_lib_maps "mapKeys" :: Name-_maps_member = qname _hydra_lib_maps "member" :: Name-_maps_null = qname _hydra_lib_maps "null" :: Name-_maps_remove = qname _hydra_lib_maps "remove" :: Name-_maps_singleton = qname _hydra_lib_maps "singleton" :: Name-_maps_size = qname _hydra_lib_maps "size" :: Name-_maps_toList = qname _hydra_lib_maps "toList" :: Name-_maps_union = qname _hydra_lib_maps "union" :: Name-_maps_values = qname _hydra_lib_maps "values" :: Name+ prim2 _logic_and Logic.and [] boolean boolean boolean,+ prim3 _logic_ifElse Logic.ifElse [_x] boolean x_ x_ x_,+ prim1 _logic_not Logic.not [] boolean boolean,+ prim2 _logic_or Logic.or [] boolean boolean boolean] hydraLibMaps :: Library hydraLibMaps = standardLibrary _hydra_lib_maps [- prim3Interp _maps_alter Nothing ["k", "v"] (function (optional v) (optional v)) k mapKv mapKv,- prim3 _maps_bimap Maps.bimap ["k1", "k2", "v1", "v2"] (function k1 k2) (function v1 v2) (Prims.map k1 v1) (Prims.map k2 v2),- prim1 _maps_elems Maps.elems ["k", "v"] mapKv (list v),- prim0 _maps_empty Maps.empty ["k", "v"] mapKv,- prim2 _maps_filter Maps.filter ["k", "v"] (function v boolean) mapKv mapKv,- prim2 _maps_filterWithKey Maps.filterWithKey ["k", "v"] (function k (function v boolean)) mapKv mapKv,- prim3 _maps_findWithDefault Maps.findWithDefault ["k", "v"] v k mapKv v,- prim1 _maps_fromList Maps.fromList ["k", "v"] (list $ pair k v) mapKv,- prim3 _maps_insert Maps.insert ["k", "v"] k v mapKv mapKv,- prim1 _maps_keys Maps.keys ["k", "v"] mapKv (list k),- prim2 _maps_lookup Maps.lookup ["k", "v"] k mapKv (optional v),- prim2 _maps_map Maps.map ["k", "v1", "v2"] (function v1 v2) (Prims.map k v1) (Prims.map k v2),- prim2 _maps_mapKeys Maps.mapKeys ["k1", "k2", "v"] (function k1 k2) (Prims.map k1 v) (Prims.map k2 v),- prim2 _maps_member Maps.member ["k", "v"] k mapKv boolean,- prim1 _maps_null Maps.null ["k", "v"] mapKv boolean,- prim1 _maps_size Maps.size ["k", "v"] mapKv int32,- prim2 _maps_remove Maps.remove ["k", "v"] k mapKv mapKv,- prim2 _maps_singleton Maps.singleton ["k", "v"] k v mapKv,- prim1 _maps_size Maps.size ["k", "v"] mapKv int32,- prim1 _maps_toList Maps.toList ["k", "v"] mapKv (list $ pair k v),- prim2 _maps_union Maps.union ["k", "v"] mapKv mapKv mapKv]+ prim3 _maps_alter Maps.alter [_v, _kOrd] (fun (optional v_) (optional v_)) k_ mapKv mapKv,+ prim3 _maps_bimap Maps.bimap [_k1Ord, _k2Ord, _v1, _v2] (fun k1_ k2_) (fun v1_ v2_) (Prims.map k1_ v1_) (Prims.map k2_ v2_),+ prim1 _maps_elems Maps.elems [_kOrd, _v] mapKv (list v_),+ prim2 _maps_delete Maps.delete [_kOrd, _v] k_ mapKv mapKv,+ prim0 _maps_empty Maps.empty [_kOrd, _v] mapKv,+ prim2 _maps_filter Maps.filter [_v, _kOrd] (fun v_ boolean) mapKv mapKv,+ prim2 _maps_filterWithKey Maps.filterWithKey [_kOrd, _v] (fun k_ (fun v_ boolean)) mapKv mapKv,+ prim3 _maps_findWithDefault Maps.findWithDefault [_v, _kOrd] v_ k_ mapKv v_,+ prim1 _maps_fromList Maps.fromList [_kOrd, _v] (list $ pair k_ v_) mapKv,+ prim3 _maps_insert Maps.insert [_kOrd, _v] k_ v_ mapKv mapKv,+ prim1 _maps_keys Maps.keys [_kOrd, _v] mapKv (list k_),+ prim2 _maps_lookup Maps.lookup [_kOrd, _v] k_ mapKv (optional v_),+ prim2 _maps_map Maps.map [_v1, _v2, _kOrd] (fun v1_ v2_) (Prims.map k_ v1_) (Prims.map k_ v2_),+ prim2 _maps_mapKeys Maps.mapKeys [_k1Ord, _k2Ord, _v] (fun k1_ k2_) (Prims.map k1_ v_) (Prims.map k2_ v_),+ prim2 _maps_member Maps.member [_kOrd, _v] k_ mapKv boolean,+ prim1 _maps_null Maps.null [_kOrd, _v] mapKv boolean,+ prim1 _maps_size Maps.size [_kOrd, _v] mapKv int32,+ prim2 _maps_singleton Maps.singleton [_kOrd, _v] k_ v_ mapKv,+ prim1 _maps_toList Maps.toList [_kOrd, _v] mapKv (list $ pair k_ v_),+ prim2 _maps_union Maps.union [_kOrd, _v] mapKv mapKv mapKv] where- k = variable "k"- k1 = variable "k1"- k2 = variable "k2"- v = variable "v"- v1 = variable "v1"- v2 = variable "v2"- mapKv = Prims.map k v---- * hydra.lib.math primitives--_hydra_lib_math :: Namespace-_hydra_lib_math = Namespace "hydra.lib.math"+ mapKv = Prims.map k_ v_ -_math_add = qname _hydra_lib_math "add" :: Name-_math_div = qname _hydra_lib_math "div" :: Name-_math_mod = qname _hydra_lib_math "mod" :: Name-_math_mul = qname _hydra_lib_math "mul" :: Name-_math_neg = qname _hydra_lib_math "neg" :: Name-_math_range = qname _hydra_lib_math "range" :: Name-_math_rem = qname _hydra_lib_math "rem" :: Name-_math_sub = qname _hydra_lib_math "sub" :: Name+hydraLibMathFloat64 :: Library+hydraLibMathFloat64 = standardLibrary _hydra_lib_math [+ prim1 _math_acos Math.acos [] float64 float64,+ prim1 _math_acosh Math.acosh [] float64 float64,+ prim1 _math_asin Math.asin [] float64 float64,+ prim1 _math_asinh Math.asinh [] float64 float64,+ prim1 _math_atan Math.atan [] float64 float64,+ prim2 _math_atan2 Math.atan2 [] float64 float64 float64,+ prim1 _math_atanh Math.atanh [] float64 float64,+ prim1 _math_ceiling Math.ceiling [] float64 bigint,+ prim1 _math_cos Math.cos [] float64 float64,+ prim1 _math_cosh Math.cosh [] float64 float64,+ prim0 _math_e Math.e [] float64,+ prim1 _math_exp Math.exp [] float64 float64,+ prim1 _math_floor Math.floor [] float64 bigint,+ prim1 _math_log Math.log [] float64 float64,+ prim2 _math_logBase Math.logBase [] float64 float64 float64,+ prim0 _math_pi Math.pi [] float64,+ prim2 _math_pow Math.pow [] float64 float64 float64,+ prim1 _math_round Math.round [] float64 bigint,+ prim1 _math_sin Math.sin [] float64 float64,+ prim1 _math_sinh Math.sinh [] float64 float64,+ prim1 _math_sqrt Math.sqrt [] float64 float64,+ prim1 _math_tan Math.tan [] float64 float64,+ prim1 _math_tanh Math.tanh [] float64 float64,+ prim1 _math_truncate Math.truncate [] float64 bigint] hydraLibMathInt32 :: Library hydraLibMathInt32 = standardLibrary _hydra_lib_math [- prim2 _math_add Math.add [] int32 int32 int32,- prim2 _math_div Math.div [] int32 int32 int32,- prim2 _math_mod Math.mod [] int32 int32 int32,- prim2 _math_mul Math.mul [] int32 int32 int32,- prim1 _math_neg Math.neg [] int32 int32,- prim2 _math_range Math.range [] int32 int32 (list int32),- prim2 _math_rem Math.rem [] int32 int32 int32,- prim2 _math_sub Math.sub [] int32 int32 int32]---- * hydra.lib.optionals primitives--_hydra_lib_optionals :: Namespace-_hydra_lib_optionals = Namespace "hydra.lib.optionals"--_optionals_apply :: Name-_optionals_apply = qname _hydra_lib_optionals "apply" :: Name-_optionals_bind = qname _hydra_lib_optionals "bind" :: Name-_optionals_cases = qname _hydra_lib_optionals "cases" :: Name-_optionals_cat = qname _hydra_lib_optionals "cat" :: Name-_optionals_compose = qname _hydra_lib_optionals "compose" :: Name-_optionals_fromJust = qname _hydra_lib_optionals "fromJust" :: Name-_optionals_fromMaybe = qname _hydra_lib_optionals "fromMaybe" :: Name-_optionals_isJust = qname _hydra_lib_optionals "isJust" :: Name-_optionals_isNothing = qname _hydra_lib_optionals "isNothing" :: Name-_optionals_map = qname _hydra_lib_optionals "map" :: Name-_optionals_mapMaybe = qname _hydra_lib_optionals "mapMaybe" :: Name-_optionals_maybe = qname _hydra_lib_optionals "maybe" :: Name-_optionals_pure = qname _hydra_lib_optionals "pure" :: Name--hydraLibOptionals :: Library-hydraLibOptionals = standardLibrary _hydra_lib_optionals [- prim2 _optionals_apply Optionals.apply ["x", "y"] (optional $ function x y) (optional x) (optional y),- prim2 _optionals_bind Optionals.bind ["x", "y"] (optional x) (function x (optional y)) (optional y),- prim3Interp _optionals_cases (Just casesInterp) ["x", "y"] (optional x) y (function x y) y,- prim1 _optionals_cat Optionals.cat ["x"] (list $ optional x) (list x),- prim2 _optionals_compose Optionals.compose ["x", "y", "z"] (function x $ optional y) (function y $ optional z) (function x $ optional z),- prim1 _optionals_fromJust Optionals.fromJust ["x"] (optional x) x,- prim2 _optionals_fromMaybe Optionals.fromMaybe ["x"] x (optional x) x,- prim1 _optionals_isJust Optionals.isJust ["x"] (optional x) boolean,- prim1 _optionals_isNothing Optionals.isNothing ["x"] (optional x) boolean,- prim2Interp _optionals_map (Just optionalsMapInterp) ["x", "y"] (function x y) (optional x) (optional y),- prim2Interp _optionals_mapMaybe Nothing ["x", "y"] (function x $ optional y) (list x) (list y),- prim3Interp _optionals_maybe (Just maybeInterp) ["x", "y"] y (function x y) (optional x) y,- prim1 _optionals_pure Optionals.pure ["x"] x (optional x)]- where- x = variable "x"- y = variable "y"- z = variable "z"---- | Interpreted implementation of hydra.lib.optionals.cases-casesInterp :: Term -> Term -> Term -> Flow Graph Term-casesInterp opt def fun = maybeInterp def fun opt---- | Interpreted implementation of hydra.lib.optionals.maybe-maybeInterp :: Term -> Term -> Term -> Flow Graph Term-maybeInterp def fun opt = do- mval <- ExtractCore.optional Prelude.pure opt- return $ case mval of- Nothing -> def- Just val -> Terms.apply fun val--optionalsMapInterp :: Term -> Term -> Flow Graph Term-optionalsMapInterp fun opt = do- mval <- ExtractCore.optional Prelude.pure opt- return $ case mval of- Nothing -> Terms.nothing- Just val -> Terms.just $ Terms.apply fun val---- * hydra.lib.sets primitives+ prim1 _math_abs Math.abs [] int32 int32,+ prim2 _math_add Math.add [] int32 int32 int32,+ prim2 _math_div Math.div [] int32 int32 int32,+ prim1 _math_even Math.even [] int32 boolean,+ prim2 _math_max Math.max [] int32 int32 int32,+ prim2 _math_min Math.min [] int32 int32 int32,+ prim2 _math_mod Math.mod [] int32 int32 int32,+ prim2 _math_mul Math.mul [] int32 int32 int32,+ prim1 _math_negate Math.negate [] int32 int32,+ prim1 _math_odd Math.odd [] int32 boolean,+ prim1 _math_pred Math.pred [] int32 int32,+ prim2 _math_range Math.range [] int32 int32 (list int32),+ prim2 _math_rem Math.rem [] int32 int32 int32,+ prim1 _math_signum Math.signum [] int32 int32,+ prim2 _math_sub Math.sub [] int32 int32 int32,+ prim1 _math_succ Math.succ [] int32 int32] -_hydra_lib_sets :: Namespace-_hydra_lib_sets = Namespace "hydra.lib.sets"+hydraLibMaybes :: Library+hydraLibMaybes = standardLibrary _hydra_lib_maybes [+ prim2 _maybes_apply Maybes.apply [_x, _y] (optional $ fun x_ y_) (optional x_) (optional y_),+ prim2 _maybes_bind Maybes.bind [_x, _y] (optional x_) (fun x_ (optional y_)) (optional y_),+ prim3 _maybes_cases Maybes.cases [_x, _y] (optional x_) y_ (fun x_ y_) y_,+ prim1 _maybes_cat Maybes.cat [_x] (list $ optional x_) (list x_),+ prim3 _maybes_compose Maybes.compose [_x, _y, _z] (fun x_ $ optional y_) (fun y_ $ optional z_) x_ (optional z_),+ prim1 _maybes_fromJust Maybes.fromJust [_x] (optional x_) x_,+ prim2 _maybes_fromMaybe Maybes.fromMaybe [_x] x_ (optional x_) x_,+ prim1 _maybes_isJust Maybes.isJust [_x] (optional x_) boolean,+ prim1 _maybes_isNothing Maybes.isNothing [_x] (optional x_) boolean,+ prim2 _maybes_map Maybes.map [_x, _y] (fun x_ y_) (optional x_) (optional y_),+ prim2 _maybes_mapMaybe Maybes.mapMaybe [_x, _y] (fun x_ $ optional y_) (list x_) (list y_),+ prim3 _maybes_maybe Maybes.maybe [_y, _x] y_ (fun x_ y_) (optional x_) y_,+ prim1 _maybes_pure Maybes.pure [_x] x_ (optional x_)] -_sets_delete = qname _hydra_lib_sets "delete" :: Name-_sets_difference = qname _hydra_lib_sets "difference" :: Name-_sets_empty = qname _hydra_lib_sets "empty" :: Name-_sets_fromList = qname _hydra_lib_sets "fromList" :: Name-_sets_insert = qname _hydra_lib_sets "insert" :: Name-_sets_intersection = qname _hydra_lib_sets "intersection" :: Name-_sets_map = qname _hydra_lib_sets "map" :: Name-_sets_member = qname _hydra_lib_sets "member" :: Name-_sets_null = qname _hydra_lib_sets "null" :: Name-_sets_singleton = qname _hydra_lib_sets "singleton" :: Name-_sets_size = qname _hydra_lib_sets "size" :: Name-_sets_toList = qname _hydra_lib_sets "toList" :: Name-_sets_union = qname _hydra_lib_sets "union" :: Name-_sets_unions = qname _hydra_lib_sets "unions" :: Name+hydraLibPairs :: Library+hydraLibPairs = standardLibrary _hydra_lib_pairs [+ prim3 _pairs_bimap Pairs.bimap [_a, _b, _c, _d] (fun a_ c_) (fun b_ d_) (pair a_ b_) (pair c_ d_),+ prim1 _pairs_first Pairs.first [_a, _b] (pair a_ b_) a_,+ prim1 _pairs_second Pairs.second [_a, _b] (pair a_ b_) b_] hydraLibSets :: Library hydraLibSets = standardLibrary _hydra_lib_sets [- prim2 _sets_delete Sets.delete ["x"] x (set x) (set x),- prim2 _sets_difference Sets.difference ["x"] (set x) (set x) (set x),- prim0 _sets_empty Sets.empty ["x"] (set x),- prim1 _sets_fromList Sets.fromList ["x"] (list x) (set x),- prim2 _sets_insert Sets.insert ["x"] x (set x) (set x),- prim2 _sets_intersection Sets.intersection ["x"] (set x) (set x) (set x),- prim2 _sets_map Sets.map ["x", "y"] (function x y) (set x) (set y),- prim2 _sets_member Sets.member ["x"] x (set x) boolean,- prim1 _sets_null Sets.null ["x"] (set x) boolean,- prim1 _sets_singleton Sets.singleton ["x"] x (set x),- prim1 _sets_size Sets.size ["x"] (set x) int32,- prim1 _sets_toList Sets.toList ["x"] (set x) (list x),- prim2 _sets_union Sets.union ["x"] (set x) (set x) (set x),- prim1 _sets_unions Sets.unions ["x"] (list $ set x) (set x)]- where- x = variable "x"- y = variable "y"---- * hydra.lib.strings primitives--_hydra_lib_strings :: Namespace-_hydra_lib_strings = Namespace "hydra.lib.strings"--_strings_cat = qname _hydra_lib_strings "cat" :: Name-_strings_cat2 = qname _hydra_lib_strings "cat2" :: Name-_strings_charAt = qname _hydra_lib_strings "charAt" :: Name-_strings_fromList = qname _hydra_lib_strings "fromList" :: Name-_strings_intercalate = qname _hydra_lib_strings "intercalate" :: Name-_strings_null = qname _hydra_lib_strings "null" :: Name-_strings_length = qname _hydra_lib_strings "length" :: Name-_strings_lines = qname _hydra_lib_strings "lines" :: Name-_strings_splitOn = qname _hydra_lib_strings "splitOn" :: Name-_strings_toList = qname _hydra_lib_strings "toList" :: Name-_strings_toLower = qname _hydra_lib_strings "toLower" :: Name-_strings_toUpper = qname _hydra_lib_strings "toUpper" :: Name-_strings_unlines = qname _hydra_lib_strings "unlines" :: Name+ prim2 _sets_delete Sets.delete [_xOrd] x_ (set x_) (set x_),+ prim2 _sets_difference Sets.difference [_xOrd] (set x_) (set x_) (set x_),+ prim0 _sets_empty Sets.empty [_xOrd] (set x_),+ prim1 _sets_fromList Sets.fromList [_xOrd] (list x_) (set x_),+ prim2 _sets_insert Sets.insert [_xOrd] x_ (set x_) (set x_),+ prim2 _sets_intersection Sets.intersection [_xOrd] (set x_) (set x_) (set x_),+ prim2 _sets_map Sets.map [_xOrd, _yOrd] (fun x_ y_) (set x_) (set y_),+ prim2 _sets_member Sets.member [_xOrd] x_ (set x_) boolean,+ prim1 _sets_null Sets.null [_xOrd] (set x_) boolean,+ prim1 _sets_singleton Sets.singleton [_xOrd] x_ (set x_),+ prim1 _sets_size Sets.size [_xOrd] (set x_) int32,+ prim1 _sets_toList Sets.toList [_xOrd] (set x_) (list x_),+ prim2 _sets_union Sets.union [_xOrd] (set x_) (set x_) (set x_),+ prim1 _sets_unions Sets.unions [_xOrd] (list $ set x_) (set x_)] hydraLibStrings :: Library hydraLibStrings = standardLibrary _hydra_lib_strings [
+ src/main/haskell/Hydra/Sources/Test/All.hs view
@@ -0,0 +1,23 @@+-- | Aggregates all Hydra test source modules++module Hydra.Sources.Test.All where++import Hydra.Kernel++import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestSuite as TestSuite+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+++-- | All test modules (including test suite modules that TestSuite depends on)+testModules :: [Module]+testModules = baseTestModules ++ TestSuite.testSuiteModules++-- | Base test modules (TestGraph, TestTerms, TestTypes, TestSuite)+baseTestModules :: [Module]+baseTestModules = [+ TestGraph.module_,+ TestTerms.module_,+ TestTypes.module_,+ TestSuite.module_]
+ src/main/haskell/Hydra/Sources/Test/Annotations.hs view
@@ -0,0 +1,261 @@+-- | Test cases for hydra.annotations functions+module Hydra.Sources.Test.Annotations where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Sources.Kernel.Terms.Annotations as Annotations+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+++-- | Test trace for Flow-based tests+testTrace :: TTerm Term+testTrace = metaref Monads.emptyTrace++-- | Test state for Flow-based tests (using Graph as the state type, since+-- functions like getTermDescription return Flow Graph ...)+-- Note: the type is TTerm Term because at the meta level, everything is a Term+testState :: TTerm Term+testState = metaref Lexical.emptyGraph+++ns :: Namespace+ns = Namespace "hydra.test.annotations"++module_ :: Module+module_ = Module ns elements [Annotations.ns, Lexical.ns] [] $+ Just "Test cases for hydra.annotations functions"+ where+ elements = [Phantoms.toBinding allTests]+++-- | Test cases for getTermAnnotation and setTermAnnotation+arbitraryAnnotationTests :: TTerm TestGroup+arbitraryAnnotationTests = subgroup "arbitrary annotations" [+ -- Set a single key/value pair (multiple cases for property test coverage)+ -- Note: These tests require interpretation because setTermAnnotation uses maps.alter which has no interpreter impl+ evalCase "set single annotation #1"+ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ int32Term 42) @@ stringTerm "foo")+ (annotatedTerm (stringTerm "foo") $ Terms.map $ Maps.singleton (nameTerm "k1") (int32Term 42)),+ evalCase "set single annotation #2"+ (metaref Annotations.setTermAnnotation @@ nameTerm "myKey" @@ (optional $ just $ int32Term (-17)) @@ stringTerm "bar")+ (annotatedTerm (stringTerm "bar") $ Terms.map $ Maps.singleton (nameTerm "myKey") (int32Term (-17))),+ evalCase "set single annotation #3"+ (metaref Annotations.setTermAnnotation @@ nameTerm "x" @@ (optional $ just $ stringTerm "hello") @@ int32Term 0)+ (annotatedTerm (int32Term 0) $ Terms.map $ Maps.singleton (nameTerm "x") (stringTerm "hello")),++ -- Retrieve a single value (multiple cases)+ -- Note: These tests require the interpreter because getTermAnnotation uses pattern matching on Term+ evalCaseWithTags "get existing annotation #1" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "k1"+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "value") @@ int32Term 42))+ (optional $ just $ stringTerm "value"),+ evalCaseWithTags "get existing annotation #2" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "foo"+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "foo" @@ (optional $ just $ stringTerm "") @@ int32Term 99))+ (optional $ just $ stringTerm ""),+ evalCaseWithTags "get existing annotation #3" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "key"+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "key" @@ (optional $ just $ int32Term 123) @@ stringTerm "test"))+ (optional $ just $ int32Term 123),++ -- Retrieve a null value (annotation not present) - multiple cases+ evalCaseWithTags "get missing annotation #1" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "k1" @@ int16Term 42)+ (optional nothing),+ evalCaseWithTags "get missing annotation #2" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "nonexistent" @@ stringTerm "hello")+ (optional nothing),+ evalCaseWithTags "get missing annotation #3" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "k1"+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k2" @@ (optional $ just $ int32Term 1) @@ int32Term 42))+ (optional nothing),++ -- Set multiple values (multiple cases)+ evalCase "set multiple annotations #1"+ (metaref Annotations.setTermAnnotation @@ nameTerm "k2" @@ (optional $ just $ int32Term 200)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "first") @@ booleanTerm True))+ (annotatedTerm (booleanTerm True) $ Terms.map $ Maps.fromList $ Phantoms.list [+ Phantoms.pair (nameTerm "k1") (stringTerm "first"),+ Phantoms.pair (nameTerm "k2") (int32Term 200)]),+ evalCase "set multiple annotations #2"+ (metaref Annotations.setTermAnnotation @@ nameTerm "b" @@ (optional $ just $ int32Term 0)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "a" @@ (optional $ just $ int32Term (-5)) @@ stringTerm "test"))+ (annotatedTerm (stringTerm "test") $ Terms.map $ Maps.fromList $ Phantoms.list [+ Phantoms.pair (nameTerm "a") (int32Term (-5)),+ Phantoms.pair (nameTerm "b") (int32Term 0)]),++ -- An outer annotation overrides an inner one (multiple cases)+ evalCase "outer annotation overrides inner #1"+ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "outer")+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "inner") @@ stringTerm "bar"))+ (annotatedTerm (stringTerm "bar") $ Terms.map $ Maps.singleton (nameTerm "k1") (stringTerm "outer")),+ evalCase "outer annotation overrides inner #2"+ (metaref Annotations.setTermAnnotation @@ nameTerm "x" @@ (optional $ just $ stringTerm "new")+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "x" @@ (optional $ just $ stringTerm "old") @@ int32Term 42))+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "x") (stringTerm "new")),+ evalCase "outer annotation overrides inner #3"+ (metaref Annotations.setTermAnnotation @@ nameTerm "key" @@ (optional $ just $ int32Term 999)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "key" @@ (optional $ just $ int32Term 1) @@ booleanTerm False))+ (annotatedTerm (booleanTerm False) $ Terms.map $ Maps.singleton (nameTerm "key") (int32Term 999)),++ -- Unset a single annotation (multiple cases)+ evalCase "unset single annotation #1"+ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional nothing)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "foo") @@ int64Term 137))+ (int64Term 137),+ evalCase "unset single annotation #2"+ (metaref Annotations.setTermAnnotation @@ nameTerm "x" @@ (optional nothing)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "x" @@ (optional $ just $ int32Term 42) @@ stringTerm "test"))+ (stringTerm "test"),++ -- Unset one of multiple annotations (multiple cases)+ evalCase "unset one of multiple annotations #1"+ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional nothing)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k2" @@ (optional $ just $ int32Term 200)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "k1" @@ (optional $ just $ stringTerm "first") @@ int64Term 137)))+ (annotatedTerm (int64Term 137) $ Terms.map $ Maps.singleton (nameTerm "k2") (int32Term 200)),+ evalCase "unset one of multiple annotations #2"+ (metaref Annotations.setTermAnnotation @@ nameTerm "b" @@ (optional nothing)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "b" @@ (optional $ just $ int32Term 2)+ @@ (metaref Annotations.setTermAnnotation @@ nameTerm "a" @@ (optional $ just $ int32Term 1) @@ stringTerm "x")))+ (annotatedTerm (stringTerm "x") $ Terms.map $ Maps.singleton (nameTerm "a") (int32Term 1))]++-- | Test cases for getTermDescription and setTermDescription+descriptionTests :: TTerm TestGroup+descriptionTests = subgroup "descriptions" [+ -- Set a single description (multiple cases)+ -- Note: These tests require interpretation because setTermDescription uses maps.alter which has no interpreter impl+ evalCase "set description #1"+ (metaref Annotations.setTermDescription @@ (optional $ just $ string "my description") @@ stringTerm "foo")+ (annotatedTerm (stringTerm "foo") $ Terms.map $ Maps.singleton (nameTerm "description") (stringTerm "my description")),+ evalCase "set description #2"+ (metaref Annotations.setTermDescription @@ (optional $ just $ string "") @@ int32Term 42)+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "description") (stringTerm "")),+ evalCase "set description #3"+ (metaref Annotations.setTermDescription @@ (optional $ just $ string "A longer description with spaces") @@ booleanTerm True)+ (annotatedTerm (booleanTerm True) $ Terms.map $ Maps.singleton (nameTerm "description") (stringTerm "A longer description with spaces")),++ -- Get existing description (returns Flow Graph (Maybe String))+ -- Note: These tests require the interpreter because getTermDescription uses Flow and pattern matching+ evalCaseWithTags "get existing description #1" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "hello") @@ int32Term 42))+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional $ just $ string "hello")) testState testTrace),+ evalCaseWithTags "get existing description #2" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "") @@ stringTerm "test"))+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional $ just $ string "")) testState testTrace),+ evalCaseWithTags "get existing description #3" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "desc") @@ booleanTerm False))+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional $ just $ string "desc")) testState testTrace),++ -- Get missing description (no description annotation present)+ evalCaseWithTags "get missing description #1" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription @@ int16Term 42)+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional nothing)) testState testTrace),+ evalCaseWithTags "get missing description #2" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription @@ stringTerm "no description here")+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional nothing)) testState testTrace),+ evalCaseWithTags "get missing description #3" [tag_requiresFlowDecoding]+ (unFlowTerm @@ (metaref Annotations.getTermDescription @@ int32Term 0)+ @@ testState @@ testTrace)+ (flowStateTerm (optional $ just $ (optional nothing)) testState testTrace),++ -- An outer description overrides an inner one (multiple cases)+ evalCase "outer description overrides inner #1"+ (metaref Annotations.setTermDescription @@ (optional $ just $ string "outer")+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "inner") @@ stringTerm "bar"))+ (annotatedTerm (stringTerm "bar") $ Terms.map $ Maps.singleton (nameTerm "description") (stringTerm "outer")),+ evalCase "outer description overrides inner #2"+ (metaref Annotations.setTermDescription @@ (optional $ just $ string "new")+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "old") @@ int32Term 99))+ (annotatedTerm (int32Term 99) $ Terms.map $ Maps.singleton (nameTerm "description") (stringTerm "new")),++ -- Unset a description (multiple cases)+ evalCase "unset description #1"+ (metaref Annotations.setTermDescription @@ (optional nothing)+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "desc") @@ int64Term 137))+ (int64Term 137),+ evalCase "unset description #2"+ (metaref Annotations.setTermDescription @@ (optional nothing)+ @@ (metaref Annotations.setTermDescription @@ (optional $ just $ string "to be removed") @@ stringTerm "test"))+ (stringTerm "test")]++-- | Test cases for layered (non-compact) annotations+-- Note: These tests require interpretation because they call getTermAnnotation which is not a primitive+layeredAnnotationTests :: TTerm TestGroup+layeredAnnotationTests = subgroup "layered annotations" [+ -- Annotations at different levels, with different keys, are all available+ evalCaseWithTags "get annotation from unannotated term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "one" @@ int32Term 42)+ (optional nothing),++ evalCaseWithTags "get annotation from singly annotated term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "one"+ @@ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 1)))+ (optional $ just $ int32Term 1),++ evalCaseWithTags "get inner annotation from doubly annotated term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "one"+ @@ (annotatedTerm+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 1))+ $ Terms.map $ Maps.singleton (nameTerm "two") (int32Term 2)))+ (optional $ just $ int32Term 1),++ evalCaseWithTags "get outer annotation from doubly annotated term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "two"+ @@ (annotatedTerm+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 1))+ $ Terms.map $ Maps.singleton (nameTerm "two") (int32Term 2)))+ (optional $ just $ int32Term 2),++ -- Non-overridden annotation still accessible in triply annotated term+ evalCaseWithTags "get non-overridden annotation from triply annotated term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "two"+ @@ (annotatedTerm+ (annotatedTerm+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 1))+ $ Terms.map $ Maps.singleton (nameTerm "two") (int32Term 2))+ $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 99)))+ (optional $ just $ int32Term 2),++ -- Outer annotations override inner ones+ evalCaseWithTags "outer annotation overrides inner in layered term" [tag_requiresFlowDecoding]+ (metaref Annotations.getTermAnnotation @@ nameTerm "one"+ @@ (annotatedTerm+ (annotatedTerm+ (annotatedTerm (int32Term 42) $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 1))+ $ Terms.map $ Maps.singleton (nameTerm "two") (int32Term 2))+ $ Terms.map $ Maps.singleton (nameTerm "one") (int32Term 99)))+ (optional $ just $ int32Term 99)]++allTests :: TBinding TestGroup+allTests = Phantoms.definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.annotations functions" $+ supergroup "annotations" [+ arbitraryAnnotationTests,+ descriptionTests,+ layeredAnnotationTests]
+ src/main/haskell/Hydra/Sources/Test/Checking/Advanced.hs view
@@ -0,0 +1,190 @@++-- | Advanced type checking test cases: annotated terms and flows+module Hydra.Sources.Test.Checking.Advanced where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.test.checking.advanced"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Advanced type checking test cases: annotated terms and flows")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding annotatedTermsTests,+ Phantoms.toBinding topLevelAnnotationsTests,+ Phantoms.toBinding nestedAnnotationsTests,+ Phantoms.toBinding annotationsInComplexContextsTests,+ Phantoms.toBinding flowsTests,+ Phantoms.toBinding flowsWithFailureAcrossLetBindingsTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Advanced type checking test cases" $+ supergroup "Advanced" [+ annotatedTermsTests,+ flowsTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Annotated terms ------++annotatedTermsTests :: TBinding TestGroup+annotatedTermsTests = define "annotatedTermsTests" $+ supergroup "Annotated terms" [+ topLevelAnnotationsTests,+ nestedAnnotationsTests,+ annotationsInComplexContextsTests]++topLevelAnnotationsTests :: TBinding TestGroup+topLevelAnnotationsTests = define "topLevelAnnotationsTests" $+ subgroup "Top-level annotations" [+ noChange "annotated literal"+ (annotated (int32 42) mapTermEmpty)+ T.int32,+ noChange "annotated list"+ (annotated (list [string "a", string "b"]) mapTermEmpty)+ (T.list T.string),+ noChange "annotated record"+ (annotated (record TestTypes.testTypePersonName [+ "firstName">: string "John",+ "lastName">: string "Doe",+ "age">: int32 25]) mapTermEmpty)+ (Core.typeVariable TestTypes.testTypePersonName),+ checkTest "annotated lambda" []+ (annotated (lambda "x" $ var "x") mapTermEmpty)+ (annotated (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x") mapTermEmpty)+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0"))]++nestedAnnotationsTests :: TBinding TestGroup+nestedAnnotationsTests = define "nestedAnnotationsTests" $+ subgroup "Nested annotations" [+ noChange "annotation within annotation"+ (annotated (annotated (int32 100) mapTermEmpty) mapTermEmpty)+ T.int32,+ checkTest "annotated terms in tuple" []+ (tuple [annotated (int32 1) mapTermEmpty,+ annotated (string "hello") mapTermEmpty])+ (tyapps (pair (annotated (int32 1) mapTermEmpty) (annotated (string "hello") mapTermEmpty)) [T.int32, T.string])+ (T.pair T.int32 T.string),+ checkTest "annotated term in function application" []+ (annotated (lambda "x" $ var "x") mapTermEmpty @@ annotated (int32 42) mapTermEmpty)+ (annotated (lambdaTyped "x" T.int32 $ var "x") mapTermEmpty @@ annotated (int32 42) mapTermEmpty)+ T.int32]++annotationsInComplexContextsTests :: TBinding TestGroup+annotationsInComplexContextsTests = define "annotationsInComplexContextsTests" $+ subgroup "Annotations in complex contexts" [+ checkTest "annotated let binding" []+ (lets ["x">: annotated (int32 5) mapTermEmpty,+ "y">: annotated (string "world") mapTermEmpty] $+ annotated (tuple [var "x", var "y"]) mapTermEmpty)+ (letsTyped [("x", annotated (int32 5) mapTermEmpty, T.mono T.int32),+ ("y", annotated (string "world") mapTermEmpty, T.mono T.string)] $+ annotated (tyapps (pair (var "x") (var "y")) [T.int32, T.string]) mapTermEmpty)+ (T.pair T.int32 T.string),+ noChange "annotated record fields"+ (record TestTypes.testTypePersonName [+ "firstName">: annotated (string "Alice") mapTermEmpty,+ "lastName">: annotated (string "Smith") mapTermEmpty,+ "age">: annotated (int32 30) mapTermEmpty])+ (Core.typeVariable TestTypes.testTypePersonName),+ checkTest "annotated function in application" []+ (lets ["add">: annotated (primitive _math_add) mapTermEmpty] $+ var "add" @@ annotated (int32 10) mapTermEmpty @@ annotated (int32 20) mapTermEmpty)+ (letsTyped [("add", annotated (primitive _math_add) mapTermEmpty, T.mono $ T.function T.int32 (T.function T.int32 T.int32))] $+ var "add" @@ (annotated (int32 10) mapTermEmpty) @@ (annotated (int32 20) mapTermEmpty))+ T.int32]++-- expectTermWithType "annotated function in application"+-- (lets ["add">: annotated (primitive _math_add) M.empty] $+-- var "add" @@ annotated (int32 10) M.empty @@ annotated (int32 20) M.empty)+-- (letsTyped [("add", annotated (primitive _math_add) M.empty, Types.mono $ Types.function Types.int32 (Types.function Types.int32 Types.int32))] $+-- var "add" @@ annotated (int32 10) M.empty @@ annotated (int32 20) M.empty)+-- Types.int32++------ Flows ------++flowsTests :: TBinding TestGroup+flowsTests = define "flowsTests" $+ supergroup "Flows" [+ flowsWithFailureAcrossLetBindingsTests]++flowsWithFailureAcrossLetBindingsTests :: TBinding TestGroup+flowsWithFailureAcrossLetBindingsTests = define "flowsWithFailureAcrossLetBindingsTests" $+ subgroup "Flows with failure across let bindings" [+ checkTest "mutually referential failure functions with Flow monad" [tag_disabledForPython] -- Very slow in Python (47+ seconds)+ (lets ["conditionalUnexpected">: lambda "s" $ lambda "b" $ lambda "ignored" $+ primitive _logic_ifElse @@ var "b" @@+ (var "unexpected" @@ string "oops") @@+ (var "unexpected" @@ var "s"),+ "unexpected">: lambda "s" $ primitive _flows_fail @@ var "s"] $+ var "conditionalUnexpected")+ (tylams ["t0", "t1", "t2"] $+ letsTyped [+ ("conditionalUnexpected",+ tylams ["t3", "t4", "t5"] $+ lambdaTyped "s" T.string $+ lambdaTyped "b" T.boolean $+ lambdaTyped "ignored" (T.var "t3") $+ tyapp (primitive _logic_ifElse) (T.applys (Core.typeVariable $ name "hydra.compute.Flow") [T.var "t4", T.var "t5"]) @@ var "b" @@+ (tyapps (var "unexpected") [T.var "t4", T.var "t5"] @@ string "oops") @@+ (tyapps (var "unexpected") [T.var "t4", T.var "t5"] @@ var "s"),+ T.poly ["t3", "t4", "t5"] $+ T.function T.string $+ T.function T.boolean $+ T.function (T.var "t3") $+ T.applys (Core.typeVariable $ name "hydra.compute.Flow") [T.var "t4", T.var "t5"]),+ ("unexpected",+ tylams ["t3", "t4"] $+ lambdaTyped "s" T.string $+ tyapps (primitive _flows_fail) [T.var "t3", T.var "t4"] @@ var "s",+ T.poly ["t3", "t4"] $+ T.function T.string $+ T.applys (Core.typeVariable $ name "hydra.compute.Flow") [T.var "t3", T.var "t4"])] $+ tyapps (var "conditionalUnexpected") [T.var "t0", T.var "t1", T.var "t2"])+ (T.forAlls ["t0", "t1", "t2"] $+ T.function T.string $+ T.function T.boolean $+ T.function (T.var "t0") $+ T.applys (Core.typeVariable $ name "hydra.compute.Flow") [T.var "t1", T.var "t2"])]
+ src/main/haskell/Hydra/Sources/Test/Checking/AlgebraicTypes.hs view
@@ -0,0 +1,425 @@++-- | Algebraic type checking test cases: unit, pairs, eithers, optionals+module Hydra.Sources.Test.Checking.AlgebraicTypes where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.test.checking.algebraicTypes"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Algebraic type checking test cases: unit, pairs, eithers, optionals")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding unitTests,+ Phantoms.toBinding unitTermTests,+ Phantoms.toBinding unitTermInPolymorphicContextTests,+ Phantoms.toBinding pairsTests,+ Phantoms.toBinding basicPairsTests,+ Phantoms.toBinding polymorphicPairsTests,+ Phantoms.toBinding pairsInComplexContextsTests,+ Phantoms.toBinding nestedPairsTests,+ Phantoms.toBinding pairsWithComplexTypesTests,+ Phantoms.toBinding eithersTests,+ Phantoms.toBinding leftValuesTests,+ Phantoms.toBinding rightValuesTests,+ Phantoms.toBinding polymorphicEithersTests,+ Phantoms.toBinding eithersInComplexContextsTests,+ Phantoms.toBinding nestedEithersTests,+ Phantoms.toBinding eithersWithComplexTypesTests,+ Phantoms.toBinding optionalsTests,+ Phantoms.toBinding monomorphicOptionalsTests,+ Phantoms.toBinding polymorphicOptionalsTests,+ Phantoms.toBinding optionalsInComplexContextsTests,+ Phantoms.toBinding nestedOptionalsTests,+ Phantoms.toBinding optionalsWithComplexTypesTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ supergroup "Algebraic types" [+ unitTests,+ pairsTests,+ eithersTests,+ optionalsTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Unit ------++unitTests :: TBinding TestGroup+unitTests = define "unitTests" $+ supergroup "Unit" [+ unitTermTests,+ unitTermInPolymorphicContextTests]++unitTermTests :: TBinding TestGroup+unitTermTests = define "unitTermTests" $+ subgroup "Unit term" [+ noChange "unit literal"+ unit+ T.unit]++unitTermInPolymorphicContextTests :: TBinding TestGroup+unitTermInPolymorphicContextTests = define "unitTermInPolymorphicContextTests" $+ subgroup "Unit term in polymorphic context" [+ checkTest "unit from lambda" []+ (lambda "x" unit)+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") unit)+ (T.forAlls ["t0"] $ T.function (T.var "t0") T.unit)]++------ Pairs ------++pairsTests :: TBinding TestGroup+pairsTests = define "pairsTests" $+ supergroup "Pairs" [+ basicPairsTests,+ polymorphicPairsTests,+ pairsInComplexContextsTests,+ nestedPairsTests,+ pairsWithComplexTypesTests]++basicPairsTests :: TBinding TestGroup+basicPairsTests = define "basicPairsTests" $+ subgroup "Basic pairs" [+ checkTest "pair of int and string" []+ (pair (int32 42) (string "hello"))+ (tyapps (pair (int32 42) (string "hello")) [T.int32, T.string])+ (T.pair T.int32 T.string),+ checkTest "pair of string and boolean" []+ (pair (string "test") (boolean True))+ (tyapps (pair (string "test") (boolean True)) [T.string, T.boolean])+ (T.pair T.string T.boolean),+ checkTest "pair of boolean and int" []+ (pair (boolean False) (int32 100))+ (tyapps (pair (boolean False) (int32 100)) [T.boolean, T.int32])+ (T.pair T.boolean T.int32)]++polymorphicPairsTests :: TBinding TestGroup+polymorphicPairsTests = define "polymorphicPairsTests" $+ subgroup "Polymorphic pairs" [+ checkTest "pair from lambda (first element)" []+ (lambda "x" $ pair (var "x") (string "constant"))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapps (pair (var "x") (string "constant")) [T.var "t0", T.string])+ (T.forAll "t0" $ T.function (T.var "t0") (T.pair (T.var "t0") T.string)),+ checkTest "pair from lambda (second element)" []+ (lambda "x" $ pair (string "constant") (var "x"))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapps (pair (string "constant") (var "x")) [T.string, T.var "t0"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.pair T.string (T.var "t0"))),+ checkTest "pair from two lambdas" []+ (lambda "x" $ lambda "y" $ pair (var "x") (var "y"))+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ tyapps (pair (var "x") (var "y")) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.pair (T.var "t0") (T.var "t1")))),+ checkTest "pair with repeated variable" []+ (lambda "x" $ pair (var "x") (var "x"))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapps (pair (var "x") (var "x")) [T.var "t0", T.var "t0"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t0")))]++pairsInComplexContextsTests :: TBinding TestGroup+pairsInComplexContextsTests = define "pairsInComplexContextsTests" $+ subgroup "Pairs in complex contexts" [+ checkTest "pair in list" []+ (list [pair (int32 1) (string "one"), pair (int32 2) (string "two")])+ (list [tyapps (pair (int32 1) (string "one")) [T.int32, T.string], tyapps (pair (int32 2) (string "two")) [T.int32, T.string]])+ (T.list $ T.pair T.int32 T.string),+ checkTest "pair in let binding" []+ (lets ["result" >: pair (int32 42) (string "answer")] $+ var "result")+ (letsTyped [("result", tyapps (pair (int32 42) (string "answer")) [T.int32, T.string], T.mono $ T.pair T.int32 T.string)] $+ var "result")+ (T.pair T.int32 T.string)]++nestedPairsTests :: TBinding TestGroup+nestedPairsTests = define "nestedPairsTests" $+ subgroup "Nested pairs" [+ checkTest "pair of pairs" []+ (pair (pair (int32 1) (string "one")) (pair (boolean True) (int32 2)))+ (tyapps (pair (tyapps (pair (int32 1) (string "one")) [T.int32, T.string]) (tyapps (pair (boolean True) (int32 2)) [T.boolean, T.int32])) [T.pair T.int32 T.string, T.pair T.boolean T.int32])+ (T.pair (T.pair T.int32 T.string) (T.pair T.boolean T.int32)),+ checkTest "pair with list" []+ (pair (list [int32 1, int32 2]) (string "numbers"))+ (tyapps (pair (list [int32 1, int32 2]) (string "numbers")) [T.list T.int32, T.string])+ (T.pair (T.list T.int32) T.string),+ checkTest "list of pairs" []+ (list [pair (int32 1) (string "a"), pair (int32 2) (string "b")])+ (list [tyapps (pair (int32 1) (string "a")) [T.int32, T.string], tyapps (pair (int32 2) (string "b")) [T.int32, T.string]])+ (T.list $ T.pair T.int32 T.string)]++personRecord :: String -> String -> Int -> TTerm Term+personRecord fName lName age' =+ record (name "Person") [+ "firstName" >: string fName,+ "lastName" >: string lName,+ "age" >: int32 age']++pairsWithComplexTypesTests :: TBinding TestGroup+pairsWithComplexTypesTests = define "pairsWithComplexTypesTests" $+ subgroup "Pairs with complex types" [+ checkTest "pair with record on first" []+ (pair (personRecord "Alice" "Smith" 30) (int32 1))+ (tyapps (pair (personRecord "Alice" "Smith" 30) (int32 1)) [T.var "Person", T.int32])+ (T.pair (T.var "Person") T.int32),+ checkTest "pair with record on second" []+ (pair (string "name") (personRecord "Bob" "Jones" 25))+ (tyapps (pair (string "name") (personRecord "Bob" "Jones" 25)) [T.string, T.var "Person"])+ (T.pair T.string (T.var "Person"))]++------ Eithers ------++eithersTests :: TBinding TestGroup+eithersTests = define "eithersTests" $+ supergroup "Eithers" [+ leftValuesTests,+ rightValuesTests,+ polymorphicEithersTests,+ eithersInComplexContextsTests,+ nestedEithersTests,+ eithersWithComplexTypesTests]++leftValuesTests :: TBinding TestGroup+leftValuesTests = define "leftValuesTests" $+ subgroup "Left values" [+ checkTest "left int" []+ (left $ int32 42)+ (tylam "t0" $ tyapps (left $ int32 42) [T.int32, T.var "t0"])+ (T.forAlls ["t0"] $ T.either_ T.int32 (T.var "t0")),+ checkTest "left string" []+ (left $ string "error")+ (tylam "t0" $ tyapps (left $ string "error") [T.string, T.var "t0"])+ (T.forAlls ["t0"] $ T.either_ T.string (T.var "t0")),+ checkTest "left boolean" []+ (left $ boolean False)+ (tylam "t0" $ tyapps (left $ boolean False) [T.boolean, T.var "t0"])+ (T.forAlls ["t0"] $ T.either_ T.boolean (T.var "t0"))]++rightValuesTests :: TBinding TestGroup+rightValuesTests = define "rightValuesTests" $+ subgroup "Right values" [+ checkTest "right int" []+ (right $ int32 42)+ (tylam "t0" $ tyapps (right $ int32 42) [T.var "t0", T.int32])+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") T.int32),+ checkTest "right string" []+ (right $ string "success")+ (tylam "t0" $ tyapps (right $ string "success") [T.var "t0", T.string])+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") T.string),+ checkTest "right boolean" []+ (right $ boolean True)+ (tylam "t0" $ tyapps (right $ boolean True) [T.var "t0", T.boolean])+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") T.boolean)]++polymorphicEithersTests :: TBinding TestGroup+polymorphicEithersTests = define "polymorphicEithersTests" $+ subgroup "Polymorphic eithers" [+ checkTest "left from lambda" []+ (lambda "x" $ left $ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ tyapps (left $ var "x") [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.either_ (T.var "t0") (T.var "t1"))),+ checkTest "right from lambda" []+ (lambda "x" $ right $ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ tyapps (right $ var "x") [T.var "t1", T.var "t0"])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.either_ (T.var "t1") (T.var "t0"))),+ checkTest "either from two lambdas" []+ (lambda "flag" $ lambda "x" $+ primitive _logic_ifElse @@ var "flag" @@+ (left $ var "x") @@+ (right $ var "x"))+ (tylam "t0" $ lambdaTyped "flag" T.boolean $ lambdaTyped "x" (T.var "t0") $+ tyapp (primitive _logic_ifElse) (T.either_ (T.var "t0") (T.var "t0")) @@ var "flag" @@+ tyapps (left $ var "x") [T.var "t0", T.var "t0"] @@+ tyapps (right $ var "x") [T.var "t0", T.var "t0"])+ (T.forAlls ["t0"] $ T.function T.boolean (T.function (T.var "t0") (T.either_ (T.var "t0") (T.var "t0"))))]++eithersInComplexContextsTests :: TBinding TestGroup+eithersInComplexContextsTests = define "eithersInComplexContextsTests" $+ subgroup "Eithers in complex contexts" [+ checkTest "either in list" []+ (list [left $ string "error", right $ int32 42])+ (list [tyapps (left $ string "error") [T.string, T.int32], tyapps (right $ int32 42) [T.string, T.int32]])+ (T.list $ T.either_ T.string T.int32),+ checkTest "either in let binding" []+ (lets ["result">: right $ int32 42] $+ var "result")+ (tylam "t0" $ letsTyped [("result", tylam "t1" $ tyapps (right $ int32 42) [T.var "t1", T.int32], T.poly ["t1"] $ T.either_ (T.var "t1") T.int32)] $+ tyapp (var "result") (T.var "t0"))+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") T.int32)]++nestedEithersTests :: TBinding TestGroup+nestedEithersTests = define "nestedEithersTests" $+ subgroup "Nested eithers" [+ checkTest "either of either (left left)" []+ (left $ left $ int32 1)+ (tylams ["t0", "t1"] $ tyapps (left $ tyapps (left $ int32 1) [T.int32, T.var "t0"]) [T.either_ T.int32 (T.var "t0"), T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.either_ (T.either_ T.int32 (T.var "t0")) (T.var "t1")),+ checkTest "either of either (left right)" []+ (left $ right $ string "nested")+ (tylams ["t0", "t1"] $ tyapps (left $ tyapps (right $ string "nested") [T.var "t0", T.string]) [T.either_ (T.var "t0") T.string, T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.either_ (T.either_ (T.var "t0") T.string) (T.var "t1")),+ checkTest "either of either (right)" []+ (right $ boolean True)+ (tylam "t0" $ tyapps (right $ boolean True) [T.var "t0", T.boolean])+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") T.boolean),+ checkTest "either of list" []+ (left $ list [int32 1, int32 2])+ (tylam "t0" $ tyapps (left $ list [int32 1, int32 2]) [T.list T.int32, T.var "t0"])+ (T.forAlls ["t0"] $ T.either_ (T.list T.int32) (T.var "t0")),+ checkTest "list of eithers" []+ (list [left $ string "a", right $ int32 1, left $ string "b"])+ (list [tyapps (left $ string "a") [T.string, T.int32], tyapps (right $ int32 1) [T.string, T.int32], tyapps (left $ string "b") [T.string, T.int32]])+ (T.list $ T.either_ T.string T.int32)]++eithersWithComplexTypesTests :: TBinding TestGroup+eithersWithComplexTypesTests = define "eithersWithComplexTypesTests" $+ subgroup "Eithers with complex types" [+ checkTest "either with record on left" []+ (left $ record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 30])+ (tylam "t0" $ tyapps (left $ record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 30]) [Core.typeVariable TestTypes.testTypePersonName, T.var "t0"])+ (T.forAlls ["t0"] $ T.either_ (Core.typeVariable TestTypes.testTypePersonName) (T.var "t0")),+ checkTest "either with record on right" []+ (right $ record TestTypes.testTypePersonName [+ "firstName">: string "Bob",+ "lastName">: string "Jones",+ "age">: int32 25])+ (tylam "t0" $ tyapps (right $ record TestTypes.testTypePersonName [+ "firstName">: string "Bob",+ "lastName">: string "Jones",+ "age">: int32 25]) [T.var "t0", Core.typeVariable TestTypes.testTypePersonName])+ (T.forAlls ["t0"] $ T.either_ (T.var "t0") (Core.typeVariable TestTypes.testTypePersonName))]++------ Optionals ------++optionalsTests :: TBinding TestGroup+optionalsTests = define "optionalsTests" $+ supergroup "Optionals" [+ monomorphicOptionalsTests,+ polymorphicOptionalsTests,+ optionalsInComplexContextsTests,+ nestedOptionalsTests,+ optionalsWithComplexTypesTests]++monomorphicOptionalsTests :: TBinding TestGroup+monomorphicOptionalsTests = define "monomorphicOptionalsTests" $+ subgroup "Monomorphic optionals" [+ checkTest "nothing" []+ (optional nothing)+ (tylam "t0" $ tyapp (optional nothing) (T.var "t0"))+ (T.forAll "t0" $ T.optional $ T.var "t0"),+ noChange "just int"+ (optional $ just $ int32 42)+ (T.optional T.int32),+ noChange "just string"+ (optional $ just $ string "hello")+ (T.optional T.string),+ noChange "just boolean"+ (optional $ just $ boolean True)+ (T.optional T.boolean)]++polymorphicOptionalsTests :: TBinding TestGroup+polymorphicOptionalsTests = define "polymorphicOptionalsTests" $+ subgroup "Polymorphic optionals" [+ checkTest "optional from lambda" []+ (lambda "x" $ optional $ just $ var "x")+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ optional $ just $ var "x")+ (T.forAll "t0" $ T.function (T.var "t0") (T.optional $ T.var "t0")),+ checkTest "nothing from lambda" []+ (lambda "x" $ optional nothing)+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ tyapp (optional nothing) (T.var "t1"))+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.optional $ T.var "t1")),+ checkTest "conditional optional" []+ (lambda "x" $ lambda "flag" $+ primitive _logic_ifElse @@ var "flag" @@+ (optional $ just $ var "x") @@+ (optional nothing))+ (tylams ["t0"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "flag" T.boolean $+ tyapp (primitive _logic_ifElse) (T.optional $ T.var "t0") @@ var "flag" @@+ (optional $ just $ var "x") @@+ (tyapp (optional nothing) (T.var "t0")))+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.function T.boolean (T.optional $ T.var "t0")))]++optionalsInComplexContextsTests :: TBinding TestGroup+optionalsInComplexContextsTests = define "optionalsInComplexContextsTests" $+ subgroup "Optionals in complex contexts" [+ checkTest "optional in record" []+ (record TestTypes.testTypeBuddyListAName [+ "head">: string "first",+ "tail">: optional $ just $ record TestTypes.testTypeBuddyListBName [+ "head">: string "second",+ "tail">: optional nothing]])+ (tyapp (record TestTypes.testTypeBuddyListAName [+ "head">: string "first",+ "tail">: optional $ just $ tyapp (record TestTypes.testTypeBuddyListBName [+ "head">: string "second",+ "tail">: tyapp (optional nothing) (T.apply (Core.typeVariable TestTypes.testTypeBuddyListAName) T.string)]) T.string]) T.string)+ (T.apply (Core.typeVariable TestTypes.testTypeBuddyListAName) T.string),+ checkTest "optional in let binding" []+ (lets ["maybeValue" >: optional $ just $ int32 42] $+ var "maybeValue")+ (letsTyped [("maybeValue", optional $ just $ int32 42, T.mono $ T.optional T.int32)] $+ var "maybeValue")+ (T.optional T.int32)]++nestedOptionalsTests :: TBinding TestGroup+nestedOptionalsTests = define "nestedOptionalsTests" $+ subgroup "Nested optionals" [+ noChange "optional of optional"+ (optional $ just $ optional $ just $ string "nested")+ (T.optional $ T.optional T.string),+ noChange "optional of list"+ (optional $ just $ list [int32 1, int32 2, int32 3])+ (T.optional $ T.list T.int32),+ checkTest "list of optionals" []+ (list [optional $ just $ string "a", optional nothing, optional $ just $ string "b"])+ (list [optional $ just $ string "a", tyapp (optional nothing) T.string, optional $ just $ string "b"])+ (T.list $ T.optional T.string)]++optionalsWithComplexTypesTests :: TBinding TestGroup+optionalsWithComplexTypesTests = define "optionalsWithComplexTypesTests" $+ subgroup "Optionals with complex types" [+ noChange "optional map"+ (optional $ just $ mapTerm [(string "key", int32 42)])+ (T.optional $ T.map T.string T.int32)]
+ src/main/haskell/Hydra/Sources/Test/Checking/All.hs view
@@ -0,0 +1,51 @@++module Hydra.Sources.Test.Checking.All where++import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Sources.Kernel.Types.All+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import qualified Hydra.Sources.Test.Checking.Advanced as Advanced+import qualified Hydra.Sources.Test.Checking.AlgebraicTypes as AlgebraicTypes+import qualified Hydra.Sources.Test.Checking.Collections as Collections+import qualified Hydra.Sources.Test.Checking.Failures as Failures+import qualified Hydra.Sources.Test.Checking.Fundamentals as Fundamentals+import qualified Hydra.Sources.Test.Checking.NominalTypes as NominalTypes+++ns :: Namespace+ns = Namespace "hydra.test.checking.all"++module_ :: Module+module_ = Module ns elements namespaces kernelTypesNamespaces $+ Just "Hydra's type checking test suite"+ where+ elements = [Phantoms.toBinding allTests]+ namespaces = [+ Advanced.ns,+ AlgebraicTypes.ns,+ Collections.ns,+ Failures.ns,+ Fundamentals.ns,+ NominalTypes.ns]++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ doc "The group of all type checking tests" $+ Testing.testGroup (string "checking") nothing (list subgroups) (list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups = [+ Advanced.allTests,+ AlgebraicTypes.allTests,+ Collections.allTests,+ Failures.allTests,+ Fundamentals.allTests,+ NominalTypes.allTests]
+ src/main/haskell/Hydra/Sources/Test/Checking/Collections.hs view
@@ -0,0 +1,353 @@++-- | Collection type checking test cases: lists, sets, maps+module Hydra.Sources.Test.Checking.Collections where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.test.checking.collections"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Collection type checking test cases: lists, sets, maps")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding listsTests,+ Phantoms.toBinding listsOfLiteralsTests,+ Phantoms.toBinding emptyListsTests,+ Phantoms.toBinding polymorphicListsTests,+ Phantoms.toBinding nestedListsTests,+ Phantoms.toBinding listsInComplexContextsTests,+ Phantoms.toBinding mapsTests,+ Phantoms.toBinding monomorphicMapsTests,+ Phantoms.toBinding polymorphicMapsTests,+ Phantoms.toBinding mapsInComplexContextsTests,+ Phantoms.toBinding mapsWithComplexTypesTests,+ Phantoms.toBinding setsTests,+ Phantoms.toBinding monomorphicSetsTests,+ Phantoms.toBinding polymorphicSetsTests,+ Phantoms.toBinding setsInComplexContextsTests,+ Phantoms.toBinding nestedSetsTests,+ Phantoms.toBinding setsWithComplexTypesTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ supergroup "Collections" [+ listsTests,+ setsTests,+ mapsTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Lists ------++listsTests :: TBinding TestGroup+listsTests = define "listsTests" $+ supergroup "Lists" [+ listsOfLiteralsTests,+ emptyListsTests,+ polymorphicListsTests,+ nestedListsTests,+ listsInComplexContextsTests]++listsOfLiteralsTests :: TBinding TestGroup+listsOfLiteralsTests = define "listsOfLiteralsTests" $+ subgroup "Lists of literals" [+ noChange "int list"+ (list [int32 1, int32 2])+ (T.list T.int32),+ noChange "string list"+ (list [string "hello", string "world"])+ (T.list T.string),+ noChange "single element list"+ (list [bigint 42])+ (T.list T.bigint),+ noChange "mixed numeric types"+ (list [float32 1.0, float32 2.5, float32 3.14])+ (T.list T.float32)]++emptyListsTests :: TBinding TestGroup+emptyListsTests = define "emptyListsTests" $+ subgroup "Empty lists" [+ checkTest "empty list" []+ (list [])+ (tylam "t0" $ tyapp (list []) (T.var "t0"))+ (T.forAll "t0" $ T.list $ T.var "t0"),+ checkTest "pair of empty lists" []+ (pair (list []) (list []))+ (tylams ["t0", "t1"] $+ tyapps (pair (tyapp (list []) (T.var "t0")) (tyapp (list []) (T.var "t1"))) [T.list $ T.var "t0", T.list $ T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.pair (T.list $ T.var "t0") (T.list $ T.var "t1")),+ checkTest "empty list in tuple" []+ (tuple [list [], string "context"])+ (tylam "t0" $ tyapps (pair (tyapp (list []) (T.var "t0")) (string "context")) [T.list $ T.var "t0", T.string])+ (T.forAll "t0" $ T.pair (T.list $ T.var "t0") T.string)]++polymorphicListsTests :: TBinding TestGroup+polymorphicListsTests = define "polymorphicListsTests" $+ subgroup "Polymorphic lists" [+ checkTest "list from lambda" []+ (lambda "x" $ list [var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ list [var "x"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.list $ T.var "t0")),+ checkTest "list with repeated var" []+ (lambda "x" $ list [var "x", var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ list [var "x", var "x"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.list $ T.var "t0")),+ checkTest "list from two lambdas" []+ (lambda "x" $ lambda "y" $ list [var "x", var "y"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t0") $ list [var "x", var "y"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.function (T.var "t0") (T.list $ T.var "t0")))]++nestedListsTests :: TBinding TestGroup+nestedListsTests = define "nestedListsTests" $+ subgroup "Nested lists" [+ noChange "list of lists"+ (list [list [int32 1], list [int32 2, int32 3]])+ (T.list $ T.list T.int32),+ checkTest "empty nested lists" []+ (list [list [], list []])+ (tylam "t0" $ list [tyapp (list []) (T.var "t0"), tyapp (list []) (T.var "t0")])+ (T.forAll "t0" $ T.list $ T.list $ T.var "t0"),+ checkTest "nested polymorphic" []+ (lambda "x" $ list [list [var "x"]])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ list [list [var "x"]])+ (T.forAll "t0" $ T.function (T.var "t0") (T.list $ T.list $ T.var "t0"))]++listsInComplexContextsTests :: TBinding TestGroup+listsInComplexContextsTests = define "listsInComplexContextsTests" $+ subgroup "Lists in complex contexts" [+ checkTest "multiple lists in tuple" []+ (tuple [+ list [int32 1, int32 2],+ list [string "a", string "b"]])+ (tyapps (pair (list [int32 1, int32 2]) (list [string "a", string "b"])) [T.list T.int32, T.list T.string])+ (T.pair (T.list T.int32) (T.list T.string))]++------ Maps ------++mapsTests :: TBinding TestGroup+mapsTests = define "mapsTests" $+ supergroup "Maps" [+ monomorphicMapsTests,+ polymorphicMapsTests,+ mapsInComplexContextsTests,+ mapsWithComplexTypesTests]++monomorphicMapsTests :: TBinding TestGroup+monomorphicMapsTests = define "monomorphicMapsTests" $+ subgroup "Monomorphic maps" [+ checkTest "empty map" []+ (mapTerm [])+ (tylams ["t0", "t1"] $ tyapps (mapTerm []) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.map (T.var "t0") (T.var "t1")),+ noChange "int to string map"+ (mapTerm [(int32 1, string "one"),+ (int32 2, string "two")])+ (T.map T.int32 T.string),+ noChange "string to int map"+ (mapTerm [(string "a", int32 1),+ (string "b", int32 2)])+ (T.map T.string T.int32),+ noChange "single entry map"+ (mapTerm [(bigint 42, boolean True)])+ (T.map T.bigint T.boolean)]++polymorphicMapsTests :: TBinding TestGroup+polymorphicMapsTests = define "polymorphicMapsTests" $+ subgroup "Polymorphic maps" [+ checkTest "map from lambda keys" []+ (lambda "k" $ mapTerm [(var "k", string "value")])+ (tylam "t0" $ lambdaTyped "k" (T.var "t0") $ mapTerm [(var "k", string "value")])+ (T.forAll "t0" $ T.function (T.var "t0") (T.map (T.var "t0") T.string)),+ checkTest "map from lambda values" []+ (lambda "v" $ mapTerm [(string "key", var "v")])+ (tylam "t0" $ lambdaTyped "v" (T.var "t0") $ mapTerm [(string "key", var "v")])+ (T.forAll "t0" $ T.function (T.var "t0") (T.map T.string (T.var "t0"))),+ checkTest "map from lambda both" []+ (lambda "k" $ lambda "v" $ mapTerm [(var "k", var "v")])+ (tylams ["t0", "t1"] $ lambdaTyped "k" (T.var "t0") $ lambdaTyped "v" (T.var "t1") $ mapTerm [(var "k", var "v")])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.map (T.var "t0") (T.var "t1")))),+ checkTest "map with repeated variables" []+ (lambda "x" $ mapTerm [(var "x", var "x")])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ mapTerm [(var "x", var "x")])+ (T.forAll "t0" $ T.function (T.var "t0") (T.map (T.var "t0") (T.var "t0")))]++mapsInComplexContextsTests :: TBinding TestGroup+mapsInComplexContextsTests = define "mapsInComplexContextsTests" $+ subgroup "Maps in complex contexts" [+ checkTest "map in tuple" []+ (tuple [mapTerm [(int32 1, string "one")],+ string "context"])+ (tyapps (pair (mapTerm [(int32 1, string "one")]) (string "context")) [T.map T.int32 T.string, T.string])+ (T.pair (T.map T.int32 T.string) T.string),+ noChange "nested maps"+ (mapTerm [(string "outer", mapTerm [(int32 1, boolean True)])])+ (T.map T.string (T.map T.int32 T.boolean)),+ checkTest "map in let binding" []+ (lets ["lookup">: mapTerm [(string "key1", int32 100),+ (string "key2", int32 200)]] $+ var "lookup")+ (letsTyped [("lookup", mapTerm [(string "key1", int32 100),+ (string "key2", int32 200)],+ T.mono $ T.map T.string T.int32)] $+ var "lookup")+ (T.map T.string T.int32)]++mapsWithComplexTypesTests :: TBinding TestGroup+mapsWithComplexTypesTests = define "mapsWithComplexTypesTests" $+ subgroup "Maps with complex types" [+ noChange "map of records"+ (mapTerm [(string "person1",+ record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 25])])+ (T.map T.string (Core.typeVariable TestTypes.testTypePersonName)),+ noChange "map of lists"+ (mapTerm [(int32 1, list [string "a", string "b"]),+ (int32 2, list [string "c", string "d"])])+ (T.map T.int32 (T.list T.string)),+ checkTest "map of tuples" []+ (mapTerm [(string "coords", tuple [int32 10, int32 20])])+ (mapTerm [(string "coords", tyapps (pair (int32 10) (int32 20)) [T.int32, T.int32])])+ (T.map T.string (T.pair T.int32 T.int32))]++------ Sets ------++setsTests :: TBinding TestGroup+setsTests = define "setsTests" $+ supergroup "Sets" [+ monomorphicSetsTests,+ polymorphicSetsTests,+ setsInComplexContextsTests,+ nestedSetsTests,+ setsWithComplexTypesTests]++monomorphicSetsTests :: TBinding TestGroup+monomorphicSetsTests = define "monomorphicSetsTests" $+ subgroup "Monomorphic sets" [+ checkTest "empty set" []+ (Terms.set [])+ (tylam "t0" $ tyapp (Terms.set []) (T.var "t0"))+ (T.forAll "t0" $ T.set $ T.var "t0"),+ noChange "int set"+ (Terms.set [int32 1, int32 2, int32 3])+ (T.set T.int32),+ noChange "string set"+ (Terms.set [string "apple", string "banana", string "cherry"])+ (T.set T.string),+ noChange "single element set"+ (Terms.set [boolean True])+ (T.set T.boolean)]++polymorphicSetsTests :: TBinding TestGroup+polymorphicSetsTests = define "polymorphicSetsTests" $+ subgroup "Polymorphic sets" [+ checkTest "set from lambda" []+ (lambda "x" $ Terms.set [var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ Terms.set [var "x"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.set $ T.var "t0")),+ checkTest "set with repeated variable" []+ (lambda "x" $ Terms.set [var "x", var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ Terms.set [var "x", var "x"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.set $ T.var "t0")),+ checkTest "set from two variables" []+ (lambda "x" $ lambda "y" $ Terms.set [var "x", var "y"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t0") $ Terms.set [var "x", var "y"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.function (T.var "t0") (T.set $ T.var "t0")))]++setsInComplexContextsTests :: TBinding TestGroup+setsInComplexContextsTests = define "setsInComplexContextsTests" $+ subgroup "Sets in complex contexts" [+ checkTest "set in tuple" []+ (tuple [Terms.set [int32 1, int32 2], string "context"])+ (tyapps (pair (Terms.set [int32 1, int32 2]) (string "context")) [T.set T.int32, T.string])+ (T.pair (T.set T.int32) T.string),+ checkTest "set in let binding" []+ (lets ["numbers">: Terms.set [int32 10, int32 20, int32 30]] $+ var "numbers")+ (letsTyped [("numbers", Terms.set [int32 10, int32 20, int32 30],+ T.mono $ T.set T.int32)] $+ var "numbers")+ (T.set T.int32)]++nestedSetsTests :: TBinding TestGroup+nestedSetsTests = define "nestedSetsTests" $+ subgroup "Nested sets" [+ noChange "set of lists"+ (Terms.set [+ list [string "a", string "b"],+ list [string "c", string "d"]])+ (T.set $ T.list T.string),+ checkTest "set of tuples" []+ (Terms.set [+ tuple [int32 1, int32 2],+ tuple [int32 3, int32 4]])+ (Terms.set [+ tyapps (pair (int32 1) (int32 2)) [T.int32, T.int32],+ tyapps (pair (int32 3) (int32 4)) [T.int32, T.int32]])+ (T.set $ T.pair T.int32 T.int32),+ noChange "set of sets"+ (Terms.set [Terms.set [string "nested"]])+ (T.set $ T.set T.string)]++setsWithComplexTypesTests :: TBinding TestGroup+setsWithComplexTypesTests = define "setsWithComplexTypesTests" $+ subgroup "Sets with complex types" [+ noChange "set of records"+ (Terms.set [record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 30]])+ (T.set $ Core.typeVariable TestTypes.testTypePersonName),+ checkTest "set of optionals" []+ (Terms.set [+ optional $ just $ int32 42,+ optional nothing])+ (Terms.set [+ optional $ just $ int32 42,+ tyapp (optional nothing) T.int32])+ (T.set $ T.optional T.int32),+ noChange "set of maps"+ (Terms.set [Terms.map $ Phantoms.map $ M.singleton (string "key") (int32 42)])+ (T.set $ T.map T.string T.int32)]
+ src/main/haskell/Hydra/Sources/Test/Checking/Failures.hs view
@@ -0,0 +1,74 @@++-- | Type checking failure test cases+module Hydra.Sources.Test.Checking.Failures where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.test.checking.failures"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Type checking failure test cases")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding failOnUntypedTests,+ Phantoms.toBinding untypedLambdasTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Type checking failure test cases" $+ supergroup "Failures" [+ failOnUntypedTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Fail on untyped (pre-inference) terms ------++failOnUntypedTests :: TBinding TestGroup+failOnUntypedTests = define "failOnUntypedTests" $+ supergroup "Fail on untyped (pre-inference) terms" [+ untypedLambdasTests]++untypedLambdasTests :: TBinding TestGroup+untypedLambdasTests = define "untypedLambdasTests" $+ subgroup "Untyped lambdas" ([] :: [TTerm TestCaseWithMetadata])
+ src/main/haskell/Hydra/Sources/Test/Checking/Fundamentals.hs view
@@ -0,0 +1,910 @@++-- | Fundamental type checking test cases: literals, variables, lambdas, applications, let terms, and primitives+module Hydra.Sources.Test.Checking.Fundamentals where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as BC+++ns :: Namespace+ns = Namespace "hydra.test.checking.fundamentals"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Fundamental type checking test cases: literals, variables, lambdas, applications, let terms, and primitives")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding applicationsTests,+ Phantoms.toBinding simpleFunctionApplicationsTests,+ Phantoms.toBinding partialApplicationsTests,+ Phantoms.toBinding higherOrderApplicationsTests,+ Phantoms.toBinding polymorphicApplicationsTests,+ Phantoms.toBinding applicationsInComplexContextsTests,+ Phantoms.toBinding applicationsWithComplexArgumentsTests,+ Phantoms.toBinding lambdasTests,+ Phantoms.toBinding simpleLambdasTests,+ Phantoms.toBinding multiParameterLambdasTests,+ Phantoms.toBinding lambdasWithOperationsTests,+ Phantoms.toBinding nestedLambdasTests,+ Phantoms.toBinding lambdasInComplexContextsTests,+ Phantoms.toBinding higherOrderLambdasTests,+ Phantoms.toBinding letTermsTests,+ Phantoms.toBinding simpleLetBindingsTests,+ Phantoms.toBinding letTermsWithShadowingTests,+ Phantoms.toBinding recursiveBindingsTests,+ Phantoms.toBinding mutualRecursionTests,+ Phantoms.toBinding nestedLetTermsTests,+ Phantoms.toBinding letWithComplexExpressionsTests,+ Phantoms.toBinding literalsTests,+ Phantoms.toBinding booleanLiteralsTests,+ Phantoms.toBinding stringLiteralsTests,+ Phantoms.toBinding integerLiteralsTests,+ Phantoms.toBinding floatLiteralsTests,+-- toBinding binaryLiteralsTests, -- TODO: restore when binary literal code generation is supported+ Phantoms.toBinding literalsInComplexContextsTests,+ Phantoms.toBinding primitivesTests,+ Phantoms.toBinding nullaryPrimitivesTests,+ Phantoms.toBinding unaryPrimitivesTests,+ Phantoms.toBinding binaryPrimitivesTests,+ Phantoms.toBinding ternaryPrimitivesTests,+ Phantoms.toBinding monomorphicVsPolymorphicTests,+ Phantoms.toBinding higherOrderPrimitivesTests,+ Phantoms.toBinding primitivesInComplexContextsTests,+ Phantoms.toBinding variablesTests,+ Phantoms.toBinding simpleVariableLookupTests,+ Phantoms.toBinding variableScopingTests,+ Phantoms.toBinding polymorphicVariablesTests,+ Phantoms.toBinding variablesInComplexContextsTests,+ Phantoms.toBinding recursiveVariablesTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ supergroup "Fundamentals" [+ literalsTests,+ variablesTests,+ lambdasTests,+ applicationsTests,+ letTermsTests,+ primitivesTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Applications ------++applicationsTests :: TBinding TestGroup+applicationsTests = define "applicationsTests" $+ supergroup "Applications" [+ simpleFunctionApplicationsTests,+ partialApplicationsTests,+ higherOrderApplicationsTests,+ polymorphicApplicationsTests,+ applicationsInComplexContextsTests,+ applicationsWithComplexArgumentsTests]++simpleFunctionApplicationsTests :: TBinding TestGroup+simpleFunctionApplicationsTests = define "simpleFunctionApplicationsTests" $+ subgroup "Simple function applications" [+ checkTest "identity application" []+ (lambda "x" (var "x") @@ int32 42)+ (lambdaTyped "x" T.int32 (var "x") @@ int32 42)+ T.int32,+ noChange "primitive application"+ (primitive _math_add @@ int32 10 @@ int32 20)+ T.int32,+ noChange "string concatenation"+ (primitive _strings_cat2 @@ string "hello" @@ string "world")+ T.string]++partialApplicationsTests :: TBinding TestGroup+partialApplicationsTests = define "partialApplicationsTests" $+ subgroup "Partial applications" [+ noChange "partially applied add"+ (primitive _math_add @@ int32 5)+ (T.function T.int32 T.int32),+ noChange "partially applied string cat"+ (primitive _strings_cat2 @@ string "prefix")+ (T.function T.string T.string)]++higherOrderApplicationsTests :: TBinding TestGroup+higherOrderApplicationsTests = define "higherOrderApplicationsTests" $+ subgroup "Higher-order applications" [+ checkTest "apply function to function" []+ (lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x",+ "double">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $+ var "apply" @@ var "double" @@ int32 5)+ (letsTyped [+ ("apply", tylams ["t0", "t1"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "x" (T.var "t0") $ var "f" @@ var "x",+ T.poly ["t0", "t1"] $ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.var "t0") (T.var "t1"))),+ ("double", lambdaTyped "n" T.int32 $ primitive _math_mul @@ var "n" @@ int32 2,+ T.mono $ T.function T.int32 T.int32)] $+ tyapps (var "apply") [T.int32, T.int32] @@ var "double" @@ int32 5)+ T.int32,+ checkTest "function composition" []+ (lets ["compose">: lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"),+ "add1">: lambda "n" $ primitive _math_add @@ var "n" @@ int32 1,+ "mul2">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $+ var "compose" @@ var "add1" @@ var "mul2" @@ int32 3)+ (letsTyped [+ ("compose", tylams ["t0", "t1", "t2"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "g" (T.function (T.var "t2") (T.var "t0")) $ lambdaTyped "x" (T.var "t2") $ var "f" @@ (var "g" @@ var "x"),+ T.poly ["t0", "t1", "t2"] $ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.function (T.var "t2") (T.var "t0")) (T.function (T.var "t2") (T.var "t1")))),+ ("add1", lambdaTyped "n" T.int32 $ primitive _math_add @@ var "n" @@ int32 1,+ T.mono $ T.function T.int32 T.int32),+ ("mul2", lambdaTyped "n" T.int32 $ primitive _math_mul @@ var "n" @@ int32 2,+ T.mono $ T.function T.int32 T.int32)] $+ tyapps (var "compose") [T.int32, T.int32, T.int32] @@ var "add1" @@ var "mul2" @@ int32 3)+ T.int32]++polymorphicApplicationsTests :: TBinding TestGroup+polymorphicApplicationsTests = define "polymorphicApplicationsTests" $+ subgroup "Polymorphic applications" [+ checkTest "polymorphic identity" []+ (lets ["id">: lambda "x" $ var "x"] $+ tuple [var "id" @@ int32 42, var "id" @@ string "hello"])+ (letsTyped [+ ("id", tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x",+ T.poly ["t0"] $ T.function (T.var "t0") (T.var "t0"))] $+ tyapps (pair (tyapp (var "id") T.int32 @@ int32 42) (tyapp (var "id") T.string @@ string "hello")) [T.int32, T.string])+ (T.pair T.int32 T.string),+ checkTest "polymorphic const" []+ (lets ["const">: lambdas ["x", "y"] $ var "x"] $+ var "const" @@ string "keep" @@ int32 999)+ (letsTyped [+ ("const", tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ var "x",+ T.poly ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.var "t0")))] $+ tyapps (var "const") [T.string, T.int32] @@ string "keep" @@ int32 999)+ T.string,+ checkTest "polymorphic flip" []+ (lets ["flip">: lambda "f" $ lambda "x" $ lambda "y" $ var "f" @@ var "y" @@ var "x"] $+ var "flip" @@ primitive _strings_cat2 @@ string "world" @@ string "hello")+ (letsTyped [+ ("flip", tylams ["t0", "t1", "t2"] $ lambdaTyped "f" (T.function (T.var "t0") (T.function (T.var "t1") (T.var "t2"))) $ lambdaTyped "x" (T.var "t1") $ lambdaTyped "y" (T.var "t0") $ var "f" @@ var "y" @@ var "x",+ T.poly ["t0", "t1", "t2"] $ T.function (T.function (T.var "t0") (T.function (T.var "t1") (T.var "t2"))) (T.function (T.var "t1") (T.function (T.var "t0") (T.var "t2"))))] $+ tyapps (var "flip") [T.string, T.string, T.string] @@ primitive _strings_cat2 @@ string "world" @@ string "hello")+ T.string]++applicationsInComplexContextsTests :: TBinding TestGroup+applicationsInComplexContextsTests = define "applicationsInComplexContextsTests" $+ subgroup "Applications in complex contexts" [+ checkTest "application in tuple" []+ (tuple [primitive _math_add @@ int32 1 @@ int32 2,+ primitive _strings_cat2 @@ string "a" @@ string "b"])+ (tyapps (pair (primitive _math_add @@ int32 1 @@ int32 2) (primitive _strings_cat2 @@ string "a" @@ string "b")) [T.int32, T.string])+ (T.pair T.int32 T.string),+ noChange "application in record"+ (record TestTypes.testTypePersonName [+ "firstName">: primitive _strings_cat2 @@ string "John" @@ string "ny",+ "lastName">: string "Doe",+ "age">: primitive _math_add @@ int32 20 @@ int32 5])+ (Core.typeVariable TestTypes.testTypePersonName),+ checkTest "application in let binding" []+ (lets ["result">: primitive _math_mul @@ int32 6 @@ int32 7] $+ var "result")+ (letsTyped [+ ("result", primitive _math_mul @@ int32 6 @@ int32 7,+ T.mono T.int32)] $+ var "result")+ T.int32,+ noChange "nested applications"+ (primitive _math_add @@ (primitive _math_mul @@ int32 3 @@ int32 4) @@ (primitive _math_add @@ int32 1 @@ int32 2))+ T.int32]++applicationsWithComplexArgumentsTests :: TBinding TestGroup+applicationsWithComplexArgumentsTests = define "applicationsWithComplexArgumentsTests" $+ subgroup "Applications with complex arguments" [+ checkTest "application with record argument" []+ (lets ["getName">: lambda "person" $ project TestTypes.testTypePersonName (name "firstName") @@ var "person"] $+ var "getName" @@ record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 25])+ (letsTyped [+ ("getName", lambdaTyped "person" (Core.typeVariable TestTypes.testTypePersonName) $ project TestTypes.testTypePersonName (name "firstName") @@ var "person",+ T.mono $ T.function (Core.typeVariable TestTypes.testTypePersonName) T.string)] $+ var "getName" @@ record TestTypes.testTypePersonName [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 25])+ T.string,+ checkTest "application with list argument" []+ (lets ["head">: lambda "xs" $ primitive _lists_head @@ var "xs"] $+ var "head" @@ list [string "first", string "second"])+ (letsTyped [+ ("head", tylam "t0" $ lambdaTyped "xs" (T.list (T.var "t0")) $ tyapp (primitive _lists_head) (T.var "t0") @@ var "xs",+ T.poly ["t0"] $ T.function (T.list (T.var "t0")) (T.var "t0"))] $+ tyapp (var "head") T.string @@ list [string "first", string "second"])+ T.string]++------ Lambdas ------++lambdasTests :: TBinding TestGroup+lambdasTests = define "lambdasTests" $+ supergroup "Lambdas" [+ simpleLambdasTests,+ multiParameterLambdasTests,+ lambdasWithOperationsTests,+ nestedLambdasTests,+ lambdasInComplexContextsTests,+ higherOrderLambdasTests]++simpleLambdasTests :: TBinding TestGroup+simpleLambdasTests = define "simpleLambdasTests" $+ subgroup "Simple lambdas" [+ checkTest "identity function" []+ (lambda "x" $ var "x")+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0")),+ checkTest "constant function" []+ (lambda "x" $ int32 42)+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ int32 42)+ (T.forAlls ["t0"] $ T.function (T.var "t0") T.int32)]++multiParameterLambdasTests :: TBinding TestGroup+multiParameterLambdasTests = define "multiParameterLambdasTests" $+ subgroup "Multi-parameter lambdas" [+ checkTest "two parameters" []+ (lambda "x" $ lambda "y" $ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ var "x")+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.var "t0"))),+ checkTest "three parameters" []+ (lambda "x" $ lambda "y" $ lambda "z" $ var "y")+ (tylams ["t0", "t1", "t2"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ lambdaTyped "z" (T.var "t2") $ var "y")+ (T.forAlls ["t0", "t1", "t2"] $ T.function+ (T.var "t0")+ (T.function (T.var "t1") (T.function (T.var "t2") (T.var "t1")))),+ checkTest "parameter reuse" []+ (lambda "x" $ lambda "y" $ tuple [var "x", var "x", var "y"])+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ tyapps (pair (var "x") (tyapps (pair (var "x") (var "y")) [T.var "t0", T.var "t1"])) [T.var "t0", T.pair (T.var "t0") (T.var "t1")])+ (T.forAlls ["t0", "t1"] $ T.function+ (T.var "t0") (T.function (T.var "t1")+ (T.pair (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))))]++lambdasWithOperationsTests :: TBinding TestGroup+lambdasWithOperationsTests = define "lambdasWithOperationsTests" $+ subgroup "Lambdas with operations" [+ checkTest "lambda with primitive" []+ (lambda "x" $ primitive _math_add @@ var "x" @@ int32 1)+ (lambdaTyped "x" T.int32 $ primitive _math_add @@ var "x" @@ int32 1)+ (T.function T.int32 T.int32),+ checkTest "lambda with application" []+ (lambda "f" $ lambda "x" $ var "f" @@ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "x" (T.var "t0") $ var "f" @@ var "x")+ (T.forAlls ["t0", "t1"] $ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.var "t0") (T.var "t1"))),+ checkTest "lambda with construction" []+ (lambda "x" $ lambda "y" $ tuple [var "x", var "y"])+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ tyapps (pair (var "x") (var "y")) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.pair (T.var "t0") (T.var "t1"))))]++nestedLambdasTests :: TBinding TestGroup+nestedLambdasTests = define "nestedLambdasTests" $+ subgroup "Nested lambdas" [+ checkTest "lambda returning lambda" []+ (lambda "x" $ lambda "y" $ lambda "z" $ var "x")+ (tylams ["t0", "t1", "t2"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ lambdaTyped "z" (T.var "t2") $ var "x")+ (T.forAlls ["t0", "t1", "t2"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.function (T.var "t2") (T.var "t0")))),+ checkTest "lambda with let binding" []+ (lambda "x" $ lets ["y">: var "x"] $ var "y")+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ letsTyped [("y", var "x", T.mono (T.var "t0"))] $ var "y")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0")),+ checkTest "lambda with inner lambda" []+ (lambda "outer" $ lets ["inner">: lambda "x" $ var "x"] $ var "inner" @@ var "outer")+ (tylam "t0" $ lambdaTyped "outer" (T.var "t0") $ letsTyped [("inner", tylam "t1" $ lambdaTyped "x" (T.var "t1") $ var "x", T.poly ["t1"] $ T.function (T.var "t1") (T.var "t1"))] $ tyapp (var "inner") (T.var "t0") @@ var "outer")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0"))]++lambdasInComplexContextsTests :: TBinding TestGroup+lambdasInComplexContextsTests = define "lambdasInComplexContextsTests" $+ subgroup "Lambdas in complex contexts" [+ checkTest "lambda in tuple" []+ (tuple [lambda "x" $ var "x", int32 42])+ (tylam "t0" $ tyapps (pair (lambdaTyped "x" (T.var "t0") $ var "x") (int32 42)) [T.function (T.var "t0") (T.var "t0"), T.int32])+ (T.forAlls ["t0"] $ T.pair (T.function (T.var "t0") (T.var "t0")) T.int32),+ checkTest "lambda in list" []+ (list [lambda "x" $ primitive _math_add @@ var "x" @@ int32 1,+ lambda "y" $ primitive _math_mul @@ var "y" @@ int32 2])+ (list [lambdaTyped "x" T.int32 $ primitive _math_add @@ var "x" @@ int32 1,+ lambdaTyped "y" T.int32 $ primitive _math_mul @@ var "y" @@ int32 2])+ (T.list $ T.function T.int32 T.int32),+ checkTest "lambda in record" []+ (lambda "name" $ record TestTypes.testTypePersonName [+ "firstName">: var "name",+ "lastName">: string "Doe",+ "age">: int32 30])+ (lambdaTyped "name" T.string $ record TestTypes.testTypePersonName [+ "firstName">: var "name",+ "lastName">: string "Doe",+ "age">: int32 30])+ (T.function T.string (Core.typeVariable TestTypes.testTypePersonName))]++higherOrderLambdasTests :: TBinding TestGroup+higherOrderLambdasTests = define "higherOrderLambdasTests" $+ subgroup "Higher-order lambdas" [+ checkTest "function composition" []+ (lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"))+ (tylams ["t0", "t1", "t2"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "g" (T.function (T.var "t2") (T.var "t0")) $ lambdaTyped "x" (T.var "t2") $ var "f" @@ (var "g" @@ var "x"))+ (T.forAlls ["t0", "t1", "t2"] $ T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function+ (T.function (T.var "t2") (T.var "t0"))+ (T.function (T.var "t2") (T.var "t1")))),+ checkTest "function application" []+ (lambda "f" $ lambda "x" $ var "f" @@ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "x" (T.var "t0") $ var "f" @@ var "x")+ (T.forAlls ["t0", "t1"] $ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.var "t0") (T.var "t1"))),+ checkTest "curried function" []+ (lambda "x" $ lambda "y" $ lambda "z" $ primitive _logic_ifElse @@ var "x" @@ var "y" @@ var "z")+ (tylam "t0" $ lambdaTyped "x" T.boolean $ lambdaTyped "y" (T.var "t0") $ lambdaTyped "z" (T.var "t0") $ tyapp (primitive _logic_ifElse) (T.var "t0") @@ var "x" @@ var "y" @@ var "z")+ (T.forAlls ["t0"] $ T.function T.boolean (T.function (T.var "t0") (T.function (T.var "t0") (T.var "t0"))))]++------ Let terms ------++letTermsTests :: TBinding TestGroup+letTermsTests = define "letTermsTests" $+ supergroup "Let terms" [+ simpleLetBindingsTests,+ letTermsWithShadowingTests,+ recursiveBindingsTests,+ mutualRecursionTests,+ nestedLetTermsTests,+ letWithComplexExpressionsTests]++simpleLetBindingsTests :: TBinding TestGroup+simpleLetBindingsTests = define "simpleLetBindingsTests" $+ subgroup "Simple let bindings" [+ checkTest "single binding" []+ (lets ["x">: int32 42] $+ var "x")+ (letsTyped [("x", int32 42, T.mono T.int32)] $+ var "x")+ T.int32,+ checkTest "multiple bindings" []+ (lets ["x">: int32 42,+ "y">: string "hello"] $+ tuple [var "x", var "y"])+ (letsTyped [("x", int32 42, T.mono T.int32),+ ("y", string "hello", T.mono T.string)] $+ tyapps (pair (var "x") (var "y")) [T.int32, T.string])+ (T.pair T.int32 T.string)]++letTermsWithShadowingTests :: TBinding TestGroup+letTermsWithShadowingTests = define "letTermsWithShadowingTests" $+ subgroup "Let terms with shadowing" [+ checkTest "lambda parameter shadowing let binding" []+ (lets ["x">: int32 42] $+ lambda "x" $ var "x")+ (tylam "t0" $+ letsTyped [("x", int32 42, T.mono T.int32)] $+ lambdaTyped "x" (T.var "t0") $ var "x")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0")),+ checkTest "nested lambda shadowing" []+ (lambda "x" $+ lets ["y">: var "x"] $+ lambda "x" $+ tuple [var "x", var "y"])+ (tylams ["t0", "t1"] $+ lambdaTyped "x" (T.var "t0") $+ letsTyped [("y", var "x", T.mono $ T.var "t0")] $+ lambdaTyped "x" (T.var "t1") $+ tyapps (pair (var "x") (var "y")) [T.var "t1", T.var "t0"])+ (T.forAlls ["t0", "t1"] $+ T.function (T.var "t0") $+ T.function (T.var "t1") $+ T.pair (T.var "t1") (T.var "t0")),+ checkTest "multiple levels of let shadowing" []+ (lets ["x">: int32 1] $+ lets ["x">: string "second"] $+ lets ["x">: boolean True] $+ var "x")+ (letsTyped [("x", int32 1, T.mono T.int32)] $+ letsTyped [("x", string "second", T.mono T.string)] $+ letsTyped [("x", boolean True, T.mono T.boolean)] $+ var "x")+ T.boolean,+ checkTest "let shadowing with lambda and reference to outer binding" []+ (lets ["x">: int32 10, "y">: int32 20] $+ lambda "x" $+ lets ["z">: var "y"] $+ tuple [var "x", var "z"])+ (tylam "t0" $+ letsTyped [("x", int32 10, T.mono T.int32),+ ("y", int32 20, T.mono T.int32)] $+ lambdaTyped "x" (T.var "t0") $+ letsTyped [("z", var "y", T.mono T.int32)] $+ tyapps (pair (var "x") (var "z")) [T.var "t0", T.int32])+ (T.forAlls ["t0"] $+ T.function (T.var "t0") $+ T.pair (T.var "t0") T.int32)]++recursiveBindingsTests :: TBinding TestGroup+recursiveBindingsTests = define "recursiveBindingsTests" $+ subgroup "Recursive bindings" [+ checkTest "simple arithmetic recursion" []+ (lets ["double">: lambda "n" $ primitive _math_add @@ var "n" @@ var "n"] $+ var "double" @@ int32 5)+ (letsTyped [("double", lambdaTyped "n" T.int32 $ primitive _math_add @@ var "n" @@ var "n",+ T.mono $ T.function T.int32 T.int32)] $+ var "double" @@ int32 5)+ T.int32]++mutualRecursionTests :: TBinding TestGroup+mutualRecursionTests = define "mutualRecursionTests" $+ subgroup "Mutual recursion" [+ checkTest "mutually recursive data" []+ (lets ["listA">: record TestTypes.testTypeBuddyListAName [+ "head">: int32 1,+ "tail">: optional $ just $ var "listB"],+ "listB">: record TestTypes.testTypeBuddyListBName [+ "head">: int32 2,+ "tail">: optional nothing]] $+ var "listA")+ (letsTyped [("listA", tyapp (record TestTypes.testTypeBuddyListAName [+ "head">: int32 1,+ "tail">: optional $ just $ var "listB"]) T.int32,+ T.mono $ T.apply (Core.typeVariable TestTypes.testTypeBuddyListAName) T.int32),+ ("listB", tyapp (record TestTypes.testTypeBuddyListBName [+ "head">: int32 2,+ "tail">: tyapp (optional nothing) (T.apply (Core.typeVariable TestTypes.testTypeBuddyListAName) T.int32)]) T.int32,+ T.mono $ T.apply (Core.typeVariable TestTypes.testTypeBuddyListBName) T.int32)] $+ var "listA")+ (T.apply (Core.typeVariable TestTypes.testTypeBuddyListAName) T.int32),+ checkTest "(monomorphic) mutually recursive functions" []+ (lets ["f">: lambda "x" $ var "g" @@ var "x",+ "g">: lambda "y" $ primitive _math_add @@ var "y" @@ int32 1] $+ var "f" @@ int32 5)+ (letsTyped [("f", lambdaTyped "x" T.int32 $ var "g" @@ var "x",+ T.mono $ T.function T.int32 T.int32),+ ("g", lambdaTyped "y" T.int32 $ primitive _math_add @@ var "y" @@ int32 1,+ T.mono $ T.function T.int32 T.int32)] $+ var "f" @@ int32 5)+ T.int32]++nestedLetTermsTests :: TBinding TestGroup+nestedLetTermsTests = define "nestedLetTermsTests" $+ subgroup "Nested let terms" [+ checkTest "monomorphic nesting" []+ (lets ["x">: int32 1] $+ lets ["y">: primitive _math_add @@ var "x" @@ int32 2] $+ lets ["z">: primitive _math_mul @@ var "y" @@ int32 3] $+ var "z")+ (letsTyped [("x", int32 1, T.mono T.int32)] $+ letsTyped [("y", primitive _math_add @@ var "x" @@ int32 2, T.mono T.int32)] $+ letsTyped [("z", primitive _math_mul @@ var "y" @@ int32 3, T.mono T.int32)] $+ var "z")+ T.int32,+ checkTest "polymorphic nesting" []+ (lets ["id">: lambda "x" $ var "x"] $+ lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x"] $+ var "apply" @@ var "id" @@ string "test")+ (letsTyped [("id", tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x",+ T.poly ["t0"] $ T.function (T.var "t0") (T.var "t0"))] $+ letsTyped [("apply", tylams ["t0", "t1"] $ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $ lambdaTyped "x" (T.var "t0") $ var "f" @@ var "x",+ T.poly ["t0", "t1"] $ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.var "t0") (T.var "t1")))] $+ tyapps (var "apply") [T.string, T.string] @@ tyapp (var "id") T.string @@ string "test")+ T.string,+ checkTest "variable capture avoidance" []+ (lets ["x">: int32 1] $+ lambda "x" $ lets ["y">: var "x"] $ var "y")+ (tylam "t0" $ letsTyped [("x", int32 1, T.mono T.int32)] $+ lambdaTyped "x" (T.var "t0") $ letsTyped [("y", var "x", T.mono (T.var "t0"))] $ var "y")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0")),+ checkTest "simple let in lambda" []+ (lambda "z" $ lets ["y">: var "z"] $ var "y")+ (tylam "t0" $ lambdaTyped "z" (T.var "t0") $ letsTyped [("y", var "z", T.mono (T.var "t0"))] $ var "y")+ (T.forAlls ["t0"] $ T.function (T.var "t0") (T.var "t0"))]++letWithComplexExpressionsTests :: TBinding TestGroup+letWithComplexExpressionsTests = define "letWithComplexExpressionsTests" $+ subgroup "Let with complex expressions" [+ checkTest "let in record" []+ (record TestTypes.testTypePersonName [+ "firstName">: lets ["first">: string "John",+ "middle">: string "Q"] $+ primitive _strings_cat2 @@ var "first" @@ var "middle",+ "lastName">: string "Doe",+ "age">: int32 30])+ (record TestTypes.testTypePersonName [+ "firstName">: letsTyped [("first", string "John", T.mono T.string),+ ("middle", string "Q", T.mono T.string)] $+ primitive _strings_cat2 @@ var "first" @@ var "middle",+ "lastName">: string "Doe",+ "age">: int32 30])+ (Core.typeVariable TestTypes.testTypePersonName),+ checkTest "let in function application" []+ (lets ["x">: int32 5,+ "y">: int32 3] $+ primitive _math_add @@ var "x" @@ var "y")+ (letsTyped [("x", int32 5, T.mono T.int32),+ ("y", int32 3, T.mono T.int32)] $+ primitive _math_add @@ var "x" @@ var "y")+ T.int32,+ checkTest "polymorphic let binding" []+ (lets ["id">: lambda "x" $ var "x"] $+ tuple [var "id" @@ int32 42, var "id" @@ string "hello"])+ (letsTyped [("id", tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x",+ T.poly ["t0"] $ T.function (T.var "t0") (T.var "t0"))] $+ tyapps (pair (tyapp (var "id") T.int32 @@ int32 42) (tyapp (var "id") T.string @@ string "hello")) [T.int32, T.string])+ (T.pair T.int32 T.string),+ checkTest "composition" []+ (lets ["compose">: lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"),+ "add1">: lambda "n" $ primitive _math_add @@ var "n" @@ int32 1,+ "double">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $+ (var "compose" @@ var "add1" @@ var "double") @@ int32 5)+ (letsTyped [+ ("compose", tylams ["t0", "t1", "t2"] $+ lambdaTyped "f" (T.function (T.var "t0") (T.var "t1")) $+ lambdaTyped "g" (T.function (T.var "t2") (T.var "t0")) $+ lambdaTyped "x" (T.var "t2") $ var "f" @@ (var "g" @@ var "x"),+ T.poly ["t0", "t1", "t2"] $+ T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function (T.function (T.var "t2") (T.var "t0"))+ (T.function (T.var "t2") (T.var "t1")))),+ ("add1", lambdaTyped "n" T.int32 $ primitive _math_add @@ var "n" @@ int32 1,+ T.mono $ T.function T.int32 T.int32),+ ("double", lambdaTyped "n" T.int32 $ primitive _math_mul @@ var "n" @@ int32 2,+ T.mono $ T.function T.int32 T.int32)] $+ (tyapps (var "compose") [T.int32, T.int32, T.int32] @@ var "add1" @@ var "double") @@ int32 5)+ T.int32]++------ Literals ------++literalsTests :: TBinding TestGroup+literalsTests = define "literalsTests" $+ supergroup "Literals" [+ booleanLiteralsTests,+ stringLiteralsTests,+ integerLiteralsTests,+ floatLiteralsTests,+-- binaryLiteralsTests, -- TODO: restore this group+ literalsInComplexContextsTests]++booleanLiteralsTests :: TBinding TestGroup+booleanLiteralsTests = define "booleanLiteralsTests" $+ subgroup "Boolean literals" [+ noChange "true" (boolean True) T.boolean,+ noChange "false" (boolean False) T.boolean]++stringLiteralsTests :: TBinding TestGroup+stringLiteralsTests = define "stringLiteralsTests" $+ subgroup "String literals" [+ noChange "simple string" (string "hello") T.string,+ noChange "empty string" (string "") T.string,+ noChange "unicode string" (string "café") T.string]++integerLiteralsTests :: TBinding TestGroup+integerLiteralsTests = define "integerLiteralsTests" $+ subgroup "Integer literals" [+ noChange "bigint" (bigint 42) T.bigint,+ noChange "int8" (int8 127) T.int8,+ noChange "int16" (int16 32767) T.int16,+ noChange "int32" (int32 2147483647) T.int32,+ noChange "int64" (int64 9223372036854775807) T.int64,+ noChange "uint8" (uint8 255) T.uint8,+ noChange "uint16" (uint16 65535) T.uint16,+ noChange "uint32" (uint32 4294967295) T.uint32,+ noChange "uint64" (uint64 18446744073709551615) T.uint64]++floatLiteralsTests :: TBinding TestGroup+floatLiteralsTests = define "floatLiteralsTests" $+ subgroup "Float literals" [+ noChange "bigfloat" (bigfloat 3.14159) T.bigfloat,+ noChange "float32" (float32 2.71828) T.float32,+ noChange "float64" (float64 1.41421) T.float64]++binaryLiteralsTests :: TBinding TestGroup+binaryLiteralsTests = define "binaryLiteralsTests" $+ subgroup "Binary literals" [+ noChange "binary" (binary (BC.pack "Hello World")) T.binary]++literalsInComplexContextsTests :: TBinding TestGroup+literalsInComplexContextsTests = define "literalsInComplexContextsTests" $+ subgroup "Literals in complex contexts" [+ checkTest "literals in tuple" []+ (tuple [boolean True, tuple [string "test", tuple [int32 42, float32 3.14]]])+ (tyapps (pair (boolean True) (tyapps (pair (string "test") (tyapps (pair (int32 42) (float32 3.14)) [T.int32, T.float32])) [T.string, T.pair T.int32 T.float32])) [T.boolean, T.pair T.string (T.pair T.int32 T.float32)])+ (T.pair T.boolean (T.pair T.string (T.pair T.int32 T.float32))),+ noChange "literals in list"+ (list [string "one", string "two", string "three"])+ (T.list T.string)]++------ Primitives ------++primitivesTests :: TBinding TestGroup+primitivesTests = define "primitivesTests" $+ supergroup "Primitives" [+ nullaryPrimitivesTests,+ unaryPrimitivesTests,+ binaryPrimitivesTests,+ ternaryPrimitivesTests,+ monomorphicVsPolymorphicTests,+ higherOrderPrimitivesTests,+ primitivesInComplexContextsTests]++nullaryPrimitivesTests :: TBinding TestGroup+nullaryPrimitivesTests = define "nullaryPrimitivesTests" $+ subgroup "Nullary primitives" [+ checkTest "empty map" []+ (primitive _maps_empty)+ (tylams ["t0", "t1"] $ tyapps (primitive _maps_empty) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.map (T.var "t0") (T.var "t1")),+ checkTest "empty set" []+ (primitive _sets_empty)+ (tylam "t0" $ tyapp (primitive _sets_empty) (T.var "t0"))+ (T.forAll "t0" $ T.set $ T.var "t0")]++unaryPrimitivesTests :: TBinding TestGroup+unaryPrimitivesTests = define "unaryPrimitivesTests" $+ subgroup "Unary primitives" [+ checkTest "lists head" []+ (primitive _lists_head)+ (tylam "t0" $ tyapp (primitive _lists_head) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.list $ T.var "t0") (T.var "t0")),+ noChange "math neg"+ (primitive _math_negate)+ (T.function T.int32 T.int32),+ noChange "logic not"+ (primitive _logic_not)+ (T.function T.boolean T.boolean)]++binaryPrimitivesTests :: TBinding TestGroup+binaryPrimitivesTests = define "binaryPrimitivesTests" $+ subgroup "Binary primitives" [+ noChange "math add"+ (primitive _math_add)+ (T.function T.int32 (T.function T.int32 T.int32)),+ checkTest "lists cons" []+ (primitive _lists_cons)+ (tylam "t0" $ tyapp (primitive _lists_cons) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.function (T.list $ T.var "t0") (T.list $ T.var "t0"))),+ checkTest "maps insert" []+ (primitive _maps_insert)+ (tylams ["t0", "t1"] $ tyapps (primitive _maps_insert) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function+ (T.var "t0")+ (T.function (T.var "t1") (T.function (T.map (T.var "t0") (T.var "t1")) (T.map (T.var "t0") (T.var "t1")))))]++ternaryPrimitivesTests :: TBinding TestGroup+ternaryPrimitivesTests = define "ternaryPrimitivesTests" $+ subgroup "Ternary primitives" [+ checkTest "logic ifElse" []+ (primitive _logic_ifElse)+ (tylam "t0" $ tyapp (primitive _logic_ifElse) (T.var "t0"))+ (T.forAll "t0" $ T.function T.boolean (T.function (T.var "t0") (T.function (T.var "t0") (T.var "t0")))),+ checkTest "lists foldl" []+ (primitive _lists_foldl)+ (tylams ["t0", "t1"] $ tyapps (primitive _lists_foldl) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function+ (T.function (T.var "t0") (T.function (T.var "t1") (T.var "t0")))+ (T.function (T.var "t0") (T.function (T.list $ T.var "t1") (T.var "t0"))))]++monomorphicVsPolymorphicTests :: TBinding TestGroup+monomorphicVsPolymorphicTests = define "monomorphicVsPolymorphicTests" $+ subgroup "Monomorphic vs polymorphic" [+ noChange "monomorphic math"+ (primitive _math_add)+ (T.function T.int32 (T.function T.int32 T.int32)),+ checkTest "polymorphic identity" []+ (primitive _equality_identity)+ (tylam "t0" $ tyapp (primitive _equality_identity) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.var "t0")),+ checkTest "polymorphic map" []+ (primitive _lists_map)+ (tylams ["t0", "t1"] $ tyapps (primitive _lists_map) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $ T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function (T.list $ T.var "t0") (T.list $ T.var "t1")))]++higherOrderPrimitivesTests :: TBinding TestGroup+higherOrderPrimitivesTests = define "higherOrderPrimitivesTests" $+ subgroup "Higher-order primitives" [+ checkTest "lists map function" []+ (primitive _lists_map @@ (lambda "x" $ primitive _math_add @@ var "x" @@ int32 1))+ (tyapps (primitive _lists_map) [T.int32, T.int32] @@ (lambdaTyped "x" T.int32 $ primitive _math_add @@ var "x" @@ int32 1))+ (T.function (T.list T.int32) (T.list T.int32)),+ checkTest "lists filter" []+ (primitive _lists_filter)+ (tylam "t0" $ tyapp (primitive _lists_filter) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.function (T.var "t0") T.boolean) (T.function (T.list $ T.var "t0") (T.list $ T.var "t0"))),+ checkTest "optionals maybe" []+ (primitive _maybes_maybe)+ (tylams ["t0", "t1"] $ tyapps (primitive _maybes_maybe) [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $+ T.function (T.var "t0") (T.function (T.function (T.var "t1") (T.var "t0")) (T.function (T.optional $ T.var "t1") (T.var "t0"))))]++primitivesInComplexContextsTests :: TBinding TestGroup+primitivesInComplexContextsTests = define "primitivesInComplexContextsTests" $+ subgroup "Primitives in complex contexts" [+ checkTest "primitive composition" []+ (lets ["double">: lambda "x" $ primitive _math_mul @@ var "x" @@ int32 2,+ "increment">: lambda "x" $ primitive _math_add @@ var "x" @@ int32 1] $+ primitive _lists_map @@ var "double" @@ (primitive _lists_map @@ var "increment" @@ list [int32 1, int32 2, int32 3]))+ (letsTyped [("double", lambdaTyped "x" T.int32 $ primitive _math_mul @@ var "x" @@ int32 2,+ T.mono $ T.function T.int32 T.int32),+ ("increment", lambdaTyped "x" T.int32 $ primitive _math_add @@ var "x" @@ int32 1,+ T.mono $ T.function T.int32 T.int32)] $+ tyapps (primitive _lists_map) [T.int32, T.int32] @@ var "double" @@ (tyapps (primitive _lists_map) [T.int32, T.int32] @@ var "increment" @@ list [int32 1, int32 2, int32 3]))+ (T.list T.int32),+ checkTest "nested higher-order" []+ (primitive _lists_map @@ (primitive _lists_map @@ (primitive _math_add @@ int32 1)) @@+ list [list [int32 1, int32 2], list [int32 3, int32 4]])+ (tyapps (primitive _lists_map) [T.list T.int32, T.list T.int32] @@ (tyapps (primitive _lists_map) [T.int32, T.int32] @@ (primitive _math_add @@ int32 1)) @@+ list [list [int32 1, int32 2], list [int32 3, int32 4]])+ (T.list $ T.list T.int32)]++------ Variables ------++variablesTests :: TBinding TestGroup+variablesTests = define "variablesTests" $+ supergroup "Variables" [+ simpleVariableLookupTests,+ variableScopingTests,+ polymorphicVariablesTests,+ variablesInComplexContextsTests,+ recursiveVariablesTests]++simpleVariableLookupTests :: TBinding TestGroup+simpleVariableLookupTests = define "simpleVariableLookupTests" $+ subgroup "Simple variable lookup" [+ checkTest "int variable" []+ (lambda "x" $ var "x")+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x")+ (T.forAll "t0" $ T.function (T.var "t0") (T.var "t0")),+ checkTest "variable in let binding" []+ (lets ["x">: int32 42] $ var "x")+ (letsTyped [("x", int32 42, T.mono T.int32)] $ var "x")+ T.int32,+ checkTest "multiple variables" []+ (lets ["x">: string "hello",+ "y">: int32 42] $+ tuple [var "x", var "y"])+ (letsTyped [("x", string "hello", T.mono T.string),+ ("y", int32 42, T.mono T.int32)] $+ tyapps (pair (var "x") (var "y")) [T.string, T.int32])+ (T.pair T.string T.int32)]++variableScopingTests :: TBinding TestGroup+variableScopingTests = define "variableScopingTests" $+ subgroup "Variable scoping" [+ checkTest "lambda parameter" []+ (lambda "x" $ lambda "y" $ var "x")+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ lambdaTyped "y" (T.var "t1") $ var "x")+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.var "t0"))),+ checkTest "let binding scope" []+ (lets ["x">: int32 1] $+ lets ["y">: string "hello"] $+ var "x")+ (letsTyped [("x", int32 1, T.mono T.int32)] $+ letsTyped [("y", string "hello", T.mono T.string)] $+ var "x")+ T.int32,+ checkTest "variable shadowing" []+ (lets ["x">: int32 1] $+ lambda "x" $ var "x")+ (tylam "t0" $ letsTyped [("x", int32 1, T.mono T.int32)] $+ lambdaTyped "x" (T.var "t0") $ var "x")+ (T.forAll "t0" $ T.function (T.var "t0") (T.var "t0")),+ checkTest "nested scoping" []+ (lambda "x" $+ lets ["y">: var "x"] $+ lambda "z" $+ tuple [var "x", var "y", var "z"])+ (tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $+ letsTyped [("y", var "x", T.mono (T.var "t0"))] $+ lambdaTyped "z" (T.var "t1") $+ tyapps (pair (var "x") (tyapps (pair (var "y") (var "z")) [T.var "t0", T.var "t1"])) [T.var "t0", T.pair (T.var "t0") (T.var "t1")])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.pair (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))))]++polymorphicVariablesTests :: TBinding TestGroup+polymorphicVariablesTests = define "polymorphicVariablesTests" $+ subgroup "Polymorphic variables" [+ checkTest "polymorphic function" []+ (lets ["id">: lambda "x" $ var "x"] $+ var "id")+ (tylam "t0" $ letsTyped [("id", tylam "t1" $ lambdaTyped "x" (T.var "t1") $ var "x",+ T.poly ["t1"] $ T.function (T.var "t1") (T.var "t1"))] $+ tyapp (var "id") (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.var "t0")),+ checkTest "polymorphic application" []+ (lets ["id">: lambda "x" $ var "x"] $+ tuple [var "id" @@ int32 42, var "id" @@ string "test"])+ (letsTyped [("id", tylam "t0" $ lambdaTyped "x" (T.var "t0") $ var "x",+ T.poly ["t0"] $ T.function (T.var "t0") (T.var "t0"))] $+ tyapps (pair (tyapp (var "id") T.int32 @@ int32 42) (tyapp (var "id") T.string @@ string "test")) [T.int32, T.string])+ (T.pair T.int32 T.string),+ checkTest "higher order polymorphic" []+ (lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x"] $+ var "apply")+ (tylams ["t0", "t1"] $ letsTyped [("apply", tylams ["t2", "t3"] $ lambdaTyped "f" (T.function (T.var "t2") (T.var "t3")) $ lambdaTyped "x" (T.var "t2") $ var "f" @@ var "x",+ T.poly ["t2", "t3"] $ T.function (T.function (T.var "t2") (T.var "t3")) (T.function (T.var "t2") (T.var "t3")))] $+ tyapps (var "apply") [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $+ T.function (T.function (T.var "t0") (T.var "t1")) (T.function (T.var "t0") (T.var "t1")))]++variablesInComplexContextsTests :: TBinding TestGroup+variablesInComplexContextsTests = define "variablesInComplexContextsTests" $+ subgroup "Variables in complex contexts" [+ checkTest "variable in record" []+ (lambda "name" $+ record TestTypes.testTypePersonName [+ "firstName">: (var "name"),+ "lastName">: (string "Doe"),+ "age">: (int32 25)])+ (lambdaTyped "name" T.string $+ record TestTypes.testTypePersonName [+ "firstName">: (var "name"),+ "lastName">: (string "Doe"),+ "age">: (int32 25)])+ (T.function T.string (Core.typeVariable TestTypes.testTypePersonName)),+ checkTest "variable in list" []+ (lambda "x" $ list [var "x", var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ list [var "x", var "x"])+ (T.forAll "t0" $ T.function (T.var "t0") (T.list $ T.var "t0")),+ checkTest "variable in map" []+ (lambda "key" $ lambda "value" $+ mapTerm [(var "key", var "value")])+ (tylams ["t0", "t1"] $ lambdaTyped "key" (T.var "t0") $ lambdaTyped "value" (T.var "t1") $+ mapTerm [(var "key", var "value")])+ (T.forAlls ["t0", "t1"] $ T.function (T.var "t0") (T.function (T.var "t1") (T.map (T.var "t0") (T.var "t1")))),+ checkTest "variable in optional" []+ (lambda "x" $ Core.termMaybe $ just $ var "x")+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ Core.termMaybe $ just $ var "x")+ (T.forAll "t0" $ T.function (T.var "t0") (T.optional $ T.var "t0"))]++recursiveVariablesTests :: TBinding TestGroup+recursiveVariablesTests = define "recursiveVariablesTests" $+ subgroup "Recursive variables" [+ checkTest "simple recursion" []+ (lets ["f">: lambda "x" $ primitive _math_add @@ var "x" @@ int32 1] $+ var "f")+ (letsTyped [("f", lambdaTyped "x" T.int32 $ primitive _math_add @@ var "x" @@ int32 1,+ T.mono $ T.function T.int32 T.int32)] $+ var "f")+ (T.function T.int32 T.int32),+ checkTest "mutual recursion" []+ (lets ["f">: lambda "x" $ var "g" @@ var "x",+ "g">: lambda "y" $ primitive _math_add @@ var "y" @@ int32 1] $+ var "f")+ (letsTyped [("f", lambdaTyped "x" T.int32 $ var "g" @@ var "x",+ T.mono $ T.function T.int32 T.int32),+ ("g", lambdaTyped "y" T.int32 $ primitive _math_add @@ var "y" @@ int32 1,+ T.mono $ T.function T.int32 T.int32)] $+ var "f")+ (T.function T.int32 T.int32)]
+ src/main/haskell/Hydra/Sources/Test/Checking/NominalTypes.hs view
@@ -0,0 +1,1651 @@++-- | Nominal type checking test cases: records, unions, wrapped terms, and eliminations (projections, case statements, unwrapping)+module Hydra.Sources.Test.Checking.NominalTypes where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M+++ns :: Namespace+ns = Namespace "hydra.test.checking.nominalTypes"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Nominal type checking test cases: records, unions, field access, injection, projection")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding recordsTests,+ Phantoms.toBinding monomorphicRecordsTests,+ Phantoms.toBinding polymorphicRecordsTests,+ Phantoms.toBinding recordsInComplexContextsTests,+ Phantoms.toBinding multiParameterPolymorphicRecordsTests,+ Phantoms.toBinding recordEliminationsTests,+ Phantoms.toBinding simpleRecordProjectionsTests,+ Phantoms.toBinding recordProjectionsAppliedToRecordsTests,+ Phantoms.toBinding polymorphicRecordProjectionsTests,+ Phantoms.toBinding polymorphicRecordProjectionsAppliedTests,+ Phantoms.toBinding recordProjectionsWithVariablesTests,+ Phantoms.toBinding recordProjectionsInComplexContextsTests,+ Phantoms.toBinding multiParameterPolymorphicProjectionsTests,+ Phantoms.toBinding higherOrderRecordProjectionsTests,+ Phantoms.toBinding recursiveRecordProjectionsTests,+ Phantoms.toBinding recordProjectionsWithMutualRecursionTests,+ Phantoms.toBinding unionsTests,+ Phantoms.toBinding simpleUnionInjectionsTests,+ Phantoms.toBinding unionInjectionsWithDataTests,+ Phantoms.toBinding polymorphicUnionInjectionsTests,+ Phantoms.toBinding polymorphicRecursiveUnionInjectionsTests,+ Phantoms.toBinding polymorphicUnionsFromLambdaTests,+ Phantoms.toBinding unionsInComplexContextsTests,+ Phantoms.toBinding multiParameterPolymorphicInjectionsTests,+ Phantoms.toBinding unionEliminationsTests,+ Phantoms.toBinding simpleUnitVariantEliminationsTests,+ Phantoms.toBinding unionEliminationsWithDataTests,+ Phantoms.toBinding polymorphicUnionEliminationsTests,+ Phantoms.toBinding simplePolymorphicUnionTests,+ Phantoms.toBinding usingUnionPolymorphicRecursiveTests,+ Phantoms.toBinding usingKernelTypesTests,+ Phantoms.toBinding unionEliminationsWithDefaultsTests,+ Phantoms.toBinding nestedUnionEliminationsTests,+ Phantoms.toBinding unionEliminationsInComplexContextsTests,+ Phantoms.toBinding multiParameterPolymorphicCaseStatementsTests,+ Phantoms.toBinding higherOrderUnionEliminationsTests,+ Phantoms.toBinding recursiveUnionEliminationsTests,+ Phantoms.toBinding wrappedTermsTests,+ Phantoms.toBinding monomorphicWrappedTermsTests,+ Phantoms.toBinding polymorphicWrappedTermsTests,+ Phantoms.toBinding wrappedTermsInComplexContextsTests,+ Phantoms.toBinding nestedWrappedTermsTests,+ Phantoms.toBinding multipleWrappingLevelsTests,+ Phantoms.toBinding multiParameterPolymorphicWrappersTests,+ Phantoms.toBinding wrapEliminationsTests,+ Phantoms.toBinding monomorphicUnwrappingTests,+ Phantoms.toBinding polymorphicUnwrappingTests,+ Phantoms.toBinding unwrapEliminationsInApplicationsTests,+ Phantoms.toBinding unwrapInComplexContextsTests,+ Phantoms.toBinding multiParameterPolymorphicUnwrappersTests,+ Phantoms.toBinding chainedUnwrappingTests,+ Phantoms.toBinding multipleUnwrapOperationsTests,+ Phantoms.toBinding eliminationsTests,+ Phantoms.toBinding projectionsWithVariablesTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ supergroup "Nominal types" [+ recordsTests,+ unionsTests,+ wrappedTermsTests,+ eliminationsTests]++------ Helper functions ------++-- Helper function to create a type checking test case+checkTest :: String -> [Tag] -> TTerm Term -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+checkTest name tags input outputTerm outputType = testCaseWithMetadata (Phantoms.string name)+ (testCaseTypeChecking $ typeCheckingTestCase input outputTerm outputType) Phantoms.nothing (Phantoms.list $ tag . unTag <$> tags)++-- Helper for tests where the term doesn't change during type checking+noChange :: String -> TTerm Term -> TTerm Type -> TTerm TestCaseWithMetadata+noChange name term typ = checkTest name [] term term typ++-- Create a TestCase inject for type checking+testCaseTypeChecking :: TTerm TypeCheckingTestCase -> TTerm TestCase+testCaseTypeChecking = Phantoms.inject _TestCase _TestCase_typeChecking++-- Create a TypeCheckingTestCase record+typeCheckingTestCase :: TTerm Term -> TTerm Term -> TTerm Type -> TTerm TypeCheckingTestCase+typeCheckingTestCase input outputTerm outputType = Phantoms.record _TypeCheckingTestCase [+ Phantoms.field _TypeCheckingTestCase_input input,+ Phantoms.field _TypeCheckingTestCase_outputTerm outputTerm,+ Phantoms.field _TypeCheckingTestCase_outputType outputType]++------ Records ------++recordsTests :: TBinding TestGroup+recordsTests = define "recordsTests" $+ supergroup "Records" [+ monomorphicRecordsTests,+ polymorphicRecordsTests,+ recordsInComplexContextsTests,+ multiParameterPolymorphicRecordsTests]++monomorphicRecordsTests :: TBinding TestGroup+monomorphicRecordsTests = define "monomorphicRecordsTests" $+ subgroup "Monomorphic records" [+ noChange "latlon record"+ (record (name "LatLon") [+ "lat" >: float32 19.5429,+ "lon" >: float32 (-155.6659)])+ (T.var "LatLon"),+ checkTest "latlon with variable" []+ (lambda "x" $ record (name "LatLon") [+ "lat" >: float32 19.5429,+ "lon" >: var "x"])+ (lambdaTyped "x" T.float32 $ record (name "LatLon") [+ "lat" >: float32 19.5429,+ "lon" >: var "x"])+ (T.function T.float32 (T.var "LatLon")),+ noChange "person record"+ (record (name "Person") [+ "firstName" >: string "Alice",+ "lastName" >: string "Smith",+ "age" >: int32 30])+ (T.var "Person"),+ noChange "empty record"+ (record (name "Unit") [])+ (T.var "Unit"),+ checkTest "person with variables" []+ (lambda "name" $ lambda "age" $ record (name "Person") [+ "firstName" >: var "name",+ "lastName" >: string "Doe",+ "age" >: var "age"])+ (lambdaTyped "name" T.string $ lambdaTyped "age" T.int32 $ record (name "Person") [+ "firstName" >: var "name",+ "lastName" >: string "Doe",+ "age" >: var "age"])+ (T.function T.string (T.function T.int32 (T.var "Person")))]++polymorphicRecordsTests :: TBinding TestGroup+polymorphicRecordsTests = define "polymorphicRecordsTests" $+ subgroup "Polymorphic records" [+ checkTest "latlon poly float" []+ (record (name "LatLonPoly") [+ "lat" >: float32 19.5429,+ "lon" >: float32 (-155.6659)])+ (tyapp (record (name "LatLonPoly") [+ "lat" >: float32 19.5429,+ "lon" >: float32 (-155.6659)]) T.float32)+ (T.apply (T.var "LatLonPoly") T.float32),+ checkTest "latlon poly int64" []+ (record (name "LatLonPoly") [+ "lat" >: int64 195429,+ "lon" >: int64 (-1556659)])+ (tyapp (record (name "LatLonPoly") [+ "lat" >: int64 195429,+ "lon" >: int64 (-1556659)]) T.int64)+ (T.apply (T.var "LatLonPoly") T.int64),+ checkTest "latlon poly variable" []+ (lambda "x" $ record (name "LatLonPoly") [+ "lat" >: var "x",+ "lon" >: var "x"])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapp (record (name "LatLonPoly") [+ "lat" >: var "x",+ "lon" >: var "x"]) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.apply (T.var "LatLonPoly") (T.var "t0"))),+ checkTest "buddylist string" []+ (record (name "BuddyListA") [+ "head" >: string "first",+ "tail" >: optional nothing])+ (tyapp (record (name "BuddyListA") [+ "head" >: string "first",+ "tail" >: tyapp (optional nothing) (T.apply (T.var "BuddyListB") T.string)]) T.string)+ (T.apply (T.var "BuddyListA") T.string),+ checkTest "buddylist variable" []+ (lambda "x" $ record (name "BuddyListA") [+ "head" >: var "x",+ "tail" >: optional nothing])+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapp (record (name "BuddyListA") [+ "head" >: var "x",+ "tail" >: tyapp (optional nothing) (T.apply (T.var "BuddyListB") (T.var "t0"))]) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.apply (T.var "BuddyListA") (T.var "t0")))]++recordsInComplexContextsTests :: TBinding TestGroup+recordsInComplexContextsTests = define "recordsInComplexContextsTests" $+ subgroup "Records in complex contexts" [+ checkTest "records in tuple" []+ (tuple [+ record (name "Person") [+ "firstName" >: string "Bob",+ "lastName" >: string "Jones",+ "age" >: int32 25],+ record (name "LatLon") [+ "lat" >: float32 1.0,+ "lon" >: float32 2.0]])+ (tyapps (pair+ (record (name "Person") [+ "firstName" >: string "Bob",+ "lastName" >: string "Jones",+ "age" >: int32 25])+ (record (name "LatLon") [+ "lat" >: float32 1.0,+ "lon" >: float32 2.0])) [T.var "Person", T.var "LatLon"])+ (T.pair (T.var "Person") (T.var "LatLon")),+ checkTest "poly records in tuple" []+ (tuple [+ record (name "LatLonPoly") [+ "lat" >: int32 1,+ "lon" >: int32 2],+ record (name "BuddyListA") [+ "head" >: string "test",+ "tail" >: optional nothing]])+ (tyapps (pair+ (tyapp (record (name "LatLonPoly") [+ "lat" >: int32 1,+ "lon" >: int32 2]) T.int32)+ (tyapp (record (name "BuddyListA") [+ "head" >: string "test",+ "tail" >: tyapp (optional nothing) (T.apply (T.var "BuddyListB") T.string)]) T.string))+ [T.apply (T.var "LatLonPoly") T.int32, T.apply (T.var "BuddyListA") T.string])+ (T.pair+ (T.apply (T.var "LatLonPoly") T.int32)+ (T.apply (T.var "BuddyListA") T.string)),+ checkTest "recursive record" []+ (record (name "IntList") [+ "head" >: int32 42,+ "tail" >: optional (Phantoms.just (+ record (name "IntList") [+ "head" >: int32 43,+ "tail" >: optional nothing]))])+ (record (name "IntList") [+ "head" >: int32 42,+ "tail" >: optional (Phantoms.just (+ record (name "IntList") [+ "head" >: int32 43,+ "tail" >: tyapp (optional nothing) (T.var "IntList")]))])+ (T.var "IntList")]++multiParameterPolymorphicRecordsTests :: TBinding TestGroup+multiParameterPolymorphicRecordsTests = define "multiParameterPolymorphicRecordsTests" $+ subgroup "Multi-parameter polymorphic records" [+ checkTest "triple with three monomorphic types" []+ (record (name "Triple") [+ "first" >: int32 1,+ "second" >: string "middle",+ "third" >: boolean True])+ (tyapps (record (name "Triple") [+ "first" >: int32 1,+ "second" >: string "middle",+ "third" >: boolean True]) [T.int32, T.string, T.boolean])+ (T.applys (T.var "Triple") [T.int32, T.string, T.boolean]),+ checkTest "triple with PersonOrSomething containing map" []+ (lambda "k" $ lambda "v" $+ record (name "Triple") [+ "first" >: string "prefix",+ "second" >: inject (TestTypes.testTypePersonOrSomethingName) "other"+ (mapTerm [(var "k", var "v")]),+ "third" >: int32 999])+ (tylams ["t0", "t1"] $+ lambdaTyped "k" (T.var "t0") $+ lambdaTyped "v" (T.var "t1") $+ tyapps (record (name "Triple") [+ "first" >: string "prefix",+ "second" >: tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other"+ (mapTerm [(var "k", var "v")])) (T.map (T.var "t0") (T.var "t1")),+ "third" >: int32 999])+ [T.string,+ T.apply (T.var "PersonOrSomething") (T.map (T.var "t0") (T.var "t1")),+ T.int32])+ (T.forAlls ["t0", "t1"] $+ T.function (T.var "t0") $+ T.function (T.var "t1") $+ T.applys (T.var "Triple")+ [T.string,+ T.apply (T.var "PersonOrSomething") (T.map (T.var "t0") (T.var "t1")),+ T.int32])]++------ Record eliminations ------++recordEliminationsTests :: TBinding TestGroup+recordEliminationsTests = define "recordEliminationsTests" $+ supergroup "Record eliminations" [+ simpleRecordProjectionsTests,+ recordProjectionsAppliedToRecordsTests,+ polymorphicRecordProjectionsTests,+ polymorphicRecordProjectionsAppliedTests,+ recordProjectionsWithVariablesTests,+ recordProjectionsInComplexContextsTests,+ multiParameterPolymorphicProjectionsTests,+ higherOrderRecordProjectionsTests,+ recursiveRecordProjectionsTests,+ recordProjectionsWithMutualRecursionTests,+ projectionsWithVariablesTests]++simpleRecordProjectionsTests :: TBinding TestGroup+simpleRecordProjectionsTests = define "simpleRecordProjectionsTests" $+ subgroup "Simple record projections" [+ noChange "project firstName from Person"+ (project (TestTypes.testTypePersonName) (name "firstName"))+ (T.function (T.var "Person") T.string),+ noChange "project lastName from Person"+ (project (TestTypes.testTypePersonName) (name "lastName"))+ (T.function (T.var "Person") T.string),+ noChange "project age from Person"+ (project (TestTypes.testTypePersonName) (name "age"))+ (T.function (T.var "Person") T.int32),+ noChange "project lat from LatLon"+ (project (TestTypes.testTypeLatLonName) (name "lat"))+ (T.function (T.var "LatLon") T.float32),+ noChange "project lon from LatLon"+ (project (TestTypes.testTypeLatLonName) (name "lon"))+ (T.function (T.var "LatLon") T.float32)]++recordProjectionsAppliedToRecordsTests :: TBinding TestGroup+recordProjectionsAppliedToRecordsTests = define "recordProjectionsAppliedToRecordsTests" $+ subgroup "Record projections applied to records" [+ noChange "project firstName applied to person record"+ (project (TestTypes.testTypePersonName) (name "firstName") @@+ record (name "Person") [+ "firstName" >: string "Alice",+ "lastName" >: string "Smith",+ "age" >: int32 30])+ T.string,+ noChange "project age applied to person record"+ (project (TestTypes.testTypePersonName) (name "age") @@+ record (name "Person") [+ "firstName" >: string "Bob",+ "lastName" >: string "Jones",+ "age" >: int32 25])+ T.int32,+ noChange "project lat applied to LatLon record"+ (project (TestTypes.testTypeLatLonName) (name "lat") @@+ record (name "LatLon") [+ "lat" >: float32 40.7128,+ "lon" >: float32 (-74.0060)])+ T.float32]++polymorphicRecordProjectionsTests :: TBinding TestGroup+polymorphicRecordProjectionsTests = define "polymorphicRecordProjectionsTests" $+ subgroup "Polymorphic record projections" [+ checkTest "project lat from polymorphic LatLonPoly" []+ (project (TestTypes.testTypeLatLonPolyName) (name "lat"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.apply (T.var "LatLonPoly") (T.var "t0")) (T.var "t0")),+ checkTest "project lon from polymorphic LatLonPoly" []+ (project (TestTypes.testTypeLatLonPolyName) (name "lon"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lon")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.apply (T.var "LatLonPoly") (T.var "t0")) (T.var "t0")),+ checkTest "project head from BuddyListA" []+ (project (TestTypes.testTypeBuddyListAName) (name "head"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeBuddyListAName) (name "head")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.apply (T.var "BuddyListA") (T.var "t0")) (T.var "t0")),+ checkTest "project tail from BuddyListA" []+ (project (TestTypes.testTypeBuddyListAName) (name "tail"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeBuddyListAName) (name "tail")) (T.var "t0"))+ (T.forAll "t0" $ T.function+ (T.apply (T.var "BuddyListA") (T.var "t0"))+ (T.optional (T.apply (T.var "BuddyListB") (T.var "t0"))))]++polymorphicRecordProjectionsAppliedTests :: TBinding TestGroup+polymorphicRecordProjectionsAppliedTests = define "polymorphicRecordProjectionsAppliedTests" $+ subgroup "Polymorphic record projections applied" [+ checkTest "project lat from LatLonPoly with int32" []+ (project (TestTypes.testTypeLatLonPolyName) (name "lat") @@+ record (name "LatLonPoly") [+ "lat" >: int32 40,+ "lon" >: int32 (-74)])+ (tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) T.int32 @@+ tyapp (record (name "LatLonPoly") [+ "lat" >: int32 40,+ "lon" >: int32 (-74)]) T.int32)+ T.int32,+ checkTest "project lon from LatLonPoly with float64" []+ (project (TestTypes.testTypeLatLonPolyName) (name "lon") @@+ record (name "LatLonPoly") [+ "lat" >: float64 40.7128,+ "lon" >: float64 (-74.0060)])+ (tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lon")) T.float64 @@+ tyapp (record (name "LatLonPoly") [+ "lat" >: float64 40.7128,+ "lon" >: float64 (-74.0060)]) T.float64)+ T.float64,+ checkTest "project head from BuddyListA with string" []+ (project (TestTypes.testTypeBuddyListAName) (name "head") @@+ record (name "BuddyListA") [+ "head" >: string "Alice",+ "tail" >: optional nothing])+ (tyapp (project (TestTypes.testTypeBuddyListAName) (name "head")) T.string @@+ tyapp (record (name "BuddyListA") [+ "head" >: string "Alice",+ "tail" >: tyapp (optional nothing) (T.apply (T.var "BuddyListB") T.string)]) T.string)+ T.string]++recordProjectionsWithVariablesTests :: TBinding TestGroup+recordProjectionsWithVariablesTests = define "recordProjectionsWithVariablesTests" $+ subgroup "Record projections with variables" [+ checkTest "project from lambda parameter" []+ (lambda "person" $ project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (lambdaTyped "person" (T.var "Person") $ project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (T.function (T.var "Person") T.string),+ checkTest "project from polymorphic lambda parameter" []+ (lambda "coords" $ project (TestTypes.testTypeLatLonPolyName) (name "lat") @@ var "coords")+ (tylam "t0" $ lambdaTyped "coords" (T.apply (T.var "LatLonPoly") (T.var "t0")) $ tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) (T.var "t0") @@ var "coords")+ (T.forAll "t0" $ T.function (T.apply (T.var "LatLonPoly") (T.var "t0")) (T.var "t0")),+ checkTest "multiple projections from same record" []+ (lambda "person" $+ tuple [project (TestTypes.testTypePersonName) (name "firstName") @@ var "person",+ project (TestTypes.testTypePersonName) (name "lastName") @@ var "person"])+ (lambdaTyped "person" (T.var "Person") $+ tyapps (pair+ (project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (project (TestTypes.testTypePersonName) (name "lastName") @@ var "person")) [T.string, T.string])+ (T.function (T.var "Person") (T.pair T.string T.string))]++recordProjectionsInComplexContextsTests :: TBinding TestGroup+recordProjectionsInComplexContextsTests = define "recordProjectionsInComplexContextsTests" $+ subgroup "Record projections in complex contexts" [+ checkTest "projection in let binding" []+ (lets ["person">: record (name "Person") [+ "firstName" >: string "Charlie",+ "lastName" >: string "Brown",+ "age" >: int32 35],+ "getName">: project (TestTypes.testTypePersonName) (name "firstName")] $+ var "getName" @@ var "person")+ (letsTyped [("person", record (name "Person") [+ "firstName" >: string "Charlie",+ "lastName" >: string "Brown",+ "age" >: int32 35],+ T.mono $ T.var "Person"),+ ("getName", project (TestTypes.testTypePersonName) (name "firstName"),+ T.mono $ T.function (T.var "Person") T.string)] $+ var "getName" @@ var "person")+ T.string,+ checkTest "projection in tuple" []+ (tuple [project (TestTypes.testTypePersonName) (name "firstName"),+ project (TestTypes.testTypePersonName) (name "age")])+ (tyapps (pair+ (project (TestTypes.testTypePersonName) (name "firstName"))+ (project (TestTypes.testTypePersonName) (name "age")))+ [T.function (T.var "Person") T.string, T.function (T.var "Person") T.int32])+ (T.pair (T.function (T.var "Person") T.string) (T.function (T.var "Person") T.int32)),+ noChange "projection in list"+ (list [project (TestTypes.testTypePersonName) (name "firstName"),+ project (TestTypes.testTypePersonName) (name "lastName")])+ (T.list (T.function (T.var "Person") T.string))]++multiParameterPolymorphicProjectionsTests :: TBinding TestGroup+multiParameterPolymorphicProjectionsTests = define "multiParameterPolymorphicProjectionsTests" $+ subgroup "Multi-parameter polymorphic projections" [+ checkTest "project first from Triple" []+ (project (TestTypes.testTypeTripleName) (name "first"))+ (tylams ["t0", "t1", "t2"] $ tyapps (project (TestTypes.testTypeTripleName) (name "first")) [T.var "t0", T.var "t1", T.var "t2"])+ (T.forAlls ["t0", "t1", "t2"] $+ T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t0", T.var "t1", T.var "t2"])+ (T.var "t0")),+ checkTest "project second from Triple applied" []+ (project (TestTypes.testTypeTripleName) (name "second") @@+ record (TestTypes.testTypeTripleName) [+ "first">: int32 1,+ "second">: string "middle",+ "third">: boolean True])+ (tyapps (project (TestTypes.testTypeTripleName) (name "second")) [T.int32, T.string, T.boolean] @@+ tyapps (record (TestTypes.testTypeTripleName) [+ "first">: int32 1,+ "second">: string "middle",+ "third">: boolean True]) [T.int32, T.string, T.boolean])+ T.string,+ checkTest "project from Triple and use second field, which is another polymorphic record" []+ (lambda "triple" $ lambda "key" $+ match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" $ Core.termMaybe nothing,+ "other">: lambda "m" $ primitive _maps_lookup @@ var "key" @@ var "m"] @@+ (project (TestTypes.testTypeTripleName) (name "second") @@ var "triple"))+ (tylams ["t0", "t1", "t2", "t3"] $+ lambdaTyped "triple"+ (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName)+ [T.var "t0",+ T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (T.map (T.var "t1") (T.var "t2")),+ T.var "t3"]) $+ lambdaTyped "key" (T.var "t1") $+ tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (tyapp (Core.termMaybe nothing) (T.var "t2")),+ "other">: lambdaTyped "m" (T.map (T.var "t1") (T.var "t2")) $+ tyapps (primitive _maps_lookup) [T.var "t1", T.var "t2"] @@ var "key" @@ var "m"]) (T.map (T.var "t1") (T.var "t2")) @@+ (tyapps (project (TestTypes.testTypeTripleName) (name "second"))+ [T.var "t0",+ T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (T.map (T.var "t1") (T.var "t2")),+ T.var "t3"] @@ var "triple"))+ (T.forAlls ["t0", "t1", "t2", "t3"] $+ T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName)+ [T.var "t0",+ T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (T.map (T.var "t1") (T.var "t2")),+ T.var "t3"])+ (T.function (T.var "t1") (T.optional (T.var "t2"))))]++higherOrderRecordProjectionsTests :: TBinding TestGroup+higherOrderRecordProjectionsTests = define "higherOrderRecordProjectionsTests" $+ subgroup "Higher-order record projections" [+ checkTest "map projection over list of records" []+ (primitive _lists_map @@ (project (TestTypes.testTypePersonName) (name "firstName")) @@+ list [record (TestTypes.testTypePersonName) [+ "firstName">: (string "Alice"),+ "lastName">: (string "Smith"),+ "age">: (int32 30)],+ record (TestTypes.testTypePersonName) [+ "firstName">: (string "Bob"),+ "lastName">: (string "Jones"),+ "age">: (int32 25)]])+ (tyapps (primitive _lists_map) [Core.typeVariable $ TestTypes.testTypePersonName, T.string] @@ (project (TestTypes.testTypePersonName) (name "firstName")) @@+ list [record (TestTypes.testTypePersonName) [+ "firstName">: (string "Alice"),+ "lastName">: (string "Smith"),+ "age">: (int32 30)],+ record (TestTypes.testTypePersonName) [+ "firstName">: (string "Bob"),+ "lastName">: (string "Jones"),+ "age">: (int32 25)]])+ (T.list T.string),+ checkTest "map polymorphic projection" []+ (primitive _lists_map @@ (project (TestTypes.testTypeLatLonPolyName) (name "lat")) @@+ list [record (TestTypes.testTypeLatLonPolyName) [+ "lat">: (int32 40),+ "lon">: (int32 (-74))],+ record (TestTypes.testTypeLatLonPolyName) [+ "lat">: (int32 34),+ "lon">: (int32 (-118))]])+ (tyapps (primitive _lists_map) [T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) T.int32, T.int32]+ @@ (tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) T.int32) @@+ list [tyapp (record (TestTypes.testTypeLatLonPolyName) [+ "lat">: (int32 40),+ "lon">: (int32 (-74))]) T.int32,+ tyapp (record (TestTypes.testTypeLatLonPolyName) [+ "lat">: (int32 34),+ "lon">: (int32 (-118))]) T.int32])+ (T.list T.int32),+ checkTest "filter using projection" []+ (primitive _lists_filter @@+ (lambda "person" $+ primitive _equality_gt @@+ (project (TestTypes.testTypePersonName) (name "age") @@ var "person") @@+ int32 30) @@+ list [record (TestTypes.testTypePersonName) [+ "firstName">: (string "Alice"),+ "lastName">: (string "Smith"),+ "age">: (int32 35)],+ record (TestTypes.testTypePersonName) [+ "firstName">: (string "Bob"),+ "lastName">: (string "Jones"),+ "age">: (int32 25)]])+ (tyapp (primitive _lists_filter) (Core.typeVariable $ TestTypes.testTypePersonName) @@+ (lambdaTyped "person" (Core.typeVariable $ TestTypes.testTypePersonName) $+ tyapp (primitive _equality_gt) T.int32 @@+ (project (TestTypes.testTypePersonName) (name "age") @@ var "person") @@+ int32 30) @@+ list [record (TestTypes.testTypePersonName) [+ "firstName">: (string "Alice"),+ "lastName">: (string "Smith"),+ "age">: (int32 35)],+ record (TestTypes.testTypePersonName) [+ "firstName">: (string "Bob"),+ "lastName">: (string "Jones"),+ "age">: (int32 25)]])+ (T.list (Core.typeVariable $ TestTypes.testTypePersonName))]++recursiveRecordProjectionsTests :: TBinding TestGroup+recursiveRecordProjectionsTests = define "recursiveRecordProjectionsTests" $+ subgroup "Recursive record projections" [+ checkTest "nested projection from recursive record" []+ (lambda "intList" $+ primitive _maybes_maybe @@+ int32 0 @@+ (project (TestTypes.testTypeIntListName) (name "head")) @@+ (project (TestTypes.testTypeIntListName) (name "tail") @@ var "intList"))+ (lambdaTyped "intList" (Core.typeVariable $ TestTypes.testTypeIntListName) $+ tyapps (primitive _maybes_maybe) [T.int32, Core.typeVariable $ TestTypes.testTypeIntListName] @@+ int32 0 @@+ (project (TestTypes.testTypeIntListName) (name "head")) @@+ (project (TestTypes.testTypeIntListName) (name "tail") @@ var "intList"))+ (T.function (Core.typeVariable $ TestTypes.testTypeIntListName) T.int32)]++recordProjectionsWithMutualRecursionTests :: TBinding TestGroup+recordProjectionsWithMutualRecursionTests = define "recordProjectionsWithMutualRecursionTests" $+ subgroup "Record projections with mutual recursion" [+ checkTest "project head from BuddyListA" []+ (project (TestTypes.testTypeBuddyListAName) (name "head"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeBuddyListAName) (name "head")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0")) (T.var "t0")),+ checkTest "project tail from BuddyListB" []+ (project (TestTypes.testTypeBuddyListBName) (name "tail"))+ (tylam "t0" $ tyapp (project (TestTypes.testTypeBuddyListBName) (name "tail")) (T.var "t0"))+ (T.forAll "t0" $ T.function+ (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0"))+ (T.optional (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0")))),+ checkTest "chained projections across mutual recursion" []+ (lambda "listA" $+ primitive _maybes_maybe @@+ Core.termMaybe nothing @@+ (lambda "listB" $+ primitive _maybes_maybe @@+ Core.termMaybe nothing @@+ (project (TestTypes.testTypeBuddyListAName) (name "tail")) @@+ (project (TestTypes.testTypeBuddyListBName) (name "tail") @@ var "listB")) @@+ (project (TestTypes.testTypeBuddyListAName) (name "tail") @@ var "listA"))+ (tylam "t0" $ lambdaTyped "listA" (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0")) $+ tyapps (primitive _maybes_maybe) [T.optional (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")), T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")] @@+ tyapp (Core.termMaybe nothing) (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")) @@+ (lambdaTyped "listB" (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")) $+ tyapps (primitive _maybes_maybe) [T.optional (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")), T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0")] @@+ tyapp (Core.termMaybe nothing) (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0")) @@+ (tyapp (project (TestTypes.testTypeBuddyListAName) (name "tail")) (T.var "t0")) @@+ (tyapp (project (TestTypes.testTypeBuddyListBName) (name "tail")) (T.var "t0") @@ var "listB")) @@+ (tyapp (project (TestTypes.testTypeBuddyListAName) (name "tail")) (T.var "t0") @@ var "listA"))+ (T.forAll "t0" $ T.function+ (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0"))+ (T.optional (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListBName) (T.var "t0"))))]++------ Unions ------++unionsTests :: TBinding TestGroup+unionsTests = define "unionsTests" $+ supergroup "Unions" [+ simpleUnionInjectionsTests,+ unionInjectionsWithDataTests,+ polymorphicUnionInjectionsTests,+ polymorphicRecursiveUnionInjectionsTests,+ polymorphicUnionsFromLambdaTests,+ unionsInComplexContextsTests,+ multiParameterPolymorphicInjectionsTests]++simpleUnionInjectionsTests :: TBinding TestGroup+simpleUnionInjectionsTests = define "simpleUnionInjectionsTests" $+ subgroup "Simple union injections" [+ noChange "inject into Comparison lessThan variant"+ (injectUnit (TestTypes.testTypeComparisonName) "lessThan")+ (Core.typeVariable $ TestTypes.testTypeComparisonName),+ noChange "inject into Comparison equalTo variant"+ (injectUnit (TestTypes.testTypeComparisonName) "equalTo")+ (Core.typeVariable $ TestTypes.testTypeComparisonName),+ noChange "inject into Comparison greaterThan variant"+ (injectUnit (TestTypes.testTypeComparisonName) "greaterThan")+ (Core.typeVariable $ TestTypes.testTypeComparisonName)]++unionInjectionsWithDataTests :: TBinding TestGroup+unionInjectionsWithDataTests = define "unionInjectionsWithDataTests" $+ subgroup "Union injections with data" [+ noChange "inject into Number int variant"+ (inject (TestTypes.testTypeNumberName) "int" (int32 42))+ (Core.typeVariable $ TestTypes.testTypeNumberName),+ noChange "inject into Number float variant"+ (inject (TestTypes.testTypeNumberName) "float" (float32 3.14))+ (Core.typeVariable $ TestTypes.testTypeNumberName),+ noChange "inject into Timestamp unixTimeMillis variant"+ (inject (TestTypes.testTypeTimestampName) "unixTimeMillis" (uint64 1609459200000))+ (Core.typeVariable $ TestTypes.testTypeTimestampName),+ noChange "inject into Timestamp date variant"+ (inject (TestTypes.testTypeTimestampName) "date" (string "2021-01-01"))+ (Core.typeVariable $ TestTypes.testTypeTimestampName)]++polymorphicUnionInjectionsTests :: TBinding TestGroup+polymorphicUnionInjectionsTests = define "polymorphicUnionInjectionsTests" $+ subgroup "Polymorphic union injections" [+ checkTest "inject person into PersonOrSomething" []+ (inject (TestTypes.testTypePersonOrSomethingName) "person"+ (record (TestTypes.testTypePersonName) [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 30]))+ (tylam "t0" $ tyapp (inject (TestTypes.testTypePersonOrSomethingName) "person"+ (record (TestTypes.testTypePersonName) [+ "firstName">: string "Alice",+ "lastName">: string "Smith",+ "age">: int32 30])) (T.var "t0"))+ (T.forAll "t0" $ T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (T.var "t0")),+ checkTest "inject string into PersonOrSomething other variant" []+ (inject (TestTypes.testTypePersonOrSomethingName) "other" (string "something else"))+ (tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (string "something else")) T.string)+ (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) T.string),+ checkTest "inject int into PersonOrSomething other variant" []+ (inject (TestTypes.testTypePersonOrSomethingName) "other" (int32 42))+ (tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (int32 42)) T.int32)+ (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) T.int32)]++polymorphicRecursiveUnionInjectionsTests :: TBinding TestGroup+polymorphicRecursiveUnionInjectionsTests = define "polymorphicRecursiveUnionInjectionsTests" $+ subgroup "Polymorphic recursive union injections" [+ checkTest "inject boolean into UnionPolymorphicRecursive" []+ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "bool" (boolean True))+ (tylam "t0" $ tyapp (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "bool" (boolean True)) (T.var "t0"))+ (T.forAll "t0" $ T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t0")),+ checkTest "inject string value into UnionPolymorphicRecursive" []+ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (string "test"))+ (tyapp (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (string "test")) T.string)+ (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.string),+ checkTest "inject int value into UnionPolymorphicRecursive" []+ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (int32 123))+ (tyapp (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (int32 123)) T.int32)+ (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32)]++polymorphicUnionsFromLambdaTests :: TBinding TestGroup+polymorphicUnionsFromLambdaTests = define "polymorphicUnionsFromLambdaTests" $+ subgroup "Polymorphic unions from lambda" [+ checkTest "lambda creating PersonOrSomething other variant" []+ (lambda "x" $ inject (TestTypes.testTypePersonOrSomethingName) "other" (var "x"))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (var "x")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (T.var "t0"))),+ checkTest "lambda creating UnionPolymorphicRecursive value variant" []+ (lambda "x" $ inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (var "x"))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapp (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" (var "x")) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t0")))]++unionsInComplexContextsTests :: TBinding TestGroup+unionsInComplexContextsTests = define "unionsInComplexContextsTests" $+ subgroup "Unions in complex contexts" [+ checkTest "union in tuple" []+ (tuple [inject (TestTypes.testTypeNumberName) "int" (int32 42),+ string "context"])+ (tyapps (pair+ (inject (TestTypes.testTypeNumberName) "int" (int32 42))+ (string "context"))+ [Core.typeVariable $ TestTypes.testTypeNumberName, T.string])+ (T.pair (Core.typeVariable $ TestTypes.testTypeNumberName) T.string),+ noChange "union in list"+ (list [inject (TestTypes.testTypeNumberName) "int" (int32 1),+ inject (TestTypes.testTypeNumberName) "float" (float32 2.5)])+ (T.list $ Core.typeVariable $ TestTypes.testTypeNumberName),+ checkTest "polymorphic union in let binding" []+ (lets ["value">: inject (TestTypes.testTypePersonOrSomethingName) "other" (string "test")] $+ var "value")+ (letsTyped [("value", tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (string "test")) T.string,+ T.mono $ T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) T.string)] $+ var "value")+ (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) T.string)]++multiParameterPolymorphicInjectionsTests :: TBinding TestGroup+multiParameterPolymorphicInjectionsTests = define "multiParameterPolymorphicInjectionsTests" $+ subgroup "Multi-parameter polymorphic injections" [+ checkTest "either left with int" []+ (inject (TestTypes.testTypeEitherName) "left" (int32 42))+ (tylam "t0" $ tyapps (inject (TestTypes.testTypeEitherName) "left" (int32 42)) [T.int32, T.var "t0"])+ (T.forAll "t0" $ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.int32, T.var "t0"]),+ checkTest "either right with string" []+ (inject (TestTypes.testTypeEitherName) "right" (string "hello"))+ (tylam "t0" $ tyapps (inject (TestTypes.testTypeEitherName) "right" (string "hello")) [T.var "t0", T.string])+ (T.forAll "t0" $ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.string]),+ checkTest "either containing LatLonPoly in list" []+ (inject (TestTypes.testTypeEitherName) "right"+ (list [record (TestTypes.testTypeLatLonPolyName) [+ "lat">: int32 40,+ "lon">: int32 (-74)]]))+ (tylam "t0" $ tyapps (inject (TestTypes.testTypeEitherName) "right"+ (list [tyapp (record (TestTypes.testTypeLatLonPolyName) [+ "lat">: int32 40,+ "lon">: int32 (-74)]) T.int32]))+ [T.var "t0", T.list (T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) T.int32)])+ (T.forAll "t0" $ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.list (T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) T.int32)]),+ checkTest "either in triple in map with shared type variables" []+ (lambda "x0" $ lambda "x1" $ lambda "x2" $+ Terms.map $ Phantoms.map $ M.singleton (string "key") $+ record (TestTypes.testTypeTripleName) [+ "first">: inject (TestTypes.testTypeEitherName) "left" (var "x0"),+ "second">: inject (TestTypes.testTypeEitherName) "left" (var "x0"),+ "third">: inject (TestTypes.testTypeEitherName) "right" (var "x1")])+ (tylams ["t0", "t1", "t2", "t3", "t4", "t5"] $+ lambdaTyped "x0" (T.var "t0") $+ lambdaTyped "x1" (T.var "t1") $+ lambdaTyped "x2" (T.var "t2") $+ Terms.map $ Phantoms.map $ M.singleton (string "key") $+ tyapps (record (TestTypes.testTypeTripleName) [+ "first">: tyapps (inject (TestTypes.testTypeEitherName) "left" (var "x0")) [T.var "t0", T.var "t3"],+ "second">: tyapps (inject (TestTypes.testTypeEitherName) "left" (var "x0")) [T.var "t0", T.var "t4"],+ "third">: tyapps (inject (TestTypes.testTypeEitherName) "right" (var "x1")) [T.var "t5", T.var "t1"]])+ [T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.var "t3"],+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.var "t4"],+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t5", T.var "t1"]])+ (T.forAlls ["t0", "t1", "t2", "t3", "t4", "t5"] $+ T.function (T.var "t0") $+ T.function (T.var "t1") $+ T.function (T.var "t2") $+ T.map T.string $+ T.applys (Core.typeVariable $ TestTypes.testTypeTripleName)+ [T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.var "t3"],+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.var "t4"],+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t5", T.var "t1"]])]++------ Union eliminations ------++unionEliminationsTests :: TBinding TestGroup+unionEliminationsTests = define "unionEliminationsTests" $+ supergroup "Union eliminations" [+ simpleUnitVariantEliminationsTests,+ unionEliminationsWithDataTests,+ polymorphicUnionEliminationsTests,+ unionEliminationsWithDefaultsTests,+ nestedUnionEliminationsTests,+ unionEliminationsInComplexContextsTests,+ multiParameterPolymorphicCaseStatementsTests,+ higherOrderUnionEliminationsTests,+ recursiveUnionEliminationsTests]++simpleUnitVariantEliminationsTests :: TBinding TestGroup+simpleUnitVariantEliminationsTests = define "simpleUnitVariantEliminationsTests" $+ subgroup "Simple unit inject eliminations" [+ checkTest "match Comparison with all cases" []+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal"),+ "greaterThan">: lambda "x" (string "greater")])+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal"),+ "greaterThan">: lambdaTyped "x" T.unit (string "greater")])+ (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.string),+ checkTest "match Comparison returning int32" []+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (int32 (-1)),+ "equalTo">: lambda "x" (int32 0),+ "greaterThan">: lambda "x" (int32 1)])+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (int32 (-1)),+ "equalTo">: lambdaTyped "x" T.unit (int32 0),+ "greaterThan">: lambdaTyped "x" T.unit (int32 1)])+ (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.int32),+ checkTest "match applied to Comparison variant" []+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal"),+ "greaterThan">: lambda "x" (string "greater")] @@+ injectUnit (TestTypes.testTypeComparisonName) "equalTo")+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal"),+ "greaterThan">: lambdaTyped "x" T.unit (string "greater")] @@+ injectUnit (TestTypes.testTypeComparisonName) "equalTo")+ T.string]++unionEliminationsWithDataTests :: TBinding TestGroup+unionEliminationsWithDataTests = define "unionEliminationsWithDataTests" $+ subgroup "Union eliminations with data" [+ checkTest "match Number extracting int values" []+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambda "i" (var "i"),+ "float">: lambda "f" (int32 0)])+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambdaTyped "i" T.int32 (var "i"),+ "float">: lambdaTyped "f" T.float32 (int32 0)])+ (T.function (Core.typeVariable $ TestTypes.testTypeNumberName) T.int32),+ checkTest "match Number converting to string" []+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambda "i" (primitive _literals_showInt32 @@ var "i"),+ "float">: lambda "f" (primitive _literals_showFloat32 @@ var "f")])+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambdaTyped "i" T.int32 (primitive _literals_showInt32 @@ var "i"),+ "float">: lambdaTyped "f" T.float32 (primitive _literals_showFloat32 @@ var "f")])+ (T.function (Core.typeVariable $ TestTypes.testTypeNumberName) T.string),+ checkTest "match Number applied to int variant" []+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambda "i" (primitive _math_add @@ var "i" @@ int32 10),+ "float">: lambda "f" (int32 0)] @@+ inject (TestTypes.testTypeNumberName) "int" (int32 42))+ (match (TestTypes.testTypeNumberName) nothing [+ "int">: lambdaTyped "i" T.int32 (primitive _math_add @@ var "i" @@ int32 10),+ "float">: lambdaTyped "f" T.float32 (int32 0)] @@+ inject (TestTypes.testTypeNumberName) "int" (int32 42))+ T.int32,+ checkTest "match Timestamp with mixed data types" []+ (match (TestTypes.testTypeTimestampName) nothing [+ "unixTimeMillis">: lambda "millis" (primitive _literals_showUint64 @@ var "millis"),+ "date">: lambda "dateStr" (var "dateStr")])+ (match (TestTypes.testTypeTimestampName) nothing [+ "unixTimeMillis">: lambdaTyped "millis" T.uint64 (primitive _literals_showUint64 @@ var "millis"),+ "date">: lambdaTyped "dateStr" T.string (var "dateStr")])+ (T.function (Core.typeVariable $ TestTypes.testTypeTimestampName) T.string)]++polymorphicUnionEliminationsTests :: TBinding TestGroup+polymorphicUnionEliminationsTests = define "polymorphicUnionEliminationsTests" $+ supergroup "Polymorphic union eliminations" [+ simplePolymorphicUnionTests,+ usingUnionPolymorphicRecursiveTests,+ usingKernelTypesTests]++simplePolymorphicUnionTests :: TBinding TestGroup+simplePolymorphicUnionTests = define "simplePolymorphicUnionTests" $+ subgroup "Simple polymorphic unions" [+ checkTest "match PersonOrSomething with string" []+ (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambda "x" (var "x")])+ (tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambdaTyped "x" T.string (var "x")]) T.string)+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) T.string) T.string),+ checkTest "match PersonOrSomething instantiated with string" []+ (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambda "x" (var "x")] @@+ inject (TestTypes.testTypePersonOrSomethingName) "other" (string "test"))+ (tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambdaTyped "x" T.string (var "x")]) T.string @@+ tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (string "test")) T.string)+ T.string]++usingUnionPolymorphicRecursiveTests :: TBinding TestGroup+usingUnionPolymorphicRecursiveTests = define "usingUnionPolymorphicRecursiveTests" $+ subgroup "using UnionPolymorphicRecursive" [+ checkTest "non-applied UnionPolymorphicRecursive" []+ (lets [+ "test">: (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambda "i" $ primitive _literals_showInt32 @@ var "i"])] $+ var "test")+ (letsTyped [+ ("test",+ tyapp (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32,+ T.mono $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string)] $+ var "test")+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string),+ checkTest "applied UnionPolymorphicRecursive with int32" []+ (lets [+ "test">: (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambda "i" $ primitive _literals_showInt32 @@ var "i"])+ @@ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" $ int32 42)] $+ var "test")+ (letsTyped [+ ("test",+ tyapp (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32+ @@ tyapp (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" $ int32 42) T.int32,+ T.mono T.string)] $+ var "test")+ T.string,+ checkTest "applied UnionPolymorphicRecursive with int32 in lambda" []+ (lets [+ "test">: lambda "x" $ match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambda "i" $ primitive _literals_showInt32 @@ var "i"]+ @@ var "x"] $+ var "test")+ (letsTyped [+ ("test",+ lambdaTyped "x" (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) $+ tyapp (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32+ @@ var "x",+ T.mono $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string)] $+ var "test")+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string),+ checkTest "applied generic UnionPolymorphicRecursive in lambda" []+ (lets [+ "test">: lambda "x" $ match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambda "ignored" $ string "foo"]+ @@ var "x"] $+ var "test")+ (tylam "t0" $ letsTyped [+ ("test",+ tylam "t1" $ lambdaTyped "x" (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t1")) $+ tyapp (match (TestTypes.testTypeUnionPolymorphicRecursiveName)+ (just $ string "other") [+ "value">: lambdaTyped "ignored" (T.var "t1") $ string "foo"]) (T.var "t1")+ @@ var "x",+ T.poly ["t1"] $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t1")) T.string)] $+ tyapp (var "test") $ T.var "t0")+ (T.forAll "t0" $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t0")) T.string)]++usingKernelTypesTests :: TBinding TestGroup+usingKernelTypesTests = define "usingKernelTypesTests" $+ subgroup "Using kernel types" [+ checkTest "case statement on CoderDirection applied to argument" []+ (lambda "dir" $+ lambda "coder" $+ match (name "hydra.coders.CoderDirection")+ nothing [+ "encode">: lambda "_" $+ lambda "v12" $+ project (name "hydra.compute.Coder") (name "encode")+ @@ var "coder" @@ var "v12",+ "decode">: lambda "_" $+ lambda "v12" $+ project (name "hydra.compute.Coder") (name "decode")+ @@ var "coder" @@ var "v12"]+ @@ var "dir")+ (tylams ["t0", "t1"] $+ lambdaTyped "dir" (T.var "hydra.coders.CoderDirection") $+ lambdaTyped "coder" (T.applys (T.var "hydra.compute.Coder") (T.var <$> ["t0", "t0", "t1", "t1"])) $+ match (name "hydra.coders.CoderDirection")+ nothing [+ "encode">: lambdaTyped "_" T.unit $+ lambdaTyped "v12" (T.var "t1") $+ tyapps (project (name "hydra.compute.Coder") (name "encode")) (T.var <$> ["t0", "t0", "t1", "t1"])+ @@ var "coder" @@ var "v12",+ "decode">: lambdaTyped "_" T.unit $+ lambdaTyped "v12" (T.var "t1") $+ tyapps (project (name "hydra.compute.Coder") (name "decode")) (T.var <$> ["t0", "t0", "t1", "t1"])+ @@ var "coder" @@ var "v12"]+ @@ var "dir")+ (T.forAlls ["t0", "t1"] $+ T.functionMany [+ T.var "hydra.coders.CoderDirection",+ T.applys (T.var "hydra.compute.Coder") (T.var <$> ["t0", "t0", "t1", "t1"]),+ T.var "t1",+ T.applys (Core.typeVariable $ name "hydra.compute.Flow") [T.var "t0", T.var "t1"]])]++unionEliminationsWithDefaultsTests :: TBinding TestGroup+unionEliminationsWithDefaultsTests = define "unionEliminationsWithDefaultsTests" $+ subgroup "Union eliminations with defaults" [+ checkTest "match Comparison with default case" []+ (match (TestTypes.testTypeComparisonName) (just (string "unknown")) [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal")])+ (match (TestTypes.testTypeComparisonName) (just (string "unknown")) [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal")])+ (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.string),+ checkTest "match Number with default case" []+ (match (TestTypes.testTypeNumberName) (just (int32 (-1))) [+ "int">: lambda "i" (var "i")])+ (match (TestTypes.testTypeNumberName) (just (int32 (-1))) [+ "int">: lambdaTyped "i" T.int32 (var "i")])+ (T.function (Core.typeVariable $ TestTypes.testTypeNumberName) T.int32),+ checkTest "match UnionMonomorphic with default" []+ (match (TestTypes.testTypeUnionMonomorphicName) (just (string "fallback")) [+ "bool">: lambda "b" (primitive _literals_showBoolean @@ var "b"),+ "string">: lambda "s" (var "s")])+ (match (TestTypes.testTypeUnionMonomorphicName) (just (string "fallback")) [+ "bool">: lambdaTyped "b" T.boolean (primitive _literals_showBoolean @@ var "b"),+ "string">: lambdaTyped "s" T.string (var "s")])+ (T.function (Core.typeVariable $ TestTypes.testTypeUnionMonomorphicName) T.string)]++nestedUnionEliminationsTests :: TBinding TestGroup+nestedUnionEliminationsTests = define "nestedUnionEliminationsTests" $+ subgroup "Nested union eliminations" [+ checkTest "nested match statements" []+ (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambda "x" (+ match (TestTypes.testTypeNumberName) nothing [+ "int">: lambda "i" (primitive _literals_showInt32 @@ var "i"),+ "float">: lambda "f" (primitive _literals_showFloat32 @@ var "f")] @@+ var "x")])+ (tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambdaTyped "x" (Core.typeVariable $ TestTypes.testTypeNumberName) (+ match (TestTypes.testTypeNumberName) nothing [+ "int">: lambdaTyped "i" T.int32 (primitive _literals_showInt32 @@ var "i"),+ "float">: lambdaTyped "f" T.float32 (primitive _literals_showFloat32 @@ var "f")] @@+ var "x")]) (Core.typeVariable $ TestTypes.testTypeNumberName))+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypePersonOrSomethingName) (Core.typeVariable $ TestTypes.testTypeNumberName)) T.string),+ checkTest "match in tuple" []+ (tuple [+ match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (int32 1),+ "equalTo">: lambda "x" (int32 0),+ "greaterThan">: lambda "x" (int32 (-1))],+ string "context"])+ (tyapps (pair+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (int32 1),+ "equalTo">: lambdaTyped "x" T.unit (int32 0),+ "greaterThan">: lambdaTyped "x" T.unit (int32 (-1))])+ (string "context"))+ [T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.int32, T.string])+ (T.pair (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.int32) T.string)]++unionEliminationsInComplexContextsTests :: TBinding TestGroup+unionEliminationsInComplexContextsTests = define "unionEliminationsInComplexContextsTests" $+ subgroup "Union eliminations in complex contexts" [+ checkTest "match in let binding" []+ (lets ["matcher">: match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal"),+ "greaterThan">: lambda "x" (string "greater")]] $+ var "matcher")+ (letsTyped [("matcher", match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal"),+ "greaterThan">: lambdaTyped "x" T.unit (string "greater")],+ T.mono $ T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.string)] $+ var "matcher")+ (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.string),+ checkTest "match in record" []+ (record (TestTypes.testTypePersonName) [+ "firstName">: (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambda "x" (var "x")] @@+ inject (TestTypes.testTypePersonOrSomethingName) "other" (string "John")),+ "lastName">: (string "Doe"),+ "age">: (int32 30)])+ (record (TestTypes.testTypePersonName) [+ "firstName">: (tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (project (TestTypes.testTypePersonName) (name "firstName") @@ var "p"),+ "other">: lambdaTyped "x" T.string (var "x")]) T.string @@+ tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (string "John")) T.string),+ "lastName">: (string "Doe"),+ "age">: (int32 30)])+ (Core.typeVariable $ TestTypes.testTypePersonName),+ checkTest "match with polymorphic result in list" []+ (list [+ match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambda "p" (project (TestTypes.testTypePersonName) (name "age") @@ var "p"),+ "other">: lambda "x" (var "x")] @@+ inject (TestTypes.testTypePersonOrSomethingName) "other" (int32 25),+ int32 30])+ (list [+ tyapp (match (TestTypes.testTypePersonOrSomethingName) nothing [+ "person">: lambdaTyped "p" (Core.typeVariable $ TestTypes.testTypePersonName) (project (TestTypes.testTypePersonName) (name "age") @@ var "p"),+ "other">: lambdaTyped "x" T.int32 (var "x")]) T.int32 @@+ tyapp (inject (TestTypes.testTypePersonOrSomethingName) "other" (int32 25)) T.int32,+ int32 30])+ (T.list T.int32)]++multiParameterPolymorphicCaseStatementsTests :: TBinding TestGroup+multiParameterPolymorphicCaseStatementsTests = define "multiParameterPolymorphicCaseStatementsTests" $+ subgroup "Multi-parameter polymorphic case statements" [+ checkTest "case Either converting both to string" []+ (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambda "x" $ primitive _literals_showInt32 @@ var "x",+ "right">: lambda "y" $ primitive _literals_showFloat32 @@ var "y"])+ (tyapps (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambdaTyped "x" T.int32 (primitive _literals_showInt32 @@ var "x"),+ "right">: lambdaTyped "y" T.float32 (primitive _literals_showFloat32 @@ var "y")]) [T.int32, T.float32])+ (T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.int32, T.float32])+ T.string),+ checkTest "case Either applied to injection" []+ (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambda "n" $ primitive _math_add @@ var "n" @@ int32 1,+ "right">: lambda "s" $ primitive _strings_length @@ var "s"] @@+ inject (TestTypes.testTypeEitherName) "left" (int32 42))+ (tyapps (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambdaTyped "n" T.int32 (primitive _math_add @@ var "n" @@ int32 1),+ "right">: lambdaTyped "s" T.string (primitive _strings_length @@ var "s")]) [T.int32, T.string] @@+ tyapps (inject (TestTypes.testTypeEitherName) "left" (int32 42)) [T.int32, T.string])+ T.int32,+ checkTest "case Either with Triple and nested projections" []+ (lambda "triple" $+ match (TestTypes.testTypeEitherName) nothing [+ "left">: lambda "coords" $+ project (TestTypes.testTypeLatLonPolyName) (name "lat") @@ var "coords",+ "right">: lambda "t" $+ project (TestTypes.testTypeTripleName) (name "first") @@ var "t"] @@+ (project (TestTypes.testTypeTripleName) (name "second") @@ var "triple"))+ (tylams ["t0", "t1", "t2", "t3", "t4"] $+ lambdaTyped "triple"+ (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName)+ [T.var "t0",+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName)+ [T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) (T.var "t1"),+ T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t1", T.var "t2", T.var "t3"]],+ T.var "t4"]) $+ tyapps (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambdaTyped "coords" (T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) (T.var "t1")) $+ tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) (T.var "t1") @@ var "coords",+ "right">: lambdaTyped "t" (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t1", T.var "t2", T.var "t3"]) $+ tyapps (project (TestTypes.testTypeTripleName) (name "first")) [T.var "t1", T.var "t2", T.var "t3"] @@ var "t"])+ [T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) (T.var "t1"),+ T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t1", T.var "t2", T.var "t3"]] @@+ (tyapps (project (TestTypes.testTypeTripleName) (name "second"))+ [T.var "t0",+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName)+ [T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) (T.var "t1"),+ T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t1", T.var "t2", T.var "t3"]],+ T.var "t4"] @@ var "triple"))+ (T.forAlls ["t0", "t1", "t2", "t3", "t4"] $+ T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeTripleName)+ [T.var "t0",+ T.applys (Core.typeVariable $ TestTypes.testTypeEitherName)+ [T.apply (Core.typeVariable $ TestTypes.testTypeLatLonPolyName) (T.var "t1"),+ T.applys (Core.typeVariable $ TestTypes.testTypeTripleName) [T.var "t1", T.var "t2", T.var "t3"]],+ T.var "t4"])+ (T.var "t1")),+ checkTest "case Either with polymorphic let bindings" []+ (lets ["makeLeft">: lambda "x" $ inject (TestTypes.testTypeEitherName) "left" (var "x"),+ "makeRight">: lambda "y" $ inject (TestTypes.testTypeEitherName) "right" (var "y")] $+ lambda "flag" $+ match (TestTypes.testTypeEitherName) nothing [+ "left">: lambda "n" $ var "makeRight" @@ (primitive _math_add @@ var "n" @@ int32 10),+ "right">: lambda "s" $ var "makeLeft" @@ (primitive _strings_length @@ var "s")] @@+ var "flag")+ (letsTyped [("makeLeft", tylams ["t0", "t1"] $ lambdaTyped "x" (T.var "t0") $ tyapps (inject (TestTypes.testTypeEitherName) "left" (var "x")) [T.var "t0", T.var "t1"],+ T.poly ["t0", "t1"] $ T.function (T.var "t0") (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t0", T.var "t1"])),+ ("makeRight", tylams ["t0", "t1"] $ lambdaTyped "y" (T.var "t0") $ tyapps (inject (TestTypes.testTypeEitherName) "right" (var "y")) [T.var "t1", T.var "t0"],+ T.poly ["t0", "t1"] $ T.function (T.var "t0") (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.var "t1", T.var "t0"]))] $+ lambdaTyped "flag" (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.int32, T.string]) $+ tyapps (match (TestTypes.testTypeEitherName) nothing [+ "left">: lambdaTyped "n" T.int32 $ tyapps (var "makeRight") [T.int32, T.int32] @@ (primitive _math_add @@ var "n" @@ int32 10),+ "right">: lambdaTyped "s" T.string $ tyapps (var "makeLeft") [T.int32, T.int32] @@ (primitive _strings_length @@ var "s")]) [T.int32, T.string] @@+ var "flag")+ (T.function (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.int32, T.string]) (T.applys (Core.typeVariable $ TestTypes.testTypeEitherName) [T.int32, T.int32]))]++higherOrderUnionEliminationsTests :: TBinding TestGroup+higherOrderUnionEliminationsTests = define "higherOrderUnionEliminationsTests" $+ subgroup "Higher-order union eliminations" [+ checkTest "map match over list" []+ (primitive _lists_map @@+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal"),+ "greaterThan">: lambda "x" (string "greater")]) @@+ list [injectUnit (TestTypes.testTypeComparisonName) "lessThan",+ injectUnit (TestTypes.testTypeComparisonName) "equalTo"])+ (tyapps (primitive _lists_map) [Core.typeVariable $ TestTypes.testTypeComparisonName, T.string] @@+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal"),+ "greaterThan">: lambdaTyped "x" T.unit (string "greater")]) @@+ list [injectUnit (TestTypes.testTypeComparisonName) "lessThan",+ injectUnit (TestTypes.testTypeComparisonName) "equalTo"])+ (T.list T.string),+ checkTest "compose match with other functions" []+ (lambda "comp" $+ primitive _strings_length @@+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambda "x" (string "less"),+ "equalTo">: lambda "x" (string "equal"),+ "greaterThan">: lambda "x" (string "greater")] @@+ var "comp"))+ (lambdaTyped "comp" (Core.typeVariable $ TestTypes.testTypeComparisonName) $+ primitive _strings_length @@+ (match (TestTypes.testTypeComparisonName) nothing [+ "lessThan">: lambdaTyped "x" T.unit (string "less"),+ "equalTo">: lambdaTyped "x" T.unit (string "equal"),+ "greaterThan">: lambdaTyped "x" T.unit (string "greater")] @@+ var "comp"))+ (T.function (Core.typeVariable $ TestTypes.testTypeComparisonName) T.int32),+ checkTest "match in lambda body" []+ (lambda "unionValue" $+ match (TestTypes.testTypeNumberName) nothing [+ "int">: lambda "i" (primitive _math_add @@ var "i" @@ int32 1),+ "float">: lambda "f" (int32 0)] @@+ var "unionValue")+ (lambdaTyped "unionValue" (Core.typeVariable $ TestTypes.testTypeNumberName) $+ match (TestTypes.testTypeNumberName) nothing [+ "int">: lambdaTyped "i" T.int32 (primitive _math_add @@ var "i" @@ int32 1),+ "float">: lambdaTyped "f" T.float32 (int32 0)] @@+ var "unionValue")+ (T.function (Core.typeVariable $ TestTypes.testTypeNumberName) T.int32)]++recursiveUnionEliminationsTests :: TBinding TestGroup+recursiveUnionEliminationsTests = define "recursiveUnionEliminationsTests" $+ subgroup "Recursive union eliminations" [+ checkTest "match HydraType recursively" []+ (match (TestTypes.testTypeHydraTypeName) nothing [+ "literal">: lambda "lit" (+ match (TestTypes.testTypeHydraLiteralTypeName) nothing [+ "boolean">: lambda "b" (primitive _literals_showBoolean @@ var "b"),+ "string">: lambda "s" (var "s")] @@+ var "lit"),+ "list">: lambda "nested" (string "list")])+ (match (TestTypes.testTypeHydraTypeName) nothing [+ "literal">: lambdaTyped "lit" (Core.typeVariable $ TestTypes.testTypeHydraLiteralTypeName) (+ match (TestTypes.testTypeHydraLiteralTypeName) nothing [+ "boolean">: lambdaTyped "b" T.boolean (primitive _literals_showBoolean @@ var "b"),+ "string">: lambdaTyped "s" T.string (var "s")] @@+ var "lit"),+ "list">: lambdaTyped "nested" (Core.typeVariable $ TestTypes.testTypeHydraTypeName) (string "list")])+ (T.function (Core.typeVariable $ TestTypes.testTypeHydraTypeName) T.string)]++------ Wrapped terms ------++wrappedTermsTests :: TBinding TestGroup+wrappedTermsTests = define "wrappedTermsTests" $+ supergroup "Wrapped terms" [+ monomorphicWrappedTermsTests,+ polymorphicWrappedTermsTests,+ wrappedTermsInComplexContextsTests,+ nestedWrappedTermsTests,+ multipleWrappingLevelsTests,+ multiParameterPolymorphicWrappersTests]++monomorphicWrappedTermsTests :: TBinding TestGroup+monomorphicWrappedTermsTests = define "monomorphicWrappedTermsTests" $+ subgroup "Monomorphic wrapped terms" [+ noChange "string alias"+ (wrap (TestTypes.testTypeStringAliasName) (string "hello"))+ (Core.typeVariable $ TestTypes.testTypeStringAliasName),+ noChange "wrapped integer"+ (wrap (TestTypes.testTypeStringAliasName) (string "wrapped"))+ (Core.typeVariable $ TestTypes.testTypeStringAliasName),+ checkTest "wrapped in tuple" []+ (tuple [wrap (TestTypes.testTypeStringAliasName) (string "first"),+ string "second"])+ (tyapps (pair+ (wrap (TestTypes.testTypeStringAliasName) (string "first"))+ (string "second"))+ [Core.typeVariable $ TestTypes.testTypeStringAliasName, T.string])+ (T.pair (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string)]++polymorphicWrappedTermsTests :: TBinding TestGroup+polymorphicWrappedTermsTests = define "polymorphicWrappedTermsTests" $+ subgroup "Polymorphic wrapped terms" [+ checkTest "polymorphic wrapper with int" []+ (wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1, int32 2]))+ (tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1, int32 2])) T.int32)+ (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) T.int32),+ checkTest "polymorphic wrapper with string" []+ (wrap (TestTypes.testTypePolymorphicWrapperName) (list [string "a", string "b"]))+ (tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [string "a", string "b"])) T.string)+ (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) T.string),+ checkTest "polymorphic wrapper from lambda" []+ (lambda "x" $ wrap (TestTypes.testTypePolymorphicWrapperName) (list [var "x"]))+ (tylam "t0" $ lambdaTyped "x" (T.var "t0") $ tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [var "x"])) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.var "t0") (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.var "t0")))]++wrappedTermsInComplexContextsTests :: TBinding TestGroup+wrappedTermsInComplexContextsTests = define "wrappedTermsInComplexContextsTests" $+ subgroup "Wrapped terms in complex contexts" [+ noChange "wrapped in record"+ (record (TestTypes.testTypePersonName) [+ "firstName">: (string "John"),+ "lastName">: (string "Doe"),+ "age">: (int32 30)])+ (Core.typeVariable $ TestTypes.testTypePersonName),+ checkTest "wrapped in let binding" []+ (lets ["alias">: wrap (TestTypes.testTypeStringAliasName) (string "test")] $+ var "alias")+ (letsTyped [("alias", wrap (TestTypes.testTypeStringAliasName) (string "test"),+ T.mono $ Core.typeVariable $ TestTypes.testTypeStringAliasName)] $+ var "alias")+ (Core.typeVariable $ TestTypes.testTypeStringAliasName),+ noChange "wrapped in list"+ (list [wrap (TestTypes.testTypeStringAliasName) (string "first"),+ wrap (TestTypes.testTypeStringAliasName) (string "second")])+ (T.list $ Core.typeVariable $ TestTypes.testTypeStringAliasName)]++nestedWrappedTermsTests :: TBinding TestGroup+nestedWrappedTermsTests = define "nestedWrappedTermsTests" $+ subgroup "Nested wrapped terms" [+ checkTest "wrapped tuple" []+ (wrap (TestTypes.testTypePolymorphicWrapperName) (list [tuple [int32 1, string "a"]]))+ (tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [tyapps (pair (int32 1) (string "a")) [T.int32, T.string]])) (T.pair T.int32 T.string))+ (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.pair T.int32 T.string)),+ checkTest "wrapped optional" []+ (wrap (TestTypes.testTypePolymorphicWrapperName) (list [Core.termMaybe $ just $ int32 42]))+ (tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [Core.termMaybe $ just $ int32 42])) (T.optional T.int32))+ (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.optional T.int32)),+ checkTest "wrapped map" []+ (wrap (TestTypes.testTypePolymorphicWrapperName) (list [mapTerm [(string "key", int32 42)]]))+ (tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [mapTerm [(string "key", int32 42)]])) (T.map T.string T.int32))+ (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.map T.string T.int32))]++multipleWrappingLevelsTests :: TBinding TestGroup+multipleWrappingLevelsTests = define "multipleWrappingLevelsTests" $+ subgroup "Multiple wrapping levels" [+ noChange "wrapped in optional"+ (Core.termMaybe $ just $ wrap (TestTypes.testTypeStringAliasName) (string "wrapped"))+ (T.optional $ Core.typeVariable $ TestTypes.testTypeStringAliasName),+ checkTest "list of wrapped polymorphic" []+ (list [wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1]),+ wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 2])])+ (list [tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1])) T.int32,+ tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 2])) T.int32])+ (T.list $ T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) T.int32)]++multiParameterPolymorphicWrappersTests :: TBinding TestGroup+multiParameterPolymorphicWrappersTests = define "multiParameterPolymorphicWrappersTests" $+ subgroup "Multi-parameter polymorphic wrappers" [+ checkTest "symmetric triple wrapping simple types" []+ (wrap (TestTypes.testTypeSymmetricTripleName) $+ record (TestTypes.testTypeTripleName) [+ "first">: (int32 1),+ "second">: (string "edge"),+ "third">: (int32 2)])+ (tyapps (wrap (TestTypes.testTypeSymmetricTripleName) $+ tyapps (record (TestTypes.testTypeTripleName) [+ "first">: (int32 1),+ "second">: (string "edge"),+ "third">: (int32 2)]) [T.int32, T.string, T.int32])+ [T.int32, T.string])+ (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.int32, T.string]),+ checkTest "symmetric triple from lambda" []+ (lambda "v1" $ lambda "e" $ lambda "v2" $+ wrap (TestTypes.testTypeSymmetricTripleName) $+ record (TestTypes.testTypeTripleName) [+ "first">: (var "v1"),+ "second">: (var "e"),+ "third">: (var "v2")])+ (tylams ["t0", "t1"] $+ lambdaTyped "v1" (T.var "t0") $+ lambdaTyped "e" (T.var "t1") $+ lambdaTyped "v2" (T.var "t0") $+ tyapps (wrap (TestTypes.testTypeSymmetricTripleName) $+ tyapps (record (TestTypes.testTypeTripleName) [+ "first">: (var "v1"),+ "second">: (var "e"),+ "third">: (var "v2")]) [T.var "t0", T.var "t1", T.var "t0"])+ [T.var "t0", T.var "t1"])+ (T.forAlls ["t0", "t1"] $+ T.function (T.var "t0") $+ T.function (T.var "t1") $+ T.function (T.var "t0") $+ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]),+ checkTest "symmetric triple with nested polymorphic types and foldl" []+ (lets ["sumList">: lambda "lst" $+ primitive _lists_foldl @@+ (lambda "acc" $ lambda "x" $ primitive _math_add @@ var "acc" @@ var "x") @@+ int32 0 @@+ var "lst"] $+ lambda "nums1" $ lambda "nums2" $+ wrap (TestTypes.testTypeSymmetricTripleName) $+ record (TestTypes.testTypeTripleName) [+ "first">: (var "sumList" @@ var "nums1"),+ "second">: (list [var "nums1", var "nums2"]),+ "third">: (var "sumList" @@ var "nums2")])+ (letsTyped [("sumList",+ lambdaTyped "lst" (T.list T.int32) $+ tyapps (primitive _lists_foldl) [T.int32, T.int32] @@+ (lambdaTyped "acc" T.int32 $ lambdaTyped "x" T.int32 $ primitive _math_add @@ var "acc" @@ var "x") @@+ int32 0 @@+ var "lst",+ T.mono $ T.function (T.list T.int32) T.int32)] $+ lambdaTyped "nums1" (T.list T.int32) $+ lambdaTyped "nums2" (T.list T.int32) $+ tyapps (wrap (TestTypes.testTypeSymmetricTripleName) $+ tyapps (record (TestTypes.testTypeTripleName) [+ "first">: (var "sumList" @@ var "nums1"),+ "second">: (list [var "nums1", var "nums2"]),+ "third">: (var "sumList" @@ var "nums2")])+ [T.int32, T.list (T.list T.int32), T.int32])+ [T.int32, T.list (T.list T.int32)])+ (T.function (T.list T.int32) $+ T.function (T.list T.int32) $+ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.int32, T.list (T.list T.int32)])]++------ Wrap eliminations ------++wrapEliminationsTests :: TBinding TestGroup+wrapEliminationsTests = define "wrapEliminationsTests" $+ supergroup "Wrap eliminations" [+ monomorphicUnwrappingTests,+ polymorphicUnwrappingTests,+ unwrapEliminationsInApplicationsTests,+ unwrapInComplexContextsTests,+ multiParameterPolymorphicUnwrappersTests,+ chainedUnwrappingTests,+ multipleUnwrapOperationsTests]++monomorphicUnwrappingTests :: TBinding TestGroup+monomorphicUnwrappingTests = define "monomorphicUnwrappingTests" $+ subgroup "Monomorphic unwrapping" [+ noChange "unwrap string alias"+ (unwrap (TestTypes.testTypeStringAliasName))+ (T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string)]++polymorphicUnwrappingTests :: TBinding TestGroup+polymorphicUnwrappingTests = define "polymorphicUnwrappingTests" $+ subgroup "Polymorphic unwrapping" [+ checkTest "unwrap polymorphic wrapper" []+ (unwrap (TestTypes.testTypePolymorphicWrapperName))+ (tylam "t0" $ tyapp (unwrap (TestTypes.testTypePolymorphicWrapperName)) (T.var "t0"))+ (T.forAll "t0" $ T.function (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.var "t0")) (T.list $ T.var "t0"))]++unwrapEliminationsInApplicationsTests :: TBinding TestGroup+unwrapEliminationsInApplicationsTests = define "unwrapEliminationsInApplicationsTests" $+ subgroup "Unwrap eliminations in applications" [+ noChange "unwrap applied to wrapped term"+ (unwrap (TestTypes.testTypeStringAliasName) @@ wrap (TestTypes.testTypeStringAliasName) (string "hello"))+ T.string,+ checkTest "unwrap polymorphic applied" []+ (unwrap (TestTypes.testTypePolymorphicWrapperName) @@ wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1, int32 2]))+ (tyapp (unwrap (TestTypes.testTypePolymorphicWrapperName)) T.int32 @@ tyapp (wrap (TestTypes.testTypePolymorphicWrapperName) (list [int32 1, int32 2])) T.int32)+ (T.list T.int32)]++unwrapInComplexContextsTests :: TBinding TestGroup+unwrapInComplexContextsTests = define "unwrapInComplexContextsTests" $+ subgroup "Unwrap in complex contexts" [+ checkTest "unwrap in let binding" []+ (lets ["unwrapper" >: unwrap (TestTypes.testTypeStringAliasName),+ "wrapped" >: wrap (TestTypes.testTypeStringAliasName) (string "test")] $+ var "unwrapper" @@ var "wrapped")+ (letsTyped [+ ("unwrapper", unwrap (TestTypes.testTypeStringAliasName), T.mono $ T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string),+ ("wrapped", wrap (TestTypes.testTypeStringAliasName) (string "test"), T.mono $ Core.typeVariable $ TestTypes.testTypeStringAliasName)] $+ var "unwrapper" @@ var "wrapped")+ T.string,+ checkTest "unwrap in tuple" []+ (tuple [unwrap (TestTypes.testTypeStringAliasName), string "context"])+ (tyapps (pair+ (unwrap (TestTypes.testTypeStringAliasName))+ (string "context"))+ [T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string, T.string])+ (T.pair (T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string) T.string),+ checkTest "unwrap in lambda" []+ (lambda "wrapped" $ unwrap (TestTypes.testTypeStringAliasName) @@ var "wrapped")+ (lambdaTyped "wrapped" (Core.typeVariable $ TestTypes.testTypeStringAliasName) $ unwrap (TestTypes.testTypeStringAliasName) @@ var "wrapped")+ (T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string)]++multiParameterPolymorphicUnwrappersTests :: TBinding TestGroup+multiParameterPolymorphicUnwrappersTests = define "multiParameterPolymorphicUnwrappersTests" $+ subgroup "Multi-parameter polymorphic unwrappers" [+ checkTest "unwrap symmetric triple to tuple" []+ (lambda "st" $+ tuple [+ project (TestTypes.testTypeTripleName) (name "first") @@ (unwrap (TestTypes.testTypeSymmetricTripleName) @@ var "st"),+ project (TestTypes.testTypeTripleName) (name "third") @@ (unwrap (TestTypes.testTypeSymmetricTripleName) @@ var "st")])+ (tylams ["t0", "t1"] $+ lambdaTyped "st" (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]) $+ tyapps (pair+ (tyapps (project (TestTypes.testTypeTripleName) (name "first")) [T.var "t0", T.var "t1", T.var "t0"] @@+ (tyapps (unwrap (TestTypes.testTypeSymmetricTripleName)) [T.var "t0", T.var "t1"] @@ var "st"))+ (tyapps (project (TestTypes.testTypeTripleName) (name "third")) [T.var "t0", T.var "t1", T.var "t0"] @@+ (tyapps (unwrap (TestTypes.testTypeSymmetricTripleName)) [T.var "t0", T.var "t1"] @@ var "st")))+ [T.var "t0", T.var "t0"])+ (T.forAlls ["t0", "t1"] $+ T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"])+ (T.pair (T.var "t0") (T.var "t0"))),+ checkTest "unwrap and collect edges in set" []+ (lets ["getEdge" >: lambda "st" $+ project (TestTypes.testTypeTripleName) (name "second") @@ (unwrap (TestTypes.testTypeSymmetricTripleName) @@ var "st")] $+ lambda "triples" $+ primitive _sets_map @@ var "getEdge" @@ var "triples")+ (tylams ["t0", "t1"] $+ letsTyped [("getEdge",+ tylams ["t2", "t3"] $+ lambdaTyped "st" (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t2", T.var "t3"]) $+ tyapps (project (TestTypes.testTypeTripleName) (name "second")) [T.var "t2", T.var "t3", T.var "t2"] @@+ (tyapps (unwrap (TestTypes.testTypeSymmetricTripleName)) [T.var "t2", T.var "t3"] @@ var "st"),+ T.poly ["t2", "t3"] $ T.function+ (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t2", T.var "t3"])+ (T.var "t3"))] $+ lambdaTyped "triples" (T.set $ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]) $+ tyapps (primitive _sets_map) [T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"], T.var "t1"] @@+ (tyapps (var "getEdge") [T.var "t0", T.var "t1"]) @@+ var "triples")+ (T.forAlls ["t0", "t1"] $+ T.function+ (T.set $ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"])+ (T.set $ T.var "t1")),++ checkTest "unwrap with maybe to handle optional symmetric triple" []+ (lambda "mst" $+ primitive _maybes_maybe @@+ (Core.termMaybe nothing) @@+ (lambda "st" $ Core.termMaybe $+ just $ project (TestTypes.testTypeTripleName) (name "second") @@ (unwrap (TestTypes.testTypeSymmetricTripleName) @@ var "st")) @@+ var "mst")+ (tylams ["t0", "t1"] $+ lambdaTyped "mst" (T.optional $ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]) $+ tyapps (primitive _maybes_maybe)+ [T.optional (T.var "t1"),+ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]] @@+ tyapp (Core.termMaybe nothing) (T.var "t1") @@+ (lambdaTyped "st" (T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"]) $+ Core.termMaybe $ just $+ (tyapps (project (TestTypes.testTypeTripleName) (name "second")) [T.var "t0", T.var "t1", T.var "t0"] @@+ (tyapps (unwrap (TestTypes.testTypeSymmetricTripleName)) [T.var "t0", T.var "t1"] @@ var "st"))) @@+ var "mst")+ (T.forAlls ["t0", "t1"] $+ T.function+ (T.optional $ T.applys (Core.typeVariable $ TestTypes.testTypeSymmetricTripleName) [T.var "t0", T.var "t1"])+ (T.optional $ T.var "t1"))]++chainedUnwrappingTests :: TBinding TestGroup+chainedUnwrappingTests = define "chainedUnwrappingTests" $+ subgroup "Chained unwrapping" [+ checkTest "unwrap then process" []+ (lambda "wrapped" $+ primitive _strings_cat2 @@ (unwrap (TestTypes.testTypeStringAliasName) @@ var "wrapped") @@ string " suffix")+ (lambdaTyped "wrapped" (Core.typeVariable $ TestTypes.testTypeStringAliasName) $+ primitive _strings_cat2 @@ (unwrap (TestTypes.testTypeStringAliasName) @@ var "wrapped") @@ string " suffix")+ (T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string),+ checkTest "unwrap polymorphic then map" []+ (lambda "wrappedList" $+ primitive _lists_map @@ (primitive _math_add @@ int32 1) @@ (unwrap (TestTypes.testTypePolymorphicWrapperName) @@ var "wrappedList"))+ (lambdaTyped "wrappedList" (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) T.int32) $+ (tyapps (primitive _lists_map) [T.int32, T.int32]) @@ (primitive _math_add @@ int32 1) @@ (tyapp (unwrap (TestTypes.testTypePolymorphicWrapperName)) T.int32 @@ var "wrappedList"))+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) T.int32) (T.list T.int32))]++multipleUnwrapOperationsTests :: TBinding TestGroup+multipleUnwrapOperationsTests = define "multipleUnwrapOperationsTests" $+ subgroup "Multiple unwrap operations" [+ checkTest "unwrap different types" []+ (lambda "stringWrapped" $+ lambda "listWrapped" $+ tuple [+ unwrap (TestTypes.testTypeStringAliasName) @@ var "stringWrapped",+ unwrap (TestTypes.testTypePolymorphicWrapperName) @@ var "listWrapped"])+ (tylam "t0" $ lambdaTyped "stringWrapped" (Core.typeVariable $ TestTypes.testTypeStringAliasName) $+ lambdaTyped "listWrapped" (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.var "t0")) $+ tyapps (pair+ (unwrap (TestTypes.testTypeStringAliasName) @@ var "stringWrapped")+ (tyapp (unwrap (TestTypes.testTypePolymorphicWrapperName)) (T.var "t0") @@ var "listWrapped"))+ [T.string, T.list $ T.var "t0"])+ (T.forAll "t0" $ T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName)+ (T.function (T.apply (Core.typeVariable $ TestTypes.testTypePolymorphicWrapperName) (T.var "t0"))+ (T.pair T.string (T.list $ T.var "t0"))))]++------ Eliminations parent group ------++eliminationsTests :: TBinding TestGroup+eliminationsTests = define "eliminationsTests" $+ supergroup "Eliminations" [+ recordEliminationsTests,+ unionEliminationsTests,+ wrapEliminationsTests]++projectionsWithVariablesTests :: TBinding TestGroup+projectionsWithVariablesTests = define "projectionsWithVariablesTests" $+ subgroup "Projections with variables" [+ checkTest "project from lambda parameter" []+ (lambda "person" $ project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (lambdaTyped "person" (T.var "Person") $ project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (T.function (T.var "Person") T.string),+ checkTest "project from polymorphic lambda parameter" []+ (lambda "coords" $ project (TestTypes.testTypeLatLonPolyName) (name "lat") @@ var "coords")+ (tylam "t0" $ lambdaTyped "coords" (T.apply (T.var "LatLonPoly") (T.var "t0")) $ tyapp (project (TestTypes.testTypeLatLonPolyName) (name "lat")) (T.var "t0") @@ var "coords")+ (T.forAll "t0" $ T.function (T.apply (T.var "LatLonPoly") (T.var "t0")) (T.var "t0")),+ checkTest "multiple projections from same record" []+ (lambda "person" $+ tuple [project (TestTypes.testTypePersonName) (name "firstName") @@ var "person",+ project (TestTypes.testTypePersonName) (name "lastName") @@ var "person"])+ (lambdaTyped "person" (T.var "Person") $+ tyapps (pair+ (project (TestTypes.testTypePersonName) (name "firstName") @@ var "person")+ (project (TestTypes.testTypePersonName) (name "lastName") @@ var "person")) [T.string, T.string])+ (T.function (T.var "Person") (T.pair T.string T.string))]+
+ src/main/haskell/Hydra/Sources/Test/EtaExpansion.hs view
@@ -0,0 +1,422 @@++module Hydra.Sources.Test.EtaExpansion where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Prelude hiding (foldl)+++ns :: Namespace+ns = Namespace "hydra.test.etaExpansion"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Test cases for eta expansion of terms")+ where+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = Phantoms.definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for eta expansion of terms" $+ testGroup (Phantoms.string "eta expansion") Phantoms.nothing (Phantoms.list subgroups) (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups = [+ partialApplicationOfPrimitives,+ polymorphicTerms,+ higherOrderFunctions,+ letTerms,+ caseStatements,+ nonExpansionOfEliminations]++ partialApplicationOfPrimitives = testGroup (Phantoms.string "Partial application of primitives") Phantoms.nothing (Phantoms.list subgroups') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups' = [+ barePrimitives,+ partiallyAppliedPrimitives,+ fullyAppliedPrimitives,+ recordProjections]++ barePrimitives = testGroup (Phantoms.string "Bare primitives are not expanded") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "unary primitive"+ toLower,+ noChange "binary primitive"+ splitOn])++ partiallyAppliedPrimitives = testGroup (Phantoms.string "Partially applied primitives expand with lambdas") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "binary primitive with one argument"+ (splitOn @@ string "foo")+ (lambda "v1" $ splitOn @@ string "foo" @@ var "v1"),+ testCase "ternary primitive with one argument"+ (foldl @@ var "f")+ (lambda "v1" $ lambda "v2" $ foldl @@ var "f" @@ var "v1" @@ var "v2")])++ fullyAppliedPrimitives = testGroup (Phantoms.string "Fully applied primitives are not expanded") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "unary primitive"+ (toLower @@ string "FOO"),+ noChange "binary primitive"+ (splitOn @@ string "," @@ string "a,b,c")])++ recordProjections = testGroup (Phantoms.string "Record projections") Phantoms.nothing (Phantoms.list subgroups'') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups'' = [+ bareProjections,+ appliedProjections,+ nestedProjections,+ functionValuedProjections]++ bareProjections = testGroup (Phantoms.string "Bare projections expand with a lambda") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "projection without argument"+ (project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")))+ (lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1")])++ appliedProjections = testGroup (Phantoms.string "Applied projections are not expanded") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "projection with argument"+ (project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "person"),+ noChange "projection applied to a record"+ (project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@+ record TestTypes.testTypePersonName ["firstName">: string "John", "lastName">: string "Doe"])])++ nestedProjections = testGroup (Phantoms.string "Projections nested in other structures") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "projection in a list"+ (list [project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")), toLower])+ (list [lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1", toLower]),+ testCase "projection in a tuple"+ (pair (project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName"))) (string "default"))+ (pair (lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1") (string "default")),+ testCase "projection in let binding"+ (lets ["getter">: project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName"))] (var "getter"))+ (lets ["getter">: lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1"] (var "getter")),+ testCase "projection in lambda body"+ (lambda "x" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")))+ (lambda "x" $ lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1")])++ functionValuedProjections = testGroup (Phantoms.string "Function-valued projections") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "projection of function-valued field applied to arguments should not be expanded"+ (tyapps+ (project TestTypes.testTypeTripleName (Core.name (Phantoms.string "first")))+ [T.function T.string T.string, T.string, T.string]+ @@ tyapps+ (record TestTypes.testTypeTripleName ["first">: primitive _strings_toLower, "second">: string "middle", "third">: string "last"])+ [T.function T.string T.string, T.string, T.string]+ @@ string "DATA")])++ polymorphicTerms = testGroup (Phantoms.string "Polymorphic terms (System F)") Phantoms.nothing (Phantoms.list subgroups') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups' = [+ typeLambdasInLetBindings,+ typeApplicationsOfPolymorphicBindings]++ typeLambdasInLetBindings = testGroup (Phantoms.string "Type lambdas in let bindings") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "polymorphic identity function"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (var "id")),+ testCase "monomorphic partially applied primitive"+ (letsTyped [("partial", splitOn @@ string "foo", T.mono (T.function T.string (T.list T.string)))]+ (var "partial"))+ (letsTyped [("partial", lambda "v1" $ splitOn @@ string "foo" @@ var "v1", T.mono (T.function T.string (T.list T.string)))]+ (var "partial")),+ testCase "monomorphic projection"+ (letsTyped [("getter", project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")), T.mono (T.function (T.var "Person") T.string))]+ (var "getter"))+ (letsTyped [("getter", lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1", T.mono (T.function (T.var "Person") T.string))]+ (var "getter"))])++ typeApplicationsOfPolymorphicBindings = testGroup (Phantoms.string "Type applications of polymorphic bindings") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "polymorphic variable with type application"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (var "id" `tyapp` T.string)),+ noChange "type application of identity applied to binary function with no arguments"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ ((var "id" `tyapp` (T.function T.string (T.function T.string (T.list T.string)))) @@ splitOn)),+ testCase "type application of identity applied to partially applied binary function"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ ((var "id" `tyapp` (T.function T.string (T.list T.string))) @@ (splitOn @@ string ",")))+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))] $+ (var "id" `tyapp` (T.function T.string (T.list T.string))) @@ (lambda "v1" $ splitOn @@ string "," @@ var "v1")),+ noChange "type application of identity applied to fully applied binary function"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ ((var "id" `tyapp` (T.list T.string)) @@ (splitOn @@ string "," @@ string "foo,bar"))),+ testCase "type application of identity applied to binary function, then applied to one argument"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (((var "id" `tyapp` (T.function T.string (T.function T.string (T.list T.string)))) @@ splitOn) @@ string ","))+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (lambda "v1" $ (((var "id" `tyapp` (T.function T.string (T.function T.string (T.list T.string)))) @@ splitOn) @@ string ",") @@ var "v1")),+ noChange "type application of identity applied to binary function, then fully applied to two arguments"+ (letsTyped [("id", tylam "a" (lambda "x" $ var "x"), T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (((var "id" `tyapp` (T.function T.string (T.function T.string (T.list T.string)))) @@ splitOn) @@ string "," @@ string "foo,bar"))])++ higherOrderFunctions = testGroup (Phantoms.string "Higher-Order Functions") Phantoms.nothing (Phantoms.list subgroups') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups' = [functionsThatReturnFunctions]++ functionsThatReturnFunctions = testGroup (Phantoms.string "Functions that return functions") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "lambda returning bare binary primitive"+ (lambda "x" splitOn),+ noChange "lambda returning bare unary primitive"+ (lambda "x" toLower),+ testCase "lambda returning partially applied primitive"+ (lambda "x" $ splitOn @@ string ",")+ (lambda "x" $ lambda "v1" $ splitOn @@ string "," @@ var "v1"),+ noChange "lambda returning fully applied primitive"+ (lambda "x" $ splitOn @@ string "," @@ var "x"),+ testCase "lambda returning bare projection"+ (lambda "person" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")))+ (lambda "person" $ lambda "v1" $ project TestTypes.testTypePersonName (Core.name (Phantoms.string "firstName")) @@ var "v1"),+ testCase "nested lambdas with partial application in body"+ (lambda "x" $ lambda "y" $ splitOn @@ var "x")+ (lambda "x" $ lambda "y" $ lambda "v1" $ splitOn @@ var "x" @@ var "v1"),+ testCase "lambda returning lambda returning partial application"+ (lambda "x" $ lambda "y" $ lambda "z" $ splitOn @@ var "x")+ (lambda "x" $ lambda "y" $ lambda "z" $ lambda "v1" $ splitOn @@ var "x" @@ var "v1")])++ letTerms = testGroup (Phantoms.string "Let terms") Phantoms.nothing (Phantoms.list subgroups') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups' = [partialApplicationOfLetBoundFunction]++ partialApplicationOfLetBoundFunction = testGroup (Phantoms.string "partial application of a let-bound function") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "simple"+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ var "helper" @@ string "foo")+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ lambda "v1" $ lambda "v2" $ var "helper" @@ string "foo" @@ var "v1" @@ var "v2"),+ testCase "in a fold"+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ (tyapps foldl [T.string, T.string])+ @@ (var "helper" @@ string "foo")+ @@ string ""+ @@ list [string "bar", string "baz"])+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ (tyapps foldl [T.string, T.string])+ @@ (lambda "v1" $ lambda "v2" $ var "helper" @@ string "foo" @@ var "v1" @@ var "v2")+ @@ string ""+ @@ list [string "bar", string "baz"]),+ testCase "within another let binding"+ (letsTyped+ [("tryme",+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ var "helper" @@ string "foo"),+ T.mono $ T.functionMany [T.string, T.string, T.string])] $+ unit)+ (letsTyped+ [("tryme",+ (letsTyped+ [("helper",+ lambda "arg1" $ lambda "arg2" $ lambda "arg3" $+ cat @@ list [var "arg1", var "arg2", var "arg3"],+ T.mono $ T.functionMany [T.string, T.string, T.string, T.string])] $+ lambda "v1" $ lambda "v2" $ var "helper" @@ string "foo" @@ var "v1" @@ var "v2"),+ T.mono $ T.functionMany [T.string, T.string, T.string])] $+ unit)])++ caseStatements = testGroup (Phantoms.string "Case statements") Phantoms.nothing (Phantoms.list subgroups') (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups' = [+ monomorphicAtTopLevel,+ monomorphicInLetBinding,+ polymorphicInLetBinding,+ forcedExpansionInCaseBranches]++ monomorphicAtTopLevel = testGroup (Phantoms.string "monomorphic at top level") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "non-applied case statement"+ (match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambda "s" $ var "s"])+ (lambda "v1" $ (match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambda "s" $ var "s"])+ @@ var "v1"),+ noChange "applied case statement"+ ((match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambdaTyped "s" T.string $ var "s"])+ @@ (inject TestTypes.testTypeUnionMonomorphicName "string" (string "foo"))),+ noChange "applied case statement in lambda"+ (lambdaTyped "x" (Core.typeVariable TestTypes.testTypeUnionMonomorphicName) $ (match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambdaTyped "s" T.string $ var "s"])+ @@ var "x")])++ monomorphicInLetBinding = testGroup (Phantoms.string "monomorphic in let binding") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "non-applied case statement"+ (letsTyped [+ ("test",+ match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambda "s" $ var "s"],+ T.mono $ T.function (Core.typeVariable TestTypes.testTypeUnionMonomorphicName) T.string)]+ (string "ignored"))+ (letsTyped [+ ("test",+ lambda "v1" $ match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambda "s" $ var "s"] @@ var "v1",+ T.mono $ T.function (Core.typeVariable TestTypes.testTypeUnionMonomorphicName) T.string)]+ (string "ignored")),+ noChange "applied case statement"+ (letsTyped [+ ("test",+ (match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambdaTyped "s" T.string $ var "s"])+ @@ (inject TestTypes.testTypeUnionMonomorphicName "string" (string "foo")),+ T.mono $ T.string)]+ (string "ignored")),+ noChange "applied case statement in lambda"+ (letsTyped [+ ("test",+ lambdaTyped "x" (Core.typeVariable TestTypes.testTypeUnionMonomorphicName) $ (match TestTypes.testTypeUnionMonomorphicName+ (just $ string "other") [+ "string">: lambdaTyped "s" T.string $ var "s"])+ @@ var "x",+ T.mono $ T.function T.string T.string)]+ (string "ignored"))])++ polymorphicInLetBinding = testGroup (Phantoms.string "polymorphic in let binding") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "non-applied UnionPolymorphicRecursive"+ (letsTyped [+ ("test",+ tyapp (match TestTypes.testTypeUnionPolymorphicRecursiveName+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32,+ T.mono $ T.function (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string)] $+ var "test")+ (letsTyped [+ ("test",+ lambda "v1" $ tyapp (match TestTypes.testTypeUnionPolymorphicRecursiveName+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32+ @@ var "v1",+ T.mono $ T.function (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string)] $+ var "test"),+ noChange "applied UnionPolymorphicRecursive with int32"+ (letsTyped [+ ("test",+ tyapp (match TestTypes.testTypeUnionPolymorphicRecursiveName+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32+ @@ tyapp (inject TestTypes.testTypeUnionPolymorphicRecursiveName "value" (int32 42)) T.int32,+ T.mono $ T.string)] $+ var "test"),+ noChange "applied UnionPolymorphicRecursive with int32 in lambda"+ (letsTyped [+ ("test",+ lambdaTyped "x" (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) $+ tyapp (match TestTypes.testTypeUnionPolymorphicRecursiveName+ (just $ string "other") [+ "value">: lambdaTyped "i" T.int32 $ primitive _literals_showInt32 @@ var "i"]) T.int32+ @@ var "x",+ T.mono $ T.function (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) T.int32) T.string)] $+ var "test"),+ noChange "applied generic UnionPolymorphicRecursive in lambda"+ (tylam "t0" $ letsTyped [+ ("test",+ tylam "t1" $ lambdaTyped "x" (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t1")) $+ tyapp (match TestTypes.testTypeUnionPolymorphicRecursiveName+ (just $ string "other") [+ "value">: lambdaTyped "ignored" (T.var "t1") $ string "foo"]) (T.var "t1")+ @@ var "x",+ T.poly ["t1"] $ T.function (T.apply (Core.typeVariable TestTypes.testTypeUnionPolymorphicRecursiveName) (T.var "t1")) T.string)] $+ tyapp (var "test") $ T.var "t0")])++ forcedExpansionInCaseBranches = testGroup (Phantoms.string "Forced expansion in case statement branches") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ testCase "variable reference in case branch is expanded"+ (letsTyped [("handler", toLower, T.mono (T.function T.string T.string))] $+ match TestTypes.testTypeUnionMonomorphicName nothing+ ["bool">: lambda "ignored" $ string "boolean value",+ "string">: var "handler",+ "unit">: lambda "ignored" $ string "unit value"])+ (letsTyped [("handler", toLower, T.mono (T.function T.string T.string))] $+ lambda "v1" $ match TestTypes.testTypeUnionMonomorphicName nothing+ ["bool">: lambda "ignored" $ string "boolean value",+ "string">: lambda "v1" $ var "handler" @@ var "v1",+ "unit">: lambda "ignored" $ string "unit value"] @@ var "v1"),+ testCase "bare primitive in case branch is expanded"+ (match TestTypes.testTypeUnionMonomorphicName nothing+ ["bool">: lambda "ignored" $ string "boolean value",+ "string">: toLower,+ "unit">: lambda "ignored" $ string "unit value"])+ (lambda "v1" $ match TestTypes.testTypeUnionMonomorphicName nothing+ ["bool">: lambda "ignored" $ string "boolean value",+ "string">: lambda "v1" $ toLower @@ var "v1",+ "unit">: lambda "ignored" $ string "unit value"] @@ var "v1"),+ noChange "variable reference outside case branch is not expanded"+ (lets ["handler">: toLower] $ var "handler"),+ noChange "bare primitive outside case branch is not expanded"+ toLower])++ nonExpansionOfEliminations = testGroup (Phantoms.string "Non-expansion of eliminations which produce functions") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list [+ noChange "applied case statement"+ (tylams ["t0", "t1"] $+ lambdaTyped "dir" (T.var "hydra.coders.CoderDirection") $+ lambdaTyped "coder" (T.applys (T.var "hydra.compute.Coder") (T.var <$> ["t0", "t0", "t1", "t1"])) $+ match (Core.nameLift _CoderDirection)+ nothing [+ "encode">: lambdaTyped "_" T.unit $+ lambdaTyped "v12" (T.var "t1") $+ tyapps (project (Core.nameLift _Coder) (Core.name (Phantoms.string "encode"))) (T.var <$> ["t0", "t0", "t1", "t1"])+ @@ var "coder" @@ var "v12",+ "decode">: lambdaTyped "_" T.unit $+ lambdaTyped "v12" (T.var "t1") $+ tyapps (project (Core.nameLift _Coder) (Core.name (Phantoms.string "decode"))) (T.var <$> ["t0", "t0", "t1", "t1"])+ @@ var "coder" @@ var "v12"]+ @@ var "dir"),+ noChange "applied projection"+ (tyapps (project TestTypes.testTypeTripleName (Core.name (Phantoms.string "third"))) [T.int32, T.int32, T.function T.string T.string]+ @@ (record TestTypes.testTypeTripleName [+ "first">: int32 42,+ "second">: int32 137,+ "third">: lambda "s" $ toLower @@ var "s"]))])++-- Helpers++testCase :: String -> TTerm Term -> TTerm Term -> TTerm TestCaseWithMetadata+testCase name input output = testCaseWithMetadata (Phantoms.string name) tcase Phantoms.nothing (Phantoms.list ([] :: [TTerm Tag]))+ where+ tcase = testCaseEtaExpansion $ etaExpansionTestCase input output++noChange :: String -> TTerm Term -> TTerm TestCaseWithMetadata+noChange name term = testCase name term term++cat = primitive $ _strings_cat+foldl = primitive $ _lists_foldl+splitOn = primitive $ _strings_splitOn+toLower = primitive $ _strings_toLower+--toLower = Core.termFunction $ Core.functionPrimitive $ Core.name (Phantoms.string "hydra.lib.strings.toLower")
src/main/haskell/Hydra/Sources/Test/Formatting.hs view
@@ -1,15 +1,52 @@-module Hydra.Sources.Test.Formatting (formattingTests) where+module Hydra.Sources.Test.Formatting where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Dsl.Tests-import Hydra.Dsl.ShorthandTypes-import Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M +import qualified Hydra.Dsl.Meta.Util as Util+import qualified Hydra.Show.Util as ShowUtil -formattingTests :: TestGroup-formattingTests = TestGroup "formatting tests" Nothing [] cases++ns :: Namespace+ns = Namespace "hydra.test.formatting"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Test cases for string formatting and case conversion") where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding caseConversionTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for hydra.formatting" $+ Testing.testGroup (Phantoms.string "formatting") Phantoms.nothing (Phantoms.list subgroups) (Phantoms.list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups = [+ caseConversionTests]++caseConversionTests :: TBinding TestGroup+caseConversionTests = define "caseConversionTests" $+ Phantoms.doc "Test cases for case conversion" $+ Testing.testGroup (Phantoms.string "case conversion") Phantoms.nothing (Phantoms.list ([] :: [TTerm TestGroup])) (Phantoms.list cases)+ where cases = [ -- from lower_snake_case testCase 1 CaseConventionLowerSnake CaseConventionUpperSnake "a_hello_world_42_a42_42a_b" "A_HELLO_WORLD_42_A42_42A_B",@@ -35,13 +72,19 @@ testCase 15 CaseConventionPascal CaseConventionCamel "AHelloWorld42A4242aB" "aHelloWorld42A4242aB", testCase 16 CaseConventionPascal CaseConventionPascal "AHelloWorld42A4242aB" "AHelloWorld42A4242aB"] - testCase i fromConvention toConvention fromString toString = TestCaseWithMetadata name tcase Nothing []- where- tcase = TestCaseCaseConversion $ CaseConversionTestCase fromConvention toConvention fromString toString- name = "#" ++ show i ++ " (" ++ showConvention fromConvention ++ " -> " ++ showConvention toConvention ++ ")"+-- Helpers - showConvention c = case c of- CaseConventionLowerSnake -> "lower_snake_case"- CaseConventionUpperSnake -> "UPPER_SNAKE_CASE"- CaseConventionCamel -> "camelCase"- CaseConventionPascal -> "PascalCase"+testCase :: Int -> CaseConvention -> CaseConvention -> String -> String -> TTerm TestCaseWithMetadata+testCase i fromConvention toConvention fromString toString = Testing.testCaseWithMetadata name tcase Phantoms.nothing (Phantoms.list ([] :: [TTerm Tag]))+ where+ tcase = Testing.testCaseCaseConversion $ Testing.caseConversionTestCase+ (metaConv fromConvention)+ (metaConv toConvention)+ (Phantoms.string fromString)+ (Phantoms.string toString)+ name = Phantoms.string $ "#" ++ show i ++ " (" ++ ShowUtil.caseConvention fromConvention ++ " -> " ++ ShowUtil.caseConvention toConvention ++ ")"+ metaConv conv = case conv of+ CaseConventionLowerSnake -> Util.caseConventionLowerSnake+ CaseConventionUpperSnake -> Util.caseConventionUpperSnake+ CaseConventionCamel -> Util.caseConventionCamel+ CaseConventionPascal -> Util.caseConventionPascal
+ src/main/haskell/Hydra/Sources/Test/Hoisting.hs view
@@ -0,0 +1,2137 @@+-- | Test cases for hoisting transformations+module Hydra.Sources.Test.Hoisting where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.hoisting"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hoisting transformations"+ where+ elements = [Phantoms.toBinding allTests]++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hoisting transformations" $+ supergroup "hoisting" [+ hoistSubtermsGroup,+ hoistCaseStatementsGroup,+ hoistLetBindingsGroup,+ hoistPolymorphicLetBindingsGroup,+ hoistPolymorphicTypeParametersGroup]++-- Helper to build names+nm :: String -> TTerm Name+nm s = Core.name $ Phantoms.string s++-- Helper to build an empty annotation map+emptyAnnMap :: TTerm (M.Map Name Term)+emptyAnnMap = Phantoms.map M.empty++-- Helper for single-binding let+letExpr :: String -> TTerm Term -> TTerm Term -> TTerm Term+letExpr varName value body = lets [(nm varName, value)] body++-- Helper for multi-binding let+multiLet :: [(String, TTerm Term)] -> TTerm Term -> TTerm Term+multiLet bindings body = lets ((\(n, v) -> (nm n, v)) <$> bindings) body++-- | Test cases for hoistSubterms+-- This function hoists subterms matching a predicate into local let bindings.+-- The predicate receives the term and returns True if the term should be hoisted.+-- For each let term, immediate subterms (binding values and body) are processed:+-- matching subterms are collected and hoisted into a local let that wraps+-- that immediate subterm.+hoistSubtermsGroup :: TTerm TestGroup+hoistSubtermsGroup = subgroup "hoistSubterms" [+ -- ============================================================+ -- Test: hoistNothing predicate (identity transformation)+ -- The hoistNothing predicate never hoists anything.+ -- ============================================================++ hoistCase "hoistNothing: simple let unchanged"+ hoistPredicateNothing+ -- Input: let x = 42 in x+ (letExpr "x" (int32 42) (var "x"))+ -- Output: unchanged+ (letExpr "x" (int32 42) (var "x")),++ hoistCase "hoistNothing: let with list in body unchanged"+ hoistPredicateNothing+ -- Input: let x = 1 in [x, 2, 3]+ (letExpr "x" (int32 1) (list [var "x", int32 2, int32 3]))+ -- Output: unchanged - hoistNothing never hoists+ (letExpr "x" (int32 1) (list [var "x", int32 2, int32 3])),++ hoistCase "hoistNothing: let with application in body unchanged"+ hoistPredicateNothing+ -- Input: let f = g in f (h 42)+ (letExpr "f" (var "g") (apply (var "f") (apply (var "h") (int32 42))))+ -- Output: unchanged+ (letExpr "f" (var "g") (apply (var "f") (apply (var "h") (int32 42)))),++ -- ============================================================+ -- Test: hoistLists predicate+ -- Hoists list terms. Matching subterms within an immediate subterm+ -- are collected and wrapped in a local let around that subterm.+ -- ============================================================++ hoistCase "hoistLists: list in body is hoisted into local let"+ hoistPredicateLists+ -- Input: let x = 1 in f [1, 2, 3]+ (letExpr "x" (int32 1) (apply (var "f") (list [int32 1, int32 2, int32 3])))+ -- Output: body is wrapped in local let with hoisted list+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (list [int32 1, int32 2, int32 3])+ (apply (var "f") (var "_hoist__body_1")))),++ hoistCase "hoistLists: multiple lists in body are hoisted together"+ hoistPredicateLists+ -- Input: let x = 1 in pair [1, 2] [3, 4]+ (letExpr "x" (int32 1)+ (apply (apply (var "pair") (list [int32 1, int32 2]))+ (list [int32 3, int32 4])))+ -- Output: body is wrapped in local let with both hoisted lists+ (letExpr "x" (int32 1)+ (multiLet [+ ("_hoist__body_1", list [int32 1, int32 2]),+ ("_hoist__body_2", list [int32 3, int32 4])]+ (apply (apply (var "pair") (var "_hoist__body_1")) (var "_hoist__body_2")))),++ hoistCase "hoistLists: list in binding value is hoisted into local let"+ hoistPredicateLists+ -- Input: let x = f [1, 2] in x+ (letExpr "x" (apply (var "f") (list [int32 1, int32 2])) (var "x"))+ -- Output: binding value is wrapped in local let+ (letExpr "x"+ (letExpr "_hoist_x_1" (list [int32 1, int32 2])+ (apply (var "f") (var "_hoist_x_1")))+ (var "x")),++ hoistCase "hoistLists: nested lists hoisted from inside out"+ hoistPredicateLists+ -- Input: let x = 1 in f [[1, 2], 3]+ (letExpr "x" (int32 1)+ (apply (var "f") (list [list [int32 1, int32 2], int32 3])))+ -- Output: inner list hoisted first, then outer list+ (letExpr "x" (int32 1)+ (multiLet [+ ("_hoist__body_1", list [int32 1, int32 2]),+ ("_hoist__body_2", list [var "_hoist__body_1", int32 3])]+ (apply (var "f") (var "_hoist__body_2")))),++ -- ============================================================+ -- Test: hoistApplications predicate+ -- Hoists function applications.+ -- ============================================================++ hoistCase "hoistApplications: application in list element is hoisted"+ hoistPredicateApplications+ -- Input: let x = 1 in [f x, y]+ (letExpr "x" (int32 1)+ (list [apply (var "f") (var "x"), var "y"]))+ -- Output: body is wrapped in local let+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (apply (var "f") (var "x"))+ (list [var "_hoist__body_1", var "y"]))),++ hoistCase "hoistApplications: application in record field is hoisted"+ hoistPredicateApplications+ -- Input: let x = 1 in {value: f x}+ (letExpr "x" (int32 1)+ (record (nm "Data") [(nm "value", apply (var "f") (var "x"))]))+ -- Output: body is wrapped in local let+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (apply (var "f") (var "x"))+ (record (nm "Data") [(nm "value", var "_hoist__body_1")]))),++ hoistCase "hoistApplications: nested applications hoisted from inside out"+ hoistPredicateApplications+ -- Input: let x = 1 in [f (g x)]+ (letExpr "x" (int32 1)+ (list [apply (var "f") (apply (var "g") (var "x"))]))+ -- Output: inner application hoisted first, then outer+ (letExpr "x" (int32 1)+ (multiLet [+ ("_hoist__body_1", apply (var "g") (var "x")),+ ("_hoist__body_2", apply (var "f") (var "_hoist__body_1"))]+ (list [var "_hoist__body_2"]))),++ -- ============================================================+ -- Test: hoistCaseStatements predicate+ -- Hoists case/match statements.+ -- ============================================================++ hoistCase "hoistCaseStatements: case in application argument is hoisted"+ hoistPredicateCaseStatements+ -- Input: let x = just 42 in f (match x with just y -> y | nothing -> 0)+ (letExpr "x" (optional $ just $ int32 42)+ (apply (var "f")+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])))+ -- Output: body is wrapped in local let with hoisted case+ (letExpr "x" (optional $ just $ int32 42)+ (letExpr "_hoist__body_1"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (var "f") (var "_hoist__body_1")))),++ hoistCase "hoistCaseStatements: case in list element is hoisted"+ hoistPredicateCaseStatements+ -- Input: let x = 1 in [match y with ok -> x | err -> 0]+ (letExpr "x" (int32 1)+ (list [match (nm "Result") (just $ var "y")+ [(nm "ok", var "x"),+ (nm "err", int32 0)]]))+ -- Output: body is wrapped in local let+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1"+ (match (nm "Result") (just $ var "y")+ [(nm "ok", var "x"),+ (nm "err", int32 0)])+ (list [var "_hoist__body_1"]))),++ -- ============================================================+ -- Test: Nested let expressions+ -- Each let is processed independently; inner lets are processed first.+ -- ============================================================++ hoistCase "hoistLists: nested let - inner let processed independently"+ hoistPredicateLists+ -- Input: let x = 1 in (let y = 2 in f [x, y])+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (apply (var "f") (list [var "x", var "y"]))))+ -- Output: the list is hoisted in the inner let's body+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (letExpr "_hoist__body_1" (list [var "x", var "y"])+ (apply (var "f") (var "_hoist__body_1"))))),++ -- ============================================================+ -- Test: Non-let terms are unchanged+ -- hoistSubterms only processes let expressions.+ -- ============================================================++ hoistCase "hoistLists: non-let term is unchanged"+ hoistPredicateLists+ -- Input: f [1, 2, 3] (no enclosing let)+ (apply (var "f") (list [int32 1, int32 2, int32 3]))+ -- Output: unchanged - no let to hoist into+ (apply (var "f") (list [int32 1, int32 2, int32 3])),++ hoistCase "hoistApplications: bare application unchanged"+ hoistPredicateApplications+ -- Input: f (g x) (no enclosing let)+ (apply (var "f") (apply (var "g") (var "x")))+ -- Output: unchanged+ (apply (var "f") (apply (var "g") (var "x"))),++ -- ============================================================+ -- Test: Lambda-bound variable capture during hoisting+ -- When hoisting a term that contains free variables which are+ -- lambda-bound at an enclosing scope within the immediate subterm,+ -- those variables must be captured: the hoisted binding is wrapped+ -- in lambdas for those variables, and the reference is replaced+ -- with an application of those variables.+ -- ============================================================++ -- Case 1: Hoisted term refers to let-bound variable (no capture needed)+ hoistCase "hoistLists: term referring to let-bound variable needs no capture"+ hoistPredicateLists+ -- Input: let x = 1 in f [x, 2]+ -- The list refers to x which is let-bound, not lambda-bound+ (letExpr "x" (int32 1)+ (apply (var "f") (list [var "x", int32 2])))+ -- Output: list is hoisted without any lambda wrapping+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (list [var "x", int32 2])+ (apply (var "f") (var "_hoist__body_1")))),++ -- Case 2: Hoisted term refers to lambda-bound variable ABOVE the let (no capture needed)+ hoistCase "hoistLists: term referring to lambda above let needs no capture"+ hoistPredicateLists+ -- Input: \y -> let x = 1 in f [y, x]+ -- y is lambda-bound above the let, so it's not in the immediate subterm's scope+ (lambda "y"+ (letExpr "x" (int32 1)+ (apply (var "f") (list [var "y", var "x"]))))+ -- Output: list is hoisted without lambda wrapping (y was bound before let)+ (lambda "y"+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (list [var "y", var "x"])+ (apply (var "f") (var "_hoist__body_1"))))),++ -- Case 3: Lambda-bound variable between let and hoisted term, but NOT free in hoisted term+ hoistCase "hoistLists: lambda-bound var not free in hoisted term needs no capture"+ hoistPredicateLists+ -- Input: let x = 1 in (\y -> f [x, 2])+ -- y is lambda-bound between let and list, but y does not appear in the list [x, 2]+ -- So [x, 2] should be hoisted without capturing y+ (letExpr "x" (int32 1)+ (lambda "y" (apply (var "f") (list [var "x", int32 2]))))+ -- Output: list [x, 2] is hoisted without lambda wrapping for y (y not free in list)+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (list [var "x", int32 2])+ (lambda "y" (apply (var "f") (var "_hoist__body_1"))))),++ -- Case 4: Lambda-bound variable between let and hoisted term, IS free in hoisted term+ hoistCase "hoistLists: lambda-bound var free in hoisted term requires capture"+ hoistPredicateLists+ -- Input: let x = 1 in (\y -> f [x, y])+ -- y is lambda-bound between let and list, and y appears in the list [x, y]+ -- So [x, y] should be hoisted with y captured+ (letExpr "x" (int32 1)+ (lambda "y" (apply (var "f") (list [var "x", var "y"]))))+ -- Output: _hoist__body_1 = \y -> [x, y], reference becomes _hoist__body_1 y+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (lambda "y" (list [var "x", var "y"]))+ (lambda "y" (apply (var "f") (apply (var "_hoist__body_1") (var "y")))))),++ -- Case 5: Multiple lambda-bound variables, only some free in hoisted term+ hoistCase "hoistLists: only free lambda-bound vars are captured"+ hoistPredicateLists+ -- Input: let x = 1 in (\a -> \b -> f [x, b])+ -- Both a and b are lambda-bound between let and list+ -- But only b appears in the list [x, b], so only b is captured+ (letExpr "x" (int32 1)+ (lambda "a" (lambda "b" (apply (var "f") (list [var "x", var "b"])))))+ -- Output: _hoist__body_1 = \b -> [x, b], reference becomes _hoist__body_1 b+ (letExpr "x" (int32 1)+ (letExpr "_hoist__body_1" (lambda "b" (list [var "x", var "b"]))+ (lambda "a" (lambda "b" (apply (var "f") (apply (var "_hoist__body_1") (var "b"))))))),++ -- ============================================================+ -- Test: Stable naming for sibling immediate subterms+ -- Each sibling uses its parent binding name as a prefix, ensuring+ -- that changes to one sibling don't affect the names in another.+ -- ============================================================++ hoistCase "hoistLists: stable naming for binding and body"+ hoistPredicateLists+ -- Input: let x = f [1, 2] in g [3, 4]+ -- Both binding value and body have lists to hoist+ (letExpr "x" (apply (var "f") (list [int32 1, int32 2]))+ (apply (var "g") (list [int32 3, int32 4])))+ -- Output: binding uses _hoist_x_1, body uses _hoist__body_1+ (letExpr "x"+ (letExpr "_hoist_x_1" (list [int32 1, int32 2])+ (apply (var "f") (var "_hoist_x_1")))+ (letExpr "_hoist__body_1" (list [int32 3, int32 4])+ (apply (var "g") (var "_hoist__body_1")))),++ hoistCase "hoistLists: stable naming for multiple bindings"+ hoistPredicateLists+ -- Input: let x = f [1]; y = g [2] in x+ (multiLet [+ ("x", apply (var "f") (list [int32 1])),+ ("y", apply (var "g") (list [int32 2]))]+ (var "x"))+ -- Output: each binding uses its own name as prefix (_hoist_x_1, _hoist_y_1)+ (multiLet [+ ("x", letExpr "_hoist_x_1" (list [int32 1])+ (apply (var "f") (var "_hoist_x_1"))),+ ("y", letExpr "_hoist_y_1" (list [int32 2])+ (apply (var "g") (var "_hoist_y_1")))]+ (var "x")),++ -- ============================================================+ -- Test: Polymorphic recursion - this is the key test case+ -- The new local-let approach avoids polymorphic mutual recursion+ -- by keeping hoisted bindings local to each immediate subterm.+ -- ============================================================++ hoistCase "hoistLists: polymorphic binding with self-reference below hoisted term"+ hoistPredicateLists+ -- Input: let f = \x -> pair (f x) [x, 1] in f 42+ -- f is polymorphic and has a self-reference, with a list below it+ -- With sibling hoisting, this would create: let f = ...; _hoist_f_1 = [x, 1] in ...+ -- which causes polymorphic mutual recursion issues.+ -- With local hoisting, we get: let f = (let _hoist_f_1 = ... in ...) in ...+ -- which is polymorphic nesting (OK) rather than mutual recursion.+ (letExpr "f"+ (lambda "x" (apply (apply (var "pair") (apply (var "f") (var "x")))+ (list [var "x", int32 1])))+ (apply (var "f") (int32 42)))+ -- Output: the list is hoisted into a local let within f's binding value+ (letExpr "f"+ (letExpr "_hoist_f_1" (lambda "x" (list [var "x", int32 1]))+ (lambda "x" (apply (apply (var "pair") (apply (var "f") (var "x")))+ (apply (var "_hoist_f_1") (var "x")))))+ (apply (var "f") (int32 42)))]++-- | Test cases for hoistCaseStatements+-- This function hoists case statements (eliminations) that are NOT at "top level".+-- Top level means: the root, or reachable through annotations, lambda bodies,+-- or ONE application LHS. Case statements at top level can become Python match+-- statements; those not at top level need to be hoisted.+hoistCaseStatementsGroup :: TTerm TestGroup+hoistCaseStatementsGroup = subgroup "hoistCaseStatements" [+ -- ============================================================+ -- Test: Case statement at top level - should NOT be hoisted+ -- ============================================================++ hoistCaseStatementsCase "case at top level of let body is NOT hoisted"+ -- Input: let x = just 42 in match x with just y -> y | nothing -> 0+ -- The case statement is directly in the let body (top level)+ (letExpr "x" (optional $ just $ int32 42)+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ -- Output: unchanged - case is at top level+ (letExpr "x" (optional $ just $ int32 42)+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])),++ hoistCaseStatementsCase "case in let binding value is NOT hoisted"+ -- Input: let x = match y with just z -> z | nothing -> 0 in x+ -- The case statement is at top level of binding value+ (letExpr "x"+ (match (nm "Optional") (just $ var "y")+ [(nm "just", lambda "z" (var "z")),+ (nm "nothing", int32 0)])+ (var "x"))+ -- Output: unchanged - case is at top level+ (letExpr "x"+ (match (nm "Optional") (just $ var "y")+ [(nm "just", lambda "z" (var "z")),+ (nm "nothing", int32 0)])+ (var "x")),++ hoistCaseStatementsCase "case inside lambda body is NOT hoisted"+ -- Input: let f = \a -> match a with just y -> y | nothing -> 0 in f (just 42)+ -- The case is inside a lambda body, but lambda bodies are pass-through+ -- This becomes def f(a): match a: ... in Python+ (letExpr "f"+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (apply (var "f") (optional $ just $ int32 42)))+ -- Output: unchanged - case is at top level (through lambda body)+ (letExpr "f"+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (apply (var "f") (optional $ just $ int32 42))),++ hoistCaseStatementsCase "case inside nested lambdas is NOT hoisted"+ -- Input: let f = \a -> \b -> match a with ok -> b | err -> 0 in f+ -- The case is inside nested lambdas - still at top level+ -- This becomes def f(a, b): match a: ... in Python+ (letExpr "f"+ (lambda "a" (lambda "b"+ (match (nm "Result") (just $ var "a")+ [(nm "ok", var "b"),+ (nm "err", int32 0)])))+ (var "f"))+ -- Output: unchanged - case is at top level (through lambda bodies)+ (letExpr "f"+ (lambda "a" (lambda "b"+ (match (nm "Result") (just $ var "a")+ [(nm "ok", var "b"),+ (nm "err", int32 0)])))+ (var "f")),++ hoistCaseStatementsCase "case as LHS of one application is NOT hoisted"+ -- Input: let f = (match Optional with ...) x in f+ -- The case is LHS of one application - still at top level (one app LHS allowed)+ -- This is match taking its single argument+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f"))+ -- Output: unchanged - case is at top level (one application LHS)+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f")),++ hoistCaseStatementsCase "case wrapped in annotation is NOT hoisted"+ -- Input: let f = @ann (match Optional with ...) in f+ -- The case is wrapped in annotation - annotations are transparent+ (letExpr "f"+ (annot emptyAnnMap+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "f"))+ -- Output: unchanged - case is at top level (through annotation)+ (letExpr "f"+ (annot emptyAnnMap+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "f")),++ hoistCaseStatementsCase "case in lambda with one application is NOT hoisted"+ -- Input: let f = \a -> (match Optional with ...) a in f+ -- Lambda body + one application LHS = still at top level+ (letExpr "f"+ (lambda "a"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "a")))+ (var "f"))+ -- Output: unchanged - case is at top level+ (letExpr "f"+ (lambda "a"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "a")))+ (var "f")),++ -- ============================================================+ -- Test: Case statement NOT at top level - SHOULD be hoisted+ -- ============================================================++ hoistCaseStatementsCase "case as RHS of application IS hoisted"+ -- Input: let f = g (match Optional with ...) in f+ -- The case is RHS of application (argument position) - NOT top level+ (letExpr "f"+ (apply (var "g")+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (var "g") (var "_hoist_f_1")))+ (var "f")),++ hoistCaseStatementsCase "case in nested application LHS IS hoisted"+ -- Input: let f = ((match Optional with ...) x) y in f+ -- The case is LHS of LHS of application - only ONE app LHS allowed+ -- The second application takes us out of top level+ (letExpr "f"+ (apply+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "z" (lambda "w" (var "z"))),+ (nm "nothing", lambda "w" (int32 0))])+ (var "x"))+ (var "y"))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "z" (lambda "w" (var "z"))),+ (nm "nothing", lambda "w" (int32 0))])+ (apply (apply (var "_hoist_f_1") (var "x")) (var "y")))+ (var "f")),++ hoistCaseStatementsCase "case inside list element IS hoisted"+ -- Input: let f = [match Optional with ...] in f+ -- The case is inside a list element - NOT top level+ (letExpr "f"+ (list [match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]])+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (list [var "_hoist_f_1"]))+ (var "f")),++ hoistCaseStatementsCase "case inside lambda inside list IS hoisted"+ -- Input: let f = [\a -> match a with ...] in f+ -- Even though case is inside lambda, the lambda itself is inside a list+ -- The list position makes it not top level+ (letExpr "f"+ (list [lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])])+ (var "f"))+ -- Output: case is hoisted with 'a' captured+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (list [lambda "a" (apply (var "_hoist_f_1") (var "a"))]))+ (var "f")),++ -- ============================================================+ -- Test: Non-case terms - should NOT be hoisted regardless+ -- ============================================================++ hoistCaseStatementsCase "list inside lambda is NOT hoisted (only case statements)"+ -- Input: let f = \a -> [a, 1, 2] in f 0+ -- The list is not at top level, but hoistCaseStatements only hoists cases+ (letExpr "f"+ (lambda "a" (list [var "a", int32 1, int32 2]))+ (apply (var "f") (int32 0)))+ -- Output: unchanged - only case statements are hoisted+ (letExpr "f"+ (lambda "a" (list [var "a", int32 1, int32 2]))+ (apply (var "f") (int32 0))),++ -- ============================================================+ -- Test: Mixed scenarios+ -- ============================================================++ hoistCaseStatementsCase "case in binding is not hoisted, case in arg position is hoisted"+ -- Input: let x = match a with ... in f (match b with ...)+ -- First case is at top level of binding, second is in argument position+ (letExpr "x"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "z" (var "z")),+ (nm "nothing", int32 0)])+ (apply (var "f")+ (match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "w" (var "w")),+ (nm "nothing", int32 0)])))+ -- Output: only second case is hoisted+ (letExpr "x"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "z" (var "z")),+ (nm "nothing", int32 0)])+ (letExpr "_hoist__body_1"+ (match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "w" (var "w")),+ (nm "nothing", int32 0)])+ (apply (var "f") (var "_hoist__body_1")))),++ -- ============================================================+ -- Test: Mixed let and lambda at top level (no hoisting needed)+ -- ============================================================++ hoistCaseStatementsCase "case in nested let body is NOT hoisted"+ -- Input: let x = 1 in let y = 2 in match z with ...+ -- The case is in nested let body - still at top level+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (match (nm "Optional") (just $ var "z")+ [(nm "just", lambda "w" (var "w")),+ (nm "nothing", int32 0)])))+ -- Output: unchanged+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (match (nm "Optional") (just $ var "z")+ [(nm "just", lambda "w" (var "w")),+ (nm "nothing", int32 0)]))),++ hoistCaseStatementsCase "case in let inside lambda is NOT hoisted"+ -- Input: let f = \a -> let x = 1 in match a with ...+ -- Lambda body then let body - both pass through+ (letExpr "f"+ (lambda "a"+ (letExpr "x" (int32 1)+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])))+ (var "f"))+ -- Output: unchanged+ (letExpr "f"+ (lambda "a"+ (letExpr "x" (int32 1)+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])))+ (var "f")),++ hoistCaseStatementsCase "case in lambda inside let body is NOT hoisted"+ -- Input: let x = 1 in \a -> match a with ...+ -- Let body then lambda body - both pass through+ (letExpr "x" (int32 1)+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])))+ -- Output: unchanged+ (letExpr "x" (int32 1)+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))),++ hoistCaseStatementsCase "case with let+lambda+app is NOT hoisted"+ -- Input: let f = \a -> let x = 1 in (match a with ...) x+ -- Lambda body, let body, one app LHS - all pass through+ (letExpr "f"+ (lambda "a"+ (letExpr "x" (int32 1)+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))))+ (var "f"))+ -- Output: unchanged+ (letExpr "f"+ (lambda "a"+ (letExpr "x" (int32 1)+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))))+ (var "f")),++ -- ============================================================+ -- Test: Multiple applications (hoisting required)+ -- ============================================================++ hoistCaseStatementsCase "case in triple application LHS IS hoisted"+ -- Input: let f = (((match ...) x) y) z in f+ -- Three nested applications - only one app LHS allowed+ (letExpr "f"+ (apply+ (apply+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "a" (lambda "b" (lambda "c" (var "a")))),+ (nm "nothing", lambda "b" (lambda "c" (int32 0)))])+ (var "x"))+ (var "y"))+ (var "z"))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "a" (lambda "b" (lambda "c" (var "a")))),+ (nm "nothing", lambda "b" (lambda "c" (int32 0)))])+ (apply (apply (apply (var "_hoist_f_1") (var "x")) (var "y")) (var "z")))+ (var "f")),++ hoistCaseStatementsCase "case as second argument IS hoisted"+ -- Input: let f = g x (match ...) in f+ -- Case is RHS of second application+ (letExpr "f"+ (apply (apply (var "g") (var "x"))+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (apply (var "g") (var "x")) (var "_hoist_f_1")))+ (var "f")),++ hoistCaseStatementsCase "case in both arguments - both hoisted"+ -- Input: let f = g (match a ...) (match b ...) in f+ -- Both cases are in argument positions+ (letExpr "f"+ (apply+ (apply (var "g")+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)]))+ (match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)]))+ (var "f"))+ -- Output: both cases hoisted into a SINGLE let with two bindings+ -- (hoistSubterms collects all hoistable terms from one subterm into one let)+ (letExpr "f"+ (lets+ [(nm "_hoist_f_1",+ match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)]),+ (nm "_hoist_f_2",+ match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)])]+ (apply (apply (var "g") (var "_hoist_f_1")) (var "_hoist_f_2")))+ (var "f")),++ -- ============================================================+ -- Test: Descent into various structures (hoisting required)+ -- ============================================================++ hoistCaseStatementsCase "case in second list element IS hoisted"+ -- Input: let f = [1, match ...] in f+ (letExpr "f"+ (list [int32 1,+ match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]])+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (list [int32 1, var "_hoist_f_1"]))+ (var "f")),++ hoistCaseStatementsCase "multiple cases in list - all hoisted"+ -- Input: let f = [match a ..., match b ...] in f+ (letExpr "f"+ (list [+ match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)],+ match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)]])+ (var "f"))+ -- Output: both cases hoisted into a SINGLE let with two bindings+ (letExpr "f"+ (lets+ [(nm "_hoist_f_1",+ match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)]),+ (nm "_hoist_f_2",+ match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)])]+ (list [var "_hoist_f_1", var "_hoist_f_2"]))+ (var "f")),++ hoistCaseStatementsCase "case in pair first element IS hoisted"+ -- Input: let f = (match ..., 1) in f+ (letExpr "f"+ (pair+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (int32 1))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (pair (var "_hoist_f_1") (int32 1)))+ (var "f")),++ hoistCaseStatementsCase "case in pair second element IS hoisted"+ -- Input: let f = (1, match ...) in f+ (letExpr "f"+ (pair+ (int32 1)+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "f"))+ -- Output: case is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (pair (int32 1) (var "_hoist_f_1")))+ (var "f")),++ -- ============================================================+ -- Test: Nested let terms - case hoisted into CHILD let, not parent+ -- This is critical: hoisting is local to immediate subterms+ -- ============================================================++ hoistCaseStatementsCase "case in child let binding hoisted into child"+ -- Input: let outer = (let inner = g (match ...) in inner) in outer+ -- The case is in the binding of inner let, inside argument position+ -- It should be hoisted into the inner let, not the outer+ (letExpr "outer"+ (letExpr "inner"+ (apply (var "g")+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "inner"))+ (var "outer"))+ -- Output: case hoisted into inner let's binding+ (letExpr "outer"+ (letExpr "inner"+ (letExpr "_hoist_inner_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (var "g") (var "_hoist_inner_1")))+ (var "inner"))+ (var "outer")),++ hoistCaseStatementsCase "case in child let body hoisted into child"+ -- Input: let outer = (let inner = 1 in g (match ...)) in outer+ -- The case is in the body of inner let, inside argument position+ -- It should be hoisted into the inner let's body, not the outer+ (letExpr "outer"+ (letExpr "inner" (int32 1)+ (apply (var "g")+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])))+ (var "outer"))+ -- Output: case hoisted into inner let's body+ (letExpr "outer"+ (letExpr "inner" (int32 1)+ (letExpr "_hoist__body_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (var "g") (var "_hoist__body_1"))))+ (var "outer")),++ hoistCaseStatementsCase "case at top level of child let NOT hoisted"+ -- Input: let outer = (let inner = match ... in inner) in outer+ -- The case is at top level of inner let's binding - no hoisting needed+ (letExpr "outer"+ (letExpr "inner"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "inner"))+ (var "outer"))+ -- Output: unchanged+ (letExpr "outer"+ (letExpr "inner"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "inner"))+ (var "outer")),++ hoistCaseStatementsCase "cases in both outer and child - each hoisted locally"+ -- Input: let outer = f (match a ...) (let inner = g (match b ...) in inner) in outer+ -- First case in outer's body (arg position), second in inner's binding (arg position)+ -- Each should be hoisted into its respective scope+ -- Each binding uses its name as prefix: inner gets _hoist_inner_1, outer gets _hoist_outer_1+ (letExpr "outer"+ (apply+ (apply (var "f")+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)]))+ (letExpr "inner"+ (apply (var "g")+ (match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)]))+ (var "inner")))+ (var "outer"))+ -- Output: outer binding gets _hoist_outer_1, inner binding gets _hoist_inner_1+ (letExpr "outer"+ (letExpr "_hoist_outer_1"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "x" (var "x")),+ (nm "nothing", int32 0)])+ (apply+ (apply (var "f") (var "_hoist_outer_1"))+ (letExpr "inner"+ (letExpr "_hoist_inner_1"+ (match (nm "Optional") (just $ var "b")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 1)])+ (apply (var "g") (var "_hoist_inner_1")))+ (var "inner"))))+ (var "outer")),++ -- ============================================================+ -- Test: Lambda after app LHS - should trigger hoisting+ -- ============================================================++ hoistCaseStatementsCase "lambda after app LHS takes us out of top level"+ -- Input: let f = ((\a -> match a with ...) x) in f+ -- App LHS then lambda body - after using app, lambda doesn't help+ (letExpr "f"+ (apply+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ (var "x"))+ (var "f"))+ -- Output: case is hoisted because lambda comes after we've used our one app LHS+ -- Path to case: letBinding, applicationFunction, lambdaBody+ -- Processing: letBinding (pass), applicationFunction (use app, mark usedApp=true), lambdaBody (usedApp=true, fail)+ -- So case IS hoisted. The case uses 'a' which is lambda-bound, so it's wrapped in a lambda+ -- and the reference becomes (_hoist_f_1 a)+ (letExpr "f"+ (letExpr "_hoist_f_1"+ -- The hoisted case is wrapped in a lambda to capture 'a'+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)]))+ -- The original lambda body is replaced with (_hoist_f_1 a)+ (apply+ (lambda "a" (apply (var "_hoist_f_1") (var "a")))+ (var "x")))+ (var "f")),++ -- ============================================================+ -- Test: Case statements inside case branches (nested cases)+ -- Case branches bind variables, so they are like lambda bodies+ -- ============================================================++ hoistCaseStatementsCase "case inside case branch is NOT hoisted"+ -- Input: let f = match x with just a -> match a with ... | nothing -> 0 in f+ -- Inner case is inside a case branch - branches are pass-through like lambdas+ (letExpr "f"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)])),+ (nm "nothing", int32 0)])+ (var "f"))+ -- Output: unchanged - inner case is at top level (through case branch)+ (letExpr "f"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)])),+ (nm "nothing", int32 0)])+ (var "f")),++ hoistCaseStatementsCase "case inside case default branch is NOT hoisted"+ -- Input: let f = match x with just a -> a | nothing -> match y with ... in f+ -- Inner case is in default branch - still pass-through+ (letExpr "f"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a" (var "a")),+ (nm "nothing",+ match (nm "Optional") (just $ var "y")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)])])+ (var "f"))+ -- Output: unchanged - inner case is at top level (through case default)+ (letExpr "f"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a" (var "a")),+ (nm "nothing",+ match (nm "Optional") (just $ var "y")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)])])+ (var "f")),++ hoistCaseStatementsCase "case in arg position inside case branch IS hoisted"+ -- Input: let f = match x with just a -> g (match a with ...) | nothing -> 0 in f+ -- Inner case is in argument position inside a case branch - should be hoisted+ (letExpr "f"+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a"+ (apply (var "g")+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)]))),+ (nm "nothing", int32 0)])+ (var "f"))+ -- Output: inner case is hoisted to the OUTER let level (not inside the branch)+ -- because hoistSubterms only creates lets at existing let boundaries.+ -- The inner case uses 'a' which is lambda-bound, so it's wrapped in a lambda+ -- and the reference becomes (_hoist_f_1 a)+ (letExpr "f"+ (letExpr "_hoist_f_1"+ -- The inner case wrapped in a lambda to capture 'a'+ (lambda "a"+ (match (nm "Optional") (just $ var "a")+ [(nm "just", lambda "b" (var "b")),+ (nm "nothing", int32 0)]))+ -- The outer case with the reference (_hoist_f_1 a) inside the branch+ (match (nm "Optional") (just $ var "x")+ [(nm "just", lambda "a"+ (apply (var "g") (apply (var "_hoist_f_1") (var "a")))),+ (nm "nothing", int32 0)]))+ (var "f")),++ -- ============================================================+ -- Test: Case inside case default with let binding+ -- This is the pattern from isSimpleAssignment in CoderUtils:+ -- match term with+ -- specific_case -> ...+ -- _ -> let baseTerm = f(term) in match baseTerm with ...+ -- The inner case in the default branch's let body must be hoisted+ -- because Python can't encode match statements inline in case branches+ -- ============================================================++ hoistCaseStatementsCase "case in let body inside applied case default IS hoisted"+ -- Input: let f = (case x of just a -> a | _ -> let b = g(x) in (case b of ...)(b)) x+ -- The outer case is applied (through `cases`/`apply`), putting default branch+ -- at non-top-level. Inner applied case in default > let body must be hoisted.+ -- This is the pattern from isSimpleAssignment in CoderUtils.+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "a" (var "a")),+ (nm "nothing",+ letExpr "b" (apply (var "g") (var "x"))+ (apply+ (match (nm "Result") nothing+ [(nm "ok", lambda "y" (var "y")),+ (nm "err", int32 0)])+ (var "b")))])+ (var "x"))+ (var "f"))+ -- Output: inner applied case is hoisted within the inner let (preserving let-bound variable scoping)+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "a" (var "a")),+ (nm "nothing",+ letExpr "b" (apply (var "g") (var "x"))+ (letExpr "_hoist__body_1"+ (match (nm "Result") nothing+ [(nm "ok", lambda "y" (var "y")),+ (nm "err", int32 0)])+ (apply (var "_hoist__body_1") (var "b"))))])+ (var "x"))+ (var "f")),++ hoistCaseStatementsCase "case in let body inside applied case branch IS hoisted"+ -- Input: let f = (case x of just a -> let b = h(a) in (case b of ...)(b) | nothing -> 0) x+ -- Like above but inner case is in a named branch rather than default.+ -- 'a' IS lambda-bound (from the case branch), so it IS captured.+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "a"+ (letExpr "b" (apply (var "h") (var "a"))+ (apply+ (match (nm "Result") nothing+ [(nm "ok", lambda "y" (var "y")),+ (nm "err", int32 0)])+ (var "b")))),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f"))+ -- Output: inner case is hoisted within the inner let (preserving let-bound variable scoping)+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "a"+ (letExpr "b" (apply (var "h") (var "a"))+ (letExpr "_hoist__body_1"+ (match (nm "Result") nothing+ [(nm "ok", lambda "y" (var "y")),+ (nm "err", int32 0)])+ (apply (var "_hoist__body_1") (var "b"))))),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f")),++ -- ============================================================+ -- Test: Case applications (case function applied to argument)+ -- ============================================================++ hoistCaseStatementsCase "case application at top level of binding is NOT hoisted"+ -- Input: let f = (match Optional with ...) x in f+ -- The case application is at top level (one app LHS)+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f"))+ -- Output: unchanged+ (letExpr "f"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x"))+ (var "f")),++ hoistCaseStatementsCase "case application in arg position IS hoisted"+ -- Input: let f = g ((match Optional with ...) x) in f+ -- The bare case function is hoisted first (bottom-up), then the application+ -- uses the hoisted reference. 'x' is not lambda-bound so not captured.+ (letExpr "f"+ (apply (var "g")+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "x")))+ (var "f"))+ -- Output: bare case function is hoisted, application becomes _hoist_f_1(x)+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply (var "g") (apply (var "_hoist_f_1") (var "x"))))+ (var "f")),++ hoistCaseStatementsCase "case application inside immediately-applied lambda IS hoisted"+ -- Input: let f = (\a -> (match Optional with ...) a) x in f+ -- The bare case function is inside \a -> (case ...) a. Bottom-up processing:+ -- The bare case function at path [LetBinding f, ApplicationFunction, LambdaBody, ApplicationFunction]+ -- gets hoisted. No captured variables (case function has no free vars).+ (letExpr "f"+ (apply+ (lambda "a"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "a")))+ (var "x"))+ (var "f"))+ -- Output: bare case function is hoisted+ (letExpr "f"+ (letExpr "_hoist_f_1"+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (apply+ (lambda "a" (apply (var "_hoist_f_1") (var "a")))+ (var "x")))+ (var "f")),++ hoistCaseStatementsCase "case application in lambda body is NOT hoisted"+ -- Input: let f = \a -> (match Optional with ...) a in f+ -- Lambda body + one app LHS = still at top level+ (letExpr "f"+ (lambda "a"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "a")))+ (var "f"))+ -- Output: unchanged+ (letExpr "f"+ (lambda "a"+ (apply+ (match (nm "Optional") nothing+ [(nm "just", lambda "y" (var "y")),+ (nm "nothing", int32 0)])+ (var "a")))+ (var "f"))]++-- | Test cases for hoistPolymorphicLetBindings+-- This function hoists polymorphic let bindings (those with non-empty type scheme variables)+-- to the top level of the given let term.+hoistPolymorphicLetBindingsGroup :: TTerm TestGroup+hoistPolymorphicLetBindingsGroup = subgroup "hoistPolymorphicLetBindings" [+ -- ============================================================+ -- Test: No polymorphic bindings - unchanged+ -- ============================================================++ hoistPolyCase "no polymorphic bindings: simple let unchanged"+ -- Input: let x : Int32 = 42 in x+ (mkLet [(nm "x", int32 42, monoType T.int32)] (var "x"))+ -- Output: unchanged+ (mkLet [(nm "x", int32 42, monoType T.int32)] (var "x")),++ hoistPolyCase "no polymorphic bindings: multiple monomorphic bindings"+ -- Input: let x : Int32 = 1; y : String = "hi" in pair x y+ (mkLet [+ (nm "x", int32 1, monoType T.int32),+ (nm "y", string "hi", monoType T.string)]+ (apply (apply (var "pair") (var "x")) (var "y")))+ -- Output: unchanged+ (mkLet [+ (nm "x", int32 1, monoType T.int32),+ (nm "y", string "hi", monoType T.string)]+ (apply (apply (var "pair") (var "x")) (var "y"))),++ -- ============================================================+ -- Test: Single polymorphic binding at top level - stays in place+ -- ============================================================++ hoistPolyCase "single polymorphic binding: already at top level"+ -- Input: let id : forall a. a -> a = \x -> x in id 42+ (mkLet [(nm "id", lambda "x" (var "x"), polyType ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42)))+ -- Output: unchanged (already at top)+ (mkLet [(nm "id", lambda "x" (var "x"), polyType ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42))),++ -- ============================================================+ -- Test: Polymorphic binding inside lambda body+ -- ============================================================++ hoistPolyCase "polymorphic binding inside lambda: no capture"+ -- Input: let f = \a -> (let id : forall b. b -> b = \x -> x in id a) in f 42+ -- Here 'id' does not reference 'a', so it can be hoisted directly+ (mkLet [(nm "f",+ lambda "a" (Core.termLet $ mkLet [(nm "id", lambda "x" (var "x"), polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "id") (var "a"))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "f") (int32 42)))+ -- Output: f comes first (original binding), then f_id is hoisted (no wrapping needed)+ (mkLet [+ (nm "f",+ lambda "a" (apply (var "f_id") (var "a")),+ monoType (T.function T.int32 T.int32)),+ (nm "f_id", tylam "b" (lambda "x" (var "x")), polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "f") (int32 42))),++ -- ============================================================+ -- Test: Polymorphic binding captures lambda variable - requires wrapping+ -- ============================================================++ hoistPolyCase "polymorphic binding captures lambda variable: wrapped in lambda"+ -- Input: let f = \(a:String) -> (let g : forall b. b -> Pair<String, b> = \x -> pair a x in g 42) in f "hello"+ -- Here 'g' references 'a' (the enclosing lambda's variable), so when hoisted,+ -- it must be wrapped in a lambda that takes 'a', and the reference replaced with an application+ (mkLet [(nm "f",+ lambdaTyped "a" T.string (Core.termLet $ mkLet [+ (nm "g", lambda "x" (apply (apply (var "pair") (var "a")) (var "x")),+ polyType ["b"] (T.function (T.var "b") (T.pair T.string (T.var "b"))))]+ (apply (var "g") (int32 42))),+ monoType (T.function T.string (T.pair T.string T.int32)))]+ (apply (var "f") (string "hello")))+ -- Output: f comes first (original binding), then f_g is hoisted wrapped in \(a:String) -> ..., and reference becomes (f_g a)+ (mkLet [+ (nm "f",+ lambdaTyped "a" T.string (apply (apply (var "f_g") (var "a")) (int32 42)),+ monoType (T.function T.string (T.pair T.string T.int32))),+ (nm "f_g", tylam "b" (lambdaTyped "a" T.string (lambda "x" (apply (apply (var "pair") (var "a")) (var "x")))),+ polyType ["b"] (T.function T.string (T.function (T.var "b") (T.pair T.string (T.var "b")))))]+ (apply (var "f") (string "hello"))),++ hoistPolyCase "polymorphic binding captures multiple lambda variables"+ -- Input: let f = \(a:Int32) -> \(b:Int32) -> (let g : forall c. c -> c = \x -> triple a b x in g 42) in f 1 2+ -- Here 'g' references both 'a' and 'b', so it needs to be wrapped with both+ (mkLet [(nm "f",+ lambdaTyped "a" T.int32 (lambdaTyped "b" T.int32 (Core.termLet $ mkLet [+ (nm "g", lambda "x" (apply (apply (apply (var "triple") (var "a")) (var "b")) (var "x")),+ polyType ["c"] (T.function (T.var "c") (T.var "c")))]+ (apply (var "g") (int32 42)))),+ monoType (T.function T.int32 (T.function T.int32 T.int32)))]+ (apply (apply (var "f") (int32 1)) (int32 2)))+ -- Output: f comes first (original binding), then f_g is wrapped in \(a:Int32) -> \(b:Int32) -> ..., references become ((f_g a) b)+ (mkLet [+ (nm "f",+ lambdaTyped "a" T.int32 (lambdaTyped "b" T.int32 (apply (apply (apply (var "f_g") (var "a")) (var "b")) (int32 42))),+ monoType (T.function T.int32 (T.function T.int32 T.int32))),+ (nm "f_g", tylam "c" (lambdaTyped "a" T.int32 (lambdaTyped "b" T.int32 (lambda "x" (apply (apply (apply (var "triple") (var "a")) (var "b")) (var "x"))))),+ polyType ["c"] (T.function T.int32 (T.function T.int32 (T.function (T.var "c") (T.var "c")))))]+ (apply (apply (var "f") (int32 1)) (int32 2))),++ hoistPolyCase "polymorphic binding captures some but not all lambda variables"+ -- Input: let f = \(a:Int32) -> \(b:Int32) -> (let g : forall c. c -> Pair<Int32, c> = \x -> pair a x in g b) in f 1 2+ -- Here 'g' only references 'a', not 'b'+ (mkLet [(nm "f",+ lambdaTyped "a" T.int32 (lambdaTyped "b" T.int32 (Core.termLet $ mkLet [+ (nm "g", lambda "x" (apply (apply (var "pair") (var "a")) (var "x")),+ polyType ["c"] (T.function (T.var "c") (T.pair T.int32 (T.var "c"))))]+ (apply (var "g") (var "b")))),+ monoType (T.function T.int32 (T.function T.int32 (T.pair T.int32 T.int32))))]+ (apply (apply (var "f") (int32 1)) (int32 2)))+ -- Output: f comes first (original binding), then f_g is wrapped only in \(a:Int32) -> ..., reference becomes (f_g a)+ (mkLet [+ (nm "f",+ lambdaTyped "a" T.int32 (lambdaTyped "b" T.int32 (apply (apply (var "f_g") (var "a")) (var "b"))),+ monoType (T.function T.int32 (T.function T.int32 (T.pair T.int32 T.int32)))),+ (nm "f_g", tylam "c" (lambdaTyped "a" T.int32 (lambda "x" (apply (apply (var "pair") (var "a")) (var "x")))),+ polyType ["c"] (T.function T.int32 (T.function (T.var "c") (T.pair T.int32 (T.var "c")))))]+ (apply (apply (var "f") (int32 1)) (int32 2))),++ hoistPolyCase "polymorphic binding captures both lambda-bound and let-bound variables"+ -- Input: let f = \(a:Int32) -> (let x : Int32 = 1; g : forall b. b -> b = \y -> add (add a x) y in g 42) in f 10+ -- Here 'g' references 'a' (lambda-bound from enclosing scope) and 'x' (let-bound sibling).+ -- When g is hoisted to the top level, it goes OUTSIDE the inner let block, so it must capture+ -- both 'a' (from the enclosing lambda) AND 'x' (which is no longer a sibling after hoisting).+ (mkLet [(nm "f",+ lambdaTyped "a" T.int32 (Core.termLet $ mkLet [+ (nm "x", int32 1, monoType T.int32),+ (nm "g", lambda "y" (apply (apply (primitive _math_add)+ (apply (apply (primitive _math_add) (var "a")) (var "x"))) (var "y")),+ polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "g") (int32 42))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "f") (int32 10)))+ -- Output: f comes first (original binding), then f_g captures both 'a' and 'x', reference becomes ((f_g a) x)+ (mkLet [+ (nm "f",+ lambdaTyped "a" T.int32 (Core.termLet $ mkLet [+ (nm "x", int32 1, monoType T.int32)]+ (apply (apply (apply (var "f_g") (var "a")) (var "x")) (int32 42))),+ monoType (T.function T.int32 T.int32)),+ (nm "f_g", tylam "b" (lambdaTyped "a" T.int32 (lambdaTyped "x" T.int32+ (lambda "y" (apply (apply (primitive _math_add)+ (apply (apply (primitive _math_add) (var "a")) (var "x"))) (var "y"))))),+ polyType ["b"] (T.function T.int32 (T.function T.int32 (T.function (T.var "b") (T.var "b")))))]+ (apply (var "f") (int32 10))),++ hoistPolyCase "sibling polymorphic bindings inside lambda: one calls the other"+ -- Input: let wrapper = \outer : Int32 -> let g : forall a. a -> a = \y -> add outer y; h : forall b. b -> b = \z -> g z in h 42 in wrapper 10+ -- This mimics the structure in unifyTypeConstraints where bind and tryBinding are+ -- both inside withConstraint lambda and one calls the other.+ -- g captures 'outer', h calls g which means h must transitively capture 'outer'+ (mkLet [(nm "wrapper",+ lambdaTyped "outer" T.int32 (Core.termLet $ mkLet [+ (nm "g", lambda "y" (apply (apply (primitive _math_add) (var "outer")) (var "y")),+ polyType ["a"] (T.function (T.var "a") (T.var "a"))),+ (nm "h", lambda "z" (apply (var "g") (var "z")),+ polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "h") (int32 42))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "wrapper") (int32 10)))+ -- Output: wrapper first (original), then wrapper_g and wrapper_h hoisted (both capture outer)+ -- wrapper_g is wrapped: \outer -> \y -> add outer y+ -- wrapper_h is wrapped: \outer -> \z -> (wrapper_g outer) z+ -- The reference to wrapper_g inside wrapper_h becomes (wrapper_g outer)+ (mkLet [+ (nm "wrapper",+ lambdaTyped "outer" T.int32 (apply (apply (var "wrapper_h") (var "outer")) (int32 42)),+ monoType (T.function T.int32 T.int32)),+ (nm "wrapper_g", tylam "a" (lambdaTyped "outer" T.int32 (lambda "y" (apply (apply (primitive _math_add) (var "outer")) (var "y")))),+ polyType ["a"] (T.function T.int32 (T.function (T.var "a") (T.var "a")))),+ (nm "wrapper_h", tylam "b" (lambdaTyped "outer" T.int32 (lambda "z" (apply (apply (var "wrapper_g") (var "outer")) (var "z")))),+ polyType ["b"] (T.function T.int32 (T.function (T.var "b") (T.var "b"))))]+ (apply (var "wrapper") (int32 10))),++ hoistPolyCase "sibling polymorphic bindings inside lambda: h passes its own args to g"+ -- Input: let wrapper = \outer -> let g : forall a. a -> a = \v -> \t -> add outer (add v t);+ -- h : forall b. b -> b = \v -> \t -> g v t+ -- in h 1 2+ -- in wrapper 10+ -- Here h calls g with its own args v and t. After hoisting:+ -- g becomes \outer -> \v -> \t -> add outer (add v t)+ -- h becomes \outer -> \v -> \t -> ((g outer) v) t+ -- The reference to g in h should NOT duplicate outer, v, or t+ (mkLet [(nm "wrapper",+ lambdaTyped "outer" T.int32 (Core.termLet $ mkLet [+ (nm "g", lambda "v" (lambda "t" (apply (apply (primitive _math_add) (var "outer"))+ (apply (apply (primitive _math_add) (var "v")) (var "t")))),+ polyType ["a"] (T.function (T.var "a") (T.function (T.var "a") (T.var "a")))),+ (nm "h", lambda "v" (lambda "t" (apply (apply (var "g") (var "v")) (var "t"))),+ polyType ["b"] (T.function (T.var "b") (T.function (T.var "b") (T.var "b"))))]+ (apply (apply (var "h") (int32 1)) (int32 2))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "wrapper") (int32 10)))+ -- Output: wrapper first (original), then wrapper_g and wrapper_h hoisted (both capture outer)+ -- wrapper_g: \outer -> \v -> \t -> add outer (add v t)+ -- wrapper_h: \outer -> \v -> \t -> ((wrapper_g outer) v) t+ (mkLet [+ (nm "wrapper",+ lambdaTyped "outer" T.int32 (apply (apply (apply (var "wrapper_h") (var "outer")) (int32 1)) (int32 2)),+ monoType (T.function T.int32 T.int32)),+ (nm "wrapper_g", tylam "a" (lambdaTyped "outer" T.int32+ (lambda "v" (lambda "t" (apply (apply (primitive _math_add) (var "outer"))+ (apply (apply (primitive _math_add) (var "v")) (var "t")))))),+ polyType ["a"] (T.function T.int32 (T.function (T.var "a") (T.function (T.var "a") (T.var "a"))))),+ (nm "wrapper_h", tylam "b" (lambdaTyped "outer" T.int32+ (lambda "v" (lambda "t" (apply (apply (apply (var "wrapper_g") (var "outer")) (var "v")) (var "t"))))),+ polyType ["b"] (T.function T.int32 (T.function (T.var "b") (T.function (T.var "b") (T.var "b")))))]+ (apply (var "wrapper") (int32 10))),++ -- ============================================================+ -- Test: Untyped bindings are treated as monomorphic+ -- ============================================================++ hoistPolyCase "untyped binding: not hoisted"+ -- Input: let x = 1 in (let y = 2 in x + y)+ -- Neither binding has a type, so neither is polymorphic+ (mkLetUntyped [(nm "x", int32 1)]+ (Core.termLet $ mkLetUntyped [(nm "y", int32 2)]+ (apply (apply (primitive _math_add) (var "x")) (var "y"))))+ -- Output: unchanged (untyped bindings are not polymorphic)+ (mkLetUntyped [(nm "x", int32 1)]+ (Core.termLet $ mkLetUntyped [(nm "y", int32 2)]+ (apply (apply (primitive _math_add) (var "x")) (var "y")))),++ -- ============================================================+ -- Test: Name collision - nested binding has same name as top-level (after unshadowing)+ -- Note: This test uses distinct names as unshadowVariables would produce.+ -- The hoisting code assumes no shadowing. If there were shadowing,+ -- two bindings named 'id' would collide at top level.+ -- ============================================================++ hoistPolyCase "no name collision: distinct names after unshadowing"+ -- Input: let id = \x -> x; f = \a -> (let id2 : forall b. b -> b = \y -> y in id2 (id a)) in f 42+ -- Here 'id' is monomorphic at top level, 'id2' is polymorphic nested+ -- They have distinct names (as unshadowVariables would ensure)+ (mkLet [+ (nm "id", lambda "x" (var "x"), monoType (T.function T.int32 T.int32)),+ (nm "f",+ lambda "a" (Core.termLet $ mkLet [+ (nm "id2", lambda "y" (var "y"), polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "id2") (apply (var "id") (var "a")))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "f") (int32 42)))+ -- Output: id and f first (original), then f_id2 hoisted+ (mkLet [+ (nm "id", lambda "x" (var "x"), monoType (T.function T.int32 T.int32)),+ (nm "f",+ lambda "a" (apply (var "f_id2") (apply (var "id") (var "a"))),+ monoType (T.function T.int32 T.int32)),+ (nm "f_id2", tylam "b" (lambda "y" (var "y")), polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "f") (int32 42))),++ -- ============================================================+ -- Test: Nested polymorphic binding calls enclosing polymorphic binding+ -- When a polymorphic binding h at a nested level calls a polymorphic+ -- binding g from an enclosing (but not top) level, g should NOT be+ -- passed as a term argument to h. Instead, h's body should reference+ -- the hoisted g (wrapper_g) directly, since polymorphic let-bound+ -- variables are excluded from capture.+ -- ============================================================++ hoistPolyCase "nested polymorphic binding calls enclosing polymorphic binding"+ -- Input: let wrapper = \outer:Int32 ->+ -- let g : forall a. a -> a = \y -> y+ -- in \inner:Int32 ->+ -- let h : forall b. b -> b = \z -> g z+ -- in h 42+ -- in wrapper 10 20+ -- Here g is polymorphic at an outer let level, and h is polymorphic+ -- at an inner let level. h calls g. When both are hoisted:+ -- - g becomes wrapper_g (no captures needed)+ -- - h becomes wrapper_h, and should reference wrapper_g directly+ -- (NOT receive g as a term parameter)+ (mkLet [(nm "wrapper",+ lambdaTyped "outer" T.int32 (Core.termLet $ mkLet [+ -- g : forall a. a -> a (at outer let level)+ (nm "g",+ lambda "y" (var "y"),+ polyType ["a"] (T.function (T.var "a") (T.var "a")))]+ -- inner lambda+ (lambdaTyped "inner" T.int32 (Core.termLet $ mkLet [+ -- h : forall b. b -> b (at inner let level, calls g)+ (nm "h",+ lambda "z" (apply (var "g") (var "z")),+ polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "h") (int32 42))))),+ monoType (T.function T.int32 (T.function T.int32 T.int32)))]+ (apply (apply (var "wrapper") (int32 10)) (int32 20)))+ -- Output: wrapper simplified, wrapper_g and wrapper_h hoisted.+ -- CRITICAL: wrapper_h references wrapper_g directly, NOT through a parameter.+ -- Neither g nor any enclosing lambda variables are captured by h,+ -- because g is polymorphic (excluded from capture) and h doesn't use outer/inner.+ (mkLet [+ (nm "wrapper",+ lambdaTyped "outer" T.int32+ (lambdaTyped "inner" T.int32+ (apply (var "wrapper_h") (int32 42))),+ monoType (T.function T.int32 (T.function T.int32 T.int32))),+ -- wrapper_g: hoisted, no captures+ (nm "wrapper_g",+ tylam "a" (lambda "y" (var "y")),+ polyType ["a"] (T.function (T.var "a") (T.var "a"))),+ -- wrapper_h: hoisted, references wrapper_g directly (no g parameter)+ (nm "wrapper_h",+ tylam "b" (lambda "z" (apply (var "wrapper_g") (var "z"))),+ polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (apply (var "wrapper") (int32 10)) (int32 20))),++ -- ============================================================+ -- Test: Polymorphic binding captures monomorphic sibling in same let+ -- This test case demonstrates the bug in joinTypes where:+ -- - sleft/sright are monomorphic bindings (NOT hoisted)+ -- - cannotUnify is polymorphic (HOISTED) and references sleft/sright+ -- When cannotUnify is hoisted, it must capture sleft/sright as parameters+ -- because they are defined in the same let and won't be hoisted with it.+ -- ============================================================++ hoistPolyCase "polymorphic binding captures monomorphic sibling in same let"+ -- This mirrors the joinTypes structure:+ -- let wrapper = \left -> \right ->+ -- let sleft : Int32 = f left; -- monomorphic, NOT hoisted+ -- sright : Int32 = f right; -- monomorphic, NOT hoisted+ -- cannotUnify : forall a. a -> a = \x -> add sleft (add sright x) -- polymorphic, refs sleft/sright+ -- in cannotUnify 42+ -- in wrapper 1 2+ --+ -- When cannotUnify is hoisted, it must capture sleft and sright since they are+ -- defined in the same let and won't be hoisted with it.+ (mkLet [(nm "wrapper",+ lambdaTyped "left" T.int32+ (lambdaTyped "right" T.int32+ (Core.termLet $ mkLet [+ (nm "sleft", apply (var "f") (var "left"), monoType T.int32),+ (nm "sright", apply (var "f") (var "right"), monoType T.int32),+ (nm "cannotUnify",+ lambda "x" (apply (apply (primitive _math_add) (var "sleft"))+ (apply (apply (primitive _math_add) (var "sright")) (var "x"))),+ polyType ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "cannotUnify") (int32 42)))),+ monoType (T.function T.int32 (T.function T.int32 T.int32)))]+ (apply (apply (var "wrapper") (int32 1)) (int32 2)))+ -- Expected output:+ -- wrapper is simplified, wrapper_cannotUnify is hoisted with sleft and sright captured+ -- wrapper_cannotUnify: forall a. \sleft:Int32 -> \sright:Int32 -> \x -> add sleft (add sright x)+ -- Reference becomes: ((wrapper_cannotUnify sleft) sright) 42+ (mkLet [+ (nm "wrapper",+ lambdaTyped "left" T.int32+ (lambdaTyped "right" T.int32+ (Core.termLet $ mkLet [+ (nm "sleft", apply (var "f") (var "left"), monoType T.int32),+ (nm "sright", apply (var "f") (var "right"), monoType T.int32)]+ (apply (apply (apply (var "wrapper_cannotUnify") (var "sleft")) (var "sright")) (int32 42)))),+ monoType (T.function T.int32 (T.function T.int32 T.int32))),+ (nm "wrapper_cannotUnify",+ tylam "a"+ (lambdaTyped "sleft" T.int32+ (lambdaTyped "sright" T.int32+ (lambda "x" (apply (apply (primitive _math_add) (var "sleft"))+ (apply (apply (primitive _math_add) (var "sright")) (var "x")))))),+ polyType ["a"] (T.function T.int32 (T.function T.int32 (T.function (T.var "a") (T.var "a")))))]+ (apply (apply (var "wrapper") (int32 1)) (int32 2))),++ -- This test uses NESTED lets (as the DSL generates with <~) rather than a single flat let.+ -- The bug: when poly bindings in different nested lets reference each other,+ -- transitive captured variables are not propagated correctly.+ --+ -- Structure (nested lets, like DSL generates):+ -- wrapper = \left ->+ -- let sleft = left -- mono (outermost nested let)+ -- in let cannotUnify = fail sleft -- poly, refs sleft (middle nested let)+ -- in let joinList = cannotUnify 1 -- poly, refs cannotUnify (innermost nested let)+ -- in joinList+ --+ -- When joinList is hoisted, it captures cannotUnify (from outer let).+ -- When cannotUnify is hoisted, it captures sleft and its replacement becomes: wrapper_cannotUnify sleft+ -- The replacement for cannotUnify gets substituted into joinList's body.+ -- Bug: joinList ends up with free variable sleft because it wasn't captured transitively.+ hoistPolyCase "nested lets: poly binding references poly sibling from outer let"+ (mkLet [(nm "wrapper",+ lambdaTyped "left" T.int32+ -- Outer nested let: sleft (mono)+ (Core.termLet $ mkLet [+ (nm "sleft", var "left", monoType T.int32)]+ -- Middle nested let: cannotUnify (poly, refs sleft)+ (Core.termLet $ mkLet [+ (nm "cannotUnify",+ lambda "x" (apply (apply (primitive _math_add) (var "sleft")) (var "x")),+ polyType ["a"] (T.function (T.var "a") (T.var "a")))]+ -- Inner nested let: joinList (poly, refs cannotUnify)+ (Core.termLet $ mkLet [+ (nm "joinList",+ lambda "y" (apply (var "cannotUnify") (var "y")),+ polyType ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "joinList") (int32 42))))),+ monoType (T.function T.int32 T.int32))]+ (apply (var "wrapper") (int32 1)))+ -- Expected: both cannotUnify and joinList are hoisted.+ -- wrapper_cannotUnify captures sleft.+ -- wrapper_joinList must ALSO capture sleft (transitively through cannotUnify).+ -- The reference to cannotUnify in joinList becomes wrapper_cannotUnify sleft,+ -- so joinList needs sleft in scope.+ (mkLet [+ (nm "wrapper",+ lambdaTyped "left" T.int32+ (Core.termLet $ mkLet [+ (nm "sleft", var "left", monoType T.int32)]+ (apply (apply (var "wrapper_joinList") (var "sleft")) (int32 42))),+ monoType (T.function T.int32 T.int32)),+ (nm "wrapper_cannotUnify",+ tylam "a"+ (lambdaTyped "sleft" T.int32+ (lambda "x" (apply (apply (primitive _math_add) (var "sleft")) (var "x")))),+ polyType ["a"] (T.function T.int32 (T.function (T.var "a") (T.var "a")))),+ (nm "wrapper_joinList",+ tylam "b"+ (lambdaTyped "sleft" T.int32+ (lambda "y" (apply (apply (var "wrapper_cannotUnify") (var "sleft")) (var "y")))),+ polyType ["b"] (T.function T.int32 (T.function (T.var "b") (T.var "b"))))]+ (apply (var "wrapper") (int32 1))),++ -- ============================================================+ -- Regression test: polymorphic binding with pair term must preserve+ -- type application wrappers after hoisting. This reproduces the+ -- "pair type requires 2 type arguments, got 0" error in Java code+ -- generation. The binding `init` (like in hoistLetBindingsWithPredicate)+ -- contains a pair of empty list and a set. After inference, the pair+ -- has TypeApplication wrappers. These wrappers must survive hoisting.+ -- ============================================================++ hoistPolyCase "polymorphic binding with pair: type applications preserved"+ -- Input: let f = \b:Name ->+ -- let init : forall t0. Pair<List<t0>, Set<Name>>+ -- = Λt0. @(Set<Name>) @(List<t0>) pair((@t0 []), singleton(b))+ -- in init+ -- in f (name "x")+ -- The init binding is polymorphic (has type var t0 from empty list).+ -- After hoisting, the pair must KEEP its TypeApplication wrappers.+ (mkLet [(nm "f",+ lambdaTyped "b" (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string) (Core.termLet $ mkLet [+ (nm "init",+ -- Term with type lambda and type applications (as inference would produce):+ -- Λt0. TypeApp(TypeApp(Pair(TypeApp([], t0), singleton(b)), List<t0>), Set<Name>)+ tylam "t0" (tyapp (tyapp+ (pair+ (tyapp (list ([] :: [TTerm Term])) (T.var "t0"))+ (apply (var "singleton") (var "b")))+ (T.list (T.var "t0")))+ (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string))),+ polyType ["t0"] (T.pair (T.list (T.var "t0")) (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string))))]+ (var "init")),+ monoType (T.function (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)+ (T.pair (T.list (T.var "t0")) (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)))))]+ (apply (var "f") (var "name_x")))+ -- Expected output: f first (original), then f_init hoisted.+ -- The hoisted binding must retain TypeApplication wrappers on the pair.+ -- Λt0 is stripped and re-added by hoisting, but inner type apps on pair are preserved.+ (mkLet [+ (nm "f",+ lambdaTyped "b" (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)+ (apply (var "f_init") (var "b")),+ monoType (T.function (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)+ (T.pair (T.list (T.var "t0")) (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string))))),+ (nm "f_init",+ -- After hoisting: captures b, re-adds type lambda for t0+ -- The inner type applications on the pair MUST be preserved+ tylam "t0" (lambdaTyped "b" (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)+ (tyapp (tyapp+ (pair+ (tyapp (list ([] :: [TTerm Term])) (T.var "t0"))+ (apply (var "singleton") (var "b")))+ (T.list (T.var "t0")))+ (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)))),+ polyType ["t0"] (T.function (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)+ (T.pair (T.list (T.var "t0")) (T.set (T.wrap (Core.name (Phantoms.string "hydra.core.Name")) T.string)))))]+ (apply (var "f") (var "name_x"))),++ -- ============================================================+ -- Regression test: monomorphic binding referencing outer type variables+ -- must get type applications at the call site after hoisting.+ -- This reproduces the Java "T70848" bug: without type apps on the+ -- hoisted reference, the Java coder falls back to tryTypeOf which+ -- generates fresh inference variables instead of using the correct+ -- type parameters from the enclosing scope.+ -- ============================================================++ hoistPolyCase "monomorphic binding captures type vars: replacement includes type applications"+ -- Input: let f = TypeLambda a (TypeLambda b (+ -- \(x:a) -> let q : TypeScheme([], a -> b) = \(y:a) -> g y+ -- in q x))+ -- in f+ -- Here 'q' is monomorphic but references outer type vars 'a' and 'b'.+ -- When hoisted, q becomes polymorphic in [a, b].+ -- The replacement must include TypeApp(b, TypeApp(a, Var(f_q))) to instantiate+ -- the hoisted binding with the correct type variables.+ (mkLet [(nm "f",+ tylam "a" (tylam "b" (+ lambdaTyped "x" (T.var "a") (Core.termLet $ mkLet [+ (nm "q",+ lambdaTyped "y" (T.var "a") (apply (var "g") (var "y")),+ monoType (T.function (T.var "a") (T.var "b")))]+ (apply (var "q") (var "x"))))),+ polyType ["a", "b"] (T.function (T.var "a") (T.var "b")))]+ (var "f"))+ -- Expected output: f first, then f_q hoisted with type lambdas for [a, b].+ -- q does not reference x, so no lambda capture is needed.+ -- The replacement for q SHOULD be TypeApp(b, TypeApp(a, Var(f_q)))+ -- so that downstream code knows the type variable instantiation.+ -- Using Core.termTypeApplication directly to avoid meta-encoding issues with tyapp.+ (mkLet [+ (nm "f",+ tylam "a" (tylam "b" (+ lambdaTyped "x" (T.var "a")+ (apply+ (Core.termTypeApplication $ Core.typeApplicationTerm+ (Core.termTypeApplication $ Core.typeApplicationTerm (var "f_q") (T.var "a"))+ (T.var "b"))+ (var "x")))),+ polyType ["a", "b"] (T.function (T.var "a") (T.var "b"))),+ (nm "f_q",+ tylam "a" (tylam "b" (+ lambdaTyped "y" (T.var "a") (apply (var "g") (var "y")))),+ polyType ["a", "b"] (T.function (T.var "a") (T.var "b")))]+ (var "f"))]++-- | Test cases for hoistLetBindings with hoistAll=True+-- This function hoists ALL let bindings (not just polymorphic ones) to the top level.+-- This is used for Java which cannot have let expressions in arbitrary positions.+-- Key behavior: type lambdas are boundaries - we don't hoist bindings OUT of type lambdas+-- because doing so could move code that references type variables outside their scope.+hoistLetBindingsGroup :: TTerm TestGroup+hoistLetBindingsGroup = subgroup "hoistLetBindings" [+ -- ============================================================+ -- Test: Basic nested let hoisting (no type lambdas)+ -- ============================================================++ hoistAllCase "nested let inside lambda: binding hoisted with lambda capture"+ -- Input: let f = \a -> (let g = a + 1 in g * 2) in f 10+ (mkLetUntyped [(nm "f",+ lambda "a" (Core.termLet $ mkLetUntyped [(nm "g", apply (apply (primitive _math_add) (var "a")) (int32 1))]+ (apply (apply (primitive _math_mul) (var "g")) (int32 2))))]+ (apply (var "f") (int32 10)))+ -- Output: f comes first (original binding), then f_g is hoisted with lambda to capture 'a', reference becomes (f_g a)+ (mkLetUntyped [+ (nm "f",+ lambda "a" (apply (apply (primitive _math_mul) (apply (var "f_g") (var "a"))) (int32 2))),+ (nm "f_g", lambda "a" (apply (apply (primitive _math_add) (var "a")) (int32 1)))]+ (apply (var "f") (int32 10))),++ -- ============================================================+ -- Test: Type applications are processed normally (they don't introduce type variables)+ -- But the inner lambda still has nested let that gets hoisted+ -- ============================================================++ hoistAllCase "type application: nested let outside lambda CAN be hoisted"+ -- Input: let f = (let y = 1 in \x -> x + y) @Int32 in f 10+ -- The let is OUTSIDE the lambda, so y can be hoisted without capture+ (mkLetUntyped [(nm "f",+ tyapp (Core.termLet $ mkLetUntyped [(nm "y", int32 1)]+ (lambda "x" (apply (apply (primitive _math_add) (var "x")) (var "y")))) T.int32)]+ (apply (var "f") (int32 10)))+ -- Output: f comes first (original binding), then f_y is hoisted+ (mkLetUntyped [+ (nm "f",+ tyapp (lambda "x" (apply (apply (primitive _math_add) (var "x")) (var "f_y"))) T.int32),+ (nm "f_y", int32 1)]+ (apply (var "f") (int32 10)))]++-- | Convenience function for creating hoist let bindings test cases (hoistAll=True)+hoistAllCase :: String -> TTerm Let -> TTerm Let -> TTerm TestCaseWithMetadata+hoistAllCase cname input output = hoistLetBindingsCase cname input output++-- | Helper for creating a Let term with typed bindings+mkLet :: [(TTerm Name, TTerm Term, TTerm (Maybe TypeScheme))] -> TTerm Term -> TTerm Let+mkLet bindings body = Core.let_ (Phantoms.list $ mkBinding <$> bindings) body+ where+ mkBinding :: (TTerm Name, TTerm Term, TTerm (Maybe TypeScheme)) -> TTerm Binding+ mkBinding (n, t, ts) = Core.binding n t ts++-- | Helper for creating a Let term with untyped bindings+mkLetUntyped :: [(TTerm Name, TTerm Term)] -> TTerm Term -> TTerm Let+mkLetUntyped bindings body = Core.let_ (Phantoms.list $ mkBinding <$> bindings) body+ where+ mkBinding :: (TTerm Name, TTerm Term) -> TTerm Binding+ mkBinding (n, t) = Core.binding n t Phantoms.nothing++-- | Helper for creating a monomorphic type scheme+monoType :: TTerm Type -> TTerm (Maybe TypeScheme)+monoType typ = Phantoms.just $ Core.typeScheme (Phantoms.list ([] :: [TTerm Name])) typ Phantoms.nothing++-- | Helper for creating a polymorphic type scheme+polyType :: [String] -> TTerm Type -> TTerm (Maybe TypeScheme)+polyType vars typ = Phantoms.just $ Core.typeScheme (Phantoms.list $ nm <$> vars) typ Phantoms.nothing++-- | Convenience function for creating hoist polymorphic let bindings test cases+hoistPolyCase :: String -> TTerm Let -> TTerm Let -> TTerm TestCaseWithMetadata+hoistPolyCase cname input output = hoistPolymorphicLetBindingsCase cname input output++-- | Test cases for type parameter extraction when hoisting polymorphic let bindings+-- This group specifically tests scenarios where Java code generation fails because+-- type parameters (t0, t1, t2, etc.) are used in generated code but not declared+-- in method signatures. The root cause is that javaTypeParametersForType doesn't+-- properly collect all free type variables from nested generic types.+--+-- These tests illustrate the EXPECTED behavior after the issue is fixed.+-- Currently, the Java coder fails to generate compilable code for these cases.+hoistPolymorphicTypeParametersGroup :: TTerm TestGroup+hoistPolymorphicTypeParametersGroup = subgroup "hoistPolymorphicTypeParameters" [+ -- ============================================================+ -- Test: Nested polymorphic bindings with multiple type variables+ -- This is the core issue: when a polymorphic binding like `choose`+ -- uses type variables (t0, t1, t2) in nested function types,+ -- those variables must be declared in the hoisted method signature.+ -- ============================================================++ hoistPolyCase "nested function types: all type variables must be declared"+ -- Input: let f = (let choose : forall t0 t1 t2. (t0 -> t1) -> (t2 -> t1) -> t0 -> t1 = ... in choose) in f+ -- This simulates the `mutateTrace` scenario where `choose` is a polymorphic+ -- local binding with multiple type parameters in nested function types.+ -- (Simplified to avoid using "Either" as a type variable name)+ (mkLet [(nm "f",+ Core.termLet $ mkLet [(nm "choose",+ lambda "forLeft" (lambda "forRight" (lambda "e"+ (apply (var "forLeft") (var "e")))),+ -- Type: forall t0 t1 t2. (t0 -> t1) -> (t2 -> t1) -> t0 -> t1+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function+ (T.function (T.var "t2") (T.var "t1"))+ (T.function (T.var "t0") (T.var "t1")))))]+ (var "choose"),+ monoType (T.function+ (T.function T.string T.int32)+ (T.function+ (T.function T.boolean T.int32)+ (T.function T.string T.int32))))]+ (var "f"))+ -- Output: f first (original), then f_choose hoisted with ALL type parameters preserved+ -- When generating Java, the method signature must declare t0, t1, t2+ (mkLet [+ (nm "f",+ var "f_choose",+ monoType (T.function+ (T.function T.string T.int32)+ (T.function+ (T.function T.boolean T.int32)+ (T.function T.string T.int32)))),+ (nm "f_choose",+ tylam "t0" (tylam "t1" (tylam "t2" (lambda "forLeft" (lambda "forRight" (lambda "e"+ (apply (var "forLeft") (var "e"))))))),+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function+ (T.function (T.var "t2") (T.var "t1"))+ (T.function (T.var "t0") (T.var "t1")))))]+ (var "f")),++ -- ============================================================+ -- Test: Type variable in return position only+ -- Type variables appearing only in the return type of a nested+ -- function must still be declared.+ -- ============================================================++ hoistPolyCase "type variable in return position only"+ -- Input: let f = (let returnT : forall t. () -> t = ... in returnT) in f+ (mkLet [(nm "f",+ Core.termLet $ mkLet [(nm "returnT",+ lambda "unit" (var "undefined"),+ polyType ["t"] (T.function T.unit (T.var "t")))]+ (var "returnT"),+ monoType (T.function T.unit T.int32))]+ (var "f"))+ -- Output: f first (original), then f_returnT hoisted with t declared+ (mkLet [+ (nm "f",+ var "f_returnT",+ monoType (T.function T.unit T.int32)),+ (nm "f_returnT",+ tylam "t" (lambda "unit" (var "undefined")),+ polyType ["t"] (T.function T.unit (T.var "t")))]+ (var "f")),++ -- ============================================================+ -- Test: Type variables in deeply nested generic types+ -- The Java coder uses freeVariablesInType but may not recurse+ -- into all nested type structures.+ -- ============================================================++ hoistPolyCase "type variables in deeply nested generics"+ -- Input: let f = (let nested : forall t0 t1 t2. ((t0, t1), t2) -> t0 = ... in nested) in f+ -- Type variables t0, t1, t2 are in nested pair types+ -- (Simplified from original which used List<Map<...>> - those are treated as type vars in tests)+ (mkLet [(nm "f",+ Core.termLet $ mkLet [(nm "nested",+ lambda "x" (var "undefined"),+ -- Type: forall t0 t1 t2. ((t0, t1), t2) -> t0+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.pair (T.pair (T.var "t0") (T.var "t1")) (T.var "t2"))+ (T.var "t0")))]+ (var "nested"),+ monoType (T.function+ (T.pair (T.pair T.string T.int32) T.boolean)+ T.string))]+ (var "f"))+ -- Output: f first (original), then f_nested hoisted with all type parameters t0, t1, t2 declared+ (mkLet [+ (nm "f",+ var "f_nested",+ monoType (T.function+ (T.pair (T.pair T.string T.int32) T.boolean)+ T.string)),+ (nm "f_nested",+ tylam "t0" (tylam "t1" (tylam "t2" (lambda "x" (var "undefined")))),+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.pair (T.pair (T.var "t0") (T.var "t1")) (T.var "t2"))+ (T.var "t0")))]+ (var "f")),++ -- ============================================================+ -- Test: Multiple polymorphic bindings that share type variable names+ -- Each binding should independently track its own type variables.+ -- ============================================================++ hoistPolyCase "multiple bindings with overlapping type variable names"+ -- Input: let outer = (let id1 : forall t. t -> t = \x -> x; id2 : forall t. t -> t = \y -> y in pair id1 id2) in outer+ -- Both id1 and id2 use "t" but they are independent+ (mkLet [(nm "outer",+ Core.termLet $ mkLet [+ (nm "id1", lambda "x" (var "x"), polyType ["t"] (T.function (T.var "t") (T.var "t"))),+ (nm "id2", lambda "y" (var "y"), polyType ["t"] (T.function (T.var "t") (T.var "t")))]+ (apply (apply (var "pair") (var "id1")) (var "id2")),+ monoType (T.pair+ (T.function T.int32 T.int32)+ (T.function T.string T.string)))]+ (var "outer"))+ -- Output: outer first (original), then outer_id1 and outer_id2 hoisted (each with their own t parameter)+ (mkLet [+ (nm "outer",+ apply (apply (var "pair") (var "outer_id1")) (var "outer_id2"),+ monoType (T.pair+ (T.function T.int32 T.int32)+ (T.function T.string T.string))),+ (nm "outer_id1", tylam "t" (lambda "x" (var "x")), polyType ["t"] (T.function (T.var "t") (T.var "t"))),+ (nm "outer_id2", tylam "t" (lambda "y" (var "y")), polyType ["t"] (T.function (T.var "t") (T.var "t")))]+ (var "outer")),++ -- ============================================================+ -- Test: Polymorphic binding with captured term variable AND type parameters+ -- This is the combination case: the binding both captures a lambda-bound+ -- term variable AND has type parameters that need to be declared.+ -- ============================================================++ hoistPolyCase "captured variable with type parameters"+ -- Input: let f = \(a:String) -> (let g : forall t. t -> Pair<String, t> = \x -> pair a x in g 42) in f "hello"+ -- Here 'g' captures 'a' AND has type parameter t+ -- When hoisted: g must be wrapped in lambda for 'a', AND method must declare t+ (mkLet [(nm "f",+ lambdaTyped "a" T.string (Core.termLet $ mkLet [+ (nm "g",+ lambda "x" (apply (apply (var "pair") (var "a")) (var "x")),+ polyType ["t"] (T.function (T.var "t") (T.pair T.string (T.var "t"))))]+ (apply (var "g") (int32 42))),+ monoType (T.function T.string (T.pair T.string T.int32)))]+ (apply (var "f") (string "hello")))+ -- Output: f first (original), then f_g hoisted with lambda wrapper for 'a', and t must be declared+ -- Java signature: <t> Function<String, Function<t, Pair<String, t>>> f_g = a -> x -> pair(a, x);+ (mkLet [+ (nm "f",+ lambdaTyped "a" T.string (apply (apply (var "f_g") (var "a")) (int32 42)),+ monoType (T.function T.string (T.pair T.string T.int32))),+ (nm "f_g",+ tylam "t" (lambdaTyped "a" T.string (lambda "x" (apply (apply (var "pair") (var "a")) (var "x")))),+ polyType ["t"] (T.function T.string (T.function (T.var "t") (T.pair T.string (T.var "t")))))]+ (apply (var "f") (string "hello"))),++ -- ============================================================+ -- Test: Short type variable names (the isLambdaBoundVariable heuristic)+ -- The Java coder's isLambdaBoundVariable uses name length <= 4 to identify+ -- type variables. These tests ensure that this heuristic correctly+ -- identifies variables that should become Java type parameters.+ -- ============================================================++ hoistPolyCase "short type variable names are treated as type parameters"+ -- Input: let f = (let g : forall s t v. s -> t -> v = ... in g) in f+ -- s, t, v have length <= 4, so they should be recognized as type parameters+ (mkLet [(nm "f",+ Core.termLet $ mkLet [(nm "g",+ lambda "s" (lambda "t" (var "undefined")),+ polyType ["s", "t", "v"]+ (T.function (T.var "s")+ (T.function (T.var "t") (T.var "v"))))]+ (var "g"),+ monoType (T.function T.int32 (T.function T.string T.boolean)))]+ (var "f"))+ -- Output: f first (original), then f_g hoisted with s, t, v declared as type parameters+ (mkLet [+ (nm "f",+ var "f_g",+ monoType (T.function T.int32 (T.function T.string T.boolean))),+ (nm "f_g",+ tylam "s" (tylam "t" (tylam "v" (lambda "s" (lambda "t" (var "undefined"))))),+ polyType ["s", "t", "v"]+ (T.function (T.var "s")+ (T.function (T.var "t") (T.var "v"))))]+ (var "f")),++ hoistPolyCase "numbered type variables like t0 t1 t2"+ -- Input: let f = (let g : forall t0 t1 t2. t0 -> t1 -> t2 = ... in g) in f+ -- t0, t1, t2 have length <= 4, common pattern in generated code+ (mkLet [(nm "f",+ Core.termLet $ mkLet [(nm "g",+ lambda "x" (lambda "y" (var "undefined")),+ polyType ["t0", "t1", "t2"]+ (T.function (T.var "t0")+ (T.function (T.var "t1") (T.var "t2"))))]+ (var "g"),+ monoType (T.function T.int32 (T.function T.string T.boolean)))]+ (var "f"))+ -- Output: f first (original), then f_g hoisted with t0, t1, t2 declared+ (mkLet [+ (nm "f",+ var "f_g",+ monoType (T.function T.int32 (T.function T.string T.boolean))),+ (nm "f_g",+ tylam "t0" (tylam "t1" (tylam "t2" (lambda "x" (lambda "y" (var "undefined"))))),+ polyType ["t0", "t1", "t2"]+ (T.function (T.var "t0")+ (T.function (T.var "t1") (T.var "t2"))))]+ (var "f")),++ -- ============================================================+ -- Test: Complex "choose" pattern from mutateTrace+ -- This directly models the failing code in Monads.java+ -- NOTE: This test uses T.var "Either" which causes "Either" to be+ -- treated as a free type variable. In real code, Either would be a defined+ -- type constructor and wouldn't be captured as a free variable. This test+ -- has been simplified to avoid this issue by using only type variables.+ -- ============================================================++ hoistPolyCase "choose pattern from mutateTrace"+ -- Input simulates: let mutateTrace = ... in+ -- choose <~ (forLeft ~> forRight ~> e ~> either forLeft forRight e) $+ -- ... rest of mutateTrace ...+ -- The `choose` binding has type:+ -- forall t0 t1 t2. (t0 -> t1) -> (t2 -> t1) -> t0 -> t1+ -- (Simplified to avoid using "Either" as a type variable name)+ (mkLet [(nm "mutateTrace",+ lambda "mutate" (lambda "restore" (lambda "f"+ (Core.termLet $ mkLet [(nm "choose",+ -- choose = \forLeft -> \forRight -> \e -> forLeft e+ lambda "forLeft" (lambda "forRight" (lambda "e"+ (apply (var "forLeft") (var "e")))),+ -- Type: forall t0 t1 t2. (t0 -> t1) -> (t2 -> t1) -> t0 -> t1+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function+ (T.function (T.var "t2") (T.var "t1"))+ (T.function (T.var "t0") (T.var "t1")))))]+ -- Body uses choose+ (apply (apply (apply (var "choose") (var "forLeft")) (var "forRight")) (var "e"))))),+ -- Full type of mutateTrace (using concrete types)+ monoType (T.function T.int32+ (T.function T.int32+ (T.function T.int32 T.int32))))]+ (var "mutateTrace"))+ -- Output: mutateTrace first (original), then mutateTrace_choose hoisted, MUST have t0, t1, t2 declared+ (mkLet [+ (nm "mutateTrace",+ lambda "mutate" (lambda "restore" (lambda "f"+ (apply (apply (apply (var "mutateTrace_choose") (var "forLeft")) (var "forRight")) (var "e")))),+ monoType (T.function T.int32+ (T.function T.int32+ (T.function T.int32 T.int32)))),+ (nm "mutateTrace_choose",+ tylam "t0" (tylam "t1" (tylam "t2" (lambda "forLeft" (lambda "forRight" (lambda "e"+ (apply (var "forLeft") (var "e"))))))),+ polyType ["t0", "t1", "t2"]+ (T.function+ (T.function (T.var "t0") (T.var "t1"))+ (T.function+ (T.function (T.var "t2") (T.var "t1"))+ (T.function (T.var "t0") (T.var "t1")))))]+ (var "mutateTrace"))]
src/main/haskell/Hydra/Sources/Test/Inference/AlgebraicTypes.hs view
@@ -1,48 +1,215 @@-module Hydra.Sources.Test.Inference.AlgebraicTypes (algebraicTypesTests) where+module Hydra.Sources.Test.Inference.AlgebraicTypes where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Phantoms as Base-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph-import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T-import Hydra.Sources.Test.Inference.Fundamentals+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import qualified Data.Map as M-import Prelude hiding (map, sum) +ns :: Namespace+ns = Namespace "hydra.test.inference.algebraicTypes" -algebraicTypesTests :: TTerm TestGroup-algebraicTypesTests = supergroup "Algebraic terms" [- testGroupForFolds,- testGroupForLists,- testGroupForMaps,- testGroupForOptionals,- testGroupForProducts,- testGroupForSets,- testGroupForSums]+module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Inference tests for algebraic data types")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding testGroupForCollectionPrimitives,+ Phantoms.toBinding testGroupForEithers,+ Phantoms.toBinding testGroupForFolds,+ Phantoms.toBinding testGroupForLists,+ Phantoms.toBinding testGroupForMaps,+ Phantoms.toBinding testGroupForOptionals,+ Phantoms.toBinding testGroupForPairs,+ Phantoms.toBinding testGroupForSets] -testGroupForFolds :: TTerm TestGroup-testGroupForFolds = subgroup "List eliminations (folds)" [- expectMono 1 [tag_disabledForMinimalInference]- foldAdd- (T.functionMany [T.int32, T.list T.int32, T.int32]),- expectMono 2 [tag_disabledForMinimalInference]- (foldAdd @@ int32 0)- (T.function (T.list T.int32) T.int32),- expectMono 3 [tag_disabledForMinimalInference]- (foldAdd @@ int32 0 @@ (list (int32 <$> [1, 2, 3, 4, 5])))- T.int32]+define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Algebraic data type tests" $+ supergroup "Algebraic terms" [+ testGroupForCollectionPrimitives,+ testGroupForEithers,+ testGroupForFolds,+ testGroupForLists,+ testGroupForMaps,+ testGroupForOptionals,+ testGroupForPairs,+ testGroupForSets]++testGroupForCollectionPrimitives :: TBinding TestGroup+testGroupForCollectionPrimitives = define "testGroupForCollectionPrimitives" $+ supergroup "Collection primitives" [++ -- Applying maps.map to a concrete function+ subgroup "maps.map applied to a function" [+ -- maps.map (partially applied): maps.map negate => map<k, int32> -> map<k, int32>+ expectPoly 1 [tag_disabledForMinimalInference]+ (primitive _maps_map @@ primitive _math_negate)+ ["t0"] (T.function (T.map (T.var "t0") T.int32) (T.map (T.var "t0") T.int32)),+ -- maps.map with a lambda+ expectPoly 2 [tag_disabledForMinimalInference]+ (primitive _maps_map @@ lambda "x" (list [var "x"]))+ ["t0", "t1"] (T.function (T.map (T.var "t0") (T.var "t1")) (T.map (T.var "t0") (T.list $ T.var "t1"))),+ -- maps.map with sets.fromList: transforms map values from lists to sets+ expectPoly 3 [tag_disabledForMinimalInference]+ (primitive _maps_map @@ primitive _sets_fromList)+ ["t0", "t1"] (T.function (T.map (T.var "t0") (T.list $ T.var "t1")) (T.map (T.var "t0") (T.set $ T.var "t1")))],++ -- Applying sets.map to cross-collection functions+ subgroup "sets.map applied to a function" [+ -- sets.map negate => set<int32> -> set<int32>+ expectMono 1 [tag_disabledForMinimalInference]+ (primitive _sets_map @@ primitive _math_negate)+ (T.function (T.set T.int32) (T.set T.int32)),+ -- sets.map with lists.length: set<list<t>> -> set<int32>+ expectPoly 2 [tag_disabledForMinimalInference]+ (primitive _sets_map @@ primitive _lists_length)+ ["t0"] (T.function (T.set $ T.list $ T.var "t0") (T.set T.int32))],++ -- Composing collection primitives in let bindings+ subgroup "Composing collection primitives in let" [+ -- let f = maps.map sets.fromList in f+ expectPoly 1 [tag_disabledForMinimalInference]+ (lets [+ "f">: primitive _maps_map @@ primitive _sets_fromList]+ $ var "f")+ ["t0", "t1"] (T.function (T.map (T.var "t0") (T.list $ T.var "t1")) (T.map (T.var "t0") (T.set $ T.var "t1"))),+ -- let f = maps.map sets.fromList; g = f (map literal) in g+ expectMono 2 [tag_disabledForMinimalInference]+ (lets [+ "f">: primitive _maps_map @@ primitive _sets_fromList,+ "g">: var "f" @@ mapTerm [(string "a", list [int32 1, int32 2])]]+ $ var "g")+ (T.map T.string (T.set T.int32))],++ -- Composing map operations in lambdas+ subgroup "Map operations in lambdas" [+ -- \m. maps.map lists.length m => map<k, list<t>> -> map<k, int32>+ expectPoly 1 [tag_disabledForMinimalInference]+ (lambda "m" $ primitive _maps_map @@ primitive _lists_length @@ var "m")+ ["t0", "t1"] (T.function (T.map (T.var "t0") (T.list $ T.var "t1")) (T.map (T.var "t0") T.int32)),+ -- \f. \m. maps.map f m => (v1 -> v2) -> map<k, v1> -> map<k, v2>+ expectPoly 2 [tag_disabledForMinimalInference]+ (lambda "f" $ lambda "m" $ primitive _maps_map @@ var "f" @@ var "m")+ ["t0", "t1", "t2"] (T.functionMany [T.function (T.var "t0") (T.var "t1"), T.map (T.var "t2") (T.var "t0"), T.map (T.var "t2") (T.var "t1")])],++ -- Fully applied collection conversions+ subgroup "Fully applied collection conversions" [+ -- sets.fromList [1, 2, 3] => set<int32>+ expectMono 1 [tag_disabledForMinimalInference]+ (primitive _sets_fromList @@ list (int32 <$> [1, 2, 3]))+ (T.set T.int32),+ -- maps.map negate (maps.fromList [(1, 2)]) => map<int32, int32>+ expectMono 2 [tag_disabledForMinimalInference]+ (primitive _maps_map @@ primitive _math_negate @@ (primitive _maps_fromList @@ list [pair (int32 1) (int32 2)]))+ (T.map T.int32 T.int32),+ -- maps.map sets.fromList (maps.fromList [("a", [1, 2])]) => map<string, set<int32>>+ expectMono 3 [tag_disabledForMinimalInference]+ (primitive _maps_map @@ primitive _sets_fromList @@ (primitive _maps_fromList @@ list [pair (string "a") (list [int32 1, int32 2])]))+ (T.map T.string (T.set T.int32))]]++testGroupForEithers :: TBinding TestGroup+testGroupForEithers = define "testGroupForEithers" $+ supergroup "Either terms" [+ subgroup "Left values" [+ expectMono 1 []+ (list [left $ string "error", right $ int32 42])+ (T.list $ T.either_ T.string T.int32),+ expectPoly 2 []+ (left $ string "error")+ ["t0"] (T.either_ T.string (T.var "t0"))],++ subgroup "Right values" [+ expectMono 1 []+ (list [right $ int32 42, left $ string "error"])+ (T.list $ T.either_ T.string T.int32),+ expectPoly 2 []+ (right $ int32 42)+ ["t0"] (T.either_ (T.var "t0") T.int32)],++ subgroup "Polymorphic either values" [+ expectPoly 1 []+ (left $ list [])+ ["t0", "t1"] (T.either_ (T.list $ T.var "t0") (T.var "t1")),+ expectPoly 2 []+ (right $ list [])+ ["t0", "t1"] (T.either_ (T.var "t0") (T.list $ T.var "t1"))],++ subgroup "Nested either values" [+ expectMono 1 []+ (list [left $ left $ int32 1, left $ right $ string "nested", right $ true])+ (T.list $ T.either_ (T.either_ T.int32 T.string) T.boolean),+ expectMono 2 []+ (list [right $ left $ int32 42, right $ right $ true, left $ string "foo"])+ (T.list $ T.either_ T.string (T.either_ T.int32 T.boolean))],++ subgroup "Either in lambda" [+ expectPoly 1 []+ (lambda "x" (left $ var "x"))+ ["t0", "t1"] (T.function (T.var "t0") (T.either_ (T.var "t0") (T.var "t1"))),+ expectPoly 2 []+ (lambda "x" (right $ var "x"))+ ["t0", "t1"] (T.function (T.var "t0") (T.either_ (T.var "t1") (T.var "t0")))],++ subgroup "Either in data structures" [+ expectMono 1 []+ (list [left $ string "error", right $ int32 42])+ (T.list $ T.either_ T.string T.int32),+ expectPoly 2 []+ (pair (list [left $ string "error", right $ int32 42]) (list []))+ ["t0"] (T.pair (T.list $ T.either_ T.string T.int32) (T.list $ T.var "t0"))]]++testGroupForFolds :: TBinding TestGroup+testGroupForFolds = define "testGroupForFolds" $+ supergroup "Eliminations" [+ subgroup "List eliminations (folds)" [+ expectMono 1 [tag_disabledForMinimalInference]+ foldAdd+ (T.functionMany [T.int32, T.list T.int32, T.int32]),+ expectMono 2 [tag_disabledForMinimalInference]+ (foldAdd @@ int32 0)+ (T.function (T.list T.int32) T.int32),+ expectMono 3 [tag_disabledForMinimalInference]+ (foldAdd @@ int32 0 @@ (list (int32 <$> [1, 2, 3, 4, 5])))+ T.int32],++ subgroup "Optional eliminations" [+ expectMono 1 [tag_disabledForMinimalInference]+ (primitive _maybes_maybe @@ (int32 42) @@ (primitive _math_negate))+ (T.function (T.optional T.int32) T.int32),+ expectMono 2 [tag_disabledForMinimalInference]+ (primitive _maybes_maybe @@ (int32 42) @@ (primitive _math_negate) @@ (optional (just $ int32 137)))+ T.int32,+ expectMono 3 [tag_disabledForMinimalInference]+ (primitive _maybes_maybe @@ (int32 42) @@ (primitive _math_negate) @@ optional nothing)+ T.int32,+ expectPoly 4 [tag_disabledForMinimalInference]+ (lambda "x" $ primitive _maybes_maybe @@ (var "x") @@ (primitive _maybes_pure) @@ var "x")+ ["t0"] (T.function (T.optional $ T.var "t0") (T.optional $ T.var "t0")),+ expectPoly 5 [tag_disabledForMinimalInference]+ (primitive _maybes_maybe @@ (list []) @@ (lambda "x" $ list [var "x"]))+ ["t0"] (T.function (T.optional $ T.var "t0") (T.list $ T.var "t0"))]] where foldAdd = primitive _lists_foldl @@ primitive _math_add -testGroupForLists :: TTerm TestGroup-testGroupForLists = supergroup "List terms" [+testGroupForLists :: TBinding TestGroup+testGroupForLists = define "testGroupForLists" $+ supergroup "List terms" [ subgroup "List of strings" [ expectMono 1 [] (list [string "foo", string "bar"])@@ -72,19 +239,25 @@ (lambda "x" (list [var "x", string "foo", var "x"])) (T.function T.string (T.list T.string))]] -testGroupForMaps :: TTerm TestGroup-testGroupForMaps = subgroup "Map terms" [+testGroupForMaps :: TBinding TestGroup+testGroupForMaps = define "testGroupForMaps" $+ subgroup "Map terms" [ expectMono 1 [tag_disabledForMinimalInference]- (mapTermCheat [- (Terms.string "firstName", Terms.string "Arthur"),- (Terms.string "lastName", Terms.string "Dent")])+ (mapTerm [+ (string "firstName", string "Arthur"),+ (string "lastName", string "Dent")]) (T.map T.string T.string), expectPoly 2 [tag_disabledForMinimalInference]- (mapTermCheat [])- ["t0", "t1"] (T.map (T.var "t0") (T.var "t1"))]+ (mapTerm [])+ ["t0", "t1"] (T.map (T.var "t0") (T.var "t1")),+ expectPoly 3 [tag_disabledForMinimalInference]+ (lambdas ["x", "y"] $ mapTerm+ [(var "x", float64 0.1), (var "y", float64 0.2)])+ ["t0"] (T.function (T.var "t0") (T.function (T.var "t0") (T.map (T.var "t0") T.float64)))] -testGroupForOptionals :: TTerm TestGroup-testGroupForOptionals = subgroup "Optional terms" [+testGroupForOptionals :: TBinding TestGroup+testGroupForOptionals = define "testGroupForOptionals" $+ subgroup "Optional terms" [ expectMono 1 [tag_disabledForMinimalInference] (optional $ just $ int32 42) (T.optional T.int32),@@ -92,66 +265,66 @@ (optional nothing) ["t0"] (T.optional $ T.var "t0")] -testGroupForProducts :: TTerm TestGroup-testGroupForProducts = supergroup "Product terms" [- subgroup "Empty products" [- expectMono 1 []- (tuple [])- (T.product [])],+testGroupForPairs :: TBinding TestGroup+testGroupForPairs = define "testGroupForPairs" $+ supergroup "Pair terms" [+ subgroup "Monotyped pairs" [+ expectMono 1 [tag_disabledForMinimalInference]+ (pair (string "foo") (int32 42))+ (T.pair T.string T.int32),+ expectMono 2 [tag_disabledForMinimalInference]+ (pair (string "foo") (list [float32 42.0, float32 137.0]))+ (T.pair T.string (T.list T.float32))], - subgroup "Non-empty, monotyped products" [- expectMono 1 []- (tuple [string "foo", int32 42])- (T.product [T.string, T.int32]),- expectMono 2 []- (tuple [string "foo", list [float32 42.0, float32 137.0]])- (T.product [T.string, T.list T.float32]),- expectMono 3 [tag_disabledForMinimalInference]- (tuple [string "foo", int32 42, list [float32 42.0, float32 137.0]])- (T.product [T.string, T.int32, T.list T.float32])],+ subgroup "Polytyped pairs" [+ expectPoly 1 [tag_disabledForMinimalInference]+ (pair (list []) (string "foo"))+ ["t0"] (T.pair (T.list $ T.var "t0") T.string),+ expectPoly 2 [tag_disabledForMinimalInference]+ (pair (list []) (list []))+ ["t0", "t1"] (T.pair (T.list $ T.var "t0") (T.list $ T.var "t1"))], - subgroup "Polytyped products" [- expectPoly 1 []- (tuple [list [], string "foo"])- ["t0"] (T.product [T.list $ T.var "t0", T.string]),+ subgroup "Nested pairs" [+ expectMono 1 [tag_disabledForMinimalInference]+ (pair (pair (int32 1) (string "nested")) true)+ (T.pair (T.pair T.int32 T.string) T.boolean),+ expectMono 2 [tag_disabledForMinimalInference]+ (pair (string "foo") (pair (int32 42) (list [float32 42.0])))+ (T.pair T.string (T.pair T.int32 (T.list T.float32)))],++ subgroup "Pairs in lambda" [+ expectPoly 1 [tag_disabledForMinimalInference]+ (lambda "x" (pair (var "x") (string "constant")))+ ["t0"] (T.function (T.var "t0") (T.pair (T.var "t0") T.string)), expectPoly 2 [tag_disabledForMinimalInference]- (tuple [int32 42, string "foo", list []])- ["t0"] (T.product [T.int32, T.string, T.list $ T.var "t0"])],+ (lambda "p" (pair (var "p") (var "p")))+ ["t0"] (T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t0")))], - subgroup "Pairs" [- expectMono 1 []+ subgroup "Pairs in data structures" [+ expectMono 1 [tag_disabledForMinimalInference]+ (list [pair (string "a") (int32 1), pair (string "b") (int32 2)])+ (T.list $ T.pair T.string T.int32),+ expectPoly 2 [tag_disabledForMinimalInference]+ (list [pair (list []) (string "foo")])+ ["t0"] (T.list $ T.pair (T.list $ T.var "t0") T.string)],++ subgroup "Additional cases" [+ expectMono 1 [tag_disabledForMinimalInference] (pair (int32 42) (string "foo")) (T.pair T.int32 T.string),- expectPoly 2 []+ expectPoly 2 [tag_disabledForMinimalInference] (pair (list []) (string "foo")) ["t0"] (T.pair (T.list $ T.var "t0") T.string),- expectPoly 3 []+ expectPoly 3 [tag_disabledForMinimalInference] (pair (list []) (list [])) ["t0", "t1"] (T.pair (T.list $ T.var "t0") (T.list $ T.var "t1"))]] -testGroupForSets :: TTerm TestGroup-testGroupForSets = subgroup "Set terms" [+testGroupForSets :: TBinding TestGroup+testGroupForSets = define "testGroupForSets" $+ subgroup "Set terms" [ expectMono 1 [tag_disabledForMinimalInference] (set [true]) (T.set T.boolean), expectPoly 2 [tag_disabledForMinimalInference] (set [set []]) ["t0"] (T.set $ T.set $ T.var "t0")]--testGroupForSums :: TTerm TestGroup-testGroupForSums = supergroup "Sum terms" [- subgroup "Singleton sum terms" [- expectMono 1 [tag_disabledForMinimalInference]- (sum 0 1 (string "foo"))- (T.sum [T.string]),- expectPoly 2 [tag_disabledForMinimalInference]- (sum 0 1 (list []))- ["t0"] (T.sum [T.list $ T.var "t0"])],-- subgroup "Non-singleton sum terms" [- expectPoly 1 [tag_disabledForMinimalInference]- (sum 0 2 (string "foo"))- ["t0"] (T.sum [T.string, T.var "t0"]),- expectPoly 2 [tag_disabledForMinimalInference]- (sum 1 2 (string "foo"))- ["t0"] (T.sum [T.var "t0", T.string])]]
src/main/haskell/Hydra/Sources/Test/Inference/AlgorithmW.hs view
@@ -1,29 +1,46 @@-module Hydra.Sources.Test.Inference.AlgorithmW (algorithmWTests) where+module Hydra.Sources.Test.Inference.AlgorithmW where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Phantoms as Base-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph-import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T-import Hydra.Sources.Test.Inference.Fundamentals+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import qualified Data.Map as M-import Prelude hiding (map, sum) +ns :: Namespace+ns = Namespace "hydra.test.inference.algorithmW" -algorithmWTests :: TTerm TestGroup-algorithmWTests = supergroup "Algorithm W test cases" [- testGroupForSystemF]+module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Algorithm W inference tests")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding testGroupForSystemF] +define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Algorithm W test cases" $+ supergroup "Algorithm W test cases" [+ testGroupForSystemF]+ -- @wisnesky's original Algorithm W test cases, modified so as to normalize type variables-testGroupForSystemF :: TTerm TestGroup-testGroupForSystemF = subgroup "STLC to System F" [+testGroupForSystemF :: TBinding TestGroup+testGroupForSystemF = define "testGroupForSystemF" $+ subgroup "STLC to System F" [ -- --Untyped input: -- -- (\x. x)@@ -192,5 +209,5 @@ where -- Placeholders for the primitives in @wisnesky's test cases; they are not necessarily the same functions, -- but they have the same types.- primPred = primitive _math_neg- primSucc = primitive _math_neg+ primPred = primitive _math_negate+ primSucc = primitive _math_negate
+ src/main/haskell/Hydra/Sources/Test/Inference/All.hs view
@@ -0,0 +1,51 @@++module Hydra.Sources.Test.Inference.All where++import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Sources.Kernel.Types.All+import Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import qualified Hydra.Sources.Test.Inference.AlgebraicTypes as AlgebraicTypes+import qualified Hydra.Sources.Test.Inference.AlgorithmW as AlgorithmW+import qualified Hydra.Sources.Test.Inference.Failures as Failures+import qualified Hydra.Sources.Test.Inference.Fundamentals as Fundamentals+import qualified Hydra.Sources.Test.Inference.KernelExamples as KernelExamples+import qualified Hydra.Sources.Test.Inference.NominalTypes as NominalTypes+++ns :: Namespace+ns = Namespace "hydra.test.inference.all"++module_ :: Module+module_ = Module ns elements namespaces kernelTypesNamespaces $+ Just "Hydra's inference test suite"+ where+ elements = [Phantoms.toBinding allTests]+ namespaces = [+ AlgebraicTypes.ns,+ AlgorithmW.ns,+ Failures.ns,+ Fundamentals.ns,+ KernelExamples.ns,+ NominalTypes.ns]++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ doc "The group of all inference tests" $+ Testing.testGroup (string "inference") nothing (list subgroups) (list ([] :: [TTerm TestCaseWithMetadata]))+ where+ subgroups = [+ AlgebraicTypes.allTests,+ AlgorithmW.allTests,+ Failures.allTests,+ Fundamentals.allTests,+ KernelExamples.allTests,+ NominalTypes.allTests]
src/main/haskell/Hydra/Sources/Test/Inference/Failures.hs view
@@ -1,40 +1,69 @@-module Hydra.Sources.Test.Inference.Failures (failureTests) where+module Hydra.Sources.Test.Inference.Failures where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T -import qualified Data.Map as M-import qualified Data.Set as S-import Prelude hiding (map, sum)+ns :: Namespace+ns = Namespace "hydra.test.inference.failures" +module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Inference tests for expected failures")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding undefinedVariableTests,+ Phantoms.toBinding unificationFailureTests,+ Phantoms.toBinding invalidApplicationTests,+ Phantoms.toBinding selfApplicationTests,+ Phantoms.toBinding arityMismatchTests,+ Phantoms.toBinding recursiveTypeTests,+ Phantoms.toBinding occurCheckTests,+ Phantoms.toBinding typeConstructorMisuseTests,+ Phantoms.toBinding polymorphismViolationTests,+ Phantoms.toBinding letBindingMismatchTests,+ Phantoms.toBinding constraintSolverEdgeCaseTests,+ Phantoms.toBinding primitiveTypeErrorTests,+ Phantoms.toBinding complexConstraintFailureTests] -failureTests :: TTerm TestGroup-failureTests = supergroup "Expected failures" [- undefinedVariableTests,- unificationFailureTests,- invalidApplicationTests,- selfApplicationTests,- arityMismatchTests,- recursiveTypeTests,- occurCheckTests,- typeConstructorMisuseTests,- polymorphismViolationTests,- letBindingMismatchTests,- constraintSolverEdgeCaseTests,- primitiveTypeErrorTests,- complexConstraintFailureTests]+define :: String -> TTerm a -> TBinding a+define = definitionInModule module_ -undefinedVariableTests :: TTerm TestGroup-undefinedVariableTests = supergroup "Undefined variable" [+allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Expected failure tests" $+ supergroup "Expected failures" [+ undefinedVariableTests,+ unificationFailureTests,+ invalidApplicationTests,+ selfApplicationTests,+ arityMismatchTests,+ recursiveTypeTests,+ occurCheckTests,+ typeConstructorMisuseTests,+ polymorphismViolationTests,+ letBindingMismatchTests,+ constraintSolverEdgeCaseTests,+ primitiveTypeErrorTests,+ complexConstraintFailureTests]++undefinedVariableTests :: TBinding TestGroup+undefinedVariableTests = define "undefinedVariableTests" $+ supergroup "Undefined variable" [ subgroup "Basic unbound variables" [ expectFailure 1 [] (var "x"),@@ -59,8 +88,9 @@ expectFailure 3 [] (lets ["x">: lambda "y" $ var "z"] $ var "x")]] -unificationFailureTests :: TTerm TestGroup-unificationFailureTests = supergroup "Unification failure" [+unificationFailureTests :: TBinding TestGroup+unificationFailureTests = define "unificationFailureTests" $+ supergroup "Unification failure" [ subgroup "Basic type mismatches" [ expectFailure 1 [] (primitive _math_add @@ int32 42 @@ string "foo"),@@ -100,8 +130,9 @@ (lets ["cons">: primitive _lists_cons] $ list [var "cons" @@ int32 42, var "cons" @@ string "foo"])]] -invalidApplicationTests :: TTerm TestGroup-invalidApplicationTests = supergroup "Invalid application" [+invalidApplicationTests :: TBinding TestGroup+invalidApplicationTests = define "invalidApplicationTests" $+ supergroup "Invalid application" [ subgroup "Non-function application" [ expectFailure 1 [] (int32 42 @@ int32 137),@@ -132,8 +163,9 @@ expectFailure 4 [] (list [] @@ true)]] -selfApplicationTests :: TTerm TestGroup-selfApplicationTests = supergroup "Self-application" [+selfApplicationTests :: TBinding TestGroup+selfApplicationTests = define "selfApplicationTests" $+ supergroup "Self-application" [ subgroup "Direct self-application" [ expectFailure 1 [] (lambda "x" $ var "x" @@ var "x"),@@ -148,8 +180,9 @@ expectFailure 3 [] (lets ["cycle">: lambda "f" $ var "f" @@ var "cycle"] $ var "cycle" @@ var "cycle")]] -arityMismatchTests :: TTerm TestGroup-arityMismatchTests = supergroup "Arity mismatch" [+arityMismatchTests :: TBinding TestGroup+arityMismatchTests = define "arityMismatchTests" $+ supergroup "Arity mismatch" [ subgroup "Too many arguments" [ expectFailure 1 [] (primitive _math_add @@ int32 42 @@ int32 137 @@ int32 999),@@ -166,8 +199,9 @@ expectFailure 3 [] ((lambda "x" $ int32 42) @@ string "arg" @@ int32 137 @@ true)]] -recursiveTypeTests :: TTerm TestGroup-recursiveTypeTests = supergroup "Recursive type construction" [+recursiveTypeTests :: TBinding TestGroup+recursiveTypeTests = define "recursiveTypeTests" $+ supergroup "Recursive type construction" [ subgroup "Direct recursive types" [ expectFailure 1 [] (lets ["x">: list [var "x"]] $ var "x"),@@ -192,8 +226,9 @@ expectFailure 3 [] (lets ["f">: list [var "g"], "g">: tuple [var "f", var "f"]] $ var "f")]] -occurCheckTests :: TTerm TestGroup-occurCheckTests = supergroup "Occur check failures" [+occurCheckTests :: TBinding TestGroup+occurCheckTests = define "occurCheckTests" $+ supergroup "Occur check failures" [ subgroup "Function occur checks" [ expectFailure 1 [] (lets ["g">: lambda "h" $ var "g" @@ var "g" @@ var "h"] $ var "g")],@@ -218,8 +253,9 @@ expectFailure 2 [] (lets ["loop">: lambda "x" $ lambda "y" $ var "loop" @@ (var "x" @@ var "loop") @@ var "y"] $ var "loop")]] -typeConstructorMisuseTests :: TTerm TestGroup-typeConstructorMisuseTests = supergroup "Type constructor misuse" [+typeConstructorMisuseTests :: TBinding TestGroup+typeConstructorMisuseTests = define "typeConstructorMisuseTests" $+ supergroup "Type constructor misuse" [ subgroup "List constructor errors" [ expectFailure 1 [] (primitive _lists_cons @@ (list [int32 42]) @@ int32 137), -- Wrong order@@ -250,8 +286,9 @@ expectFailure 4 [] (primitive _math_div @@ true @@ false)]] -polymorphismViolationTests :: TTerm TestGroup-polymorphismViolationTests = supergroup "Polymorphism violations" [+polymorphismViolationTests :: TBinding TestGroup+polymorphismViolationTests = define "polymorphismViolationTests" $+ supergroup "Polymorphism violations" [ subgroup "Identity function violations" [ expectFailure 1 [] (lets ["id">: lambda "x" $ var "x"] $@@ -268,7 +305,9 @@ (lets ["f">: lambda "x" $ list [var "x", int32 42]] $ var "f" @@ string "foo"), expectFailure 2 [] (lets ["g">: lambda "x" $ pair (var "x") (string "constant")] $- primitive _math_add @@ (first $ var "g" @@ int32 42) @@ (first $ var "g" @@ string "bad")),+ primitive _math_add+ @@ (primitive _pairs_first @@ (var "g" @@ int32 42))+ @@ (primitive _pairs_first @@ (var "g" @@ string "bad"))), expectFailure 3 [] (lets ["h">: lambda "x" $ primitive _lists_cons @@ var "x" @@ list [int32 0]] $ var "h" @@ string "incompatible")],@@ -281,8 +320,9 @@ expectFailure 3 [] (lambda "h" $ primitive _math_add @@ (var "h" @@ int32 42) @@ (var "h" @@ string "error"))]] -letBindingMismatchTests :: TTerm TestGroup-letBindingMismatchTests = supergroup "Let binding type mismatches" [+letBindingMismatchTests :: TBinding TestGroup+letBindingMismatchTests = define "letBindingMismatchTests" $+ supergroup "Let binding type mismatches" [ subgroup "Application type mismatches" [ expectFailure 1 [] (lets [@@ -310,7 +350,7 @@ (lets [ "pair1">: pair (int32 42) (string "foo"), "pair2">: pair (string "bar") (var "pair1")] $- primitive _math_add @@ (first $ var "pair2") @@ int32 1)],+ primitive _math_add @@ (primitive _pairs_first @@ var "pair2") @@ int32 1)], subgroup "Function binding mismatches" [ expectFailure 1 []@@ -325,8 +365,9 @@ "bad">: var "g" @@ string "foo" @@ true] $ var "bad")]] -constraintSolverEdgeCaseTests :: TTerm TestGroup-constraintSolverEdgeCaseTests = supergroup "Constraint solver edge cases" [+constraintSolverEdgeCaseTests :: TBinding TestGroup+constraintSolverEdgeCaseTests = define "constraintSolverEdgeCaseTests" $+ supergroup "Constraint solver edge cases" [ subgroup "Complex constraint propagation" [ expectFailure 1 [] (lets [@@ -361,8 +402,9 @@ "circular">: lambda "f" $ var "f" @@ var "circular" @@ var "f"] $ var "circular" @@ var "circular")]] -primitiveTypeErrorTests :: TTerm TestGroup-primitiveTypeErrorTests = supergroup "Primitive function type errors" [+primitiveTypeErrorTests :: TBinding TestGroup+primitiveTypeErrorTests = define "primitiveTypeErrorTests" $+ supergroup "Primitive function type errors" [ subgroup "Logic primitive errors" [ expectFailure 1 [] (primitive _logic_ifElse @@ int32 42 @@ true @@ false), -- Condition not boolean@@ -381,7 +423,7 @@ expectFailure 3 [] (primitive _lists_head @@ string "not a list"), expectFailure 4 []- (primitive _optionals_fromMaybe @@ int32 42 @@ string "not optional")],+ (primitive _maybes_fromMaybe @@ int32 42 @@ string "not optional")], subgroup "Math primitive errors" [ expectFailure 1 []@@ -393,8 +435,9 @@ expectFailure 4 [] (primitive _math_mod @@ int32 42 @@ string "not a number")]] -complexConstraintFailureTests :: TTerm TestGroup-complexConstraintFailureTests = supergroup "Complex constraint failures" [+complexConstraintFailureTests :: TBinding TestGroup+complexConstraintFailureTests = define "complexConstraintFailureTests" $+ supergroup "Complex constraint failures" [ subgroup "Multi-level constraint conflicts" [ expectFailure 1 [] (lets [
src/main/haskell/Hydra/Sources/Test/Inference/Fundamentals.hs view
@@ -1,32 +1,55 @@-module Hydra.Sources.Test.Inference.Fundamentals (fundamentalsTests) where+module Hydra.Sources.Test.Inference.Fundamentals where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T -import qualified Data.Map as M-import Prelude hiding (map, sum)+ns :: Namespace+ns = Namespace "hydra.test.inference.fundamentals" +module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Inference tests for fundamental language features")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding testGroupForLambdas,+ Phantoms.toBinding testGroupForLet,+ Phantoms.toBinding testGroupForLiterals,+ Phantoms.toBinding testGroupForPathologicalTerms,+ Phantoms.toBinding testGroupForPolymorphism,+ Phantoms.toBinding testGroupForPrimitives] -fundamentalsTests :: TTerm TestGroup-fundamentalsTests = supergroup "Fundamentals" [- testGroupForLambdas,- testGroupForLet,- testGroupForLiterals,- testGroupForPathologicalTerms,- testGroupForPolymorphism,- testGroupForPrimitives]+define :: String -> TTerm a -> TBinding a+define = definitionInModule module_ -testGroupForLambdas :: TTerm TestGroup-testGroupForLambdas = supergroup "Lambdas" [+allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Fundamental language feature tests" $+ supergroup "Fundamentals" [+ testGroupForLambdas,+ testGroupForLet,+ testGroupForLiterals,+ testGroupForPathologicalTerms,+ testGroupForPolymorphism,+ testGroupForPrimitives]++testGroupForLambdas :: TBinding TestGroup+testGroupForLambdas = define "testGroupForLambdas" $+ supergroup "Lambdas" [ subgroup "Simple lambdas" [ expectPoly 1 [] (lambda "x" $ var "x")@@ -48,8 +71,9 @@ (lambda "x" $ lambda "x" $ primitive _math_add @@ var "x" @@ int32 42) ["t0"] (T.function (T.var "t0") (T.function T.int32 T.int32))]] -testGroupForLet :: TTerm TestGroup-testGroupForLet = supergroup "Let terms" [+testGroupForLet :: TBinding TestGroup+testGroupForLet = define "testGroupForLet" $+ supergroup "Let terms" [ subgroup "Simple" [ expectPoly 1 []@@ -67,6 +91,11 @@ (lets [ "foo">: int32 42] $ var "foo")+ T.int32,+ expectMono 2 []+ (lets [+ "foo">: int32 42]+ $ var "foo") T.int32], subgroup "Multiple references to a let-bound term" [ expectMono 1 []@@ -120,31 +149,44 @@ subgroup "Let-polymorphism" [ expectPoly 1 []+ (lets ["x">: float32 42.0] $ lambdas ["y", "z"] $ var "x")+ ["t0", "t1"] (T.function (T.var "t0") (T.function (T.var "t1") T.float32)),+ -- Example from https://www.cs.cornell.edu/courses/cs6110/2017sp/lectures/lec23.pdf+ expectMono 2 [] (lets [+ "square">: lambda "z" $ primitive _math_mul @@ var "z" @@ var "z"] $+ lambdas ["f", "x", "y"] $ primitive _logic_ifElse+ @@ (var "f" @@ (var "square" @@ var "x") @@ var "y")+ @@ (var "f" @@ var "x" @@ (var "f" @@ var "x" @@ var "y"))+ @@ (var "f" @@ var "x" @@ var "y"))+ (T.functionMany [+ T.functionMany [T.int32, T.boolean, T.boolean], T.int32, T.boolean, T.boolean]),+ expectPoly 3 []+ (lets [ "id">: lambda "x" $ var "x"] $ lambda "x" $ var "id" @@ (var "id" @@ var "x")) ["t0"] (T.function (T.var "t0") (T.var "t0")),- expectMono 2 []+ expectMono 4 [] (lets [ "id">: lambda "x" $ var "x"] $ var "id" @@ (list [var "id" @@ int32 42])) (T.list T.int32),- expectPoly 3 []+ expectPoly 5 [] (lets [ "id">: lambda "x" $ var "x"] $ lambda "x" (var "id" @@ (list [var "id" @@ var "x"]))) ["t0"] (T.function (T.var "t0") (T.list $ T.var "t0")),- expectMono 4 []+ expectMono 6 [] (lets [ "id">: lambda "x" $ var "x"] $ pair (var "id" @@ int32 42) (var "id" @@ string "foo")) (T.pair T.int32 T.string),- expectMono 5 []+ expectMono 7 [] (lets [ "list">: lambda "x" $ list [var "x"]] $ pair (var "list" @@ int32 42) (var "list" @@ string "foo")) (T.pair (T.list T.int32) (T.list T.string)),- expectPoly 6 [tag_disabled]+ expectPoly 8 [tag_disabled] (lets [ "singleton">: lambda "x" $ list [var "x"], "f">: lambda "x" $ lambda "y" $ primitive _lists_cons@@ -153,14 +195,14 @@ "g">: lambda "x" $ lambda "y" $ var "f" @@ int32 42 @@ var "y"] $ var "f") ["t0"] (T.list $ T.pair T.int32 (T.var "t0")),- expectMono 7 [tag_disabledForMinimalInference]+ expectMono 9 [tag_disabledForMinimalInference] (lets [ "id">: lambda "x" $ var "x", "fortytwo">: var "id" @@ int32 42, "foo">: var "id" @@ string "foo"] $ pair (var "fortytwo") (var "foo")) (T.pair T.int32 T.string),- expectMono 8 [tag_disabledForMinimalInference]+ expectMono 10 [tag_disabledForMinimalInference] (lets [ "fortytwo">: var "id" @@ int32 42, "id">: lambda "x" $ var "x",@@ -216,11 +258,11 @@ "z">: var "x", "w">: var "z"] $ pair (var "x") (pair (var "w") (var "z")))- ["t0", "t1", "t2"] (T.product [- T.function (T.var "t0") (T.var "t0"),- T.product [- T.function (T.var "t1") (T.var "t1"),- T.function (T.var "t2") (T.var "t2")]])],+ ["t0", "t1", "t2"] (T.pair+ (T.function (T.var "t0") (T.var "t0"))+ (T.pair+ (T.function (T.var "t1") (T.var "t1"))+ (T.function (T.var "t2") (T.var "t2"))))], subgroup "Recursive and mutually recursive let with polymorphism" [ expectMono 1 []@@ -280,13 +322,133 @@ "foo">: var "bar", "bar">: var "foo"] $ pair (var "foo") (var "bar"))- ["t0", "t1"] (T.pair (T.var "t0") (T.var "t1"))]]+ ["t0", "t1"] (T.pair (T.var "t0") (T.var "t1"))],++ -- Over-generalization of hoisted let-bindings.+ -- When a nested let-binding is hoisted to a sibling, its type may be generalized+ -- beyond what the usage context constrains.+ subgroup "Over-generalization of hoisted let-bindings" [+ -- Nested: \g. \val. let r = g val in g (fst r)+ -- g is constrained: fst(g val) is used as input to g, so g : a -> (a, b)+ -- f : forall a b. (a -> (a, b)) -> a -> (a, b)+ expectPoly 1 []+ (lambda "g" $ lambda "val" $+ lets ["r">: var "g" @@ var "val"] $+ var "g" @@ (primitive _pairs_first @@ var "r"))+ ["t0", "t1"] (T.function+ (T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))+ (T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))),++ -- Hoisted: let helper = \g. \val. g val; f = \g. \val. g (fst (helper g val)) in f+ -- helper generalizes to forall a b. (a -> b) -> a -> b, losing the constraint b = (a, c).+ -- So f gets: forall a b c. (a -> (b, c)) -> a -> (b, c) -- 3 vars instead of 2.+ -- This test documents the CURRENT behavior (over-generalized).+ -- TODO: if inference is improved, update to match test 1 above.+ expectPoly 2 []+ (lets [+ "helper">: lambda "g" $ lambda "val" $ var "g" @@ var "val",+ "f">: lambda "g" $ lambda "val" $+ var "g" @@ (primitive _pairs_first @@ (var "helper" @@ var "g" @@ var "val"))] $+ var "f")+ ["t0", "t1"] (T.function+ (T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))+ (T.function (T.var "t0") (T.pair (T.var "t0") (T.var "t1")))),++ -- Chain of captures: forField takes rec as a parameter, uses fst of result.+ -- forField = \rec. \val. \x. let r = rec val x in (fst r, x)+ -- Independently, forField : forall a b c d. (a -> b -> (c, d)) -> a -> b -> (c, b)+ -- This is correct: the constraint c=a only exists at the call site, not in forField itself.+ -- This pattern occurs in rewriteAndFoldTerm where hoisted bindings are more polymorphic+ -- than how they are used. The Java coder must handle this discrepancy.+ expectPoly 3 []+ (lets [+ "forField">: lambda "rec" $ lambda "val" $ lambda "x" $+ lets ["r">: var "rec" @@ var "val" @@ var "x"] $+ pair (primitive _pairs_first @@ var "r") (var "x"),+ "main">: lambda "rec" $ lambda "val" $ lambda "x" $+ var "forField" @@ var "rec" @@ var "val" @@ var "x"] $+ var "main")+ ["t0", "t1", "t2", "t3"] (T.function+ (T.functionMany [T.var "t0", T.var "t1", T.pair (T.var "t2") (T.var "t3")])+ (T.functionMany [T.var "t0", T.var "t1", T.pair (T.var "t2") (T.var "t1")])),++ -- Models the rewriteAndFoldTerm_r pattern: a case/if expression where one branch+ -- uses a helper's result and the other uses the direct value. Both branches must+ -- return the same type, which should unify the helper's accumulator type with the+ -- direct value's type.+ -- helper = \f. \val. f val -- helper: forall a b. (a -> b) -> a -> b+ -- main = \f. \val. \b. ifElse b (helper f val) (val, 0)+ -- branch 1: helper f val => instantiates to (a -> b) -> a -> b, result b+ -- branch 2: (val, 0) => (a, Int)+ -- unify b = (a, Int), so helper f val : (a, Int)+ -- main : forall a. (a -> (a, Int)) -> a -> Bool -> (a, Int) -- 1 var+ expectPoly 4 []+ (lets [+ "helper">: lambda "f" $ lambda "val" $ var "f" @@ var "val",+ "main">: lambda "f" $ lambda "val" $ lambda "b" $+ primitive _logic_ifElse @@ var "b"+ @@ (var "helper" @@ var "f" @@ var "val")+ @@ (pair (var "val") (int32 0))] $+ var "main")+ ["t0"] (T.functionMany [+ T.function (T.var "t0") (T.pair (T.var "t0") T.int32),+ T.var "t0",+ T.boolean,+ T.pair (T.var "t0") T.int32]),++ -- Closer to rewriteAndFoldTerm_r: forField has rec as lambda param (not sibling reference).+ -- forField = \rec. \val. let r = rec val in (fst r, snd r)+ -- rec: a -> (b, c), val: a, r: (b, c), result: (b, c) -- 3 vars+ -- main = \rec. \val. \b. ifElse b (forField rec val) (val, 0)+ -- branch 1: forField rec val => fresh instance of forField, result (b', c')+ -- branch 2: (val, 0) => (a, Int)+ -- unify (b', c') = (a, Int) => b' = a, c' = Int+ -- also a = a (from rec's first arg), so rec: a -> (a, Int)+ -- main: forall a. (a -> (a, Int)) -> a -> Bool -> (a, Int) -- 1 var+ expectPoly 5 []+ (lets [+ "forField">: lambda "rec" $ lambda "val" $+ lets ["r">: var "rec" @@ var "val"] $+ pair (primitive _pairs_first @@ var "r") (primitive _pairs_second @@ var "r"),+ "main">: lambda "rec" $ lambda "val" $ lambda "b" $+ primitive _logic_ifElse @@ var "b"+ @@ (var "forField" @@ var "rec" @@ var "val")+ @@ (pair (var "val") (int32 0))] $+ var "main")+ ["t0"] (T.functionMany [+ T.function (T.var "t0") (T.pair (T.var "t0") T.int32),+ T.var "t0",+ T.boolean,+ T.pair (T.var "t0") T.int32]),++ -- Models the full rewriteAndFoldTerm_r pattern with an intermediate sibling "rcases".+ -- rcases = \forFields. \val. forFields val -- rcases: forall a b. (a -> b) -> a -> b+ -- r = \forFields. \val. \b. ifElse b (rcases forFields val) (val, 0)+ -- branch 1: rcases forFields val. forFields: a -> b, val: a => result: b+ -- instantiate rcases: (a' -> b') -> a' -> b'. a' = a, b' = b. result: b+ -- branch 2: (val, 0) = (a, Int)+ -- unify b = (a, Int) => forFields: a -> (a, Int)+ -- r: forall a. (a -> (a, Int)) -> a -> Bool -> (a, Int) -- 1 var+ expectPoly 6 []+ (lets [+ "rcases">: lambda "forFields" $ lambda "val" $ var "forFields" @@ var "val",+ "r">: lambda "forFields" $ lambda "val" $ lambda "b" $+ primitive _logic_ifElse @@ var "b"+ @@ (var "rcases" @@ var "forFields" @@ var "val")+ @@ (pair (var "val") (int32 0))] $+ var "r")+ ["t0"] (T.functionMany [+ T.function (T.var "t0") (T.pair (T.var "t0") T.int32),+ T.var "t0",+ T.boolean,+ T.pair (T.var "t0") T.int32])]] where- s = primitive _math_neg- p = primitive _math_neg+ s = primitive _math_negate+ p = primitive _math_negate -testGroupForLiterals :: TTerm TestGroup-testGroupForLiterals = subgroup "Literals" [+testGroupForLiterals :: TBinding TestGroup+testGroupForLiterals = define "testGroupForLiterals" $+ subgroup "Literals" [ expectMono 1 [] (int32 42) T.int32,@@ -300,8 +462,9 @@ (float64 42.0) T.float64] -testGroupForPathologicalTerms :: TTerm TestGroup-testGroupForPathologicalTerms = supergroup "Pathological terms" [+testGroupForPathologicalTerms :: TBinding TestGroup+testGroupForPathologicalTerms = define "testGroupForPathologicalTerms" $+ supergroup "Pathological terms" [ subgroup "Recursion" [ expectPoly 1 []@@ -357,8 +520,9 @@ $ var "build" @@ int32 0) (T.list T.int32)]] -testGroupForPolymorphism :: TTerm TestGroup-testGroupForPolymorphism = supergroup "Polymorphism" [+testGroupForPolymorphism :: TBinding TestGroup+testGroupForPolymorphism = define "testGroupForPolymorphism" $+ supergroup "Polymorphism" [ subgroup "Simple lists and optionals" [ expectPoly 1 []@@ -412,10 +576,19 @@ subgroup "Mixed expressions with lambdas, constants, and primitive functions" [ expectMono 1 [] (lambda "x" $ (primitive _math_sub @@ (primitive _math_add @@ var "x" @@ var "x") @@ int32 1))+ (T.function T.int32 T.int32)],++ subgroup "Application terms" [+ expectMono 1 []+ ((lambda "x" $ var "x") @@ string "foo")+ T.string,+ expectMono 2 []+ (lambda "x" $ primitive _math_sub @@ (primitive _math_add @@ var "x" @@ var "x") @@ int32 1) (T.function T.int32 T.int32)]] -testGroupForPrimitives :: TTerm TestGroup-testGroupForPrimitives = supergroup "Primitives" [+testGroupForPrimitives :: TBinding TestGroup+testGroupForPrimitives = define "testGroupForPrimitives" $+ supergroup "Primitives" [ subgroup "Monomorphic primitive functions" [ expectMono 1 []
− src/main/haskell/Hydra/Sources/Test/Inference/InferenceSuite.hs
@@ -1,23 +0,0 @@-module Hydra.Sources.Test.Inference.InferenceSuite (inferenceTests) where--import Hydra.Kernel-import Hydra.Testing-import Hydra.Dsl.Testing as Testing-import Hydra.Sources.Test.Inference.AlgebraicTypes-import Hydra.Sources.Test.Inference.AlgorithmW-import Hydra.Sources.Test.Inference.Failures-import Hydra.Sources.Test.Inference.Fundamentals-import Hydra.Sources.Test.Inference.KernelExamples-import Hydra.Sources.Test.Inference.NominalTypes-import Hydra.Sources.Test.Inference.Simple---inferenceTests :: TTerm TestGroup-inferenceTests = supergroup "Inference tests" [- algebraicTypesTests,- algorithmWTests,- failureTests,- fundamentalsTests,- kernelExamplesTests,- nominalTypesTests,- simpleTermsTests]
src/main/haskell/Hydra/Sources/Test/Inference/KernelExamples.hs view
@@ -1,28 +1,45 @@-module Hydra.Sources.Test.Inference.KernelExamples (kernelExamplesTests) where+module Hydra.Sources.Test.Inference.KernelExamples where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Phantoms as Base-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph-import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T-import Hydra.Sources.Test.Inference.Fundamentals+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import qualified Data.Map as M-import Prelude hiding (map, sum) +ns :: Namespace+ns = Namespace "hydra.test.inference.kernelExamples" -kernelExamplesTests :: TTerm TestGroup-kernelExamplesTests = supergroup "Examples from the Hydra kernel" [- testGroupForNestedLet]+module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Inference tests for examples from the Hydra kernel")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding testGroupForNestedLet] -testGroupForNestedLet :: TTerm TestGroup-testGroupForNestedLet = supergroup "Nested let" [+define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Examples from the Hydra kernel" $+ supergroup "Examples from the Hydra kernel" [+ testGroupForNestedLet]++testGroupForNestedLet :: TBinding TestGroup+testGroupForNestedLet = define "testGroupForNestedLet" $+ supergroup "Nested let" [ subgroup "hydra.formatting.mapFirstLetter" [ expectMono 1 [tag_disabledForMinimalInference] (lambda "mapping" $ lambda "s" $ lets [@@ -32,4 +49,56 @@ @@ (primitive _strings_null @@ var "s") @@ (var "s") @@ (primitive _strings_cat2 @@ var "firstLetter" @@ (primitive _strings_fromList @@ (primitive _lists_tail @@ var "list"))))- (T.functionMany [T.function T.string T.string, T.string, T.string])]]+ (T.functionMany [T.function T.string T.string, T.string, T.string])],++ -- Simplified reproduction of fullyStripAndNormalizeType's 'go' binding using ifElse.+ -- Tests that inference gives go a monomorphic type when all types are constrained+ -- by primitive calls (Maps.insert, Math.add).+ subgroup "Recursive let with pair return (ifElse)" [+ expectMono 2 [tag_disabledForMinimalInference]+ (lambda "input" $ lets [+ "go">:+ lambda "depth" $ lambda "subst" $ lambda "s" $+ primitive _logic_ifElse+ @@ (primitive _strings_null @@ var "s")+ @@ (pair (var "subst") (var "s"))+ @@ (var "go"+ @@ (primitive _math_add @@ var "depth" @@ int32 1)+ @@ (primitive _maps_insert @@ string "key" @@ string "val" @@ var "subst")+ @@ var "s")] $+ lets [+ "result">: var "go" @@ int32 0 @@ primitive _maps_empty @@ var "input",+ "subst">: primitive _pairs_first @@ var "result",+ "body">: primitive _pairs_second @@ var "result"] $+ pair (var "subst") (var "body"))+ (T.function T.string+ (T.pair (T.map T.string T.string) T.string))],++ -- Closer reproduction of fullyStripAndNormalizeType's 'go' binding using+ -- case/match on the Type union (with a default case).+ -- The default case returns (subst, t) directly; the forall case recurses+ -- with Maps.insert constraining subst to Map Name Name.+ -- This tests whether union elimination with a default case causes+ -- inference to over-generalize the pair-first type variable.+ subgroup "Recursive let with pair return (case on Type)" [+ expectMono 3 [tag_disabledForMinimalInference]+ (lambda "typ" $ lets [+ "go">:+ lambda "depth" $ lambda "subst" $ lambda "t" $+ Terms.match (Core.nameLift _Type) (just $ pair (var "subst") (var "t")) [+ _Type_forall >>: lambda "ft" $+ var "go"+ @@ (primitive _math_add @@ var "depth" @@ int32 1)+ @@ (primitive _maps_insert+ @@ (project (Core.nameLift _ForallType) (Core.nameLift _ForallType_parameter) @@ var "ft")+ @@ (Terms.wrap (Core.nameLift _Name) (primitive _strings_cat2 @@ string "_" @@ (primitive _literals_showInt32 @@ var "depth")))+ @@ var "subst")+ @@ (project (Core.nameLift _ForallType) (Core.nameLift _ForallType_body) @@ var "ft")]+ @@ var "t"] $+ lets [+ "result">: var "go" @@ int32 0 @@ primitive _maps_empty @@ var "typ"] $+ pair (primitive _pairs_first @@ var "result") (primitive _pairs_second @@ var "result"))+ -- Expected: Type -> (Map Name Name, Type)+ -- Named types appear as TypeVariable in schemes (e.g., hydra.core.Name, hydra.core.Type)+ (T.function (T.variable "hydra.core.Type")+ (T.pair (T.map (T.variable "hydra.core.Name") (T.variable "hydra.core.Name")) (T.variable "hydra.core.Type")))]]
src/main/haskell/Hydra/Sources/Test/Inference/NominalTypes.hs view
@@ -1,175 +1,210 @@-module Hydra.Sources.Test.Inference.NominalTypes (nominalTypesTests) where+module Hydra.Sources.Test.Inference.NominalTypes where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Phantoms as Base-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph-import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T-import Hydra.Sources.Test.Inference.Fundamentals+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import qualified Data.Map as M-import Prelude hiding (map, sum)+import Hydra.Sources.Libraries -nominalTypesTests :: TTerm TestGroup-nominalTypesTests = supergroup "Nominal terms" [- testGroupForCaseStatements,- testGroupForProjections,- testGroupForRecords,- testGroupForVariants,- testGroupForWrappers]+ns :: Namespace+ns = Namespace "hydra.test.inference.nominalTypes" -testGroupForCaseStatements :: TTerm TestGroup-testGroupForCaseStatements = subgroup "Case statements" [+module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Inference tests for nominal types")+ where+ elements = [+ Phantoms.toBinding allTests,+ Phantoms.toBinding testGroupForCaseStatements,+ Phantoms.toBinding testGroupForProjections,+ Phantoms.toBinding testGroupForRecords,+ Phantoms.toBinding testGroupForVariants,+ Phantoms.toBinding testGroupForWrappers]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Nominal type tests" $+ supergroup "Nominal terms" [+ testGroupForCaseStatements,+ testGroupForProjections,+ testGroupForRecords,+ testGroupForVariants,+ testGroupForWrappers]++testGroupForCaseStatements :: TBinding TestGroup+testGroupForCaseStatements = define "testGroupForCaseStatements" $+ subgroup "Case statements" [ expectMono 1 [tag_disabledForMinimalInference]- (match (ref testTypeSimpleNumberNameDef) nothing [+ (match (TestTypes.testTypeSimpleNumberName) nothing [ "int">: lambda "x" $ var "x", "float">: lambda "x" $ int32 42])- (T.function (Core.typeVariable $ ref testTypeSimpleNumberNameDef) T.int32),+ (T.function (Core.typeVariable $ TestTypes.testTypeSimpleNumberName) T.int32), expectMono 2 [tag_disabledForMinimalInference]- (match (ref testTypeUnionMonomorphicNameDef) nothing [+ (match (TestTypes.testTypeUnionMonomorphicName) nothing [ "bool">: constant true, "string">: constant false, "unit">: constant false])- (T.function (Core.typeVariable $ ref testTypeUnionMonomorphicNameDef) T.boolean)]+ (T.function (Core.typeVariable $ TestTypes.testTypeUnionMonomorphicName) T.boolean)] -testGroupForProjections :: TTerm TestGroup-testGroupForProjections = supergroup "Projections" [+testGroupForProjections :: TBinding TestGroup+testGroupForProjections = define "testGroupForProjections" $+ supergroup "Projections" [ subgroup "Record eliminations" [ expectMono 1 [tag_disabledForMinimalInference]- (project (ref testTypePersonNameDef) (name "firstName"))- (T.function (Core.typeVariable $ ref testTypePersonNameDef) T.string)]]+ (project (TestTypes.testTypePersonName) (name "firstName"))+ (T.function (Core.typeVariable $ TestTypes.testTypePersonName) T.string)], -testGroupForRecords :: TTerm TestGroup-testGroupForRecords = supergroup "Records" [+ subgroup "Pair projections" [+ expectPoly 1 [tag_disabledForMinimalInference]+ (primitive _pairs_first)+ ["t0", "t1"] (T.function (T.pair (T.var "t0") (T.var "t1")) (T.var "t0")),+ expectMono 2 [tag_disabledForMinimalInference]+ (primitive _pairs_second @@ pair (int32 42) (string "foo"))+ T.string]] +testGroupForRecords :: TBinding TestGroup+testGroupForRecords = define "testGroupForRecords" $+ supergroup "Records" [+ subgroup "Simple records" [ expectMono 1 [tag_disabledForMinimalInference]- (record (ref testTypeLatLonNameDef) [+ (record (TestTypes.testTypeLatLonName) [ "lat">: float32 37.7749, "lon">: float32 $ negate 122.4194])- (Core.typeVariable (ref testTypeLatLonNameDef)),+ (Core.typeVariable (TestTypes.testTypeLatLonName)), expectMono 2 [tag_disabledForMinimalInference]- (record (ref testTypeLatLonPolyNameDef) [+ (record (TestTypes.testTypeLatLonPolyName) [ "lat">: float32 37.7749, "lon">: float32 $ negate 122.4194])- (T.apply (Core.typeVariable (ref testTypeLatLonPolyNameDef)) T.float32),+ (T.apply (Core.typeVariable (TestTypes.testTypeLatLonPolyName)) T.float32), expectMono 3 [tag_disabledForMinimalInference]- (lambda "lon" (record (ref testTypeLatLonPolyNameDef) [+ (lambda "lon" (record (TestTypes.testTypeLatLonPolyName) [ "lat">: float32 37.7749, "lon">: var "lon"]))- (T.function T.float32 (T.apply (Core.typeVariable (ref testTypeLatLonPolyNameDef)) T.float32)),+ (T.function T.float32 (T.apply (Core.typeVariable (TestTypes.testTypeLatLonPolyName)) T.float32)), expectPoly 4 [tag_disabledForMinimalInference]- (lambda "latlon" (record (ref testTypeLatLonPolyNameDef) [+ (lambda "latlon" (record (TestTypes.testTypeLatLonPolyName) [ "lat">: var "latlon", "lon">: var "latlon"]))- ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable (ref testTypeLatLonPolyNameDef)) (T.var "t0"))),+ ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable (TestTypes.testTypeLatLonPolyName)) (T.var "t0"))), expectMono 5 [tag_disabledForMinimalInference]- (ref testDataArthurDef)- (Core.typeVariable (ref testTypePersonNameDef))],+ (TestTerms.testDataArthur)+ (Core.typeVariable (TestTypes.testTypePersonName))], subgroup "Record instances of simply recursive record types" [ expectMono 1 [tag_disabledForMinimalInference]- (record (ref testTypeIntListNameDef) [+ (record (TestTypes.testTypeIntListName) [ "head">: int32 42,- "tail">: optional $ just (record (ref testTypeIntListNameDef) [+ "tail">: optional $ just (record (TestTypes.testTypeIntListName) [ "head">: int32 43, "tail">: optional nothing])])- (Core.typeVariable (ref testTypeIntListNameDef)),+ (Core.typeVariable (TestTypes.testTypeIntListName)), expectMono 2 [tag_disabledForMinimalInference]- ((lambda "x" $ record (ref testTypeIntListNameDef) [+ ((lambda "x" $ record (TestTypes.testTypeIntListName) [ "head">: var "x",- "tail">: optional $ just (record (ref testTypeIntListNameDef) [+ "tail">: optional $ just (record (TestTypes.testTypeIntListName) [ "head">: var "x", "tail">: optional nothing])]) @@ int32 42)- (Core.typeVariable (ref testTypeIntListNameDef)),+ (Core.typeVariable (TestTypes.testTypeIntListName)), expectMono 3 [tag_disabledForMinimalInference]- (record (ref testTypeListNameDef) [+ (record (TestTypes.testTypeListName) [ "head">: int32 42,- "tail">: optional $ just (record (ref testTypeListNameDef) [+ "tail">: optional $ just (record (TestTypes.testTypeListName) [ "head">: int32 43, "tail">: optional nothing])])- (T.apply (Core.typeVariable (ref testTypeListNameDef)) T.int32),+ (T.apply (Core.typeVariable (TestTypes.testTypeListName)) T.int32), expectMono 4 [tag_disabledForMinimalInference]- ((lambda "x" $ record (ref testTypeListNameDef) [+ ((lambda "x" $ record (TestTypes.testTypeListName) [ "head">: var "x",- "tail">: optional $ just (record (ref testTypeListNameDef) [+ "tail">: optional $ just (record (TestTypes.testTypeListName) [ "head">: var "x", "tail">: optional nothing])]) @@ int32 42)- (T.apply (Core.typeVariable (ref testTypeListNameDef)) T.int32),+ (T.apply (Core.typeVariable (TestTypes.testTypeListName)) T.int32), expectPoly 5 [tag_disabledForMinimalInference]- (lambda "x" $ record (ref testTypeListNameDef) [+ (lambda "x" $ record (TestTypes.testTypeListName) [ "head">: var "x",- "tail">: optional $ just (record (ref testTypeListNameDef) [+ "tail">: optional $ just (record (TestTypes.testTypeListName) [ "head">: var "x", "tail">: optional nothing])])- ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable (ref testTypeListNameDef)) (T.var "t0")))],+ ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable (TestTypes.testTypeListName)) (T.var "t0")))], subgroup "Record instances of mutually recursive record types" [ expectMono 1 [tag_disabledForMinimalInference]- ((lambda "x" $ record (ref testTypeBuddyListANameDef) [+ ((lambda "x" $ record (TestTypes.testTypeBuddyListAName) [ "head">: var "x",- "tail">: optional $ just $ record (ref testTypeBuddyListBNameDef) [+ "tail">: optional $ just $ record (TestTypes.testTypeBuddyListBName) [ "head">: var "x", "tail">: optional nothing]]) @@ int32 42)- (T.apply (Core.typeVariable $ ref testTypeBuddyListANameDef) T.int32),+ (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) T.int32), expectPoly 2 [tag_disabledForMinimalInference]- (lambda "x" $ record (ref testTypeBuddyListANameDef) [+ (lambda "x" $ record (TestTypes.testTypeBuddyListAName) [ "head">: var "x",- "tail">: optional $ just $ record (ref testTypeBuddyListBNameDef) [+ "tail">: optional $ just $ record (TestTypes.testTypeBuddyListBName) [ "head">: var "x", "tail">: optional nothing]])- ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable $ ref testTypeBuddyListANameDef) (T.var "t0")))]]+ ["t0"] (T.function (T.var "t0") (T.apply (Core.typeVariable $ TestTypes.testTypeBuddyListAName) (T.var "t0")))]] -testGroupForVariants :: TTerm TestGroup-testGroupForVariants = supergroup "Variant terms" [+testGroupForVariants :: TBinding TestGroup+testGroupForVariants = define "testGroupForVariants" $+ supergroup "Variant terms" [ subgroup "Variants" [ expectMono 1 [tag_disabledForMinimalInference]- (inject (ref testTypeTimestampNameDef) "unixTimeMillis" $ uint64 1638200308368)- (Core.typeVariable (ref testTypeTimestampNameDef)),+ (inject (TestTypes.testTypeTimestampName) "unixTimeMillis" $ uint64 1638200308368)+ (Core.typeVariable (TestTypes.testTypeTimestampName)), expectMono 2 [tag_disabledForMinimalInference]- (inject (ref testTypeUnionMonomorphicNameDef) "string" $ string "bar")- (Core.typeVariable (ref testTypeUnionMonomorphicNameDef))],+ (inject (TestTypes.testTypeUnionMonomorphicName) "string" $ string "bar")+ (Core.typeVariable (TestTypes.testTypeUnionMonomorphicName))], -- TODO: inference failure test cases -- H.it "test #3" $ -- expectFailure--- (inject testTypeUnionMonomorphicName $ Field (Name "string") $ int32 42)+-- (inject TestTypes.testTypeUnionMonomorphicName $ Field (Name "string") $ int32 42) subgroup "Polymorphic and recursive variants" [ expectPoly 1 [tag_disabledForMinimalInference]- (inject (ref testTypeUnionPolymorphicRecursiveNameDef) "bool" true)- ["t0"] (T.apply (Core.typeVariable (ref testTypeUnionPolymorphicRecursiveNameDef)) (T.var "t0")),+ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "bool" true)+ ["t0"] (T.apply (Core.typeVariable (TestTypes.testTypeUnionPolymorphicRecursiveName)) (T.var "t0")), expectMono 2 [tag_disabledForMinimalInference]- (inject (ref testTypeUnionPolymorphicRecursiveNameDef) "value" $ string "foo")- (T.apply (Core.typeVariable (ref testTypeUnionPolymorphicRecursiveNameDef)) T.string),+ (inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" $ string "foo")+ (T.apply (Core.typeVariable (TestTypes.testTypeUnionPolymorphicRecursiveName)) T.string), expectMono 3 [tag_disabledForMinimalInference] (lets [- "other">: inject (ref testTypeUnionPolymorphicRecursiveNameDef) "value" $ int32 42]- $ inject (ref testTypeUnionPolymorphicRecursiveNameDef) "other" $ var "other")- (T.apply (Core.typeVariable (ref testTypeUnionPolymorphicRecursiveNameDef)) T.int32)]]+ "other">: inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "value" $ int32 42]+ $ inject (TestTypes.testTypeUnionPolymorphicRecursiveName) "other" $ var "other")+ (T.apply (Core.typeVariable (TestTypes.testTypeUnionPolymorphicRecursiveName)) T.int32)]] -testGroupForWrappers :: TTerm TestGroup-testGroupForWrappers = supergroup "Wrapper introductions and eliminations" [+testGroupForWrappers :: TBinding TestGroup+testGroupForWrappers = define "testGroupForWrappers" $+ supergroup "Wrapper introductions and eliminations" [ subgroup "Wrapper introductions" [ expectMono 1 [tag_disabledForMinimalInference]- (wrap (ref testTypeStringAliasNameDef) $ string "foo")- (Core.typeVariable $ ref testTypeStringAliasNameDef),+ (wrap (TestTypes.testTypeStringAliasName) $ string "foo")+ (Core.typeVariable $ TestTypes.testTypeStringAliasName), expectMono 2 [tag_disabledForMinimalInference]- (lambda "v" $ wrap (ref testTypeStringAliasNameDef) $ var "v")- (T.function T.string (Core.typeVariable $ ref testTypeStringAliasNameDef))],+ (lambda "v" $ wrap (TestTypes.testTypeStringAliasName) $ var "v")+ (T.function T.string (Core.typeVariable $ TestTypes.testTypeStringAliasName))], subgroup "Wrapper eliminations" [ expectMono 1 [tag_disabledForMinimalInference]- (unwrap (ref testTypeStringAliasNameDef))- (T.function (Core.typeVariable $ ref testTypeStringAliasNameDef) T.string),+ (unwrap (TestTypes.testTypeStringAliasName))+ (T.function (Core.typeVariable $ TestTypes.testTypeStringAliasName) T.string), expectMono 2 [tag_disabledForMinimalInference]- (unwrap (ref testTypeStringAliasNameDef) @@ (wrap (ref testTypeStringAliasNameDef) $ string "foo"))+ (unwrap (TestTypes.testTypeStringAliasName) @@ (wrap (TestTypes.testTypeStringAliasName) $ string "foo")) T.string]]
− src/main/haskell/Hydra/Sources/Test/Inference/Simple.hs
@@ -1,272 +0,0 @@-module Hydra.Sources.Test.Inference.Simple (simpleTermsTests) where--import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Phantoms as Base-import qualified Hydra.Dsl.Core as Core-import Hydra.Dsl.Testing as Testing-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Test.TestGraph-import Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Dsl.TTypes as T-import Hydra.Sources.Test.Inference.Fundamentals--import qualified Data.Map as M-import Prelude hiding (map, sum)---simpleTermsTests :: TTerm TestGroup-simpleTermsTests = supergroup "Simple terms" [- testGroupForApplicationTerms,- testGroupForFunctionTerms,- testGroupForIndividualTerms,- testGroupForLetTerms,- testGroupForListTerms,- testGroupForPrimitiveTerms,- testGroupForProductTerms,- testGroupForSumTerms]--testGroupForApplicationTerms :: TTerm TestGroup-testGroupForApplicationTerms = subgroup "Application terms" [- expectMono 1 []- ((lambda "x" $ var "x") @@ string "foo")- T.string,- expectMono 2 []- (lambda "x" $ primitive _math_sub @@ (primitive _math_add @@ var "x" @@ var "x") @@ int32 1)- (T.function T.int32 T.int32)]--testGroupForFunctionTerms :: TTerm TestGroup-testGroupForFunctionTerms = supergroup "Function terms" [-- subgroup "Lambdas" [- expectPoly 1 []- (lambda "x" $ var "x")- ["t0"] (T.function (T.var "t0") (T.var "t0")),- expectPoly 2 []- (lambda "x" $ int16 137)- ["t0"] (T.function (T.var "t0") T.int16)],-- subgroup "List eliminations" [- expectMono 1 [tag_disabledForMinimalInference]- foldAdd- (T.functionMany [T.int32, T.list T.int32, T.int32]),- expectMono 2 [tag_disabledForMinimalInference]- (apply foldAdd $ int32 0)- (T.function (T.list T.int32) T.int32),- expectMono 3 [tag_disabledForMinimalInference]- (apply (apply foldAdd $ int32 0) (list (int32 <$> [1, 2, 3, 4, 5])))- T.int32],-- subgroup "Optional eliminations" [- expectMono 1 [tag_disabledForMinimalInference]- (primitive _optionals_maybe @@ (int32 42) @@ (primitive _math_neg))- (T.function (T.optional T.int32) T.int32),- expectMono 2 [tag_disabledForMinimalInference]- (primitive _optionals_maybe @@ (int32 42) @@ (primitive _math_neg) @@ (optional (just $ int32 137)))- T.int32,- expectMono 3 [tag_disabledForMinimalInference]- (primitive _optionals_maybe @@ (int32 42) @@ (primitive _math_neg) @@ optional nothing)- T.int32,- expectPoly 4 [tag_disabledForMinimalInference]- (lambda "x" $ primitive _optionals_maybe @@ (var "x") @@ (primitive _optionals_pure) @@ var "x")- ["t0"] (T.function (T.optional $ T.var "t0") (T.optional $ T.var "t0")),- expectPoly 5 [tag_disabledForMinimalInference]- (primitive _optionals_maybe @@ (list []) @@ (lambda "x" $ list [var "x"]))- ["t0"] (T.function (T.optional $ T.var "t0") (T.list $ T.var "t0"))],-- subgroup "Tuple projections" [- expectPoly 1 [tag_disabledForMinimalInference]- (untuple 2 0)- ["t0", "t1"] (T.function (T.product [T.var "t0", T.var "t1"]) (T.var "t0")),- expectMono 2 [tag_disabledForMinimalInference]- (untuple 2 1 @@ pair (int32 42) (string "foo"))- T.string,- expectPoly 3 [tag_disabledForMinimalInference]- (lambda "x" $ untuple 1 0 @@ tuple [var "x"])- ["t0"] (T.function (T.var "t0") (T.var "t0")),- expectPoly 4 [tag_disabledForMinimalInference]- (lambda "x" $ untuple 3 2 @@ tuple [var "x", var "x", int32 42])- ["t0"] (T.function (T.var "t0") T.int32)]]-- where- foldAdd = primitive _lists_foldl @@ primitive _math_add--testGroupForIndividualTerms :: TTerm TestGroup-testGroupForIndividualTerms = supergroup "Individual terms" [-- subgroup "Literal values" [- expectMono 1 []- (int32 42)- T.int32,- expectMono 2 []- (string "foo")- T.string,- expectMono 3 []- false- T.boolean,- expectMono 4 []- (float64 42.0)- T.float64],-- subgroup "Let terms" [- expectPoly 1 []- (lets ["x">: float32 42.0] $ lambdas ["y", "z"] $ var "x")- ["t0", "t1"] (T.function (T.var "t0") (T.function (T.var "t1") T.float32)),- -- Example from https://www.cs.cornell.edu/courses/cs6110/2017sp/lectures/lec23.pdf- expectMono 2 []- (lets [- "square">: lambda "z" $ primitive _math_mul @@ var "z" @@ var "z"] $- lambdas ["f", "x", "y"] $ primitive _logic_ifElse- @@ (var "f" @@ (var "square" @@ var "x") @@ var "y")- @@ (var "f" @@ var "x" @@ (var "f" @@ var "x" @@ var "y"))- @@ (var "f" @@ var "x" @@ var "y"))- (T.functionMany [- T.functionMany [T.int32, T.boolean, T.boolean], T.int32, T.boolean, T.boolean])],-- subgroup "Optionals" [- expectMono 1 [tag_disabledForMinimalInference]- (optional $ just $ int32 42)- (T.optional T.int32),- expectPoly 2 [tag_disabledForMinimalInference]- (optional nothing)- ["t0"] (T.optional $ T.var "t0")],-- subgroup "Products" [- expectMono 1 []- (tuple [])- (T.product []),- expectMono 2 []- (pair (int32 42) (string "foo"))- (T.product [T.int32, T.string])],-- subgroup "Sets" [- expectMono 1 [tag_disabledForMinimalInference]- (set [true])- (T.set T.boolean),- expectPoly 2 [tag_disabledForMinimalInference]- (set [set []])- ["t0"] (T.set $ T.set $ T.var "t0")],-- subgroup "Maps" [- expectMono 1 [tag_disabledForMinimalInference]- (mapTermCheat [- (Terms.string "firstName", Terms.string "Arthur"),- (Terms.string "lastName", Terms.string "Dent")])- (T.map T.string T.string),- expectPoly 2 [tag_disabledForMinimalInference]- (TTerms.map Maps.empty)- ["t0", "t1"] (T.map (T.var "t0") (T.var "t1")),- expectPoly 3 [tag_disabledForMinimalInference]- (lambdas ["x", "y"] $ mapTermCheat- [(Terms.var "x", Terms.float64 0.1), (Terms.var "y", Terms.float64 0.2)])- ["t0"] (T.function (T.var "t0") (T.function (T.var "t0") (T.map (T.var "t0") T.float64)))]]---- -- TODO: add a case for a recursive nominal type -- e.g. MyList := () + (int, Mylist)--- subgroup "Nominal (newtype) terms" [--- expectMono []--- testDataArthur--- (T.wrap "Person")--- expectMono []--- (lambda "x" (record [--- Field "firstName" $ var "x",--- Field "lastName" $ var "x",--- Field "age" $ int32 42]))--- (T.function T.string testTypePerson)--testGroupForLetTerms :: TTerm TestGroup-testGroupForLetTerms = supergroup "Let terms" [-- subgroup "Empty let" [- expectMono 1 []- (lets [] $ int32 42)- T.int32],-- subgroup "Trivial let" [- expectMono 2 []- (lets [- "foo">: int32 42]- $ var "foo")- T.int32]]--testGroupForListTerms :: TTerm TestGroup-testGroupForListTerms = supergroup "List terms" [-- subgroup "List of strings" [- expectMono 1 []- (list [string "foo", string "bar"])- (T.list T.string)],- subgroup "List of lists of strings" [- expectMono 1 []- (list [list [string "foo"], list []])- (T.list $ T.list T.string)],- subgroup "Empty list" [- expectPoly 1 []- (list [])- ["t0"] (T.list $ T.var "t0")],- subgroup "List containing an empty list" [- expectPoly 1 []- (list [list []])- ["t0"] (T.list $ T.list $ T.var "t0")],- subgroup "Lambda producing a list of integers" [- expectMono 1 []- (lambda "x" (list [var "x", int32 42]))- (T.function T.int32 $ T.list T.int32)],- subgroup "List with bound variables" [- expectMono 1 []- (lambda "x" (list [var "x", string "foo", var "x"]))- (T.function T.string (T.list T.string))]]--testGroupForPrimitiveTerms :: TTerm TestGroup-testGroupForPrimitiveTerms = supergroup "Primitive terms" [-- subgroup "Monomorphic primitive functions" [- expectMono 1 []- (primitive $ Name "hydra.lib.strings.length")- (T.function T.string T.int32),- expectMono 2 []- (primitive _math_sub)- (T.function T.int32 (T.function T.int32 T.int32))],- subgroup "Polymorphic primitive functions" [- expectPoly 1 []- (lambda "els" (apply (primitive _lists_length) (apply (primitive _lists_concat) $ var "els")))- ["t0"] (T.function (T.list $ T.list $ T.var "t0") T.int32)]]--testGroupForProductTerms :: TTerm TestGroup-testGroupForProductTerms = supergroup "Product terms" [-- subgroup "Empty product" [- expectMono 1 []- (tuple [])- (T.product [])],- subgroup "Non-empty monotyped products" [- expectMono 1 []- (tuple [string "foo", int32 42])- (T.product [T.string, T.int32]),- expectMono 2 []- (tuple [string "foo", list [float32 42.0, float32 137.0]])- (T.product [T.string, T.list T.float32])],- subgroup "Polytyped products" [- expectPoly 1 []- (tuple [list [], string "foo"])- ["t0"] (T.product [T.list $ T.var "t0", T.string])]]--testGroupForSumTerms :: TTerm TestGroup-testGroupForSumTerms = supergroup "Sum terms" [-- subgroup "Singleton sum terms" [- expectMono 1 [tag_disabledForMinimalInference]- (sum 0 1 $ string "foo")- (T.sum [T.string]),- expectPoly 2 [tag_disabledForMinimalInference]- (sum 0 1 $ list [])- ["t0"] (T.sum [T.list $ T.var "t0"])],- subgroup "Non-singleton sum terms" [- expectPoly 1 [tag_disabledForMinimalInference]- (sum 0 2 $ string "foo")- ["t0"] (T.sum [T.string, T.var "t0"]),- expectPoly 2 [tag_disabledForMinimalInference]- (sum 1 2 $ string "foo")- ["t0"] (T.sum [T.var "t0", T.string])]]
+ src/main/haskell/Hydra/Sources/Test/Json/Coder.hs view
@@ -0,0 +1,231 @@+-- | Test cases for the type-directed JSON coder+module Hydra.Sources.Test.Json.Coder where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this module+import Hydra.Json.Model (Value)+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Json as Json+++ns :: Namespace+ns = Namespace "hydra.test.json.coder"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for the type-directed JSON coder (Hydra Term <-> JSON Value)")+ where+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for the type-directed JSON coder" $+ supergroup "JSON coder" [+ literalCoderGroup,+ integerCoderGroup,+ floatCoderGroup,+ collectionCoderGroup,+ optionalCoderGroup,+ recordCoderGroup]++-- Helper for creating JSON coder test cases+coderTest :: String -> TTerm Type -> TTerm Term -> TTerm Value -> TTerm TestCaseWithMetadata+coderTest name typ term json = testCaseWithMetadata (Phantoms.string name)+ (testCaseJsonCoder $ jsonCoderTestCase typ term json)+ Phantoms.nothing (Phantoms.list ([] :: [TTerm Tag]))++-- | Test cases for literal type encoding/decoding+literalCoderGroup :: TTerm TestGroup+literalCoderGroup = subgroup "literal types" [+ -- Booleans+ coderTest "boolean true"+ T.boolean+ (Terms.boolean True)+ (Json.valueBoolean $ Phantoms.boolean True),+ coderTest "boolean false"+ T.boolean+ (Terms.boolean False)+ (Json.valueBoolean $ Phantoms.boolean False),++ -- Integers+ coderTest "int32 positive"+ T.int32+ (Terms.int32 42)+ (Json.valueNumber $ Phantoms.bigfloat 42.0),+ coderTest "int32 negative"+ T.int32+ (Terms.int32 (-17))+ (Json.valueNumber $ Phantoms.bigfloat (-17.0)),+ coderTest "int32 zero"+ T.int32+ (Terms.int32 0)+ (Json.valueNumber $ Phantoms.bigfloat 0.0),++ -- Floats (using exact binary fractions to avoid precision issues)+ coderTest "float32"+ T.float32+ (Terms.float32 1.5)+ (Json.valueNumber $ Phantoms.bigfloat 1.5),+ coderTest "float64"+ T.float64+ (Terms.float64 2.718)+ (Json.valueNumber $ Phantoms.bigfloat 2.718),++ -- Strings+ coderTest "string simple"+ T.string+ (Terms.string "hello")+ (Json.valueString $ Phantoms.string "hello"),+ coderTest "string empty"+ T.string+ (Terms.string "")+ (Json.valueString $ Phantoms.string ""),+ coderTest "string with spaces"+ T.string+ (Terms.string "hello world")+ (Json.valueString $ Phantoms.string "hello world")]++-- | Test cases for all integer types+integerCoderGroup :: TTerm TestGroup+integerCoderGroup = subgroup "integer types" [+ -- int8+ coderTest "int8 positive"+ T.int8+ (Terms.int8 127)+ (Json.valueNumber $ Phantoms.bigfloat 127.0),+ coderTest "int8 negative"+ T.int8+ (Terms.int8 (-128))+ (Json.valueNumber $ Phantoms.bigfloat (-128.0)),++ -- int16+ coderTest "int16 positive"+ T.int16+ (Terms.int16 1000)+ (Json.valueNumber $ Phantoms.bigfloat 1000.0),+ coderTest "int16 negative"+ T.int16+ (Terms.int16 (-1000))+ (Json.valueNumber $ Phantoms.bigfloat (-1000.0)),++ -- uint8+ coderTest "uint8 max"+ T.uint8+ (Terms.uint8 255)+ (Json.valueNumber $ Phantoms.bigfloat 255.0),+ coderTest "uint8 zero"+ T.uint8+ (Terms.uint8 0)+ (Json.valueNumber $ Phantoms.bigfloat 0.0),++ -- uint16+ coderTest "uint16 positive"+ T.uint16+ (Terms.uint16 60000)+ (Json.valueNumber $ Phantoms.bigfloat 60000.0),++ -- uint32+ coderTest "uint32 positive"+ T.uint32+ (Terms.uint32 4000000000)+ (Json.valueNumber $ Phantoms.bigfloat 4000000000.0),++ -- uint64+ coderTest "uint64 positive"+ T.uint64+ (Terms.uint64 1000000)+ (Json.valueNumber $ Phantoms.bigfloat 1000000.0),++ -- bigint (encoded as number, like other integer types)+ coderTest "bigint positive"+ T.bigint+ (Terms.bigint 123456789012345)+ (Json.valueNumber $ Phantoms.bigfloat 123456789012345.0),+ coderTest "bigint negative"+ T.bigint+ (Terms.bigint (-999999999999))+ (Json.valueNumber $ Phantoms.bigfloat (-999999999999.0))]++-- | Test cases for float types+floatCoderGroup :: TTerm TestGroup+floatCoderGroup = subgroup "float types" [+ -- bigfloat (note: like bigint, these may be encoded as strings for precision in some cases)+ coderTest "bigfloat positive"+ T.bigfloat+ (Terms.bigfloat 3.14159265359)+ (Json.valueNumber $ Phantoms.bigfloat 3.14159265359),+ coderTest "bigfloat negative"+ T.bigfloat+ (Terms.bigfloat (-2.71828))+ (Json.valueNumber $ Phantoms.bigfloat (-2.71828)),+ coderTest "bigfloat zero"+ T.bigfloat+ (Terms.bigfloat 0.0)+ (Json.valueNumber $ Phantoms.bigfloat 0.0)]++-- | Test cases for collection type encoding/decoding+collectionCoderGroup :: TTerm TestGroup+collectionCoderGroup = subgroup "collection types" [+ -- Lists+ coderTest "list of integers"+ (T.list T.int32)+ (Terms.list [Terms.int32 1, Terms.int32 2, Terms.int32 3])+ (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0,+ Json.valueNumber $ Phantoms.bigfloat 3.0]),+ coderTest "list of strings"+ (T.list T.string)+ (Terms.list [Terms.string "a", Terms.string "b"])+ (Json.valueArray $ Phantoms.list [+ Json.valueString $ Phantoms.string "a",+ Json.valueString $ Phantoms.string "b"]),+ coderTest "empty list"+ (T.list T.int32)+ (Terms.list [])+ (Json.valueArray $ Phantoms.list ([] :: [TTerm Value]))]+ -- Note: Map tests are more complex due to the map term representation++-- | Test cases for optional type encoding/decoding+optionalCoderGroup :: TTerm TestGroup+optionalCoderGroup = subgroup "optional types" [+ coderTest "optional string with value"+ (T.optional T.string)+ (Terms.optional $ Phantoms.just $ Terms.string "hello")+ (Json.valueString $ Phantoms.string "hello"),+ coderTest "optional string nothing"+ (T.optional T.string)+ (Terms.optional Phantoms.nothing)+ Json.valueNull,+ coderTest "optional int with value"+ (T.optional T.int32)+ (Terms.optional $ Phantoms.just $ Terms.int32 42)+ (Json.valueNumber $ Phantoms.bigfloat 42.0),+ coderTest "optional int nothing"+ (T.optional T.int32)+ (Terms.optional Phantoms.nothing)+ Json.valueNull]++-- | Test cases for record type encoding/decoding+recordCoderGroup :: TTerm TestGroup+recordCoderGroup = subgroup "record types" ([] :: [TTerm TestCaseWithMetadata])
+ src/main/haskell/Hydra/Sources/Test/Json/Parser.hs view
@@ -0,0 +1,181 @@+module Hydra.Sources.Test.Json.Parser where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this module+import Hydra.Json.Model (Value)+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Json as Json+import qualified Hydra.Dsl.Meta.Parsing as Parsing+++ns :: Namespace+ns = Namespace "hydra.test.json.parser"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for JSON parsing")+ where+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for JSON parsing" $+ supergroup "JSON parsing" [+ primitivesGroup,+ stringsGroup,+ arraysGroup,+ objectsGroup,+ nestedGroup,+ whitespaceGroup]++-- Helper for creating successful JSON parser test cases+parserCase :: String -> String -> TTerm Value -> TTerm TestCaseWithMetadata+parserCase name input expectedValue = testCaseWithMetadata (Phantoms.string name)+ (testCaseJsonParser $ jsonParserTestCase (Phantoms.string input)+ (Parsing.parseResultSuccess $ Parsing.parseSuccess expectedValue (Phantoms.string "")))+ Phantoms.nothing (Phantoms.list ([] :: [TTerm Tag]))++primitivesGroup :: TTerm TestGroup+primitivesGroup = subgroup "primitives" [+ -- Null+ parserCase "null" "null" Json.valueNull,++ -- Booleans+ parserCase "true" "true" (Json.valueBoolean $ Phantoms.boolean True),+ parserCase "false" "false" (Json.valueBoolean $ Phantoms.boolean False),++ -- Numbers - integers+ parserCase "zero" "0" (Json.valueNumber $ Phantoms.bigfloat 0.0),+ parserCase "positive integer" "42" (Json.valueNumber $ Phantoms.bigfloat 42.0),+ parserCase "negative integer" "-17" (Json.valueNumber $ Phantoms.bigfloat (-17.0)),+ parserCase "large integer" "1000000" (Json.valueNumber $ Phantoms.bigfloat 1000000.0),++ -- Numbers - decimals+ parserCase "decimal" "3.14" (Json.valueNumber $ Phantoms.bigfloat 3.14),+ parserCase "negative decimal" "-2.5" (Json.valueNumber $ Phantoms.bigfloat (-2.5)),++ -- Numbers - scientific notation+ parserCase "scientific notation" "1e3" (Json.valueNumber $ Phantoms.bigfloat 1000.0),+ parserCase "scientific with decimal" "1.5e2" (Json.valueNumber $ Phantoms.bigfloat 150.0),+ parserCase "negative exponent" "1e-2" (Json.valueNumber $ Phantoms.bigfloat 0.01)]++stringsGroup :: TTerm TestGroup+stringsGroup = subgroup "strings" [+ -- Basic strings+ parserCase "empty string" "\"\"" (Json.valueString $ Phantoms.string ""),+ parserCase "simple string" "\"hello\"" (Json.valueString $ Phantoms.string "hello"),+ parserCase "string with spaces" "\"hello world\"" (Json.valueString $ Phantoms.string "hello world"),++ -- Escape sequences+ parserCase "escaped double quote" "\"say \\\"hi\\\"\"" (Json.valueString $ Phantoms.string "say \"hi\""),+ parserCase "escaped backslash" "\"path\\\\to\\\\file\"" (Json.valueString $ Phantoms.string "path\\to\\file"),+ parserCase "escaped newline" "\"line1\\nline2\"" (Json.valueString $ Phantoms.string "line1\nline2"),+ parserCase "escaped carriage return" "\"line1\\rline2\"" (Json.valueString $ Phantoms.string "line1\rline2"),+ parserCase "escaped tab" "\"col1\\tcol2\"" (Json.valueString $ Phantoms.string "col1\tcol2"),+ parserCase "escaped forward slash" "\"a\\/b\"" (Json.valueString $ Phantoms.string "a/b")]++arraysGroup :: TTerm TestGroup+arraysGroup = subgroup "arrays" [+ -- Empty and single element+ parserCase "empty array" "[]" (Json.valueArray $ Phantoms.list ([] :: [TTerm Value])),+ parserCase "single element" "[1]" (Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 1.0]),++ -- Multiple elements+ parserCase "multiple numbers" "[1, 2, 3]" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0,+ Json.valueNumber $ Phantoms.bigfloat 3.0]),++ parserCase "multiple strings" "[\"a\", \"b\"]" (Json.valueArray $ Phantoms.list [+ Json.valueString $ Phantoms.string "a",+ Json.valueString $ Phantoms.string "b"]),++ -- Mixed types+ parserCase "mixed types" "[1, \"two\", true, null]" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueString $ Phantoms.string "two",+ Json.valueBoolean $ Phantoms.boolean True,+ Json.valueNull])]++objectsGroup :: TTerm TestGroup+objectsGroup = subgroup "objects" [+ -- Empty and single key+ parserCase "empty object" "{}" (Json.valueObject $ Phantoms.map M.empty),+ parserCase "single key-value" "{\"name\": \"Alice\"}" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "name", Json.valueString $ Phantoms.string "Alice")]),++ -- Multiple keys+ parserCase "multiple keys" "{\"a\": 1, \"b\": 2}" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "a", Json.valueNumber $ Phantoms.bigfloat 1.0),+ (Phantoms.string "b", Json.valueNumber $ Phantoms.bigfloat 2.0)]),++ -- Mixed value types+ parserCase "mixed value types" "{\"active\": true, \"count\": 42, \"name\": \"test\"}" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "count", Json.valueNumber $ Phantoms.bigfloat 42.0),+ (Phantoms.string "name", Json.valueString $ Phantoms.string "test"),+ (Phantoms.string "active", Json.valueBoolean $ Phantoms.boolean True)])]++nestedGroup :: TTerm TestGroup+nestedGroup = subgroup "nested structures" [+ -- Array of arrays+ parserCase "nested arrays" "[[1, 2], [3, 4]]" (Json.valueArray $ Phantoms.list [+ Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 1.0, Json.valueNumber $ Phantoms.bigfloat 2.0],+ Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 3.0, Json.valueNumber $ Phantoms.bigfloat 4.0]]),++ -- Object with array+ parserCase "object with array" "{\"items\": [1, 2]}" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "items", Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0])]),++ -- Array of objects+ parserCase "array of objects" "[{\"id\": 1}, {\"id\": 2}]" (Json.valueArray $ Phantoms.list [+ Json.valueObject $ Phantoms.map $ M.singleton (Phantoms.string "id") (Json.valueNumber $ Phantoms.bigfloat 1.0),+ Json.valueObject $ Phantoms.map $ M.singleton (Phantoms.string "id") (Json.valueNumber $ Phantoms.bigfloat 2.0)]),++ -- Nested object+ parserCase "nested object" "{\"user\": {\"name\": \"Bob\"}}" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "user", Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "name", Json.valueString $ Phantoms.string "Bob")])])]++whitespaceGroup :: TTerm TestGroup+whitespaceGroup = subgroup "whitespace handling" [+ -- Leading/trailing whitespace+ parserCase "leading whitespace" " null" Json.valueNull,+ parserCase "trailing whitespace" "null " Json.valueNull,+ parserCase "both whitespace" " null " Json.valueNull,++ -- Whitespace in arrays+ parserCase "array with whitespace" "[ 1 , 2 , 3 ]" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0,+ Json.valueNumber $ Phantoms.bigfloat 3.0]),++ -- Whitespace in objects+ parserCase "object with whitespace" "{ \"a\" : 1 }" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "a", Json.valueNumber $ Phantoms.bigfloat 1.0)]),++ -- Newlines+ parserCase "multiline array" "[\n 1,\n 2\n]" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0])]
+ src/main/haskell/Hydra/Sources/Test/Json/Roundtrip.hs view
@@ -0,0 +1,129 @@+-- | Round-trip test cases for the Either-based JSON encoder and decoder+--+-- These tests verify that:+-- 1. Terms can be encoded to JSON and decoded back to the original term+-- 2. The encoder and decoder handle all supported term constructs correctly+--+-- Note: These tests use the existing Flow-based JSON coder for now.+-- The Either-based encoder/decoder will be used once generated.+module Hydra.Sources.Test.Json.Roundtrip where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this module+import Hydra.Testing+++ns :: Namespace+ns = Namespace "hydra.test.json.roundtrip"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Round-trip test cases for JSON encoding and decoding")+ where+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Round-trip test cases for JSON encoding and decoding" $+ supergroup "JSON round-trip" [+ literalRoundtripGroup,+ collectionRoundtripGroup,+ optionalRoundtripGroup]++-- Helper for creating JSON round-trip test cases+roundtripTest :: String -> TTerm Type -> TTerm Term -> TTerm TestCaseWithMetadata+roundtripTest testName typ term = jsonRoundtripCase testName typ term++----------------------------------------+-- Literal types+----------------------------------------++literalRoundtripGroup :: TTerm TestGroup+literalRoundtripGroup = subgroup "literal types" [+ -- Booleans+ roundtripTest "boolean true" T.boolean (boolean True),+ roundtripTest "boolean false" T.boolean (boolean False),++ -- Integers (native JSON numbers - fit within JSON precision)+ roundtripTest "int8 positive" T.int8 (int8 42),+ roundtripTest "int8 negative" T.int8 (int8 (-17)),+ roundtripTest "int16" T.int16 (int16 1000),+ roundtripTest "int32" T.int32 (int32 100000),+ roundtripTest "uint8" T.uint8 (uint8 200),+ roundtripTest "uint16" T.uint16 (uint16 50000),++ -- Larger integers (within JSON safe integer range ~2^53)+ roundtripTest "int64" T.int64 (int64 1000000000000),+ roundtripTest "uint32" T.uint32 (uint32 4000000000),++ -- Floats+ roundtripTest "float32" T.float32 (float32 1.5),+ roundtripTest "float64" T.float64 (float64 3.14159),++ -- Strings+ roundtripTest "string simple" T.string (string "hello"),+ roundtripTest "string empty" T.string (string ""),+ roundtripTest "string with spaces" T.string (string "hello world")]++----------------------------------------+-- Collection types+----------------------------------------++collectionRoundtripGroup :: TTerm TestGroup+collectionRoundtripGroup = subgroup "collection types" [+ -- Lists+ roundtripTest "list of integers"+ (T.list T.int32)+ (list [int32 1, int32 2, int32 3]),+ roundtripTest "list of strings"+ (T.list T.string)+ (list [string "a", string "b"]),+ roundtripTest "empty list"+ (T.list T.int32)+ (list []),+ roundtripTest "nested list"+ (T.list $ T.list T.int32)+ (list [list [int32 1, int32 2], list [int32 3]]),++ -- Sets (encoded as arrays)+ roundtripTest "set of strings"+ (T.set T.string)+ (set [string "a", string "b"]),+ roundtripTest "empty set"+ (T.set T.int32)+ (set [])]++----------------------------------------+-- Optional types+----------------------------------------++optionalRoundtripGroup :: TTerm TestGroup+optionalRoundtripGroup = subgroup "optional types" [+ roundtripTest "optional string with value"+ (T.optional T.string)+ (optional $ just $ string "hello"),+ roundtripTest "optional string nothing"+ (T.optional T.string)+ (optional nothing),+ roundtripTest "optional int with value"+ (T.optional T.int32)+ (optional $ just $ int32 42)]
+ src/main/haskell/Hydra/Sources/Test/Json/Writer.hs view
@@ -0,0 +1,152 @@+module Hydra.Sources.Test.Json.Writer where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this module+import Hydra.Json.Model (Value)+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Json as Json+++ns :: Namespace+ns = Namespace "hydra.test.json.writer"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for JSON serialization")+ where+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for JSON serialization (writer)" $+ supergroup "JSON serialization" [+ primitivesGroup,+ stringsGroup,+ arraysGroup,+ objectsGroup,+ nestedGroup]++-- Helper for creating JSON writer test cases+writerCase :: String -> TTerm Value -> String -> TTerm TestCaseWithMetadata+writerCase name jsonValue expectedStr = testCaseWithMetadata (Phantoms.string name)+ (testCaseJsonWriter $ jsonWriterTestCase jsonValue (Phantoms.string expectedStr))+ Phantoms.nothing (Phantoms.list ([] :: [TTerm Tag]))++primitivesGroup :: TTerm TestGroup+primitivesGroup = subgroup "primitives" [+ -- Null+ writerCase "null" Json.valueNull "null",++ -- Booleans+ writerCase "true" (Json.valueBoolean $ Phantoms.boolean True) "true",+ writerCase "false" (Json.valueBoolean $ Phantoms.boolean False) "false",++ -- Numbers - integers (whole numbers are formatted without decimal point)+ writerCase "zero" (Json.valueNumber $ Phantoms.bigfloat 0.0) "0",+ writerCase "positive integer" (Json.valueNumber $ Phantoms.bigfloat 42.0) "42",+ writerCase "negative integer" (Json.valueNumber $ Phantoms.bigfloat (-17.0)) "-17",+ writerCase "large integer" (Json.valueNumber $ Phantoms.bigfloat 1000000.0) "1000000",++ -- Numbers - decimals+ writerCase "decimal" (Json.valueNumber $ Phantoms.bigfloat 3.14) "3.14",+ writerCase "negative decimal" (Json.valueNumber $ Phantoms.bigfloat (-2.5)) "-2.5",+ writerCase "small decimal" (Json.valueNumber $ Phantoms.bigfloat 0.001) "1.0e-3"]++stringsGroup :: TTerm TestGroup+stringsGroup = subgroup "strings" [+ -- Basic strings+ writerCase "empty string" (Json.valueString $ Phantoms.string "") "\"\"",+ writerCase "simple string" (Json.valueString $ Phantoms.string "hello") "\"hello\"",+ writerCase "string with spaces" (Json.valueString $ Phantoms.string "hello world") "\"hello world\"",++ -- Escape sequences+ writerCase "string with double quote" (Json.valueString $ Phantoms.string "say \"hi\"") "\"say \\\"hi\\\"\"",+ writerCase "string with backslash" (Json.valueString $ Phantoms.string "path\\to\\file") "\"path\\\\to\\\\file\"",+ writerCase "string with newline" (Json.valueString $ Phantoms.string "line1\nline2") "\"line1\\nline2\"",+ writerCase "string with carriage return" (Json.valueString $ Phantoms.string "line1\rline2") "\"line1\\rline2\"",+ writerCase "string with tab" (Json.valueString $ Phantoms.string "col1\tcol2") "\"col1\\tcol2\"",+ writerCase "string with mixed escapes" (Json.valueString $ Phantoms.string "a\"b\\c\nd") "\"a\\\"b\\\\c\\nd\""]++arraysGroup :: TTerm TestGroup+arraysGroup = subgroup "arrays" [+ -- Empty and single element+ writerCase "empty array" (Json.valueArray $ Phantoms.list ([] :: [TTerm Value])) "[]",+ writerCase "single element" (Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 1.0]) "[1]",++ -- Multiple elements+ writerCase "multiple numbers" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0,+ Json.valueNumber $ Phantoms.bigfloat 3.0]) "[1, 2, 3]",++ writerCase "multiple strings" (Json.valueArray $ Phantoms.list [+ Json.valueString $ Phantoms.string "a",+ Json.valueString $ Phantoms.string "b"]) "[\"a\", \"b\"]",++ -- Mixed types+ writerCase "mixed types" (Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueString $ Phantoms.string "two",+ Json.valueBoolean $ Phantoms.boolean True,+ Json.valueNull]) "[1, \"two\", true, null]"]++objectsGroup :: TTerm TestGroup+objectsGroup = subgroup "objects" [+ -- Empty and single key+ writerCase "empty object" (Json.valueObject $ Phantoms.map M.empty) "{}",+ writerCase "single key-value" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "name", Json.valueString $ Phantoms.string "Alice")]) "{\"name\": \"Alice\"}",++ -- Multiple keys+ writerCase "multiple keys" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "a", Json.valueNumber $ Phantoms.bigfloat 1.0),+ (Phantoms.string "b", Json.valueNumber $ Phantoms.bigfloat 2.0)]) "{\"a\": 1, \"b\": 2}",++ -- Mixed value types+ writerCase "mixed value types" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "count", Json.valueNumber $ Phantoms.bigfloat 42.0),+ (Phantoms.string "name", Json.valueString $ Phantoms.string "test"),+ (Phantoms.string "active", Json.valueBoolean $ Phantoms.boolean True)]) "{\"active\": true, \"count\": 42, \"name\": \"test\"}"]++nestedGroup :: TTerm TestGroup+nestedGroup = subgroup "nested structures" [+ -- Array of arrays+ writerCase "nested arrays" (Json.valueArray $ Phantoms.list [+ Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 1.0, Json.valueNumber $ Phantoms.bigfloat 2.0],+ Json.valueArray $ Phantoms.list [Json.valueNumber $ Phantoms.bigfloat 3.0, Json.valueNumber $ Phantoms.bigfloat 4.0]]) "[[1, 2], [3, 4]]",++ -- Object with array+ writerCase "object with array" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "items", Json.valueArray $ Phantoms.list [+ Json.valueNumber $ Phantoms.bigfloat 1.0,+ Json.valueNumber $ Phantoms.bigfloat 2.0])]) "{\"items\": [1, 2]}",++ -- Array of objects+ writerCase "array of objects" (Json.valueArray $ Phantoms.list [+ Json.valueObject $ Phantoms.map $ M.singleton (Phantoms.string "id") (Json.valueNumber $ Phantoms.bigfloat 1.0),+ Json.valueObject $ Phantoms.map $ M.singleton (Phantoms.string "id") (Json.valueNumber $ Phantoms.bigfloat 2.0)]) "[{\"id\": 1}, {\"id\": 2}]",++ -- Nested object+ writerCase "nested object" (Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "user", Json.valueObject $ Phantoms.map $ M.fromList [+ (Phantoms.string "name", Json.valueString $ Phantoms.string "Bob")])]) "{\"user\": {\"name\": \"Bob\"}}"]
+ src/main/haskell/Hydra/Sources/Test/Lib/Chars.hs view
@@ -0,0 +1,93 @@+module Hydra.Sources.Test.Lib.Chars where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Data.Char (ord)+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.chars"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.chars primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Test groups for hydra.lib.chars primitives++charsIsAlphaNum :: TTerm TestGroup+charsIsAlphaNum = subgroup "isAlphaNum" [+ test "letter" (ord 'a') true,+ test "digit" (ord '5') true,+ test "space" (ord ' ') false,+ test "punctuation" (ord '.') false]+ where+ test name x result = primCase name _chars_isAlphaNum [int32 x] result++charsIsLower :: TTerm TestGroup+charsIsLower = subgroup "isLower" [+ test "lowercase" (ord 'a') true,+ test "uppercase" (ord 'A') false,+ test "digit" (ord '5') false]+ where+ test name x result = primCase name _chars_isLower [int32 x] result++charsIsSpace :: TTerm TestGroup+charsIsSpace = subgroup "isSpace" [+ test "space" (ord ' ') true,+ test "tab" (ord '\t') true,+ test "newline" (ord '\n') true,+ test "letter" (ord 'a') false]+ where+ test name x result = primCase name _chars_isSpace [int32 x] result++charsIsUpper :: TTerm TestGroup+charsIsUpper = subgroup "isUpper" [+ test "uppercase" (ord 'A') true,+ test "lowercase" (ord 'a') false,+ test "digit" (ord '5') false]+ where+ test name x result = primCase name _chars_isUpper [int32 x] result++charsToLower :: TTerm TestGroup+charsToLower = subgroup "toLower" [+ test "uppercase" (ord 'A') (ord 'a'),+ test "lowercase" (ord 'a') (ord 'a'),+ test "digit" (ord '5') (ord '5')]+ where+ test name x result = primCase name _chars_toLower [int32 x] (int32 result)++charsToUpper :: TTerm TestGroup+charsToUpper = subgroup "toUpper" [+ test "lowercase" (ord 'a') (ord 'A'),+ test "uppercase" (ord 'A') (ord 'A'),+ test "digit" (ord '5') (ord '5')]+ where+ test name x result = primCase name _chars_toUpper [int32 x] (int32 result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.chars primitives" $+ supergroup "hydra.lib.chars primitives" [+ charsIsAlphaNum,+ charsIsLower,+ charsIsSpace,+ charsIsUpper,+ charsToLower,+ charsToUpper]
+ src/main/haskell/Hydra/Sources/Test/Lib/Eithers.hs view
@@ -0,0 +1,184 @@+module Hydra.Sources.Test.Lib.Eithers where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+++ns :: Namespace+ns = Namespace "hydra.test.lib.eithers"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.eithers primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Helper to create Left terms+leftInt32 :: Int -> TTerm Term+leftInt32 x = left (int32 x)++-- Helper to create Right terms+rightString :: String -> TTerm Term+rightString s = right (string s)++-- Test groups for hydra.lib.eithers primitives++eithersBind :: TTerm TestGroup+eithersBind = subgroup "bind" [+ test "bind Right with success" (rightString "ab") (right (int32 2)),+ test "bind Right with failure" (rightString "") (leftInt32 0),+ test "bind Left returns Left unchanged" (leftInt32 42) (leftInt32 42)]+ where+ -- Function: get length of string, fail with 0 if empty+ bindFn = lambda "s" (primitive _logic_ifElse+ @@ (primitive _strings_null @@ var "s")+ @@ (left (int32 0))+ @@ (right (primitive _strings_length @@ var "s")))+ test name input expected = primCase name _eithers_bind [input, bindFn] expected++eithersBimap :: TTerm TestGroup+eithersBimap = subgroup "bimap" [+ test "map left value" (leftInt32 5) (leftInt32 10),+ test "map right value" (rightString "ab") (right (int32 2))]+ where+ test name input expected = primCase name _eithers_bimap [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ lambda "s" (primitive _strings_length @@ var "s"),+ input] expected++eithersIsLeft :: TTerm TestGroup+eithersIsLeft = subgroup "isLeft" [+ test "left value" (leftInt32 42) true,+ test "right value" (rightString "test") false]+ where+ test name x result = primCase name _eithers_isLeft [x] result++eithersIsRight :: TTerm TestGroup+eithersIsRight = subgroup "isRight" [+ test "right value" (rightString "test") true,+ test "left value" (leftInt32 42) false]+ where+ test name x result = primCase name _eithers_isRight [x] result++eithersFromLeft :: TTerm TestGroup+eithersFromLeft = subgroup "fromLeft" [+ test "extract left" 99 (leftInt32 42) 42,+ test "use default for right" 99 (rightString "test") 99]+ where+ test name def x result = primCase name _eithers_fromLeft [int32 def, x] (int32 result)++eithersFromRight :: TTerm TestGroup+eithersFromRight = subgroup "fromRight" [+ test "extract right" "default" (rightString "test") "test",+ test "use default for left" "default" (leftInt32 42) "default"]+ where+ test name def x result = primCase name _eithers_fromRight [string def, x] (string result)++eithersEither :: TTerm TestGroup+eithersEither = subgroup "either" [+ test "apply left function" (leftInt32 5) 10,+ test "apply right function" (rightString "ab") 2]+ where+ test name x result = primCase name _eithers_either [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ lambda "s" (primitive _strings_length @@ var "s"),+ x] (int32 result)++eithersLefts :: TTerm TestGroup+eithersLefts = subgroup "lefts" [+ test "filter left values" [leftInt32 1, rightString "a", leftInt32 2, rightString "b"] [1, 2],+ test "all lefts" [leftInt32 1, leftInt32 2] [1, 2],+ test "all rights" [rightString "a", rightString "b"] [],+ test "empty list" [] []]+ where+ test name input expected = primCase name _eithers_lefts [list input] (list $ fmap int32 expected)++eithersRights :: TTerm TestGroup+eithersRights = subgroup "rights" [+ test "filter right values" [leftInt32 1, rightString "a", leftInt32 2, rightString "b"] ["a", "b"],+ test "all rights" [rightString "a", rightString "b"] ["a", "b"],+ test "all lefts" [leftInt32 1, leftInt32 2] [],+ test "empty list" [] []]+ where+ test name input expected = primCase name _eithers_rights [list input] (list $ fmap string expected)++eithersPartitionEithers :: TTerm TestGroup+eithersPartitionEithers = subgroup "partitionEithers" [+ test "partition mixed" [leftInt32 1, rightString "a", leftInt32 2, rightString "b"] ([1, 2], ["a", "b"]),+ test "all lefts" [leftInt32 1, leftInt32 2] ([1, 2], []),+ test "all rights" [rightString "a", rightString "b"] ([], ["a", "b"]),+ test "empty list" [] ([], [])]+ where+ test name input (lefts, rights) = primCase name _eithers_partitionEithers [list input]+ (Core.termPair $ Phantoms.pair (list $ fmap int32 lefts) (list $ fmap string rights))++eithersMap :: TTerm TestGroup+eithersMap = subgroup "map" [+ test "map right value" (rightInt32 5) (rightInt32 10),+ test "preserve left" (leftInt32 99) (leftInt32 99)]+ where+ rightInt32 x = right (int32 x)+ leftInt32 x = left (int32 x)+ test name input expected = primCase name _eithers_map [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ input] expected++eithersMapList :: TTerm TestGroup+eithersMapList = subgroup "mapList" [+ test "all succeed" [1, 2, 3] (right (list [int32 2, int32 4, int32 6])),+ test "first fails" [1, 0, 3] (left (string "zero")),+ test "empty list" [] (right (list []))]+ where+ test name input expected = primCase name _eithers_mapList [+ lambda "x" (primitive _logic_ifElse+ @@ (primitive _equality_equal @@ var "x" @@ int32 0)+ @@ left (string "zero")+ @@ right (primitive _math_mul @@ var "x" @@ int32 2)),+ list $ fmap int32 input] expected++eithersMapMaybe :: TTerm TestGroup+eithersMapMaybe = subgroup "mapMaybe" [+ test "just succeeds" (Core.termMaybe $ just (int32 5)) (right (Core.termMaybe $ just (int32 10))),+ test "just fails" (Core.termMaybe $ just (int32 0)) (left (string "zero")),+ test "nothing" (Core.termMaybe nothing) (right (Core.termMaybe nothing))]+ where+ test name input expected = primCase name _eithers_mapMaybe [+ lambda "x" (primitive _logic_ifElse+ @@ (primitive _equality_equal @@ var "x" @@ int32 0)+ @@ left (string "zero")+ @@ right (primitive _math_mul @@ var "x" @@ int32 2)),+ input] expected++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.eithers primitives" $+ supergroup "hydra.lib.eithers primitives" [+ eithersBind,+ eithersBimap,+ eithersIsLeft,+ eithersIsRight,+ eithersFromLeft,+ eithersFromRight,+ eithersEither,+ eithersLefts,+ eithersRights,+ eithersPartitionEithers,+ eithersMap,+ eithersMapList,+ eithersMapMaybe]
+ src/main/haskell/Hydra/Sources/Test/Lib/Equality.hs view
@@ -0,0 +1,194 @@+module Hydra.Sources.Test.Lib.Equality where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.equality"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.equality primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Test groups for hydra.lib.equality primitives++equalityCompare :: TTerm TestGroup+equalityCompare = subgroup "compare" [+ test "less than" 3 5 "lessThan",+ test "equal" 5 5 "equalTo",+ test "greater than" 5 3 "greaterThan"]+ where+ test testName x y resultField = primCase testName _equality_compare [int32 x, int32 y] (injectUnit (name "hydra.util.Comparison") resultField)++equalityEqual :: TTerm TestGroup+equalityEqual = subgroup "equal" [+ test "equal integers" 5 5 true,+ test "unequal integers" 5 3 false]+ where+ test name x y result = primCase name _equality_equal [int32 x, int32 y] result++equalityGt :: TTerm TestGroup+equalityGt = subgroup "gt" [+ test "greater" 5 3 true,+ test "equal" 5 5 false,+ test "less" 3 5 false]+ where+ test name x y result = primCase name _equality_gt [int32 x, int32 y] result++equalityGte :: TTerm TestGroup+equalityGte = subgroup "gte" [+ test "greater" 5 3 true,+ test "equal" 5 5 true,+ test "less" 3 5 false]+ where+ test name x y result = primCase name _equality_gte [int32 x, int32 y] result++equalityIdentity :: TTerm TestGroup+equalityIdentity = subgroup "identity" [+ test "integer" 42 42]+ where+ test name x result = primCase name _equality_identity [int32 x] (int32 result)++equalityLt :: TTerm TestGroup+equalityLt = subgroup "lt" [+ test "less" 3 5 true,+ test "equal" 5 5 false,+ test "greater" 5 3 false]+ where+ test name x y result = primCase name _equality_lt [int32 x, int32 y] result++equalityLte :: TTerm TestGroup+equalityLte = subgroup "lte" [+ test "less" 3 5 true,+ test "equal" 5 5 true,+ test "greater" 5 3 false]+ where+ test name x y result = primCase name _equality_lte [int32 x, int32 y] result++equalityMax :: TTerm TestGroup+equalityMax = subgroup "max" [+ test "first greater" 5 3 5,+ test "second greater" 3 5 5,+ test "equal" 5 5 5]+ where+ test name x y result = primCase name _equality_max [int32 x, int32 y] (int32 result)++equalityMin :: TTerm TestGroup+equalityMin = subgroup "min" [+ test "first less" 3 5 3,+ test "second less" 5 3 3,+ test "equal" 5 5 5]+ where+ test name x y result = primCase name _equality_min [int32 x, int32 y] (int32 result)++-- Tests for ordering with string values+equalityCompareStrings :: TTerm TestGroup+equalityCompareStrings = subgroup "compare strings" [+ test "less than (lexicographic)" "apple" "banana" "lessThan",+ test "equal" "hello" "hello" "equalTo",+ test "greater than (lexicographic)" "zebra" "apple" "greaterThan",+ test "empty vs non-empty" "" "a" "lessThan",+ test "prefix vs longer" "ab" "abc" "lessThan"]+ where+ test testName x y resultField = primCase testName _equality_compare [string x, string y] (injectUnit (name "hydra.util.Comparison") resultField)++equalityLtStrings :: TTerm TestGroup+equalityLtStrings = subgroup "lt strings" [+ test "less (lexicographic)" "apple" "banana" true,+ test "equal" "hello" "hello" false,+ test "greater" "zebra" "apple" false]+ where+ test name x y result = primCase name _equality_lt [string x, string y] result++equalityGtStrings :: TTerm TestGroup+equalityGtStrings = subgroup "gt strings" [+ test "greater (lexicographic)" "zebra" "apple" true,+ test "equal" "hello" "hello" false,+ test "less" "apple" "banana" false]+ where+ test name x y result = primCase name _equality_gt [string x, string y] result++equalityMaxStrings :: TTerm TestGroup+equalityMaxStrings = subgroup "max strings" [+ test "first greater" "zebra" "apple" "zebra",+ test "second greater" "apple" "zebra" "zebra",+ test "equal" "hello" "hello" "hello"]+ where+ test name x y result = primCase name _equality_max [string x, string y] (string result)++equalityMinStrings :: TTerm TestGroup+equalityMinStrings = subgroup "min strings" [+ test "first less" "apple" "zebra" "apple",+ test "second less" "zebra" "apple" "apple",+ test "equal" "hello" "hello" "hello"]+ where+ test name x y result = primCase name _equality_min [string x, string y] (string result)++-- Tests for ordering with float values+equalityCompareFloats :: TTerm TestGroup+equalityCompareFloats = subgroup "compare floats" [+ test "less than" 1.5 2.5 "lessThan",+ test "equal" 3.14 3.14 "equalTo",+ test "greater than" 5.0 3.0 "greaterThan",+ test "negative vs positive" (-1.0) 1.0 "lessThan"]+ where+ test testName x y resultField = primCase testName _equality_compare [float64 x, float64 y] (injectUnit (name "hydra.util.Comparison") resultField)++equalityLtFloats :: TTerm TestGroup+equalityLtFloats = subgroup "lt floats" [+ test "less" 1.5 2.5 true,+ test "equal" 3.14 3.14 false,+ test "greater" 5.0 3.0 false]+ where+ test name x y result = primCase name _equality_lt [float64 x, float64 y] result++equalityGtFloats :: TTerm TestGroup+equalityGtFloats = subgroup "gt floats" [+ test "greater" 5.0 3.0 true,+ test "equal" 3.14 3.14 false,+ test "less" 1.5 2.5 false]+ where+ test name x y result = primCase name _equality_gt [float64 x, float64 y] result++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.equality primitives" $+ supergroup "hydra.lib.equality primitives" [+ -- Integer tests+ equalityCompare,+ equalityEqual,+ equalityGt,+ equalityGte,+ equalityIdentity,+ equalityLt,+ equalityLte,+ equalityMax,+ equalityMin,+ -- String tests+ equalityCompareStrings,+ equalityLtStrings,+ equalityGtStrings,+ equalityMaxStrings,+ equalityMinStrings,+ -- Float tests+ equalityCompareFloats,+ equalityLtFloats,+ equalityGtFloats]
+ src/main/haskell/Hydra/Sources/Test/Lib/Flows.hs view
@@ -0,0 +1,267 @@+-- | Test cases for hydra.lib.flows primitives+module Hydra.Sources.Test.Lib.Flows where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+++ns :: Namespace+ns = Namespace "hydra.test.lib.flows"++module_ :: Module+module_ = Module ns elements [Monads.ns] kernelTypesNamespaces $+ Just "Test cases for hydra.lib.flows primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- | Trace at the TTerm Term level+testTrace :: TTerm Term+testTrace = traceTerm (list []) (list []) (Terms.map (Phantoms.map M.empty))++-- Test groups for hydra.lib.flows primitives++-- | Test cases for flows.pure: lifts a value into a successful flow+-- Note: This uses the kernel Monads.pure since the primitive doesn't have an eval implementation+flowsPure :: TTerm TestGroup+flowsPure = subgroup "pure" [+ test "pure integer" (int32 42),+ test "pure zero" (int32 0),+ test "pure negative" (int32 (-5)),+ test "pure string" (string "hello")]+ where+ test testName val = evalCase testName+ (unFlowTerm @@ (metaref Monads.pure @@ val) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just val) unit testTrace)++-- | Test cases for flows.fail: creates a failing flow+-- Note: This uses the kernel Monads.fail since the primitive doesn't have an eval implementation+flowsFail :: TTerm TestGroup+flowsFail = subgroup "fail" [+ test "fail with message"]+ where+ test testName = evalCase testName+ (unFlowTerm @@ (metaref Monads.fail @@ string "test error message") @@ unit @@ testTrace)+ (flowStateTerm (optional nothing) unit (traceWithMessages ["Error: test error message ()"]))+ traceWithMessages msgs = traceTerm (list []) (list $ fmap string msgs) (Terms.map (Phantoms.map M.empty))++-- | Test cases for flows.map: transforms the value inside a flow+-- Tests the primitive _flows_map with kernel Monads.pure for flow construction+flowsMap :: TTerm TestGroup+flowsMap = subgroup "map" [+ test "map negate" (primitive _math_negate) (int32 5) (int32 (-5)),+ test "map abs" (primitive _math_abs) (int32 (-3)) (int32 3)]+ where+ test testName fn inVal outVal = evalCase testName+ (unFlowTerm @@ (primitive _flows_map @@ fn @@ (metaref Monads.pure @@ inVal)) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just outVal) unit testTrace)++-- | Test cases for flows.bind: chains flow computations together+-- Uses kernel Monads.bind since the primitive isn't completing evaluation+flowsBind :: TTerm TestGroup+flowsBind = subgroup "bind" [+ test "bind add" (primitive _math_add) (int32 5) (int32 5) (int32 10),+ test "bind multiply" (primitive _math_mul) (int32 3) (int32 4) (int32 12)]+ where+ test testName op x y result = evalCase testName+ (unFlowTerm @@ (metaref Monads.bind+ @@ (metaref Monads.pure @@ x)+ @@ (lambda "n" (metaref Monads.pure @@ (op @@ var "n" @@ y)))) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just result) unit testTrace)++-- | Test cases for flows.apply: applies a function inside a flow to a value inside a flow+-- This test uses kernel Monads definitions to construct the apply operation.+flowsApply :: TTerm TestGroup+flowsApply = subgroup "apply" [+ test "apply add" (int32 8)]+ where+ -- apply (pure (add 3)) (pure 5) = pure 8+ -- Using Monads definitions: bind flowFun (\f -> bind flowArg (\x -> pure (f x)))+ test testName result =+ let flowFun = metaref Monads.pure @@ (primitive _math_add @@ int32 3)+ flowArg = metaref Monads.pure @@ int32 5+ -- Build the nested bind structure using kernel definitions+ applyTerm = metaref Monads.bind @@ flowFun @@+ (lambda "f" (metaref Monads.bind @@ flowArg @@+ (lambda "x" (metaref Monads.pure @@ (var "f" @@ var "x")))))+ in evalCase testName+ (unFlowTerm @@ applyTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just result) unit testTrace)++-- | Test cases for flows.foldl: folds over a list with flow-returning function+-- Manually constructs the fold using kernel Monads.bind/pure+flowsFoldl :: TTerm TestGroup+flowsFoldl = subgroup "foldl" [+ test "foldl sum"]+ where+ -- foldl (\acc x -> pure (acc + x)) 0 [1,2,3] = pure 6+ -- Unrolled: bind (pure 0 >>= \a0 -> pure (a0+1)) >>= \a1 -> bind (pure (a1+2)) >>= \a2 -> pure (a2+3)+ -- Simplified: bind (pure 1) >>= \a1 -> bind (pure (a1+2)) >>= \a2 -> pure (a2+3)+ test testName = evalCase testName+ (unFlowTerm @@ foldTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (int32 6)) unit testTrace)+ -- Manually unroll: foldl (+) 0 [1,2,3] using bind+ foldTerm =+ metaref Monads.bind @@ (metaref Monads.pure @@ int32 0) @@+ (lambda "a0" $ metaref Monads.bind @@ (metaref Monads.pure @@ (primitive _math_add @@ var "a0" @@ int32 1)) @@+ (lambda "a1" $ metaref Monads.bind @@ (metaref Monads.pure @@ (primitive _math_add @@ var "a1" @@ int32 2)) @@+ (lambda "a2" $ metaref Monads.pure @@ (primitive _math_add @@ var "a2" @@ int32 3))))++-- | Test cases for flows.mapList: maps a flow-returning function over a list+-- Manually constructs the mapList using kernel Monads.bind/pure+flowsMapList :: TTerm TestGroup+flowsMapList = subgroup "mapList" [+ test "mapList add one"]+ where+ -- mapList (\n -> pure (n + 1)) [1,2,3] = pure [2,3,4]+ -- Unrolled: bind (pure 2) (\y1 -> bind (pure 3) (\y2 -> bind (pure 4) (\y3 -> pure [y1,y2,y3])))+ test testName = evalCase testName+ (unFlowTerm @@ mapListTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (list [int32 2, int32 3, int32 4])) unit testTrace)+ addOne n = metaref Monads.pure @@ (primitive _math_add @@ n @@ int32 1)+ mapListTerm =+ metaref Monads.bind @@ addOne (int32 1) @@+ (lambda "y1" $ metaref Monads.bind @@ addOne (int32 2) @@+ (lambda "y2" $ metaref Monads.bind @@ addOne (int32 3) @@+ (lambda "y3" $ metaref Monads.pure @@ list [var "y1", var "y2", var "y3"])))++-- | Test cases for flows.sequence: sequences a list of flows into a flow of list+-- Manually constructs using kernel Monads.bind/pure+flowsSequence :: TTerm TestGroup+flowsSequence = subgroup "sequence" [+ test "sequence pure list"]+ where+ -- sequence [pure 1, pure 2, pure 3] = pure [1,2,3]+ -- Unrolled: bind (pure 1) (\x1 -> bind (pure 2) (\x2 -> bind (pure 3) (\x3 -> pure [x1,x2,x3])))+ test testName = evalCase testName+ (unFlowTerm @@ sequenceTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (list [int32 1, int32 2, int32 3])) unit testTrace)+ sequenceTerm =+ metaref Monads.bind @@ (metaref Monads.pure @@ int32 1) @@+ (lambda "x1" $ metaref Monads.bind @@ (metaref Monads.pure @@ int32 2) @@+ (lambda "x2" $ metaref Monads.bind @@ (metaref Monads.pure @@ int32 3) @@+ (lambda "x3" $ metaref Monads.pure @@ list [var "x1", var "x2", var "x3"])))++-- | Test cases for flows.mapMaybe: maps a flow-returning function over a Maybe+-- Manually constructs using kernel Monads operations+flowsMapMaybe :: TTerm TestGroup+flowsMapMaybe = subgroup "mapMaybe" [+ testJust "mapMaybe just" (int32 5) (int32 6),+ testNothing "mapMaybe nothing"]+ where+ -- mapMaybe (\n -> pure (n + 1)) (Just 5) = pure (Just 6)+ testJust testName inVal outVal = evalCase testName+ (unFlowTerm @@ (metaref Monads.bind @@ addOnePure inVal @@+ (lambda "y" $ metaref Monads.pure @@ (optional $ just (var "y")))) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (optional $ just outVal)) unit testTrace)+ -- mapMaybe (\n -> pure (n + 1)) Nothing = pure Nothing+ testNothing testName = evalCase testName+ (unFlowTerm @@ (metaref Monads.pure @@ (optional nothing)) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (optional nothing)) unit testTrace)+ addOnePure n = metaref Monads.pure @@ (primitive _math_add @@ n @@ int32 1)++-- | Test cases for flows.mapSet: maps a flow-returning function over a Set+-- Manually constructs using kernel Monads operations+flowsMapSet :: TTerm TestGroup+flowsMapSet = subgroup "mapSet" [+ test "mapSet add one"]+ where+ -- mapSet (\n -> pure (n + 1)) {1,2,3} = pure {2,3,4}+ -- Unrolled similar to mapList, then convert to set+ test testName = evalCase testName+ (unFlowTerm @@ mapSetTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (Core.termSet $ Phantoms.set [int32 2, int32 3, int32 4])) unit testTrace)+ addOne n = metaref Monads.pure @@ (primitive _math_add @@ n @@ int32 1)+ -- Build: bind (addOne 1) (\y1 -> bind (addOne 2) (\y2 -> bind (addOne 3) (\y3 -> pure (fromList [y1,y2,y3]))))+ mapSetTerm =+ metaref Monads.bind @@ addOne (int32 1) @@+ (lambda "y1" $ metaref Monads.bind @@ addOne (int32 2) @@+ (lambda "y2" $ metaref Monads.bind @@ addOne (int32 3) @@+ (lambda "y3" $ metaref Monads.pure @@ (primitive _sets_fromList @@ list [var "y1", var "y2", var "y3"]))))++-- | Test cases for flows.mapElems: maps a flow-returning function over Map values+-- Manually constructs using kernel Monads operations+flowsMapElems :: TTerm TestGroup+flowsMapElems = subgroup "mapElems" [+ test "mapElems add one"]+ where+ -- mapElems (\v -> pure (v + 1)) {a:1, b:2} = pure {a:2, b:3}+ -- Unrolled: bind (addOne 1) (\v1 -> bind (addOne 2) (\v2 -> pure (fromList [("a",v1),("b",v2)])))+ test testName = evalCase testName+ (unFlowTerm @@ mapElemsTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just expectedMap) unit testTrace)+ addOne n = metaref Monads.pure @@ (primitive _math_add @@ n @@ int32 1)+ expectedMap = Core.termMap $ Phantoms.map $ M.fromList [(string "a", int32 2), (string "b", int32 3)]+ mapElemsTerm =+ metaref Monads.bind @@ addOne (int32 1) @@+ (lambda "v1" $ metaref Monads.bind @@ addOne (int32 2) @@+ (lambda "v2" $ metaref Monads.pure @@+ (primitive _maps_fromList @@ list [pair (string "a") (var "v1"), pair (string "b") (var "v2")])))++-- | Test cases for flows.mapKeys: maps a flow-returning function over Map keys+-- Manually constructs using kernel Monads operations+flowsMapKeys :: TTerm TestGroup+flowsMapKeys = subgroup "mapKeys" [+ test "mapKeys add one"]+ where+ -- mapKeys (\k -> pure (k + 1)) {1:a, 2:b} = pure {2:a, 3:b}+ -- Unrolled: bind (addOne 1) (\k1 -> bind (addOne 2) (\k2 -> pure (fromList [(k1,"a"),(k2,"b")])))+ test testName = evalCase testName+ (unFlowTerm @@ mapKeysTerm @@ unit @@ testTrace)+ (flowStateTerm (optional $ just expectedMap) unit testTrace)+ addOne n = metaref Monads.pure @@ (primitive _math_add @@ n @@ int32 1)+ expectedMap = Core.termMap $ Phantoms.map $ M.fromList [(int32 2, string "a"), (int32 3, string "b")]+ mapKeysTerm =+ metaref Monads.bind @@ addOne (int32 1) @@+ (lambda "k1" $ metaref Monads.bind @@ addOne (int32 2) @@+ (lambda "k2" $ metaref Monads.pure @@+ (primitive _maps_fromList @@ list [pair (var "k1") (string "a"), pair (var "k2") (string "b")])))++-- | Test cases for flows.withDefault: uses fallback value if flow fails+flowsWithDefault :: TTerm TestGroup+flowsWithDefault = subgroup "withDefault" [+ testSuccess "withDefault on success returns original",+ testFailure "withDefault on failure returns fallback"]+ where+ -- withDefault 0 (pure 42) = pure 42 (success case)+ testSuccess testName = evalCase testName+ (unFlowTerm @@ (primitive _flows_withDefault @@ int32 0 @@ (metaref Monads.pure @@ int32 42)) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (int32 42)) unit testTrace)+ -- withDefault 99 (fail "error") = pure 99 (failure case - uses fallback)+ testFailure testName = evalCase testName+ (unFlowTerm @@ (primitive _flows_withDefault @@ int32 99 @@ (metaref Monads.fail @@ string "error")) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just (int32 99)) unit testTrace)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.flows primitives" $+ supergroup "hydra.lib.flows primitives" [+ flowsApply,+ flowsBind,+ flowsFail,+ flowsFoldl,+ flowsMap,+ flowsMapElems,+ flowsMapKeys,+ flowsMapList,+ flowsMapMaybe,+ flowsMapSet,+ flowsPure,+ flowsSequence,+ flowsWithDefault]
src/main/haskell/Hydra/Sources/Test/Lib/Lists.hs view
@@ -1,13 +1,61 @@-module Hydra.Sources.Test.Lib.Lists (listPrimitiveTests) where+module Hydra.Sources.Test.Lib.Lists where -import Hydra.Dsl.Tests-import Hydra.Dsl.Terms+-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M +-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries -listPrimitiveTests :: TestGroup-listPrimitiveTests = TestGroup "hydra.lib.lists primitives" Nothing groups []++ns :: Namespace+ns = Namespace "hydra.test.lib.lists"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Test cases for hydra.lib.lists primitives") where- groups = [+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- Helper functions for building test terms+intList :: [Int] -> TTerm Term+intList els = list (int32 <$> els)++intListList :: [[Int]] -> TTerm Term+intListList lists = list (intList <$> lists)++optionalInt32 :: Maybe Int -> TTerm Term+optionalInt32 Nothing = Core.termMaybe nothing+optionalInt32 (Just x) = Core.termMaybe $ just (int32 x)++optionalString :: Maybe String -> TTerm Term+optionalString Nothing = Core.termMaybe nothing+optionalString (Just x) = Core.termMaybe $ just (string x)++stringList :: [String] -> TTerm Term+stringList els = list (string <$> els)++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for hydra.lib.lists primitives" $+ supergroup "hydra.lib.lists primitives" [ listsApply, listsAt, listsBind,@@ -15,10 +63,11 @@ listsConcat2, listsCons, listsDrop,--- listsDropWhile, -- TODO+ listsDropWhile, listsElem,--- listsFilter, -- TODO--- listsFoldl, -- TODO+ listsFilter,+ listsFind,+ listsFoldl, listsGroup, listsHead, listsInit,@@ -29,381 +78,364 @@ listsMap, listsNub, listsNull,+ listsPartition, listsPure, listsReplicate, listsReverse, listsSafeHead, listsSingleton, listsSort,--- listsSortOn, -- TODO--- listsSpan, -- TODO+ listsSortOn,+ listsSpan, listsTail, listsTake, listsTranspose,- listsZip]--- listsZipWith] -- TODO--listsApply :: TestGroup-listsApply = TestGroup "apply" Nothing [] [- testStr "string transformations" [primitive _strings_toUpper, primitive _strings_toLower] ["One", "Two", "Three"] ["ONE", "TWO", "THREE", "one", "two", "three"],- testStr "empty function list" [] ["a", "b"] [],- testStr "empty input list" [primitive _strings_toUpper] [] [],- testStr "single function" [primitive _strings_toUpper] ["hello"] ["HELLO"],- testStr "single input" [primitive _strings_toUpper, primitive _strings_toLower] ["Test"] ["TEST", "test"]]- where- testStr name funs lst result = primCase name _lists_apply [list funs, stringList lst] (stringList result)--listsAt :: TestGroup-listsAt = TestGroup "at" Nothing [] [- testInt "first element" 0 [1, 2, 3] 1,- testInt "middle element" 1 [1, 2, 3] 2,- testInt "last element" 2 [1, 2, 3] 3,- testInt "single element list" 0 [42] 42,- testStr "string list access" 1 ["hello", "world"] "world"]- where- testInt name idx lst result = primCase name _lists_at [int32 idx, intList lst] (int32 result)- testStr name idx lst result = primCase name _lists_at [int32 idx, stringList lst] (string result)--listsBind :: TestGroup-listsBind = TestGroup "bind" Nothing [] [- test "negation function" [1, 2, 3, 4] (primitive _lists_pure <.> primitive _math_neg) (negate <$> [1, 2, 3, 4]),- test "empty list" [] (primitive _lists_pure <.> primitive _math_neg) [],- test "single element" [5] (primitive _lists_pure <.> primitive _math_neg) [-5],- test "duplicate elements" [1, 1, 2] (primitive _lists_pure <.> primitive _math_neg) [-1, -1, -2]]- where- test name lst fun result = primCase name _lists_bind [intList lst, fun] (intList result)--listsConcat :: TestGroup-listsConcat = TestGroup "concat" Nothing [] [- test "multiple non-empty lists" [[1, 2, 3], [4, 5], [6, 7, 8]] [1, 2, 3, 4, 5, 6, 7, 8],- test "empty lists included" [[], [1, 2], [], [3]] [1, 2, 3],- test "single list" [[1, 2, 3]] [1, 2, 3],- test "all empty lists" [[], [], []] [],- test "empty list of lists" [] []]- where- test name lists result = primCase name _lists_concat [intListList lists] (intList result)--listsConcat2 :: TestGroup-listsConcat2 = TestGroup "concat2" Nothing [] [- testInt "two non-empty lists" [1, 2] [3, 4] [1, 2, 3, 4],- testInt "first list empty" [] [1, 2] [1, 2],- testInt "second list empty" [1, 2] [] [1, 2],- testInt "both lists empty" [] [] [],- testInt "single elements" [1] [2] [1, 2],- testStr "string lists" ["a", "b"] ["c", "d"] ["a", "b", "c", "d"]]- where- testInt name lst1 lst2 result = primCase name _lists_concat2 [intList lst1, intList lst2] (intList result)- testStr name lst1 lst2 result = primCase name _lists_concat2 [stringList lst1, stringList lst2] (stringList result)--listsCons :: TestGroup-listsCons = TestGroup "cons" Nothing [] [- testInt "cons to non-empty list" 1 [2, 3] [1, 2, 3],- testInt "cons to empty list" 1 [] [1],- testInt "cons negative number" (-1) [2, 3] [-1, 2, 3],- testStr "cons string" "hello" ["world"] ["hello", "world"]]- where- testInt name x lst result = primCase name _lists_cons [int32 x, intList lst] (intList result)- testStr name x lst result = primCase name _lists_cons [string x, stringList lst] (stringList result)--listsDrop :: TestGroup-listsDrop = TestGroup "drop" Nothing [] [- test "drop from beginning" 2 [1, 2, 3, 4, 5] [3, 4, 5],- test "drop zero elements" 0 [1, 2, 3] [1, 2, 3],- test "drop all elements" 3 [1, 2, 3] [],- test "drop more than length" 5 [1, 2] [],- test "drop from empty list" 3 [] [],- test "drop negative amount" (-1) [1, 2, 3] [1, 2, 3]]- where- test name n lst result = primCase name _lists_drop [int32 n, intList lst] (intList result)--listsDropWhile :: TestGroup-listsDropWhile = TestGroup "dropWhile" Nothing [] [- test "drop while less than 3" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 3)) [1, 2, 3, 2, 1] [3, 2, 1],- test "drop all elements" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 10)) [1, 2, 3] [],- test "drop no elements" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 0)) [1, 2, 3] [1, 2, 3],- test "empty list" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 5)) [] []]- where- test name pred lst result = primCase name _lists_dropWhile [pred, intList lst] (intList result)--listsElem :: TestGroup-listsElem = TestGroup "elem" Nothing [] [- testInt "element present" 2 [1, 2, 3] True,- testInt "element not present" 4 [1, 2, 3] False,- testInt "empty list" 1 [] False,- testInt "single element present" 1 [1] True,- testInt "single element not present" 2 [1] False,- testInt "duplicate elements" 2 [1, 2, 2, 3] True,- testStr "string element present" "hello" ["world", "hello", "test"] True,- testStr "string element not present" "missing" ["world", "hello"] False]- where- testInt name x lst result = primCase name _lists_elem [int32 x, intList lst] (boolean result)- testStr name x lst result = primCase name _lists_elem [string x, stringList lst] (boolean result)--listsFilter :: TestGroup-listsFilter = TestGroup "filter" Nothing [] [- test "filter positive numbers" (lambda "x" (primitive _equality_gt <.> var "x" <.> int32 0)) [-1, 2, -3, 4, 5] [2, 4, 5],- test "filter all elements" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 10)) [1, 2, 3] [1, 2, 3],- test "filter no elements" (lambda "x" (primitive _equality_gt <.> var "x" <.> int32 10)) [1, 2, 3] [],- test "empty list" (lambda "x" (primitive _equality_gt <.> var "x" <.> int32 0)) [] []]- where- test name pred lst result = primCase name _lists_filter [pred, intList lst] (intList result)--listsFoldl :: TestGroup-listsFoldl = TestGroup "foldl" Nothing [] [- test "sum with addition" (primitive _math_add) 0 [1, 2, 3, 4] 10,- test "product with multiplication" (primitive _math_mul) 1 [2, 3, 4] 24,- test "empty list" (primitive _math_add) 5 [] 5,- test "single element" (primitive _math_add) 10 [5] 15,- test "subtraction fold" (primitive _math_sub) 10 [1, 2, 3] 4]- where- test name op acc lst result = primCase name _lists_foldl [op, int32 acc, intList lst] (int32 result)--listsGroup :: TestGroup-listsGroup = TestGroup "group" Nothing [] [- test "consecutive duplicates" [1, 1, 2, 2, 2, 3, 1] [[1, 1], [2, 2, 2], [3], [1]],- test "no duplicates" [1, 2, 3] [[1], [2], [3]],- test "all same" [1, 1, 1] [[1, 1, 1]],- test "empty list" [] [],- test "single element" [1] [[1]]]- where- test name lst result = primCase name _lists_group [intList lst] (intListList result)--listsHead :: TestGroup-listsHead = TestGroup "head" Nothing [] [- testInt "three element list" [1, 2, 3] 1,- testInt "single element list" [42] 42,- testInt "negative numbers" [-1, -2, -3] (-1),- testStr "string list" ["hello", "world"] "hello"]- where- testInt name lst result = primCase name _lists_head [intList lst] (int32 result)- testStr name lst result = primCase name _lists_head [stringList lst] (string result)--listsInit :: TestGroup-listsInit = TestGroup "init" Nothing [] [- testInt "multiple elements" [1, 2, 3, 4] [1, 2, 3],- testInt "two elements" [1, 2] [1],- testInt "single element" [1] [],- testStr "string list" ["a", "b", "c"] ["a", "b"]]- where- testInt name lst result = primCase name _lists_init [intList lst] (intList result)- testStr name lst result = primCase name _lists_init [stringList lst] (stringList result)--listsIntercalate :: TestGroup-listsIntercalate = TestGroup "intercalate" Nothing [] [- test "double zero separator" [0, 0] [[1, 2, 3], [4, 5], [6, 7, 8]] [1, 2, 3, 0, 0, 4, 5, 0, 0, 6, 7, 8],- test "empty separator" [] [[1, 2], [3, 4]] [1, 2, 3, 4],- test "single element separator" [99] [[1], [2], [3]] [1, 99, 2, 99, 3],- test "empty list of lists" [0] [] [],- test "single list" [0] [[1, 2, 3]] [1, 2, 3],- test "lists with empty lists" [0] [[], [1], []] [0, 1, 0]]- where- test name ifx lists result = primCase name _lists_intercalate [intList ifx, intListList lists] (intList result)--listsIntersperse :: TestGroup-listsIntersperse = TestGroup "intersperse" Nothing [] [- testStr "string interspersion" "and" ["one", "two", "three"] ["one", "and", "two", "and", "three"],- testStr "single element" "x" ["only"] ["only"],- testStr "empty list" "x" [] [],- testStr "two elements" "+" ["a", "b"] ["a", "+", "b"],- testInt "number interspersion" 0 [1, 2, 3] [1, 0, 2, 0, 3]]- where- testStr name ifx lst result = primCase name _lists_intersperse [string ifx, stringList lst] (stringList result)- testInt name ifx lst result = primCase name _lists_intersperse [int32 ifx, intList lst] (intList result)--listsLast :: TestGroup-listsLast = TestGroup "last" Nothing [] [- testInt "three element list" [1, 2, 3] 3,- testInt "single element list" [42] 42,- testInt "negative numbers" [-1, -2, -3] (-3),- testStr "string list" ["hello", "world"] "world"]- where- testInt name lst result = primCase name _lists_last [intList lst] (int32 result)- testStr name lst result = primCase name _lists_last [stringList lst] (string result)--listsLength :: TestGroup-listsLength = TestGroup "length" Nothing [] [- testInt "three elements" [1, 2, 3] 3,- testInt "empty list" [] 0,- testInt "single element" [42] 1,- testInt "many elements" [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 10,- testStr "string list" ["a", "b", "c"] 3]- where- testInt name lst result = primCase name _lists_length [intList lst] (int32 result)- testStr name lst result = primCase name _lists_length [stringList lst] (int32 result)--listsMap :: TestGroup-listsMap = TestGroup "map" Nothing [] [- testStr "string to uppercase" (primitive _strings_toUpper) ["one", "two"] ["ONE", "TWO"],- testStr "empty list" (primitive _strings_toUpper) [] [],- testStr "single element" (primitive _strings_toUpper) ["hello"] ["HELLO"],- testInt "number negation" (primitive _math_neg) [1, 2, 3] [-1, -2, -3],- testInt "identity function" (primitive _equality_identity) [1, 2, 3] [1, 2, 3]]- where- testStr name fun lst result = primCase name _lists_map [fun, stringList lst] (stringList result)- testInt name fun lst result = primCase name _lists_map [fun, intList lst] (intList result)--listsNub :: TestGroup-listsNub = TestGroup "nub" Nothing [] [- testInt "remove duplicates" [1, 2, 1, 3, 2, 4] [1, 2, 3, 4],- testInt "no duplicates" [1, 2, 3] [1, 2, 3],- testInt "all duplicates" [1, 1, 1] [1],- testInt "empty list" [] [],- testInt "single element" [1] [1],- testStr "string duplicates" ["a", "b", "a", "c"] ["a", "b", "c"]]- where- testInt name lst result = primCase name _lists_nub [intList lst] (intList result)- testStr name lst result = primCase name _lists_nub [stringList lst] (stringList result)--listsNull :: TestGroup-listsNull = TestGroup "null" Nothing [] [- testInt "empty int list" [] True,- testInt "single element" [1] False,- testInt "multiple elements" [1, 2, 3] False,- testStr "empty string list" [] True,- testStr "non-empty string list" ["a"] False]- where- testInt name lst result = primCase name _lists_null [intList lst] (boolean result)- testStr name lst result = primCase name _lists_null [stringList lst] (boolean result)--listsPure :: TestGroup-listsPure = TestGroup "pure" Nothing [] [- testStr "string element" "one" ["one"],- testStr "empty string" "" [""],- testInt "number element" 42 [42],- testInt "negative number" (-5) [-5]]- where- testStr name arg result = primCase name _lists_pure [string arg] (stringList result)- testInt name arg result = primCase name _lists_pure [int32 arg] (intList result)--listsReplicate :: TestGroup-listsReplicate = TestGroup "replicate" Nothing [] [- testInt "replicate three times" 3 42 [42, 42, 42],- testInt "replicate zero times" 0 1 [],- testInt "replicate once" 1 99 [99],- testStr "replicate string" 2 "hello" ["hello", "hello"]]- where- testInt name n x result = primCase name _lists_replicate [int32 n, int32 x] (intList result)- testStr name n x result = primCase name _lists_replicate [int32 n, string x] (stringList result)--listsReverse :: TestGroup-listsReverse = TestGroup "reverse" Nothing [] [- testInt "multiple elements" [1, 2, 3, 4] [4, 3, 2, 1],- testInt "single element" [1] [1],- testInt "empty list" [] [],- testInt "two elements" [1, 2] [2, 1],- testStr "string list" ["a", "b", "c"] ["c", "b", "a"]]- where- testInt name lst result = primCase name _lists_reverse [intList lst] (intList result)- testStr name lst result = primCase name _lists_reverse [stringList lst] (stringList result)--listsSafeHead :: TestGroup-listsSafeHead = TestGroup "safeHead" Nothing [] [- testInt "non-empty int list" [1, 2, 3] (Just 1),- testInt "empty int list" [] Nothing,- testInt "single element" [42] (Just 42),- testStr "non-empty string list" ["hello", "world"] (Just "hello"),- testStr "empty string list" [] Nothing]- where- testInt name lst result = primCase name _lists_safeHead [intList lst] (optionalInt32 result)- testStr name lst result = primCase name _lists_safeHead [stringList lst] (optionalString result)- optionalInt32 Nothing = optional Nothing- optionalInt32 (Just x) = optional (Just (int32 x))- optionalString Nothing = optional Nothing- optionalString (Just x) = optional (Just (string x))--listsSingleton :: TestGroup-listsSingleton = TestGroup "singleton" Nothing [] [- testInt "number element" 42 [42],- testInt "negative number" (-1) [-1],- testInt "zero" 0 [0],- testStr "string element" "hello" ["hello"]]- where- testInt name x result = primCase name _lists_singleton [int32 x] (intList result)- testStr name x result = primCase name _lists_singleton [string x] (stringList result)--listsSort :: TestGroup-listsSort = TestGroup "sort" Nothing [] [- testInt "unsorted numbers" [3, 1, 4, 1, 5] [1, 1, 3, 4, 5],- testInt "already sorted" [1, 2, 3] [1, 2, 3],- testInt "reverse sorted" [3, 2, 1] [1, 2, 3],- testInt "single element" [1] [1],- testInt "empty list" [] [],- testInt "duplicates" [2, 1, 2, 3, 1] [1, 1, 2, 2, 3],- testStr "string sort" ["zebra", "apple", "banana"] ["apple", "banana", "zebra"]]- where- testInt name lst result = primCase name _lists_sort [intList lst] (intList result)- testStr name lst result = primCase name _lists_sort [stringList lst] (stringList result)--listsSortOn :: TestGroup-listsSortOn = TestGroup "sortOn" Nothing [] [- testStr "sort by string length" (primitive _strings_length) ["hello", "hi", "world"] ["hi", "hello", "world"],- testStr "empty string list" (primitive _strings_length) [] [],- testStr "single string element" (primitive _strings_length) ["test"] ["test"],- testInt "sort by negation" (primitive _math_neg) [1, 3, 2] [3, 2, 1],- testInt "sort by absolute value" (primitive _math_neg) [-1, -3, 2] [-1, 2, -3]]- where- testStr name keyFn lst result = primCase name _lists_sortOn [keyFn, stringList lst] (stringList result)- testInt name keyFn lst result = primCase name _lists_sortOn [keyFn, intList lst] (intList result)--listsSpan :: TestGroup-listsSpan = TestGroup "span" Nothing [] [- test "span less than 3" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 3)) [1, 2, 3, 1, 2] ([1, 2], [3, 1, 2]),- test "span all elements" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 10)) [1, 2, 3] ([1, 2, 3], []),- test "span no elements" (lambda "x" (primitive _equality_gt <.> var "x" <.> int32 10)) [1, 2, 3] ([], [1, 2, 3]),- test "empty list" (lambda "x" (primitive _equality_lt <.> var "x" <.> int32 5)) [] ([], [])]- where- test name pred lst (prefix, suffix) = primCase name _lists_span [pred, intList lst] (pair (intList prefix) (intList suffix))--listsTail :: TestGroup-listsTail = TestGroup "tail" Nothing [] [- testInt "multiple elements" [1, 2, 3, 4] [2, 3, 4],- testInt "two elements" [1, 2] [2],- testInt "single element" [1] [],- testStr "string list" ["a", "b", "c"] ["b", "c"]]- where- testInt name lst result = primCase name _lists_tail [intList lst] (intList result)- testStr name lst result = primCase name _lists_tail [stringList lst] (stringList result)+ listsZip,+ listsZipWith]+ where+ listsApply = supergroup "apply" [+ subgroup "string transformations" [+ testStr "string transformations" [primitive _strings_toUpper, primitive _strings_toLower] ["One", "Two", "Three"] ["ONE", "TWO", "THREE", "one", "two", "three"]],+ subgroup "edge cases" [+ testStr "empty function list" [] ["a", "b"] [],+ testStr "empty input list" [primitive _strings_toUpper] [] [],+ testStr "single function" [primitive _strings_toUpper] ["hello"] ["HELLO"],+ testStr "single input" [primitive _strings_toUpper, primitive _strings_toLower] ["Test"] ["TEST", "test"]]]+ where+ testStr name funs lst result = primCase name _lists_apply [list funs, stringList lst] (stringList result)+ + listsAt = subgroup "at" [+ testInt "first element" 0 [1, 2, 3] 1,+ testInt "middle element" 1 [1, 2, 3] 2,+ testInt "last element" 2 [1, 2, 3] 3,+ testInt "single element list" 0 [42] 42,+ testStr "string list access" 1 ["hello", "world"] "world"]+ where+ testInt name idx lst result = primCase name _lists_at [int32 idx, intList lst] (int32 result)+ testStr name idx lst result = primCase name _lists_at [int32 idx, stringList lst] (string result)+ + listsBind = subgroup "bind" [+ test "negation function" [1, 2, 3, 4] (lambda "x" (primitive _lists_pure @@ (primitive _math_negate @@ var "x"))) (negate <$> [1, 2, 3, 4]),+ test "empty list" [] (lambda "x" (primitive _lists_pure @@ (primitive _math_negate @@ var "x"))) [],+ test "single element" [5] (lambda "x" (primitive _lists_pure @@ (primitive _math_negate @@ var "x"))) [-5],+ test "duplicate elements" [1, 1, 2] (lambda "x" (primitive _lists_pure @@ (primitive _math_negate @@ var "x"))) [-1, -1, -2]]+ where+ test name lst fun result = primCase name _lists_bind [intList lst, fun] (intList result)+ + listsConcat = subgroup "concat" [+ test "multiple non-empty lists" [[1, 2, 3], [4, 5], [6, 7, 8]] [1, 2, 3, 4, 5, 6, 7, 8],+ test "empty lists included" [[], [1, 2], [], [3]] [1, 2, 3],+ test "single list" [[1, 2, 3]] [1, 2, 3],+ test "all empty lists" [[], [], []] [],+ test "empty list of lists" [] []]+ where+ test name lists result = primCase name _lists_concat [intListList lists] (intList result)+ + listsConcat2 = subgroup "concat2" [+ testInt "two non-empty lists" [1, 2] [3, 4] [1, 2, 3, 4],+ testInt "first list empty" [] [1, 2] [1, 2],+ testInt "second list empty" [1, 2] [] [1, 2],+ testInt "both lists empty" [] [] [],+ testInt "single elements" [1] [2] [1, 2],+ testStr "string lists" ["a", "b"] ["c", "d"] ["a", "b", "c", "d"]]+ where+ testInt name lst1 lst2 result = primCase name _lists_concat2 [intList lst1, intList lst2] (intList result)+ testStr name lst1 lst2 result = primCase name _lists_concat2 [stringList lst1, stringList lst2] (stringList result)+ + listsCons = subgroup "cons" [+ testInt "cons to non-empty list" 1 [2, 3] [1, 2, 3],+ testInt "cons to empty list" 1 [] [1],+ testInt "cons negative number" (-1) [2, 3] [-1, 2, 3],+ testStr "cons string" "hello" ["world"] ["hello", "world"]]+ where+ testInt name x lst result = primCase name _lists_cons [int32 x, intList lst] (intList result)+ testStr name x lst result = primCase name _lists_cons [string x, stringList lst] (stringList result)+ + listsDrop = subgroup "drop" [+ test "drop from beginning" 2 [1, 2, 3, 4, 5] [3, 4, 5],+ test "drop zero elements" 0 [1, 2, 3] [1, 2, 3],+ test "drop all elements" 3 [1, 2, 3] [],+ test "drop more than length" 5 [1, 2] [],+ test "drop from empty list" 3 [] [],+ test "drop negative amount" (-1) [1, 2, 3] [1, 2, 3]]+ where+ test name n lst result = primCase name _lists_drop [int32 n, intList lst] (intList result)+ + listsDropWhile = subgroup "dropWhile" [+ test "drop while less than 3" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 3)) [1, 2, 3, 2, 1] [3, 2, 1],+ test "drop all elements" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 10)) [1, 2, 3] [],+ test "drop no elements" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 0)) [1, 2, 3] [1, 2, 3],+ test "empty list" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 5)) [] []]+ where+ test name pred lst result = primCase name _lists_dropWhile [pred, intList lst] (intList result)+ + listsElem = subgroup "elem" [+ testInt "element present" 2 [1, 2, 3] True,+ testInt "element not present" 4 [1, 2, 3] False,+ testInt "empty list" 1 [] False,+ testInt "single element present" 1 [1] True,+ testInt "single element not present" 2 [1] False,+ testInt "duplicate elements" 2 [1, 2, 2, 3] True,+ testStr "string element present" "hello" ["world", "hello", "test"] True,+ testStr "string element not present" "missing" ["world", "hello"] False]+ where+ testInt name x lst result = primCase name _lists_elem [int32 x, intList lst] (boolean result)+ testStr name x lst result = primCase name _lists_elem [string x, stringList lst] (boolean result)+ + listsFilter = subgroup "filter" [+ test "filter positive numbers" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 0)) [-1, 2, -3, 4, 5] [2, 4, 5],+ test "filter all elements" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 10)) [1, 2, 3] [1, 2, 3],+ test "filter no elements" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 10)) [1, 2, 3] [],+ test "empty list" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 0)) [] []]+ where+ test name pred lst result = primCase name _lists_filter [pred, intList lst] (intList result) -listsTake :: TestGroup-listsTake = TestGroup "take" Nothing [] [- test "take from beginning" 2 [1, 2, 3, 4, 5] [1, 2],- test "take zero elements" 0 [1, 2, 3] [],- test "take all elements" 3 [1, 2, 3] [1, 2, 3],- test "take more than length" 5 [1, 2] [1, 2],- test "take from empty list" 3 [] [],- test "take negative amount" (-1) [1, 2, 3] []]- where- test name n lst result = primCase name _lists_take [int32 n, intList lst] (intList result)+ listsFind = subgroup "find" [+ test "find existing element" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 3)) [1, 2, 4, 5] (Just 4),+ test "find first matching" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 0)) [1, 2, 3] (Just 1),+ test "find no match" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 10)) [1, 2, 3] Nothing,+ test "find in empty list" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 0)) [] Nothing,+ test "find single element" (lambda "x" (primitive _equality_equal @@ var "x" @@ int32 42)) [42] (Just 42)]+ where+ test name pred lst result = primCase name _lists_find [pred, intList lst] (optionalInt32 result) -listsTranspose :: TestGroup-listsTranspose = TestGroup "transpose" Nothing [] [- test "square matrix" [[1, 2, 3], [4, 5, 6]] [[1, 4], [2, 5], [3, 6]],- test "empty lists" [] [],- test "single row" [[1, 2, 3]] [[1], [2], [3]],- test "single column" [[1], [2], [3]] [[1, 2, 3]],- test "ragged matrix" [[1, 2], [3], [4, 5, 6]] [[1, 3, 4], [2, 5], [6]]]- where- test name matrix result = primCase name _lists_transpose [intListList matrix] (intListList result)+ listsFoldl = subgroup "foldl" [+ test "sum with addition" (primitive _math_add) 0 [1, 2, 3, 4] 10,+ test "product with multiplication" (primitive _math_mul) 1 [2, 3, 4] 24,+ test "empty list" (primitive _math_add) 5 [] 5,+ test "single element" (primitive _math_add) 10 [5] 15,+ test "subtraction fold" (primitive _math_sub) 10 [1, 2, 3] 4]+ where+ test name op acc lst result = primCase name _lists_foldl [op, int32 acc, intList lst] (int32 result)+ + listsGroup = subgroup "group" [+ test "consecutive duplicates" [1, 1, 2, 2, 2, 3, 1] [[1, 1], [2, 2, 2], [3], [1]],+ test "no duplicates" [1, 2, 3] [[1], [2], [3]],+ test "all same" [1, 1, 1] [[1, 1, 1]],+ test "empty list" [] [],+ test "single element" [1] [[1]]]+ where+ test name lst result = primCase name _lists_group [intList lst] (intListList result)+ + listsHead = subgroup "head" [+ testInt "three element list" [1, 2, 3] 1,+ testInt "single element list" [42] 42,+ testInt "negative numbers" [-1, -2, -3] (-1),+ testStr "string list" ["hello", "world"] "hello"]+ where+ testInt name lst result = primCase name _lists_head [intList lst] (int32 result)+ testStr name lst result = primCase name _lists_head [stringList lst] (string result)+ + listsInit = subgroup "init" [+ testInt "multiple elements" [1, 2, 3, 4] [1, 2, 3],+ testInt "two elements" [1, 2] [1],+ testInt "single element" [1] [],+ testStr "string list" ["a", "b", "c"] ["a", "b"]]+ where+ testInt name lst result = primCase name _lists_init [intList lst] (intList result)+ testStr name lst result = primCase name _lists_init [stringList lst] (stringList result)+ + listsIntercalate = subgroup "intercalate" [+ test "double zero separator" [0, 0] [[1, 2, 3], [4, 5], [6, 7, 8]] [1, 2, 3, 0, 0, 4, 5, 0, 0, 6, 7, 8],+ test "empty separator" [] [[1, 2], [3, 4]] [1, 2, 3, 4],+ test "single element separator" [99] [[1], [2], [3]] [1, 99, 2, 99, 3],+ test "empty list of lists" [0] [] [],+ test "single list" [0] [[1, 2, 3]] [1, 2, 3],+ test "lists with empty lists" [0] [[], [1], []] [0, 1, 0]]+ where+ test name ifx lists result = primCase name _lists_intercalate [intList ifx, intListList lists] (intList result)+ + listsIntersperse = subgroup "intersperse" [+ testStr "string interspersion" "and" ["one", "two", "three"] ["one", "and", "two", "and", "three"],+ testStr "single element" "x" ["only"] ["only"],+ testStr "empty list" "x" [] [],+ testStr "two elements" "+" ["a", "b"] ["a", "+", "b"],+ testInt "number interspersion" 0 [1, 2, 3] [1, 0, 2, 0, 3]]+ where+ testStr name ifx lst result = primCase name _lists_intersperse [string ifx, stringList lst] (stringList result)+ testInt name ifx lst result = primCase name _lists_intersperse [int32 ifx, intList lst] (intList result)+ + listsLast = subgroup "last" [+ testInt "three element list" [1, 2, 3] 3,+ testInt "single element list" [42] 42,+ testInt "negative numbers" [-1, -2, -3] (-3),+ testStr "string list" ["hello", "world"] "world"]+ where+ testInt name lst result = primCase name _lists_last [intList lst] (int32 result)+ testStr name lst result = primCase name _lists_last [stringList lst] (string result)+ + listsLength = subgroup "length" [+ testInt "three elements" [1, 2, 3] 3,+ testInt "empty list" [] 0,+ testInt "single element" [42] 1,+ testInt "many elements" [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 10,+ testStr "string list" ["a", "b", "c"] 3]+ where+ testInt name lst result = primCase name _lists_length [intList lst] (int32 result)+ testStr name lst result = primCase name _lists_length [stringList lst] (int32 result)+ + listsMap = subgroup "map" [+ testStr "string to uppercase" (primitive _strings_toUpper) ["one", "two"] ["ONE", "TWO"],+ testStr "empty list" (primitive _strings_toUpper) [] [],+ testStr "single element" (primitive _strings_toUpper) ["hello"] ["HELLO"],+ testInt "number negation" (primitive _math_negate) [1, 2, 3] [-1, -2, -3],+ testInt "identity function" (primitive _equality_identity) [1, 2, 3] [1, 2, 3]]+ where+ testStr name fun lst result = primCase name _lists_map [fun, stringList lst] (stringList result)+ testInt name fun lst result = primCase name _lists_map [fun, intList lst] (intList result)+ + listsNub = subgroup "nub" [+ testInt "remove duplicates" [1, 2, 1, 3, 2, 4] [1, 2, 3, 4],+ testInt "no duplicates" [1, 2, 3] [1, 2, 3],+ testInt "all duplicates" [1, 1, 1] [1],+ testInt "empty list" [] [],+ testInt "single element" [1] [1],+ testStr "string duplicates" ["a", "b", "a", "c"] ["a", "b", "c"]]+ where+ testInt name lst result = primCase name _lists_nub [intList lst] (intList result)+ testStr name lst result = primCase name _lists_nub [stringList lst] (stringList result)+ + listsNull = subgroup "null" [+ testInt "empty int list" [] True,+ testInt "single element" [1] False,+ testInt "multiple elements" [1, 2, 3] False,+ testStr "empty string list" [] True,+ testStr "non-empty string list" ["a"] False]+ where+ testInt name lst result = primCase name _lists_null [intList lst] (boolean result)+ testStr name lst result = primCase name _lists_null [stringList lst] (boolean result) -listsZip :: TestGroup-listsZip = TestGroup "zip" Nothing [] [- test "equal length lists" [1, 2, 3] ["a", "b", "c"] [(1, "a"), (2, "b"), (3, "c")],- test "first list shorter" [1, 2] ["a", "b", "c"] [(1, "a"), (2, "b")],- test "second list shorter" [1, 2, 3] ["a", "b"] [(1, "a"), (2, "b")],- test "empty first list" [] ["a", "b"] [],- test "empty second list" [1, 2] [] [],- test "both empty lists" [] [] []]- where- test name lst1 lst2 result = primCase name _lists_zip [intList lst1, stringList lst2] (list ((\(x, y) -> pair (int32 x) (string y)) <$> result))+ listsPartition = subgroup "partition" [+ test "partition greater than 3" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 3)) [1, 2, 3, 4, 5, 6] ([4, 5, 6], [1, 2, 3]),+ test "partition all elements" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 10)) [1, 2, 3] ([1, 2, 3], []),+ test "partition no elements" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 10)) [1, 2, 3] ([], [1, 2, 3]),+ test "partition even numbers" (lambda "x" (primitive _math_even @@ var "x")) [1, 2, 3, 4, 5, 6] ([2, 4, 6], [1, 3, 5]),+ test "empty list" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 5)) [] ([], [])]+ where+ test name pred lst (yes, no) = primCase name _lists_partition [pred, intList lst] (pair (intList yes) (intList no)) -listsZipWith :: TestGroup-listsZipWith = TestGroup "zipWith" Nothing [] [- testInt "addition" (primitive _math_add) [1, 2, 3] [4, 5, 6] [5, 7, 9],- testInt "first list shorter" (primitive _math_add) [1, 2] [4, 5, 6] [5, 7],- testInt "second list shorter" (primitive _math_add) [1, 2, 3] [4, 5] [5, 7],- testInt "empty first list" (primitive _math_add) [] [1, 2, 3] [],- testInt "empty second list" (primitive _math_add) [1, 2, 3] [] [],- testStr "string concatenation" (primitive _strings_cat2) ["a", "b"] ["1", "2"] ["a1", "b1"]]- where- testInt name op lst1 lst2 result = primCase name _lists_zipWith [op, intList lst1, intList lst2] (intList result)- testStr name op lst1 lst2 result = primCase name _lists_zipWith [op, stringList lst1, stringList lst2] (stringList result)+ listsPure = subgroup "pure" [+ testStr "string element" "one" ["one"],+ testStr "empty string" "" [""],+ testInt "number element" 42 [42],+ testInt "negative number" (-5) [-5]]+ where+ testStr name arg result = primCase name _lists_pure [string arg] (stringList result)+ testInt name arg result = primCase name _lists_pure [int32 arg] (intList result)+ + listsReplicate = subgroup "replicate" [+ testInt "replicate three times" 3 42 [42, 42, 42],+ testInt "replicate zero times" 0 1 [],+ testInt "replicate once" 1 99 [99],+ testStr "replicate string" 2 "hello" ["hello", "hello"]]+ where+ testInt name n x result = primCase name _lists_replicate [int32 n, int32 x] (intList result)+ testStr name n x result = primCase name _lists_replicate [int32 n, string x] (stringList result)+ + listsReverse = subgroup "reverse" [+ testInt "multiple elements" [1, 2, 3, 4] [4, 3, 2, 1],+ testInt "single element" [1] [1],+ testInt "empty list" [] [],+ testInt "two elements" [1, 2] [2, 1],+ testStr "string list" ["a", "b", "c"] ["c", "b", "a"]]+ where+ testInt name lst result = primCase name _lists_reverse [intList lst] (intList result)+ testStr name lst result = primCase name _lists_reverse [stringList lst] (stringList result)+ + listsSafeHead = subgroup "safeHead" [+ testInt "non-empty int list" [1, 2, 3] (Just 1),+ testInt "empty int list" [] Nothing,+ testInt "single element" [42] (Just 42),+ testStr "non-empty string list" ["hello", "world"] (Just "hello"),+ testStr "empty string list" [] Nothing]+ where+ testInt name lst result = primCase name _lists_safeHead [intList lst] (optionalInt32 result)+ testStr name lst result = primCase name _lists_safeHead [stringList lst] (optionalString result)+ + listsSingleton = subgroup "singleton" [+ testInt "number element" 42 [42],+ testInt "negative number" (-1) [-1],+ testInt "zero" 0 [0],+ testStr "string element" "hello" ["hello"]]+ where+ testInt name x result = primCase name _lists_singleton [int32 x] (intList result)+ testStr name x result = primCase name _lists_singleton [string x] (stringList result)+ + listsSort = subgroup "sort" [+ testInt "unsorted numbers" [3, 1, 4, 1, 5] [1, 1, 3, 4, 5],+ testInt "already sorted" [1, 2, 3] [1, 2, 3],+ testInt "reverse sorted" [3, 2, 1] [1, 2, 3],+ testInt "single element" [1] [1],+ testInt "empty list" [] [],+ testInt "duplicates" [2, 1, 2, 3, 1] [1, 1, 2, 2, 3],+ testStr "string sort" ["zebra", "apple", "banana"] ["apple", "banana", "zebra"]]+ where+ testInt name lst result = primCase name _lists_sort [intList lst] (intList result)+ testStr name lst result = primCase name _lists_sort [stringList lst] (stringList result)+ + listsSortOn = subgroup "sortOn" [+ testStr "sort by string length" (primitive _strings_length) ["hello", "hi", "world"] ["hi", "hello", "world"],+ testStr "empty string list" (primitive _strings_length) [] [],+ testStr "single string element" (primitive _strings_length) ["test"] ["test"],+ testInt "sort by negation" (primitive _math_negate) [1, 3, 2] [3, 2, 1],+ testInt "sort by absolute value" (primitive _math_abs) [-1, -3, 2] [-1, 2, -3]]+ where+ testStr name keyFn lst result = primCase name _lists_sortOn [keyFn, stringList lst] (stringList result)+ testInt name keyFn lst result = primCase name _lists_sortOn [keyFn, intList lst] (intList result)+ + listsSpan = subgroup "span" [+ test "span less than 3" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 3)) [1, 2, 3, 1, 2] ([1, 2], [3, 1, 2]),+ test "span all elements" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 10)) [1, 2, 3] ([1, 2, 3], []),+ test "span no elements" (lambda "x" (primitive _equality_gt @@ var "x" @@ int32 10)) [1, 2, 3] ([], [1, 2, 3]),+ test "empty list" (lambda "x" (primitive _equality_lt @@ var "x" @@ int32 5)) [] ([], [])]+ where+ test name pred lst (prefix, suffix) = primCase name _lists_span [pred, intList lst] (pair (intList prefix) (intList suffix))+ + listsTail = subgroup "tail" [+ testInt "multiple elements" [1, 2, 3, 4] [2, 3, 4],+ testInt "two elements" [1, 2] [2],+ testInt "single element" [1] [],+ testStr "string list" ["a", "b", "c"] ["b", "c"]]+ where+ testInt name lst result = primCase name _lists_tail [intList lst] (intList result)+ testStr name lst result = primCase name _lists_tail [stringList lst] (stringList result)+ + listsTake = subgroup "take" [+ test "take from beginning" 2 [1, 2, 3, 4, 5] [1, 2],+ test "take zero elements" 0 [1, 2, 3] [],+ test "take all elements" 3 [1, 2, 3] [1, 2, 3],+ test "take more than length" 5 [1, 2] [1, 2],+ test "take from empty list" 3 [] [],+ test "take negative amount" (-1) [1, 2, 3] []]+ where+ test name n lst result = primCase name _lists_take [int32 n, intList lst] (intList result)+ + listsTranspose = subgroup "transpose" [+ test "square matrix" [[1, 2, 3], [4, 5, 6]] [[1, 4], [2, 5], [3, 6]],+ test "empty lists" [] [],+ test "single row" [[1, 2, 3]] [[1], [2], [3]],+ test "single column" [[1], [2], [3]] [[1, 2, 3]],+ test "ragged matrix" [[1, 2], [3], [4, 5, 6]] [[1, 3, 4], [2, 5], [6]]]+ where+ test name matrix result = primCase name _lists_transpose [intListList matrix] (intListList result)+ + listsZip = subgroup "zip" [+ test "equal length lists" [1, 2, 3] ["a", "b", "c"] [(1, "a"), (2, "b"), (3, "c")],+ test "first list shorter" [1, 2] ["a", "b", "c"] [(1, "a"), (2, "b")],+ test "second list shorter" [1, 2, 3] ["a", "b"] [(1, "a"), (2, "b")],+ test "empty first list" [] ["a", "b"] [],+ test "empty second list" [1, 2] [] [],+ test "both empty lists" [] [] []]+ where+ test name lst1 lst2 result = primCase name _lists_zip [intList lst1, stringList lst2] (list ((\(x, y) -> pair (int32 x) (string y)) <$> result))+ + listsZipWith = subgroup "zipWith" [+ testInt "addition" (primitive _math_add) [1, 2, 3] [4, 5, 6] [5, 7, 9],+ testInt "first list shorter" (primitive _math_add) [1, 2] [4, 5, 6] [5, 7],+ testInt "second list shorter" (primitive _math_add) [1, 2, 3] [4, 5] [5, 7],+ testInt "empty first list" (primitive _math_add) [] [1, 2, 3] [],+ testInt "empty second list" (primitive _math_add) [1, 2, 3] [] [],+ testStr "string concatenation" (primitive _strings_cat2) ["a", "b"] ["1", "2"] ["a1", "b2"]]+ where+ testInt name op lst1 lst2 result = primCase name _lists_zipWith [op, intList lst1, intList lst2] (intList result)+ testStr name op lst1 lst2 result = primCase name _lists_zipWith [op, stringList lst1, stringList lst2] (stringList result)
+ src/main/haskell/Hydra/Sources/Test/Lib/Literals.hs view
@@ -0,0 +1,558 @@+module Hydra.Sources.Test.Lib.Literals where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as BC+++ns :: Namespace+ns = Namespace "hydra.test.lib.literals"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.literals primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Test groups for hydra.lib.literals primitives+-- Note: Testing a representative subset of the many literal conversion functions++literalsBigintToInt32 :: TTerm TestGroup+literalsBigintToInt32 = subgroup "bigintToInt32" [+ test "positive" 42 42,+ test "negative" (-42) (-42),+ test "zero" 0 0]+ where+ test name x result = primCase name _literals_bigintToInt32 [bigint x] (int32 result)++literalsInt32ToBigint :: TTerm TestGroup+literalsInt32ToBigint = subgroup "int32ToBigint" [+ test "positive" 42 42,+ test "negative" (-42) (-42),+ test "zero" 0 0]+ where+ test name x result = primCase name _literals_int32ToBigint [int32 x] (bigint result)++-- Other integer to bigint conversions++literalsInt8ToBigint :: TTerm TestGroup+literalsInt8ToBigint = subgroup "int8ToBigint" [+ test "positive" 42 42,+ test "negative" (-42) (-42),+ test "max value" 127 127,+ test "min value" (-128) (-128)]+ where+ test name x result = primCase name _literals_int8ToBigint [int8 x] (bigint result)++literalsInt16ToBigint :: TTerm TestGroup+literalsInt16ToBigint = subgroup "int16ToBigint" [+ test "positive" 1000 1000,+ test "negative" (-1000) (-1000)]+ where+ test name x result = primCase name _literals_int16ToBigint [int16 x] (bigint result)++literalsInt64ToBigint :: TTerm TestGroup+literalsInt64ToBigint = subgroup "int64ToBigint" [+ test "positive" 1000000 1000000,+ test "negative" (-1000000) (-1000000)]+ where+ test name x result = primCase name _literals_int64ToBigint [int64 x] (bigint result)++-- Unsigned integer to bigint conversions++literalsUint8ToBigint :: TTerm TestGroup+literalsUint8ToBigint = subgroup "uint8ToBigint" [+ test "zero" 0 0,+ test "max value" 255 255]+ where+ test name x result = primCase name _literals_uint8ToBigint [uint8 x] (bigint result)++literalsUint16ToBigint :: TTerm TestGroup+literalsUint16ToBigint = subgroup "uint16ToBigint" [+ test "zero" 0 0,+ test "typical value" 1000 1000]+ where+ test name x result = primCase name _literals_uint16ToBigint [uint16 x] (bigint result)++literalsUint32ToBigint :: TTerm TestGroup+literalsUint32ToBigint = subgroup "uint32ToBigint" [+ test "zero" 0 0,+ test "typical value" 100000 100000]+ where+ test name x result = primCase name _literals_uint32ToBigint [uint32 x] (bigint result)++literalsUint64ToBigint :: TTerm TestGroup+literalsUint64ToBigint = subgroup "uint64ToBigint" [+ test "zero" 0 0,+ test "typical value" 1000000 1000000]+ where+ test name x result = primCase name _literals_uint64ToBigint [uint64 x] (bigint result)++-- Bigint to other integer conversions++literalsBigintToInt8 :: TTerm TestGroup+literalsBigintToInt8 = subgroup "bigintToInt8" [+ test "positive" 42 42,+ test "negative" (-42) (-42)]+ where+ test name x result = primCase name _literals_bigintToInt8 [bigint x] (int8 result)++literalsBigintToInt16 :: TTerm TestGroup+literalsBigintToInt16 = subgroup "bigintToInt16" [+ test "positive" 1000 1000,+ test "negative" (-1000) (-1000)]+ where+ test name x result = primCase name _literals_bigintToInt16 [bigint x] (int16 result)++literalsBigintToInt64 :: TTerm TestGroup+literalsBigintToInt64 = subgroup "bigintToInt64" [+ test "positive" 1000000 1000000,+ test "negative" (-1000000) (-1000000)]+ where+ test name x result = primCase name _literals_bigintToInt64 [bigint x] (int64 result)++literalsBigintToUint8 :: TTerm TestGroup+literalsBigintToUint8 = subgroup "bigintToUint8" [+ test "zero" 0 0,+ test "typical value" 100 100]+ where+ test name x result = primCase name _literals_bigintToUint8 [bigint x] (uint8 result)++literalsBigintToUint16 :: TTerm TestGroup+literalsBigintToUint16 = subgroup "bigintToUint16" [+ test "zero" 0 0,+ test "typical value" 1000 1000]+ where+ test name x result = primCase name _literals_bigintToUint16 [bigint x] (uint16 result)++literalsBigintToUint32 :: TTerm TestGroup+literalsBigintToUint32 = subgroup "bigintToUint32" [+ test "zero" 0 0,+ test "typical value" 100000 100000]+ where+ test name x result = primCase name _literals_bigintToUint32 [bigint x] (uint32 result)++literalsBigintToUint64 :: TTerm TestGroup+literalsBigintToUint64 = subgroup "bigintToUint64" [+ test "zero" 0 0,+ test "typical value" 1000000 1000000]+ where+ test name x result = primCase name _literals_bigintToUint64 [bigint x] (uint64 result)++-- Float conversions++literalsFloat32ToBigfloat :: TTerm TestGroup+literalsFloat32ToBigfloat = subgroup "float32ToBigfloat" [+ test "positive" 2.5 2.5, -- use exact Float32 values+ test "negative" (-2.5) (-2.5),+ test "zero" 0.0 0.0]+ where+ test name x result = primCase name _literals_float32ToBigfloat [float32 x] (bigfloat result)++literalsFloat64ToBigfloat :: TTerm TestGroup+literalsFloat64ToBigfloat = subgroup "float64ToBigfloat" [+ test "positive" 3.14159 3.14159,+ test "negative" (-2.71828) (-2.71828),+ test "zero" 0.0 0.0]+ where+ test name x result = primCase name _literals_float64ToBigfloat [float64 x] (bigfloat result)++literalsBigfloatToFloat32 :: TTerm TestGroup+literalsBigfloatToFloat32 = subgroup "bigfloatToFloat32" [+ test "positive" 3.14 3.14,+ test "negative" (-2.5) (-2.5),+ test "zero" 0.0 0.0]+ where+ test name x result = primCase name _literals_bigfloatToFloat32 [bigfloat x] (float32 result)++literalsBigfloatToFloat64 :: TTerm TestGroup+literalsBigfloatToFloat64 = subgroup "bigfloatToFloat64" [+ test "positive" 3.14159 3.14159,+ test "negative" (-2.71828) (-2.71828),+ test "zero" 0.0 0.0]+ where+ test name x result = primCase name _literals_bigfloatToFloat64 [bigfloat x] (float64 result)++literalsBigintToBigfloat :: TTerm TestGroup+literalsBigintToBigfloat = subgroup "bigintToBigfloat" [+ test "positive" 42 42.0,+ test "negative" (-42) (-42.0),+ test "zero" 0 0.0]+ where+ test name x result = primCase name _literals_bigintToBigfloat [bigint x] (bigfloat result)++literalsBigfloatToBigint :: TTerm TestGroup+literalsBigfloatToBigint = subgroup "bigfloatToBigint" [+ test "positive" 42.7 43, -- round uses banker's rounding+ test "negative" (-42.7) (-43),+ test "zero" 0.0 0,+ test "round down" 42.3 42,+ test "half even up" 42.5 42, -- banker's rounding: 42.5 rounds to 42 (even)+ test "half even down" 43.5 44] -- banker's rounding: 43.5 rounds to 44 (even)+ where+ test name x result = primCase name _literals_bigfloatToBigint [bigfloat x] (bigint result)++-- Show functions++literalsShowInt32 :: TTerm TestGroup+literalsShowInt32 = subgroup "showInt32" [+ test "positive" 42 "42",+ test "negative" (-42) "-42",+ test "zero" 0 "0"]+ where+ test name x result = primCase name _literals_showInt32 [int32 x] (string result)++literalsShowInt8 :: TTerm TestGroup+literalsShowInt8 = subgroup "showInt8" [+ test "positive" 42 "42",+ test "negative" (-42) "-42"]+ where+ test name x result = primCase name _literals_showInt8 [int8 x] (string result)++literalsShowInt16 :: TTerm TestGroup+literalsShowInt16 = subgroup "showInt16" [+ test "positive" 1000 "1000",+ test "negative" (-1000) "-1000"]+ where+ test name x result = primCase name _literals_showInt16 [int16 x] (string result)++literalsShowInt64 :: TTerm TestGroup+literalsShowInt64 = subgroup "showInt64" [+ test "positive" 1000000 "1000000",+ test "negative" (-1000000) "-1000000"]+ where+ test name x result = primCase name _literals_showInt64 [int64 x] (string result)++literalsShowUint8 :: TTerm TestGroup+literalsShowUint8 = subgroup "showUint8" [+ test "zero" 0 "0",+ test "max value" 255 "255"]+ where+ test name x result = primCase name _literals_showUint8 [uint8 x] (string result)++literalsShowUint16 :: TTerm TestGroup+literalsShowUint16 = subgroup "showUint16" [+ test "zero" 0 "0",+ test "typical value" 1000 "1000"]+ where+ test name x result = primCase name _literals_showUint16 [uint16 x] (string result)++literalsShowUint32 :: TTerm TestGroup+literalsShowUint32 = subgroup "showUint32" [+ test "zero" 0 "0",+ test "typical value" 100000 "100000"]+ where+ test name x result = primCase name _literals_showUint32 [uint32 x] (string result)++literalsShowUint64 :: TTerm TestGroup+literalsShowUint64 = subgroup "showUint64" [+ test "zero" 0 "0",+ test "typical value" 1000000 "1000000"]+ where+ test name x result = primCase name _literals_showUint64 [uint64 x] (string result)++literalsShowBigint :: TTerm TestGroup+literalsShowBigint = subgroup "showBigint" [+ test "positive" 42 "42",+ test "negative" (-42) "-42",+ test "zero" 0 "0"]+ where+ test name x result = primCase name _literals_showBigint [bigint x] (string result)++literalsShowFloat32 :: TTerm TestGroup+literalsShowFloat32 = subgroup "showFloat32" [+ test "positive" 3.14 "3.14",+ test "negative" (-2.5) "-2.5",+ test "zero" 0.0 "0.0",+ test "small positive" 0.05 "5.0e-2",+ test "small positive 2" 0.03 "3.0e-2",+ test "very small" 0.001 "1.0e-3",+ test "normal decimal" 0.1 "0.1"]+ where+ test name x result = primCase name _literals_showFloat32 [float32 x] (string result)++literalsShowFloat64 :: TTerm TestGroup+literalsShowFloat64 = subgroup "showFloat64" [+ test "positive" 3.14159 "3.14159",+ test "zero" 0.0 "0.0",+ test "small positive" 0.05 "5.0e-2",+ test "small positive 2" 0.03 "3.0e-2",+ test "very small" 0.001 "1.0e-3",+ test "normal decimal" 0.1 "0.1"]+ where+ test name x result = primCase name _literals_showFloat64 [float64 x] (string result)++literalsShowBigfloat :: TTerm TestGroup+literalsShowBigfloat = subgroup "showBigfloat" [+ test "positive" 3.14 "3.14",+ test "zero" 0.0 "0.0",+ test "small positive" 0.05 "5.0e-2",+ test "small positive 2" 0.03 "3.0e-2",+ test "very small" 0.001 "1.0e-3",+ test "normal decimal" 0.1 "0.1"]+ where+ test name x result = primCase name _literals_showBigfloat [bigfloat x] (string result)++literalsShowBoolean :: TTerm TestGroup+literalsShowBoolean = subgroup "showBoolean" [+ test "true" true "true",+ test "false" false "false"]+ where+ test name x result = primCase name _literals_showBoolean [x] (string result)++literalsShowString :: TTerm TestGroup+literalsShowString = subgroup "showString" [+ test "simple" "hello" "\"hello\"",+ test "empty" "" "\"\"",+ -- Non-ASCII characters are escaped as decimal codes+ test "latin accented" "caf\233" "\"caf\\233\"",+ test "greek lambda" "\955" "\"\\955\"",+ test "mixed ascii and non-ascii" "A\233B" "\"A\\233B\"",+ -- Standard named escapes+ test "tab" "\t" "\"\\t\"",+ test "newline" "\n" "\"\\n\"",+ test "carriage return" "\r" "\"\\r\"",+ test "backslash" "\\" "\"\\\\\"",+ test "double quote" "\"" "\"\\\"\"",+ -- Control characters with named escapes+ test "null" "\0" "\"\\NUL\"",+ test "bell" "\a" "\"\\a\"",+ test "backspace" "\b" "\"\\b\"",+ test "form feed" "\f" "\"\\f\"",+ test "vertical tab" "\v" "\"\\v\"",+ test "delete" "\127" "\"\\DEL\""]+ where+ test name x result = primCase name _literals_showString [string x] (string result)++-- Read functions++literalsReadInt8 :: TTerm TestGroup+literalsReadInt8 = subgroup "readInt8" [+ testJust "positive" "42" 42,+ testJust "negative" "-42" (-42),+ testJust "max value" "127" 127,+ testJust "min value" "-128" (-128),+ testNothing "invalid" "abc",+ testNothing "overflow" "128"]+ where+ testJust name x result = primCase name _literals_readInt8 [string x] (Core.termMaybe $ just (int8 result))+ testNothing name x = primCase name _literals_readInt8 [string x] (Core.termMaybe nothing)++literalsReadInt16 :: TTerm TestGroup+literalsReadInt16 = subgroup "readInt16" [+ testJust "positive" "1000" 1000,+ testJust "negative" "-1000" (-1000),+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readInt16 [string x] (Core.termMaybe $ just (int16 result))+ testNothing name x = primCase name _literals_readInt16 [string x] (Core.termMaybe nothing)++literalsReadInt32 :: TTerm TestGroup+literalsReadInt32 = subgroup "readInt32" [+ testJust "positive" "42" 42,+ testJust "negative" "-42" (-42),+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readInt32 [string x] (Core.termMaybe $ just (int32 result))+ testNothing name x = primCase name _literals_readInt32 [string x] (Core.termMaybe nothing)++literalsReadInt64 :: TTerm TestGroup+literalsReadInt64 = subgroup "readInt64" [+ testJust "positive" "1000000" 1000000,+ testJust "negative" "-1000000" (-1000000),+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readInt64 [string x] (Core.termMaybe $ just (int64 result))+ testNothing name x = primCase name _literals_readInt64 [string x] (Core.termMaybe nothing)++literalsReadFloat32 :: TTerm TestGroup+literalsReadFloat32 = subgroup "readFloat32" [+ testJust "positive" "3.14" 3.14,+ testJust "negative" "-2.5" (-2.5),+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readFloat32 [string x] (Core.termMaybe $ just (float32 result))+ testNothing name x = primCase name _literals_readFloat32 [string x] (Core.termMaybe nothing)++literalsReadFloat64 :: TTerm TestGroup+literalsReadFloat64 = subgroup "readFloat64" [+ testJust "positive" "3.14159" 3.14159,+ testJust "negative" "-2.71828" (-2.71828),+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readFloat64 [string x] (Core.termMaybe $ just (float64 result))+ testNothing name x = primCase name _literals_readFloat64 [string x] (Core.termMaybe nothing)++literalsReadBigfloat :: TTerm TestGroup+literalsReadBigfloat = subgroup "readBigfloat" [+ testJust "positive" "3.14" 3.14,+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readBigfloat [string x] (Core.termMaybe $ just (bigfloat result))+ testNothing name x = primCase name _literals_readBigfloat [string x] (Core.termMaybe nothing)++literalsReadBoolean :: TTerm TestGroup+literalsReadBoolean = subgroup "readBoolean" [+ testJust "true" "true" true,+ testJust "false" "false" false,+ testNothing "invalid" "yes"]+ where+ testJust name x result = primCase name _literals_readBoolean [string x] (Core.termMaybe $ just result)+ testNothing name x = primCase name _literals_readBoolean [string x] (Core.termMaybe nothing)++literalsReadString :: TTerm TestGroup+literalsReadString = subgroup "readString" [+ testJust "quoted string" "\"hello\"" "hello",+ testJust "empty quoted" "\"\"" "",+ testNothing "unquoted" "hello"]+ where+ testJust name x result = primCase name _literals_readString [string x] (Core.termMaybe $ just (string result))+ testNothing name x = primCase name _literals_readString [string x] (Core.termMaybe nothing)++literalsReadUint8 :: TTerm TestGroup+literalsReadUint8 = subgroup "readUint8" [+ testJust "zero" "0" 0,+ testJust "typical" "100" 100,+ testJust "max value" "255" 255,+ testNothing "invalid" "abc",+ testNothing "negative" "-1"]+ where+ testJust name x result = primCase name _literals_readUint8 [string x] (Core.termMaybe $ just (uint8 result))+ testNothing name x = primCase name _literals_readUint8 [string x] (Core.termMaybe nothing)++literalsReadUint16 :: TTerm TestGroup+literalsReadUint16 = subgroup "readUint16" [+ testJust "zero" "0" 0,+ testJust "typical" "1000" 1000,+ testNothing "invalid" "abc",+ testNothing "negative" "-1"]+ where+ testJust name x result = primCase name _literals_readUint16 [string x] (Core.termMaybe $ just (uint16 result))+ testNothing name x = primCase name _literals_readUint16 [string x] (Core.termMaybe nothing)++literalsReadUint32 :: TTerm TestGroup+literalsReadUint32 = subgroup "readUint32" [+ testJust "zero" "0" 0,+ testJust "typical" "100000" 100000,+ testNothing "invalid" "abc",+ testNothing "negative" "-1"]+ where+ testJust name x result = primCase name _literals_readUint32 [string x] (Core.termMaybe $ just (uint32 result))+ testNothing name x = primCase name _literals_readUint32 [string x] (Core.termMaybe nothing)++literalsReadUint64 :: TTerm TestGroup+literalsReadUint64 = subgroup "readUint64" [+ testJust "zero" "0" 0,+ testJust "typical" "1000000" 1000000,+ testNothing "invalid" "abc",+ testNothing "negative" "-1"]+ where+ testJust name x result = primCase name _literals_readUint64 [string x] (Core.termMaybe $ just (uint64 result))+ testNothing name x = primCase name _literals_readUint64 [string x] (Core.termMaybe nothing)++literalsReadBigint :: TTerm TestGroup+literalsReadBigint = subgroup "readBigint" [+ testJust "positive" "42" 42,+ testJust "negative" "-42" (-42),+ testJust "zero" "0" 0,+ testJust "large" "123456789012345678901234567890" 123456789012345678901234567890,+ testNothing "invalid" "abc"]+ where+ testJust name x result = primCase name _literals_readBigint [string x] (Core.termMaybe $ just (bigint result))+ testNothing name x = primCase name _literals_readBigint [string x] (Core.termMaybe nothing)++-- Binary/String conversion+-- Note: binaryToStringBS and stringToBinary use base64 encoding++literalsStringToBinary :: TTerm TestGroup+literalsStringToBinary = subgroup "stringToBinary" [+ test "simple base64" "aGVsbG8=" (BC.pack "hello"),+ test "empty string" "" B.empty]+ where+ test name x result = primCase name _literals_stringToBinary [string x] (binary result)++literalsBinaryToString :: TTerm TestGroup+literalsBinaryToString = subgroup "binaryToString" [+ test "simple binary" (BC.pack "hello") "aGVsbG8=",+ test "empty binary" B.empty ""]+ where+ test name x result = primCase name _literals_binaryToString [binary x] (string result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.literals primitives" $+ supergroup "hydra.lib.literals primitives" [+ -- Bigint conversions+ literalsBigintToInt8,+ literalsBigintToInt16,+ literalsBigintToInt32,+ literalsBigintToInt64,+ literalsBigintToUint8,+ literalsBigintToUint16,+ literalsBigintToUint32,+ literalsBigintToUint64,+ -- To bigint conversions+ literalsInt8ToBigint,+ literalsInt16ToBigint,+ literalsInt32ToBigint,+ literalsInt64ToBigint,+ literalsUint8ToBigint,+ literalsUint16ToBigint,+ literalsUint32ToBigint,+ literalsUint64ToBigint,+ -- Float conversions+ literalsFloat32ToBigfloat,+ literalsFloat64ToBigfloat,+ literalsBigfloatToFloat32,+ literalsBigfloatToFloat64,+ literalsBigintToBigfloat,+ literalsBigfloatToBigint,+ -- Show functions+ literalsShowInt8,+ literalsShowInt16,+ literalsShowInt32,+ literalsShowInt64,+ literalsShowUint8,+ literalsShowUint16,+ literalsShowUint32,+ literalsShowUint64,+ literalsShowBigint,+ literalsShowFloat32,+ literalsShowFloat64,+ literalsShowBigfloat,+ literalsShowBoolean,+ literalsShowString,+ -- Read functions+ literalsReadInt8,+ literalsReadInt16,+ literalsReadInt32,+ literalsReadInt64,+ literalsReadUint8,+ literalsReadUint16,+ literalsReadUint32,+ literalsReadUint64,+ literalsReadBigint,+ literalsReadFloat32,+ literalsReadFloat64,+ literalsReadBigfloat,+ literalsReadBoolean,+ literalsReadString,+ -- Binary conversions+ literalsStringToBinary,+ literalsBinaryToString]
+ src/main/haskell/Hydra/Sources/Test/Lib/Logic.hs view
@@ -0,0 +1,84 @@+module Hydra.Sources.Test.Lib.Logic where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.logic"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.logic primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Test groups for hydra.lib.logic primitives++logicAnd :: TTerm TestGroup+logicAnd = subgroup "and" [+ test "true and true" true true true,+ test "true and false" true false false,+ test "false and true" false true false,+ test "false and false" false false false]+ where+ test name x y result = primCase name _logic_and [x, y] (result)++logicOr :: TTerm TestGroup+logicOr = subgroup "or" [+ test "true or true" true true true,+ test "true or false" true false true,+ test "false or true" false true true,+ test "false or false" false false false]+ where+ test name x y result = primCase name _logic_or [x, y] (result)++logicNot :: TTerm TestGroup+logicNot = subgroup "not" [+ test "not true" true false,+ test "not false" false true]+ where+ test name x result = primCase name _logic_not [x] (result)++logicIfElse :: TTerm TestGroup+logicIfElse = supergroup "ifElse" [+ subgroup "boolean values" [+ testBool "true condition returns then" true true false true,+ testBool "false condition returns else" false true false false],+ subgroup "integer values" [+ testInt "true selects first int" true 42 0 42,+ testInt "false selects second int" false 42 0 0],+ subgroup "string values" [+ testStr "true selects first string" true "yes" "no" "yes",+ testStr "false selects second string" false "yes" "no" "no"]]+ where+ testBool name cond thenVal elseVal result =+ primCase name _logic_ifElse [cond, thenVal, elseVal] (result)+ testInt name cond thenVal elseVal result =+ primCase name _logic_ifElse [cond, int32 thenVal, int32 elseVal] (int32 result)+ testStr name cond thenVal elseVal result =+ primCase name _logic_ifElse [cond, string thenVal, string elseVal] (string result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.logic primitives" $+ supergroup "hydra.lib.logic primitives" [+ logicAnd,+ logicIfElse,+ logicNot,+ logicOr]
+ src/main/haskell/Hydra/Sources/Test/Lib/Maps.hs view
@@ -0,0 +1,256 @@+module Hydra.Sources.Test.Lib.Maps where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+++ns :: Namespace+ns = Namespace "hydra.test.lib.maps"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.maps primitives"+ where+ elements = [Phantoms.toBinding allTests]++emptyStringMap = intStringMap []+intStringMapOrEmpty = intStringMap++---- This is a hack for HSpec. We create a map<string, string>, because that is the map type we default to when there are no elements.+--emptyStringMap :: TTerm Term+--emptyStringMap = primitive _maps_fromList @@ (primitive _lists_drop @@ int32 1 @@ list [pair (string "") (string "")])++-- Helper to create map terms (Int -> String maps)+intStringMap :: [(Int, String)] -> TTerm Term+intStringMap pairs = Core.termMap $ Phantoms.map $ M.fromList $ fmap toPair pairs+ where+ toPair (k, v) = (int32 k, string v)++--intStringMapOrEmpty :: [(Int, String)] -> TTerm Term+--intStringMapOrEmpty pairs = if L.null pairs then emptyStringMap else intStringMap pairs++-- Helper for optional values+optionalString :: Maybe String -> TTerm Term+optionalString Nothing = Core.termMaybe nothing+optionalString (Just s) = Core.termMaybe $ just (Terms.string s)++-- Test groups for hydra.lib.maps primitives++mapsEmpty :: TTerm TestGroup+mapsEmpty = subgroup "empty" [+ test "empty map"]+ where+ test name = primCase name _maps_empty [] emptyStringMap++mapsSingleton :: TTerm TestGroup+mapsSingleton = subgroup "singleton" [+ test "single entry" 42 "hello" [(42, "hello")]]+ where+ test name k v result = primCase name _maps_singleton [int32 k, Terms.string v] (intStringMap result)++mapsFromList :: TTerm TestGroup+mapsFromList = subgroup "fromList" [+ test "create from pairs" [(1, "a"), (2, "b")] [(1, "a"), (2, "b")],+ test "duplicate keys" [(1, "a"), (1, "b")] [(1, "b")],+ test "empty list" [] []]+ where+ test name input expected = primCase name _maps_fromList [+ list $ Prelude.map (\(k, v) -> Core.termPair $ Phantoms.pair (int32 k) (Terms.string v)) input+ ] $ intStringMap expected++mapsToList :: TTerm TestGroup+mapsToList = subgroup "toList" [+ test "convert to pairs" [(1, "a"), (2, "b")] [(1, "a"), (2, "b")],+ test "unsorted keys" [(3, "c"), (1, "a"), (2, "b")] [(1, "a"), (2, "b"), (3, "c")],+ test "empty map" [] []]+ where+ test name input expected = primCase name _maps_toList [intStringMap input] (+ list $ Prelude.map (\(k, v) -> Core.termPair $ Phantoms.pair (int32 k) (Terms.string v)) expected)++mapsInsert :: TTerm TestGroup+mapsInsert = subgroup "insert" [+ test "insert new key" 3 "c" [(1, "a"), (2, "b")] [(1, "a"), (2, "b"), (3, "c")],+ test "update existing" 2 "updated" [(1, "a"), (2, "b")] [(1, "a"), (2, "updated")],+ test "insert into empty" 1 "x" [] [(1, "x")]]+ where+ test name k v m result = primCase name _maps_insert [int32 k, Terms.string v, intStringMap m] (intStringMap result)++mapsRemove :: TTerm TestGroup+mapsRemove = subgroup "remove" [+ test "remove existing" 2 [(1, "a"), (2, "b"), (3, "c")] [(1, "a"), (3, "c")],+ test "remove non-existing" 4 [(1, "a"), (2, "b")] [(1, "a"), (2, "b")],+ test "remove from empty" 1 [] []]+ where+ test name k m result = primCase name _maps_delete [int32 k, intStringMap m] (intStringMap result)++mapsLookup :: TTerm TestGroup+mapsLookup = subgroup "lookup" [+ test "find existing key" 2 [(1, "a"), (2, "b")] (Just "b"),+ test "key not found" 3 [(1, "a"), (2, "b")] Nothing,+ test "lookup in empty" 1 [] Nothing]+ where+ test name k m result = primCase name _maps_lookup [int32 k, intStringMap m] (optionalString result)++mapsMember :: TTerm TestGroup+mapsMember = subgroup "member" [+ test "key exists" 2 [(1, "a"), (2, "b")] true,+ test "key missing" 3 [(1, "a"), (2, "b")] false,+ test "empty map" 1 [] false]+ where+ test name k m result = primCase name _maps_member [int32 k, intStringMap m] result++mapsSize :: TTerm TestGroup+mapsSize = subgroup "size" [+ test "three entries" [(1, "a"), (2, "b"), (3, "c")] 3,+ test "single entry" [(42, "test")] 1,+ test "empty map" [] 0]+ where+ test name m result = primCase name _maps_size [intStringMapOrEmpty m] (int32 result)++mapsNull :: TTerm TestGroup+mapsNull = subgroup "null" [+ test "empty map" [] true,+ test "non-empty map" [(1, "a")] false]+ where+ test name m result = primCase name _maps_null [intStringMapOrEmpty m] result++mapsKeys :: TTerm TestGroup+mapsKeys = subgroup "keys" [+ test "get all keys" [(1, "a"), (2, "b"), (3, "c")] [1, 2, 3],+ test "unsorted keys" [(3, "c"), (1, "a"), (2, "b")] [1, 2, 3],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_keys [intStringMapOrEmpty m] (list $ Prelude.map int32 result)++mapsElems :: TTerm TestGroup+mapsElems = subgroup "elems" [+ test "get all elements" [(1, "a"), (2, "b")] ["a", "b"],+ test "unsorted keys" [(3, "c"), (1, "a"), (2, "b")] ["a", "b", "c"],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_elems [intStringMapOrEmpty m] (list $ Prelude.map Terms.string result)++mapsMap :: TTerm TestGroup+mapsMap = subgroup "map" [+ test "map over values" [(1, "a"), (2, "b")] [(1, "A"), (2, "B")],+ test "map empty" [] []]+ where+ test name m result = primCase name _maps_map [+ lambda "s" (primitive _strings_toUpper @@ var "s"),+ intStringMapOrEmpty m] (intStringMapOrEmpty result)++mapsFindWithDefault :: TTerm TestGroup+mapsFindWithDefault = subgroup "findWithDefault" [+ test "find existing" "default" 2 [(1, "a"), (2, "b")] "b",+ test "use default" "default" 3 [(1, "a"), (2, "b")] "default"]+ where+ test name def k m result = primCase name _maps_findWithDefault [+ Terms.string def, int32 k, intStringMap m] (Terms.string result)++mapsUnion :: TTerm TestGroup+mapsUnion = subgroup "union" [+ test "union two maps" [(1, "a"), (2, "b")] [(2, "x"), (3, "c")] [(1, "a"), (2, "b"), (3, "c")],+ test "union with empty" [(1, "a")] [] [(1, "a")],+ test "empty with map" [] [(1, "a")] [(1, "a")]]+ where+ test name m1 m2 result = primCase name _maps_union [intStringMap m1, intStringMap m2] (intStringMap result)++mapsMapKeys :: TTerm TestGroup+mapsMapKeys = subgroup "mapKeys" [+ test "double keys" [(1, "a"), (2, "b")] [(2, "a"), (4, "b")],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_mapKeys [+ lambda "k" (primitive _math_mul @@ var "k" @@ int32 2),+ intStringMapOrEmpty m] (intStringMapOrEmpty result)++mapsFilter :: TTerm TestGroup+mapsFilter = subgroup "filter" [+ test "filter values starting with a" [(1, "a"), (2, "b"), (3, "ab")] [(1, "a"), (3, "ab")],+ test "filter all" [(1, "b"), (2, "c")] [],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_filter [+ lambda "v" (primitive _equality_equal @@ (primitive _strings_charAt @@ int32 0 @@ var "v") @@ int32 97), -- 'a' = 97+ intStringMapOrEmpty m] (intStringMapOrEmpty result)++mapsFilterWithKey :: TTerm TestGroup+mapsFilterWithKey = subgroup "filterWithKey" [+ test "filter by key > 1" [(1, "a"), (2, "b"), (3, "c")] [(2, "b"), (3, "c")],+ test "filter all" [(1, "a")] [],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_filterWithKey [+ lambda "k" (lambda "v" (primitive _equality_gt @@ var "k" @@ int32 1)),+ intStringMapOrEmpty m] (intStringMapOrEmpty result)++mapsBimap :: TTerm TestGroup+mapsBimap = subgroup "bimap" [+ test "transform both" [(1, "a"), (2, "b")] [(2, "A"), (4, "B")],+ test "empty map" [] []]+ where+ test name m result = primCase name _maps_bimap [+ lambda "k" (primitive _math_mul @@ var "k" @@ int32 2),+ lambda "v" (primitive _strings_toUpper @@ var "v"),+ intStringMapOrEmpty m] (intStringMapOrEmpty result)++mapsAlter :: TTerm TestGroup+mapsAlter = subgroup "alter" [+ test "insert new key" 3 [(1, "a"), (2, "b")] [(1, "a"), (2, "b"), (3, "new")],+ test "update existing key" 2 [(1, "a"), (2, "b")] [(1, "a"), (2, "updated")],+ test "delete key" 2 [(1, "a"), (2, "b")] [(1, "a")]]+ where+ -- The alter function tests use different functions:+ -- insert: always return Just "new"+ test "insert new key" k m result = primCase "insert new key" _maps_alter [+ lambda "opt" (Core.termMaybe $ just (Terms.string "new")),+ int32 k, intStringMap m] (intStringMap result)+ -- update: return Just "updated" if exists+ test "update existing key" k m result = primCase "update existing key" _maps_alter [+ lambda "opt" (Core.termMaybe $ just (Terms.string "updated")),+ int32 k, intStringMap m] (intStringMap result)+ -- delete: always return Nothing+ test "delete key" k m result = primCase "delete key" _maps_alter [+ lambda "opt" (Core.termMaybe nothing),+ int32 k, intStringMap m] (intStringMap result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.maps primitives" $+ supergroup "hydra.lib.maps primitives" [+ mapsAlter,+ mapsBimap,+ mapsElems,+ mapsEmpty,+ mapsFilter,+ mapsFilterWithKey,+ mapsFindWithDefault,+ mapsFromList,+ mapsInsert,+ mapsKeys,+ mapsLookup,+ mapsMap,+ mapsMapKeys,+ mapsMember,+ mapsNull,+ mapsRemove,+ mapsSingleton,+ mapsSize,+ mapsToList,+ mapsUnion]
+ src/main/haskell/Hydra/Sources/Test/Lib/Math.hs view
@@ -0,0 +1,412 @@+module Hydra.Sources.Test.Lib.Math where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.math"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.math primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Test groups for hydra.lib.math primitives++mathAbs :: TTerm TestGroup+mathAbs = subgroup "abs" [+ test "positive" 5 5,+ test "negative" (-5) 5,+ test "zero" 0 0]+ where+ test name x result = primCase name _math_abs [int32 x] (int32 result)++mathAdd :: TTerm TestGroup+mathAdd = subgroup "add" [+ test "positive numbers" 3 5 8,+ test "negative numbers" (-3) (-5) (-8),+ test "mixed sign" 10 (-3) 7,+ test "with zero" 42 0 42]+ where+ test name x y result = primCase name _math_add [int32 x, int32 y] (int32 result)++mathDiv :: TTerm TestGroup+mathDiv = subgroup "div" [+ test "exact division" 10 2 5,+ test "truncates toward negative infinity" 10 3 3,+ test "negative dividend" (-10) 3 (-4),+ test "negative divisor" 10 (-3) (-4)]+ where+ test name x y result = primCase name _math_div [int32 x, int32 y] (int32 result)++mathEven :: TTerm TestGroup+mathEven = subgroup "even" [+ test "even positive" 4 true,+ test "odd positive" 5 false,+ test "even negative" (-4) true,+ test "odd negative" (-5) false,+ test "zero" 0 true]+ where+ test name x result = primCase name _math_even [int32 x] result++mathMax :: TTerm TestGroup+mathMax = subgroup "max" [+ test "first is larger" 10 5 10,+ test "second is larger" 5 10 10,+ test "equal values" 7 7 7,+ test "negative numbers" (-3) (-5) (-3),+ test "mixed sign" (-5) 5 5,+ test "with zero" 0 42 42]+ where+ test name x y result = primCase name _math_max [int32 x, int32 y] (int32 result)++mathMin :: TTerm TestGroup+mathMin = subgroup "min" [+ test "first is smaller" 5 10 5,+ test "second is smaller" 10 5 5,+ test "equal values" 7 7 7,+ test "negative numbers" (-3) (-5) (-5),+ test "mixed sign" (-5) 5 (-5),+ test "with zero" 0 42 0]+ where+ test name x y result = primCase name _math_min [int32 x, int32 y] (int32 result)++mathMod :: TTerm TestGroup+mathMod = subgroup "mod" [+ test "basic modulo" 10 3 1,+ test "exact division" 10 2 0,+ test "negative dividend" (-10) 3 2,+ test "negative divisor" 10 (-3) (-2)]+ where+ test name x y result = primCase name _math_mod [int32 x, int32 y] (int32 result)++mathMul :: TTerm TestGroup+mathMul = subgroup "mul" [+ test "positive numbers" 3 5 15,+ test "negative numbers" (-3) (-5) 15,+ test "mixed sign" 3 (-5) (-15),+ test "with zero" 42 0 0,+ test "with one" 42 1 42]+ where+ test name x y result = primCase name _math_mul [int32 x, int32 y] (int32 result)++mathNegate :: TTerm TestGroup+mathNegate = subgroup "negate" [+ test "positive" 5 (-5),+ test "negative" (-5) 5,+ test "zero" 0 0]+ where+ test name x result = primCase name _math_negate [int32 x] (int32 result)++mathOdd :: TTerm TestGroup+mathOdd = subgroup "odd" [+ test "odd positive" 5 true,+ test "even positive" 4 false,+ test "odd negative" (-5) true,+ test "even negative" (-4) false,+ test "zero" 0 false]+ where+ test name x result = primCase name _math_odd [int32 x] result++mathPred :: TTerm TestGroup+mathPred = subgroup "pred" [+ test "positive" 5 4,+ test "zero" 0 (-1),+ test "negative" (-5) (-6)]+ where+ test name x result = primCase name _math_pred [int32 x] (int32 result)++mathRange :: TTerm TestGroup+mathRange = subgroup "range" [+ test "ascending range" 1 5 [1, 2, 3, 4, 5],+ test "single element" 5 5 [5],+ test "two elements" 3 4 [3, 4],+ test "negative start" (-2) 2 [(-2), (-1), 0, 1, 2]]+ where+ test name start end result = primCase name _math_range [int32 start, int32 end] (list $ int32 <$> result)++mathRem :: TTerm TestGroup+mathRem = subgroup "rem" [+ test "basic remainder" 10 3 1,+ test "exact division" 10 2 0,+ test "negative dividend" (-10) 3 (-1),+ test "negative divisor" 10 (-3) 1]+ where+ test name x y result = primCase name _math_rem [int32 x, int32 y] (int32 result)++mathSignum :: TTerm TestGroup+mathSignum = subgroup "signum" [+ test "positive" 5 1,+ test "negative" (-5) (-1),+ test "zero" 0 0]+ where+ test name x result = primCase name _math_signum [int32 x] (int32 result)++mathSub :: TTerm TestGroup+mathSub = subgroup "sub" [+ test "positive numbers" 10 3 7,+ test "negative numbers" (-10) (-3) (-7),+ test "mixed sign" 10 (-3) 13,+ test "with zero" 42 0 42]+ where+ test name x y result = primCase name _math_sub [int32 x, int32 y] (int32 result)++mathSucc :: TTerm TestGroup+mathSucc = subgroup "succ" [+ test "positive" 5 6,+ test "zero" 0 1,+ test "negative" (-5) (-4)]+ where+ test name x result = primCase name _math_succ [int32 x] (int32 result)++-- Float64 tests++mathE :: TTerm TestGroup+mathE = subgroup "e" [+ test "Euler's number"]+ where+ test name = primCase name _math_e [] (float64 (exp 1))++mathPi :: TTerm TestGroup+mathPi = subgroup "pi" [+ test "pi constant"]+ where+ test name = primCase name _math_pi [] (float64 pi)++mathSin :: TTerm TestGroup+mathSin = subgroup "sin" [+ test "sin 0" 0.0 0.0,+ test "sin pi/2" (pi / 2) 1.0,+ test "sin pi" pi (sin pi)] -- Use actual computed value for precision+ where+ test name x result = primCase name _math_sin [float64 x] (float64 result)++mathCos :: TTerm TestGroup+mathCos = subgroup "cos" [+ test "cos 0" 0.0 1.0,+ test "cos pi/2" (pi / 2) (cos (pi / 2)), -- Use actual computed value for precision+ test "cos pi" pi (-1.0)]+ where+ test name x result = primCase name _math_cos [float64 x] (float64 result)++mathTan :: TTerm TestGroup+mathTan = subgroup "tan" [+ test "tan 0" 0.0 0.0,+ test "tan pi/4" (pi / 4) (tan (pi / 4))] -- Use actual computed value for precision+ where+ test name x result = primCase name _math_tan [float64 x] (float64 result)++mathAsin :: TTerm TestGroup+mathAsin = subgroup "asin" [+ test "asin 0" 0.0 0.0,+ test "asin 1" 1.0 (pi / 2),+ test "asin -1" (-1.0) (-(pi / 2))]+ where+ test name x result = primCase name _math_asin [float64 x] (float64 result)++mathAcos :: TTerm TestGroup+mathAcos = subgroup "acos" [+ test "acos 1" 1.0 0.0,+ test "acos 0" 0.0 (pi / 2),+ test "acos -1" (-1.0) pi]+ where+ test name x result = primCase name _math_acos [float64 x] (float64 result)++mathAtan :: TTerm TestGroup+mathAtan = subgroup "atan" [+ test "atan 0" 0.0 0.0,+ test "atan 1" 1.0 (pi / 4)]+ where+ test name x result = primCase name _math_atan [float64 x] (float64 result)++mathAtan2 :: TTerm TestGroup+mathAtan2 = subgroup "atan2" [+ test "atan2 1 1" 1.0 1.0 (pi / 4),+ test "atan2 1 0" 1.0 0.0 (pi / 2),+ test "atan2 0 1" 0.0 1.0 0.0]+ where+ test name y x result = primCase name _math_atan2 [float64 y, float64 x] (float64 result)++mathSinh :: TTerm TestGroup+mathSinh = subgroup "sinh" [+ test "sinh 0" 0.0 0.0,+ test "sinh 1" 1.0 (sinh 1.0)]+ where+ test name x result = primCase name _math_sinh [float64 x] (float64 result)++mathCosh :: TTerm TestGroup+mathCosh = subgroup "cosh" [+ test "cosh 0" 0.0 1.0,+ test "cosh 1" 1.0 (cosh 1.0)]+ where+ test name x result = primCase name _math_cosh [float64 x] (float64 result)++mathTanh :: TTerm TestGroup+mathTanh = subgroup "tanh" [+ test "tanh 0" 0.0 0.0,+ test "tanh 1" 1.0 (tanh 1.0)]+ where+ test name x result = primCase name _math_tanh [float64 x] (float64 result)++mathAsinh :: TTerm TestGroup+mathAsinh = subgroup "asinh" [+ test "asinh 0" 0.0 0.0,+ test "asinh 1" 1.0 (asinh 1.0)]+ where+ test name x result = primCase name _math_asinh [float64 x] (float64 result)++mathAcosh :: TTerm TestGroup+mathAcosh = subgroup "acosh" [+ test "acosh 1" 1.0 0.0,+ test "acosh 2" 2.0 (acosh 2.0)]+ where+ test name x result = primCase name _math_acosh [float64 x] (float64 result)++mathAtanh :: TTerm TestGroup+mathAtanh = subgroup "atanh" [+ test "atanh 0" 0.0 0.0,+ test "atanh 0.5" 0.5 (atanh 0.5)]+ where+ test name x result = primCase name _math_atanh [float64 x] (float64 result)++mathExp :: TTerm TestGroup+mathExp = subgroup "exp" [+ test "exp 0" 0.0 1.0,+ test "exp 1" 1.0 (exp 1.0),+ test "exp -1" (-1.0) (exp (-1.0))]+ where+ test name x result = primCase name _math_exp [float64 x] (float64 result)++mathLog :: TTerm TestGroup+mathLog = subgroup "log" [+ test "log 1" 1.0 0.0,+ test "log e" (exp 1.0) 1.0]+ where+ test name x result = primCase name _math_log [float64 x] (float64 result)++mathLogBase :: TTerm TestGroup+mathLogBase = subgroup "logBase" [+ test "log10 1" 10.0 1.0 0.0,+ test "log10 10" 10.0 10.0 1.0,+ test "log10 100" 10.0 100.0 2.0,+ test "log2 8" 2.0 8.0 3.0]+ where+ test name base x result = primCase name _math_logBase [float64 base, float64 x] (float64 result)++mathPow :: TTerm TestGroup+mathPow = subgroup "pow" [+ test "2^3" 2.0 3.0 8.0,+ test "10^0" 10.0 0.0 1.0,+ test "2^-1" 2.0 (-1.0) 0.5]+ where+ test name base exp result = primCase name _math_pow [float64 base, float64 exp] (float64 result)++mathSqrt :: TTerm TestGroup+mathSqrt = subgroup "sqrt" [+ test "sqrt 4" 4.0 2.0,+ test "sqrt 9" 9.0 3.0,+ test "sqrt 2" 2.0 (sqrt 2.0),+ test "sqrt 0" 0.0 0.0]+ where+ test name x result = primCase name _math_sqrt [float64 x] (float64 result)++mathCeiling :: TTerm TestGroup+mathCeiling = subgroup "ceiling" [+ test "ceiling 3.2" 3.2 4,+ test "ceiling 3.0" 3.0 3,+ test "ceiling -3.2" (-3.2) (-3),+ test "ceiling -3.0" (-3.0) (-3)]+ where+ test name x result = primCase name _math_ceiling [float64 x] (bigint result)++mathFloor :: TTerm TestGroup+mathFloor = subgroup "floor" [+ test "floor 3.8" 3.8 3,+ test "floor 3.0" 3.0 3,+ test "floor -3.2" (-3.2) (-4),+ test "floor -3.0" (-3.0) (-3)]+ where+ test name x result = primCase name _math_floor [float64 x] (bigint result)++mathRound :: TTerm TestGroup+mathRound = subgroup "round" [+ test "round 3.4" 3.4 3,+ test "round 3.5" 3.5 4,+ test "round 3.6" 3.6 4,+ test "round -3.4" (-3.4) (-3),+ test "round -3.5" (-3.5) (-4)]+ where+ test name x result = primCase name _math_round [float64 x] (bigint result)++mathTruncate :: TTerm TestGroup+mathTruncate = subgroup "truncate" [+ test "truncate 3.8" 3.8 3,+ test "truncate 3.2" 3.2 3,+ test "truncate -3.8" (-3.8) (-3),+ test "truncate -3.2" (-3.2) (-3)]+ where+ test name x result = primCase name _math_truncate [float64 x] (bigint result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.math primitives" $+ supergroup "hydra.lib.math primitives" [+ -- Int32 primitives+ mathAbs,+ mathAdd,+ mathDiv,+ mathEven,+ mathMax,+ mathMin,+ mathMod,+ mathMul,+ mathNegate,+ mathOdd,+ mathPred,+ mathRange,+ mathRem,+ mathSignum,+ mathSub,+ mathSucc,+ -- Float64 primitives+ mathE,+ mathPi,+ mathSin,+ mathCos,+ mathTan,+ mathAsin,+ mathAcos,+ mathAtan,+ mathAtan2,+ mathSinh,+ mathCosh,+ mathTanh,+ mathAsinh,+ mathAcosh,+ mathAtanh,+ mathExp,+ mathLog,+ mathLogBase,+ mathPow,+ mathSqrt,+ mathCeiling,+ mathFloor,+ mathRound,+ mathTruncate]
+ src/main/haskell/Hydra/Sources/Test/Lib/Maybes.hs view
@@ -0,0 +1,188 @@+module Hydra.Sources.Test.Lib.Maybes where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.maybes"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.maybes primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Helper to create Just terms for Int32 values+justInt32 :: Int -> TTerm Term+justInt32 x = Core.termMaybe $ just (int32 x)++-- Helper to create Nothing terms+nothingTerm :: TTerm Term+nothingTerm = Core.termMaybe nothing++-- Test groups for hydra.lib.maybes primitives++maybesIsJust :: TTerm TestGroup+maybesIsJust = subgroup "isJust" [+ test "just value" (justInt32 42) true,+ test "nothing" nothingTerm false]+ where+ test name x result = primCase name _maybes_isJust [x] result++maybesIsNothing :: TTerm TestGroup+maybesIsNothing = subgroup "isNothing" [+ test "just value" (justInt32 42) false,+ test "nothing" nothingTerm true]+ where+ test name x result = primCase name _maybes_isNothing [x] result++maybesFromMaybe :: TTerm TestGroup+maybesFromMaybe = subgroup "fromMaybe" [+ test "just value" 0 (justInt32 42) 42,+ test "nothing with default" 99 nothingTerm 99]+ where+ test name def x result = primCase name _maybes_fromMaybe [int32 def, x] (int32 result)++maybesMaybe :: TTerm TestGroup+maybesMaybe = subgroup "maybe" [+ test "just value applies function" 0 (justInt32 5) 10,+ test "nothing returns default" 99 nothingTerm 99]+ where+ test name def x result = primCase name _maybes_maybe [+ int32 def,+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ x] (int32 result)++maybesPure :: TTerm TestGroup+maybesPure = subgroup "pure" [+ test "wraps integer" (int32 42) (justInt32 42),+ test "wraps string" (string "hello") (Core.termMaybe $ just (string "hello"))]+ where+ test name x expected = primCase name _maybes_pure [x] expected++maybesCat :: TTerm TestGroup+maybesCat = subgroup "cat" [+ test "filters nothings" [justInt32 1, nothingTerm, justInt32 2] [1, 2],+ test "all justs" [justInt32 1, justInt32 2] [1, 2],+ test "all nothings" [nothingTerm, nothingTerm] [],+ test "empty list" [] []]+ where+ test name input expected = primCase name _maybes_cat [+ list input+ ] (list $ fmap int32 expected)++maybesMap :: TTerm TestGroup+maybesMap = subgroup "map" [+ test "maps just value" (justInt32 5) (justInt32 10),+ test "nothing unchanged" nothingTerm nothingTerm]+ where+ test name x expected = primCase name _maybes_map [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ x] expected++maybesApply :: TTerm TestGroup+maybesApply = subgroup "apply" [+ test "both just" (Core.termMaybe $ just (primitive _math_add @@ int32 3)) (justInt32 5) (justInt32 8),+ test "nothing function" nothingTerm (justInt32 5) nothingTerm,+ test "nothing value" (Core.termMaybe $ just (primitive _math_add @@ int32 3)) nothingTerm nothingTerm]+ where+ test name f x expected = primCase name _maybes_apply [f, x] expected++maybesBind :: TTerm TestGroup+maybesBind = subgroup "bind" [+ test "just to just" (justInt32 5) (justInt32 10),+ test "nothing to nothing" nothingTerm nothingTerm]+ where+ test name x expected = primCase name _maybes_bind [+ x,+ lambda "x" (Core.termMaybe $ just (primitive _math_mul @@ var "x" @@ int32 2))] expected++maybesCases :: TTerm TestGroup+maybesCases = subgroup "cases" [+ test "just applies function" (justInt32 5) (int32 0) (int32 10),+ test "nothing returns default" nothingTerm (int32 99) (int32 99)]+ where+ test name opt def expected = primCase name _maybes_cases [+ opt,+ def,+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2)] expected++maybesFromJust :: TTerm TestGroup+maybesFromJust = subgroup "fromJust" [+ test "extract from just" (justInt32 42) (int32 42)]+ where+ test name x expected = primCase name _maybes_fromJust [x] expected++maybesMapMaybe :: TTerm TestGroup+maybesMapMaybe = subgroup "mapMaybe" [+ test "filter and transform" [1, 2, 3, 4, 5] [6, 8, 10], -- x > 2: [3,4,5] doubled = [6,8,10]+ test "empty result" [1, 2] [],+ test "empty input" [] []]+ where+ -- Function that returns Just (x*2) if x > 2, else Nothing+ filterFn = lambda "x" (+ primitive _logic_ifElse+ @@ (primitive _equality_gt @@ var "x" @@ int32 2)+ @@ (Core.termMaybe $ just (primitive _math_mul @@ var "x" @@ int32 2))+ @@ nothingTerm)+ test name xs expected = primCase name _maybes_mapMaybe [+ filterFn,+ list $ Prelude.map int32 xs] (list $ Prelude.map int32 expected)++-- | Test cases for compose: Kleisli composition of two Maybe-returning functions+-- compose f g x = bind (f x) g+maybesCompose :: TTerm TestGroup+maybesCompose = subgroup "compose" [+ test "both succeed" 5 12, -- f(5)=Just 6, g(6)=Just 12+ testFails "first fails" 10, -- f(10)=Nothing (x > 5), so result is Nothing+ testFails "second fails" 3] -- f(3)=Just 4, g(4)=Nothing (y < 5), so result is Nothing+ where+ -- f: x -> if x <= 5 then Just (x + 1) else Nothing+ funF = lambda "x" (+ primitive _logic_ifElse+ @@ (primitive _equality_lte @@ var "x" @@ int32 5)+ @@ (Core.termMaybe $ just (primitive _math_add @@ var "x" @@ int32 1))+ @@ nothingTerm)+ -- g: y -> if y >= 5 then Just (y * 2) else Nothing+ funG = lambda "y" (+ primitive _logic_ifElse+ @@ (primitive _equality_gte @@ var "y" @@ int32 5)+ @@ (Core.termMaybe $ just (primitive _math_mul @@ var "y" @@ int32 2))+ @@ nothingTerm)+ -- compose f g x computes bind (f x) g+ test name input expected = primCase name _maybes_compose [funF, funG, int32 input] (justInt32 expected)+ testFails name input = primCase name _maybes_compose [funF, funG, int32 input] nothingTerm++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.maybes primitives" $+ supergroup "hydra.lib.maybes primitives" [+ maybesApply,+ maybesBind,+ maybesCases,+ maybesCat,+ maybesCompose,+ maybesFromJust,+ maybesFromMaybe,+ maybesIsJust,+ maybesIsNothing,+ maybesMap,+ maybesMapMaybe,+ maybesMaybe,+ maybesPure]
+ src/main/haskell/Hydra/Sources/Test/Lib/Pairs.hs view
@@ -0,0 +1,69 @@+module Hydra.Sources.Test.Lib.Pairs where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.pairs"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.pairs primitives"+ where+ elements = [Phantoms.toBinding allTests]++-- Helper to create pair terms+pairTerm :: Int -> String -> TTerm Term+pairTerm i s = Terms.pair (int32 i) (Terms.string s)++-- Test groups for hydra.lib.pairs primitives++pairsBimap :: TTerm TestGroup+pairsBimap = subgroup "bimap" [+ test "transform both elements" 5 "ab" 10 2,+ test "with zero" 0 "hello" 0 5]+ where+ test name fst snd resultFst resultSnd = primCase name _pairs_bimap [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ lambda "s" (primitive _strings_length @@ var "s"),+ pairTerm fst snd] (Terms.pair (int32 resultFst) (int32 resultSnd))++pairsFirst :: TTerm TestGroup+pairsFirst = subgroup "first" [+ test "extract first element" 42 "hello" 42,+ test "with zero" 0 "world" 0,+ test "negative number" (-5) "test" (-5)]+ where+ test name fst snd result = primCase name _pairs_first [pairTerm fst snd] (int32 result)++pairsSecond :: TTerm TestGroup+pairsSecond = subgroup "second" [+ test "extract second element" 42 "hello" "hello",+ test "empty string" 0 "" "",+ test "long string" 123 "testing" "testing"]+ where+ test name fst snd result = primCase name _pairs_second [pairTerm fst snd] (Terms.string result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.pairs primitives" $+ supergroup "hydra.lib.pairs primitives" [+ pairsBimap,+ pairsFirst,+ pairsSecond]
+ src/main/haskell/Hydra/Sources/Test/Lib/Sets.hs view
@@ -0,0 +1,171 @@+module Hydra.Sources.Test.Lib.Sets where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.lib.sets"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for hydra.lib.sets primitives"+ where+ elements = [Phantoms.toBinding allTests]++emptyStringSet = intSet []+intSetOrEmpty = intSet++-- Helper to create set terms+intSet :: [Int] -> TTerm Term+intSet xs = Core.termSet $ Phantoms.set $ Prelude.map int32 xs++--intSetOrEmpty :: [Int] -> TTerm Term+--intSetOrEmpty xs = if L.null xs+-- then emptyStringSet+-- else intSet xs++-- Test groups for hydra.lib.sets primitives++setsEmpty :: TTerm TestGroup+setsEmpty = subgroup "empty" [+ test "empty set" []]+ where+ test name expected = primCase name _sets_empty [] emptyStringSet++setsSingleton :: TTerm TestGroup+setsSingleton = subgroup "singleton" [+ test "single element" 42 [42]]+ where+ test name x result = primCase name _sets_singleton [int32 x] (intSet result)++setsFromList :: TTerm TestGroup+setsFromList = subgroup "fromList" [+ test "create from list" [1, 2, 3] [1, 2, 3],+ test "duplicates removed" [1, 2, 1, 3] [1, 2, 3],+ test "empty list" [] []]+ where+ test name input expected = primCase name _sets_fromList [list $ Prelude.map int32 input] (intSetOrEmpty expected)++setsToList :: TTerm TestGroup+setsToList = subgroup "toList" [+ test "convert to list" [1, 2, 3] [1, 2, 3],+ test "unsorted input" [3, 1, 2] [1, 2, 3],+ test "empty set" [] []]+ where+ test name input expected = primCase name _sets_toList [intSetOrEmpty input] (list $ Prelude.map int32 expected)++setsInsert :: TTerm TestGroup+setsInsert = subgroup "insert" [+ test "insert new element" 4 [1, 2, 3] [1, 2, 3, 4],+ test "insert existing element" 2 [1, 2, 3] [1, 2, 3],+ test "insert into empty" 1 [] [1]]+ where+ test name x s result = primCase name _sets_insert [int32 x, intSet s] (intSet result)++setsDelete :: TTerm TestGroup+setsDelete = subgroup "delete" [+ test "delete existing" 2 [1, 2, 3] [1, 3],+ test "delete non-existing" 4 [1, 2, 3] [1, 2, 3],+ test "delete from empty" 1 [] []]+ where+ test name x s result = primCase name _sets_delete [int32 x, intSet s] (intSet result)++setsMember :: TTerm TestGroup+setsMember = subgroup "member" [+ test "element exists" 2 [1, 2, 3] true,+ test "element missing" 4 [1, 2, 3] false,+ test "empty set" 1 [] false]+ where+ test name x s result = primCase name _sets_member [int32 x, intSet s] result++setsSize :: TTerm TestGroup+setsSize = subgroup "size" [+ test "three elements" [1, 2, 3] 3,+ test "single element" [42] 1,+ test "empty set" [] 0]+ where+ test name s result = primCase name _sets_size [intSetOrEmpty s] (int32 result)++setsNull :: TTerm TestGroup+setsNull = subgroup "null" [+ test "empty set" [] true,+ test "non-empty set" [1, 2] false]+ where+ test name s result = primCase name _sets_null [intSetOrEmpty s] result++setsUnion :: TTerm TestGroup+setsUnion = subgroup "union" [+ test "union two sets" [1, 2] [2, 3] [1, 2, 3],+ test "union with empty" [1, 2] [] [1, 2],+ test "empty with non-empty" [] [1, 2] [1, 2]]+ where+ test name s1 s2 result = primCase name _sets_union [intSet s1, intSet s2] (intSet result)++setsIntersection :: TTerm TestGroup+setsIntersection = subgroup "intersection" [+ test "common elements" [1, 2, 3] [2, 3, 4] [2, 3],+ test "no common elements" [1, 2] [3, 4] [],+ test "intersection with empty" [1, 2] [] []]+ where+ test name s1 s2 result = primCase name _sets_intersection [intSet s1, intSet s2] (intSet result)++setsDifference :: TTerm TestGroup+setsDifference = subgroup "difference" [+ test "remove elements" [1, 2, 3] [2, 4] [1, 3],+ test "no overlap" [1, 2] [3, 4] [1, 2],+ test "difference with empty" [1, 2] [] [1, 2]]+ where+ test name s1 s2 result = primCase name _sets_difference [intSet s1, intSet s2] (intSet result)++setsUnions :: TTerm TestGroup+setsUnions = subgroup "unions" [+ test "union of multiple sets" [[1, 2], [2, 3], [3, 4]] [1, 2, 3, 4],+ test "union with empty sets" [[1, 2], [], [3]] [1, 2, 3],+ test "empty list of sets" [] [],+ test "single set" [[1, 2, 3]] [1, 2, 3]]+ where+ test name sets result = primCase name _sets_unions [list $ Prelude.map intSet sets] (intSet result)++setsMap :: TTerm TestGroup+setsMap = subgroup "map" [+ test "map function" [1, 2, 3] [2, 4, 6],+ test "map on empty" [] []]+ where+ test name s result = primCase name _sets_map [+ lambda "x" (primitive _math_mul @@ var "x" @@ int32 2),+ intSet s] (intSet result)++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.lib.sets primitives" $+ supergroup "hydra.lib.sets primitives" [+ setsEmpty,+ setsSingleton,+ setsFromList,+ setsToList,+ setsInsert,+ setsDelete,+ setsMember,+ setsSize,+ setsNull,+ setsUnion,+ setsUnions,+ setsIntersection,+ setsDifference,+ setsMap]
src/main/haskell/Hydra/Sources/Test/Lib/Strings.hs view
@@ -1,12 +1,43 @@-module Hydra.Sources.Test.Lib.Strings (stringPrimitiveTests) where+module Hydra.Sources.Test.Lib.Strings where -import Hydra.Dsl.Tests+-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M +-- Additional imports specific to this file+import Hydra.Testing+import Hydra.Sources.Libraries -stringPrimitiveTests :: TestGroup-stringPrimitiveTests = TestGroup "hydra.lib.strings primitives" Nothing groups []++ns :: Namespace+ns = Namespace "hydra.test.lib.strings"++module_ :: Module+module_ = Module ns elements+ [TestGraph.ns]+ kernelTypesNamespaces+ (Just "Test cases for hydra.lib.strings primitives") where- groups = [+ elements = [+ Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for hydra.lib.strings primitives" $+ supergroup "hydra.lib.strings primitives" [ stringsCat, stringsCat2, stringsCharAt,@@ -20,187 +51,220 @@ stringsToLower, stringsToUpper, stringsUnlines]--stringsCat :: TestGroup-stringsCat = TestGroup "cat" Nothing [] [- test "basic concatenation" ["one", "two", "three"] "onetwothree",- test "with empty strings" ["", "one", "", ""] "one",- test "empty list" [] "",- test "single string" ["hello"] "hello",- test "many empty strings" ["", "", "", ""] "",- test "unicode strings" ["ñ", "世", "🌍"] "ñ世🌍",- test "special characters" ["\n", "\t", "\r"] "\n\t\r",- test "numbers as strings" ["1", "2", "3"] "123",- test "spaces" [" ", " ", " "] " ",- test "mixed content" ["Hello", " ", "World", "!"] "Hello World!"]- where- test name ls result = primCase name _strings_cat [list (string <$> ls)] (string result)--stringsCat2 :: TestGroup-stringsCat2 = TestGroup "cat2" Nothing [] [- test "basic concatenation" "hello" "world" "helloworld",- test "empty first string" "" "world" "world",- test "empty second string" "hello" "" "hello",- test "both empty strings" "" "" "",- test "with spaces" "hello " "world" "hello world",- test "unicode characters" "ñ" "世" "ñ世",- test "numeric strings" "123" "456" "123456",- test "special characters" "\n" "\t" "\n\t"]- where- test name s1 s2 result = primCase name _strings_cat2 [string s1, string s2] (string result)--stringsCharAt :: TestGroup-stringsCharAt = TestGroup "charAt" Nothing [] [- test "first character" 0 "hello" 104, -- 'h'- test "middle character" 2 "hello" 108, -- 'l'- test "last character" 4 "hello" 111, -- 'o'- test "single character string" 0 "a" 97, -- 'a'- test "unicode character" 0 "ñ" 241, -- 'ñ'- test "space character" 0 " " 32, -- space- test "newline character" 0 "\n" 10, -- newline- test "tab character" 0 "\t" 9] -- tab- where- test name idx s result = primCase name _strings_charAt [int32 idx, string s] (int32 result)--stringsFromList :: TestGroup-stringsFromList = TestGroup "fromList" Nothing [] [- test "basic ascii string" [104, 101, 108, 108, 111] "hello",- test "empty code point list" [] "",- test "single character" [97] "a",- test "with spaces" [104, 32, 105] "h i",- test "unicode characters" [241, 19990, 127757] "ñ世🌍",- test "numeric characters" [49, 50, 51] "123",- test "special characters" [10, 9, 13] "\n\t\r"]- where- test name codePoints result = primCase name _strings_fromList [list (int32 <$> codePoints)] (string result)--stringsIntercalate :: TestGroup-stringsIntercalate = TestGroup "intercalate" Nothing [] [- test "comma separator" "," ["one", "two", "three"] "one,two,three",- test "space separator" " " ["hello", "world"] "hello world",- test "empty separator" "" ["a", "b", "c"] "abc",- test "multi-character separator" " | " ["A", "B", "C"] "A | B | C",- test "empty string list" "," [] "",- test "single item list" "," ["only"] "only",- test "empty strings in list" "," ["", "a", ""] ",a,",- test "unicode separator" "🔗" ["link1", "link2"] "link1🔗link2"]- where- test name sep strs result = primCase name _strings_intercalate [string sep, list (string <$> strs)] (string result)--stringsLength :: TestGroup-stringsLength = TestGroup "length" Nothing [] [- test "empty string" "" 0,- test "single character" "a" 1,- test "basic word" "one" 3,- test "string with spaces" "hello world" 11,- test "unicode characters" "ñ世🌍" 3,- test "special characters" "\n\t\r" 3,- test "numeric string" "12345" 5,- test "long string" "this is a longer string for testing" 35]- where- test name s result = primCase name _strings_length [string s] (int32 result)--stringsLines :: TestGroup-stringsLines = TestGroup "lines" Nothing [] [- test "single line" "hello world" ["hello world"],- test "two lines" "hello\nworld" ["hello", "world"],- test "three lines" "one\ntwo\nthree" ["one", "two", "three"],- test "empty string" "" [],- test "just newline" "\n" [""],- test "trailing newline" "hello\n" ["hello"],- test "leading newline" "\nhello" ["", "hello"],- test "multiple consecutive newlines" "a\n\nb" ["a", "", "b"]]- where- test name s result = primCase name _strings_lines [string s] (list (string <$> result))--stringsNull :: TestGroup-stringsNull = TestGroup "null" Nothing [] [- test "empty string" "" True,- test "single character" "a" False,- test "space only" " " False,- test "basic word" "hello" False,- test "newline only" "\n" False,- test "tab only" "\t" False]- where- test name s result = primCase name _strings_null [string s] (boolean result)--stringsSplitOn :: TestGroup-stringsSplitOn = TestGroup "splitOn" Nothing [] [- test "double s in Mississippi" "ss" "Mississippi" ["Mi", "i", "ippi"],- test "whole string as separator" "Mississippi" "Mississippi" ["", ""],- test "space separated words" " " "one two three" ["one", "two", "three"],- test "leading and trailing spaces" " " " one two three " ["", "one", "two", "three", ""],- test "multiple consecutive spaces" " " " one two three" ["", "", "one", "two", "three"],- test "double space separator" " " " one two three" ["", "one two three"],- test "overlapping pattern aa in aaa" "aa" "aaa" ["", "a"],- test "separator on empty string" "a" "" [""],- test "empty separator on abc" "" "abc" ["", "a", "b", "c"],- test "both separator and string empty" "" "" [""],- test "separator not found" "x" "hello" ["hello"],- test "separator at start" "h" "hello" ["", "ello"],- test "separator at end" "o" "hello" ["hell", ""],- test "multiple same separators" "l" "hello" ["he", "", "o"],- test "single character string and separator" "a" "a" ["", ""],- test "unicode separator" "世" "hello世world世!" ["hello", "world", "!"],- test "multi-character separator" "ab" "cabbage" ["c", "bage"],- test "newline separator" "\n" "line1\nline2\nline3" ["line1", "line2", "line3"]]- where- test name s0 s1 result = primCase name _strings_splitOn [string s0, string s1] (list (string <$> result))--stringsToList :: TestGroup-stringsToList = TestGroup "toList" Nothing [] [- test "empty string" "" [],- test "single character" "a" [97],- test "basic word" "hello" [104, 101, 108, 108, 111],- test "with space" "h i" [104, 32, 105],- test "unicode characters" "ñ世🌍" [241, 19990, 127757],- test "numeric string" "123" [49, 50, 51],- test "special characters" "\n\t\r" [10, 9, 13]]- where- test name s result = primCase name _strings_toList [string s] (list (int32 <$> result))--stringsToLower :: TestGroup-stringsToLower = TestGroup "toLower" Nothing [] [- test "mixed case sentence" "One TWO threE" "one two three",- test "alphanumeric mixed case" "Abc123" "abc123",- test "all uppercase" "HELLO" "hello",- test "all lowercase" "hello" "hello",- test "empty string" "" "",- test "single uppercase char" "A" "a",- test "single lowercase char" "a" "a",- test "with spaces" "Hello World" "hello world",- test "with punctuation" "Hello, World!" "hello, world!",- test "unicode accented chars" "ÑÁÉÍÓÚ" "ñáéíóú",- test "numbers only" "12345" "12345",- test "special characters only" "\n\t\r" "\n\t\r"]- where- test name s result = primCase name _strings_toLower [string s] (string result)--stringsToUpper :: TestGroup-stringsToUpper = TestGroup "toUpper" Nothing [] [- test "mixed case sentence" "One TWO threE" "ONE TWO THREE",- test "alphanumeric mixed case" "Abc123" "ABC123",- test "all lowercase" "hello" "HELLO",- test "all uppercase" "HELLO" "HELLO",- test "empty string" "" "",- test "single lowercase char" "a" "A",- test "single uppercase char" "A" "A",- test "with spaces" "hello world" "HELLO WORLD",- test "with punctuation" "hello, world!" "HELLO, WORLD!",- test "unicode accented chars" "ñáéíóú" "ÑÁÉÍÓÚ",- test "numbers only" "12345" "12345",- test "special characters only" "\n\t\r" "\n\t\r"]- where- test name s result = primCase name _strings_toUpper [string s] (string result)--stringsUnlines :: TestGroup-stringsUnlines = TestGroup "unlines" Nothing [] [- test "basic two lines" ["hello", "world"] "hello\nworld\n",- test "single line" ["hello"] "hello\n",- test "empty list" [] "",- test "three lines" ["one", "two", "three"] "one\ntwo\nthree\n",- test "with empty lines" ["hello", "", "world"] "hello\n\nworld\n",- test "all empty lines" ["", "", ""] "\n\n\n",- test "unicode content" ["ñoño", "世界"] "ñoño\n世界\n"]- where- test name strs result = primCase name _strings_unlines [list (string <$> strs)] (string result)+ where+ stringsCat = subgroup "cat" [+ -- Basic functionality+ test "basic concatenation" ["one", "two", "three"] "onetwothree",+ test "single string" ["hello"] "hello",+ test "empty list" [] "",+ + -- Empty string handling+ test "with empty strings" ["", "one", "", ""] "one",+ test "all empty strings" ["", "", "", ""] "",+ + -- Unicode correctness+ test "unicode strings" ["\241", "\19990", "\127757"] "\241\19990\127757", -- ñ, 世, 🌍+ test "combining characters" ["e", "\769"] "e\769", -- e + combining acute accent+ + -- Special characters (control characters may be handled specially)+ test "control characters" ["\n", "\t", "\r"] "\n\t\r",+ test "null character" ["hello", "\0", "world"] "hello\0world"]+ where+ test name ls result = primCase name _strings_cat [list (string <$> ls)] (string result)+ + stringsCat2 = subgroup "cat2" [+ test "basic concatenation" "hello" "world" "helloworld",+ test "empty first string" "" "world" "world",+ test "empty second string" "hello" "" "hello",+ test "both empty strings" "" "" "",+ test "unicode characters" "\241" "\19990" "\241\19990", -- ñ, 世+ test "special characters" "\n" "\t" "\n\t",+ test "null characters" "hello\0" "world" "hello\0world"]+ where+ test name s1 s2 result = primCase name _strings_cat2 [string s1, string s2] (string result)+ + stringsCharAt = subgroup "charAt" [+ test "first character" 0 "hello" 104, -- 'h'+ test "middle character" 2 "hello" 108, -- 'l'+ test "last character" 4 "hello" 111, -- 'o'+ test "single character string" 0 "a" 97, -- 'a'+ test "unicode character" 0 "\241" 241, -- ñ+ test "multi-byte unicode" 0 "\19990" 19990, -- 世+ test "second of combining pair" 1 "e\769" 769] -- combining acute accent+ -- TODO: failure cases (need syntax support)+ -- test "negative index" (-1) "hello" <error>+ -- test "index out of bounds" 10 "hello" <error>+ -- test "index on empty string" 0 "" <error>+ where+ test name idx s result = primCase name _strings_charAt [int32 idx, string s] (int32 result)+ + stringsFromList = subgroup "fromList" [+ test "basic ascii string" [104, 101, 108, 108, 111] "hello",+ test "empty code point list" [] "",+ test "single character" [97] "a",+ test "unicode characters" [241, 19990, 127757] "\241\19990\127757", -- ñ, 世, 🌍+ test "combining character sequence" [101, 769] "e\769", -- e + combining acute+ test "special characters" [10, 9, 13] "\n\t\r",+ test "null character" [104, 0, 105] "h\0i"] -- h, null, i+ -- TODO: failure cases (need syntax support)+ -- test "negative code point" [-1] <error>+ -- test "invalid code point" [1114112] <error> -- beyond valid Unicode range+ where+ test name codePoints result = primCase name _strings_fromList [list (int32 <$> codePoints)] (string result)+ + stringsIntercalate = subgroup "intercalate" [+ -- Basic functionality+ test "comma separator" "," ["one", "two", "three"] "one,two,three",+ test "empty separator" "" ["a", "b", "c"] "abc",+ test "multi-character separator" " | " ["A", "B", "C"] "A | B | C",+ + -- Edge cases+ test "empty string list" "," [] "",+ test "single item list" "," ["only"] "only",+ test "empty strings in list" "," ["", "a", ""] ",a,",+ + -- Unicode and special characters+ test "unicode separator" "\127757" ["link1", "link2"] "link1\127757link2", -- 🌍+ test "newline separator" "\n" ["line1", "line2"] "line1\nline2"]+ where+ test name sep strs result = primCase name _strings_intercalate [string sep, list (string <$> strs)] (string result)+ + stringsLength = subgroup "length" [+ test "empty string" "" 0,+ test "single character" "a" 1,+ test "basic word" "hello" 5,+ test "unicode characters" "\241\19990\127757" 3, -- ñ, 世, 🌍 (verifies code point count)+ test "combining character sequence" "e\769" 2, -- e + combining acute (separate code points)+ test "special characters" "\n\t\r" 3]+ where+ test name s result = primCase name _strings_length [string s] (int32 result)+ + stringsLines = subgroup "lines" [+ -- Basic functionality+ test "single line" "hello world" ["hello world"],+ test "two lines" "hello\nworld" ["hello", "world"],+ test "three lines" "one\ntwo\nthree" ["one", "two", "three"],+ + -- Edge cases with newlines+ test "empty string" "" [],+ test "just newline" "\n" [""],+ test "trailing newline" "hello\n" ["hello"],+ test "leading newline" "\nhello" ["", "hello"],+ + -- Consecutive newlines+ test "multiple consecutive newlines" "a\n\nb" ["a", "", "b"],+ + -- Unicode and other whitespace+ test "unicode content" "\241\n\19990" ["\241", "\19990"], -- ñ, 世+ test "tabs not split" "a\tb\nc" ["a\tb", "c"]] -- only \n splits, not \t+ where+ test name s result = primCase name _strings_lines [string s] (list (string <$> result))+ + stringsNull = subgroup "null" [+ test "empty string" "" True,+ test "single character" "a" False,+ test "space" " " False,+ test "unicode space" "\160" False, -- non-breaking space+ test "newline" "\n" False,+ test "null character" "\0" False,+ test "multi-character" "hello" False]+ where+ test name s result = primCase name _strings_null [string s] (boolean result)+ + stringsSplitOn = subgroup "splitOn" [+ -- Basic functionality+ test "basic separator" "ss" "Mississippi" ["Mi", "i", "ippi"],+ test "single char separator" " " "one two three" ["one", "two", "three"],+ test "multi-char separator" " " "a b c" ["a", "b", "c"],+ test "separator not found" "x" "hello" ["hello"],+ + -- Edge cases with separator positions+ test "separator at start" "h" "hello" ["", "ello"],+ test "separator at end" "o" "hello" ["hell", ""],+ test "leading and trailing separator" " " " one two " ["", "one", "two", ""],+ test "whole string as separator" "Mississippi" "Mississippi" ["", ""],+ + -- Consecutive and overlapping separators+ test "consecutive separators" " " "a b" ["a", "", "b"],+ test "multiple occurrences" "l" "hello" ["he", "", "o"],+ test "overlapping pattern" "aa" "aaa" ["", "a"],+ + -- Empty string cases+ test "empty separator" "" "abc" ["", "a", "b", "c"],+ test "separator on empty string" "x" "" [""],+ test "both empty" "" "" [""],+ + -- Single character cases+ test "single char both" "a" "a" ["", ""],+ + -- Unicode+ test "unicode separator" "\19990" "hello\19990world" ["hello", "world"], -- 世+ test "unicode content" "," "\241,\19990,\127757" ["\241", "\19990", "\127757"], -- ñ,世,🌍+ + -- Special characters+ test "newline separator" "\n" "line1\nline2\nline3" ["line1", "line2", "line3"]]+ where+ test name s0 s1 result = primCase name _strings_splitOn [string s0, string s1] (list (string <$> result))+ + stringsToList = subgroup "toList" [+ -- Basic functionality+ test "empty string" "" [],+ test "single character" "a" [97],+ test "basic word" "hello" [104, 101, 108, 108, 111],+ + -- Unicode+ test "unicode characters" "\241\19990\127757" [241, 19990, 127757], -- ñ, 世, 🌍+ test "combining character sequence" "e\769" [101, 769], -- e + combining acute+ + -- Special characters+ test "control characters" "\n\t\r" [10, 9, 13],+ test "null character" "h\0i" [104, 0, 105]]+ where+ test name s result = primCase name _strings_toList [string s] (list (int32 <$> result))+ + stringsToLower = subgroup "toLower" [+ -- Basic functionality+ test "mixed case" "Hello World" "hello world",+ test "all uppercase" "HELLO" "hello",+ test "all lowercase" "hello" "hello",+ test "empty string" "" "",+ + -- Non-letter characters unchanged+ test "with numbers and punctuation" "Abc123, XYZ!" "abc123, xyz!",+ test "control characters" "\n\t\r" "\n\t\r",+ + -- Unicode+ test "unicode accented chars" "\209\193\201\205\211\218" "\241\225\233\237\243\250"] -- ÑÁÉÍÓÚ -> ñáéíóú+ where+ test name s result = primCase name _strings_toLower [string s] (string result)+ + stringsToUpper = subgroup "toUpper" [+ -- Basic functionality+ test "mixed case" "hello World" "HELLO WORLD",+ test "all lowercase" "hello" "HELLO",+ test "all uppercase" "HELLO" "HELLO",+ test "empty string" "" "",+ + -- Non-letter characters unchanged+ test "with numbers and punctuation" "abc123, xyz!" "ABC123, XYZ!",+ test "control characters" "\n\t\r" "\n\t\r",+ + -- Unicode+ test "unicode accented chars" "\241\225\233\237\243\250" "\209\193\201\205\211\218"] -- ñáéíóú -> ÑÁÉÍÓÚ+ where+ test name s result = primCase name _strings_toUpper [string s] (string result)+ + stringsUnlines = subgroup "unlines" [+ -- Basic functionality+ test "multiple lines" ["one", "two", "three"] "one\ntwo\nthree\n",+ test "single line" ["hello"] "hello\n",+ test "empty list" [] "",+ + -- Empty strings in list+ test "with empty lines" ["hello", "", "world"] "hello\n\nworld\n",+ test "all empty lines" ["", "", ""] "\n\n\n",+ + -- Unicode+ test "unicode content" ["\241o\241o", "\19990\30028"] "\241o\241o\n\19990\30028\n"] -- ñoño, 世界+ where+ test name strs result = primCase name _strings_unlines [list (string <$> strs)] (string result)
+ src/main/haskell/Hydra/Sources/Test/Monads.hs view
@@ -0,0 +1,96 @@+-- | Test cases for hydra.monads functions+module Hydra.Sources.Test.Monads where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Compute as Compute+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Terms.Constants as Constants+++ns :: Namespace+ns = Namespace "hydra.test.monads"++module_ :: Module+module_ = Module ns elements [Monads.ns] [] $+ Just "Test cases for hydra.monads functions"+ where+ elements = [Phantoms.toBinding allTests]++testTrace :: TTerm Term+testTrace = traceTerm (list []) (list []) (Terms.map (Phantoms.map M.empty))++-- | Test cases for pure: lifts a value into a successful flow+pureTests :: TTerm TestGroup+pureTests = subgroup "pure" [+ test "integer" (int32 42),+ test "string" (string "hello")]+ where+ test testName val = evalCaseWithTags testName []+ (unFlowTerm @@ (metaref Monads.pure @@ val) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just val) unit testTrace)++-- | Test cases for map: transforms the value inside a flow+mapTests :: TTerm TestGroup+mapTests = subgroup "map" [+ test "map negate" (primitive _math_negate) (int32 5) (int32 (-5)),+ test "map absolute" (primitive _math_abs) (int32 (-3)) (int32 3)]+ where+ test testName fn inVal outVal = evalCase testName+ (unFlowTerm @@ (metaref Monads.map @@ fn @@ (metaref Monads.pure @@ inVal)) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just outVal) unit testTrace)++-- | Test cases for bind: chains flow computations together+bindTests :: TTerm TestGroup+bindTests = subgroup "bind" [+ test "bind add" (primitive _math_add) (int32 10) (int32 5) (int32 15),+ test "bind multiply" (primitive _math_mul) (int32 3) (int32 4) (int32 12)]+ where+ test testName op x y result = evalCase testName+ (unFlowTerm @@ (metaref Monads.bind @@ (metaref Monads.pure @@ x) @@ (lambda "n" (metaref Monads.pure @@ (op @@ var "n" @@ y)))) @@ unit @@ testTrace)+ (flowStateTerm (optional $ just result) unit testTrace)++-- | Build an empty trace with custom messages+traceWithMessages :: [String] -> TTerm Term+traceWithMessages msgs = traceTerm+ (list [])+ (list $ fmap string msgs)+ (Terms.map (Phantoms.map M.empty))++-- | Test cases for error trace ordering+-- Tests that withTrace annotations are properly recorded and errors include the trace context+errorTraceTests :: TTerm TestGroup+errorTraceTests = subgroup "error traces" [+ evalCaseWithTags "Error traces are in the right order" [tag_disabledForPython] -- Causes RecursionError in Python due to term explosion during beta reduction+ -- Input: withTrace "one" $ withTrace "two" $ fail "oops"+ (unFlowTerm+ @@ (metaref Monads.withTrace @@ string "one"+ @@ (metaref Monads.withTrace @@ string "two"+ @@ (metaref Monads.fail @@ string "oops")))+ @@ unit+ @@ testTrace)+ -- Output: FlowState Nothing () (Trace [] ["Error: oops (one > two)"] {})+ (flowStateTerm (optional nothing) unit (traceWithMessages ["Error: oops (one > two)"]))]++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for hydra.monads functions" $+ supergroup "monads" [+ pureTests,+ mapTests,+ bindTests,+ errorTraceTests]
+ src/main/haskell/Hydra/Sources/Test/Ordering.hs view
@@ -0,0 +1,375 @@+-- | Test cases for Ord instance comparisons on complex Hydra types+module Hydra.Sources.Test.Ordering where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.ordering"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for Ord instance comparisons on complex Hydra types"+ where+ elements = [Phantoms.toBinding allTests]++-- Helper for comparison result - exactly matching Equality.hs style+compResult :: String -> TTerm Term+compResult resultField = injectUnit (name "hydra.util.Comparison") resultField++-- Coerce any TTerm to TTerm Term (safe since TTerm is just a newtype wrapper)+toTerm :: TTerm a -> TTerm Term+toTerm (TTerm t) = TTerm t++-- Test comparing two values with _equality_compare (exactly matching Equality.hs style)+compareTest :: String -> TTerm a -> TTerm a -> String -> TTerm TestCaseWithMetadata+compareTest testName x y resultField = primCase testName _equality_compare [toTerm x, toTerm y] (compResult resultField)++-- Test equality with _equality_equal+equalTest :: String -> TTerm a -> TTerm a -> TTerm b -> TTerm TestCaseWithMetadata+equalTest testName x y result = primCase testName _equality_equal [toTerm x, toTerm y] (toTerm result)++-- Test less than with _equality_lt+ltTest :: String -> TTerm a -> TTerm a -> TTerm b -> TTerm TestCaseWithMetadata+ltTest testName x y result = primCase testName _equality_lt [toTerm x, toTerm y] (toTerm result)++-- ============================================================+-- Name comparison tests+-- ============================================================++nameComparisonTests :: TTerm TestGroup+nameComparisonTests = subgroup "Name comparison" [+ -- Compare two names (using nameTerm which creates a Name wrapped term)+ compareTest "name less than (alphabetic)"+ (nameTerm "apple")+ (nameTerm "banana")+ "lessThan",+ compareTest "name equal"+ (nameTerm "hello")+ (nameTerm "hello")+ "equalTo",+ compareTest "name greater than"+ (nameTerm "zebra")+ (nameTerm "apple")+ "greaterThan",+ -- Qualified names+ compareTest "qualified name less than"+ (nameTerm "hydra.core.Term")+ (nameTerm "hydra.core.Type")+ "lessThan",+ compareTest "qualified name equal"+ (nameTerm "hydra.core.Term")+ (nameTerm "hydra.core.Term")+ "equalTo",+ -- Boolean equality+ equalTest "name equality true"+ (nameTerm "foo")+ (nameTerm "foo")+ true,+ equalTest "name equality false"+ (nameTerm "foo")+ (nameTerm "bar")+ false]++-- ============================================================+-- Literal comparison tests+-- ============================================================++literalComparisonTests :: TTerm TestGroup+literalComparisonTests = subgroup "Literal comparison" [+ -- Integer literals+ compareTest "int32 literal less than"+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 10)+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 20)+ "lessThan",+ compareTest "int32 literal equal"+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 42)+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 42)+ "equalTo",+ -- String literals+ compareTest "string literal less than"+ (Core.termLiteral $ Core.literalString $ Phantoms.string "aaa")+ (Core.termLiteral $ Core.literalString $ Phantoms.string "bbb")+ "lessThan",+ -- Boolean literals+ compareTest "boolean false < true"+ (Core.termLiteral $ Core.literalBoolean Phantoms.false)+ (Core.termLiteral $ Core.literalBoolean Phantoms.true)+ "lessThan",+ compareTest "boolean true == true"+ (Core.termLiteral $ Core.literalBoolean Phantoms.true)+ (Core.termLiteral $ Core.literalBoolean Phantoms.true)+ "equalTo"]++-- ============================================================+-- Type comparison tests+-- ============================================================++typeComparisonTests :: TTerm TestGroup+typeComparisonTests = subgroup "Type comparison" [+ -- Primitive types+ compareTest "type int32 vs string"+ T.int32+ T.string+ "lessThan", -- int32 < string lexicographically in the Type union+ compareTest "type equal (int32)"+ T.int32+ T.int32+ "equalTo",+ -- List types+ compareTest "list type comparison by element"+ (T.list T.int32)+ (T.list T.string)+ "lessThan", -- list<int32> < list<string>+ compareTest "list type equal"+ (T.list T.int32)+ (T.list T.int32)+ "equalTo",+ -- Equality tests+ equalTest "type equality true"+ T.int32+ T.int32+ true,+ equalTest "type equality false"+ T.int32+ T.string+ false]++-- ============================================================+-- Term comparison tests+-- ============================================================++termComparisonTests :: TTerm TestGroup+termComparisonTests = subgroup "Term comparison" [+ -- Integer term literals+ compareTest "term int32 42 vs 43"+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 42)+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 43)+ "lessThan",+ compareTest "term int32 equal"+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 42)+ (Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 42)+ "equalTo",+ -- String term literals+ compareTest "term string a vs b"+ (Core.termLiteral $ Core.literalString $ Phantoms.string "a")+ (Core.termLiteral $ Core.literalString $ Phantoms.string "b")+ "lessThan",+ -- List terms+ compareTest "term list [1] vs [2]"+ (Core.termList $ Phantoms.list [Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 1])+ (Core.termList $ Phantoms.list [Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 2])+ "lessThan",+ compareTest "term list equal"+ (Core.termList $ Phantoms.list [Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 1])+ (Core.termList $ Phantoms.list [Core.termLiteral $ Core.literalInteger $ Core.integerValueInt32 $ Phantoms.int32 1])+ "equalTo"]++-- ============================================================+-- Custom record type comparison tests (monomorphic)+-- ============================================================++-- Helper to build a Person record term+personTerm :: String -> String -> Int -> TTerm Term+personTerm firstName lastName age = record TestTypes.testTypePersonName [+ "firstName" >: string firstName,+ "lastName" >: string lastName,+ "age" >: int32 (fromIntegral age)]++-- Helper to build a LatLon record term+latLonTerm :: Float -> Float -> TTerm Term+latLonTerm lat lon = record TestTypes.testTypeLatLonName [+ "lat" >: float32 (realToFrac lat),+ "lon" >: float32 (realToFrac lon)]++recordComparisonTests :: TTerm TestGroup+recordComparisonTests = subgroup "Record comparison (monomorphic)" [+ -- Person records - compared field by field+ compareTest "person less than by firstName"+ (personTerm "Alice" "Smith" 30)+ (personTerm "Bob" "Smith" 30)+ "lessThan",+ compareTest "person less than by lastName"+ (personTerm "Alice" "Jones" 30)+ (personTerm "Alice" "Smith" 30)+ "lessThan",+ compareTest "person less than by age"+ (personTerm "Alice" "Smith" 25)+ (personTerm "Alice" "Smith" 30)+ "lessThan",+ compareTest "person equal"+ (personTerm "Alice" "Smith" 30)+ (personTerm "Alice" "Smith" 30)+ "equalTo",+ -- LatLon records+ compareTest "latLon less than by lat"+ (latLonTerm 10.0 20.0)+ (latLonTerm 15.0 20.0)+ "lessThan",+ compareTest "latLon less than by lon"+ (latLonTerm 10.0 20.0)+ (latLonTerm 10.0 25.0)+ "lessThan",+ compareTest "latLon equal"+ (latLonTerm 10.0 20.0)+ (latLonTerm 10.0 20.0)+ "equalTo",+ -- Equality tests+ equalTest "person equality true"+ (personTerm "Alice" "Smith" 30)+ (personTerm "Alice" "Smith" 30)+ true,+ equalTest "person equality false"+ (personTerm "Alice" "Smith" 30)+ (personTerm "Bob" "Smith" 30)+ false]++-- ============================================================+-- Polymorphic type comparison tests+-- ============================================================++-- Helper to build a LatLonPoly record term with type application+latLonPolyInt32Term :: Int -> Int -> TTerm Term+latLonPolyInt32Term lat lon = tyapp+ (record TestTypes.testTypeLatLonPolyName [+ "lat" >: int32 (fromIntegral lat),+ "lon" >: int32 (fromIntegral lon)])+ T.int32++latLonPolyStringTerm :: String -> String -> TTerm Term+latLonPolyStringTerm lat lon = tyapp+ (record TestTypes.testTypeLatLonPolyName [+ "lat" >: string lat,+ "lon" >: string lon])+ T.string++-- Helper to build a PersonOrSomething union term+personOrSomethingPersonTerm :: String -> String -> Int -> TTerm Term+personOrSomethingPersonTerm firstName lastName age = tyapp+ (inject TestTypes.testTypePersonOrSomethingName "person" (personTerm firstName lastName age))+ (T.list $ Core.typeVariable TestTypes.testTypePersonName)++personOrSomethingOtherListTerm :: [TTerm Term] -> TTerm Term+personOrSomethingOtherListTerm persons = tyapp+ (inject TestTypes.testTypePersonOrSomethingName "other" (list persons))+ (T.list $ Core.typeVariable TestTypes.testTypePersonName)++polymorphicComparisonTests :: TTerm TestGroup+polymorphicComparisonTests = subgroup "Polymorphic type comparison" [+ -- LatLonPoly Int32+ compareTest "LatLonPoly Int32 less than by lat"+ (latLonPolyInt32Term 10 20)+ (latLonPolyInt32Term 15 20)+ "lessThan",+ compareTest "LatLonPoly Int32 less than by lon"+ (latLonPolyInt32Term 10 20)+ (latLonPolyInt32Term 10 25)+ "lessThan",+ compareTest "LatLonPoly Int32 equal"+ (latLonPolyInt32Term 10 20)+ (latLonPolyInt32Term 10 20)+ "equalTo",+ -- LatLonPoly String+ compareTest "LatLonPoly String less than"+ (latLonPolyStringTerm "10N" "20W")+ (latLonPolyStringTerm "15N" "20W")+ "lessThan",+ compareTest "LatLonPoly String equal"+ (latLonPolyStringTerm "10N" "20W")+ (latLonPolyStringTerm "10N" "20W")+ "equalTo",+ -- PersonOrSomething (List Person)+ compareTest "PersonOrSomething person vs person"+ (personOrSomethingPersonTerm "Alice" "Smith" 30)+ (personOrSomethingPersonTerm "Bob" "Smith" 30)+ "lessThan",+ compareTest "PersonOrSomething person equal"+ (personOrSomethingPersonTerm "Alice" "Smith" 30)+ (personOrSomethingPersonTerm "Alice" "Smith" 30)+ "equalTo",+ -- Equality tests+ equalTest "LatLonPoly Int32 equality true"+ (latLonPolyInt32Term 10 20)+ (latLonPolyInt32Term 10 20)+ true,+ equalTest "LatLonPoly Int32 equality false"+ (latLonPolyInt32Term 10 20)+ (latLonPolyInt32Term 10 25)+ false]++-- ============================================================+-- Union type comparison tests+-- ============================================================++-- Helper for Number union (int vs float)+numberIntTerm :: Int -> TTerm Term+numberIntTerm n = inject TestTypes.testTypeNumberName "int" (int32 (fromIntegral n))++numberFloatTerm :: Float -> TTerm Term+numberFloatTerm f = inject TestTypes.testTypeNumberName "float" (float32 (realToFrac f))++unionComparisonTests :: TTerm TestGroup+unionComparisonTests = subgroup "Union comparison" [+ -- Same variant, different values+ compareTest "Number int variant less than"+ (numberIntTerm 10)+ (numberIntTerm 20)+ "lessThan",+ compareTest "Number int variant equal"+ (numberIntTerm 42)+ (numberIntTerm 42)+ "equalTo",+ compareTest "Number float variant less than"+ (numberFloatTerm 1.5)+ (numberFloatTerm 2.5)+ "lessThan",+ -- Different variants (compared by variant name)+ compareTest "Number float vs int (variant name comparison)"+ (numberFloatTerm 100.0)+ (numberIntTerm 1)+ "lessThan", -- "float" < "int" alphabetically+ -- Equality+ equalTest "Number int equality true"+ (numberIntTerm 42)+ (numberIntTerm 42)+ true,+ equalTest "Number int equality false (different value)"+ (numberIntTerm 42)+ (numberIntTerm 43)+ false,+ equalTest "Number equality false (different variant)"+ (numberIntTerm 42)+ (numberFloatTerm 42.0)+ false]++-- ============================================================+-- All tests+-- ============================================================++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for Ord instance comparisons on complex Hydra types" $+ supergroup "ordering" [+ nameComparisonTests,+ literalComparisonTests,+ -- Note: typeComparisonTests and termComparisonTests are excluded because+ -- comparing Type and Term values (meta-level structures) causes issues+ -- with the kernel test generator's schema type inference+ recordComparisonTests,+ polymorphicComparisonTests,+ unionComparisonTests]
+ src/main/haskell/Hydra/Sources/Test/Reduction.hs view
@@ -0,0 +1,330 @@+-- | Test cases for term reduction/evaluation mechanics+module Hydra.Sources.Test.Reduction where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+++ns :: Namespace+ns = Namespace "hydra.test.reduction"++module_ :: Module+module_ = Module ns elements [] [] $+ Just "Test cases for term reduction/evaluation mechanics"+ where+ elements = [Phantoms.toBinding allTests]++-- | Test cases for beta reduction (lambda application)+betaReductionTests :: TTerm TestGroup+betaReductionTests = subgroup "beta reduction" [+ test "identity function applied to literal"+ (lambda "x" (var "x") @@ int32 42)+ (int32 42),+ test "constant function"+ (lambda "x" (int32 1) @@ int32 42)+ (int32 1),+ test "nested application"+ (lambda "x" (lambda "y" (var "x")) @@ int32 1 @@ int32 2)+ (int32 1)]+ where+ test name input output = evalCase name input output++-- | Test cases for monomorphic primitive application+-- Property: Simple applications of a unary primitive function succeed.+-- Property: Simple applications of a binary primitive function succeed.+-- Property: Extra arguments to a primitive function are tolerated (primitive is applied, extra args remain).+monomorphicPrimitiveTests :: TTerm TestGroup+monomorphicPrimitiveTests = subgroup "monomorphic primitives" [+ -- Unary string functions+ test "toUpper on lowercase"+ (primitive _strings_toUpper @@ string "hello")+ (string "HELLO"),+ test "toUpper on mixed case"+ (primitive _strings_toUpper @@ string "Hello World")+ (string "HELLO WORLD"),+ test "toUpper on empty string"+ (primitive _strings_toUpper @@ string "")+ (string ""),+ test "toLower on uppercase"+ (primitive _strings_toLower @@ string "HELLO")+ (string "hello"),+ test "string length"+ (primitive _strings_length @@ string "hello")+ (int32 5),+ test "string length of empty"+ (primitive _strings_length @@ string "")+ (int32 0),+ -- Binary arithmetic functions+ test "add two positive integers"+ (primitive _math_add @@ int32 3 @@ int32 5)+ (int32 8),+ test "add negative and positive"+ (primitive _math_add @@ int32 (-10) @@ int32 3)+ (int32 (-7)),+ test "add with zero"+ (primitive _math_add @@ int32 0 @@ int32 42)+ (int32 42),+ test "subtract integers"+ (primitive _math_sub @@ int32 10 @@ int32 3)+ (int32 7),+ test "multiply integers"+ (primitive _math_mul @@ int32 6 @@ int32 7)+ (int32 42),+ test "multiply by zero"+ (primitive _math_mul @@ int32 100 @@ int32 0)+ (int32 0),+ test "divide integers"+ (primitive _math_div @@ int32 20 @@ int32 4)+ (int32 5),+ test "modulo"+ (primitive _math_mod @@ int32 17 @@ int32 5)+ (int32 2),+ -- Binary string functions+ test "splitOn basic"+ (primitive _strings_splitOn @@ string "," @@ string "a,b,c")+ (list [string "a", string "b", string "c"]),+ test "cat2 strings"+ (primitive _strings_cat2 @@ string "hello" @@ string "world")+ (string "helloworld")]+ -- Note: "extra arguments are tolerated" test removed; it produces non-well-typed output+ where+ test name input output = evalCase name input output++-- | Test cases for polymorphic primitive application+-- Property: Polymorphic primitives work correctly with different element types.+polymorphicPrimitiveTests :: TTerm TestGroup+polymorphicPrimitiveTests = subgroup "polymorphic primitives" [+ -- List length (polymorphic in element type)+ test "length of integer list"+ (primitive _lists_length @@ list [int32 1, int32 2, int32 3])+ (int32 3),+ test "length of string list"+ (primitive _lists_length @@ list [string "a", string "b"])+ (int32 2),+ test "length of empty list"+ (primitive _lists_length @@ list [])+ (int32 0),+ test "length of single element list"+ (primitive _lists_length @@ list [true])+ (int32 1),+ -- List head+ test "head of integer list"+ (primitive _lists_head @@ list [int32 10, int32 20, int32 30])+ (int32 10),+ test "head of string list"+ (primitive _lists_head @@ list [string "first", string "second"])+ (string "first"),+ -- List last+ test "last of integer list"+ (primitive _lists_last @@ list [int32 10, int32 20, int32 30])+ (int32 30),+ -- List concat+ test "concat two integer lists"+ (primitive _lists_concat2 @@ list [int32 1, int32 2] @@ list [int32 3, int32 4])+ (list [int32 1, int32 2, int32 3, int32 4]),+ test "concat with empty list"+ (primitive _lists_concat2 @@ list [] @@ list [int32 1, int32 2])+ (list [int32 1, int32 2]),+ -- List reverse+ test "reverse integer list"+ (primitive _lists_reverse @@ list [int32 1, int32 2, int32 3])+ (list [int32 3, int32 2, int32 1]),+ test "reverse empty list"+ (primitive _lists_reverse @@ list [])+ (list [])]+ where+ test name input output = evalCase name input output++-- | Test cases for nullary primitives (constants)+nullaryPrimitiveTests :: TTerm TestGroup+nullaryPrimitiveTests = subgroup "nullary primitives" [+ test "empty set has size zero"+ (primitive _sets_size @@ primitive _sets_empty)+ (int32 0)]+ where+ test name input output = evalCase name input output++-- | Test cases for literal values+-- Property: Literal terms are fully reduced; evaluating a literal returns the same literal.+-- Property: Literal terms cannot be applied; applying a literal to another term leaves the application unchanged.+literalValueTests :: TTerm TestGroup+literalValueTests = subgroup "literals as values" [+ -- Various literal types reduce to themselves+ test "integer literal is a value"+ (int32 42)+ (int32 42),+ test "negative integer literal"+ (int32 (-17))+ (int32 (-17)),+ test "zero integer literal"+ (int32 0)+ (int32 0),+ test "string literal is a value"+ (string "hello")+ (string "hello"),+ test "empty string literal"+ (string "")+ (string ""),+ test "string with special characters"+ (string "hello\nworld\ttab")+ (string "hello\nworld\ttab"),+ test "boolean true is a value"+ true+ true,+ test "boolean false is a value"+ false+ false,+ test "float literal is a value"+ (float64 3.14)+ (float64 3.14),+ test "negative float literal"+ (float64 (-2.718))+ (float64 (-2.718)),+ test "zero float literal"+ (float64 0.0)+ (float64 0.0)]+ -- Note: "literal applied to literal" tests removed; they produce non-well-typed output+ where+ test name input output = evalCase name input output++-- | Test cases for list reduction+listReductionTests :: TTerm TestGroup+listReductionTests = subgroup "list reduction" [+ test "empty list is a value"+ (list [])+ (list []),+ test "list of literals is a value"+ (list [int32 1, int32 2, int32 3])+ (list [int32 1, int32 2, int32 3]),+ test "list with reducible element"+ (list [lambda "x" (var "x") @@ int32 42])+ (list [int32 42])]+ where+ test name input output = evalCase name input output++-- | Test cases for optional/maybe reduction+optionalReductionTests :: TTerm TestGroup+optionalReductionTests = subgroup "optional reduction" [+ test "nothing is a value"+ (optional nothing)+ (optional nothing),+ test "just literal is a value"+ (optional $ just $ int32 42)+ (optional $ just $ int32 42),+ test "just with reducible content"+ (optional $ just $ lambda "x" (var "x") @@ int32 42)+ (optional $ just $ int32 42)]+ where+ test name input output = evalCase name input output++-- | Test cases for alpha conversion (variable renaming in lambda calculus)+-- Property: Variables are correctly substituted at all levels.+-- Property: Lambdas binding the old variable are opaque to alpha conversion (prevent variable capture).+alphaConversionTests :: TTerm TestGroup+alphaConversionTests = subgroup "alpha conversion" [+ -- Variables are substituted at the top level+ alphaCase "variable at top level"+ (var "x")+ (name "x") (name "y")+ (var "y"),+ -- Variables are substituted within subexpressions+ alphaCase "variable in list"+ (list [int32 42, var "x"])+ (name "x") (name "y")+ (list [int32 42, var "y"]),+ -- Lambdas with unrelated variables are transparent to alpha conversion+ alphaCase "lambda with different variable is transparent"+ (lambda "z" $ list [int32 42, var "x", var "z"])+ (name "x") (name "y")+ (lambda "z" $ list [int32 42, var "y", var "z"]),+ -- Lambdas of the same variable are opaque to alpha conversion (to prevent capture)+ alphaCase "lambda with same variable is opaque"+ (lambda "x" $ list [int32 42, var "x", var "z"])+ (name "x") (name "y")+ (lambda "x" $ list [int32 42, var "x", var "z"]),+ -- Nested lambdas+ alphaCase "nested lambda outer variable"+ (lambda "a" $ lambda "b" $ var "x")+ (name "x") (name "y")+ (lambda "a" $ lambda "b" $ var "y"),+ alphaCase "nested lambda shadows outer"+ (lambda "x" $ lambda "y" $ var "x")+ (name "x") (name "z")+ (lambda "x" $ lambda "y" $ var "x"),+ -- Application+ alphaCase "application with variable"+ (var "f" @@ var "x")+ (name "x") (name "y")+ (var "f" @@ var "y"),+ alphaCase "application with both variables same"+ (var "x" @@ var "x")+ (name "x") (name "y")+ (var "y" @@ var "y")]++-- | Test cases for type-level beta reduction+-- Property: Type applications of forall types are reduced by substitution.+-- Property: Non-application types are unchanged by reduction.+typeReductionTests :: TTerm TestGroup+typeReductionTests = subgroup "type reduction" [+ -- Non-application types are unchanged+ typeRedCase "unit type unchanged"+ T.unit+ T.unit,+ typeRedCase "string type unchanged"+ T.string+ T.string,+ typeRedCase "int32 type unchanged"+ T.int32+ T.int32,+ -- Simple type application: (forall t. t -> t) String = String -> String+ typeRedCase "identity type applied to string"+ (T.forAll "t" (T.function (T.var "t") (T.var "t")) T.@@ T.string)+ (T.function T.string T.string),+ -- Type application with unused variable: (forall x. Int32) Bool = Int32+ typeRedCase "constant type ignores argument"+ (T.forAll "x" T.int32 T.@@ T.boolean)+ T.int32,+ -- Nested forall application+ typeRedCase "nested forall first application"+ (T.forAll "x" (T.forAll "y" (T.function (T.var "x") (T.var "y"))) T.@@ T.int32)+ (T.forAll "y" (T.function T.int32 (T.var "y"))),+ -- Full application of nested forall+ typeRedCase "nested forall both applications"+ (T.forAll "x" (T.forAll "y" (T.function (T.var "x") (T.var "y"))) T.@@ T.int32 T.@@ T.string)+ (T.function T.int32 T.string),+ -- List type application+ typeRedCase "list type applied"+ (T.forAll "a" (T.list (T.var "a")) T.@@ T.int32)+ (T.list T.int32),+ -- Optional type application+ typeRedCase "optional type applied"+ (T.forAll "a" (T.optional (T.var "a")) T.@@ T.string)+ (T.optional T.string)]++allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ Phantoms.doc "Test cases for term reduction mechanics" $+ supergroup "reduction" [+ betaReductionTests,+ monomorphicPrimitiveTests,+ polymorphicPrimitiveTests,+ nullaryPrimitiveTests,+ literalValueTests,+ listReductionTests,+ optionalReductionTests,+ alphaConversionTests,+ typeReductionTests]
+ src/main/haskell/Hydra/Sources/Test/Rewriting.hs view
@@ -0,0 +1,1235 @@++-- | Test cases for term rewriting operations (free variables, simplify, flatten let, lift lambda)+module Hydra.Sources.Test.Rewriting where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Dsl.Meta.Coders as Coders+import qualified Data.Set as S++-- NOTE: This file previously used T for Terms and Ty for Types.+-- After standardization: Terms are unqualified, T is for Types.+++ns :: Namespace+ns = Namespace "hydra.test.rewriting"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for term rewriting operations")+ where+ elements = [Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- | Test cases for rewriteAndFoldTermWithPath+-- These tests verify that the path-tracking rewrite function correctly tracks accessor paths+-- and properly folds values while rewriting terms+rewriteAndFoldTermWithPathGroup :: TTerm TestGroup+rewriteAndFoldTermWithPathGroup = subgroup "rewriteAndFoldTermWithPath" [+ -- The function is used by hoistSubtermsIntoLet, so we test that behavior+ -- Note: These test the path-tracking through the fold accumulator behavior++ -- Simple terms - no path-dependent rewriting needed+ foldOverTermCase "path tracking through application - sum literals"+ (apply (lambda "x" (var "x")) (int32 42))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 42),++ foldOverTermCase "path tracking through nested applications"+ (apply (apply (lambda "x" (lambda "y" (list [var "x", var "y"]))) (int32 1)) (int32 2))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 3),++ foldOverTermCase "path tracking through let bindings"+ (lets [(nm "x", int32 10)] (list [var "x", int32 32]))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 42),++ foldOverTermCase "path tracking through record fields"+ (record (nm "Point") [(nm "x", int32 10), (nm "y", int32 20)])+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 30),++ foldOverTermCase "path tracking through case branches"+ (match (nm "Result") nothing [(nm "ok", int32 1), (nm "err", int32 2)])+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 3),++ foldOverTermCase "path tracking through pair"+ (pair (int32 5) (int32 7))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 12),++ foldOverTermCase "path tracking through optional"+ (optional (just (int32 42)))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 42),++ foldOverTermCase "path tracking through wrapped term"+ (wrap (nm "Age") (int32 25))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 25),++ foldOverTermCase "path tracking through type lambda"+ (tylam "a" (int32 100))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 100),++ foldOverTermCase "path tracking through type application"+ (tyapp (int32 50) T.string)+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 50),++ foldOverTermCase "path tracking through set elements"+ (set [int32 1, int32 2, int32 3])+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 6),++ foldOverTermCase "deep nesting - application in lambda in let"+ (lets [(nm "f", lambda "x" (apply (var "x") (int32 5)))] (int32 10))+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 15),++ -- Collect list lengths tests verify proper path traversal+ foldOverTermCase "collect list lengths in nested structure"+ (list [list [int32 1, int32 2], list [int32 3]])+ Coders.traversalOrderPre+ foldOpCollectListLengths+ (list [int32 2, int32 2, int32 1]),++ foldOverTermCase "collect list lengths in let body"+ (lets [(nm "xs", list [int32 1])] (list [int32 2, int32 3]))+ Coders.traversalOrderPre+ foldOpCollectListLengths+ (list [int32 2, int32 1])]++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for term rewriting operations" $+ supergroup "rewriting" [+ freeVariablesGroup,+ simplifyTermGroup,+ flattenLetTermsGroup,+ liftLambdaAboveLetGroup,+ deannotateTermGroup,+ deannotateTypeGroup,+ topologicalSortBindingsGroup,+ normalizeTypeVariablesGroup,+ etaExpandTermGroup,+ foldOverTermGroup,+ rewriteTypeGroup,+ rewriteTermGroup,+ rewriteAndFoldTermWithPathGroup,+ unshadowVariablesGroup]++-- Helper to build names+nm :: String -> TTerm Name+nm s = Core.name $ Phantoms.string s++-- Helper to build a set of Names+nameSet :: [String] -> TTerm (S.Set Name)+nameSet names = Phantoms.set $ (nm <$> names)++-- Helper for single-binding let+letExpr :: String -> TTerm Term -> TTerm Term -> TTerm Term+letExpr varName value body = lets [(nm varName, value)] body++-- Helper for multi-binding let+multiLet :: [(String, TTerm Term)] -> TTerm Term -> TTerm Term+multiLet bindings body = lets ((\(n, v) -> (nm n, v)) <$> bindings) body++-- | Test cases for free variables computation+freeVariablesGroup :: TTerm TestGroup+freeVariablesGroup = subgroup "freeVariables" [+ freeVarsCase "string literal has no free variables"+ (string "foo")+ (nameSet []),++ freeVarsCase "single variable"+ (var "x")+ (nameSet ["x"]),++ freeVarsCase "bound variable is not free"+ (lambda "y" (var "y"))+ (nameSet []),++ freeVarsCase "unbound variable in lambda body"+ (lambda "y" (var "x"))+ (nameSet ["x"]),++ freeVarsCase "mixed free and bound variables"+ (list [+ var "x",+ apply (lambda "y" (var "y")) (int32 42)])+ (nameSet ["x"]),++ freeVarsCase "multiple free variables"+ (list [+ var "x",+ apply (lambda "y" (var "y")) (var "y")])+ (nameSet ["x", "y"])]++-- | Test cases for term simplification (beta reduction)+simplifyTermGroup :: TTerm TestGroup+simplifyTermGroup = subgroup "simplifyTerm" [+ simplifyCase "const application with literal"+ (apply (lambda "x" (string "foo")) (int32 42))+ (string "foo"),++ simplifyCase "identity application"+ (apply+ (lambda "x" (list [var "x", var "x"]))+ (var "y"))+ (list [var "y", var "y"]),++ simplifyCase "unused parameter"+ (apply (lambda "x" (string "foo")) (var "y"))+ (string "foo"),++ simplifyCase "nested lambda applications"+ (apply+ (lambda "x"+ (apply+ (lambda "a" (list [string "foo", var "a"]))+ (var "x")))+ (var "y"))+ (list [string "foo", var "y"])]++-- | Test cases for flattening nested let terms+flattenLetTermsGroup :: TTerm TestGroup+flattenLetTermsGroup = subgroup "flattenLetTerms" [+ flattenCase "non-let term unchanged"+ (int32 42)+ (int32 42),++ flattenCase "list term unchanged"+ (list [string "foo"])+ (list [string "foo"]),++ flattenCase "sequential lets in body are flattened"+ -- let x = 1 in (let y = 2 in [x, y]) becomes let x = 1, y = 2 in [x, y]+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (list [var "x", var "y"])))+ (multiLet [("x", int32 1), ("y", int32 2)]+ (list [var "x", var "y"])),++ -- Nested bindings are flattened with prefix renaming+ -- Dependencies come BEFORE bindings that use them (important for hoisting)+ flattenCase "nested binding in let value is flattened"+ -- let a = 1; b = (let x = 1; y = 2 in [x, y]) in [a, b]+ (multiLet [+ ("a", int32 1),+ ("b", multiLet [("x", int32 1), ("y", int32 2)]+ (list [var "x", var "y"]))]+ (list [var "a", var "b"]))+ -- let a = 1; b_x = 1; b_y = 2; b = [b_x, b_y] in [a, b]+ -- Note: dependencies (b_x, b_y) come before b+ (multiLet [+ ("a", int32 1),+ ("b_x", int32 1),+ ("b_y", int32 2),+ ("b", list [var "b_x", var "b_y"])]+ (list [var "a", var "b"])),++ -- Multiple levels of nesting+ -- Dependencies come BEFORE bindings that use them (important for hoisting)+ flattenCase "multiple levels of nesting are flattened"+ -- let a = 1; b = (let x = 1; y = (let p = 137; q = [x, 5] in [a, q]) in [x, y]) in [a, b]+ (multiLet [+ ("a", int32 1),+ ("b", multiLet [+ ("x", int32 1),+ ("y", multiLet [+ ("p", int32 137),+ ("q", list [var "x", int32 5])]+ (list [var "a", var "q"]))]+ (list [var "x", var "y"]))]+ (list [var "a", var "b"]))+ -- Flattened with proper prefixes+ -- Order: a, then b's deps (b_x, b_y's deps (b_y_p, b_y_q), b_y), then b+ (multiLet [+ ("a", int32 1),+ ("b_x", int32 1),+ ("b_y_p", int32 137),+ ("b_y_q", list [var "b_x", int32 5]),+ ("b_y", list [var "a", var "b_y_q"]),+ ("b", list [var "b_x", var "b_y"])]+ (list [var "a", var "b"]))]++-- | Test cases for lifting lambda above let+liftLambdaAboveLetGroup :: TTerm TestGroup+liftLambdaAboveLetGroup = subgroup "liftLambdaAboveLet" [+ liftLambdaCase "simple let with lambda in body"+ (letExpr "x" (int32 42)+ (lambda "y" (var "x")))+ (lambda "y"+ (letExpr "x" (int32 42)+ (var "x"))),++ liftLambdaCase "bare lambda unchanged"+ (lambda "x" (var "x"))+ (lambda "x" (var "x")),++ liftLambdaCase "bare let unchanged"+ (letExpr "x" (int32 42) (var "x"))+ (letExpr "x" (int32 42) (var "x")),++ liftLambdaCase "lambda with let in body unchanged"+ (lambda "y" (letExpr "x" (int32 42) (var "x")))+ (lambda "y" (letExpr "x" (int32 42) (var "x"))),++ liftLambdaCase "let with two nested lambdas"+ (letExpr "x" (int32 42)+ (lambda "y" (lambda "z" (var "x"))))+ (lambda "y"+ (lambda "z"+ (letExpr "x" (int32 42) (var "x")))),++ liftLambdaCase "lambda inside let body already above let"+ (lambda "x"+ (lambda "y"+ (letExpr "z" (int32 42) (var "z"))))+ (lambda "x"+ (lambda "y"+ (letExpr "z" (int32 42) (var "z")))),++ -- Multiple bindings and nested lets+ liftLambdaCase "let without lambda in body unchanged"+ (multiLet [("x", int32 42), ("y", string "hello")]+ (pair (var "x") (var "y")))+ (multiLet [("x", int32 42), ("y", string "hello")]+ (pair (var "x") (var "y"))),++ liftLambdaCase "multiple let bindings with lambda"+ (multiLet [("x", int32 42), ("y", string "hello")]+ (lambda "z" (var "x")))+ (lambda "z"+ (multiLet [("x", int32 42), ("y", string "hello")]+ (var "x"))),++ liftLambdaCase "nested lets with lambda at innermost level"+ (letExpr "x" (int32 42)+ (letExpr "y" (string "hello")+ (lambda "z" (var "x"))))+ (lambda "z"+ (letExpr "x" (int32 42)+ (letExpr "y" (string "hello")+ (var "x")))),++ liftLambdaCase "lambda between two lets"+ (letExpr "x" (int32 42)+ (lambda "y"+ (letExpr "z" (string "hello")+ (var "x"))))+ (lambda "y"+ (letExpr "x" (int32 42)+ (letExpr "z" (string "hello")+ (var "x")))),++ liftLambdaCase "multiple lambdas between nested lets"+ (letExpr "a" (int32 1)+ (lambda "x"+ (lambda "y"+ (letExpr "b" (int32 2)+ (var "a")))))+ (lambda "x"+ (lambda "y"+ (letExpr "a" (int32 1)+ (letExpr "b" (int32 2)+ (var "a"))))),++ liftLambdaCase "multiple lambdas already above let"+ (lambda "x"+ (lambda "y"+ (letExpr "z" (int32 42)+ (var "z"))))+ (lambda "x"+ (lambda "y"+ (letExpr "z" (int32 42)+ (var "z")))),++ -- Annotation cases+ liftLambdaCase "annotation above let containing lambda"+ (annot emptyAnnMap+ (letExpr "x" (int32 42) (lambda "y" (var "x"))))+ (annot emptyAnnMap+ (lambda "y" (letExpr "x" (int32 42) (var "x")))),++ liftLambdaCase "annotation above lambda in let body"+ (letExpr "x" (int32 42)+ (annot emptyAnnMap (lambda "y" (var "x"))))+ (lambda "y"+ (annot emptyAnnMap (letExpr "x" (int32 42) (var "x")))),++ liftLambdaCase "annotation between two lambdas"+ (letExpr "x" (int32 42)+ (lambda "y"+ (annot emptyAnnMap (lambda "z" (var "x")))))+ (lambda "y"+ (lambda "z"+ (annot emptyAnnMap (letExpr "x" (int32 42) (var "x"))))),++ liftLambdaCase "annotation on the body of lambda in let"+ (letExpr "x" (int32 42)+ (lambda "y"+ (annot emptyAnnMap (var "x"))))+ (lambda "y"+ (letExpr "x" (int32 42)+ (annot emptyAnnMap (var "x")))),++ liftLambdaCase "annotation on lambda already above let"+ (annot emptyAnnMap+ (lambda "y" (letExpr "x" (int32 42) (var "x"))))+ (annot emptyAnnMap+ (lambda "y" (letExpr "x" (int32 42) (var "x")))),++ -- Recursive lifting in nested structures+ liftLambdaCase "let-lambda inside a list"+ (list [+ int32 1,+ letExpr "x" (int32 42) (lambda "y" (var "x")),+ int32 2])+ (list [+ int32 1,+ lambda "y" (letExpr "x" (int32 42) (var "x")),+ int32 2]),++ liftLambdaCase "let-lambda in multiple list elements"+ (list [+ letExpr "x" (int32 1) (lambda "y" (var "x")),+ letExpr "z" (int32 2) (lambda "w" (var "z"))])+ (list [+ lambda "y" (letExpr "x" (int32 1) (var "x")),+ lambda "w" (letExpr "z" (int32 2) (var "z"))]),++ liftLambdaCase "let-lambda in a let binding value"+ (letExpr "f" (letExpr "x" (int32 42) (lambda "y" (var "x")))+ (var "f"))+ (letExpr "f" (lambda "y" (letExpr "x" (int32 42) (var "x")))+ (var "f")),++ liftLambdaCase "let-lambda inside a pair"+ (pair+ (letExpr "x" (int32 42) (lambda "y" (var "x")))+ (string "test"))+ (pair+ (lambda "y" (letExpr "x" (int32 42) (var "x")))+ (string "test")),++ liftLambdaCase "let-lambda in both elements of a pair"+ (pair+ (letExpr "x" (int32 1) (lambda "y" (var "x")))+ (letExpr "z" (int32 2) (lambda "w" (var "z"))))+ (pair+ (lambda "y" (letExpr "x" (int32 1) (var "x")))+ (lambda "w" (letExpr "z" (int32 2) (var "z")))),++ liftLambdaCase "let-lambda inside lambda body"+ (lambda "outer"+ (letExpr "x" (int32 42) (lambda "inner" (var "x"))))+ (lambda "outer"+ (lambda "inner" (letExpr "x" (int32 42) (var "x"))))]++-- Helper to build an empty annotation map+emptyAnnMap :: TTerm (M.Map Name Term)+emptyAnnMap = Phantoms.map M.empty++-- | Test cases for deannotating terms (stripping top-level annotations)+-- Note: deannotateTerm only strips annotations at the top level, not recursively+deannotateTermGroup :: TTerm TestGroup+deannotateTermGroup = subgroup "deannotateTerm" [+ deannotateTermCase "unannotated literal unchanged"+ (int32 42)+ (int32 42),++ deannotateTermCase "unannotated variable unchanged"+ (var "x")+ (var "x"),++ deannotateTermCase "unannotated lambda unchanged"+ (lambda "x" (var "x"))+ (lambda "x" (var "x")),++ deannotateTermCase "single annotation stripped"+ (annot emptyAnnMap (int32 42))+ (int32 42),++ deannotateTermCase "nested annotations stripped"+ (annot emptyAnnMap (annot emptyAnnMap (int32 42)))+ (int32 42),++ deannotateTermCase "annotated lambda stripped"+ (annot emptyAnnMap (lambda "x" (var "x")))+ (lambda "x" (var "x")),++ deannotateTermCase "annotated application stripped"+ (annot emptyAnnMap (apply (var "f") (var "x")))+ (apply (var "f") (var "x"))]++-- | Test cases for deannotating types (stripping top-level annotations)+-- Note: deannotateType only strips annotations at the top level, not recursively+deannotateTypeGroup :: TTerm TestGroup+deannotateTypeGroup = subgroup "deannotateType" [+ deannotateTypeCase "unannotated primitive type unchanged"+ T.int32+ T.int32,++ deannotateTypeCase "unannotated string type unchanged"+ T.string+ T.string,++ deannotateTypeCase "unannotated function type unchanged"+ (T.function T.int32 T.string)+ (T.function T.int32 T.string),++ deannotateTypeCase "single annotation stripped"+ (T.annot emptyAnnMap T.int32)+ T.int32,++ deannotateTypeCase "nested annotations stripped"+ (T.annot emptyAnnMap (T.annot emptyAnnMap T.string))+ T.string,++ deannotateTypeCase "annotated list type stripped"+ (T.annot emptyAnnMap (T.list T.int32))+ (T.list T.int32),++ deannotateTypeCase "annotated function type stripped"+ (T.annot emptyAnnMap (T.function T.int32 T.string))+ (T.function T.int32 T.string)]++-- | Test cases for topological sort of bindings+-- The function topologicalSortBindingMap takes a map of (name -> term) bindings+-- and returns groups of bindings in topological order, where each group contains+-- mutually recursive bindings (strongly connected components).+topologicalSortBindingsGroup :: TTerm TestGroup+topologicalSortBindingsGroup = subgroup "topologicalSortBindings" [+ sortBindingsCase "isolated bindings"+ (Phantoms.list [+ Phantoms.pair (nm "a") (string "foo"),+ Phantoms.pair (nm "b") (string "bar")])+ (Phantoms.list [+ Phantoms.list [Phantoms.pair (nm "a") (string "foo")],+ Phantoms.list [Phantoms.pair (nm "b") (string "bar")]]),++ sortBindingsCase "single recursive binding"+ (Phantoms.list [+ Phantoms.pair (nm "a") (list [var "a"])])+ (Phantoms.list [+ Phantoms.list [Phantoms.pair (nm "a") (list [var "a"])]]),++ sortBindingsCase "mutually recursive bindings"+ (Phantoms.list [+ Phantoms.pair (nm "a") (list [var "b"]),+ Phantoms.pair (nm "b") (list [var "a"])])+ (Phantoms.list [+ Phantoms.list [+ Phantoms.pair (nm "a") (list [var "b"]),+ Phantoms.pair (nm "b") (list [var "a"])]]),++ sortBindingsCase "mixed bindings"+ (Phantoms.list [+ Phantoms.pair (nm "a") (var "b"),+ Phantoms.pair (nm "b") (list [var "a", var "c"]),+ Phantoms.pair (nm "c") (string "foo"),+ Phantoms.pair (nm "d") (string "bar")])+ (Phantoms.list [+ Phantoms.list [Phantoms.pair (nm "c") (string "foo")],+ Phantoms.list [+ Phantoms.pair (nm "a") (var "b"),+ Phantoms.pair (nm "b") (list [var "a", var "c"])],+ Phantoms.list [Phantoms.pair (nm "d") (string "bar")]])]++-- | Test cases for normalizing type variables in terms+-- The function normalizeTypeVariablesInTerm renames type variables to a canonical form (t0, t1, t2, etc.)+normalizeTypeVariablesGroup :: TTerm TestGroup+normalizeTypeVariablesGroup = subgroup "normalizeTypeVariables" [+ -- No type variables - terms should remain unchanged+ normalizeTypeVarsCase "literal without type variables unchanged"+ (int32 42)+ (int32 42),++ normalizeTypeVarsCase "simple let without type annotations unchanged"+ (letExpr "foo" (string "foo") (int32 42))+ (letExpr "foo" (string "foo") (int32 42)),++ normalizeTypeVarsCase "let with monomorphic type scheme unchanged"+ (letsTyped [("foo", string "foo", T.mono T.string)] (int32 42))+ (letsTyped [("foo", string "foo", T.mono T.string)] (int32 42)),++ normalizeTypeVarsCase "let with monomorphic binding referencing string"+ (letsTyped [("foo", string "foo", T.mono T.string)] (int32 42))+ (letsTyped [("foo", string "foo", T.mono T.string)] (int32 42)),++ -- Only free type variables - no normalization needed+ normalizeTypeVarsCase "polymorphic binding with free type variable unchanged"+ (letsTyped [("foo", var "bar", T.mono (T.var "a"))] (int32 42))+ (letsTyped [("foo", var "bar", T.mono (T.var "a"))] (int32 42)),++ normalizeTypeVarsCase "monomorphic binding with typed lambda unchanged"+ (letsTyped [("foo", string "foo", T.mono T.string)]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42)))+ (letsTyped [("foo", string "foo", T.mono T.string)]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42))),++ normalizeTypeVarsCase "polymorphic binding with typed lambda in body unchanged"+ (letsTyped [("foo", var "bar", T.mono (T.var "a"))]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42)))+ (letsTyped [("foo", var "bar", T.mono (T.var "a"))]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42))),++ -- Polymorphic let bindings should have type variables normalized+ normalizeTypeVarsCase "polymorphic identity function normalized"+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42)))+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (apply (var "id") (int32 42))),++ normalizeTypeVarsCase "polymorphic const function normalized"+ (letsTyped [("const", lambda "x" (lambda "y" (var "x")),+ T.poly ["a", "b"] (T.function (T.var "a") (T.function (T.var "b") (T.var "a"))))]+ (apply (apply (var "const") (int32 42)) (string "foo")))+ (letsTyped [("const", lambda "x" (lambda "y" (var "x")),+ T.poly ["t0", "t1"] (T.function (T.var "t0") (T.function (T.var "t1") (T.var "t0"))))]+ (apply (apply (var "const") (int32 42)) (string "foo"))),++ -- Rewriting of bindings does not affect body (free variable in body coincides with bound variable in binding)+ normalizeTypeVarsCase "binding rewriting does not affect body with typed lambda"+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42)))+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (lambdaTyped "x" (T.function (T.var "a") T.int32) (int32 42))),++ -- Nested polymorphic let bindings - each type scheme is normalized independently+ normalizeTypeVarsCase "nested polymorphic lets normalized"+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (letsTyped [("id2", lambda "y" (var "y"),+ T.poly ["b"] (T.function (T.var "b") (T.var "b")))]+ (apply (var "id") (apply (var "id2") (int32 42)))))+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (letsTyped [("id2", lambda "y" (var "y"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (apply (var "id") (apply (var "id2") (int32 42))))),++ normalizeTypeVarsCase "nested same substitution in bindings and environment"+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (letsTyped [("id2", lambda "x" (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42))))+ (letsTyped [("id", lambda "x" (var "x"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (letsTyped [("id2", lambda "x" (var "x"),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (apply (var "id") (int32 42)))),++ -- Parent variable shadows child variable in nested lets with typed lambdas+ normalizeTypeVarsCase "parent type variable shadows child variable"+ (letsTyped [("id",+ letsTyped [("id2",+ lambdaTyped "x" (T.var "a") (var "x"),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (lambdaTyped "y" (T.var "a") (apply (var "id2") (var "y"))),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42)))+ (letsTyped [("id",+ letsTyped [("id2",+ lambdaTyped "x" (T.var "t1") (var "x"),+ T.poly ["t1"] (T.function (T.var "t1") (T.var "t1")))]+ (lambdaTyped "y" (T.var "t0") (apply (var "id2") (var "y"))),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (apply (var "id") (int32 42))),++ -- No shadowing: distinct type variable names in nested lets+ normalizeTypeVarsCase "no shadowing distinct type variables"+ (letsTyped [("id",+ letsTyped [("id2",+ lambdaTyped "x" (T.var "b") (var "x"),+ T.poly ["b"] (T.function (T.var "b") (T.var "b")))]+ (lambdaTyped "y" (T.var "a") (apply (var "id2") (var "y"))),+ T.poly ["a"] (T.function (T.var "a") (T.var "a")))]+ (apply (var "id") (int32 42)))+ (letsTyped [("id",+ letsTyped [("id2",+ lambdaTyped "x" (T.var "t1") (var "x"),+ T.poly ["t1"] (T.function (T.var "t1") (T.var "t1")))]+ (lambdaTyped "y" (T.var "t0") (apply (var "id2") (var "y"))),+ T.poly ["t0"] (T.function (T.var "t0") (T.var "t0")))]+ (apply (var "id") (int32 42))),++ -- Complex: locally free type variable in nested binding+ normalizeTypeVarsCase "locally free type variable in nested binding"+ (letsTyped [("fun1",+ lambdaTyped "x" (T.var "a") (lambdaTyped "y" (T.var "b")+ (letsTyped [("fun2",+ lambdaTyped "z" (T.var "c") (pair (var "z") (var "y")),+ T.poly ["c"] (T.function (T.var "c") (T.pair (T.var "c") (T.var "b"))))]+ (apply (var "fun2") (var "x")))),+ T.poly ["a", "b"] (T.function (T.var "a") (T.function (T.var "b") (T.pair (T.var "a") (T.var "b")))))]+ (apply (apply (var "fun1") (string "foo")) (int32 42)))+ (letsTyped [("fun1",+ lambdaTyped "x" (T.var "t0") (lambdaTyped "y" (T.var "t1")+ (letsTyped [("fun2",+ lambdaTyped "z" (T.var "t2") (pair (var "z") (var "y")),+ T.poly ["t2"] (T.function (T.var "t2") (T.pair (T.var "t2") (T.var "t1"))))]+ (apply (var "fun2") (var "x")))),+ T.poly ["t0", "t1"] (T.function (T.var "t0") (T.function (T.var "t1") (T.pair (T.var "t0") (T.var "t1")))))]+ (apply (apply (var "fun1") (string "foo")) (int32 42)))]++-- | Test cases for eta expansion of terms+-- Eta expansion adds explicit lambda wrappers to partially applied functions+etaExpandTermGroup :: TTerm TestGroup+etaExpandTermGroup = subgroup "etaExpandTerm" [+ -- Terms that don't expand (already saturated or not functions)+ etaCase "integer literal unchanged"+ (int32 42)+ (int32 42),++ etaCase "string list unchanged"+ (list [string "foo", string "bar"])+ (list [string "foo", string "bar"]),++ etaCase "fully applied binary function unchanged"+ (apply (apply (primitive _strings_splitOn) (string "foo")) (string "bar"))+ (apply (apply (primitive _strings_splitOn) (string "foo")) (string "bar")),++ -- Lambda with fully applied primitive using a string literal (matches EtaExpansion.hs pattern)+ etaCase "lambda with fully applied primitive unchanged"+ (lambda "x" (apply (apply (primitive _strings_splitOn) (string ",")) (var "x")))+ (lambda "x" (apply (apply (primitive _strings_splitOn) (string ",")) (var "x"))),++ etaCase "lambda returning constant unchanged"+ (lambda "x" (int32 42))+ (lambda "x" (int32 42)),++ -- Bare primitives are NOT expanded (they stay as-is)+ etaCase "bare unary primitive unchanged"+ (primitive _strings_toLower)+ (primitive _strings_toLower),++ etaCase "bare binary primitive unchanged"+ (primitive _strings_splitOn)+ (primitive _strings_splitOn),++ etaCase "partially applied binary primitive expands to one lambda"+ (apply (primitive _strings_splitOn) (var "foo"))+ (lambda "v1" (apply (apply (primitive _strings_splitOn) (var "foo")) (var "v1"))),++ etaCase "projection expands to lambda"+ (project (nm "Person") (nm "firstName"))+ (lambda "v1" (apply (project (nm "Person") (nm "firstName")) (var "v1"))),++ -- Subterms within applications+ etaCase "partial application inside lambda expands"+ (lambda "x" (apply (primitive _strings_splitOn) (var "x")))+ (lambda "x" (lambda "v1" (apply (apply (primitive _strings_splitOn) (var "x")) (var "v1")))),++ -- Let bindings+ etaCase "let with constant body unchanged"+ (letExpr "foo" (int32 137) (int32 42))+ (letExpr "foo" (int32 137) (int32 42)),++ etaCase "let with bare primitive value unchanged"+ (letExpr "foo" (primitive _strings_splitOn) (var "foo"))+ (letExpr "foo" (primitive _strings_splitOn) (var "foo")),++ -- Complete applications are no-ops+ etaCase "fully applied unary unchanged"+ (apply (primitive _strings_toLower) (string "FOO"))+ (apply (primitive _strings_toLower) (string "FOO")),++ -- Subterms+ etaCase "partial application in list expands"+ (list [lambda "x" (list [string "foo"]), apply (primitive _strings_splitOn) (string "bar")])+ (list [lambda "x" (list [string "foo"]), lambda "v1" (apply (apply (primitive _strings_splitOn) (string "bar")) (var "v1"))])]++-- Helper to create labeled node (pair of label and list of children)+labeledNode :: String -> [TTerm Term] -> TTerm Term+labeledNode label children = pair (string label) (list children)++-- | Test cases for foldOverTerm+-- Using predefined fold operations: collectLabels, sumInt32Literals, collectListLengths+foldOverTermGroup :: TTerm TestGroup+foldOverTermGroup = subgroup "foldOverTerm" [+ -- collectLabels tests (from checkFoldOverTerm in RewritingSpec.hs)+ -- Nodes are represented as pairs: (label, children)+ foldOverTermCase "collect labels from single node - pre-order"+ (labeledNode "a" [])+ Coders.traversalOrderPre+ foldOpCollectLabels+ (list [string "a"]),++ foldOverTermCase "collect labels from tree - pre-order"+ (labeledNode "a" [labeledNode "b" [], labeledNode "c" [labeledNode "d" []]])+ Coders.traversalOrderPre+ foldOpCollectLabels+ (list [string "a", string "b", string "c", string "d"]),++ foldOverTermCase "collect labels from single node - post-order"+ (labeledNode "a" [])+ Coders.traversalOrderPost+ foldOpCollectLabels+ (list [string "a"]),++ foldOverTermCase "collect labels from tree - post-order"+ (labeledNode "a" [labeledNode "b" [], labeledNode "c" [labeledNode "d" []]])+ Coders.traversalOrderPost+ foldOpCollectLabels+ (list [string "b", string "d", string "c", string "a"]),++ -- sumInt32Literals tests (from testFoldOverTerm in RewritingSpec.hs)+ foldOverTermCase "sum int32 literals"+ (list [int32 42, apply (lambda "x" (var "x")) (int32 10)])+ Coders.traversalOrderPre+ foldOpSumInt32Literals+ (int32 52),++ -- collectListLengths tests (from testFoldOverTerm in RewritingSpec.hs)+ foldOverTermCase "collect list lengths - pre-order"+ (list [list [string "foo", string "bar"], apply (lambda "x" (var "x")) (list [string "quux"])])+ Coders.traversalOrderPre+ foldOpCollectListLengths+ (list [int32 2, int32 2, int32 1]),++ foldOverTermCase "collect list lengths - post-order"+ (list [list [string "foo", string "bar"], apply (lambda "x" (var "x")) (list [string "quux"])])+ Coders.traversalOrderPost+ foldOpCollectListLengths+ (list [int32 2, int32 1, int32 2])]++-- | Test cases for rewriteType+-- Using predefined type rewriter: replaceStringWithInt32+rewriteTypeGroup :: TTerm TestGroup+rewriteTypeGroup = subgroup "rewriteType" [+ rewriteTypeCase "String type in left side of either is replaced"+ (T.either_ T.string T.int32)+ (T.either_ T.int32 T.int32),++ rewriteTypeCase "String type in right side of either is replaced"+ (T.either_ T.int32 T.string)+ (T.either_ T.int32 T.int32),++ rewriteTypeCase "String types in both sides of either are replaced"+ (T.either_ T.string T.string)+ (T.either_ T.int32 T.int32),++ rewriteTypeCase "String type in nested either (left of left) is replaced"+ (T.either_ (T.either_ T.string T.int32) T.int64)+ (T.either_ (T.either_ T.int32 T.int32) T.int64),++ rewriteTypeCase "String type in nested either (right of right) is replaced"+ (T.either_ T.int64 (T.either_ T.int32 T.string))+ (T.either_ T.int64 (T.either_ T.int32 T.int32)),++ rewriteTypeCase "String types in complex nested either are all replaced"+ (T.either_ (T.either_ T.string T.string) (T.either_ T.string T.int64))+ (T.either_ (T.either_ T.int32 T.int32) (T.either_ T.int32 T.int64)),++ rewriteTypeCase "String in list type is replaced"+ (T.list T.string)+ (T.list T.int32),++ rewriteTypeCase "String in function domain is replaced"+ (T.function T.string T.int64)+ (T.function T.int32 T.int64),++ rewriteTypeCase "String in function codomain is replaced"+ (T.function T.int64 T.string)+ (T.function T.int64 T.int32),++ rewriteTypeCase "String in optional type is replaced"+ (T.optional T.string)+ (T.optional T.int32)]++-- Helper for foo, bar, baz+foo :: TTerm Term+foo = string "foo"++bar :: TTerm Term+bar = string "bar"++baz :: TTerm Term+baz = string "baz"++-- | Test cases for rewriteTerm+-- Using predefined term rewriter: replaceFooWithBar+rewriteTermGroup :: TTerm TestGroup+rewriteTermGroup = subgroup "rewriteTerm" [+ -- Simple terms+ rewriteTermCase "string literal foo replaced with bar"+ foo+ bar,++ rewriteTermCase "string in variable not changed"+ (var "x")+ (var "x"),++ -- Collections+ rewriteTermCase "string in list"+ (list [foo, baz])+ (list [bar, baz]),++ rewriteTermCase "multiple strings in list"+ (list [foo, foo, baz])+ (list [bar, bar, baz]),++ rewriteTermCase "string in optional (just)"+ (optional (just foo))+ (optional (just bar)),++ -- Applications and functions+ rewriteTermCase "string in function application"+ (apply (var "print") foo)+ (apply (var "print") bar),++ rewriteTermCase "string in lambda body"+ (lambda "x" foo)+ (lambda "x" bar),++ rewriteTermCase "string in nested applications"+ (apply (var "f") (apply (var "g") foo))+ (apply (var "f") (apply (var "g") bar)),++ -- Records and products+ rewriteTermCase "string in record field"+ (record (nm "Person") [(nm "name", foo)])+ (record (nm "Person") [(nm "name", bar)]),++ rewriteTermCase "strings in multiple record fields"+ (record (nm "Data") [(nm "a", foo), (nm "b", baz), (nm "c", foo)])+ (record (nm "Data") [(nm "a", bar), (nm "b", baz), (nm "c", bar)]),++ rewriteTermCase "string in pair"+ (pair foo (int32 42))+ (pair bar (int32 42)),++ -- Let bindings+ rewriteTermCase "string in let binding value"+ (letExpr "x" foo (var "x"))+ (letExpr "x" bar (var "x")),++ rewriteTermCase "string in let body"+ (letExpr "x" (int32 1) foo)+ (letExpr "x" (int32 1) bar),++ -- Case statements+ rewriteTermCase "string in first case branch"+ (match (nm "Result") nothing [(nm "success", foo), (nm "error", baz)])+ (match (nm "Result") nothing [(nm "success", bar), (nm "error", baz)]),++ rewriteTermCase "string in second case branch"+ (match (nm "Result") nothing [(nm "success", baz), (nm "error", foo)])+ (match (nm "Result") nothing [(nm "success", baz), (nm "error", bar)]),++ rewriteTermCase "string in default branch"+ (match (nm "Result") (just foo) [(nm "success", baz), (nm "error", baz)])+ (match (nm "Result") (just bar) [(nm "success", baz), (nm "error", baz)]),++ -- Deeply nested+ rewriteTermCase "string deeply nested in record in list in application"+ (apply (var "process") (list [record (nm "Item") [(nm "value", foo)]]))+ (apply (var "process") (list [record (nm "Item") [(nm "value", bar)]])),++ -- Unions and injections+ rewriteTermCase "string in union inject value"+ (inject (nm "Result") "success" foo)+ (inject (nm "Result") "success" bar),++ -- Wrapped terms+ rewriteTermCase "string in wrapped term"+ (wrap (nm "Email") foo)+ (wrap (nm "Email") bar),++ -- Annotated terms+ rewriteTermCase "string in annotated term body"+ (annot emptyAnnMap foo)+ (annot emptyAnnMap bar),++ -- Multiple bindings in let+ rewriteTermCase "string in first of multiple let bindings"+ (multiLet [("x", foo), ("y", baz)] (var "x"))+ (multiLet [("x", bar), ("y", baz)] (var "x")),++ rewriteTermCase "string in second of multiple let bindings"+ (multiLet [("x", baz), ("y", foo)] (var "y"))+ (multiLet [("x", baz), ("y", bar)] (var "y")),++ rewriteTermCase "string in all let bindings and body"+ (multiLet [("x", foo), ("y", foo)] foo)+ (multiLet [("x", bar), ("y", bar)] bar),++ -- Sets+ rewriteTermCase "string in set"+ (set [foo, baz])+ (set [bar, baz]),++ -- Type lambdas and type applications (System F)+ rewriteTermCase "string in type lambda body"+ (tylam "a" foo)+ (tylam "a" bar),++ rewriteTermCase "string in type application body"+ (tyapp foo T.string)+ (tyapp bar T.string),++ rewriteTermCase "string in nested type lambdas"+ (tylam "a" (tylam "b" foo))+ (tylam "a" (tylam "b" bar)),++ -- Annotation edge case: string in annotation subject is replaced, but body stays same+ -- Note: annotations on the annotation map itself are not traversed by rewriteTerm++ -- Complex nested structures+ rewriteTermCase "string in case branch within let binding"+ (letExpr "handler" (match (nm "Result") nothing [(nm "ok", foo), (nm "err", baz)]) (var "handler"))+ (letExpr "handler" (match (nm "Result") nothing [(nm "ok", bar), (nm "err", baz)]) (var "handler")),++ rewriteTermCase "string in annotated wrapped record field"+ (annot emptyAnnMap (wrap (nm "User") (record (nm "UserData") [(nm "name", foo)])))+ (annot emptyAnnMap (wrap (nm "User") (record (nm "UserData") [(nm "name", bar)])))]++-- | Test cases for unshadowVariables+-- The function renames shadowed variables by appending a counter suffix.+-- When a variable name is first introduced (lambda or let), it keeps its name.+-- When the same name is introduced again in an inner scope (shadowing), the inner+-- binding is renamed to name<counter> (e.g., x2, x3, ...), and references in+-- the inner body are updated accordingly.+unshadowVariablesGroup :: TTerm TestGroup+unshadowVariablesGroup = subgroup "unshadowVariables" [++ -- === No shadowing: terms should be unchanged ===++ unshadowCase "literal unchanged"+ (int32 42)+ (int32 42),++ unshadowCase "variable unchanged"+ (var "x")+ (var "x"),++ unshadowCase "single lambda unchanged"+ (lambda "x" (var "x"))+ (lambda "x" (var "x")),++ unshadowCase "distinct lambda parameters unchanged"+ (lambda "x" (lambda "y" (list [var "x", var "y"])))+ (lambda "x" (lambda "y" (list [var "x", var "y"]))),++ unshadowCase "let with no shadowing unchanged"+ (letExpr "x" (int32 1) (var "x"))+ (letExpr "x" (int32 1) (var "x")),++ unshadowCase "let and lambda with distinct names unchanged"+ (letExpr "x" (int32 1) (lambda "y" (list [var "x", var "y"])))+ (letExpr "x" (int32 1) (lambda "y" (list [var "x", var "y"]))),++ -- === Simple lambda shadowing ===++ unshadowCase "inner lambda shadows outer lambda"+ (lambda "x" (lambda "x" (var "x")))+ (lambda "x" (lambda "x2" (var "x2"))),++ unshadowCase "inner lambda shadows outer - body references both"+ (lambda "x" (list [var "x", lambda "x" (var "x")]))+ (lambda "x" (list [var "x", lambda "x2" (var "x2")])),++ unshadowCase "triple nested lambda same name"+ (lambda "x" (lambda "x" (lambda "x" (var "x"))))+ (lambda "x" (lambda "x2" (lambda "x3" (var "x3")))),++ -- === Lambda shadowing with different parameters ===++ unshadowCase "two parameters shadow sequentially"+ (lambda "x" (lambda "y" (lambda "x" (lambda "y" (list [var "x", var "y"])))))+ (lambda "x" (lambda "y" (lambda "x2" (lambda "y2" (list [var "x2", var "y2"]))))),++ -- === Let introduces names that lambdas can shadow ===++ unshadowCase "lambda shadows let-bound variable"+ (letExpr "x" (int32 1) (lambda "x" (var "x")))+ (letExpr "x" (int32 1) (lambda "x2" (var "x2"))),++ unshadowCase "lambda shadows one of multiple let bindings"+ (multiLet [("x", int32 1), ("y", int32 2)]+ (lambda "x" (list [var "x", var "y"])))+ (multiLet [("x", int32 1), ("y", int32 2)]+ (lambda "x2" (list [var "x2", var "y"]))),++ -- === Nested lets ===++ unshadowCase "inner let body with lambda shadowing outer let"+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (lambda "x" (var "x"))))+ (letExpr "x" (int32 1)+ (letExpr "y" (int32 2)+ (lambda "x2" (var "x2")))),++ -- === Shadowing inside application ===++ unshadowCase "shadowed lambda in function position of application"+ (lambda "f" (apply (lambda "f" (var "f")) (var "f")))+ (lambda "f" (apply (lambda "f2" (var "f2")) (var "f"))),++ -- === Shadowing inside list ===++ unshadowCase "shadowed lambdas in list elements"+ (lambda "x"+ (list [+ lambda "x" (var "x"),+ lambda "x" (var "x")]))+ (lambda "x"+ (list [+ lambda "x2" (var "x2"),+ lambda "x2" (var "x2")])),++ -- === Shadowing inside record ===++ unshadowCase "shadowed lambda in record field"+ (lambda "x"+ (record (nm "Pair") [+ (nm "fst", lambda "x" (var "x")),+ (nm "snd", var "x")]))+ (lambda "x"+ (record (nm "Pair") [+ (nm "fst", lambda "x2" (var "x2")),+ (nm "snd", var "x")])),++ -- === Shadowing inside case/match branches ===++ unshadowCase "shadowed lambda in case branch"+ (lambda "x"+ (match (nm "Maybe") nothing [+ (nm "nothing", int32 0),+ (nm "just", lambda "x" (var "x"))]))+ (lambda "x"+ (match (nm "Maybe") nothing [+ (nm "nothing", int32 0),+ (nm "just", lambda "x2" (var "x2"))])),++ -- === Shadowing inside pair ===++ unshadowCase "shadowed lambda in pair"+ (lambda "x" (pair (lambda "x" (var "x")) (var "x")))+ (lambda "x" (pair (lambda "x2" (var "x2")) (var "x"))),++ -- === Shadowing inside optional ===++ unshadowCase "shadowed lambda inside optional"+ (lambda "x" (optional (just (lambda "x" (var "x")))))+ (lambda "x" (optional (just (lambda "x2" (var "x2"))))),++ -- === Shadowing inside set ===++ unshadowCase "shadowed lambda inside set element"+ (lambda "x" (set [lambda "x" (var "x")]))+ (lambda "x" (set [lambda "x2" (var "x2")])),++ -- === Shadowing inside inject (union construction) ===++ unshadowCase "shadowed lambda in union injection"+ (lambda "x" (inject (nm "Result") "ok" (lambda "x" (var "x"))))+ (lambda "x" (inject (nm "Result") "ok" (lambda "x2" (var "x2")))),++ -- === Shadowing inside wrap ===++ unshadowCase "shadowed lambda inside wrapped term"+ (lambda "x" (wrap (nm "Age") (lambda "x" (var "x"))))+ (lambda "x" (wrap (nm "Age") (lambda "x2" (var "x2")))),++ -- === Shadowing inside type lambda ===++ unshadowCase "shadowed lambda inside type lambda"+ (lambda "x" (tylam "a" (lambda "x" (var "x"))))+ (lambda "x" (tylam "a" (lambda "x2" (var "x2")))),++ -- === Shadowing inside type application ===++ unshadowCase "shadowed lambda inside type application"+ (lambda "x" (tyapp (lambda "x" (var "x")) T.string))+ (lambda "x" (tyapp (lambda "x2" (var "x2")) T.string)),++ -- === Shadowing inside annotation ===++ unshadowCase "shadowed lambda inside annotated term"+ (lambda "x" (annot emptyAnnMap (lambda "x" (var "x"))))+ (lambda "x" (annot emptyAnnMap (lambda "x2" (var "x2")))),++ -- === Complex nesting ===++ unshadowCase "shadowing at multiple depths"+ (lambda "x"+ (lambda "y"+ (lambda "x"+ (lambda "y"+ (list [var "x", var "y"])))))+ (lambda "x"+ (lambda "y"+ (lambda "x2"+ (lambda "y2"+ (list [var "x2", var "y2"]))))),++ unshadowCase "let then lambda then lambda all same name"+ (letExpr "x" (int32 1)+ (lambda "x" (lambda "x" (var "x"))))+ (letExpr "x" (int32 1)+ (lambda "x2" (lambda "x3" (var "x3")))),++ unshadowCase "lambda with shadowing in let binding value"+ (lambda "x"+ (letExpr "y" (lambda "x" (var "x"))+ (apply (var "y") (var "x"))))+ (lambda "x"+ (letExpr "y" (lambda "x2" (var "x2"))+ (apply (var "y") (var "x")))),++ -- === No-op cases: terms without binding forms ===++ unshadowCase "application without shadowing unchanged"+ (apply (var "f") (int32 42))+ (apply (var "f") (int32 42)),++ unshadowCase "list of literals unchanged"+ (list [int32 1, int32 2, int32 3])+ (list [int32 1, int32 2, int32 3]),++ unshadowCase "nested record unchanged"+ (record (nm "Point") [(nm "x", int32 10), (nm "y", int32 20)])+ (record (nm "Point") [(nm "x", int32 10), (nm "y", int32 20)])]
+ src/main/haskell/Hydra/Sources/Test/Serialization.hs view
@@ -0,0 +1,194 @@+{-# LANGUAGE FlexibleContexts #-}++-- | Test cases for AST serialization (printExpr and parenthesize)+--+-- Note: This module supersedes the Haskell-specific Hydra.SerializationSpec tests.+module Hydra.Sources.Test.Serialization where++-- Standard imports for deep DSL tests (produces TTerm a with specific types)+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding ((++))+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+import Hydra.Dsl.AsTerm+import qualified Hydra.Dsl.Meta.Ast as Ast+import qualified Hydra.Sources.Kernel.Terms.Serialization as Serialization+import qualified Hydra.Sources.Haskell.Operators as Operators++import Hydra.Ast (Expr, Op, BlockStyle)+++ns :: Namespace+ns = Namespace "hydra.test.serialization"++module_ :: Module+module_ = Module ns elements+ [Serialization.ns, Operators.ns]+ kernelTypesNamespaces+ (Just "Test cases for AST serialization")+ where+ elements = [Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ doc "Test cases for AST serialization" $+ supergroup "serialization" [+ associativityGroup,+ caseStatementGroup,+ lambdaGroup,+ listGroup,+ precedenceGroup]++-- Helper for building an infix expression: ifx op lhs rhs+infixExpr :: AsTerm t Op => t -> TTerm Expr -> TTerm Expr -> TTerm Expr+infixExpr opExpr lhs rhs = Serialization.ifx @@ asTerm opExpr @@ lhs @@ rhs++-- Helper for building a constant expression+cstExpr :: TTerm String -> TTerm Expr+cstExpr s = Serialization.cst @@ s++-- Helper for building a numeric expression+numExpr :: Int -> TTerm Expr+numExpr n = Serialization.num @@ int32 n++-- Helper for building a space-separated expression+spaceSepExpr :: [TTerm Expr] -> TTerm Expr+spaceSepExpr exprs = Serialization.spaceSep @@ list exprs++-- Helper for building a newline-separated expression+newlineSepExpr :: [TTerm Expr] -> TTerm Expr+newlineSepExpr exprs = Serialization.newlineSep @@ list exprs++-- Helper for building a bracket list+bracketListExpr :: AsTerm t BlockStyle => t -> [TTerm Expr] -> TTerm Expr+bracketListExpr style exprs = Serialization.bracketList @@ asTerm style @@ list exprs++-- Inline style (reference to kernel)+inlineBlockStyle :: TBinding BlockStyle+inlineBlockStyle = Serialization.inlineStyle++-- Reference to Haskell operators+arrowOp, gtOp, plusOp, multOp, lambdaOp, caseOp :: TBinding Op+arrowOp = Operators.arrowOp+gtOp = Operators.gtOp+plusOp = Operators.plusOp+multOp = Operators.multOp+lambdaOp = Operators.lambdaOp+caseOp = Operators.caseOp++-- Helper for lambda expressions: \vars -> body+-- lambdaExpr ["x", "y"] body = ifx lambdaOp (cst "\x y") body+lambdaExpr :: [String] -> TTerm Expr -> TTerm Expr+lambdaExpr vars body = infixExpr lambdaOp (cstExpr $ string ("\\" ++ unwords vars)) body++-- Helper for case statements+-- This creates: case cond of { pattern1 -> expr1; pattern2 -> expr2; ... }+casesExpr :: TTerm Expr -> [(TTerm Expr, TTerm Expr)] -> TTerm Expr+casesExpr cond branches = infixExpr ofOp lhs rhs+ where+ lhs = spaceSepExpr [cstExpr $ string "case", cond]+ rhs = newlineSepExpr [infixExpr caseOp pat expr | (pat, expr) <- branches]+ ofOp = Ast.op+ (Ast.symbol $ string "of")+ (Ast.padding Ast.wsSpace (Ast.wsBreakAndIndent $ string " "))+ (Ast.precedence $ int32 0)+ Ast.associativityNone++-- | Test cases for associativity+associativityGroup :: TTerm TestGroup+associativityGroup = subgroup "associativity" [+ serCase "right-associative operator"+ -- (a -> b) -> c -> d+ (infixExpr arrowOp (infixExpr arrowOp (cstExpr $ string "a") (cstExpr $ string "b"))+ (infixExpr arrowOp (cstExpr $ string "c") (cstExpr $ string "d")))+ (string "(a -> b) -> c -> d")]++-- | Test cases for case statements+caseStatementGroup :: TTerm TestGroup+caseStatementGroup = subgroup "case statements" [+ serCase "simple case statement"+ (casesExpr (infixExpr gtOp (cstExpr $ string "x") (numExpr 42))+ [(cstExpr $ string "False", cstExpr $ string "Big"),+ (cstExpr $ string "True", cstExpr $ string "Small")])+ (string "case x > 42 of\n False -> Big\n True -> Small"),++ serCase "nested case statement"+ (casesExpr (infixExpr gtOp (cstExpr $ string "x") (numExpr 42))+ [(cstExpr $ string "True",+ casesExpr (infixExpr gtOp (cstExpr $ string "x") (numExpr 100))+ [(cstExpr $ string "True", cstExpr $ string "ReallyBig"),+ (cstExpr $ string "False", cstExpr $ string "Big")]),+ (cstExpr $ string "False", cstExpr $ string "Small")])+ (string "case x > 42 of\n True -> case x > 100 of\n True -> ReallyBig\n False -> Big\n False -> Small")]++-- | Test cases for lambda expressions+lambdaGroup :: TTerm TestGroup+lambdaGroup = subgroup "lambdas" [+ serCase "simple lambda"+ (lambdaExpr ["x", "y"] (infixExpr plusOp (cstExpr $ string "x") (cstExpr $ string "y")))+ (string "\\x y -> x + y")]++-- | Test cases for list expressions+listGroup :: TTerm TestGroup+listGroup = subgroup "lists" [+ serCase "empty list"+ (bracketListExpr inlineBlockStyle [])+ (string "[]"),++ serCase "simple non-empty list"+ (bracketListExpr inlineBlockStyle [numExpr 1, numExpr 2, numExpr 3])+ (string "[1, 2, 3]"),++ serCase "nested list"+ (bracketListExpr inlineBlockStyle+ [bracketListExpr inlineBlockStyle [numExpr 1, numExpr 3], numExpr 2])+ (string "[[1, 3], 2]"),++ serCase "list with parenthesized expression inside"+ (bracketListExpr inlineBlockStyle+ [bracketListExpr inlineBlockStyle+ [numExpr 1,+ infixExpr multOp+ (infixExpr plusOp (numExpr 2) (numExpr 3))+ (infixExpr plusOp (numExpr 1) (numExpr 10))],+ numExpr 2])+ (string "[[1, (2 + 3) * (1 + 10)], 2]")]++-- | Test cases for operator precedence+precedenceGroup :: TTerm TestGroup+precedenceGroup = subgroup "precedence" [+ serCase "operators with different precedence - no parens needed"+ (infixExpr plusOp+ (infixExpr multOp (numExpr 2) (numExpr 3))+ (infixExpr multOp (numExpr 1) (numExpr 10)))+ (string "2 * 3 + 1 * 10"),++ serCase "operators with different precedence - parens needed"+ (infixExpr multOp+ (infixExpr plusOp (numExpr 2) (numExpr 3))+ (infixExpr plusOp (numExpr 1) (numExpr 10)))+ (string "(2 + 3) * (1 + 10)"),++ serCase "associative operator left nesting"+ (infixExpr multOp (cstExpr $ string "x")+ (infixExpr multOp (cstExpr $ string "y") (cstExpr $ string "z")))+ (string "x * y * z"),++ serCase "associative operator right nesting"+ (infixExpr multOp+ (infixExpr multOp (cstExpr $ string "x") (cstExpr $ string "y"))+ (cstExpr $ string "z"))+ (string "x * y * z")]
+ src/main/haskell/Hydra/Sources/Test/Sorting.hs view
@@ -0,0 +1,160 @@+-- | Test cases for topological sorting algorithms+--+-- Note: This module supersedes the Haskell-specific Hydra.SortingSpec tests.+-- Historical note: The expected orderings changed when the algorithm was updated+-- to produce a canonical ordering (sorted by node value within each SCC).+module Hydra.Sources.Test.Sorting where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+import Hydra.Sources.Libraries+import qualified Hydra.Sources.Kernel.Terms.Sorting as SortingModule++import qualified Data.Int as I+++-- Note: We use Int for input types in helpers because Phantoms.int32 expects Int+-- and produces TTerm I.Int32. The test data literals (1, 2, 3) are polymorphic.++ns :: Namespace+ns = Namespace "hydra.test.sorting"++module_ :: Module+module_ = Module ns elements+ [SortingModule.ns]+ kernelTypesNamespaces+ (Just "Test cases for topological sorting algorithms")+ where+ elements = [Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = Phantoms.definitionInModule module_++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for topological sorting" $+ supergroup "sorting" [+ topologicalSortGroup,+ topologicalSortSCCGroup]++-- Helper to create adjacency list+adj :: [(Int, [Int])] -> TTerm [(Int, [Int])]+adj pairs = Phantoms.list [Phantoms.pair (Phantoms.int32 n) (Phantoms.list (Phantoms.int32 <$> deps)) | (n, deps) <- pairs]++-- Helper for Right result (sorted list)+sorted :: [Int] -> TTerm (Either [[Int]] [Int])+sorted xs = Phantoms.right $ Phantoms.list (Phantoms.int32 <$> xs)++-- Helper for Left result (cycles)+cycles :: [[Int]] -> TTerm (Either [[Int]] [Int])+cycles cs = Phantoms.left $ Phantoms.list [Phantoms.list (Phantoms.int32 <$> c) | c <- cs]++-- Helper for SCC result+sccs :: [[Int]] -> TTerm [[Int]]+sccs cs = Phantoms.list [Phantoms.list (Phantoms.int32 <$> c) | c <- cs]++-- | Test cases for topological sort (without cycles)+topologicalSortGroup :: TTerm TestGroup+topologicalSortGroup = subgroup "topological sort" [+ -- Discrete sets (no dependencies)+ sortCase "empty set"+ (adj [])+ (sorted []),+ sortCase "singleton set"+ (adj [(1, [])])+ (sorted [1]),+ sortCase "discrete set with multiple elements"+ (adj [(3, []), (1, []), (2, [])])+ (sorted [1, 2, 3]),++ -- Trees and DAGs+ sortCase "linked list"+ (adj [(3, [1]), (2, [3]), (1, [])])+ (sorted [1, 3, 2]),+ sortCase "binary tree"+ (adj [(3, [1, 4]), (4, [6, 2]), (1, [5]), (2, []), (6, []), (5, [])])+ (sorted [5, 1, 2, 6, 4, 3]),+ sortCase "two trees"+ (adj [(3, [1, 4]), (5, [6, 2]), (2, [7]), (1, []), (4, []), (6, []), (7, [])])+ (sorted [1, 7, 2, 4, 3, 6, 5]),+ sortCase "diamond DAG"+ (adj [(1, [3, 4]), (3, [2]), (4, [2]), (2, [5]), (5, [])])+ (sorted [5, 2, 3, 4, 1]),++ -- Cycles (expected to fail)+ sortCase "two-node cycle"+ (adj [(1, [2]), (2, [1])])+ (cycles [[1, 2]]),+ sortCase "cycle with incoming and outgoing edges"+ (adj [(1, [3]), (3, [2]), (2, [3, 4]), (4, [5]), (5, [])])+ (cycles [[2, 3]])]++-- | Test cases for topological sort with strongly connected component detection+topologicalSortSCCGroup :: TTerm TestGroup+topologicalSortSCCGroup = subgroup "topological sort SCC" [+ -- Discrete sets+ sortSCCCase "empty set"+ (adj [])+ (sccs []),+ sortSCCCase "singleton set"+ (adj [(1, [])])+ (sccs [[1]]),+ sortSCCCase "discrete set with multiple elements"+ (adj [(3, []), (1, []), (2, [])])+ (sccs [[1], [2], [3]]),++ -- Weakly-connected components+ sortSCCCase "single two-element component #1"+ (adj [(1, [2]), (2, [])])+ (sccs [[2], [1]]),+ sortSCCCase "single two-element component #2"+ (adj [(2, [1]), (1, [])])+ (sccs [[1], [2]]),+ sortSCCCase "multiple-element component"+ (adj [(2, [1, 3]), (1, [3]), (3, [])])+ (sccs [[3], [1], [2]]),++ -- Strongly-connected components (cycles)+ sortSCCCase "cycle of two nodes #1"+ (adj [(1, [2]), (2, [1])])+ (sccs [[1, 2]]),+ sortSCCCase "cycle of two nodes #2"+ (adj [(2, [1]), (1, [2])])+ (sccs [[1, 2]]),+ sortSCCCase "cycle of three nodes #1"+ (adj [(1, [2]), (2, [3]), (3, [1])])+ (sccs [[1, 2, 3]]),+ sortSCCCase "cycle of three nodes #2"+ (adj [(2, [1]), (3, [2]), (1, [3])])+ (sccs [[1, 2, 3]]),+ sortSCCCase "multiple disconnected cycles"+ (adj ([(200, [])] ++ [(100, [])] ++ [(300, [])] ++ [(10, [20]), (20, [10])] ++ [(1, [2]), (2, [3]), (3, [1])]))+ (sccs [[1, 2, 3], [10, 20], [100], [200], [300]]),+ sortSCCCase "complex cycles"+ (adj [(1, [2, 3]), (2, [3]), (3, [1])])+ (sccs [[1, 2, 3]]),++ -- Mixed weakly- and strongly-connected components+ sortSCCCase "chain of three SCCs"+ (adj [(1, [2, 10]), (2, [3]), (3, [1]), (10, [20]), (20, [100, 10]), (100, [])])+ (sccs [[100], [10, 20], [1, 2, 3]]),+ sortSCCCase "SCCs with dependencies to/from non-SCC nodes"+ (adj [(1, [2, 3, 10]), (2, [3]), (3, [1]),+ (10, [20, 30]), (20, [30]), (30, []),+ (100, [200, 2]), (200, []), (300, [100]),+ (1000, []),+ (2000, [])])+ (sccs [[30], [20], [10], [1, 2, 3], [200], [100], [300], [1000], [2000]])]
+ src/main/haskell/Hydra/Sources/Test/Substitution.hs view
@@ -0,0 +1,146 @@+-- | Test cases for type and term substitution operations+module Hydra.Sources.Test.Substitution where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+++ns :: Namespace+ns = Namespace "hydra.test.substitution"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for type and term substitution operations")+ where+ elements = [Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- Helper to build names+nm :: String -> TTerm Name+nm s = Core.name $ Phantoms.string s++-- Helper for building substitution pairs+subst :: [(String, TTerm Type)] -> TTerm [(Name, Type)]+subst pairs = Phantoms.list [Phantoms.pair (nm n) t | (n, t) <- pairs]++-- ============================================================+-- substInType tests+-- ============================================================++substInTypeTests :: TTerm TestGroup+substInTypeTests = subgroup "substInType" [+ -- Empty substitution returns type unchanged+ substInTypeCase "empty substitution returns type unchanged"+ (subst [])+ T.string+ T.string,++ -- Substitute a type variable with a concrete type+ substInTypeCase "substitute type variable with int32"+ (subst [("a", T.int32)])+ (T.var "a")+ T.int32,++ -- Non-matching variable is unchanged+ substInTypeCase "non-matching variable unchanged"+ (subst [("a", T.int32)])+ (T.var "b")+ (T.var "b"),++ -- Substitute in function type+ substInTypeCase "substitute in function domain"+ (subst [("a", T.int32)])+ (T.function (T.var "a") T.string)+ (T.function T.int32 T.string),++ substInTypeCase "substitute in function codomain"+ (subst [("a", T.string)])+ (T.function T.int32 (T.var "a"))+ (T.function T.int32 T.string),++ -- Substitute in list type+ substInTypeCase "substitute in list element type"+ (subst [("a", T.int32)])+ (T.list (T.var "a"))+ (T.list T.int32),++ -- Substitute in optional type+ substInTypeCase "substitute in optional type"+ (subst [("a", T.string)])+ (T.optional (T.var "a"))+ (T.optional T.string),++ -- Substitute in pair type+ substInTypeCase "substitute in pair type both sides"+ (subst [("a", T.int32)])+ (T.pair (T.var "a") (T.var "a"))+ (T.pair T.int32 T.int32),++ -- Substitute in either type+ substInTypeCase "substitute in either type"+ (subst [("a", T.string)])+ (T.either_ (T.var "a") T.int32)+ (T.either_ T.string T.int32),++ -- Substitute in map type+ substInTypeCase "substitute in map key type"+ (subst [("k", T.string)])+ (T.map (T.var "k") T.int32)+ (T.map T.string T.int32),++ -- Substitute in set type+ substInTypeCase "substitute in set type"+ (subst [("a", T.int32)])+ (T.set (T.var "a"))+ (T.set T.int32),++ -- Nested substitution+ substInTypeCase "nested substitution in list of pairs"+ (subst [("a", T.int32)])+ (T.list (T.pair (T.var "a") T.string))+ (T.list (T.pair T.int32 T.string)),++ -- Multiple substitutions+ substInTypeCase "multiple substitutions"+ (subst [("a", T.int32), ("b", T.string)])+ (T.pair (T.var "a") (T.var "b"))+ (T.pair T.int32 T.string),++ -- Forall type: bound variable should not be substituted in body+ substInTypeCase "forAll bound variable not substituted"+ (subst [("a", T.int32)])+ (T.forAll "a" (T.function (T.var "a") (T.var "a")))+ (T.forAll "a" (T.function (T.var "a") (T.var "a"))),++ -- Forall type: free variable in body should be substituted+ substInTypeCase "forAll free variable substituted"+ (subst [("b", T.string)])+ (T.forAll "a" (T.function (T.var "a") (T.var "b")))+ (T.forAll "a" (T.function (T.var "a") T.string))]++-- ============================================================+-- All tests+-- ============================================================++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for type and term substitution operations" $+ supergroup "substitution" [+ substInTypeTests]
src/main/haskell/Hydra/Sources/Test/TestGraph.hs view
@@ -1,340 +1,91 @@ module Hydra.Sources.Test.TestGraph where +-- Standard imports for shallow DSL tests import Hydra.Kernel-import qualified Hydra.Dsl.Core as Core-import qualified Hydra.Dsl.Graph as Graph-import qualified Hydra.Dsl.Module as Module-import qualified Hydra.Dsl.Lib.Chars as Chars-import qualified Hydra.Dsl.Lib.Equality as Equality-import qualified Hydra.Dsl.Lib.Lists as Lists-import qualified Hydra.Dsl.Lib.Literals as Literals-import qualified Hydra.Dsl.Lib.Logic as Logic-import qualified Hydra.Dsl.Lib.Maps as Maps-import qualified Hydra.Dsl.Lib.Math as Math-import qualified Hydra.Dsl.Lib.Optionals as Optionals-import qualified Hydra.Dsl.Phantoms as Phantoms-import qualified Hydra.Dsl.Lib.Sets as Sets-import Hydra.Dsl.Lib.Strings as Strings-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Kernel.Types.All+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Hydra.Dsl.Meta.Graph as Graph+import qualified Hydra.Dsl.Meta.Module as DModule+import qualified Hydra.Dsl.Meta.Lib.Chars as Chars+import qualified Hydra.Dsl.Meta.Lib.Equality as Equality+import qualified Hydra.Dsl.Meta.Lib.Lists as Lists+import qualified Hydra.Dsl.Meta.Lib.Literals as Literals+import qualified Hydra.Dsl.Meta.Lib.Logic as Logic+import qualified Hydra.Dsl.Meta.Lib.Maps as Maps+import qualified Hydra.Dsl.Meta.Lib.Math as Math+import qualified Hydra.Dsl.Meta.Lib.Maybes as Maybes+import qualified Hydra.Dsl.Meta.Lib.Sets as Sets+import Hydra.Dsl.Meta.Lib.Strings as Strings+import qualified Hydra.Dsl.Terms as DslTerms+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Sources.Kernel.Types.Core as CoreTypes import Prelude hiding ((++))-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y--import qualified Hydra.Dsl.TTypes as T-import Hydra.Dsl.TTerms as TTerms+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Set as S+import qualified Data.Maybe as Y -testGraphDefinition :: String -> TTerm a -> TBinding a-testGraphDefinition = definitionInModule testGraphModule+ns :: Namespace+ns = Namespace "hydra.test.testGraph" -testGraphModule :: Module-testGraphModule = Module (Namespace "hydra.test.testGraph") elements- []- kernelTypesModules $+module_ :: Module+module_ = Module ns elements+ [TestTerms.ns, TestTypes.ns]+ kernelTypesNamespaces $ Just ("A module defining the graph used in the test suite.") where- elements = [- el testTypeLatLonNameDef,- el testTypeLatLonPolyNameDef,- el latlonRecordDef,- el testTypeLatLonDef,- el testTypeLatLonPolyDef,- el testTypeStringAliasDef,- el testTypeStringAliasNameDef,- el testTypePolymorphicWrapperDef,- el testTypePolymorphicWrapperNameDef,- el testElementArthurDef,- el testElementFirstNameDef,--- el testGraphDef, -- TODO- el testNamespaceDef,--- el testSchemaGraphDef, -- TODO- el testSchemaNamespaceDef,- el testDataArthurDef,- el testTypeBuddyListADef,- el testTypeBuddyListANameDef,- el testTypeBuddyListBDef,- el testTypeBuddyListBNameDef,- el testTypeComparisonDef,- el testTypeComparisonNameDef,- el testTypeIntListDef,- el testTypeIntListNameDef,- el testTypeHydraLiteralTypeDef,- el testTypeHydraLiteralTypeNameDef,- el testTypeHydraTypeDef,- el testTypeHydraTypeNameDef,- el testTypeListDef,- el testTypeListNameDef,- el testTypeNumberDef,- el testTypeNumberNameDef,- el testTypePersonDef,- el testTypePersonNameDef,- el testTypePersonOrSomethingDef,- el testTypePersonOrSomethingNameDef,- el testTypeSimpleNumberDef,- el testTypeSimpleNumberNameDef,- el testTypeTimestampDef,- el testTypeTimestampNameDef,- el testTypeUnionMonomorphicDef,- el testTypeUnionMonomorphicNameDef,- el testTypeUnionPolymorphicRecursiveDef,- el testTypeUnionPolymorphicRecursiveNameDef,- el testTypeUnitDef,- el testTypeUnitNameDef]--testGraphType :: String -> TTerm Type -> TBinding Type-testGraphType name = testGraphDefinition name . firstClassType--testTypeLatLonNameDef :: TBinding Name-testTypeLatLonNameDef = testGraphDefinition "testTypeLatLonName" $- name "LatLon"--testTypeLatLonPolyNameDef :: TBinding Name-testTypeLatLonPolyNameDef = testGraphDefinition "testTypeLatLonPolyName" $- name "LatLonPoly"--latlonRecordDef :: TBinding (Float -> Float -> Term)-latlonRecordDef = testGraphDefinition "latlonRecord" $- Phantoms.lambdas ["lat", "lon"] $ record (ref testTypeLatLonNameDef) [- "lat">: float32Lift $ varPhantom "lat",- "lon">: float32Lift $ varPhantom "lon"]--testTypeLatLonDef :: TBinding Type-testTypeLatLonDef = testGraphType "testTypeLatLon" $- T.record (ref testTypeLatLonNameDef) [- "lat">: T.float32,- "lon">: T.float32]--testTypeLatLonPolyDef :: TBinding Type-testTypeLatLonPolyDef = testGraphType "testTypeLatLonPoly" $- T.forAll "a" $ T.record (ref testTypeLatLonPolyNameDef) [- "lat">: T.var "a",- "lon">: T.var "a"]--testTypeStringAliasDef :: TBinding Type-testTypeStringAliasDef = testGraphType "testTypeStringAlias" $- Core.typeWrap $ Core.wrappedType (ref testTypeStringAliasNameDef) T.string--testTypeStringAliasNameDef :: TBinding Name-testTypeStringAliasNameDef = testGraphDefinition "testTypeStringAliasName" $- name "StringTypeAlias"--testTypePolymorphicWrapperDef :: TBinding Type-testTypePolymorphicWrapperDef = testGraphType "testTypePolymorphicWrapper" $- T.forAll "a" $ Core.typeWrap $ Core.wrappedType (ref testTypePolymorphicWrapperNameDef) (T.list $ T.var "a")--testTypePolymorphicWrapperNameDef :: TBinding Name-testTypePolymorphicWrapperNameDef = testGraphDefinition "testTypePolymorphicWrapperName" $- name "PolymorphicWrapper"--testElementArthurDef :: TBinding Binding-testElementArthurDef = testGraphDefinition "testElementArthur" $- Core.binding- (name "firstName")- (ref testDataArthurDef)- (Phantoms.just $ Core.typeScheme (Phantoms.list []) (Core.typeVariable $ ref testTypePersonNameDef))--testElementFirstNameDef :: TBinding Binding-testElementFirstNameDef = testGraphDefinition "testElementFirstName" $- Core.binding- (name "firstName")- (project (ref testTypePersonNameDef) (name "firstName"))- (Phantoms.just $ Core.typeScheme (Phantoms.list [])- (Core.typeFunction $ Core.functionType (Core.typeVariable $ ref testTypePersonNameDef) T.string))----testGraph :: Graph---testGraph = elementsToGraph hydraCoreGraph (Just testSchemaGraph) [testElementArthur, testElementFirstName]--testNamespaceDef :: TBinding Namespace-testNamespaceDef = testGraphDefinition "testNamespace" $ Module.namespace $ Phantoms.string "testGraph"----testSchemaGraph :: Graph---testSchemaGraph = elementsToGraph hydraCoreGraph (Just hydraCoreGraph) [--- def testTypeBuddyListAName testTypeBuddyListA,--- def testTypeBuddyListBName testTypeBuddyListB,--- def testTypeComparisonName testTypeComparison,--- def testTypeIntListName testTypeIntList,--- def testTypeHydraLiteralTypeName testTypeHydraLiteralType,--- def testTypeHydraTypeName testTypeHydraType,--- def testTypeLatLonName testTypeLatLon,--- def testTypeLatLonPolyName testTypeLatLonPoly,--- def testTypeListName testTypeList,--- def testTypeNumberName testTypeNumber,--- def testTypePersonName testTypePerson,--- def testTypePersonOrSomethingName testTypePersonOrSomething,--- def testTypeSimpleNumberName testTypeSimpleNumber,--- def testTypeStringAliasName $ Ann.doc "An alias for the string type" testTypeStringAlias,--- def testTypeTimestampName testTypeTimestamp,--- def testTypeUnionMonomorphicName testTypeUnionMonomorphic,--- def testTypeUnionPolymorphicRecursiveName testTypeUnionPolymorphicRecursive,--- def testTypeUnitName testTypeUnit]--- where--- def = typeElement--testSchemaNamespaceDef :: TBinding Namespace-testSchemaNamespaceDef = testGraphDefinition "testSchemaNamespace" $ Module.namespace $ Phantoms.string "testSchemaGraph"--testDataArthurDef :: TBinding Term-testDataArthurDef = testGraphDefinition "testDataArthur" $- record (ref testTypePersonNameDef) [- "firstName">: string "Arthur",- "lastName">: string "Dent",- "age">: int32 42]--testTypeBuddyListADef :: TBinding Type-testTypeBuddyListADef = testGraphType "testTypeBuddyListA" $- T.forAll "a" $ T.record (ref testTypeBuddyListANameDef) [- "head">: T.var "a",- "tail">: T.optional $- T.apply (Core.typeVariable $ ref testTypeBuddyListBNameDef) (T.var "a")]--testTypeBuddyListANameDef :: TBinding Name-testTypeBuddyListANameDef = testGraphDefinition "testTypeBuddyListAName" $- name "BuddyListA"--testTypeBuddyListBDef :: TBinding Type-testTypeBuddyListBDef = testGraphType "testTypeBuddyListB" $- T.forAll "a" $ T.record (ref testTypeBuddyListBNameDef) [- "head">: T.var "a",- "tail">: T.optional $- T.apply (Core.typeVariable $ ref testTypeBuddyListANameDef) (T.var "a")]--testTypeBuddyListBNameDef :: TBinding Name-testTypeBuddyListBNameDef = testGraphDefinition "testTypeBuddyListBName" $- name "BuddyListB"--testTypeComparisonDef :: TBinding Type-testTypeComparisonDef = testGraphType "testTypeComparison" $- T.union (ref testTypeComparisonNameDef) [- "lessThan">: T.unit,- "equalTo">: T.unit,- "greaterThan">: T.unit]--testTypeComparisonNameDef :: TBinding Name-testTypeComparisonNameDef = testGraphDefinition "testTypeComparisonName" $- name "Comparison"--testTypeIntListDef :: TBinding Type-testTypeIntListDef = testGraphType "testTypeIntList" $- T.record (ref testTypeIntListNameDef) [- "head">: T.int32,- "tail">: T.optional $ Core.typeVariable (ref testTypeIntListNameDef)]--testTypeIntListNameDef :: TBinding Name-testTypeIntListNameDef = testGraphDefinition "testTypeIntListName" $- name "IntList"--testTypeHydraLiteralTypeDef :: TBinding Type-testTypeHydraLiteralTypeDef = testGraphType "testTypeHydraLiteralType" $- T.union (ref testTypeHydraLiteralTypeNameDef) [- "boolean">: T.boolean,- "string">: T.string]--testTypeHydraLiteralTypeNameDef :: TBinding Name-testTypeHydraLiteralTypeNameDef = testGraphDefinition "testTypeHydraLiteralTypeName" $- name "HydraLiteralType"--testTypeHydraTypeDef :: TBinding Type-testTypeHydraTypeDef = testGraphType "testTypeHydraType" $- T.union (ref testTypeHydraTypeNameDef) [- "literal">: Core.typeVariable $ ref testTypeHydraLiteralTypeNameDef,- "list">: Core.typeVariable $ ref testTypeHydraTypeNameDef]--testTypeHydraTypeNameDef :: TBinding Name-testTypeHydraTypeNameDef = testGraphDefinition "testTypeHydraTypeName" $- name "HydraType"--testTypeListDef :: TBinding Type-testTypeListDef = testGraphType "testTypeList" $- T.forAll "a" $ T.record (ref testTypeListNameDef) [- "head">: T.var "a",- "tail">: T.optional $- T.apply (Core.typeVariable $ ref testTypeListNameDef) (T.var "a")]--testTypeListNameDef :: TBinding Name-testTypeListNameDef = testGraphDefinition "testTypeListName" $- name "List"--testTypeNumberDef :: TBinding Type-testTypeNumberDef = testGraphType "testTypeNumber" $- T.union (ref testTypeNumberNameDef) [- "int">: T.int32,- "float">: T.float32]--testTypeNumberNameDef :: TBinding Name-testTypeNumberNameDef = testGraphDefinition "testTypeNumberName" $- name "Number"--testTypePersonDef :: TBinding Type-testTypePersonDef = testGraphType "testTypePerson" $- T.record (ref testTypePersonNameDef) [- "firstName">: T.string,- "lastName">: T.string,- "age">: T.int32]--testTypePersonNameDef :: TBinding Name-testTypePersonNameDef = testGraphDefinition "testTypePersonName" $- name "Person"--testTypePersonOrSomethingDef :: TBinding Type-testTypePersonOrSomethingDef = testGraphType "testTypePersonOrSomething" $- T.forAll "a" $ T.union (ref testTypePersonOrSomethingNameDef) [- "person">: Core.typeVariable $ ref testTypePersonNameDef,- "other">: T.var "a"]--testTypePersonOrSomethingNameDef :: TBinding Name-testTypePersonOrSomethingNameDef = testGraphDefinition "testTypePersonOrSomethingName" $- name "PersonOrSomething"--testTypeSimpleNumberDef :: TBinding Type-testTypeSimpleNumberDef = testGraphType "testTypeSimpleNumber" $- T.union (ref testTypeSimpleNumberNameDef) [- "int">: T.int32,- "float">: T.float32]--testTypeSimpleNumberNameDef :: TBinding Name-testTypeSimpleNumberNameDef = testGraphDefinition "testTypeSimpleNumberName" $- name "SimpleNumber"--testTypeTimestampDef :: TBinding Type-testTypeTimestampDef = testGraphType "testTypeTimestamp" $- T.union (ref testTypeTimestampNameDef) [- "unixTimeMillis">: T.uint64,- "date">: T.string]--testTypeTimestampNameDef :: TBinding Name-testTypeTimestampNameDef = testGraphDefinition "testTypeTimestampName" $- name "Timestamp"--testTypeUnionMonomorphicDef :: TBinding Type-testTypeUnionMonomorphicDef = testGraphType "testTypeUnionMonomorphic" $- T.union (ref testTypeUnionMonomorphicNameDef) [- "bool">: T.boolean,- "string">: T.string,- "unit">: T.unit]+ elements = [+ Phantoms.toBinding testTerms,+ Phantoms.toBinding testTypes,+ Phantoms.toBinding testNamespace,+ Phantoms.toBinding testSchemaNamespace] -testTypeUnionMonomorphicNameDef :: TBinding Name-testTypeUnionMonomorphicNameDef = testGraphDefinition "testTypeUnionMonomorphicName" $- name "UnionMonomorphic"+define :: String -> TTerm a -> TBinding a+define = definitionInModule module_ -testTypeUnionPolymorphicRecursiveDef :: TBinding Type-testTypeUnionPolymorphicRecursiveDef = testGraphType "testTypeUnionPolymorphicRecursive" $- T.forAll "a" $ T.union (ref testTypeUnionPolymorphicRecursiveNameDef) [- "bool">: T.boolean,- "value">: T.var "a",- "other">: T.apply (Core.typeVariable $ ref testTypeUnionPolymorphicRecursiveNameDef) (T.var "a")]+testTerms :: TBinding (M.Map Name Term)+testTerms = define "testTerms" $+ Maps.fromList $ Phantoms.list [+ Phantoms.pair (name "testDataArthur") TestTerms.testDataArthur] -testTypeUnionPolymorphicRecursiveNameDef :: TBinding Name-testTypeUnionPolymorphicRecursiveNameDef = testGraphDefinition "testTypeUnionPolymorphicRecursiveName" $- name "UnionPolymorphicRecursive"+testNamespace :: TBinding Namespace+testNamespace = define "testNamespace" $ DModule.namespace $ Phantoms.string "testGraph" -testTypeUnitDef :: TBinding Type-testTypeUnitDef = testGraphType "testTypeUnit" $- T.record (ref testTypeUnitNameDef) []+testTypes :: TBinding (M.Map Name Type)+testTypes = define "testTypes" $+ Maps.fromList $ Phantoms.list [+ Phantoms.pair TestTypes.testTypeBuddyListAName TestTypes.testTypeBuddyListA,+ Phantoms.pair TestTypes.testTypeBuddyListBName TestTypes.testTypeBuddyListB,+ Phantoms.pair TestTypes.testTypeComparisonName TestTypes.testTypeComparison,+ Phantoms.pair TestTypes.testTypeEitherName TestTypes.testTypeEither,+ Phantoms.pair TestTypes.testTypeFlowName TestTypes.testTypeFlow,+ Phantoms.pair TestTypes.testTypeFlowStateName TestTypes.testTypeFlowState,+ Phantoms.pair TestTypes.testTypeHydraLiteralTypeName TestTypes.testTypeHydraLiteralType,+ Phantoms.pair TestTypes.testTypeHydraTypeName TestTypes.testTypeHydraType,+ Phantoms.pair TestTypes.testTypeIntListName TestTypes.testTypeIntList,+ Phantoms.pair TestTypes.testTypeLatLonName TestTypes.testTypeLatLon,+ Phantoms.pair TestTypes.testTypeLatLonPolyName TestTypes.testTypeLatLonPoly,+ Phantoms.pair TestTypes.testTypeListName TestTypes.testTypeList,+ Phantoms.pair TestTypes.testTypeNumberName TestTypes.testTypeNumber,+ Phantoms.pair TestTypes.testTypePersonName TestTypes.testTypePerson,+ Phantoms.pair TestTypes.testTypePersonOrSomethingName TestTypes.testTypePersonOrSomething,+ Phantoms.pair TestTypes.testTypePolymorphicWrapperName TestTypes.testTypePolymorphicWrapper,+ Phantoms.pair TestTypes.testTypeSimpleNumberName TestTypes.testTypeSimpleNumber,+ Phantoms.pair TestTypes.testTypeStringAliasName TestTypes.testTypeStringAlias,+ Phantoms.pair TestTypes.testTypeSymmetricTripleName TestTypes.testTypeSymmetricTriple,+ Phantoms.pair TestTypes.testTypeTimestampName TestTypes.testTypeTimestamp,+ Phantoms.pair TestTypes.testTypeTraceName TestTypes.testTypeTrace,+ Phantoms.pair TestTypes.testTypeTripleName TestTypes.testTypeTriple,+ Phantoms.pair TestTypes.testTypeUnionMonomorphicName TestTypes.testTypeUnionMonomorphic,+ Phantoms.pair TestTypes.testTypeUnionPolymorphicRecursiveName TestTypes.testTypeUnionPolymorphicRecursive,+ Phantoms.pair TestTypes.testTypeUnitName TestTypes.testTypeUnit] -testTypeUnitNameDef :: TBinding Name-testTypeUnitNameDef = testGraphDefinition "testTypeUnitName" $- name "Unit"+testSchemaNamespace :: TBinding Namespace+testSchemaNamespace = define "testSchemaNamespace" $ DModule.namespace $ Phantoms.string "testSchemaGraph"
src/main/haskell/Hydra/Sources/Test/TestSuite.hs view
@@ -1,62 +1,143 @@-module Hydra.Sources.Test.TestSuite (testSuiteModule) where+-- | Complete test suite combining all Hydra test groups -import Hydra.Kernel-import Hydra.Testing-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Sources.Kernel.Terms.All-import Hydra.Dsl.Phantoms as Base-import Hydra.Dsl.Testing-import qualified Hydra.Dsl.TTerms as TTerms-import qualified Hydra.Sources.Kernel.Types.All as KernelTypes-import qualified Hydra.Sources.Kernel.Terms.All as Tier2+module Hydra.Sources.Test.TestSuite where -import Hydra.Sources.Test.Lib.Lists-import Hydra.Sources.Test.Lib.Strings-import Hydra.Sources.Test.Formatting-import Hydra.Sources.Test.Inference.InferenceSuite-import Hydra.Sources.Test.TestGraph+-- Standard imports for deep DSL tests (produces TTerm a with specific types)+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding ((++))+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M -import qualified Data.List as L+-- Test module imports+import qualified Hydra.Sources.Test.Lib.Chars as Chars+import qualified Hydra.Sources.Test.Lib.Eithers as Eithers+import qualified Hydra.Sources.Test.Lib.Equality as Equality+import qualified Hydra.Sources.Test.Lib.Flows as Flows+import qualified Hydra.Sources.Test.Lib.Lists as Lists+import qualified Hydra.Sources.Test.Lib.Literals as Literals+import qualified Hydra.Sources.Test.Lib.Logic as Logic+import qualified Hydra.Sources.Test.Lib.Maps as Maps+import qualified Hydra.Sources.Test.Lib.Math as Math+import qualified Hydra.Sources.Test.Lib.Maybes as Maybes+import qualified Hydra.Sources.Test.Annotations as Annotations+import qualified Hydra.Sources.Test.Ordering as Ordering+import qualified Hydra.Sources.Test.Monads as Monads+import qualified Hydra.Sources.Test.Lib.Pairs as Pairs+import qualified Hydra.Sources.Test.Lib.Sets as Sets+import qualified Hydra.Sources.Test.Lib.Strings as Strings+import qualified Hydra.Sources.Test.Checking.All as CheckingAll+import qualified Hydra.Sources.Test.Checking.Advanced as CheckingAdvanced+import qualified Hydra.Sources.Test.Checking.AlgebraicTypes as CheckingAlgebraicTypes+import qualified Hydra.Sources.Test.Checking.Collections as CheckingCollections+import qualified Hydra.Sources.Test.Checking.Failures as CheckingFailures+import qualified Hydra.Sources.Test.Checking.Fundamentals as CheckingFundamentals+import qualified Hydra.Sources.Test.Checking.NominalTypes as CheckingNominalTypes+import qualified Hydra.Sources.Test.EtaExpansion as EtaExpansion+import qualified Hydra.Sources.Test.Formatting as Formatting+import qualified Hydra.Sources.Test.Inference.All as InferenceAll+import qualified Hydra.Sources.Test.Inference.AlgebraicTypes as InferenceAlgebraicTypes+import qualified Hydra.Sources.Test.Inference.AlgorithmW as InferenceAlgorithmW+import qualified Hydra.Sources.Test.Inference.Failures as InferenceFailures+import qualified Hydra.Sources.Test.Inference.Fundamentals as InferenceFundamentals+import qualified Hydra.Sources.Test.Inference.KernelExamples as InferenceKernelExamples+import qualified Hydra.Sources.Test.Inference.NominalTypes as InferenceNominalTypes+import qualified Hydra.Sources.Test.Json.Coder as JsonCoder+import qualified Hydra.Sources.Test.Json.Parser as JsonParser+import qualified Hydra.Sources.Test.Json.Roundtrip as JsonRoundtrip+import qualified Hydra.Sources.Test.Json.Writer as JsonWriter+import qualified Hydra.Sources.Test.Hoisting as Hoisting+import qualified Hydra.Sources.Test.Reduction as Reduction+import qualified Hydra.Sources.Test.Rewriting as Rewriting+import qualified Hydra.Sources.Test.Serialization as Serialization+import qualified Hydra.Sources.Test.Sorting as Sorting+import qualified Hydra.Sources.Test.Substitution as Substitution+import qualified Hydra.Sources.Test.Unification as Unification -testSuiteNs = Namespace "hydra.test.testSuite"-testSuitePrimitivesNs = Namespace "hydra.test.testSuite.primitives"+ns :: Namespace+ns = Namespace "hydra.test.testSuite" -testSuiteModule :: Module-testSuiteModule = Module testSuiteNs elements- [testGraphModule]- KernelTypes.kernelTypesModules $- Just "Test cases for primitive functions"+module_ :: Module+module_ = Module ns elements namespaces kernelTypesNamespaces $+ Just ("Hydra's common test suite, which is designed to run identically in each Hydra implementation;"+ <> " the criterion for a true Hydra implementation is that all test cases pass.") where- elements = [- allTestsEl,- formattingTestsEl,- inferenceTestsEl,- listPrimitiveTestsEl,- primitiveTestsEl,- stringPrimitiveTestsEl]+ elements = [Phantoms.toBinding allTests]+ namespaces = fst <$> testPairs -allTestsEl :: Binding-allTestsEl = encodedTestGroupToBinding testSuiteNs "allTests" $ tgroup "All tests" Nothing subgroups []+allTests :: TBinding TestGroup+allTests = definitionInModule module_ "allTests" $+ doc "The group of all common tests" $+ Testing.testGroup (string "common") nothing (list subgroups) (list ([] :: [TTerm TestCaseWithMetadata])) where- subgroups = fmap groupRef [- formattingTestsEl,- inferenceTestsEl,- primitiveTestsEl]--formattingTestsEl = testGroupToBinding testSuiteNs "formattingTests" formattingTests--inferenceTestsEl = encodedTestGroupToBinding testSuiteNs "inferenceTests" inferenceTests+ subgroups = snd <$> testPairs -listPrimitiveTestsEl = testGroupToBinding testSuiteNs "listPrimitiveTests" listPrimitiveTests+libPairs :: [(Namespace, TBinding TestGroup)]+libPairs = [+ (Chars.ns, Chars.allTests),+ (Eithers.ns, Eithers.allTests),+ (Equality.ns, Equality.allTests),+ (Flows.ns, Flows.allTests),+ (Lists.ns, Lists.allTests),+ (Literals.ns, Literals.allTests),+ (Logic.ns, Logic.allTests),+ (Maps.ns, Maps.allTests),+ (Math.ns, Math.allTests),+ (Maybes.ns, Maybes.allTests),+ (Pairs.ns, Pairs.allTests),+ (Sets.ns, Sets.allTests),+ (Strings.ns, Strings.allTests)] -primitiveTestsEl = encodedTestGroupToBinding testSuiteNs "primitiveTests" $- tgroup "Primitive functions" (Just "Test cases for primitive functions") primGroups []- where- primGroups = fmap groupRef [- listPrimitiveTestsEl,- stringPrimitiveTestsEl]+otherPairs :: [(Namespace, TBinding TestGroup)]+otherPairs = [+ (Annotations.ns, Annotations.allTests),+ (CheckingAll.ns, CheckingAll.allTests),+ (EtaExpansion.ns, EtaExpansion.allTests),+ (Formatting.ns, Formatting.allTests),+ (Hoisting.ns, Hoisting.allTests),+ (InferenceAll.ns, InferenceAll.allTests),+ (JsonCoder.ns, JsonCoder.allTests),+ (JsonParser.ns, JsonParser.allTests),+ (JsonRoundtrip.ns, JsonRoundtrip.allTests),+ (JsonWriter.ns, JsonWriter.allTests),+ (Monads.ns, Monads.allTests),+ -- TODO: (Ordering.ns, Ordering.allTests) temporarily removed - needs investigation+ (Reduction.ns, Reduction.allTests),+ (Rewriting.ns, Rewriting.allTests),+ (Serialization.ns, Serialization.allTests),+ (Sorting.ns, Sorting.allTests),+ (Substitution.ns, Substitution.allTests),+ (Unification.ns, Unification.allTests)] -stringPrimitiveTestsEl = testGroupToBinding testSuiteNs "stringPrimitiveTests" stringPrimitiveTests+testPairs :: [(Namespace, TBinding TestGroup)]+testPairs = libPairs ++ otherPairs +-- | All test suite modules (the actual Module values)+testSuiteModules :: [Module]+testSuiteModules =+ -- Lib tests+ [Chars.module_, Eithers.module_, Equality.module_, Flows.module_,+ Lists.module_, Literals.module_, Logic.module_, Maps.module_,+ Math.module_, Maybes.module_, Pairs.module_, Sets.module_, Strings.module_,+ -- Other tests+ Annotations.module_, EtaExpansion.module_, Formatting.module_, Hoisting.module_,+ JsonCoder.module_, JsonParser.module_, JsonRoundtrip.module_, JsonWriter.module_,+ Monads.module_, Reduction.module_, Rewriting.module_, Serialization.module_, Sorting.module_,+ -- TODO: Ordering.module_ temporarily removed - needs investigation+ -- Checking tests (including sub-modules)+ CheckingAll.module_,+ CheckingAdvanced.module_, CheckingAlgebraicTypes.module_, CheckingCollections.module_,+ CheckingFailures.module_, CheckingFundamentals.module_, CheckingNominalTypes.module_,+ -- Inference tests (including sub-modules)+ InferenceAll.module_,+ InferenceAlgebraicTypes.module_, InferenceAlgorithmW.module_, InferenceFailures.module_,+ InferenceFundamentals.module_, InferenceKernelExamples.module_, InferenceNominalTypes.module_,+ -- Substitution and unification tests+ Substitution.module_, Unification.module_]
+ src/main/haskell/Hydra/Sources/Test/TestTerms.hs view
@@ -0,0 +1,65 @@+module Hydra.Sources.Test.TestTerms where++import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import qualified Hydra.Dsl.Meta.Module as DModule+import Prelude hiding ((++))+++-- Type alias to avoid confusion with DSL Module+type HydraModule = Module++ns :: Namespace+ns = Namespace "hydra.test.testTerms"++module_ :: HydraModule+module_ = Module ns elements+ [TestTypes.ns]+ []+ (Just "Term definitions for the test suite")+ where+ elements = [+ Phantoms.toBinding latlonRecord,+ Phantoms.toBinding testDataArthur,+ Phantoms.toBinding testElementArthur,+ Phantoms.toBinding testElementFirstName]++defineTerm :: String -> TTerm a -> TBinding a+defineTerm = definitionInModule module_++latlonRecord :: TBinding (Float -> Float -> Term)+latlonRecord = defineTerm "latlonRecord" $+ Phantoms.lambdas ["lat", "lon"] $ record TestTypes.testTypeLatLonName [+ "lat">: float32Lift $ varPhantom "lat",+ "lon">: float32Lift $ varPhantom "lon"]++testDataArthur :: TBinding Term+testDataArthur = defineTerm "testDataArthur" $+ record TestTypes.testTypePersonName [+ "firstName">: string "Arthur",+ "lastName">: string "Dent",+ "age">: int32 42]++testElementArthur :: TBinding Binding+testElementArthur = defineTerm "testElementArthur" $+ Core.binding+ (name "firstName")+ testDataArthur+ (Phantoms.just $ Core.typeScheme (Phantoms.list ([] :: [TTerm Name])) (Core.typeVariable TestTypes.testTypePersonName) Phantoms.nothing)++testElementFirstName :: TBinding Binding+testElementFirstName = defineTerm "testElementFirstName" $+ Core.binding+ (name "firstName")+ (project TestTypes.testTypePersonName (name "firstName"))+ (Phantoms.just $ Core.typeScheme (Phantoms.list ([] :: [TTerm Name]))+ (Core.typeFunction $ Core.functionType (Core.typeVariable TestTypes.testTypePersonName) T.string) Phantoms.nothing)
+ src/main/haskell/Hydra/Sources/Test/TestTypes.hs view
@@ -0,0 +1,439 @@+module Hydra.Sources.Test.TestTypes where++import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Phantoms as Phantoms hiding ((++), (>:))+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Types as T+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Dsl.Meta.Base (name, (>:))+import qualified Hydra.Dsl.Meta.Module as DModule+import qualified Hydra.Dsl.Types as Types+import Prelude hiding ((++))+++ns :: Namespace+ns = Namespace "hydra.test.testTypes"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Type definitions for the test suite")+ where+ elements = [+ toBinding testTypeBuddyListA,+ toBinding testTypeBuddyListAName,+ toBinding testTypeBuddyListB,+ toBinding testTypeBuddyListBName,+ toBinding testTypeComparison,+ toBinding testTypeComparisonName,+ toBinding testTypeEither,+ toBinding testTypeEitherName,+ toBinding testTypeFlow,+ toBinding testTypeFlowName,+ toBinding testTypeFlowState,+ toBinding testTypeFlowStateName,+ toBinding testTypeHydraLiteralType,+ toBinding testTypeHydraLiteralTypeName,+ toBinding testTypeHydraType,+ toBinding testTypeHydraTypeName,+ toBinding testTypeIntList,+ toBinding testTypeIntListName,+ toBinding testTypeLatLon,+ toBinding testTypeLatLonName,+ toBinding testTypeLatLonPoly,+ toBinding testTypeLatLonPolyName,+ toBinding testTypeList,+ toBinding testTypeListName,+ toBinding testTypeNumber,+ toBinding testTypeNumberName,+ toBinding testTypePerson,+ toBinding testTypePersonName,+ toBinding testTypePersonOrSomething,+ toBinding testTypePersonOrSomethingName,+ toBinding testTypePolymorphicWrapper,+ toBinding testTypePolymorphicWrapperName,+ toBinding testTypeSimpleNumber,+ toBinding testTypeSimpleNumberName,+ toBinding testTypeStringAlias,+ toBinding testTypeStringAliasName,+ toBinding testTypeSymmetricTriple,+ toBinding testTypeSymmetricTripleName,+ toBinding testTypeTimestamp,+ toBinding testTypeTimestampName,+ toBinding testTypeTrace,+ toBinding testTypeTraceName,+ toBinding testTypeTriple,+ toBinding testTypeTripleName,+ toBinding testTypeUnionMonomorphic,+ toBinding testTypeUnionMonomorphicName,+ toBinding testTypeUnionPolymorphicRecursive,+ toBinding testTypeUnionPolymorphicRecursiveName,+ toBinding testTypeUnit,+ toBinding testTypeUnitName,+ -- Additional utility types+ toBinding concatType,+ toBinding compareStringsType,+ toBinding eitherStringOrInt8TypeName,+ toBinding eitherStringOrInt8Type,+ toBinding exampleProjectionType,+ toBinding listOfInt8sType,+ toBinding listOfInt16sType,+ toBinding listOfListsOfStringsType,+ toBinding listOfSetOfStringsType,+ toBinding listOfStringsType,+ toBinding mapOfStringsToIntsType,+ toBinding optionalInt8Type,+ toBinding optionalInt16Type,+ toBinding optionalStringType,+ toBinding setOfStringsType,+ toBinding stringOrIntName,+ toBinding stringOrIntType,+ toBinding testTypeName]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++defineType :: String -> TTerm Type -> TBinding Type+defineType name = define name . firstClassType++-- Helper to create fully qualified names within this module+testTypesName :: String -> TTerm Name+--testTypesName localName = name $ "test." <> localName -- TODO: restore the test namespace, which is distinct from the test sources namespace. There are still tests with raw references to test types, e.g. (var "Person").+testTypesName localName = name localName++-- Type name definitions+testTypeBuddyListAName :: TBinding Name+testTypeBuddyListAName = define "testTypeBuddyListAName" $+ testTypesName "BuddyListA"++testTypeBuddyListBName :: TBinding Name+testTypeBuddyListBName = define "testTypeBuddyListBName" $+ testTypesName "BuddyListB"++testTypeComparisonName :: TBinding Name+testTypeComparisonName = define "testTypeComparisonName" $+ testTypesName "Comparison"++testTypeEitherName :: TBinding Name+testTypeEitherName = define "testTypeEitherName" $+ testTypesName "Either"++testTypeFlowName :: TBinding Name+testTypeFlowName = define "testTypeFlowName" $+ name "hydra.compute.Flow"++testTypeFlowStateName :: TBinding Name+testTypeFlowStateName = define "testTypeFlowStateName" $+ name "hydra.compute.FlowState"++testTypeHydraLiteralTypeName :: TBinding Name+testTypeHydraLiteralTypeName = define "testTypeHydraLiteralTypeName" $+ testTypesName "HydraLiteralType"++testTypeHydraTypeName :: TBinding Name+testTypeHydraTypeName = define "testTypeHydraTypeName" $+ testTypesName "HydraType"++testTypeIntListName :: TBinding Name+testTypeIntListName = define "testTypeIntListName" $+ testTypesName "IntList"++testTypeLatLonName :: TBinding Name+testTypeLatLonName = define "testTypeLatLonName" $+ testTypesName "LatLon"++testTypeLatLonPolyName :: TBinding Name+testTypeLatLonPolyName = define "testTypeLatLonPolyName" $+ testTypesName "LatLonPoly"++testTypeListName :: TBinding Name+testTypeListName = define "testTypeListName" $+ testTypesName "List"++testTypeNumberName :: TBinding Name+testTypeNumberName = define "testTypeNumberName" $+ testTypesName "Number"++testTypePersonName :: TBinding Name+testTypePersonName = define "testTypePersonName" $+ testTypesName "Person"++testTypePersonOrSomethingName :: TBinding Name+testTypePersonOrSomethingName = define "testTypePersonOrSomethingName" $+ testTypesName "PersonOrSomething"++testTypePolymorphicWrapperName :: TBinding Name+testTypePolymorphicWrapperName = define "testTypePolymorphicWrapperName" $+ testTypesName "PolymorphicWrapper"++testTypeSimpleNumberName :: TBinding Name+testTypeSimpleNumberName = define "testTypeSimpleNumberName" $+ testTypesName "SimpleNumber"++testTypeStringAliasName :: TBinding Name+testTypeStringAliasName = define "testTypeStringAliasName" $+ testTypesName "StringAlias"++testTypeSymmetricTripleName :: TBinding Name+testTypeSymmetricTripleName = define "testTypeSymmetricTripleName" $+ testTypesName "SymmetricTriple"++testTypeTimestampName :: TBinding Name+testTypeTimestampName = define "testTypeTimestampName" $+ testTypesName "Timestamp"++testTypeTraceName :: TBinding Name+testTypeTraceName = define "testTypeTraceName" $+ name "hydra.compute.Trace"++testTypeTripleName :: TBinding Name+testTypeTripleName = define "testTypeTripleName" $+ testTypesName "Triple"++testTypeUnionMonomorphicName :: TBinding Name+testTypeUnionMonomorphicName = define "testTypeUnionMonomorphicName" $+ testTypesName "UnionMonomorphic"++testTypeUnionPolymorphicRecursiveName :: TBinding Name+testTypeUnionPolymorphicRecursiveName = define "testTypeUnionPolymorphicRecursiveName" $+ testTypesName "UnionPolymorphicRecursive"++testTypeUnitName :: TBinding Name+testTypeUnitName = define "testTypeUnitName" $+ testTypesName "Unit"++-- Type definitions+testTypeBuddyListA :: TBinding Type+testTypeBuddyListA = defineType "testTypeBuddyListA" $+ T.forAll "a" $ T.record (testTypeBuddyListAName) [+ "head">: T.variable "a",+ "tail">: T.maybe $+ T.apply (Core.typeVariable $ testTypeBuddyListBName) (T.variable "a")]++testTypeBuddyListB :: TBinding Type+testTypeBuddyListB = defineType "testTypeBuddyListB" $+ T.forAll "a" $ T.record (testTypeBuddyListBName) [+ "head">: T.variable "a",+ "tail">: T.maybe $+ T.apply (Core.typeVariable $ testTypeBuddyListAName) (T.variable "a")]++testTypeComparison :: TBinding Type+testTypeComparison = defineType "testTypeComparison" $+ T.union (testTypeComparisonName) [+ "lessThan">: T.unit,+ "equalTo">: T.unit,+ "greaterThan">: T.unit]++testTypeEither :: TBinding Type+testTypeEither = defineType "testTypeEither" $+ T.forAll "a" $ T.forAll "b" $ T.union testTypeEitherName [+ "left">: T.variable "a",+ "right">: T.variable "b"]++testTypeFlow :: TBinding Type+testTypeFlow = defineType "testTypeFlow" $+ T.forAll "s" $ T.forAll "a" $ T.record testTypeFlowName [+ "value">: T.function (T.variable "s") (T.apply (T.apply (Core.typeVariable testTypeFlowStateName) (T.variable "s")) (T.variable "a"))]++testTypeFlowState :: TBinding Type+testTypeFlowState = defineType "testTypeFlowState" $+ T.forAll "s" $ T.forAll "a" $ T.record testTypeFlowStateName [+ "value">: T.maybe (T.variable "a"),+ "state">: T.variable "s",+ "trace">: Core.typeVariable testTypeTraceName]++testTypeHydraLiteralType :: TBinding Type+testTypeHydraLiteralType = defineType "testTypeHydraLiteralType" $+ T.union testTypeHydraLiteralTypeName [+ "boolean">: T.boolean,+ "string">: T.string]++testTypeHydraType :: TBinding Type+testTypeHydraType = defineType "testTypeHydraType" $+ T.union testTypeHydraTypeName [+ "literal">: Core.typeVariable testTypeHydraLiteralTypeName,+ "list">: Core.typeVariable testTypeHydraTypeName]++testTypeIntList :: TBinding Type+testTypeIntList = defineType "testTypeIntList" $+ T.record testTypeIntListName [+ "head">: T.int32,+ "tail">: T.maybe $ Core.typeVariable testTypeIntListName]++testTypeLatLon :: TBinding Type+testTypeLatLon = defineType "testTypeLatLon" $+ T.record testTypeLatLonName [+ "lat">: T.float32,+ "lon">: T.float32]++testTypeLatLonPoly :: TBinding Type+testTypeLatLonPoly = defineType "testTypeLatLonPoly" $+ T.forAll "a" $ T.record testTypeLatLonPolyName [+ "lat">: T.variable "a",+ "lon">: T.variable "a"]++testTypeList :: TBinding Type+testTypeList = defineType "testTypeList" $+ T.forAll "a" $ T.record testTypeListName [+ "head">: T.variable "a",+ "tail">: T.maybe $+ T.apply (Core.typeVariable testTypeListName) (T.variable "a")]++testTypeNumber :: TBinding Type+testTypeNumber = defineType "testTypeNumber" $+ T.union testTypeNumberName [+ "int">: T.int32,+ "float">: T.float32]++testTypePerson :: TBinding Type+testTypePerson = defineType "testTypePerson" $+ T.record testTypePersonName [+ "firstName">: T.string,+ "lastName">: T.string,+ "age">: T.int32]++testTypePersonOrSomething :: TBinding Type+testTypePersonOrSomething = defineType "testTypePersonOrSomething" $+ T.forAll "a" $ T.union testTypePersonOrSomethingName [+ "person">: Core.typeVariable testTypePersonName,+ "other">: T.variable "a"]++testTypePolymorphicWrapper :: TBinding Type+testTypePolymorphicWrapper = defineType "testTypePolymorphicWrapper" $+ T.forAll "a" $ Core.typeWrap $ Core.wrappedType testTypePolymorphicWrapperName (T.list $ T.variable "a")++testTypeSimpleNumber :: TBinding Type+testTypeSimpleNumber = defineType "testTypeSimpleNumber" $+ T.union testTypeSimpleNumberName [+ "int">: T.int32,+ "float">: T.float32]++testTypeStringAlias :: TBinding Type+testTypeStringAlias = defineType "testTypeStringAlias" $+ Core.typeWrap $ Core.wrappedType testTypeStringAliasName T.string++testTypeSymmetricTriple :: TBinding Type+testTypeSymmetricTriple = defineType "testTypeSymmetricTriple" $+ T.forAlls ["v", "e"] $ T.wrap testTypeSymmetricTripleName $+ T.applys (Core.typeVariable testTypeTripleName) [T.variable "v", T.variable "e", T.variable "v"]++testTypeTimestamp :: TBinding Type+testTypeTimestamp = defineType "testTypeTimestamp" $+ T.union testTypeTimestampName [+ "unixTimeMillis">: T.uint64,+ "date">: T.string]++testTypeTrace :: TBinding Type+testTypeTrace = defineType "testTypeTrace" $+ T.record testTypeTraceName [+ "stack">: T.list T.string,+ "messages">: T.list T.string,+ "other">: T.map T.string T.string]++testTypeTriple :: TBinding Type+testTypeTriple = defineType "testTypeTriple" $+ T.forAll "a" $ T.forAll "b" $ T.forAll "c" $ T.record testTypeTripleName [+ "first">: T.variable "a",+ "second">: T.variable "b",+ "third">: T.variable "c"]++testTypeUnionMonomorphic :: TBinding Type+testTypeUnionMonomorphic = defineType "testTypeUnionMonomorphic" $+ T.union testTypeUnionMonomorphicName [+ "bool">: T.boolean,+ "string">: T.string,+ "unit">: T.unit]++testTypeUnionPolymorphicRecursive :: TBinding Type+testTypeUnionPolymorphicRecursive = defineType "testTypeUnionPolymorphicRecursive" $+ T.forAll "a" $ T.union testTypeUnionPolymorphicRecursiveName [+ "bool">: T.boolean,+ "value">: T.variable "a",+ "other">: T.apply (Core.typeVariable testTypeUnionPolymorphicRecursiveName) (T.variable "a")]++testTypeUnit :: TBinding Type+testTypeUnit = defineType "testTypeUnit" $+ T.record testTypeUnitName []++-- Additional type utilities for tests++concatType :: TBinding Type+concatType = defineType "concatType" $+ T.function T.string $ T.function T.string T.string++compareStringsType :: TBinding Type+compareStringsType = defineType "compareStringsType" $+ T.function T.string T.string++eitherStringOrInt8TypeName :: TBinding Name+eitherStringOrInt8TypeName = define "eitherStringOrInt8TypeName" $+ testTypesName "EitherStringOrInt8"++eitherStringOrInt8Type :: TBinding Type+eitherStringOrInt8Type = defineType "eitherStringOrInt8Type" $+ T.union eitherStringOrInt8TypeName [+ "left">: T.string,+ "right">: Core.typeLiteral $ Core.literalTypeInteger Core.integerTypeInt8]++exampleProjectionType :: TBinding Type+exampleProjectionType = defineType "exampleProjectionType" $+ T.function (Core.typeVariable testTypePersonName) T.string++listOfInt8sType :: TBinding Type+listOfInt8sType = defineType "listOfInt8sType" $+ T.list (Core.typeLiteral $ Core.literalTypeInteger Core.integerTypeInt8)++listOfInt16sType :: TBinding Type+listOfInt16sType = defineType "listOfInt16sType" $+ T.list T.int16++listOfListsOfStringsType :: TBinding Type+listOfListsOfStringsType = defineType "listOfListsOfStringsType" $+ T.list $ T.list T.string++listOfSetOfStringsType :: TBinding Type+listOfSetOfStringsType = defineType "listOfSetOfStringsType" $+ T.list $ T.set T.string++listOfStringsType :: TBinding Type+listOfStringsType = defineType "listOfStringsType" $+ T.list T.string++mapOfStringsToIntsType :: TBinding Type+mapOfStringsToIntsType = defineType "mapOfStringsToIntsType" $+ T.map T.string T.int32++optionalInt8Type :: TBinding Type+optionalInt8Type = defineType "optionalInt8Type" $+ T.maybe (Core.typeLiteral $ Core.literalTypeInteger Core.integerTypeInt8)++optionalInt16Type :: TBinding Type+optionalInt16Type = defineType "optionalInt16Type" $+ T.maybe T.int16++optionalStringType :: TBinding Type+optionalStringType = defineType "optionalStringType" $+ T.maybe T.string++setOfStringsType :: TBinding Type+setOfStringsType = defineType "setOfStringsType" $+ T.set T.string++stringOrIntName :: TBinding Name+stringOrIntName = define "stringOrIntName" $+ testTypesName "StringOrInt"++stringOrIntType :: TBinding Type+stringOrIntType = defineType "stringOrIntType" $+ T.union stringOrIntName [+ "left">: T.string,+ "right">: T.int32]++testTypeName :: TBinding Name+testTypeName = define "testTypeName" $+ testTypesName "Test"
+ src/main/haskell/Hydra/Sources/Test/Unification.hs view
@@ -0,0 +1,415 @@+-- | Test cases for type unification operations+module Hydra.Sources.Test.Unification where++-- Standard imports for shallow DSL tests+import Hydra.Kernel+import Hydra.Dsl.Meta.Testing as Testing+import Hydra.Dsl.Meta.Terms as Terms+import Hydra.Sources.Kernel.Types.All+import qualified Hydra.Dsl.Meta.Core as Core+import qualified Hydra.Dsl.Meta.Phantoms as Phantoms+import qualified Hydra.Dsl.Meta.Types as T+import qualified Hydra.Sources.Test.TestGraph as TestGraph+import qualified Hydra.Sources.Test.TestTerms as TestTerms+import qualified Hydra.Sources.Test.TestTypes as TestTypes+import qualified Data.List as L+import qualified Data.Map as M++import Hydra.Testing+++ns :: Namespace+ns = Namespace "hydra.test.unification"++module_ :: Module+module_ = Module ns elements+ []+ kernelTypesNamespaces+ (Just "Test cases for type unification operations")+ where+ elements = [Phantoms.toBinding allTests]++define :: String -> TTerm a -> TBinding a+define = definitionInModule module_++-- Helper to build names+nm :: String -> TTerm Name+nm s = Core.name $ Phantoms.string s++-- ============================================================+-- variableOccursInType tests+-- ============================================================++variableOccursInTypeTests :: TTerm TestGroup+variableOccursInTypeTests = subgroup "variableOccursInType" [+ -- Variable occurs in itself+ variableOccursCase "variable occurs in itself"+ (nm "a")+ (T.var "a")+ Phantoms.true,++ -- Variable does not occur in different variable+ variableOccursCase "variable does not occur in different variable"+ (nm "a")+ (T.var "b")+ Phantoms.false,++ -- Variable does not occur in primitive type+ variableOccursCase "variable does not occur in int32"+ (nm "a")+ T.int32+ Phantoms.false,++ variableOccursCase "variable does not occur in string"+ (nm "a")+ T.string+ Phantoms.false,++ -- Variable occurs in list type+ variableOccursCase "variable occurs in list element type"+ (nm "a")+ (T.list (T.var "a"))+ Phantoms.true,++ variableOccursCase "variable does not occur in list of different type"+ (nm "a")+ (T.list (T.var "b"))+ Phantoms.false,++ -- Variable occurs in function type+ variableOccursCase "variable occurs in function domain"+ (nm "a")+ (T.function (T.var "a") T.int32)+ Phantoms.true,++ variableOccursCase "variable occurs in function codomain"+ (nm "a")+ (T.function T.int32 (T.var "a"))+ Phantoms.true,++ variableOccursCase "variable does not occur in function with different vars"+ (nm "a")+ (T.function (T.var "b") (T.var "c"))+ Phantoms.false,++ -- Variable occurs in optional type+ variableOccursCase "variable occurs in optional type"+ (nm "a")+ (T.optional (T.var "a"))+ Phantoms.true,++ -- Variable occurs in pair type+ variableOccursCase "variable occurs in pair first"+ (nm "a")+ (T.pair (T.var "a") T.int32)+ Phantoms.true,++ variableOccursCase "variable occurs in pair second"+ (nm "a")+ (T.pair T.int32 (T.var "a"))+ Phantoms.true,++ -- Variable occurs in either type+ variableOccursCase "variable occurs in either left"+ (nm "a")+ (T.either_ (T.var "a") T.int32)+ Phantoms.true,++ variableOccursCase "variable occurs in either right"+ (nm "a")+ (T.either_ T.int32 (T.var "a"))+ Phantoms.true,++ -- Variable occurs in map type+ variableOccursCase "variable occurs in map key type"+ (nm "a")+ (T.map (T.var "a") T.int32)+ Phantoms.true,++ variableOccursCase "variable occurs in map value type"+ (nm "a")+ (T.map T.string (T.var "a"))+ Phantoms.true,++ -- Variable occurs in set type+ variableOccursCase "variable occurs in set type"+ (nm "a")+ (T.set (T.var "a"))+ Phantoms.true,++ -- Nested structures+ variableOccursCase "variable occurs in nested list"+ (nm "a")+ (T.list (T.list (T.var "a")))+ Phantoms.true,++ variableOccursCase "variable occurs in list of functions"+ (nm "a")+ (T.list (T.function T.int32 (T.var "a")))+ Phantoms.true,++ variableOccursCase "variable does not occur in complex type without it"+ (nm "a")+ (T.function (T.list T.int32) (T.optional (T.pair T.string (T.var "b"))))+ Phantoms.false,++ variableOccursCase "variable occurs deep in complex type"+ (nm "a")+ (T.function (T.list T.int32) (T.optional (T.pair T.string (T.var "a"))))+ Phantoms.true,++ -- Forall types (note: no distinction between free and bound)+ variableOccursCase "variable occurs in forAll body"+ (nm "a")+ (T.forAll "b" (T.function (T.var "b") (T.var "a")))+ Phantoms.true,++ variableOccursCase "variable occurs in forAll bound position"+ (nm "a")+ (T.forAll "a" (T.function (T.var "a") (T.var "a")))+ Phantoms.true]++-- ============================================================+-- unifyTypes tests+-- ============================================================++-- Helper: empty schema types list+noSchema :: TTerm [Name]+noSchema = Phantoms.list ([] :: [TTerm Name])++-- Helper: empty substitution (success with no bindings)+emptySubst :: [(TTerm Name, TTerm Type)]+emptySubst = []++unifyTypesTests :: TTerm TestGroup+unifyTypesTests = subgroup "unifyTypes" [+ -- Identical types unify with empty substitution+ unifyTypesCase "unify identical int32 types"+ noSchema+ T.int32+ T.int32+ emptySubst,++ unifyTypesCase "unify identical string types"+ noSchema+ T.string+ T.string+ emptySubst,++ unifyTypesCase "unify identical variable types"+ noSchema+ (T.var "a")+ (T.var "a")+ emptySubst,++ -- Variable unifies with concrete type+ unifyTypesCase "unify variable with int32"+ noSchema+ (T.var "a")+ T.int32+ [(nm "a", T.int32)],++ unifyTypesCase "unify int32 with variable"+ noSchema+ T.int32+ (T.var "a")+ [(nm "a", T.int32)],++ -- Variable unifies with variable (binding one to the other)+ unifyTypesCase "unify two different variables"+ noSchema+ (T.var "a")+ (T.var "b")+ [(nm "a", T.var "b")],++ -- List types unify element types+ unifyTypesCase "unify list of variables with list of int32"+ noSchema+ (T.list (T.var "a"))+ (T.list T.int32)+ [(nm "a", T.int32)],++ unifyTypesCase "unify identical list types"+ noSchema+ (T.list T.string)+ (T.list T.string)+ emptySubst,++ -- Function types unify domains and codomains+ unifyTypesCase "unify function types with variables"+ noSchema+ (T.function (T.var "a") (T.var "b"))+ (T.function T.int32 T.string)+ [(nm "a", T.int32), (nm "b", T.string)],++ unifyTypesCase "unify identical function types"+ noSchema+ (T.function T.int32 T.string)+ (T.function T.int32 T.string)+ emptySubst,++ -- Optional types+ unifyTypesCase "unify optional types"+ noSchema+ (T.optional (T.var "a"))+ (T.optional T.int32)+ [(nm "a", T.int32)],++ -- Pair types+ unifyTypesCase "unify pair types"+ noSchema+ (T.pair (T.var "a") (T.var "b"))+ (T.pair T.int32 T.string)+ [(nm "a", T.int32), (nm "b", T.string)],++ -- Either types+ unifyTypesCase "unify either types"+ noSchema+ (T.either_ (T.var "a") (T.var "b"))+ (T.either_ T.int32 T.string)+ [(nm "a", T.int32), (nm "b", T.string)],++ -- Map types+ unifyTypesCase "unify map types"+ noSchema+ (T.map (T.var "k") (T.var "v"))+ (T.map T.string T.int32)+ [(nm "k", T.string), (nm "v", T.int32)],++ -- Set types+ unifyTypesCase "unify set types"+ noSchema+ (T.set (T.var "a"))+ (T.set T.int32)+ [(nm "a", T.int32)],++ -- Unit types+ unifyTypesCase "unify unit types"+ noSchema+ T.unit+ T.unit+ emptySubst,++ -- Failure cases+ unifyTypesFailCase "fail to unify int32 with string"+ noSchema+ T.int32+ T.string+ "cannot unify",++ unifyTypesFailCase "fail to unify list with function"+ noSchema+ (T.list T.int32)+ (T.function T.int32 T.int32)+ "cannot unify",++ -- Occur check failure+ unifyTypesFailCase "occur check: variable with list containing it"+ noSchema+ (T.var "a")+ (T.list (T.var "a"))+ "appears free"]++-- ============================================================+-- joinTypes tests+-- ============================================================++-- Helper to create type constraints+constraint :: TTerm Type -> TTerm Type -> TTerm TypeConstraint+constraint left right = Phantoms.record _TypeConstraint [+ Phantoms.field _TypeConstraint_left left,+ Phantoms.field _TypeConstraint_right right,+ Phantoms.field _TypeConstraint_comment (Phantoms.string "join types; test")]++-- Helper for empty constraint list+noConstraints :: TTerm [TypeConstraint]+noConstraints = Phantoms.list ([] :: [TTerm TypeConstraint])++joinTypesTests :: TTerm TestGroup+joinTypesTests = subgroup "joinTypes" [+ -- Identical primitive types produce no constraints+ joinTypesCase "join identical int32"+ T.int32+ T.int32+ noConstraints,++ joinTypesCase "join identical string"+ T.string+ T.string+ noConstraints,++ -- Note: joinTypes doesn't handle type variables directly - those are handled by unifyTypeConstraints.+ -- Testing variable joining with joinTypes would fail because it's not the right level of abstraction.++ -- List types produce constraint on element types+ joinTypesCase "join list types"+ (T.list (T.var "a"))+ (T.list T.int32)+ (Phantoms.list [constraint (T.var "a") T.int32]),++ -- Function types produce constraints on domain and codomain+ joinTypesCase "join function types"+ (T.function (T.var "a") (T.var "b"))+ (T.function T.int32 T.string)+ (Phantoms.list [constraint (T.var "a") T.int32, constraint (T.var "b") T.string]),++ -- Optional types+ joinTypesCase "join optional types"+ (T.optional (T.var "a"))+ (T.optional T.int32)+ (Phantoms.list [constraint (T.var "a") T.int32]),++ -- Pair types+ joinTypesCase "join pair types"+ (T.pair (T.var "a") (T.var "b"))+ (T.pair T.int32 T.string)+ (Phantoms.list [constraint (T.var "a") T.int32, constraint (T.var "b") T.string]),++ -- Either types+ joinTypesCase "join either types"+ (T.either_ (T.var "a") (T.var "b"))+ (T.either_ T.int32 T.string)+ (Phantoms.list [constraint (T.var "a") T.int32, constraint (T.var "b") T.string]),++ -- Map types+ joinTypesCase "join map types"+ (T.map (T.var "k") (T.var "v"))+ (T.map T.string T.int32)+ (Phantoms.list [constraint (T.var "k") T.string, constraint (T.var "v") T.int32]),++ -- Set types+ joinTypesCase "join set types"+ (T.set (T.var "a"))+ (T.set T.int32)+ (Phantoms.list [constraint (T.var "a") T.int32]),++ -- Unit types+ joinTypesCase "join unit types"+ T.unit+ T.unit+ noConstraints,++ -- Failure cases+ joinTypesFailCase "fail to join int32 with string"+ T.int32+ T.string,++ joinTypesFailCase "fail to join list with function"+ (T.list T.int32)+ (T.function T.int32 T.int32),++ joinTypesFailCase "fail to join pair with either"+ (T.pair T.int32 T.string)+ (T.either_ T.int32 T.string)]++-- ============================================================+-- All tests+-- ============================================================++allTests :: TBinding TestGroup+allTests = define "allTests" $+ Phantoms.doc "Test cases for type unification operations" $+ supergroup "unification" [+ variableOccursInTypeTests,+ unifyTypesTests,+ joinTypesTests]
src/main/haskell/Hydra/Sources/Yaml/Model.hs view
@@ -1,96 +1,77 @@+-- | A basic YAML representation model+ module Hydra.Sources.Yaml.Model where -import Hydra.Kernel-import Hydra.Dsl.Annotations-import Hydra.Dsl.Bootstrap-import Hydra.Dsl.Types as Types+-- Standard type-level imports+import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core -import qualified Hydra.Sources.Kernel.Types.Accessors as Accessors-import qualified Hydra.Sources.Kernel.Types.Ast as Ast-import qualified Hydra.Sources.Kernel.Types.Coders as Coders-import qualified Hydra.Sources.Kernel.Types.Compute as Compute-import qualified Hydra.Sources.Kernel.Types.Constraints as Constraints-import qualified Hydra.Sources.Kernel.Types.Core as Core-import qualified Hydra.Sources.Kernel.Types.Grammar as Grammar-import qualified Hydra.Sources.Kernel.Types.Graph as Graph-import qualified Hydra.Sources.Kernel.Types.Json as Json-import qualified Hydra.Sources.Kernel.Types.Mantle as Mantle-import qualified Hydra.Sources.Kernel.Types.Module as Module-import qualified Hydra.Sources.Kernel.Types.Phantoms as Phantoms-import qualified Hydra.Sources.Kernel.Types.Relational as Relational-import qualified Hydra.Sources.Kernel.Types.Query as Query-import qualified Hydra.Sources.Kernel.Types.Tabular as Tabular-import qualified Hydra.Sources.Kernel.Types.Testing as Testing-import qualified Hydra.Sources.Kernel.Types.Topology as Topology-import qualified Hydra.Sources.Kernel.Types.Typing as Typing-import qualified Hydra.Sources.Kernel.Types.Workflow as Workflow +ns :: Namespace+ns = Namespace "hydra.ext.org.yaml.model" -yamlModelModule :: Module-yamlModelModule = Module ns elements [Core.module_] [Core.module_] $+define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [Core.ns] [Core.ns] $ Just ("A basic YAML representation model. Based on:\n" ++ " https://yaml.org/spec/1.2/spec.html\n" ++ "The Serialization and Presentation properties of YAML,\n" ++ "including directives, comments, anchors, style, formatting, and aliases, are not supported by this model.\n" ++ "In addition, tags are omitted from this model, and non-standard scalars are unsupported.") where- ns = Namespace "hydra.ext.org.yaml.model"- def = datatype ns- model = typeref ns- elements = [- {-- Every YAML node has an optional scalar tag or non-specific tag (omitted from this model)- -}- def "Node" $- doc "A YAML node (value)" $- union [- "mapping">: Types.map (model "Node") (model "Node"), -- Failsafe schema: tag:yaml.org,2002:map- "scalar">: model "Scalar",- "sequence">: list $ model "Node"], -- Failsafe schema: tag:yaml.org,2002:seq-- def "Scalar" $- doc "A union of scalars supported in the YAML failsafe and JSON schemas. Other scalars are not supported here" $- union [- {-- Represents a true/false value-- JSON schema: tag:yaml.org,2002:bool- -}- "bool">:- doc "Represents a true/false value"- boolean,- {-- Represents an approximation to real numbers-- JSON schema: tag:yaml.org,2002:float-- In addition to arbitrary-precision floating-point numbers in scientific notation,- YAML allows for three special values, which are not supported here:- positive and negative infinity (.inf and -.inf), and "not a number (.nan)- -}- "float">:- doc "Represents an approximation to real numbers"- bigfloat,- {-- Represents arbitrary sized finite mathematical integers+ node,+ scalar] - JSON schema: tag:yaml.org,2002:int- -}- "int">:- doc "Represents arbitrary sized finite mathematical integers"- bigint,- {-- Represents the lack of a value+-- Every YAML node has an optional scalar tag or non-specific tag (omitted from this model)+node :: Binding+node = define "Node" $+ doc "A YAML node (value)" $+ T.union [+ "mapping">:+ doc "A mapping from nodes to nodes" $+ T.map node node, -- Failsafe schema: tag:yaml.org,2002:map+ "scalar">:+ doc "A scalar value"+ scalar,+ "sequence">:+ doc "A sequence of nodes" $+ T.list node] -- Failsafe schema: tag:yaml.org,2002:seq - JSON schema: tag:yaml.org,2002:null- -}- "null">:- doc "Represents the lack of a value"- unit,- {-- Failsafe schema: tag:yaml.org,2002:str- -}- "str">:- doc "A string value"- string]]+scalar :: Binding+scalar = define "Scalar" $+ doc "A union of scalars supported in the YAML failsafe and JSON schemas. Other scalars are not supported here" $+ T.union [+ -- Represents a true/false value+ -- JSON schema: tag:yaml.org,2002:bool+ "bool">:+ doc "Represents a true/false value"+ T.boolean,+ -- Represents an approximation to real numbers+ -- JSON schema: tag:yaml.org,2002:float+ -- In addition to arbitrary-precision floating-point numbers in scientific notation,+ -- YAML allows for three special values, which are not supported here:+ -- positive and negative infinity (.inf and -.inf), and "not a number (.nan)+ "float">:+ doc "Represents an approximation to real numbers"+ T.bigfloat,+ -- Represents arbitrary sized finite mathematical integers+ -- JSON schema: tag:yaml.org,2002:int+ "int">:+ doc "Represents arbitrary sized finite mathematical integers"+ T.bigint,+ -- Represents the lack of a value+ -- JSON schema: tag:yaml.org,2002:null+ "null">:+ doc "Represents the lack of a value"+ T.unit,+ -- Failsafe schema: tag:yaml.org,2002:str+ "str">:+ doc "A string value"+ T.string]
− src/main/haskell/Hydra/Staging/Json/Serde.hs
@@ -1,84 +0,0 @@-module Hydra.Staging.Json.Serde where--import Hydra.Tools.Monads-import qualified Hydra.Compute as Compute-import qualified Hydra.Core as Core-import qualified Hydra.Graph as Graph-import qualified Hydra.Monads as Monads-import qualified Hydra.Ext.Org.Json.Coder as JsonCoder-import qualified Hydra.Tools.Bytestrings as Bytestrings-import qualified Hydra.Json as Json--import qualified Data.ByteString.Lazy as BS-import qualified Control.Monad as CM-import qualified Data.Aeson as A-import qualified Data.Aeson.KeyMap as AKM-import qualified Data.Aeson.Key as AK-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Text as T-import qualified Data.Vector as V-import qualified Data.Scientific as SC-import qualified Data.Char as C-import qualified Data.String as String---aesonValueToBytes :: A.Value -> BS.ByteString-aesonValueToBytes = A.encode--aesonValueToJsonValue :: A.Value -> Json.Value-aesonValueToJsonValue v = case v of- A.Object km -> Json.ValueObject $ M.fromList (mapPair <$> AKM.toList km)- where- mapPair (k, v) = (AK.toString k, aesonValueToJsonValue v)- A.Array a -> Json.ValueArray (aesonValueToJsonValue <$> V.toList a)- A.String t -> Json.ValueString $ T.unpack t- A.Number s -> Json.ValueNumber $ SC.toRealFloat s- A.Bool b -> Json.ValueBoolean b- A.Null -> Json.ValueNull--bytesToAesonValue :: BS.ByteString -> Either String A.Value-bytesToAesonValue = A.eitherDecode--bytesToJsonValue :: BS.ByteString -> Either String Json.Value-bytesToJsonValue bs = aesonValueToJsonValue <$> bytesToAesonValue bs--jsonByteStringCoder :: Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph Graph.Graph Core.Term BS.ByteString)-jsonByteStringCoder typ = do- coder <- JsonCoder.jsonCoder typ- return Compute.Coder {- Compute.coderEncode = fmap jsonValueToBytes . Compute.coderEncode coder,- Compute.coderDecode = \bs -> case bytesToJsonValue bs of- Left msg -> Monads.fail $ "JSON parsing failed: " ++ msg- Right v -> Compute.coderDecode coder v}---- | A convenience which maps typed terms to and from pretty-printed JSON strings, as opposed to JSON objects-jsonStringCoder :: Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph Graph.Graph Core.Term String)-jsonStringCoder typ = do- serde <- jsonByteStringCoder typ- return Compute.Coder {- Compute.coderEncode = fmap Bytestrings.bytesToString . Compute.coderEncode serde,- Compute.coderDecode = Compute.coderDecode serde . Bytestrings.stringToBytes}--jsonValueToAesonValue :: Json.Value -> A.Value-jsonValueToAesonValue v = case v of- Json.ValueArray l -> A.Array $ V.fromList (jsonValueToAesonValue <$> l)- Json.ValueBoolean b -> A.Bool b- Json.ValueNull -> A.Null- Json.ValueNumber d -> A.Number $ SC.fromFloatDigits d- Json.ValueObject m -> A.Object $ AKM.fromList (mapPair <$> M.toList m)- where- mapPair (k, v) = (AK.fromString k, jsonValueToAesonValue v)- Json.ValueString s -> A.String $ T.pack s--jsonValueToBytes :: Json.Value -> BS.ByteString-jsonValueToBytes = aesonValueToBytes . jsonValueToAesonValue--jsonValueToString :: Json.Value -> String-jsonValueToString = Bytestrings.bytesToString . jsonValueToBytes--jsonValuesToString :: [Json.Value] -> String-jsonValuesToString = L.intercalate "\n" . fmap jsonValueToString--stringToJsonValue :: String -> Either String Json.Value-stringToJsonValue = bytesToJsonValue . Bytestrings.stringToBytes
+ src/main/haskell/Hydra/Staging/Lib/Names.hs view
@@ -0,0 +1,304 @@+-- | Namespaces and primitive names for the Hydra standard library+module Hydra.Staging.Lib.Names where++import Hydra.Core+import Hydra.Module+import Hydra.Names+++_hydra_lib_chars :: Namespace+_hydra_lib_chars = Namespace "hydra.lib.chars"++_chars_isAlphaNum = qname _hydra_lib_chars "isAlphaNum" :: Name+_chars_isLower = qname _hydra_lib_chars "isLower" :: Name+_chars_isSpace = qname _hydra_lib_chars "isSpace" :: Name+_chars_isUpper = qname _hydra_lib_chars "isUpper" :: Name+_chars_toLower = qname _hydra_lib_chars "toLower" :: Name+_chars_toUpper = qname _hydra_lib_chars "toUpper" :: Name++_hydra_lib_eithers :: Namespace+_hydra_lib_eithers = Namespace "hydra.lib.eithers"++_eithers_bind = qname _hydra_lib_eithers "bind" :: Name+_eithers_bimap = qname _hydra_lib_eithers "bimap" :: Name+_eithers_either = qname _hydra_lib_eithers "either" :: Name+_eithers_fromLeft = qname _hydra_lib_eithers "fromLeft" :: Name+_eithers_fromRight = qname _hydra_lib_eithers "fromRight" :: Name+_eithers_isLeft = qname _hydra_lib_eithers "isLeft" :: Name+_eithers_isRight = qname _hydra_lib_eithers "isRight" :: Name+_eithers_lefts = qname _hydra_lib_eithers "lefts" :: Name+_eithers_map = qname _hydra_lib_eithers "map" :: Name+_eithers_mapList = qname _hydra_lib_eithers "mapList" :: Name+_eithers_mapMaybe = qname _hydra_lib_eithers "mapMaybe" :: Name+_eithers_partitionEithers = qname _hydra_lib_eithers "partitionEithers" :: Name+_eithers_rights = qname _hydra_lib_eithers "rights" :: Name++_hydra_lib_equality :: Namespace+_hydra_lib_equality = Namespace "hydra.lib.equality"++_equality_compare = qname _hydra_lib_equality "compare" :: Name+_equality_equal = qname _hydra_lib_equality "equal" :: Name+_equality_gt = qname _hydra_lib_equality "gt" :: Name+_equality_gte = qname _hydra_lib_equality "gte" :: Name+_equality_identity = qname _hydra_lib_equality "identity" :: Name+_equality_lt = qname _hydra_lib_equality "lt" :: Name+_equality_lte = qname _hydra_lib_equality "lte" :: Name+_equality_max = qname _hydra_lib_equality "max" :: Name+_equality_min = qname _hydra_lib_equality "min" :: Name++_hydra_lib_flows :: Namespace+_hydra_lib_flows = Namespace "hydra.lib.flows"++_flows_apply = qname _hydra_lib_flows "apply" :: Name+_flows_bind = qname _hydra_lib_flows "bind" :: Name+_flows_fail = qname _hydra_lib_flows "fail" :: Name+_flows_foldl = qname _hydra_lib_flows "foldl" :: Name+_flows_map = qname _hydra_lib_flows "map" :: Name+_flows_mapElems = qname _hydra_lib_flows "mapElems" :: Name+_flows_mapKeys = qname _hydra_lib_flows "mapKeys" :: Name+_flows_mapList = qname _hydra_lib_flows "mapList" :: Name+_flows_mapMaybe = qname _hydra_lib_flows "mapMaybe" :: Name+_flows_mapSet = qname _hydra_lib_flows "mapSet" :: Name+_flows_pure = qname _hydra_lib_flows "pure" :: Name+_flows_sequence = qname _hydra_lib_flows "sequence" :: Name+_flows_withDefault = qname _hydra_lib_flows "withDefault" :: Name++_hydra_lib_lists :: Namespace+_hydra_lib_lists = Namespace "hydra.lib.lists"++_lists_apply = qname _hydra_lib_lists "apply" :: Name+_lists_at = qname _hydra_lib_lists "at" :: Name+_lists_bind = qname _hydra_lib_lists "bind" :: Name+_lists_concat = qname _hydra_lib_lists "concat" :: Name+_lists_concat2 = qname _hydra_lib_lists "concat2" :: Name+_lists_cons = qname _hydra_lib_lists "cons" :: Name+_lists_drop = qname _hydra_lib_lists "drop" :: Name+_lists_dropWhile = qname _hydra_lib_lists "dropWhile" :: Name+_lists_elem = qname _hydra_lib_lists "elem" :: Name+_lists_filter = qname _hydra_lib_lists "filter" :: Name+_lists_find = qname _hydra_lib_lists "find" :: Name+_lists_foldl = qname _hydra_lib_lists "foldl" :: Name+_lists_group = qname _hydra_lib_lists "group" :: Name+_lists_head = qname _hydra_lib_lists "head" :: Name+_lists_init = qname _hydra_lib_lists "init" :: Name+_lists_intercalate = qname _hydra_lib_lists "intercalate" :: Name+_lists_intersperse = qname _hydra_lib_lists "intersperse" :: Name+_lists_last = qname _hydra_lib_lists "last" :: Name+_lists_length = qname _hydra_lib_lists "length" :: Name+_lists_map = qname _hydra_lib_lists "map" :: Name+_lists_nub = qname _hydra_lib_lists "nub" :: Name+_lists_null = qname _hydra_lib_lists "null" :: Name+_lists_partition = qname _hydra_lib_lists "partition" :: Name+_lists_pure = qname _hydra_lib_lists "pure" :: Name+_lists_replicate = qname _hydra_lib_lists "replicate" :: Name+_lists_reverse = qname _hydra_lib_lists "reverse" :: Name+_lists_safeHead = qname _hydra_lib_lists "safeHead" :: Name+_lists_singleton = qname _hydra_lib_lists "singleton" :: Name+_lists_sort = qname _hydra_lib_lists "sort" :: Name+_lists_sortOn = qname _hydra_lib_lists "sortOn" :: Name+_lists_span = qname _hydra_lib_lists "span" :: Name+_lists_tail = qname _hydra_lib_lists "tail" :: Name+_lists_take = qname _hydra_lib_lists "take" :: Name+_lists_transpose = qname _hydra_lib_lists "transpose" :: Name+_lists_zip = qname _hydra_lib_lists "zip" :: Name+_lists_zipWith = qname _hydra_lib_lists "zipWith" :: Name++_hydra_lib_literals :: Namespace+_hydra_lib_literals = Namespace "hydra.lib.literals"++_literals_bigfloatToBigint = qname _hydra_lib_literals "bigfloatToBigint" :: Name+_literals_bigfloatToFloat32 = qname _hydra_lib_literals "bigfloatToFloat32" :: Name+_literals_bigfloatToFloat64 = qname _hydra_lib_literals "bigfloatToFloat64" :: Name+_literals_bigintToBigfloat = qname _hydra_lib_literals "bigintToBigfloat" :: Name+_literals_bigintToInt8 = qname _hydra_lib_literals "bigintToInt8" :: Name+_literals_bigintToInt16 = qname _hydra_lib_literals "bigintToInt16" :: Name+_literals_bigintToInt32 = qname _hydra_lib_literals "bigintToInt32" :: Name+_literals_bigintToInt64 = qname _hydra_lib_literals "bigintToInt64" :: Name+_literals_bigintToUint8 = qname _hydra_lib_literals "bigintToUint8" :: Name+_literals_bigintToUint16 = qname _hydra_lib_literals "bigintToUint16" :: Name+_literals_bigintToUint32 = qname _hydra_lib_literals "bigintToUint32" :: Name+_literals_bigintToUint64 = qname _hydra_lib_literals "bigintToUint64" :: Name+_literals_binaryToBytes = qname _hydra_lib_literals "binaryToBytes" :: Name+_literals_binaryToString = qname _hydra_lib_literals "binaryToString" :: Name+_literals_float32ToBigfloat = qname _hydra_lib_literals "float32ToBigfloat" :: Name+_literals_float64ToBigfloat = qname _hydra_lib_literals "float64ToBigfloat" :: Name+_literals_int8ToBigint = qname _hydra_lib_literals "int8ToBigint" :: Name+_literals_int16ToBigint = qname _hydra_lib_literals "int16ToBigint" :: Name+_literals_int32ToBigint = qname _hydra_lib_literals "int32ToBigint" :: Name+_literals_int64ToBigint = qname _hydra_lib_literals "int64ToBigint" :: Name+_literals_readBigfloat = qname _hydra_lib_literals "readBigfloat" :: Name+_literals_readBigint = qname _hydra_lib_literals "readBigint" :: Name+_literals_readBoolean = qname _hydra_lib_literals "readBoolean" :: Name+_literals_readFloat32 = qname _hydra_lib_literals "readFloat32" :: Name+_literals_readFloat64 = qname _hydra_lib_literals "readFloat64" :: Name+_literals_readInt8 = qname _hydra_lib_literals "readInt8" :: Name+_literals_readInt16 = qname _hydra_lib_literals "readInt16" :: Name+_literals_readInt32 = qname _hydra_lib_literals "readInt32" :: Name+_literals_readInt64 = qname _hydra_lib_literals "readInt64" :: Name+_literals_readString = qname _hydra_lib_literals "readString" :: Name+_literals_readUint8 = qname _hydra_lib_literals "readUint8" :: Name+_literals_readUint16 = qname _hydra_lib_literals "readUint16" :: Name+_literals_readUint32 = qname _hydra_lib_literals "readUint32" :: Name+_literals_readUint64 = qname _hydra_lib_literals "readUint64" :: Name+_literals_showBigfloat = qname _hydra_lib_literals "showBigfloat" :: Name+_literals_showBigint = qname _hydra_lib_literals "showBigint" :: Name+_literals_showBoolean = qname _hydra_lib_literals "showBoolean" :: Name+_literals_showFloat32 = qname _hydra_lib_literals "showFloat32" :: Name+_literals_showFloat64 = qname _hydra_lib_literals "showFloat64" :: Name+_literals_showInt8 = qname _hydra_lib_literals "showInt8" :: Name+_literals_showInt16 = qname _hydra_lib_literals "showInt16" :: Name+_literals_showInt32 = qname _hydra_lib_literals "showInt32" :: Name+_literals_showInt64 = qname _hydra_lib_literals "showInt64" :: Name+_literals_showUint8 = qname _hydra_lib_literals "showUint8" :: Name+_literals_showUint16 = qname _hydra_lib_literals "showUint16" :: Name+_literals_showUint32 = qname _hydra_lib_literals "showUint32" :: Name+_literals_showUint64 = qname _hydra_lib_literals "showUint64" :: Name+_literals_showString = qname _hydra_lib_literals "showString" :: Name+_literals_stringToBinary = qname _hydra_lib_literals "stringToBinary" :: Name+_literals_uint8ToBigint = qname _hydra_lib_literals "uint8ToBigint" :: Name+_literals_uint16ToBigint = qname _hydra_lib_literals "uint16ToBigint" :: Name+_literals_uint32ToBigint = qname _hydra_lib_literals "uint32ToBigint" :: Name+_literals_uint64ToBigint = qname _hydra_lib_literals "uint64ToBigint" :: Name++_hydra_lib_logic :: Namespace+_hydra_lib_logic = Namespace "hydra.lib.logic"++_logic_and = qname _hydra_lib_logic "and" :: Name+_logic_ifElse = qname _hydra_lib_logic "ifElse" :: Name+_logic_not = qname _hydra_lib_logic "not" :: Name+_logic_or = qname _hydra_lib_logic "or" :: Name++_hydra_lib_maps :: Namespace+_hydra_lib_maps = Namespace "hydra.lib.maps"++_maps_alter = qname _hydra_lib_maps "alter" :: Name+_maps_bimap = qname _hydra_lib_maps "bimap" :: Name+_maps_delete = qname _hydra_lib_maps "delete" :: Name+_maps_elems = qname _hydra_lib_maps "elems" :: Name+_maps_empty = qname _hydra_lib_maps "empty" :: Name+_maps_filter = qname _hydra_lib_maps "filter" :: Name+_maps_filterWithKey = qname _hydra_lib_maps "filterWithKey" :: Name+_maps_findWithDefault = qname _hydra_lib_maps "findWithDefault" :: Name+_maps_fromList = qname _hydra_lib_maps "fromList" :: Name+_maps_insert = qname _hydra_lib_maps "insert" :: Name+_maps_keys = qname _hydra_lib_maps "keys" :: Name+_maps_lookup = qname _hydra_lib_maps "lookup" :: Name+_maps_map = qname _hydra_lib_maps "map" :: Name+_maps_mapKeys = qname _hydra_lib_maps "mapKeys" :: Name+_maps_member = qname _hydra_lib_maps "member" :: Name+_maps_null = qname _hydra_lib_maps "null" :: Name+_maps_singleton = qname _hydra_lib_maps "singleton" :: Name+_maps_size = qname _hydra_lib_maps "size" :: Name+_maps_toList = qname _hydra_lib_maps "toList" :: Name+_maps_union = qname _hydra_lib_maps "union" :: Name++_hydra_lib_math :: Namespace+_hydra_lib_math = Namespace "hydra.lib.math"++_math_abs = qname _hydra_lib_math "abs" :: Name+_math_acos = qname _hydra_lib_math "acos" :: Name+_math_acosh = qname _hydra_lib_math "acosh" :: Name+_math_add = qname _hydra_lib_math "add" :: Name+_math_asin = qname _hydra_lib_math "asin" :: Name+_math_asinh = qname _hydra_lib_math "asinh" :: Name+_math_atan = qname _hydra_lib_math "atan" :: Name+_math_atan2 = qname _hydra_lib_math "atan2" :: Name+_math_atanh = qname _hydra_lib_math "atanh" :: Name+_math_ceiling = qname _hydra_lib_math "ceiling" :: Name+_math_cos = qname _hydra_lib_math "cos" :: Name+_math_cosh = qname _hydra_lib_math "cosh" :: Name+_math_div = qname _hydra_lib_math "div" :: Name+_math_e = qname _hydra_lib_math "e" :: Name+_math_even = qname _hydra_lib_math "even" :: Name+_math_exp = qname _hydra_lib_math "exp" :: Name+_math_floor = qname _hydra_lib_math "floor" :: Name+_math_log = qname _hydra_lib_math "log" :: Name+_math_logBase = qname _hydra_lib_math "logBase" :: Name+_math_max = qname _hydra_lib_math "max" :: Name+_math_min = qname _hydra_lib_math "min" :: Name+_math_mod = qname _hydra_lib_math "mod" :: Name+_math_mul = qname _hydra_lib_math "mul" :: Name+_math_negate = qname _hydra_lib_math "negate" :: Name+_math_odd = qname _hydra_lib_math "odd" :: Name+_math_pi = qname _hydra_lib_math "pi" :: Name+_math_pow = qname _hydra_lib_math "pow" :: Name+_math_pred = qname _hydra_lib_math "pred" :: Name+_math_range = qname _hydra_lib_math "range" :: Name+_math_rem = qname _hydra_lib_math "rem" :: Name+_math_round = qname _hydra_lib_math "round" :: Name+_math_signum = qname _hydra_lib_math "signum" :: Name+_math_sin = qname _hydra_lib_math "sin" :: Name+_math_sinh = qname _hydra_lib_math "sinh" :: Name+_math_sqrt = qname _hydra_lib_math "sqrt" :: Name+_math_sub = qname _hydra_lib_math "sub" :: Name+_math_succ = qname _hydra_lib_math "succ" :: Name+_math_tan = qname _hydra_lib_math "tan" :: Name+_math_tanh = qname _hydra_lib_math "tanh" :: Name+_math_truncate = qname _hydra_lib_math "truncate" :: Name++_hydra_lib_maybes :: Namespace+_hydra_lib_maybes = Namespace "hydra.lib.maybes"++_maybes_apply :: Name+_maybes_apply = qname _hydra_lib_maybes "apply" :: Name+_maybes_bind = qname _hydra_lib_maybes "bind" :: Name+_maybes_cases = qname _hydra_lib_maybes "cases" :: Name+_maybes_cat = qname _hydra_lib_maybes "cat" :: Name+_maybes_compose = qname _hydra_lib_maybes "compose" :: Name+_maybes_fromJust = qname _hydra_lib_maybes "fromJust" :: Name+_maybes_fromMaybe = qname _hydra_lib_maybes "fromMaybe" :: Name+_maybes_isJust = qname _hydra_lib_maybes "isJust" :: Name+_maybes_isNothing = qname _hydra_lib_maybes "isNothing" :: Name+_maybes_map = qname _hydra_lib_maybes "map" :: Name+_maybes_mapMaybe = qname _hydra_lib_maybes "mapMaybe" :: Name+_maybes_maybe = qname _hydra_lib_maybes "maybe" :: Name+_maybes_pure = qname _hydra_lib_maybes "pure" :: Name++_hydra_lib_pairs :: Namespace+_hydra_lib_pairs = Namespace "hydra.lib.pairs"++_pairs_bimap = qname _hydra_lib_pairs "bimap" :: Name+_pairs_first = qname _hydra_lib_pairs "first" :: Name+_pairs_second = qname _hydra_lib_pairs "second" :: Name++_hydra_lib_sets :: Namespace+_hydra_lib_sets = Namespace "hydra.lib.sets"++_sets_delete = qname _hydra_lib_sets "delete" :: Name+_sets_difference = qname _hydra_lib_sets "difference" :: Name+_sets_empty = qname _hydra_lib_sets "empty" :: Name+_sets_fromList = qname _hydra_lib_sets "fromList" :: Name+_sets_insert = qname _hydra_lib_sets "insert" :: Name+_sets_intersection = qname _hydra_lib_sets "intersection" :: Name+_sets_map = qname _hydra_lib_sets "map" :: Name+_sets_member = qname _hydra_lib_sets "member" :: Name+_sets_null = qname _hydra_lib_sets "null" :: Name+_sets_singleton = qname _hydra_lib_sets "singleton" :: Name+_sets_size = qname _hydra_lib_sets "size" :: Name+_sets_toList = qname _hydra_lib_sets "toList" :: Name+_sets_union = qname _hydra_lib_sets "union" :: Name+_sets_unions = qname _hydra_lib_sets "unions" :: Name++_hydra_lib_strings :: Namespace+_hydra_lib_strings = Namespace "hydra.lib.strings"++_strings_cat = qname _hydra_lib_strings "cat" :: Name+_strings_cat2 = qname _hydra_lib_strings "cat2" :: Name+_strings_charAt = qname _hydra_lib_strings "charAt" :: Name+_strings_fromList = qname _hydra_lib_strings "fromList" :: Name+_strings_intercalate = qname _hydra_lib_strings "intercalate" :: Name+_strings_null = qname _hydra_lib_strings "null" :: Name+_strings_length = qname _hydra_lib_strings "length" :: Name+_strings_lines = qname _hydra_lib_strings "lines" :: Name+_strings_splitOn = qname _hydra_lib_strings "splitOn" :: Name+_strings_toList = qname _hydra_lib_strings "toList" :: Name+_strings_toLower = qname _hydra_lib_strings "toLower" :: Name+_strings_toUpper = qname _hydra_lib_strings "toUpper" :: Name+_strings_unlines = qname _hydra_lib_strings "unlines" :: Name++-- | Type class names for qualified types+_hydra_typeclass :: Namespace+_hydra_typeclass = Namespace "hydra.typeclass"++_typeclass_Eq = qname _hydra_typeclass "Eq" :: Name+_typeclass_Ord = qname _hydra_typeclass "Ord" :: Name
+ src/main/haskell/Hydra/Staging/Testing/Generation/Generate.hs view
@@ -0,0 +1,306 @@+-- | Core infrastructure for generating executable test suites from Hydra test specifications++module Hydra.Staging.Testing.Generation.Generate where++import Hydra.Kernel hiding (map)+import Hydra.Testing+import Hydra.Generation+import Hydra.Dsl.Bootstrap (bootstrapGraph)+import Hydra.Staging.Testing.Generation.Transform+import qualified Hydra.Inference as Inference+import Hydra.Sources.All++import qualified Hydra.Sources.Kernel.Terms.Formatting as Formatting+import qualified Hydra.Sources.Kernel.Terms.Lexical as Lexical+import qualified Hydra.Sources.Kernel.Terms.Monads as Monads+import qualified Hydra.Sources.Kernel.Types.Core as Core+import qualified Hydra.Lib.Strings as Strings++import qualified System.Directory as SD+import qualified System.FilePath as FP+import qualified Data.List as L+import qualified Data.Map as M+import Data.Char (isAlphaNum, isUpper, toLower, toUpper)+import Debug.Trace (trace)+import System.IO.Unsafe (unsafePerformIO)+++-- | Language-agnostic test generator abstraction+-- Parameterized by the namespace/module name type (e.g., H.ModuleName for Haskell)+data TestGenerator a = TestGenerator {+ -- | Build namespaces for a module, resolving all imports and primitives+ testGenNamespacesForModule :: Module -> Flow Graph (Namespaces a),++ -- | Create a test codec from resolved namespaces+ testGenCreateCodec :: Namespaces a -> TestCodec,++ -- | Generate a complete test file for a module and test group+ testGenGenerateTestFile :: Module -> TestGroup -> Flow Graph (FilePath, String),++ -- | Generate an aggregator file (e.g., Spec.hs for Haskell, conftest.py for Python)+ -- Takes base directory and list of modules, returns (filepath, content) or Nothing if not needed+ testGenAggregatorFile :: Maybe (FilePath -> [Module] -> (FilePath, String))+}+++-- | Build namespaces for test group by creating a module with test terms and using the generator's namespacesForModule+buildNamespacesForTestGroup :: TestGenerator a -> Module -> TestGroup -> Flow Graph (Namespaces a)+buildNamespacesForTestGroup testGen testModule testGroup = do+ -- Extract all test case terms+ let testCases = collectTestCases testGroup+ testTerms = concatMap extractTestTerms testCases++ -- Create bindings from test terms so they can be analyzed for dependencies+ testBindings = zipWith (\i term -> Binding (Name $ "_test_" ++ show i) term Nothing) ([0..] :: [Integer]) testTerms++ -- Create a temporary module with test terms as bindings+ tempModule = testModule { moduleElements = testBindings }++ -- Use the language-specific namespacesForModule which handles primitives correctly+ testGenNamespacesForModule testGen tempModule+ where+ extractTestTerms (TestCaseWithMetadata _ tcase _ _) = case tcase of+ TestCaseDelegatedEvaluation (DelegatedEvaluationTestCase input output) -> [input, output]+ _ -> []++-- | Build a mapping from module namespaces to test groups by matching on derived keys.+-- This handles the case where submodules and subgroups may be in different orders+-- (e.g., due to code generation reordering).+-- Note: subModules must be provided explicitly as namespaces since Module dependencies are now just Namespaces.+buildTestGroupMap :: [Namespace] -> TestGroup -> M.Map Namespace TestGroup+buildTestGroupMap subModuleNamespaces rootTestGroup =+ let subGroups = testGroupSubgroups rootTestGroup+ -- Build a map from test group name to test group for lookup+ groupByName = M.fromList [(testGroupName g, g) | g <- subGroups]+ -- Match each module namespace to its test group by deriving the expected test group name+ pairs = [(ns, group) |+ ns <- subModuleNamespaces,+ let expectedName = deriveTestGroupName ns,+ Just group <- [M.lookup expectedName groupByName]]+ in M.fromList pairs+ where+ -- Derive the test group name from a module namespace+ -- Handles various patterns:+ -- e.g., "hydra.test.lib.chars" -> "hydra.lib.chars primitives"+ -- e.g., "hydra.test.formatting" -> "formatting"+ -- e.g., "hydra.test.checking.all" -> "checking"+ -- e.g., "hydra.test.monads" -> "hydra.monads"+ -- e.g., "hydra.test.etaExpansion" -> "eta expansion"+ -- e.g., "hydra.test.json.coder" -> "JSON coder"+ deriveTestGroupName (Namespace ns) =+ let parts = Strings.splitOn "." ns+ -- Remove "hydra.test." prefix and handle different patterns+ withoutPrefix = drop 2 parts -- drop "hydra" and "test"+ in case withoutPrefix of+ ("lib":rest) -> "hydra.lib." ++ L.intercalate "." rest ++ " primitives"+ -- JSON special cases+ ["json", "coder"] -> "JSON coder"+ ["json", "parser"] -> "JSON parsing"+ ["json", "writer"] -> "JSON serialization"+ -- Handle camelCase conversion (e.g., etaExpansion -> eta expansion)+ [name] -> decamelize name+ -- Handle .all suffix (e.g., checking.all -> checking, inference.all -> inference)+ parts' | not (null parts') && last parts' == "all" -> L.intercalate "." (init parts')+ _ -> L.intercalate "." withoutPrefix++ -- Convert camelCase to space-separated lowercase+ decamelize s = map toLower $ L.intercalate " " $ splitCamelCase s++ -- Split a camelCase string into words+ splitCamelCase [] = []+ splitCamelCase (c:cs) =+ let (word, rest) = span (not . isUpper) cs+ in (c:word) : splitCamelCase rest++-- | Create a lookup function from a test group hierarchy+-- This walks the test group and module hierarchies to build the mapping+-- Note: subModuleNamespaces must be provided explicitly since Module dependencies are now Namespaces+createTestGroupLookup :: [Namespace] -> TestGroup -> (Namespace -> Maybe TestGroup)+createTestGroupLookup subModuleNamespaces rootTestGroup =+ let testGroupMap = buildTestGroupMap subModuleNamespaces rootTestGroup+ in \ns -> M.lookup ns testGroupMap++-- | Main entry point: generate generation test suite from test modules+-- Takes a test generator, output directory, test modules, and a lookup function for test groups+-- Note: testModules must be provided explicitly since Module dependencies are now Namespaces+generateGenerationTestSuite :: TestGenerator a -> FilePath -> [Module] -> (Namespace -> Maybe TestGroup) -> IO Bool+generateGenerationTestSuite testGen outDir modules lookupTestGroup = do+ putStrLn "Processing test modules..."++ putStrLn $ "Found " ++ show (length modules) ++ " test module(s)"+ putStrLn "Transforming test suite to generation tests..."++ -- Match modules with their test groups and transform+ let moduleTestPairs = [(mod, transformed) |+ mod <- modules,+ Just testGroup <- [lookupTestGroup (moduleNamespace mod)],+ Just transformed <- [transformToCompiledTests testGroup]]++ if null moduleTestPairs+ then do+ putStrLn "No generation tests to generate"+ return True+ else do+ putStrLn $ "Found " ++ show (length moduleTestPairs) ++ " module(s) with generation tests, generating to " ++ outDir++ let graph = modulesToGraph (mainModules ++ testModules) $ modules ++ extraModules++ -- Generate using the provided test generator, writing files incrementally+ result <- runFlowWithGraph graph $ generateAllModuleTestsIncremental testGen outDir moduleTestPairs writeFilePair++ case result of+ Left trace -> do+ putStrLn $ "✗ Generation failed: " ++ traceSummary trace+ return False+ Right count -> do+ putStrLn $ "✓ Successfully generated " ++ show count ++ " test file(s)"+ return True+ where+ writeFilePair (fullPath, content) = do+ SD.createDirectoryIfMissing True $ FP.takeDirectory fullPath+ writeFile fullPath content+ putStrLn $ " Generated: " ++ fullPath+ -- Core.module_ is required for schema types like Either, Maybe, etc.+ -- Monads.module_ is required for primitives like hydra.monads.pure+ -- Lexical.module_ is required for hydra.lexical.emptyGraph used in Flow tests+ extraModules = [Formatting.module_, Lexical.module_, Monads.module_, Core.module_]++-- Note: collectModules removed since Module dependencies are now Namespaces.+-- Callers should provide explicit module lists instead of relying on traversal.++-- | Run a Flow action with the given graph, returning Maybe+runFlowWithGraph :: s -> Flow s a -> IO (Either Trace a)+runFlowWithGraph s f = do+ return $ case v of+ Nothing -> Left trace+ Just value -> Right value+ where+ FlowState v _ trace = unFlow f s emptyTrace++-- | Generate all test files using the provided test generator+-- Returns a list of (FilePath, content) pairs+generateAllModuleTests :: TestGenerator a -> FilePath -> [(Module, TestGroup)] -> Flow Graph [(FilePath, String)]+generateAllModuleTests testGen baseDir modulePairs = do+ -- Perform type inference ONCE upfront for the entire graph+ -- This is critical for performance: inferGraphTypes is expensive and should not be called per-module+ g0 <- getState+ trace ("Starting type inference...") $ return ()+ g <- Inference.inferGraphTypes g0+ trace ("Type inference complete. Generating " ++ show (length modulePairs) ++ " module(s)...") $ return ()+ putState g++ files <- mapM (generateModuleTestWithProgress testGen baseDir) (zip [1..] modulePairs)+ -- Generate an aggregator file if the generator provides one+ case testGenAggregatorFile testGen of+ Just genAggregator -> return (genAggregator baseDir (map fst modulePairs) : files)+ Nothing -> return files++-- | Generate all test files incrementally, writing each file immediately after generation+-- This reduces peak memory usage by not accumulating all file contents in memory+-- Uses unsafePerformIO to write files from within Flow - this is safe because:+-- 1. The IO is idempotent (writing the same file twice produces the same result)+-- 2. The ordering doesn't affect the final result+-- Returns the count of files generated+generateAllModuleTestsIncremental :: TestGenerator a -> FilePath -> [(Module, TestGroup)] -> ((FilePath, String) -> IO ()) -> Flow Graph Int+generateAllModuleTestsIncremental testGen baseDir modulePairs writeFile = do+ -- Perform type inference ONCE upfront for the entire graph+ g0 <- getState+ trace ("Starting type inference...") $ return ()+ g <- Inference.inferGraphTypes g0+ trace ("Type inference complete. Generating " ++ show (length modulePairs) ++ " module(s)...") $ return ()+ putState g++ -- Generate files one at a time, writing each immediately+ -- Strict: any failure stops generation+ mapM_ (generateAndWriteModuleStrict testGen baseDir writeFile) (zip [1..] modulePairs)+ let successCount = length modulePairs++ -- Generate an aggregator file if the generator provides one+ case testGenAggregatorFile testGen of+ Just genAggregator -> do+ let aggregator = genAggregator baseDir (map fst modulePairs)+ unsafePerformIO (writeFile aggregator) `seq` return (successCount + 1)+ Nothing -> return successCount++-- | Generate and write a single module strictly (fails on any error)+generateAndWriteModuleStrict :: TestGenerator a -> FilePath -> ((FilePath, String) -> IO ()) -> (Int, (Module, TestGroup)) -> Flow Graph ()+generateAndWriteModuleStrict testGen baseDir writeFile (idx, pair) = do+ let (sourceModule, _) = pair+ ns = moduleNamespace sourceModule+ trace (" Generating module " ++ show idx ++ ": " ++ show ns) $ return ()+ result <- generateModuleTest testGen baseDir pair+ unsafePerformIO (writeFile result) `seq` return ()++-- | Try to run a Flow, returning Nothing if it fails instead of propagating the error+tryFlow :: Flow s a -> Flow s (Maybe a)+tryFlow f = Flow $ \s t ->+ let FlowState mval s' t' = unFlow f s t+ in FlowState (Just mval) s' t'++-- | Try to run a Flow, returning (Maybe result, error trace summary)+tryFlowWithTrace :: Flow s a -> Flow s (Maybe a, String)+tryFlowWithTrace f = Flow $ \s t ->+ let FlowState mval s' t' = unFlow f s t+ errMsg = case mval of+ Just _ -> ""+ Nothing -> traceSummary t'+ in FlowState (Just (mval, errMsg)) s' t'++-- | Generate a single module test and write it immediately+generateAndWriteModule :: TestGenerator a -> FilePath -> ((FilePath, String) -> IO ()) -> (Int, (Module, TestGroup)) -> Flow Graph ()+generateAndWriteModule testGen baseDir writeFile (idx, pair) = do+ let (sourceModule, _) = pair+ ns = moduleNamespace sourceModule+ trace (" Generating module " ++ show idx ++ ": " ++ show ns) $ return ()+ result <- generateModuleTest testGen baseDir pair+ -- Use unsafePerformIO to write the file immediately, then discard the result+ -- This allows GC to reclaim the generated content+ unsafePerformIO (writeFile result) `seq` return ()++-- | Generate a single test file for a module and its test group (with progress)+generateModuleTestWithProgress :: TestGenerator a -> FilePath -> (Int, (Module, TestGroup)) -> Flow Graph (FilePath, String)+generateModuleTestWithProgress testGen baseDir (idx, pair) = do+ let (sourceModule, _) = pair+ trace (" Generating module " ++ show idx ++ ": " ++ show (moduleNamespace sourceModule)) $ return ()+ generateModuleTest testGen baseDir pair++-- | Generate a single test file for a module and its test group+generateModuleTest :: TestGenerator a -> FilePath -> (Module, TestGroup) -> Flow Graph (FilePath, String)+generateModuleTest testGen baseDir (sourceModule, testGroup) = do+ -- Use the test generator's file generation function+ (filePath, content) <- testGenGenerateTestFile testGen generationModule testGroup++ let fullPath = FP.combine baseDir filePath+ return (fullPath, content)+ where+ -- Use the source module's namespace with "generation." prefix+ -- Keep the same dependencies so imports are generated correctly+ generationModule = sourceModule {moduleNamespace = addGenerationPrefix (moduleNamespace sourceModule)}++-- | Generate an aggregator spec file that imports all generated test modules+generateAggregatorSpec :: FilePath -> [Module] -> (FilePath, String)+generateAggregatorSpec baseDir modules =+ let addSpecSuffix (Namespace ns) = Namespace (ns ++ "Spec")+ modulePaths = map (namespaceToModuleName . addSpecSuffix . addGenerationPrefix . moduleNamespace) modules+ imports = L.intercalate "\n" $ map (\m -> "import qualified " ++ m ++ " as " ++ sanitizeModuleName m) modulePaths+ specs = L.intercalate "\n " $ map (\m -> sanitizeModuleName m ++ ".spec") modulePaths+ content = unlines [+ "-- Note: this is an automatically generated file. Do not edit.",+ "",+ "module Generation.Spec (spec) where",+ "",+ "import qualified Test.Hspec as H",+ imports,+ "",+ "spec :: H.Spec",+ "spec = do",+ " " ++ specs+ ]+ filePath = FP.combine baseDir "Generation/Spec.hs"+ in (filePath, content)+ where+ sanitizeModuleName = map (\c -> if c == '.' then '_' else c)+ namespaceToModuleName (Namespace ns) =+ L.intercalate "." $ L.map capitalize (L.filter (not . null) $ Strings.splitOn "." ns)+ capitalize [] = []+ capitalize (x:xs) = toUpper x : xs
+ src/main/haskell/Hydra/Staging/Testing/Generation/HaskellCodec.hs view
@@ -0,0 +1,533 @@+-- | Haskell-specific test code generation using HSpec++module Hydra.Staging.Testing.Generation.HaskellCodec where++import Hydra.Kernel hiding (map)+import Hydra.Testing+import Hydra.Coders (LanguageName(..))+import Hydra.Staging.Testing.Generation.Transform (collectTestCases, addGenerationPrefix)+import Hydra.Staging.Testing.Generation.Generate (TestGenerator(..), createTestGroupLookup, generateGenerationTestSuite)+import qualified Hydra.Ext.Haskell.Coder as HaskellCoder+import Hydra.Ext.Haskell.Utils (namespacesForModule, sanitizeHaskellName)+import qualified Hydra.Ext.Haskell.Serde as HaskellSerde+import Hydra.Serialization (printExpr, parenthesize)+import qualified Hydra.Ext.Haskell.Ast as H+import qualified Hydra.Names as Names+import qualified Hydra.Util as Util+import qualified Hydra.Show.Core as ShowCore+import qualified Hydra.Formatting as Formatting+import qualified Hydra.Lib.Strings as Strings+import qualified Hydra.Lib.Lists as Lists++import qualified Data.Map as M+import qualified Data.List as L+import qualified Data.Set as S+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Inference as Inference+import qualified Hydra.Substitution as Substitution+import qualified Hydra.Typing as Typing+import qualified Hydra.Decode.Core as DecodeCore+import Data.Char (toUpper)+import qualified System.FilePath as FP+++-- | Extract all variable names from term-encoded terms in a given term.+-- This recursively decodes encoded terms and extracts the variable names.+extractEncodedTermVariableNames :: Graph -> Term -> S.Set Name+extractEncodedTermVariableNames graph term =+ Rewriting.foldOverTerm TraversalOrderPre collectNames S.empty term+ where+ collectNames :: S.Set Name -> Term -> S.Set Name+ collectNames names t+ | isEncodedTerm (Rewriting.deannotateTerm t) =+ case DecodeCore.term graph t of+ Right decodedTerm ->+ -- Recursively extract variable names from the decoded term+ S.union names (Rewriting.termDependencyNames True True True decodedTerm)+ Left _ -> names+ | otherwise = names++-- | Add namespaces from a set of names to existing namespaces+addNamespacesToNamespaces :: Namespaces H.ModuleName -> S.Set Name -> Namespaces H.ModuleName+addNamespacesToNamespaces ns0 names =+ let newNamespaces = S.fromList $ mapMaybe Names.namespaceOf $ S.toList names+ toModuleName namespace =+ let parts = Strings.splitOn "." (unNamespace namespace)+ lastPart = L.last parts+ in H.ModuleName (Formatting.capitalize lastPart)+ toPair ns = (ns, toModuleName ns)+ newMappings = M.fromList $ map toPair $ S.toList newNamespaces+ in ns0 { namespacesMapping = M.union (namespacesMapping ns0) newMappings }+ where+ mapMaybe f = foldr (\x acc -> maybe acc (:acc) (f x)) []++-- | Check if a term is a FlowState record.+-- Returns Just (value, state, trace) if it is a FlowState record, Nothing otherwise.+isFlowStateRecord :: Term -> Maybe (Term, Term, Term)+isFlowStateRecord term = case Rewriting.deannotateTerm term of+ TermRecord rec | unName (recordTypeName rec) == "hydra.compute.FlowState" ->+ let fields = recordFields rec+ getValue = findField "value" fields+ getState = findField "state" fields+ getTrace = findField "trace" fields+ in case (getValue, getState, getTrace) of+ (Just v, Just s, Just t) -> Just (v, s, t)+ _ -> Nothing+ _ -> Nothing+ where+ findField :: String -> [Field] -> Maybe Term+ findField name = L.foldr (\f acc -> if unName (fieldName f) == name then Just (fieldTerm f) else acc) Nothing++-- | Preprocess input term to replace TermUnit state with emptyGraph in Flow unrolling patterns.+-- The kernel test generation converts the Flow state argument (e.g. emptyGraph) to TermUnit+-- due to type erasure, but some functions (like annotation functions) specifically require Graph state.+preprocessFlowInput :: Term -> Term+preprocessFlowInput = Rewriting.rewriteTerm rewrite+ where+ emptyGraphVar = TermVariable (Name "hydra.lexical.emptyGraph")++ rewrite :: (Term -> Term) -> Term -> Term+ rewrite recurse t = case Rewriting.deannotateTerm t of+ -- Pattern: (((unFlow flowExpr) state) trace)+ -- Structure: Application { function = Application { function = Application { function = Eliminator, arg = flowExpr }, arg = state }, arg = trace }+ -- We want to replace state=TermUnit with emptyGraph+ TermApplication app ->+ let func = applicationFunction app -- Application { function = Application { ... }, arg = state }+ traceArg = applicationArgument app -- trace+ in case Rewriting.deannotateTerm func of+ TermApplication stateApp ->+ let unFlowApp = applicationFunction stateApp -- Application { function = Eliminator, arg = flowExpr }+ stateArg = applicationArgument stateApp -- state (might be TermUnit)+ in case Rewriting.deannotateTerm unFlowApp of+ TermApplication elimApp ->+ let elimFunc = applicationFunction elimApp -- Eliminator+ in case Rewriting.deannotateTerm elimFunc of+ TermFunction (FunctionElimination (EliminationWrap wrapName))+ | unName wrapName == "hydra.compute.Flow" ->+ -- Found the pattern! Check if stateArg is TermUnit+ let newState = case Rewriting.deannotateTerm stateArg of+ TermUnit -> emptyGraphVar+ _ -> recurse stateArg+ -- Rebuild: ((unFlowApp newState) trace)+ newStateApp = TermApplication $ Application (recurse unFlowApp) newState+ in TermApplication $ Application newStateApp (recurse traceArg)+ _ -> recurse t+ _ -> recurse t+ _ -> recurse t+ _ -> recurse t++termToHaskell :: Namespaces H.ModuleName -> Term -> Flow Graph String+termToHaskell namespaces term = do+ result <- HaskellCoder.encodeTerm namespaces term+ return $ printExpr . parenthesize . HaskellSerde.expressionToExpr $ result++typeToHaskell :: Namespaces H.ModuleName -> Type -> Flow Graph String+typeToHaskell namespaces typ = (printExpr . parenthesize . HaskellSerde.typeToExpr) <$>+ HaskellCoder.encodeType namespaces typ++-- | Create a Haskell TestCodec that uses the real Haskell coder+haskellTestCodec :: Namespaces H.ModuleName -> TestCodec+haskellTestCodec namespaces = TestCodec {+ testCodecLanguage = LanguageName "haskell",+ testCodecFileExtension = FileExtension "hs",+ testCodecEncodeTerm = termToHaskell namespaces,+ testCodecEncodeType = typeToHaskell namespaces,+ testCodecFormatTestName = id, -- Keep test names as-is+ testCodecFormatModuleName = namespaceToModuleName,+ testCodecTestCaseTemplate = haskellTestCaseTemplate,+ testCodecTestGroupTemplate = haskellTestGroupTemplate,+ testCodecModuleTemplate = haskellModuleTemplate,+ testCodecImportTemplate = haskellImportTemplate,+ testCodecFindImports = findHaskellImports namespaces}++-- Templates for Haskell test generation+haskellTestCaseTemplate :: String+haskellTestCaseTemplate = unlines [+ " H.it {name} $ H.shouldBe",+ " ({input})",+ " ({output})"]++haskellTestGroupTemplate :: String+haskellTestGroupTemplate = "spec = H.describe {groupName} $ do"++haskellModuleTemplate :: String+haskellModuleTemplate = unlines [+ "-- " ++ warningAutoGeneratedFile,+ "",+ "module {moduleName} where",+ "",+ "{imports}",+ "",+ "spec :: H.Spec",+ "{testGroup}",+ "{testCases}"]++haskellImportTemplate :: String+haskellImportTemplate = "import qualified {namespace} as {alias}"++-- | Find necessary imports for Haskell based on referenced names+findHaskellImports :: Namespaces H.ModuleName -> S.Set Name -> [String]+findHaskellImports namespaces names = L.map makeImport (M.toList filteredMapping)+ where+ -- Filter out test module namespaces (hydra.test.*) which aren't in main library+ isTestNamespace (Namespace ns) = "hydra.test." `L.isPrefixOf` ns+ filteredMapping = M.filterWithKey (\ns _ -> not (isTestNamespace ns)) (namespacesMapping namespaces)+ makeImport (ns, alias) =+ "import qualified " ++ nsToModuleName ns ++ " as " ++ H.unModuleName alias+ nsToModuleName (Namespace ns) =+ Strings.intercalate "." $ Lists.map Formatting.capitalize (Strings.splitOn "." ns)++-- | Generate test hierarchy preserving the structure with H.describe blocks for subgroups+generateTestGroupHierarchy :: InferenceContext -> Namespaces H.ModuleName -> TestCodec -> Int -> TestGroup -> Flow Graph String+generateTestGroupHierarchy infContext namespaces codec depth testGroup = do+ -- Generate test cases at the current level with proper indentation+ testCaseLinesRaw <- mapM (generateTestCaseWithCodec infContext namespaces codec depth) (testGroupCases testGroup)+ let indent = replicate (depth * 2) ' '+ indentTestCase = L.map (indent ++)+ testCaseLines = fmap indentTestCase testCaseLinesRaw+ testCasesStr = L.intercalate "\n" (concat testCaseLines)++ -- Generate H.describe blocks for each subgroup+ subgroupStrs <- mapM generateSubgroupBlock (testGroupSubgroups testGroup)+ let subgroupsStr = L.intercalate "\n" subgroupStrs++ -- Combine test cases and subgroups+ return $ testCasesStr ++ (if null testCasesStr || null subgroupsStr then "" else "\n") ++ subgroupsStr+ where+ generateSubgroupBlock :: TestGroup -> Flow Graph String+ generateSubgroupBlock subgroup = do+ let indent = replicate (depth * 2) ' '+ -- Recursively generate content for this subgroup at depth+1 (nested inside this H.describe)+ subgroupContent <- generateTestGroupHierarchy infContext namespaces codec (depth + 1) subgroup+ let groupName = testGroupName subgroup+ -- Generate the H.describe block with proper indentation+ return $ indent ++ "H.describe " ++ show groupName ++ " $ do\n" ++ subgroupContent++-- | Generic test file generation using a TestCodec+generateTestFileWithCodec :: TestCodec -> Module -> TestGroup -> Namespaces H.ModuleName -> Flow Graph (FilePath, String)+generateTestFileWithCodec codec testModule testGroup namespaces = do+ -- Note: Type inference is now performed ONCE upfront in generateAllModuleTests (Generate.hs)+ -- This is critical for performance: inferGraphTypes is expensive and should not be called per-module+ g <- getState+ infContext <- graphToInferenceContext g++ -- Generate test hierarchy preserving the structure+ testBody <- generateTestGroupHierarchy infContext namespaces codec 1 testGroup++ -- Build the complete test module+ let testModuleContent = buildTestModuleWithCodec codec testModule testGroup testBody namespaces++ -- Use the codec's file extension for the path+ -- Append "Spec" to the namespace for hspec-discover compatibility+ let FileExtension ext = testCodecFileExtension codec+ let Namespace ns = moduleNamespace testModule+ let specNs = Namespace (ns ++ "Spec")+ let filePath = Names.namespaceToFilePath Util.CaseConventionPascal+ (FileExtension ext)+ specNs++ return (filePath, testModuleContent)++-- | Generate a single test case using a TestCodec+generateTestCaseWithCodec :: InferenceContext -> Namespaces H.ModuleName -> TestCodec -> Int -> TestCaseWithMetadata -> Flow Graph [String]+generateTestCaseWithCodec infContext namespaces codec depth (TestCaseWithMetadata name tcase _ _) = case tcase of+ TestCaseDelegatedEvaluation (DelegatedEvaluationTestCase inputRaw output) -> do+ -- Preprocess input to replace TermUnit state with emptyGraph in Flow patterns+ let input = preprocessFlowInput inputRaw++ -- Check if output is a FlowState record - if so, we compare only the flowStateValue+ -- because FlowState Graph a cannot be compared with shouldBe (Graph has no Show instance)+ case isFlowStateRecord output of+ Just (expectedValue, _, _) -> do+ -- Generate test that extracts flowStateValue from the result and compares it+ inputCode <- testCodecEncodeTerm codec input+ expectedValueCode <- testCodecEncodeTerm codec expectedValue++ let formattedName = testCodecFormatTestName codec name+ indentLines n s = L.intercalate ("\n" ++ replicate n ' ') (L.lines s)+ continuationIndent = depth * 2 + 4+ indentedInputCode = indentLines continuationIndent inputCode+ indentedExpectedCode = indentLines continuationIndent expectedValueCode++ -- Check if we need a type annotation for the expected value+ -- Use expectedValue (the unwrapped flowStateValue) for inference, not full FlowState output+ typeAnnotation <- generateTypeAnnotationForFlowStateValue infContext namespaces input expectedValue+ let finalExpectedCode = case typeAnnotation of+ Just anno -> indentedExpectedCode ++ anno+ Nothing -> indentedExpectedCode++ return [+ "H.it " ++ show formattedName ++ " $ H.shouldBe",+ " (Compute.flowStateValue (" ++ indentedInputCode ++ "))",+ " (" ++ finalExpectedCode ++ ")"]++ Nothing -> do+ -- Standard comparison - output is not a FlowState+ inputCode <- testCodecEncodeTerm codec input+ outputCode <- testCodecEncodeTerm codec output++ let formattedName = testCodecFormatTestName codec name+ indentLines n s = L.intercalate ("\n" ++ replicate n ' ') (L.lines s)+ continuationIndent = depth * 2 + 4+ indentedInputCode = indentLines continuationIndent inputCode+ indentedOutputCode = indentLines continuationIndent outputCode++ typeAnnotation <- generateTypeAnnotationFor infContext namespaces input output+ let (finalInputCode, finalOutputCode) = case typeAnnotation of+ Just anno -> (indentedInputCode, indentedOutputCode ++ anno)+ Nothing -> (indentedInputCode, indentedOutputCode)++ return [+ "H.it " ++ show formattedName ++ " $ H.shouldBe",+ " (" ++ finalInputCode ++ ")",+ " (" ++ finalOutputCode ++ ")"]++ _ -> return [] -- Skip non-delegated tests (shouldn't happen after transform)++-- | Generate a type annotation for FlowState value extraction.+-- Adds annotation when:+-- 1. Bare `Nothing` (always ambiguous) -> `Maybe Int`+-- 2. `Just Nothing` when INPUT also contains bare `Nothing` (polymorphic) -> `Maybe (Maybe Int)`+-- For (2), if input is concrete (like getTermDescription), GHC infers from input.+generateTypeAnnotationForFlowStateValue :: InferenceContext -> Namespaces H.ModuleName -> Term -> Term -> Flow Graph (Maybe String)+generateTypeAnnotationForFlowStateValue _ _ inputTerm expectedValue =+ case Rewriting.deannotateTerm expectedValue of+ TermMaybe Nothing -> return $ Just " :: Maybe Int"+ TermMaybe (Just inner) ->+ case Rewriting.deannotateTerm inner of+ TermMaybe Nothing ->+ -- Check if INPUT is polymorphic (contains bare Nothing)+ if inputContainsNothing inputTerm+ then return $ Just " :: Maybe (Maybe Int)"+ else return Nothing -- Input is concrete, GHC can infer+ _ -> return Nothing+ _ -> return Nothing+ where+ -- Check if input term contains bare Nothing (indicates polymorphism)+ inputContainsNothing :: Term -> Bool+ inputContainsNothing term = case Rewriting.deannotateTerm term of+ TermMaybe Nothing -> True+ TermMaybe (Just inner) -> inputContainsNothing inner+ TermApplication app ->+ inputContainsNothing (applicationFunction app) ||+ inputContainsNothing (applicationArgument app)+ TermFunction (FunctionLambda lam) -> inputContainsNothing (lambdaBody lam)+ TermRecord rec -> any (inputContainsNothing . fieldTerm) (recordFields rec)+ TermList xs -> any inputContainsNothing xs+ _ -> False++-- | Extract the value type from a FlowState type.+-- FlowState s a has flowStateValue :: Maybe a, so we extract the `Maybe a` type.+-- The type structure is: TypeApplication (ApplicationType (TypeApplication (ApplicationType (TypeRecord "FlowState") s)) a)+extractFlowStateValueType :: Type -> Flow Graph (Maybe Type)+extractFlowStateValueType typ = case Rewriting.deannotateType typ of+ -- FlowState s a -> extract Maybe a+ -- Structure: TypeApplication (TypeApplication FlowState s) a+ TypeApplication (ApplicationType (TypeApplication (ApplicationType base sType)) aType)+ | isFlowStateType base -> return $ Just $ TypeMaybe aType+ -- Check for TypeRecord with FlowState name+ TypeRecord rowType | unName (rowTypeTypeName rowType) == "hydra.compute.FlowState" ->+ -- FlowState as a record - extract the value field type+ let valueField = L.find (\f -> unName (fieldTypeName f) == "value") (rowTypeFields rowType)+ in case valueField of+ Just ft -> return $ Just $ fieldTypeType ft -- Already Maybe a+ Nothing -> return Nothing+ -- If it's wrapped in Maybe already (shouldn't happen), just return it+ TypeMaybe inner -> return $ Just typ+ -- Otherwise, return Nothing to indicate we couldn't extract the type+ _ -> return Nothing+ where+ isFlowStateType t = case Rewriting.deannotateType t of+ TypeWrap wt -> unName (wrappedTypeTypeName wt) == "hydra.compute.FlowState"+ TypeRecord rt -> unName (rowTypeTypeName rt) == "hydra.compute.FlowState"+ _ -> False++-- | Generate a type annotation for polymorphic output values+-- Adds annotations when BOTH:+-- 1. The inferred type has free type variables that GHC cannot resolve+-- 2. The output has no concrete values to guide type inference (empty list, etc.)+--+-- The annotation is derived from the INPUT term's inferred type, since the input+-- is the expression being evaluated and its result type should match the output type.+-- Free type variables are replaced with Int32.+generateTypeAnnotationFor :: InferenceContext -> Namespaces H.ModuleName -> Term -> Term -> Flow Graph (Maybe String)+generateTypeAnnotationFor infContext namespaces inputTerm outputTerm = do+ -- Only consider annotation if output has no concrete values to guide inference+ if not needsAnnotation+ then return Nothing+ else do+ -- Infer the type of the input expression (which gives us the result/output type)+ -- Use tryInferTypeOf to gracefully handle inference failures (e.g., when schema types+ -- like Graph conflict with polymorphic type variables)+ mresult <- tryInferTypeOf infContext inputTerm+ case mresult of+ Nothing -> return Nothing -- Inference failed; skip annotation+ Just (_, typeScheme) -> do+ let typ = typeSchemeType typeScheme+ -- Check if there are any free type variables that need grounding+ freeVars = S.toList $ S.difference+ (Rewriting.freeVariablesInType typ)+ schemaVars+ -- Either types ALWAYS need annotations (one branch is always unconstrained),+ -- while other polymorphic types only need annotations if they have free variables.+ if isEitherTerm outputTerm || not (null freeVars)+ then do+ -- Replace free type variables with Int32+ let int32Type = TypeLiteral (LiteralTypeInteger IntegerTypeInt32)+ subst = Typing.TypeSubst $ M.fromList [(v, int32Type) | v <- freeVars]+ groundedType = Substitution.substInType subst typ+ -- Encode the type as Haskell+ typeStr <- typeToHaskell namespaces groundedType+ return $ Just (" :: " ++ typeStr)+ else return Nothing+ where+ schemaVars = S.fromList $ M.keys $ inferenceContextSchemaTypes infContext+ needsAnnotation = containsTriviallyPolymorphic outputTerm+ isEitherTerm (TermEither _) = True+ isEitherTerm _ = False++-- | Try to infer the type of a term, returning Nothing if inference fails+-- This allows graceful degradation when type inference encounters issues+-- (e.g., schema types being unified with polymorphic type variables)+tryInferTypeOf :: InferenceContext -> Term -> Flow Graph (Maybe (Term, TypeScheme))+tryInferTypeOf infContext term = Flow $ \s t ->+ let FlowState mval s' t' = unFlow (Inference.inferTypeOf infContext term) s t+ in FlowState (Just mval) s' t'++-- | Check if a term CONTAINS any trivially polymorphic sub-terms (empty list, Nothing, etc.)+-- This recursively searches through the term structure to find any parts that would+-- cause GHC to need type annotations.+containsTriviallyPolymorphic :: Term -> Bool+containsTriviallyPolymorphic term = case term of+ TermList [] -> True -- Empty list+ TermList xs -> any containsTriviallyPolymorphic xs -- Check list elements+ TermSet s -> S.null s || any containsTriviallyPolymorphic (S.toList s) -- Empty set or elements+ TermMap m -> M.null m || any containsTriviallyPolymorphic (M.keys m) || any containsTriviallyPolymorphic (M.elems m)+ TermMaybe Nothing -> True -- Nothing value+ TermMaybe (Just x) -> containsTriviallyPolymorphic x -- Check content+ -- Either values ALWAYS need type annotations because one branch is unconstrained.+ -- Even `Right 5` needs an annotation because the Left type is ambiguous.+ TermEither _ -> True+ TermUnion inj -> containsTriviallyPolymorphic (fieldTerm $ injectionField inj)+ TermPair (a, b) -> containsTriviallyPolymorphic a || containsTriviallyPolymorphic b+ TermRecord fields -> any (containsTriviallyPolymorphic . fieldTerm) (recordFields fields)+ TermApplication app -> containsTriviallyPolymorphic (applicationFunction app) ||+ containsTriviallyPolymorphic (applicationArgument app)+ _ -> False++-- | Build the complete test module using a TestCodec+buildTestModuleWithCodec :: TestCodec -> Module -> TestGroup -> String -> Namespaces H.ModuleName -> String+buildTestModuleWithCodec codec testModule testGroup testBody namespaces = header ++ testBody ++ "\n"+ where+ -- Append "Spec" to module name for hspec-discover compatibility+ Namespace ns = moduleNamespace testModule+ specNs = Namespace (ns ++ "Spec")+ moduleNameString = testCodecFormatModuleName codec specNs+ groupName = testGroupName testGroup++ -- Use the codec's findImports to determine necessary imports+ -- For now, we'll pass an empty set since we're not tracking names yet+ -- TODO: collect names from test cases+ domainImports = testCodecFindImports codec S.empty++ -- Standard imports that are always needed for Haskell+ standardImports = [+ "import Hydra.Kernel",+ "import qualified Test.Hspec as H",+ "import qualified Data.List as L",+ "import qualified Data.Map as M",+ "import qualified Data.Set as S",+ "import qualified Data.Maybe as Y"]++ allImports = standardImports ++ domainImports++ -- Debug comments showing namespace configuration+ debugComments = [+ "-- DEBUG: Focus namespace = " ++ show (namespacesFocus namespaces),+ "-- DEBUG: Namespace mappings:",+ "-- " ++ show (M.toList $ namespacesMapping namespaces)+ ]++ header = unlines ([+ "-- " ++ warningAutoGeneratedFile,+ ""+ ] ++ debugComments ++ [+ "",+ "module " ++ moduleNameString ++ " where",+ ""+ ] ++ allImports ++ [+ "",+ "spec :: H.Spec",+ "spec = H.describe " ++ show groupName ++ " $ do"+ ])++-- | Convert namespace to Haskell module name+-- Uses the same logic as the Haskell coder's importName function+namespaceToModuleName :: Namespace -> String+namespaceToModuleName (Namespace ns) =+ Strings.intercalate "." $ Lists.map Formatting.capitalize (Strings.splitOn "." ns)++-- | Generate generation test file for a test group using the Haskell codec+generateHaskellTestFile :: Module -> TestGroup -> Flow Graph (FilePath, String)+generateHaskellTestFile testModule testGroup = do+ -- Build proper namespaces that include all primitives referenced in test terms+ namespaces <- buildNamespacesForTestGroup testModule testGroup++ -- Generate test file using the codec+ generateTestFileWithCodec (haskellTestCodec namespaces) testModule testGroup namespaces+ where+ buildNamespacesForTestGroup mod tgroup = do+ let testCases = collectTestCases tgroup+ testTerms = concatMap extractTestTerms testCases+ testBindings = zipWith (\i term -> Binding (Name $ "_test_" ++ show i) term Nothing) ([0..] :: [Integer]) testTerms+ tempModule = mod { moduleElements = testBindings }+ -- Get initial namespaces from the module+ baseNamespaces <- namespacesForModule tempModule+ -- Extract additional namespaces from term-encoded variable references+ graph <- getState+ let encodedNames = S.unions $ map (extractEncodedTermVariableNames graph) testTerms+ -- Add the encoded term namespaces to the base namespaces+ -- Also add hydra.lexical explicitly since it's needed for Flow tests (emptyGraph)+ let extraNamespaces = S.fromList [Name "hydra.lexical.emptyGraph"]+ return $ addNamespacesToNamespaces baseNamespaces (S.union encodedNames extraNamespaces)+ extractTestTerms (TestCaseWithMetadata _ tcase _ _) = case tcase of+ TestCaseDelegatedEvaluation (DelegatedEvaluationTestCase input output) -> [input, output]+ _ -> []++-- | Haskell-specific test generator+-- Provides the complete Haskell implementation of the TestGenerator abstraction+haskellTestGenerator :: TestGenerator H.ModuleName+haskellTestGenerator = TestGenerator {+ testGenNamespacesForModule = namespacesForModule,+ testGenCreateCodec = haskellTestCodec,+ testGenGenerateTestFile = generateHaskellTestFile,+ testGenAggregatorFile = Just generateHaskellAggregatorSpec+}++-- | Generate an aggregator spec file that imports all generated test modules (Haskell/HSpec style)+generateHaskellAggregatorSpec :: FilePath -> [Module] -> (FilePath, String)+generateHaskellAggregatorSpec baseDir modules =+ let addSpecSuffix (Namespace ns) = Namespace (ns ++ "Spec")+ modulePaths = map (namespaceToModuleName . addSpecSuffix . addGenerationPrefix . moduleNamespace) modules+ imports = L.intercalate "\n" $ map (\m -> "import qualified " ++ m ++ " as " ++ sanitizeModuleName m) modulePaths+ specs = L.intercalate "\n " $ map (\m -> sanitizeModuleName m ++ ".spec") modulePaths+ content = unlines [+ "-- Note: this is an automatically generated file. Do not edit.",+ "",+ "module Generation.Spec (spec) where",+ "",+ "import qualified Test.Hspec as H",+ imports,+ "",+ "spec :: H.Spec",+ "spec = do",+ " " ++ specs+ ]+ filePath = FP.combine baseDir "Generation/Spec.hs"+ in (filePath, content)+ where+ sanitizeModuleName = map (\c -> if c == '.' then '_' else c)+ namespaceToModuleName (Namespace ns) =+ L.intercalate "." $ L.map capitalize (L.filter (not . null) $ Strings.splitOn "." ns)+ capitalize [] = []+ capitalize (x:xs) = toUpper x : xs
+ src/main/haskell/Hydra/Staging/Testing/Generation/Transform.hs view
@@ -0,0 +1,192 @@+-- | Transform test cases for code generation, filtering to tests that can be compiled to target languages++module Hydra.Staging.Testing.Generation.Transform where++import Hydra.Kernel+import Hydra.Testing+import qualified Hydra.Dsl.Terms as Terms+import qualified Data.Maybe as Y+import qualified Data.Map as M+import qualified Data.List as L+++-- | Tag for tests that require decoding Flow values back to Terms (unsupported in generation tests)+tag_requiresFlowDecoding :: Tag+tag_requiresFlowDecoding = Tag "requiresFlowDecoding"++-- | Transform test group hierarchy to only include delegated evaluation tests.+-- These are the test cases which can be meaningfully transformed into executable code.+-- For example, a test case like `add 1 2 == 3` can be transformed into application-level code which is evaluated in+-- the runtime environment of the target language.+-- A test case like `freeVariablesInTerm (\x.y) == [y]` cannot be further transformed, except by term-encoding+-- the arguments.+-- Returns Nothing if the group becomes empty after filtering+transformToCompiledTests :: TestGroup -> Maybe TestGroup+transformToCompiledTests (TestGroup name desc subgroups cases) =+ let transformedCases = Y.mapMaybe transformTestCase cases+ transformedSubgroups = Y.mapMaybe transformToCompiledTests subgroups+ in if null transformedCases && null transformedSubgroups+ then Nothing+ else Just $ TestGroup name desc transformedSubgroups transformedCases++-- | Transform a test case to DelegatedEvaluationTestCase if applicable+-- Returns Nothing if the test case type cannot be translated+transformTestCase :: TestCaseWithMetadata -> Maybe TestCaseWithMetadata+transformTestCase tcase@(TestCaseWithMetadata name tc desc tags) = case tc of+ -- Case conversion: create delegated evaluation with convertCase call+ TestCaseCaseConversion (CaseConversionTestCase fromConv toConv fromStr toStr) ->+ Just $ TestCaseWithMetadata name delegated desc tags+ where+ delegated = TestCaseDelegatedEvaluation $ DelegatedEvaluationTestCase {+ delegatedEvaluationTestCaseInput = buildConvertCaseCall fromConv toConv fromStr,+ delegatedEvaluationTestCaseOutput = Terms.string toStr+ }++ -- Evaluation: convert directly to delegated evaluation+ TestCaseEvaluation (EvaluationTestCase _style input output) ->+ Just $ TestCaseWithMetadata name delegated desc tags+ where+ delegated = TestCaseDelegatedEvaluation $ DelegatedEvaluationTestCase {+ delegatedEvaluationTestCaseInput = input,+ delegatedEvaluationTestCaseOutput = output+ }++ -- Already delegated evaluation: keep as-is+ TestCaseDelegatedEvaluation _ ->+ Just tcase++ TestCaseTopologicalSort (TopologicalSortTestCase adjList expected) ->+ Just $ TestCaseWithMetadata name delegated desc tags+ where+ delegated = TestCaseDelegatedEvaluation $ DelegatedEvaluationTestCase {+ delegatedEvaluationTestCaseInput = buildTopologicalSortCall adjList,+ delegatedEvaluationTestCaseOutput = encodeEitherListList expected+ }++ TestCaseTopologicalSortSCC (TopologicalSortSCCTestCase adjList expected) ->+ Just $ TestCaseWithMetadata name delegated desc tags+ where+ delegated = TestCaseDelegatedEvaluation $ DelegatedEvaluationTestCase {+ delegatedEvaluationTestCaseInput = buildTopologicalSortSCCCall adjList,+ delegatedEvaluationTestCaseOutput = encodeListList expected+ }++ -- Other test types: exclude (not applicable for compiled tests)+ TestCaseAlphaConversion _ -> Nothing+ TestCaseDeannotateTerm _ -> Nothing+ TestCaseDeannotateType _ -> Nothing+ TestCaseEtaExpansion _ -> Nothing+ TestCaseFlattenLetTerms _ -> Nothing+ TestCaseFoldOverTerm _ -> Nothing+ TestCaseFreeVariables _ -> Nothing+ TestCaseHoistCaseStatements _ -> Nothing+ TestCaseHoistLetBindings _ -> Nothing+ TestCaseHoistPolymorphicLetBindings _ -> Nothing+ TestCaseHoistSubterms _ -> Nothing+ TestCaseInference _ -> Nothing+ TestCaseInferenceFailure _ -> Nothing+ TestCaseJsonCoder _ -> Nothing+ TestCaseJsonDecode _ -> Nothing+ TestCaseJsonEncode _ -> Nothing+ TestCaseJsonParser _ -> Nothing+ TestCaseJsonRoundtrip _ -> Nothing+ TestCaseJsonWriter _ -> Nothing+ TestCaseLiftLambdaAboveLet _ -> Nothing+ TestCaseNormalizeTypeVariables _ -> Nothing+ TestCaseRewriteTerm _ -> Nothing+ TestCaseRewriteType _ -> Nothing+ TestCaseSerialization _ -> Nothing+ TestCaseSimplifyTerm _ -> Nothing+ TestCaseTopologicalSortBindings _ -> Nothing+ TestCaseTypeChecking _ -> Nothing+ TestCaseTypeCheckingFailure _ -> Nothing+ TestCaseTypeReduction _ -> Nothing+ TestCaseSubstInType _ -> Nothing+ TestCaseVariableOccursInType _ -> Nothing+ TestCaseUnshadowVariables _ -> Nothing+ TestCaseUnifyTypes _ -> Nothing+ TestCaseJoinTypes _ -> Nothing++-- | Build a Term representing a convertCase function call+buildConvertCaseCall :: CaseConvention -> CaseConvention -> String -> Term+buildConvertCaseCall fromConv toConv input =+ TermApplication $ Application {+ applicationFunction = TermApplication $ Application {+ applicationFunction = TermApplication $ Application {+ applicationFunction = TermVariable convertCaseName,+ applicationArgument = encodeCaseConvention fromConv+ },+ applicationArgument = encodeCaseConvention toConv+ },+ applicationArgument = Terms.string input+ }+ where+ convertCaseName = Name "hydra.formatting.convertCase"++-- | Encode CaseConvention as a Term (unit variant)+encodeCaseConvention :: CaseConvention -> Term+encodeCaseConvention conv =+ TermUnion $ Injection _CaseConvention (Field fieldName TermUnit)+ where+ fieldName = case conv of+ CaseConventionLowerSnake -> _CaseConvention_lowerSnake+ CaseConventionUpperSnake -> _CaseConvention_upperSnake+ CaseConventionCamel -> _CaseConvention_camel+ CaseConventionPascal -> _CaseConvention_pascal++-- | Add "generation" namespace prefix+addGenerationPrefix :: Namespace -> Namespace+addGenerationPrefix (Namespace ns) = Namespace ("generation." ++ ns)++-- | Transform module with generation namespace+transformModule :: Module -> Module+transformModule (Module ns elements deps schemaDeps desc) =+ Module (addGenerationPrefix ns) elements deps schemaDeps desc++-- | Collect all test cases from a test group (flattening hierarchy)+collectTestCases :: TestGroup -> [TestCaseWithMetadata]+collectTestCases (TestGroup _ _ subgroups cases) =+ cases ++ concatMap collectTestCases subgroups++-- | Build a Term representing a topologicalSort function call+buildTopologicalSortCall :: [(Int, [Int])] -> Term+buildTopologicalSortCall adjList =+ TermApplication $ Application {+ applicationFunction = TermVariable topologicalSortName,+ applicationArgument = encodeAdjacencyList adjList+ }+ where+ topologicalSortName = Name "hydra.sorting.topologicalSort"++-- | Build a Term representing a topologicalSortComponents function call+buildTopologicalSortSCCCall :: [(Int, [Int])] -> Term+buildTopologicalSortSCCCall adjList =+ TermApplication $ Application {+ applicationFunction = TermVariable topologicalSortSCCName,+ applicationArgument = encodeAdjacencyList adjList+ }+ where+ topologicalSortSCCName = Name "hydra.sorting.topologicalSortComponents"++-- | Encode an adjacency list as a Term+encodeAdjacencyList :: [(Int, [Int])] -> Term+encodeAdjacencyList pairs = Terms.list (encodePair <$> pairs)+ where+ encodePair (node, deps) = Terms.pair (encodeInt node) (Terms.list (encodeInt <$> deps))++-- | Encode an Int as a Term+encodeInt :: Int -> Term+encodeInt = Terms.int32 . fromIntegral++-- | Encode Either [[Int]] [Int] as a Term+encodeEitherListList :: Either [[Int]] [Int] -> Term+encodeEitherListList (Left cycles) = Terms.left (encodeListList cycles)+encodeEitherListList (Right sorted) = Terms.right (encodeIntList sorted)++-- | Encode [[Int]] as a Term+encodeListList :: [[Int]] -> Term+encodeListList = Terms.list . fmap encodeIntList++-- | Encode [Int] as a Term+encodeIntList :: [Int] -> Term+encodeIntList = Terms.list . fmap encodeInt
src/main/haskell/Hydra/Staging/Yaml/Coder.hs view
@@ -1,7 +1,9 @@+-- | Bidirectional coder between Hydra terms and YAML nodes+ module Hydra.Staging.Yaml.Coder (yamlCoder) where import Hydra.Kernel-import Hydra.Adapt.Terms+import Hydra.Adapt.Modules (languageAdapter) import Hydra.Staging.Yaml.Language import Hydra.Adapt.Utils import qualified Hydra.Ext.Org.Yaml.Model as YM@@ -44,7 +46,7 @@ TermRecord (Record _ fields) -> YM.NodeMapping . M.fromList . Y.catMaybes <$> CM.zipWithM encodeField coders fields where encodeField (ft, coder) (Field (Name fn) fv) = case (fieldTypeType ft, fv) of- (TypeOptional _, TermOptional Nothing) -> pure Nothing+ (TypeMaybe _, TermMaybe Nothing) -> pure Nothing _ -> Just <$> ((,) <$> pure (yamlString fn) <*> coderEncode coder fv) _ -> unexpected "record" $ show term decode coders n = case n of@@ -79,12 +81,12 @@ coderDecode = \n -> case n of YM.NodeSequence nodes -> Terms.list <$> CM.mapM (coderDecode lc) nodes _ -> unexpected "sequence" $ show n}- TypeOptional ot -> do+ TypeMaybe ot -> do oc <- termCoder ot return Coder { coderEncode = \t -> case t of- TermOptional el -> Y.maybe (pure yamlNull) (coderEncode oc) el- _ -> unexpected "optional" $ show t,+ TermMaybe el -> Y.maybe (pure yamlNull) (coderEncode oc) el+ _ -> unexpected "maybe" $ show t, coderDecode = \n -> case n of YM.NodeScalar YM.ScalarNull -> pure $ Terms.optional Nothing _ -> Terms.optional . Just <$> coderDecode oc n}
src/main/haskell/Hydra/Staging/Yaml/Language.hs view
@@ -1,3 +1,5 @@+-- | Language constraints for YAML, defining which Hydra types can be represented in YAML+ module Hydra.Staging.Yaml.Language where import Hydra.Kernel@@ -17,7 +19,7 @@ TermVariantLiteral, TermVariantList, TermVariantMap,- TermVariantOptional,+ TermVariantMaybe, TermVariantRecord, TermVariantUnit], -- Note: TermVariantUnit is excluded because YAML null is used for optionals@@ -25,10 +27,10 @@ TypeVariantLiteral, TypeVariantList, TypeVariantMap,- TypeVariantOptional,+ TypeVariantMaybe, TypeVariantRecord, TypeVariantUnit], -- Note: TypeVariantUnit is excluded because YAML null is used for optionals languageConstraintsTypes = \typ -> case deannotateType typ of- TypeOptional (TypeOptional _) -> False+ TypeMaybe (TypeMaybe _) -> False _ -> True }
src/main/haskell/Hydra/Staging/Yaml/Modules.hs view
@@ -1,7 +1,9 @@+-- | Module-level YAML generation for Hydra terms+ module Hydra.Staging.Yaml.Modules (moduleToYaml) where import Hydra.Kernel-import Hydra.Adapt.Modules+import Hydra.Staging.Yaml.Coder import Hydra.Staging.Yaml.Serde import Hydra.Staging.Yaml.Language import qualified Hydra.Ext.Org.Yaml.Model as YM@@ -12,28 +14,23 @@ import qualified Data.Map as M -constructModule ::- Module- -> M.Map (Type) (Coder Graph Graph Term YM.Node)- -> [(Binding, TypedTerm)]- -> Flow Graph YM.Node-constructModule mod coders pairs = do- keyvals <- withTrace "encoding terms" (CM.mapM toYaml pairs)+-- | New simple adapter version that works with definitions directly+moduleToYaml :: Module -> [Definition] -> Flow Graph (M.Map FilePath String)+moduleToYaml mod defs = withTrace ("print module " ++ (unNamespace $ moduleNamespace mod)) $ do+ let termDefs = [td | DefinitionTerm td <- defs]+ node <- constructModule mod termDefs+ return $ M.fromList [(path, hydraYamlToString node)]+ where+ path = namespaceToFilePath CaseConventionCamel (FileExtension "yaml") $ moduleNamespace mod++constructModule :: Module -> [TermDefinition] -> Flow Graph YM.Node+constructModule mod termDefs = do+ keyvals <- withTrace "encoding terms" (CM.mapM toYaml termDefs) return $ YM.NodeMapping $ M.fromList keyvals where- toYaml (el, (TypedTerm term typ)) = withTrace ("element " ++ unName (bindingName el)) $ do- encode <- case M.lookup typ coders of- Nothing -> fail $ "no coder found for type " ++ show typ- Just coder -> pure $ coderEncode coder- node <- encode term- return (YM.NodeScalar $ YM.ScalarStr $ localNameOf $ bindingName el, node)+ toYaml (TermDefinition name term typeScheme) = withTrace ("element " ++ unName name) $ do+ coder <- yamlCoder (typeSchemeType typeScheme)+ node <- coderEncode coder term+ return (YM.NodeScalar $ YM.ScalarStr $ localNameOf name, node) ns = unNamespace $ moduleNamespace mod localNameOf name = L.drop (1 + L.length ns) $ unName name--moduleToYaml :: Module -> Flow Graph (M.Map FilePath String)-moduleToYaml mod = withTrace ("print module " ++ (unNamespace $ moduleNamespace mod)) $ do- node <- transformModule yamlLanguage encodeTerm constructModule mod- return $ M.fromList [(path, hydraYamlToString node)]- where- path = namespaceToFilePath CaseConventionCamel (FileExtension "yaml") $ moduleNamespace mod- encodeTerm _ = fail $ "only type definitions are expected in this mapping to YAML"
src/main/haskell/Hydra/Staging/Yaml/Serde.hs view
@@ -1,3 +1,5 @@+-- | YAML serialization and deserialization using the HsYAML library+ module Hydra.Staging.Yaml.Serde where import Hydra.Kernel
src/main/haskell/Hydra/Tools/Bytestrings.hs view
@@ -1,3 +1,5 @@+-- | Utilities for converting between lazy ByteStrings and Strings via UTF-8 encoding+ module Hydra.Tools.Bytestrings where import qualified Data.ByteString.Lazy as BS
src/main/haskell/Hydra/Tools/Monads.hs view
@@ -4,7 +4,6 @@ import Hydra.Compute import Hydra.Monads hiding (fail, pure)-import qualified Hydra.Mantle as Mantle import qualified Hydra.Lib.Flows as Flows import qualified Control.Monad as CM@@ -22,11 +21,6 @@ Nothing -> CM.fail $ traceSummary trace where FlowState mv _ trace = unFlow f cx emptyTrace--hydraEitherToHaskellEither :: Mantle.Either a b -> Either a b-hydraEitherToHaskellEither e = case e of- Mantle.EitherLeft l -> Left l- Mantle.EitherRight r -> Right r fromMaybe :: String -> Maybe a -> Flow s a fromMaybe message m = case m of
+ src/main/haskell/Org/Example/Lispy.hs view
@@ -0,0 +1,98 @@+{-+Example "Lispy" model created for wolfy++writePython "/tmp/python" mainModules [Org.Example.Lispy.module_]+-}++module Org.Example.Lispy where++import Hydra.Kernel+import Hydra.Dsl.Annotations (doc)+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Types ((>:))+import qualified Hydra.Dsl.Types as T+import qualified Hydra.Sources.Kernel.Types.Core as Core+++ns :: Namespace+ns = Namespace "org.example.lispy"++define :: String -> Type -> Binding+define = defineType ns++module_ :: Module+module_ = Module ns elements [] [Core.ns] $+ Just "Data model definition for the Lispy interpreter"+ where+ elements = [+ atom,+ closure,+ env,+ expr,+ lispList,+ number,+ proc,+ sExpr,+ symbol,+ value]++atom = define "Atom" $+ doc "An atomic Lispy value: number, boolean, None, or symbol" $+ T.union [+ "number">: number,+ "boolean">: T.boolean,+ "none">: T.unit,+ "symbol">: symbol]++closure = define "Closure" $+ T.record [+ "params">: T.list symbol,+ "body">: expr,+ "env">: env]++env = define "Env" $+ doc "Lexical environment with optional parent chaining." $+ T.record [+ "bindings">: T.map T.string value,+ "parent">: T.optional env]++expr = define "Expr" $+ doc "An expression is either an atom or an S-expression." $+ T.union [+ "atom">: atom,+ "sexpr">: sExpr]++lispList = define "LispList" $+ T.list value++number = define "Number" $+ doc ("Either an integer or a floating point number. "+ ++ "NOTE: `bool` is a subclass of `int` at runtime, but we keep it explicit here to "+ ++ "reflect Lispy truthiness (only `False`/`None` are falsey).") $+ T.union [+ "int">: T.int32,+ "float">: T.float32]++proc = define "Proc" $+ doc "A built-in procedure" $+ T.string -- Placeholder for Callable[..., Value]++sExpr = define "SExpr" $+ doc "An S-expression is a tuple whose elements are expressions (recursive type)." $+ T.list expr++symbol = define "Symbol" $+ T.string++value = define "Value" $+ doc ("Runtime values:\n"+ ++ "- atoms (numbers/bools/None/symbols)\n"+ ++ "- Lisp lists (tuples of values)\n"+ ++ "- procedures (builtins and closures)\n\n"+ ++ "We keep Expr separate because it includes unevaluated S-expressions; Value is "+ ++ "what evaluation can produce.") $+ T.union [+ "atom">: atom,+ "list">: lispList,+ "proc">: proc,+ "closure">: closure]
+ src/test/haskell/GenerationSpec.hs view
@@ -0,0 +1,11 @@+-- Bridge module to include generated tests in the test suite+-- This module re-exports the aggregated spec from generated tests++module GenerationSpec (spec) where++import qualified Generation.Spec as Generation+import qualified Test.Hspec as H++spec :: H.Spec+spec = Generation.spec+--spec = pure ()
src/test/haskell/Hydra/Adapt/LiteralsSpec.hs view
@@ -7,6 +7,7 @@ module Hydra.Adapt.LiteralsSpec where import Hydra.Kernel+import qualified Hydra.Lib.Literals as Literals import Hydra.TestUtils @@ -95,11 +96,11 @@ testLiteralAdapter :: H.SpecWith () testLiteralAdapter = H.describe "Test literal adapter" $ do - H.it "encode binary data as strings" $+ H.it "encode binary data as strings (base64)" $ QC.property $ \b -> checkLiteralAdapter [LiteralVariantString] LiteralTypeBinary LiteralTypeString False- (LiteralBinary b) (LiteralString b)+ (LiteralBinary b) (LiteralString $ Literals.binaryToStringBS b) H.it "encode booleans as strings" $ QC.property $ \b -> checkLiteralAdapter
src/test/haskell/Hydra/Adapt/TermsSpec.hs view
@@ -7,7 +7,6 @@ import qualified Hydra.Dsl.Types as Types import Hydra.Dsl.Tests -import Hydra.TestData import Hydra.TestUtils import qualified Test.Hspec as H@@ -83,7 +82,7 @@ H.it "Optionals (when supported) pass through without change" $ QC.property $ \mi -> checkDataAdapter- [TypeVariantLiteral, TypeVariantOptional]+ [TypeVariantLiteral, TypeVariantMaybe] optionalInt8Type optionalInt16Type False@@ -105,8 +104,8 @@ stringOrIntType stringOrIntType False- (variant stringOrIntName (Name "right") $ int32 int)- (variant stringOrIntName (Name "right") $ int32 int)+ (inject stringOrIntName (Name "right") $ int32 int)+ (inject stringOrIntName (Name "right") $ int32 int) H.it "Sets (when supported) pass through without change" $ QC.property $ \strings -> checkDataAdapter@@ -150,22 +149,22 @@ H.it "Optionals (when unsupported) become lists" $ QC.property $ \ms -> checkDataAdapter [TypeVariantLiteral, TypeVariantList]- (Types.optional Types.string)+ (Types.maybe Types.string) (Types.list Types.string) False (optional $ string <$> ms) (list $ Y.maybe [] (\s -> [string s]) ms) - H.it "Primitive function references (when unsupported) become variant terms" $+ H.it "Primitive function references (when unsupported) become inject terms" $ QC.property $ \name -> checkDataAdapter [TypeVariantLiteral, TypeVariantUnion, TypeVariantRecord] concatType (functionProxyType Types.string) False (primitive name)- (inject functionProxyName $ field "primitive" $ string $ unName name) -- Note: the function name is not dereferenced+ (inject functionProxyName (Name "primitive") (string $ unName name)) -- Note: the function name is not dereferenced --- H.it "Projections (when unsupported) become variant terms" $+-- H.it "Projections (when unsupported) become inject terms" $ -- QC.property $ \fname -> checkDataAdapter -- [TypeVariantLiteral, TypeVariantUnion, TypeVariantRecord] -- exampleProjectionType@@ -187,13 +186,13 @@ H.it "Unions (when unsupported) become records" $ QC.property $ \i -> checkDataAdapter- [TypeVariantLiteral, TypeVariantOptional, TypeVariantRecord]+ [TypeVariantLiteral, TypeVariantMaybe, TypeVariantRecord] eitherStringOrInt8Type (TypeRecord $ RowType eitherStringOrInt8TypeName [- Types.field "left" $ Types.optional Types.string,- Types.field "right" $ Types.optional Types.int16])+ Types.field "left" $ Types.maybe Types.string,+ Types.field "right" $ Types.maybe Types.int16]) False- (inject eitherStringOrInt8TypeName $ field "right" $ int8 i)+ (inject eitherStringOrInt8TypeName (Name "right") (int8 i)) (record eitherStringOrInt8TypeName [ field "left" $ optional Nothing, field "right" $ optional $ Just $ int16 $ fromIntegral i])@@ -255,7 +254,7 @@ --roundTripsPreserveArbitraryTypes = H.describe "Verify that the adapter is information preserving for arbitrary typed terms" $ do -- -- H.it "Check arbitrary type/term pairs" $--- QC.property $ \(TypedTerm term typ) -> roundTripIsNoop typ term+-- QC.property $ \(TypeApplicationTerm term typ) -> roundTripIsNoop typ term fieldAdaptersAreAsExpected :: H.SpecWith () fieldAdaptersAreAsExpected = H.describe "Check that field adapters are as expected" $ do@@ -288,7 +287,7 @@ languageConstraintsTypeVariants = S.fromList [ TypeVariantAnnotated, TypeVariantLiteral, TypeVariantList, TypeVariantMap, TypeVariantRecord, TypeVariantUnion], languageConstraintsTypes = \typ -> case deannotateType typ of- TypeOptional (TypeOptional _) -> False+ TypeMaybe (TypeMaybe _) -> False _ -> True } -- Note: in a real application, you wouldn't create the adapter just to use it once;
− src/test/haskell/Hydra/AnnotationsSpec.hs
@@ -1,131 +0,0 @@-module Hydra.AnnotationsSpec where--import Hydra.Kernel-import qualified Hydra.Dsl.Terms as Terms-import Hydra.TestUtils--import qualified Test.Hspec as H-import qualified Test.QuickCheck as QC-import qualified Data.Map as M---key_k1 = Name "k1"-key_k2 = Name "k2"-key_one = Name "one"-key_two = Name "two"--checkArbitraryAnnotations :: H.SpecWith ()-checkArbitraryAnnotations = H.describe "Check getting/setting of arbitrary annotations" $ do-- H.it "Set a single key/value pair" $- QC.property $ \k v -> H.shouldBe- (setAnn k (Just $ Terms.int32 v) $ Terms.string "foo")- (TermAnnotated $ AnnotatedTerm (Terms.string "foo") $ M.fromList [(k, Terms.int32 v)])-- H.it "Retrieve a single value" $- QC.property $ \k v -> H.shouldBe- (getAnn k $ setAnn k (Just $ Terms.string v) $ Terms.int32 42)- (Just $ Terms.string v)-- H.it "Retrieve a null value" $- QC.property $ \k -> H.shouldBe- (getAnn k $ Terms.int16 42)- Nothing-- H.it "Set multiple values" $- QC.property $ \v1 v2 -> H.shouldBe- (setAnn key_k2 (Just $ Terms.int32 v2) $- setAnn key_k1 (Just $ Terms.string v1) $- Terms.boolean True)- (TermAnnotated $ AnnotatedTerm (Terms.boolean True) $ M.fromList [(key_k1, Terms.string v1), (key_k2, Terms.int32 v2)])-- H.it "An outer annotation overrides an inner one" $- QC.property $ \k v1 v2 -> H.shouldBe- (setAnn k (Just $ Terms.string v2) $ setAnn k (Just $ Terms.string v1) $ Terms.string "bar")- (TermAnnotated $ AnnotatedTerm (Terms.string "bar") $ M.fromList [(k, Terms.string v2)])-- H.it "Unset a single annotation" $- QC.property $ \k -> H.shouldBe- (setAnn k Nothing $ setAnn k (Just $ Terms.string "foo") $ Terms.int64 137)- (Terms.int64 137)-- H.it "Unset one of multiple annotations" $- QC.property $ \v1 v2 -> H.shouldBe- (setAnn key_k1 Nothing $- setAnn key_k2 (Just $ Terms.int32 v2) $- setAnn key_k1 (Just $ Terms.string v1) $- Terms.int64 137)- (TermAnnotated $ AnnotatedTerm (Terms.int64 137) $ M.fromList [(key_k2, Terms.int32 v2)])--checkDescriptions :: H.SpecWith ()-checkDescriptions = H.describe "Check getting/setting of descriptions" $ do-- H.it "Set a single description" $- QC.property $ \d -> H.shouldBe- (setDesc (Just d) $ Terms.string "foo")- (TermAnnotated $ AnnotatedTerm (Terms.string "foo") $ M.fromList [(key_description, Terms.string d)])-- H.it "Retrieve a single description" $- QC.property $ \d -> H.shouldBe- (getDesc $ setDesc (Just d) $ Terms.int32 42)- (Just d)-- H.it "Retrieve a null description" $- QC.property $ \i -> H.shouldBe- (getDesc $ Terms.int16 i)- Nothing-- H.it "An outer description overrides an inner one" $- QC.property $ \d1 d2 -> H.shouldBe- (setDesc (Just d2) $ setDesc (Just d1) $ Terms.string "bar")- (TermAnnotated $ AnnotatedTerm (Terms.string "bar") $ M.fromList [(key_description, Terms.string d2)])-- H.it "Unset a description" $- QC.property $ \d -> H.shouldBe- (setDesc Nothing $ setDesc (Just d) $ Terms.int64 137)- (Terms.int64 137)--checkNoncompactAnnotations :: H.SpecWith ()-checkNoncompactAnnotations = H.describe "Check non-compact (i.e. layered) annotations" $ do-- H.it "Annotations at different levels, with different keys, are all available" $ do- H.shouldBe- (getTermAnnotation key_one term0)- Nothing- H.shouldBe- (getTermAnnotation key_one term1)- (Just $ Terms.int32 1)- H.shouldBe- (getTermAnnotation key_one term2)- (Just $ Terms.int32 1)- H.shouldBe- (getTermAnnotation key_two term2)- (Just $ Terms.int32 2)- H.shouldBe- (getTermAnnotation key_two term3)- (Just $ Terms.int32 2)-- H.it "Outer annotations override inner ones" $- H.shouldBe- (getTermAnnotation key_one term3)- (Just $ Terms.int32 42)-- where- term0 = Terms.int32 42- term1 = Terms.annot (M.fromList [(key_one, Terms.int32 1)]) term0- term2 = Terms.annot (M.fromList [(key_two, Terms.int32 2)]) term1- term3 = Terms.annot (M.fromList [(key_one, Terms.int32 42)]) term2--getAnn = getTermAnnotation--getDesc term = fromFlow (Just "no description") testGraph $ getTermDescription term--setAnn = setTermAnnotation--setDesc = setTermDescription--spec :: H.Spec-spec = do- checkArbitraryAnnotations- checkDescriptions- checkNoncompactAnnotations
src/test/haskell/Hydra/ArbitraryCore.hs view
@@ -7,6 +7,7 @@ import qualified Hydra.Dsl.Types as Types import qualified Control.Monad as CM+import qualified Data.ByteString as B import qualified Data.List as L import qualified Data.Map as M import qualified Data.Set as S@@ -14,6 +15,12 @@ import qualified Test.QuickCheck as QC +-- Arbitrary instance for ByteString+instance QC.Arbitrary B.ByteString where+ arbitrary = B.pack <$> QC.arbitrary+ shrink bs = B.pack <$> QC.shrink (B.unpack bs)++ instance QC.Arbitrary LiteralType where arbitrary = QC.oneof [@@ -73,7 +80,7 @@ IntegerValueUint64 <$> QC.arbitrary] instance QC.Arbitrary Term where- arbitrary = (\(TypedTerm term _) -> term) <$> QC.sized arbitraryTypedTerm+ arbitrary = (\(TypeApplicationTerm term _) -> term) <$> QC.sized arbitraryTypeApplicationTerm instance QC.Arbitrary Name where@@ -89,9 +96,9 @@ _ -> [] _ -> [] -- TODO -instance QC.Arbitrary TypedTerm where- arbitrary = QC.sized arbitraryTypedTerm- shrink (TypedTerm term typ) = L.concat ((\(t, m) -> TypedTerm <$> m term <*> pure t) <$> shrinkers typ)+instance QC.Arbitrary TypeApplicationTerm where+ arbitrary = QC.sized arbitraryTypeApplicationTerm+ shrink (TypeApplicationTerm term typ) = L.concat ((\(t, m) -> TypeApplicationTerm <$> m term <*> pure t) <$> shrinkers typ) arbitraryLiteral :: LiteralType -> QC.Gen Literal arbitraryLiteral at = case at of@@ -181,14 +188,15 @@ return (k, v) where n' = div n 2- TypeOptional ot -> optional <$> arbitraryOptional (arbitraryTerm ot) n'+ TypeMaybe ot -> optional <$> arbitraryOptional (arbitraryTerm ot) n' TypeRecord (RowType n sfields) -> record n <$> arbitraryFields sfields TypeSet st -> set <$> (S.fromList <$> arbitraryList False (arbitraryTerm st) n')- TypeUnion (RowType n sfields) -> inject n <$> do+ TypeUnion (RowType n sfields) -> do f <- QC.elements sfields let fn = fieldTypeName f+ let Name fnStr = fn ft <- arbitraryTerm (fieldTypeType f) n'- return $ Field fn ft+ return $ inject n (Name fnStr) ft TypeUnit -> pure TermUnit where n' = decr n@@ -205,17 +213,17 @@ TypeFunction <$> arbitraryPair FunctionType arbitraryType n', TypeList <$> arbitraryType n', TypeMap <$> arbitraryPair MapType arbitraryType n',- TypeOptional <$> arbitraryType n',+ TypeMaybe <$> arbitraryType n', -- TypeRecord <$> arbitraryList False arbitraryFieldType n', -- TODO: avoid duplicate field names TypeSet <$> arbitraryType n'] -- TypeUnion <$> arbitraryList True arbitraryFieldType n'] -- TODO: avoid duplicate field names where n' = decr n -arbitraryTypedTerm :: Int -> QC.Gen TypedTerm-arbitraryTypedTerm n = do+arbitraryTypeApplicationTerm :: Int -> QC.Gen TypeApplicationTerm+arbitraryTypeApplicationTerm n = do typ <- arbitraryType n' term <- arbitraryTerm typ n'- return $ TypedTerm term typ+ return $ TypeApplicationTerm term typ where n' = div n 2 -- TODO: a term is usually bigger than its type @@ -248,12 +256,12 @@ where shrinkPair m (km, vm) = (\vm' -> (km, vm')) <$> m vm dropPairs = [(Types.map kt vt, \(TermMap m) -> TermMap . M.fromList <$> dropAny (M.toList m))]- TypeOptional ot -> toNothing : promoteType : shrinkType+ TypeMaybe ot -> toNothing : promoteType : shrinkType where- toNothing = (Types.optional ot, \(TermOptional m) -> optional <$> Y.maybe [] (const [Nothing]) m)- promoteType = (ot, \(TermOptional m) -> Y.maybeToList m)- shrinkType = (\(t, m) -> (Types.optional t,- \(TermOptional mb) -> Y.maybe [] (fmap (optional . Just) . m) mb)) <$> shrinkers ot+ toNothing = (Types.maybe ot, \(TermMaybe m) -> optional <$> Y.maybe [] (const [Nothing]) m)+ promoteType = (ot, \(TermMaybe m) -> Y.maybeToList m)+ shrinkType = (\(t, m) -> (Types.maybe t,+ \(TermMaybe mb) -> Y.maybe [] (fmap (optional . Just) . m) mb)) <$> shrinkers ot TypeRecord (RowType name sfields) -> dropFields ++ shrinkFieldNames (TypeRecord . RowType name) (record name) (\(TermRecord (Record _ dfields)) -> dfields) sfields ++ promoteTypes ++ shrinkTypes@@ -274,7 +282,7 @@ promoteType = (st, \(TermSet els) -> S.toList els) shrinkType = (\(t, m) -> (Types.set t, \(TermSet els) -> set . S.fromList <$> CM.mapM m (S.toList els))) <$> shrinkers st TypeUnion (RowType name sfields) -> dropFields- ++ shrinkFieldNames (TypeUnion . RowType name) (inject name . L.head) (\(TermUnion (Injection _ f)) -> [f]) sfields+ ++ shrinkFieldNames (TypeUnion . RowType name) (\fs -> let Field (Name fn) ft = L.head fs in inject name (Name fn) ft) (\(TermUnion (Injection _ f)) -> [f]) sfields ++ promoteTypes ++ shrinkTypes where dropFields = [] -- TODO
src/test/haskell/Hydra/CoreCodersSpec.hs view
@@ -1,3 +1,9 @@+{-+stack ghci hydra:lib hydra:hydra-test++Test.Hspec.hspec Hydra.CoreCodersSpec.spec+-}+ module Hydra.CoreCodersSpec where import Hydra.Kernel@@ -5,6 +11,8 @@ import qualified Hydra.Dsl.Types as Types import qualified Hydra.Decode.Core as DecodeCore import qualified Hydra.Encode.Core as EncodeCore+import qualified Hydra.Monads as Monads+import qualified Hydra.Util as Util import Hydra.TestData import Hydra.TestUtils@@ -22,85 +30,217 @@ H.it "string literal type" $ do H.shouldBe (strip $ EncodeCore.literalType LiteralTypeString :: Term)- (strip $ unitVariant _LiteralType _LiteralType_string)+ (strip $ injectUnit _LiteralType _LiteralType_string) H.it "string type" $ do H.shouldBe (strip $ EncodeCore.type_ Types.string :: Term)- (strip $ variant _Type _Type_literal (unitVariant _LiteralType _LiteralType_string))+ (strip $ inject _Type _Type_literal (injectUnit _LiteralType _LiteralType_string)) H.it "int32 type" $ do H.shouldBe (strip $ EncodeCore.type_ Types.int32 :: Term)- (strip $ variant _Type _Type_literal (variant _LiteralType _LiteralType_integer $ unitVariant _IntegerType _IntegerType_int32))+ (strip $ inject _Type _Type_literal (inject _LiteralType _LiteralType_integer $ injectUnit _IntegerType _IntegerType_int32)) H.it "record type" $ do H.shouldBe (strip $ EncodeCore.type_ (TypeRecord $ RowType (Name "Example") [Types.field "something" Types.string, Types.field "nothing" Types.unit]) :: Term)- (strip $ variant _Type _Type_record $+ (strip $ inject _Type _Type_record $ record _RowType [ Field _RowType_typeName $ wrap _Name $ string "Example", Field _RowType_fields $ list [ record _FieldType [ Field _FieldType_name $ wrap _Name $ string "something",- Field _FieldType_type $ variant _Type _Type_literal $ unitVariant _LiteralType _LiteralType_string],+ Field _FieldType_type $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_string], record _FieldType [ Field _FieldType_name $ wrap _Name $ string "nothing",- Field _FieldType_type $ unitVariant _Type _Type_unit]]])+ Field _FieldType_type $ injectUnit _Type _Type_unit]]]) + H.it "Name (wrapped type)" $ do+ H.shouldBe+ (strip $ EncodeCore.name (Name "test.Name") :: Term)+ (strip $ wrap _Name $ string "test.Name")++ H.it "string literal" $ do+ H.shouldBe+ (strip $ EncodeCore.literal (LiteralString "hello") :: Term)+ (strip $ inject _Literal _Literal_string $ string "hello")++ H.it "int32 literal" $ do+ H.shouldBe+ (strip $ EncodeCore.literal (LiteralInteger (IntegerValueInt32 42)) :: Term)+ (strip $ inject _Literal _Literal_integer $ inject _IntegerValue _IntegerValue_int32 $ int32 42)++ H.it "boolean literal" $ do+ H.shouldBe+ (strip $ EncodeCore.literal (LiteralBoolean True) :: Term)+ (strip $ inject _Literal _Literal_boolean $ boolean True)++ H.it "Field (record type)" $ do+ H.shouldBe+ (strip $ EncodeCore.field (Field (Name "myField") (Terms.string "value")) :: Term)+ (strip $ record _Field [+ Field _Field_name $ wrap _Name $ string "myField",+ Field _Field_term $ inject _Term _Term_literal $ inject _Literal _Literal_string $ string "value"])++ H.it "Lambda function" $ do+ H.shouldBe+ (strip $ EncodeCore.lambda (Lambda (Name "x") Nothing (TermVariable (Name "x"))) :: Term)+ (strip $ record _Lambda [+ Field _Lambda_parameter $ wrap _Name $ string "x",+ Field _Lambda_domain $ optional Nothing,+ Field _Lambda_body $ inject _Term _Term_variable $ wrap _Name $ string "x"])++ H.it "function type" $ do+ H.shouldBe+ (strip $ EncodeCore.type_ (Types.function Types.string Types.int32) :: Term)+ (strip $ inject _Type _Type_function $ record _FunctionType [+ Field _FunctionType_domain $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_string,+ Field _FunctionType_codomain $ inject _Type _Type_literal $ inject _LiteralType _LiteralType_integer $+ injectUnit _IntegerType _IntegerType_int32])++ H.it "list type" $ do+ H.shouldBe+ (strip $ EncodeCore.type_ (Types.list Types.boolean) :: Term)+ (strip $ inject _Type _Type_list $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_boolean)++ H.it "optional type" $ do+ H.shouldBe+ (strip $ EncodeCore.type_ (Types.optional Types.string) :: Term)+ (strip $ inject _Type _Type_maybe $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_string)+ individualDecoderTestCases :: H.SpecWith () individualDecoderTestCases = do H.describe "Individual decoder test cases" $ do H.it "float32 literal type" $ do shouldSucceedWith- (DecodeCore.literalType- (variant _LiteralType _LiteralType_float $ unitVariant _FloatType _FloatType_float32))+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literalType testGraph+ (inject _LiteralType _LiteralType_float $ injectUnit _FloatType _FloatType_float32)) (LiteralTypeFloat FloatTypeFloat32) H.it "float32 type" $ do shouldSucceedWith- (DecodeCore.type_- (variant _Type _Type_literal $ variant _LiteralType _LiteralType_float $ unitVariant _FloatType _FloatType_float32))+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph+ (inject _Type _Type_literal $ inject _LiteralType _LiteralType_float $ injectUnit _FloatType _FloatType_float32)) Types.float32 H.it "union type" $ do shouldSucceedWith- (DecodeCore.type_ $- variant _Type _Type_union $ record _RowType [+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $+ inject _Type _Type_union $ record _RowType [ Field _RowType_typeName $ wrap _Name $ string (unName testTypeName), Field _RowType_fields $ list [ record _FieldType [ Field _FieldType_name $ wrap _Name $ string "left",- Field _FieldType_type $ variant _Type _Type_literal $ variant _LiteralType _LiteralType_integer $- unitVariant _IntegerType _IntegerType_int64],+ Field _FieldType_type $ inject _Type _Type_literal $ inject _LiteralType _LiteralType_integer $+ injectUnit _IntegerType _IntegerType_int64], record _FieldType [ Field _FieldType_name $ wrap _Name $ string "right",- Field _FieldType_type $ variant _Type _Type_literal $ variant _LiteralType _LiteralType_float $- unitVariant _FloatType _FloatType_float64]]])+ Field _FieldType_type $ inject _Type _Type_literal $ inject _LiteralType _LiteralType_float $+ injectUnit _FloatType _FloatType_float64]]]) (TypeUnion $ RowType testTypeName [ Types.field "left" Types.int64, Types.field "right" Types.float64]) + H.it "Name (wrapped type)" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.name testGraph $+ wrap _Name $ string "test.Name")+ (Name "test.Name")++ H.it "string literal" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literal testGraph $+ inject _Literal _Literal_string $ string "hello")+ (LiteralString "hello")++ H.it "int32 literal" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literal testGraph $+ inject _Literal _Literal_integer $ inject _IntegerValue _IntegerValue_int32 $ int32 42)+ (LiteralInteger (IntegerValueInt32 42))++ H.it "boolean literal" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literal testGraph $+ inject _Literal _Literal_boolean $ boolean True)+ (LiteralBoolean True)++ H.it "Field (record type)" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.field testGraph $+ record _Field [+ Field _Field_name $ wrap _Name $ string "myField",+ Field _Field_term $ inject _Term _Term_literal $ inject _Literal _Literal_string $ string "value"])+ (Field (Name "myField") (Terms.string "value"))++ H.it "Lambda function" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.lambda testGraph $+ record _Lambda [+ Field _Lambda_parameter $ wrap _Name $ string "x",+ Field _Lambda_domain $ optional Nothing,+ Field _Lambda_body $ inject _Term _Term_variable $ wrap _Name $ string "x"])+ (Lambda (Name "x") Nothing (TermVariable (Name "x")))++ H.it "function type" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $+ inject _Type _Type_function $ record _FunctionType [+ Field _FunctionType_domain $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_string,+ Field _FunctionType_codomain $ inject _Type _Type_literal $ inject _LiteralType _LiteralType_integer $+ injectUnit _IntegerType _IntegerType_int32])+ (Types.function Types.string Types.int32)++ H.it "list type" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $+ inject _Type _Type_list $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_boolean)+ (Types.list Types.boolean)++ H.it "optional type" $ do+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $+ inject _Type _Type_maybe $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_string)+ (Types.optional Types.string)+ decodeInvalidTerms :: H.SpecWith () decodeInvalidTerms = do H.describe "Decode invalid terms" $ do H.it "Try to decode a term with wrong fields for Type" $ do- shouldFail (DecodeCore.type_ $ variant untyped (Name "unknownField") $ list [])+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $ inject untyped (Name "unknownField") $ list []) H.it "Try to decode an incomplete representation of a Type" $ do- shouldFail (DecodeCore.type_ $ variant _Type _Type_literal $ unitVariant _LiteralType _LiteralType_integer)+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $ inject _Type _Type_literal $ injectUnit _LiteralType _LiteralType_integer) + H.it "Try to decode a Name from non-string" $ do+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.name testGraph $ wrap _Name $ int32 42)++ H.it "Try to decode a Literal from wrong union variant" $ do+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literal testGraph $ inject untyped (Name "unknownVariant") $ string "bad")++ H.it "Try to decode a record with missing field" $ do+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.field testGraph $+ record _Field [Field _Field_name $ wrap _Name $ string "onlyName"])++ H.it "Try to decode a Lambda with wrong body type" $ do+ shouldFail (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.lambda testGraph $+ record _Lambda [+ Field _Lambda_parameter $ wrap _Name $ string "x",+ Field _Lambda_domain $ optional Nothing,+ Field _Lambda_body $ string "notATerm"])+ metadataIsPreserved :: H.SpecWith () metadataIsPreserved = do H.describe "Check that metadata is preserved through a type-encoding round trip" $ do H.it "Basic metadata" $ do shouldSucceedWith- (DecodeCore.type_ $ EncodeCore.type_ annotatedStringType)+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $ EncodeCore.type_ annotatedStringType) annotatedStringType where annotatedStringType :: Type@@ -115,9 +255,59 @@ H.it "Try random types" $ QC.property $ \typ -> shouldSucceedWith- (DecodeCore.type_ $ EncodeCore.type_ typ)+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.type_ testGraph $ EncodeCore.type_ typ) typ +testRoundTripsFromLiteral :: H.SpecWith ()+testRoundTripsFromLiteral = do+ H.describe "Check that encoding, then decoding random literals is a no-op" $ do++ H.it "Try random literals" $+ QC.property $ \lit ->+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literal testGraph $ EncodeCore.literal lit)+ lit++testRoundTripsFromLiteralType :: H.SpecWith ()+testRoundTripsFromLiteralType = do+ H.describe "Check that encoding, then decoding random literal types is a no-op" $ do++ H.it "Try random literal types" $+ QC.property $ \litType ->+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.literalType testGraph $ EncodeCore.literalType litType)+ litType++testRoundTripsFromName :: H.SpecWith ()+testRoundTripsFromName = do+ H.describe "Check that encoding, then decoding random names is a no-op" $ do++ H.it "Try random names" $+ QC.property $ \name ->+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.name testGraph $ EncodeCore.name name)+ name++testRoundTripsFromIntegerType :: H.SpecWith ()+testRoundTripsFromIntegerType = do+ H.describe "Check that encoding, then decoding random integer types is a no-op" $ do++ H.it "Try random integer types" $+ QC.property $ \intType ->+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.integerType testGraph $ EncodeCore.integerType intType)+ intType++testRoundTripsFromFloatType :: H.SpecWith ()+testRoundTripsFromFloatType = do+ H.describe "Check that encoding, then decoding random float types is a no-op" $ do++ H.it "Try random float types" $+ QC.property $ \floatType ->+ shouldSucceedWith+ (Monads.eitherToFlow Util.unDecodingError $ DecodeCore.floatType testGraph $ EncodeCore.floatType floatType)+ floatType+ spec :: H.Spec spec = do individualEncoderTestCases@@ -125,3 +315,8 @@ decodeInvalidTerms metadataIsPreserved testRoundTripsFromType+ testRoundTripsFromLiteral+ testRoundTripsFromLiteralType+ testRoundTripsFromName+ testRoundTripsFromIntegerType+ testRoundTripsFromFloatType
src/test/haskell/Hydra/Dsl/TypesSpec.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE OverloadedStrings #-}- module Hydra.Dsl.TypesSpec where import Hydra.Kernel@@ -17,21 +15,21 @@ H.it "Function arrows are supported" $ do check- ("a" --> "b")- (function (var "a") (var "b"))+ ("a" ~> "b")+ (function (variable "a") (variable "b")) check- (string --> int32)+ (string ~> int32) (function string int32) H.it "Function arrows are right-associative" $ do check- ("a" --> "b" --> "c")- ("a" --> ("b" --> "c"))+ ("a" ~> "b" ~> "c")+ ("a" ~> ("b" ~> "c")) H.it "Functions bind less tightly than application" $ do check- ("a" @@ "b" --> "c" @@ "d")- (("a" @@ "b") --> ("c" @@ "d"))+ ("a" @@ "b" ~> "c" @@ "d")+ (("a" @@ "b") ~> ("c" @@ "d")) checkHelperFunctions :: H.SpecWith () checkHelperFunctions = do@@ -39,8 +37,8 @@ H.it "Check n-ary functions" $ do check- (functionMany ["a", "b"])- (function "a" "b")+ (functionMany [variable "a", variable "b"])+ (function (variable "a") (variable "b")) check (functionMany [int32, string, boolean]) (function int32 $ function string boolean)
− src/test/haskell/Hydra/InferenceSpec.hs
@@ -1,1699 +0,0 @@--- Additional inference tests, adding to those in the generated test suite--{--stack ghci hydra:lib hydra:hydra-test--Test.Hspec.hspec Hydra.InferenceSpec.spec--}--module Hydra.InferenceSpec where--import Hydra.Kernel-import Hydra.TestUtils-import Hydra.Staging.TestGraph-import Hydra.Tools.Monads-import qualified Hydra.Lib.Flows as Flows-import Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types--import qualified Test.Hspec as H-import qualified Test.QuickCheck as QC-import qualified Data.Char as C-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S---spec :: H.Spec-spec = do- checkTypeOf- checkFailTypeOfOnUntypedTerms--------------------------------------------checkFailTypeOfOnUntypedTerms :: H.SpecWith ()-checkFailTypeOfOnUntypedTerms = H.describe "Fail on untyped (pre-inference) terms" $ do- H.describe "Untyped lambdas" $ do- withDefaults typeOfShouldFail "untyped var in record"- (lambda "x" (record testTypeLatLonName [- field "lat" (float32 19.5429),- field "lon" (var "x")]))--------------------------------------------checkTypeOf :: H.SpecWith ()-checkTypeOf = H.describe "typeOf" $ do- checkTypeOfAnnotatedTerms- checkTypeOfApplications- checkTypeOfFunctions- checkTypeOfLetTerms- checkTypeOfLists- checkTypeOfLiterals- checkTypeOfMaps- checkTypeOfOptionals- checkTypeOfProducts- checkTypeOfRecords- checkTypeOfSets- checkTypeOfSums- checkTypeOfUnions- checkTypeOfUnit- checkTypeOfVariables- checkTypeOfWrappedTerms--checkTypeOfAnnotatedTerms :: H.SpecWith ()-checkTypeOfAnnotatedTerms = H.describe "Annotated terms" $ do- H.describe "Top-level annotations" $ do- expectTypeOf "annotated literal"- (annotated (int32 42) M.empty)- Types.int32- expectTypeOf "annotated list"- (annotated (list [string "a", string "b"]) M.empty)- (Types.list Types.string)- expectTypeOf "annotated record"- (annotated (record testTypePersonName [- field "firstName" (string "John"),- field "lastName" (string "Doe"),- field "age" (int32 25)]) M.empty)- (Types.var "Person")- expectTypeOf "annotated lambda"- (annotated (lambda "x" $ var "x") M.empty)- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))-- H.describe "Nested annotations" $ do- expectTypeOf "annotation within annotation"- (annotated (annotated (int32 100) M.empty) M.empty)- Types.int32- expectTypeOf "annotated terms in tuple"- (tuple [annotated (int32 1) M.empty,- annotated (string "hello") M.empty])- (Types.product [Types.int32, Types.string])- expectTypeOf "annotated term in function application"- (annotated (lambda "x" $ var "x") M.empty @@ annotated (int32 42) M.empty)- Types.int32-- H.describe "Annotations in complex contexts" $ do- expectTypeOf "annotated let binding"- (lets ["x">: annotated (int32 5) M.empty,- "y">: annotated (string "world") M.empty] $- annotated (tuple [var "x", var "y"]) M.empty)- (Types.product [Types.int32, Types.string])- expectTypeOf "annotated record fields"- (record testTypePersonName [- field "firstName" (annotated (string "Alice") M.empty),- field "lastName" (annotated (string "Smith") M.empty),- field "age" (annotated (int32 30) M.empty)])- (Types.var "Person")- expectTypeOf "annotated function in application"- (lets ["add">: annotated (primitive _math_add) M.empty] $- var "add" @@ annotated (int32 10) M.empty @@ annotated (int32 20) M.empty)- Types.int32--checkTypeOfApplications :: H.SpecWith ()-checkTypeOfApplications = H.describe "Applications" $ do- H.describe "Simple function applications" $ do- expectTypeOf "identity application"- (lambda "x" (var "x") @@ int32 42)- Types.int32- expectTypeOf "primitive application"- (primitive _math_add @@ int32 10 @@ int32 20)- Types.int32- expectTypeOf "string concatenation"- (primitive _strings_cat2 @@ string "hello" @@ string "world")- Types.string-- H.describe "Partial applications" $ do- expectTypeOf "partially applied add"- (primitive _math_add @@ int32 5)- (Types.function Types.int32 Types.int32)- expectTypeOf "partially applied string cat"- (primitive _strings_cat2 @@ string "prefix")- (Types.function Types.string Types.string)-- H.describe "Higher-order applications" $ do- expectTypeOf "apply function to function"- (lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x",- "double">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $- var "apply" @@ var "double" @@ int32 5)- Types.int32- expectTypeOf "function composition"- (lets ["compose">: lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"),- "add1">: lambda "n" $ primitive _math_add @@ var "n" @@ int32 1,- "mul2">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $- var "compose" @@ var "add1" @@ var "mul2" @@ int32 3)- Types.int32-- H.describe "Polymorphic applications" $ do- expectTypeOf "polymorphic identity"- (lets ["id">: lambda "x" $ var "x"] $- tuple [var "id" @@ int32 42, var "id" @@ string "hello"])- (Types.product [Types.int32, Types.string])- expectTypeOf "polymorphic const"- (lets ["const">: lambdas ["x", "y"] $ var "x"] $- var "const" @@ string "keep" @@ int32 999)- Types.string- expectTypeOf "polymorphic flip"- (lets ["flip">: lambda "f" $ lambda "x" $ lambda "y" $ var "f" @@ var "y" @@ var "x"] $- var "flip" @@ primitive _strings_cat2 @@ string "world" @@ string "hello")- Types.string-- H.describe "Applications in complex contexts" $ do- expectTypeOf "application in tuple"- (tuple [primitive _math_add @@ int32 1 @@ int32 2,- primitive _strings_cat2 @@ string "a" @@ string "b"])- (Types.product [Types.int32, Types.string])- expectTypeOf "application in record"- (record testTypePersonName [- field "firstName" (primitive _strings_cat2 @@ string "John" @@ string "ny"),- field "lastName" (string "Doe"),- field "age" (primitive _math_add @@ int32 20 @@ int32 5)])- (Types.var "Person")- expectTypeOf "application in let binding"- (lets ["result">: primitive _math_mul @@ int32 6 @@ int32 7] $- var "result")- Types.int32- expectTypeOf "nested applications"- (primitive _math_add @@ (primitive _math_mul @@ int32 3 @@ int32 4) @@ (primitive _math_add @@ int32 1 @@ int32 2))- Types.int32-- H.describe "Applications with complex arguments" $ do- expectTypeOf "application with record argument"- (lets ["getName">: lambda "person" $ project testTypePersonName (Name "firstName") @@ var "person"] $- var "getName" @@ record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 25)])- Types.string- expectTypeOf "application with list argument"- (lets ["head">: lambda "xs" $ primitive _lists_head @@ var "xs"] $- var "head" @@ list [string "first", string "second"])- Types.string--checkTypeOfEliminations :: H.SpecWith ()-checkTypeOfEliminations = H.describe "Eliminations" $ do- checkTypeOfProductEliminations- checkTypeOfRecordEliminations- checkTypeOfUnionEliminations- checkTypeOfWrapEliminations--checkTypeOfFunctions :: H.SpecWith ()-checkTypeOfFunctions = H.describe "Functions" $ do- checkTypeOfEliminations- checkTypeOfLambdas- checkTypeOfPrimitives--checkTypeOfLambdas :: H.SpecWith ()-checkTypeOfLambdas = H.describe "Lambdas" $ do- H.describe "Simple lambdas" $ do- expectTypeOf "identity function"- (lambda "x" $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "constant function"- (lambda "x" $ int32 42)- (Types.forAll "t0" $ Types.function (Types.var "t0") Types.int32)-- H.describe "Multi-parameter lambdas" $ do- expectTypeOf "two parameters"- (lambda "x" $ lambda "y" $ var "x")- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.var "t0")))- expectTypeOf "three parameters"- (lambda "x" $ lambda "y" $ lambda "z" $ var "y")- (Types.forAlls ["t0", "t1", "t2"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.function (Types.var "t2") (Types.var "t1"))))- expectTypeOf "parameter reuse"- (lambda "x" $ lambda "y" $ tuple [var "x", var "x", var "y"])- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.product [Types.var "t0", Types.var "t0", Types.var "t1"])))-- H.describe "Lambdas with operations" $ do- expectTypeOf "lambda with primitive"- (lambda "x" $ primitive _math_add @@ var "x" @@ int32 1)- (Types.function Types.int32 Types.int32)- expectTypeOf "lambda with application"- (lambda "f" $ lambda "x" $ var "f" @@ var "x")- (Types.forAlls ["t0", "t1"] $ Types.function (Types.function (Types.var "t0") (Types.var "t1")) (Types.function (Types.var "t0") (Types.var "t1")))- expectTypeOf "lambda with construction"- (lambda "x" $ lambda "y" $ tuple [var "x", var "y"])- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.product [Types.var "t0", Types.var "t1"])))-- H.describe "Nested lambdas" $ do- expectTypeOf "lambda returning lambda"- (lambda "x" $ lambda "y" $ lambda "z" $ var "x")- (Types.forAlls ["t0", "t1", "t2"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.function (Types.var "t2") (Types.var "t0"))))- expectTypeOf "lambda with let binding"- (lambda "x" $ lets ["y">: var "x"] $ var "y")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "lambda with inner lambda"- (lambda "outer" $ lets ["inner">: lambda "x" $ var "x"] $ var "inner" @@ var "outer")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))-- H.describe "Lambdas in complex contexts" $ do- expectTypeOf "lambda in tuple"- (tuple [lambda "x" $ var "x", int32 42])- (Types.forAll "t0" $ Types.product [Types.function (Types.var "t0") (Types.var "t0"), Types.int32])- expectTypeOf "lambda in list"- (list [lambda "x" $ primitive _math_add @@ var "x" @@ int32 1,- lambda "y" $ primitive _math_mul @@ var "y" @@ int32 2])- (Types.list $ Types.function Types.int32 Types.int32)- expectTypeOf "lambda in record"- (lambda "name" $ record testTypePersonName [- field "firstName" (var "name"),- field "lastName" (string "Doe"),- field "age" (int32 30)])- (Types.function Types.string (Types.var "Person"))-- H.describe "Higher-order lambdas" $ do- expectTypeOf "function composition"- (lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"))- (Types.forAlls ["t0", "t1", "t2"] $ Types.function- (Types.function (Types.var "t0") (Types.var "t1"))- (Types.function- (Types.function (Types.var "t2") (Types.var "t0"))- (Types.function (Types.var "t2") (Types.var "t1"))))- expectTypeOf "function application"- (lambda "f" $ lambda "x" $ var "f" @@ var "x")- (Types.forAlls ["t0", "t1"] $ Types.function (Types.function (Types.var "t0") (Types.var "t1")) (Types.function (Types.var "t0") (Types.var "t1")))- expectTypeOf "curried function"- (lambda "x" $ lambda "y" $ lambda "z" $ primitive _logic_ifElse @@ var "x" @@ var "y" @@ var "z")- (Types.forAll "t0" $ Types.function Types.boolean (Types.function (Types.var "t0") (Types.function (Types.var "t0") (Types.var "t0"))))--checkTypeOfLetTerms :: H.SpecWith ()-checkTypeOfLetTerms = H.describe "Let terms" $ do- H.describe "Simple let bindings" $ do- expectTypeOf "single binding"- (lets ["x">: int32 42] $- var "x")- Types.int32- expectTypeOf "multiple bindings"- (lets ["x">: int32 42,- "y">: string "hello"] $- tuple [var "x", var "y"])- (Types.product [Types.int32, Types.string])- expectTypeOf "binding shadowing"- (lets ["x">: int32 1] $- lets ["x">: string "shadow"] $- var "x")- Types.string-- H.describe "Recursive bindings" $ do- expectTypeOf "simple arithmetic recursion"- (lets ["double">: lambda "n" $ primitive _math_add @@ var "n" @@ var "n"] $- var "double" @@ int32 5)- Types.int32-- H.describe "Mutual recursion" $ do- expectTypeOf "mutually recursive data"- (lets ["listA">: record testTypeBuddyListAName [- field "head" (int32 1),- field "tail" (just $ var "listB")],- "listB">: record testTypeBuddyListBName [- field "head" (int32 2),- field "tail" (nothing)]] $- var "listA")- (Types.apply (Types.var "BuddyListA") Types.int32)- expectTypeOf "(monomorphic) mutually recursive functions"- (lets ["f">: lambda "x" $ var "g" @@ var "x",- "g">: lambda "y" $ primitive _math_add @@ var "y" @@ int32 1] $- var "f" @@ int32 5)- Types.int32-- H.describe "Nested let terms" $ do- expectTypeOf "monomorphic nesting"- (lets ["x">: int32 1] $- lets ["y">: primitive _math_add @@ var "x" @@ int32 2] $- lets ["z">: primitive _math_mul @@ var "y" @@ int32 3] $- var "z")- Types.int32- expectTypeOf "polymorphic nesting"- (lets ["id">: lambda "x" $ var "x"] $- lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x"] $- var "apply" @@ var "id" @@ string "test")- Types.string- expectTypeOf "variable capture avoidance"- (lets ["x">: int32 1] $- lambda "x" $ lets ["y">: var "x"] $- var "y")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))-- H.describe "Let with complex expressions" $ do- expectTypeOf "let in record"- (record testTypePersonName [- field "firstName" (lets ["first">: string "John",- "middle">: string "Q"] $- primitive _strings_cat2 @@ var "first" @@ var "middle"),- field "lastName" (string "Doe"),- field "age" (int32 30)])- (Types.var "Person")- expectTypeOf "let in function application"- (lets ["x">: int32 5,- "y">: int32 3] $- primitive _math_add @@ var "x" @@ var "y")- Types.int32- expectTypeOf "polymorphic let binding"- (lets ["id">: lambda "x" $ var "x"] $- tuple [var "id" @@ int32 42, var "id" @@ string "hello"])- (Types.product [Types.int32, Types.string])- expectTypeOf "composition"- (lets ["compose">: lambda "f" $ lambda "g" $ lambda "x" $ var "f" @@ (var "g" @@ var "x"),- "add1">: lambda "n" $ primitive _math_add @@ var "n" @@ int32 1,- "double">: lambda "n" $ primitive _math_mul @@ var "n" @@ int32 2] $- (var "compose" @@ var "add1" @@ var "double") @@ int32 5)- Types.int32--checkTypeOfLists :: H.SpecWith ()-checkTypeOfLists = H.describe "Lists" $ do- H.describe "Lists of literals" $ do- expectTypeOf "int list"- (list [int32 1, int32 2])- (Types.list Types.int32)- expectTypeOf "string list"- (list [string "hello", string "world"])- (Types.list Types.string)- expectTypeOf "single element list"- (list [bigint 42])- (Types.list Types.bigint)- expectTypeOf "mixed numeric types"- (list [float32 1.0, float32 2.5, float32 3.14])- (Types.list Types.float32)- H.describe "Empty lists" $ do- expectTypeOf "empty list"- (list [])- (Types.forAll "t0" $ Types.list $ Types.var "t0")- expectTypeOf "pair of empty lists"- (pair (list []) (list []))- (Types.forAlls ["t0", "t1"] $ Types.pair (Types.list $ Types.var "t0") (Types.list $ Types.var "t1"))- expectTypeOf "empty list in tuple"- (tuple [list [], string "context"])- (Types.forAll "t0" $ Types.product [Types.list $ Types.var "t0", Types.string])- H.describe "Polymorphic lists" $ do- expectTypeOf "list from lambda"- (lambda "x" $ list [var "x"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.list $ Types.var "t0"))- expectTypeOf "list with repeated var"- (lambda "x" $ list [var "x", var "x"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.list $ Types.var "t0"))- expectTypeOf "list from two lambdas"- (lambda "x" $ lambda "y" $ list [var "x", var "y"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.function (Types.var "t0") (Types.list $ Types.var "t0")))- H.describe "Nested lists" $ do- expectTypeOf "list of lists"- (list [list [int32 1], list [int32 2, int32 3]])- (Types.list $ Types.list Types.int32)- expectTypeOf "empty nested lists"- (list [list [], list []])- (Types.forAll "t0" $ Types.list $ Types.list $ Types.var "t0")- expectTypeOf "nested polymorphic"- (lambda "x" $ list [list [var "x"]])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.list $ Types.list $ Types.var "t0"))- H.describe "Lists in complex contexts" $ do- expectTypeOf "multiple lists in tuple"- (tuple [- list [int32 1, int32 2],- list [string "a", string "b"]])- (Types.product [Types.list Types.int32, Types.list Types.string])--checkTypeOfLiterals :: H.SpecWith ()-checkTypeOfLiterals = H.describe "Literals" $ do- H.describe "Boolean literals" $ do- expectTypeOf "true"- (boolean True)- Types.boolean- expectTypeOf "false"- (boolean False)- Types.boolean-- H.describe "String literals" $ do- expectTypeOf "simple string"- (string "hello")- Types.string- expectTypeOf "empty string"- (string "")- Types.string- expectTypeOf "unicode string"- (string "café")- Types.string-- H.describe "Integer literals" $ do- expectTypeOf "bigint"- (bigint 42)- Types.bigint- expectTypeOf "int8"- (int8 127)- Types.int8- expectTypeOf "int16"- (int16 32767)- Types.int16- expectTypeOf "int32"- (int32 2147483647)- Types.int32- expectTypeOf "int64"- (int64 9223372036854775807)- Types.int64- expectTypeOf "uint8"- (uint8 255)- Types.uint8- expectTypeOf "uint16"- (uint16 65535)- Types.uint16- expectTypeOf "uint32"- (uint32 4294967295)- Types.uint32- expectTypeOf "uint64"- (uint64 18446744073709551615)- Types.uint64-- H.describe "Float literals" $ do- expectTypeOf "bigfloat"- (bigfloat 3.14159)- Types.bigfloat- expectTypeOf "float32"- (float32 2.71828)- Types.float32- expectTypeOf "float64"- (float64 1.41421)- Types.float64-- H.describe "Binary literals" $ do- expectTypeOf "binary"- (binary "SGVsbG8gV29ybGQ=") -- "Hello World" in base64- Types.binary-- H.describe "Literals in complex contexts" $ do- expectTypeOf "literals in tuple"- (tuple [boolean True, string "test", int32 42, float32 3.14])- (Types.product [Types.boolean, Types.string, Types.int32, Types.float32])- expectTypeOf "literals in list"- (list [string "one", string "two", string "three"])- (Types.list Types.string)- expectTypeOf "literals in record"- (record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)])- (Types.var "Person")- expectTypeOf "literals in let binding"- (lets ["x">: int32 100,- "y">: string "hello",- "z">: boolean True] $- tuple [var "x", var "y", var "z"])- (Types.product [Types.int32, Types.string, Types.boolean])--checkTypeOfMaps :: H.SpecWith ()-checkTypeOfMaps = H.describe "Maps" $ do- H.describe "Monomorphic maps" $ do- expectTypeOf "empty map"- (Terms.map M.empty)- (Types.forAlls ["t0", "t1"] $ Types.map (Types.var "t0") (Types.var "t1"))- expectTypeOf "int to string map"- (Terms.map $ M.fromList [(int32 1, string "one"),- (int32 2, string "two")])- (Types.map Types.int32 Types.string)- expectTypeOf "string to int map"- (Terms.map $ M.fromList [(string "a", int32 1),- (string "b", int32 2)])- (Types.map Types.string Types.int32)- expectTypeOf "single entry map"- (Terms.map $ M.singleton (bigint 42) (boolean True))- (Types.map Types.bigint Types.boolean)-- H.describe "Polymorphic maps" $ do- expectTypeOf "map from lambda keys"- (lambda "k" $ Terms.map $ M.singleton (var "k") (string "value"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.map (Types.var "t0") Types.string))- expectTypeOf "map from lambda values"- (lambda "v" $ Terms.map $ M.singleton (string "key") (var "v"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.map Types.string (Types.var "t0")))- expectTypeOf "map from lambda both"- (lambda "k" $ lambda "v" $ Terms.map $ M.singleton (var "k") (var "v"))- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.map (Types.var "t0") (Types.var "t1"))))- expectTypeOf "map with repeated variables"- (lambda "x" $ Terms.map $ M.singleton (var "x") (var "x"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.map (Types.var "t0") (Types.var "t0")))-- H.describe "Maps in complex contexts" $ do- expectTypeOf "map in tuple"- (tuple [Terms.map $ M.singleton (int32 1) (string "one"),- string "context"])- (Types.product [Types.map Types.int32 Types.string, Types.string])- expectTypeOf "nested maps"- (Terms.map $ M.singleton (string "outer") (Terms.map $ M.singleton (int32 1) (boolean True)))- (Types.map Types.string (Types.map Types.int32 Types.boolean))- expectTypeOf "map in let binding"- (lets ["lookup">: Terms.map $ M.fromList [(string "key1", int32 100),- (string "key2", int32 200)]] $- var "lookup")- (Types.map Types.string Types.int32)-- H.describe "Maps with complex types" $ do- expectTypeOf "map of records"- (Terms.map $ M.singleton (string "person1")- (record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 25)]))- (Types.map Types.string (Types.var "Person"))- expectTypeOf "map of lists"- (Terms.map $ M.fromList [(int32 1, list [string "a", string "b"]),- (int32 2, list [string "c", string "d"])])- (Types.map Types.int32 (Types.list Types.string))- expectTypeOf "map of tuples"- (Terms.map $ M.singleton (string "coords") (tuple [int32 10, int32 20]))- (Types.map Types.string (Types.product [Types.int32, Types.int32]))--checkTypeOfOptionals :: H.SpecWith ()-checkTypeOfOptionals = H.describe "Optionals" $ do- H.describe "Monomorphic optionals" $ do- expectTypeOf "nothing"- (nothing)- (Types.forAll "t0" $ Types.optional $ Types.var "t0")- expectTypeOf "just int"- (just $ int32 42)- (Types.optional Types.int32)- expectTypeOf "just string"- (just $ string "hello")- (Types.optional Types.string)- expectTypeOf "just boolean"- (just $ boolean True)- (Types.optional Types.boolean)-- H.describe "Polymorphic optionals" $ do- expectTypeOf "optional from lambda"- (lambda "x" $ just $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.optional $ Types.var "t0"))- expectTypeOf "nothing from lambda"- (lambda "x" $ nothing)- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.optional $ Types.var "t1"))- expectTypeOf "conditional optional"- (lambda "x" $ lambda "flag" $- primitive _logic_ifElse @@ var "flag" @@- (just $ var "x") @@- (nothing))- (Types.forAlls ["t0"] $ Types.function (Types.var "t0") (Types.function Types.boolean (Types.optional $ Types.var "t0")))-- H.describe "Optionals in complex contexts" $ do- expectTypeOf "optional in tuple"- (tuple [just $ int32 100, string "context"])- (Types.product [Types.optional Types.int32, Types.string])- expectTypeOf "optional in record"- (record testTypeBuddyListAName [- field "head" (string "first"),- field "tail" (just $ record testTypeBuddyListBName [- field "head" (string "second"),- field "tail" (nothing)])])- (Types.apply (Types.var "BuddyListA") Types.string)- expectTypeOf "optional in let binding"- (lets ["maybeValue">: just $ int32 42] $- var "maybeValue")- (Types.optional Types.int32)-- H.describe "Nested optionals" $ do- expectTypeOf "optional of optional"- (just $ just $ string "nested")- (Types.optional $ Types.optional Types.string)- expectTypeOf "optional of list"- (just $ list [int32 1, int32 2, int32 3])- (Types.optional $ Types.list Types.int32)- expectTypeOf "list of optionals"- (list [just $ string "a", nothing, just $ string "b"])- (Types.list $ Types.optional Types.string)-- H.describe "Optionals with complex types" $ do- expectTypeOf "optional record"- (just $ record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)])- (Types.optional $ Types.var "Person")- expectTypeOf "optional tuple"- (just $ tuple [int32 10, string "test"])- (Types.optional $ Types.product [Types.int32, Types.string])- expectTypeOf "optional map"- (just $ Terms.map $ M.singleton (string "key") (int32 42))- (Types.optional $ Types.map Types.string Types.int32)--checkTypeOfPrimitives :: H.SpecWith ()-checkTypeOfPrimitives = H.describe "Primitives" $ do- H.describe "Nullary primitives" $ do- expectTypeOf "empty map"- (primitive _maps_empty)- (Types.forAlls ["t0", "t1"] $ Types.map (Types.var "t0") (Types.var "t1"))- expectTypeOf "empty set"- (primitive _sets_empty)- (Types.forAll "t0" $ Types.set $ Types.var "t0")-- H.describe "Unary primitives" $ do- expectTypeOf "lists head"- (primitive _lists_head)- (Types.forAll "t0" $ Types.function (Types.list $ Types.var "t0") (Types.var "t0"))- expectTypeOf "math neg"- (primitive _math_neg)- (Types.function Types.int32 Types.int32)- expectTypeOf "logic not"- (primitive _logic_not)- (Types.function Types.boolean Types.boolean)-- H.describe "Binary primitives" $ do- expectTypeOf "math add"- (primitive _math_add)- (Types.function Types.int32 (Types.function Types.int32 Types.int32))- expectTypeOf "lists cons"- (primitive _lists_cons)- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.function (Types.list $ Types.var "t0") (Types.list $ Types.var "t0")))- expectTypeOf "maps insert"- (primitive _maps_insert)- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.var "t0")- (Types.function (Types.var "t1") (Types.function (Types.map (Types.var "t0") (Types.var "t1")) (Types.map (Types.var "t0") (Types.var "t1")))))-- H.describe "Ternary primitives" $ do- expectTypeOf "logic ifElse"- (primitive _logic_ifElse)- (Types.forAll "t0" $ Types.function Types.boolean (Types.function (Types.var "t0") (Types.function (Types.var "t0") (Types.var "t0"))))- expectTypeOf "lists foldl"- (primitive _lists_foldl)- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.var "t0")))- (Types.function (Types.var "t0") (Types.function (Types.list $ Types.var "t1") (Types.var "t0"))))-- H.describe "Monomorphic vs polymorphic" $ do- expectTypeOf "monomorphic math"- (primitive _math_add)- (Types.function Types.int32 (Types.function Types.int32 Types.int32))- expectTypeOf "polymorphic identity"- (primitive _equality_identity)- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "polymorphic map"- (primitive _lists_map)- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.function (Types.var "t0") (Types.var "t1"))- (Types.function (Types.list $ Types.var "t0") (Types.list $ Types.var "t1")))-- H.describe "Higher-order primitives" $ do- expectTypeOf "lists map function"- (primitive _lists_map @@ (lambda "x" $ primitive _math_add @@ var "x" @@ int32 1))- (Types.function (Types.list Types.int32) (Types.list Types.int32))- expectTypeOf "lists filter"- (primitive _lists_filter)- (Types.forAll "t0" $ Types.function (Types.function (Types.var "t0") Types.boolean) (Types.function (Types.list $ Types.var "t0") (Types.list $ Types.var "t0")))- expectTypeOf "optionals maybe"- (primitive _optionals_maybe)- (Types.forAlls ["t0", "t1"] $- Types.function (Types.var "t0") (Types.function (Types.function (Types.var "t1") (Types.var "t0")) (Types.function (Types.optional $ Types.var "t1") (Types.var "t0"))))-- H.describe "Primitives in complex contexts" $ do- expectTypeOf "primitive composition"- (lets ["double">: lambda "x" $ primitive _math_mul @@ var "x" @@ int32 2,- "increment">: lambda "x" $ primitive _math_add @@ var "x" @@ int32 1] $- primitive _lists_map @@ var "double" @@ (primitive _lists_map @@ var "increment" @@ list [int32 1, int32 2, int32 3]))- (Types.list Types.int32)- expectTypeOf "nested higher-order"- (primitive _lists_map @@ (primitive _lists_map @@ (primitive _math_add @@ int32 1)) @@- list [list [int32 1, int32 2], list [int32 3, int32 4]])- (Types.list $ Types.list Types.int32)--checkTypeOfProducts :: H.SpecWith ()-checkTypeOfProducts = H.describe "Products" $ do- H.describe "Monomorphic products" $ do- expectTypeOf "empty tuple"- (tuple [])- (Types.product [])- expectTypeOf "singleton tuple"- (tuple [int32 42])- (Types.product [Types.int32])- expectTypeOf "pair tuple"- (tuple [int32 42, string "foo"])- (Types.product [Types.int32, Types.string])- expectTypeOf "triple tuple"- (tuple [int32 1, int32 2, int32 3])- (Types.product [Types.int32, Types.int32, Types.int32])- expectTypeOf "mixed types"- (tuple [unit, string "test", bigint 100])- (Types.product [Types.unit, Types.string, Types.bigint])- H.describe "Polymorphic products" $ do- expectTypeOf "lambda with var"- (lambda "x" $ tuple [var "x", string "foo"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.product [Types.var "t0", Types.string]))- expectTypeOf "two variables"- (lambda "x" $ lambda "y" $ tuple [var "x", var "y"])- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.product [Types.var "t0", Types.var "t1"])))- expectTypeOf "repeated variable"- (lambda "x" $ tuple [var "x", var "x"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.product [Types.var "t0", Types.var "t0"]))- H.describe "Nested products" $ do- expectTypeOf "tuple in tuple"- (tuple [tuple [int32 1], string "foo"])- (Types.product [Types.product [Types.int32], Types.string])- expectTypeOf "nested polymorphic"- (lambda "x" $ tuple [tuple [var "x"], tuple [string "test"]])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.product [Types.product [Types.var "t0"], Types.product [Types.string]]))--checkTypeOfProductEliminations :: H.SpecWith ()-checkTypeOfProductEliminations = H.describe "Product eliminations" $ do-- H.describe "Simple tuple projections" $ do- expectTypeOf "projection from pair"- (untuple 2 0 @@ pair (int32 42) (string "hello"))- Types.int32- expectTypeOf "second projection from pair"- (untuple 2 1 @@ pair (int32 42) (string "hello"))- Types.string- expectTypeOf "projection from triple"- (untuple 3 1 @@ triple (int32 1) (string "middle") (boolean True))- Types.string- expectTypeOf "first element of triple"- (untuple 3 0 @@ triple (boolean False) (int32 100) (string "last"))- Types.boolean- expectTypeOf "last element of triple"- (untuple 3 2 @@ triple (boolean False) (int32 100) (string "last"))- Types.string-- H.describe "Polymorphic tuple projections" $ do- expectTypeOf "projection function"- (untuple 2 0)- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.product [Types.var "t0", Types.var "t1"])- (Types.var "t0"))- expectTypeOf "second projection function"- (untuple 2 1)- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.product [Types.var "t0", Types.var "t1"])- (Types.var "t1"))- expectTypeOf "triple projection function"- (untuple 3 1)- (Types.forAlls ["t0", "t1", "t2"] $ Types.function- (Types.product [Types.var "t0", Types.var "t1", Types.var "t2"])- (Types.var "t1"))- expectTypeOf "projection from lambda"- (lambda "pair" $ untuple 2 0 @@ var "pair")- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.product [Types.var "t0", Types.var "t1"])- (Types.var "t0"))-- H.describe "Projections with variables" $ do- expectTypeOf "projection with variable tuple"- (lambda "x" $ lambda "y" $ untuple 2 0 @@ pair (var "x") (var "y"))- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0")- (Types.function (Types.var "t1") (Types.var "t0")))- expectTypeOf "projection preserves polymorphism"- (lambda "pair" $ pair (untuple 2 0 @@ var "pair") (untuple 2 1 @@ var "pair"))- (Types.forAlls ["t0", "t1"] $ Types.function- (Types.product [Types.var "t0", Types.var "t1"])- (Types.product [Types.var "t0", Types.var "t1"]))- expectTypeOf "nested projection"- (lambda "nested" $ untuple 2 0 @@ (untuple 2 1 @@ var "nested"))- (Types.forAlls ["t0", "t1", "t2"] $ Types.function- (Types.product [Types.var "t0", Types.product [Types.var "t1", Types.var "t2"]])- (Types.var "t1"))-- H.describe "Projections in complex contexts" $ do- expectTypeOf "projection in let binding"- (lets ["pair">: pair (int32 10) (string "test")] $- untuple 2 0 @@ var "pair")- Types.int32- expectTypeOf "projection in tuple"- (pair (untuple 2 0 @@ pair (int32 1) (string "a"))- (untuple 2 1 @@ pair (int32 2) (string "b")))- (Types.product [Types.int32, Types.string])- expectTypeOf "projection in list"- (list [untuple 2 0 @@ pair (int32 1) (string "a"),- untuple 2 0 @@ pair (int32 2) (string "b")])- (Types.list Types.int32)-- H.describe "Projections with mixed types" $ do- expectTypeOf "projection from mixed tuple"- (untuple 4 2 @@ tuple4 (int32 1) (string "test") (boolean True) (float32 3.14))- Types.boolean- expectTypeOf "projection chain"- (lets ["quadruple">: tuple4 (int32 1) (string "test") (boolean True) (float32 3.14)] $- tuple4 (untuple 4 0 @@ var "quadruple")- (untuple 4 1 @@ var "quadruple")- (untuple 4 2 @@ var "quadruple")- (untuple 4 3 @@ var "quadruple"))- (Types.product [Types.int32, Types.string, Types.boolean, Types.float32])- expectTypeOf "projection with function result"- (untuple 2 1 @@ pair (int32 42) (lambda "x" $ var "x"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))-- H.describe "Projections with primitive functions" $ do-- expectTypeOf "lists.map with untuple"- (primitive _lists_map @@ (untuple 2 0))- (Types.forAlls ["t0", "t1"] $- Types.function (Types.list (Types.product [Types.var "t0", Types.var "t1"])) (Types.list (Types.var "t0")))--checkTypeOfRecords :: H.SpecWith ()-checkTypeOfRecords = H.describe "Records" $ do- H.describe "Monomorphic records" $ do- expectTypeOf "latlon record"- (record testTypeLatLonName [- field "lat" (float32 19.5429),- field "lon" (float32 (0-155.6659))])- (Types.var "LatLon")- expectTypeOf "latlon with variable"- (lambda "x" $ record testTypeLatLonName [- field "lat" (float32 19.5429),- field "lon" (var "x")])- (Types.function Types.float32 (Types.var "LatLon"))- expectTypeOf "person record"- (record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)])- (Types.var "Person")- expectTypeOf "empty record"- (record testTypeUnitName [])- (Types.var "Unit")- expectTypeOf "person with variables"- (lambda "name" $ lambda "age" $ record testTypePersonName [- field "firstName" (var "name"),- field "lastName" (string "Doe"),- field "age" (var "age")])- (Types.function Types.string (Types.function Types.int32 (Types.var "Person")))-- H.describe "Polymorphic records" $ do- expectTypeOf "latlon poly float"- (record testTypeLatLonPolyName [- field "lat" (float32 19.5429),- field "lon" (float32 (0-155.6659))])- (Types.apply (Types.var "LatLonPoly") Types.float32)- expectTypeOf "latlon poly int64"- (record testTypeLatLonPolyName [- field "lat" (int64 195429),- field "lon" (int64 (0-1556659))])- (Types.apply (Types.var "LatLonPoly") Types.int64)- expectTypeOf "latlon poly variable"- (lambda "x" $ record testTypeLatLonPolyName [- field "lat" (var "x"),- field "lon" (var "x")])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.apply (Types.var "LatLonPoly") (Types.var "t0")))- expectTypeOf "buddylist string"- (record testTypeBuddyListAName [- field "head" (string "first"),- field "tail" (nothing)])- (Types.apply (Types.var "BuddyListA") Types.string)- expectTypeOf "buddylist variable"- (lambda "x" $ record testTypeBuddyListAName [- field "head" (var "x"),- field "tail" (nothing)])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.apply (Types.var "BuddyListA") (Types.var "t0")))-- H.describe "Records in complex contexts" $ do- expectTypeOf "records in tuple"- (tuple [- record testTypePersonName [- field "firstName" (string "Bob"),- field "lastName" (string "Jones"),- field "age" (int32 25)],- record testTypeLatLonName [- field "lat" (float32 1.0),- field "lon" (float32 2.0)]])- (Types.product [Types.var "Person", Types.var "LatLon"])- expectTypeOf "poly records in tuple"- (tuple [- record testTypeLatLonPolyName [- field "lat" (int32 1),- field "lon" (int32 2)],- record testTypeBuddyListAName [- field "head" (string "test"),- field "tail" (nothing)]])- (Types.product [- Types.apply (Types.var "LatLonPoly") Types.int32,- Types.apply (Types.var "BuddyListA") Types.string])- expectTypeOf "recursive record"- (record testTypeIntListName [- field "head" (int32 42),- field "tail" (just $- record testTypeIntListName [- field "head" (int32 43),- field "tail" (nothing)])])- (Types.var "IntList")--checkTypeOfRecordEliminations :: H.SpecWith ()-checkTypeOfRecordEliminations = H.describe "Record eliminations" $ do- H.describe "Simple record projections" $ do- expectTypeOf "project firstName from Person"- (project testTypePersonName (Name "firstName"))- (Types.function (Types.var "Person") Types.string)-- expectTypeOf "project lastName from Person"- (project testTypePersonName (Name "lastName"))- (Types.function (Types.var "Person") Types.string)-- expectTypeOf "project age from Person"- (project testTypePersonName (Name "age"))- (Types.function (Types.var "Person") Types.int32)-- expectTypeOf "project lat from LatLon"- (project testTypeLatLonName (Name "lat"))- (Types.function (Types.var "LatLon") Types.float32)-- expectTypeOf "project lon from LatLon"- (project testTypeLatLonName (Name "lon"))- (Types.function (Types.var "LatLon") Types.float32)-- H.describe "Record projections applied to records" $ do- expectTypeOf "project firstName applied to person record"- (project testTypePersonName (Name "firstName") @@- record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)])- Types.string-- expectTypeOf "project age applied to person record"- (project testTypePersonName (Name "age") @@- record testTypePersonName [- field "firstName" (string "Bob"),- field "lastName" (string "Jones"),- field "age" (int32 25)])- Types.int32-- expectTypeOf "project lat applied to LatLon record"- (project testTypeLatLonName (Name "lat") @@- record testTypeLatLonName [- field "lat" (float32 40.7128),- field "lon" (float32 (-74.0060))])- Types.float32-- H.describe "Polymorphic record projections" $ do- expectTypeOf "project lat from polymorphic LatLonPoly"- (project testTypeLatLonPolyName (Name "lat"))- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "LatLonPoly") (Types.var "t0")) (Types.var "t0"))-- expectTypeOf "project lon from polymorphic LatLonPoly"- (project testTypeLatLonPolyName (Name "lon"))- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "LatLonPoly") (Types.var "t0")) (Types.var "t0"))-- expectTypeOf "project head from BuddyListA"- (project testTypeBuddyListAName (Name "head"))- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "BuddyListA") (Types.var "t0")) (Types.var "t0"))-- expectTypeOf "project tail from BuddyListA"- (project testTypeBuddyListAName (Name "tail"))- (Types.forAll "t0" $ Types.function- (Types.apply (Types.var "BuddyListA") (Types.var "t0"))- (Types.optional (Types.apply (Types.var "BuddyListB") (Types.var "t0"))))-- H.describe "Polymorphic record projections applied" $ do- expectTypeOf "project lat from LatLonPoly with int32"- (project testTypeLatLonPolyName (Name "lat") @@- record testTypeLatLonPolyName [- field "lat" (int32 40),- field "lon" (int32 (-74))])- Types.int32-- expectTypeOf "project lon from LatLonPoly with float64"- (project testTypeLatLonPolyName (Name "lon") @@- record testTypeLatLonPolyName [- field "lat" (float64 40.7128),- field "lon" (float64 (-74.0060))])- Types.float64-- expectTypeOf "project head from BuddyListA with string"- (project testTypeBuddyListAName (Name "head") @@- record testTypeBuddyListAName [- field "head" (string "Alice"),- field "tail" (nothing)])- Types.string-- H.describe "Record projections with variables" $ do- expectTypeOf "project from lambda parameter"- (lambda "person" $ project testTypePersonName (Name "firstName") @@ var "person")- (Types.function (Types.var "Person") Types.string)-- expectTypeOf "project from polymorphic lambda parameter"- (lambda "coords" $ project testTypeLatLonPolyName (Name "lat") @@ var "coords")- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "LatLonPoly") (Types.var "t0")) (Types.var "t0"))-- expectTypeOf "multiple projections from same record"- (lambda "person" $- tuple [project testTypePersonName (Name "firstName") @@ var "person",- project testTypePersonName (Name "lastName") @@ var "person"])- (Types.function (Types.var "Person") (Types.product [Types.string, Types.string]))-- H.describe "Record projections in complex contexts" $ do- expectTypeOf "projection in let binding"- (lets ["person">: record testTypePersonName [- field "firstName" (string "Charlie"),- field "lastName" (string "Brown"),- field "age" (int32 35)],- "getName">: project testTypePersonName (Name "firstName")] $- var "getName" @@ var "person")- Types.string-- expectTypeOf "projection in tuple"- (tuple [project testTypePersonName (Name "firstName"),- project testTypePersonName (Name "age")])- (Types.product [Types.function (Types.var "Person") Types.string,- Types.function (Types.var "Person") Types.int32])-- expectTypeOf "projection in list"- (list [project testTypePersonName (Name "firstName"),- project testTypePersonName (Name "lastName")])- (Types.list (Types.function (Types.var "Person") Types.string))-- H.describe "Higher-order record projections" $ do- expectTypeOf "map projection over list of records"- (primitive _lists_map @@ (project testTypePersonName (Name "firstName")) @@- list [record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)],- record testTypePersonName [- field "firstName" (string "Bob"),- field "lastName" (string "Jones"),- field "age" (int32 25)]])- (Types.list Types.string)-- expectTypeOf "map polymorphic projection"- (primitive _lists_map @@ (project testTypeLatLonPolyName (Name "lat")) @@- list [record testTypeLatLonPolyName [- field "lat" (int32 40),- field "lon" (int32 (-74))],- record testTypeLatLonPolyName [- field "lat" (int32 34),- field "lon" (int32 (-118))]])- (Types.list Types.int32)-- expectTypeOf "filter using projection"- (primitive _lists_filter @@- (lambda "person" $- primitive _equality_gt @@- (project testTypePersonName (Name "age") @@ var "person") @@- int32 30) @@- list [record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 35)],- record testTypePersonName [- field "firstName" (string "Bob"),- field "lastName" (string "Jones"),- field "age" (int32 25)]])- (Types.list (Types.var "Person"))-- H.describe "Recursive record projections" $ do- expectTypeOf "project head from IntList"- (project testTypeIntListName (Name "head"))- (Types.function (Types.var "IntList") Types.int32)-- expectTypeOf "project tail from IntList"- (project testTypeIntListName (Name "tail"))- (Types.function (Types.var "IntList") (Types.optional (Types.var "IntList")))-- expectTypeOf "project head applied to IntList"- (project testTypeIntListName (Name "head") @@- record testTypeIntListName [- field "head" (int32 42),- field "tail" (nothing)])- Types.int32-- expectTypeOf "nested projection from recursive record"- (lambda "intList" $- primitive _optionals_maybe @@- int32 0 @@- (project testTypeIntListName (Name "head")) @@- (project testTypeIntListName (Name "tail") @@ var "intList"))- (Types.function (Types.var "IntList") Types.int32)-- H.describe "Record projections with mutual recursion" $ do- expectTypeOf "project head from BuddyListA"- (project testTypeBuddyListAName (Name "head"))- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "BuddyListA") (Types.var "t0")) (Types.var "t0"))-- expectTypeOf "project tail from BuddyListB"- (project testTypeBuddyListBName (Name "tail"))- (Types.forAll "t0" $ Types.function- (Types.apply (Types.var "BuddyListB") (Types.var "t0"))- (Types.optional (Types.apply (Types.var "BuddyListA") (Types.var "t0"))))-- expectTypeOf "chained projections across mutual recursion"- (lambda "listA" $- primitive _optionals_maybe- @@ nothing- @@ (lambda "listB" $- primitive _optionals_maybe- @@ nothing- @@ (project testTypeBuddyListAName (Name "tail"))- @@ (project testTypeBuddyListBName (Name "tail") @@ var "listB"))- @@ (project testTypeBuddyListAName (Name "tail") @@ var "listA"))- (Types.forAll "t0" $ Types.function- (Types.apply (Types.var "BuddyListA") (Types.var "t0"))- (Types.optional (Types.apply (Types.var "BuddyListB") (Types.var "t0"))))-- H.describe "Record projection composition" $ do- expectTypeOf "compose projections"- (lambda "person" $- primitive _strings_cat2 @@- (project testTypePersonName (Name "firstName") @@ var "person") @@- (project testTypePersonName (Name "lastName") @@ var "person"))- (Types.function (Types.var "Person") Types.string)-- expectTypeOf "projection with arithmetic"- (lambda "person" $- primitive _math_add @@- (project testTypePersonName (Name "age") @@ var "person") @@- int32 1)- (Types.function (Types.var "Person") Types.int32)-- expectTypeOf "record construction using string projection"- (lambda "person" $- record testTypePersonName [- field "firstName" (project testTypePersonName (Name "firstName") @@ var "person"),- field "lastName" (project testTypePersonName (Name "lastName") @@ var "person"),- field "age" (int32 0)])- (Types.function (Types.var "Person") (Types.var "Person"))--checkTypeOfSets :: H.SpecWith ()-checkTypeOfSets = H.describe "Sets" $ do- H.describe "Monomorphic sets" $ do- expectTypeOf "empty set"- (Terms.set S.empty)- (Types.forAll "t0" $ Types.set $ Types.var "t0")- expectTypeOf "int set"- (Terms.set $ S.fromList [int32 1, int32 2, int32 3])- (Types.set Types.int32)- expectTypeOf "string set"- (Terms.set $ S.fromList [string "apple", string "banana", string "cherry"])- (Types.set Types.string)- expectTypeOf "single element set"- (Terms.set $ S.singleton $ boolean True)- (Types.set Types.boolean)-- H.describe "Polymorphic sets" $ do- expectTypeOf "set from lambda"- (lambda "x" $ Terms.set $ S.singleton $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.set $ Types.var "t0"))- expectTypeOf "set with repeated variable"- (lambda "x" $ Terms.set $ S.fromList [var "x", var "x"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.set $ Types.var "t0"))- expectTypeOf "set from two variables"- (lambda "x" $ lambda "y" $ Terms.set $ S.fromList [var "x", var "y"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.function (Types.var "t0") (Types.set $ Types.var "t0")))-- H.describe "Sets in complex contexts" $ do- expectTypeOf "set in tuple"- (tuple [Terms.set $ S.fromList [int32 1, int32 2], string "context"])- (Types.product [Types.set Types.int32, Types.string])- expectTypeOf "set in let binding"- (lets ["numbers">: Terms.set $ S.fromList [int32 10, int32 20, int32 30]] $- var "numbers")- (Types.set Types.int32)-- H.describe "Nested sets" $ do- expectTypeOf "set of lists"- (Terms.set $ S.fromList [- list [string "a", string "b"],- list [string "c", string "d"]])- (Types.set $ Types.list Types.string)- expectTypeOf "set of tuples"- (Terms.set $ S.fromList [- tuple [int32 1, int32 2],- tuple [int32 3, int32 4]])- (Types.set $ Types.product [Types.int32, Types.int32])- expectTypeOf "set of sets"- (Terms.set $ S.singleton $ Terms.set $ S.fromList [string "nested"])- (Types.set $ Types.set Types.string)-- H.describe "Sets with complex types" $ do- expectTypeOf "set of records"- (Terms.set $ S.singleton $ record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)])- (Types.set $ Types.var "Person")- expectTypeOf "set of optionals"- (Terms.set $ S.fromList [- just $ int32 42,- nothing])- (Types.set $ Types.optional Types.int32)- expectTypeOf "set of maps"- (Terms.set $ S.singleton $ Terms.map $ M.singleton (string "key") (int32 42))- (Types.set $ Types.map Types.string Types.int32)--checkTypeOfSums :: H.SpecWith ()-checkTypeOfSums = H.describe "Sums" $ do- -- TODO: we probably will not bother to test sum terms; see https://github.com/CategoricalData/hydra/issues/134- return ()--checkTypeOfUnions :: H.SpecWith ()-checkTypeOfUnions = H.describe "Unions" $ do- H.describe "Simple union injections" $ do- expectTypeOf "inject into Comparison lessThan variant"- (unitVariant testTypeComparisonName (Name "lessThan"))- (Types.var "Comparison")- expectTypeOf "inject into Comparison equalTo variant"- (unitVariant testTypeComparisonName (Name "equalTo"))- (Types.var "Comparison")- expectTypeOf "inject into Comparison greaterThan variant"- (unitVariant testTypeComparisonName (Name "greaterThan"))- (Types.var "Comparison")-- H.describe "Union injections with data" $ do- expectTypeOf "inject into Number int variant"- (variant testTypeNumberName (Name "int") (int32 42))- (Types.var "Number")- expectTypeOf "inject into Number float variant"- (variant testTypeNumberName (Name "float") (float32 3.14))- (Types.var "Number")- expectTypeOf "inject into Timestamp unixTimeMillis variant"- (variant testTypeTimestampName (Name "unixTimeMillis") (uint64 1609459200000))- (Types.var "Timestamp")- expectTypeOf "inject into Timestamp date variant"- (variant testTypeTimestampName (Name "date") (string "2021-01-01"))- (Types.var "Timestamp")-- H.describe "Polymorphic union injections" $ do- expectTypeOf "inject person into PersonOrSomething"- (variant testTypePersonOrSomethingName (Name "person")- (record testTypePersonName [- field "firstName" (string "Alice"),- field "lastName" (string "Smith"),- field "age" (int32 30)]))- (Types.forAll "t0" $ Types.apply (Types.var "PersonOrSomething") (Types.var "t0"))- expectTypeOf "inject string into PersonOrSomething other variant"- (variant testTypePersonOrSomethingName (Name "other") (string "something else"))- (Types.apply (Types.var "PersonOrSomething") Types.string)- expectTypeOf "inject int into PersonOrSomething other variant"- (variant testTypePersonOrSomethingName (Name "other") (int32 42))- (Types.apply (Types.var "PersonOrSomething") Types.int32)-- H.describe "Polymorphic recursive union injections" $ do- expectTypeOf "inject boolean into UnionPolymorphicRecursive"- (variant testTypeUnionPolymorphicRecursiveName (Name "bool") (boolean True))- (Types.forAll "t0" $ Types.apply (Types.var "UnionPolymorphicRecursive") (Types.var "t0"))- expectTypeOf "inject string value into UnionPolymorphicRecursive"- (variant testTypeUnionPolymorphicRecursiveName (Name "value") (string "test"))- (Types.apply (Types.var "UnionPolymorphicRecursive") Types.string)- expectTypeOf "inject int value into UnionPolymorphicRecursive"- (variant testTypeUnionPolymorphicRecursiveName (Name "value") (int32 123))- (Types.apply (Types.var "UnionPolymorphicRecursive") Types.int32)-- H.describe "Polymorphic unions from lambda" $ do- expectTypeOf "lambda creating PersonOrSomething other variant"- (lambda "x" $ variant testTypePersonOrSomethingName (Name "other") (var "x"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.apply (Types.var "PersonOrSomething") (Types.var "t0")))- expectTypeOf "lambda creating UnionPolymorphicRecursive value variant"- (lambda "x" $ variant testTypeUnionPolymorphicRecursiveName (Name "value") (var "x"))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.apply (Types.var "UnionPolymorphicRecursive") (Types.var "t0")))-- H.describe "Unions in complex contexts" $ do- expectTypeOf "union in tuple"- (tuple [variant testTypeNumberName (Name "int") (int32 42),- string "context"])- (Types.product [Types.var "Number", Types.string])- expectTypeOf "union in list"- (list [variant testTypeNumberName (Name "int") (int32 1),- variant testTypeNumberName (Name "float") (float32 2.5)])- (Types.list $ Types.var "Number")- expectTypeOf "polymorphic union in let binding"- (lets ["value">: variant testTypePersonOrSomethingName (Name "other") (string "test")] $- var "value")- (Types.apply (Types.var "PersonOrSomething") Types.string)--checkTypeOfUnionEliminations :: H.SpecWith ()-checkTypeOfUnionEliminations = H.describe "Union eliminations" $ do- H.describe "Simple unit variant eliminations" $ do- expectTypeOf "match Comparison with all cases"- (match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal"),- "greaterThan">: lambda "x" (string "greater")])- (Types.function (Types.var "Comparison") Types.string)-- expectTypeOf "match Comparison returning int32"- (match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (int32 (-1)),- "equalTo">: lambda "x" (int32 0),- "greaterThan">: lambda "x" (int32 1)])- (Types.function (Types.var "Comparison") Types.int32)-- expectTypeOf "match applied to Comparison variant"- (match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal"),- "greaterThan">: lambda "x" (string "greater")] @@- unitVariant testTypeComparisonName (Name "equalTo"))- Types.string-- H.describe "Union eliminations with data" $ do- expectTypeOf "match Number extracting int values"- (match testTypeNumberName Nothing [- "int">: lambda "i" (var "i"),- "float">: lambda "f" (int32 0)])- (Types.function (Types.var "Number") Types.int32)-- expectTypeOf "match Number converting to string"- (match testTypeNumberName Nothing [- "int">: lambda "i" (primitive _literals_showInt32 @@ var "i"),- "float">: lambda "f" (primitive _literals_showFloat32 @@ var "f")])- (Types.function (Types.var "Number") Types.string)-- expectTypeOf "match Number applied to int variant"- (match testTypeNumberName Nothing [- "int">: lambda "i" (primitive _math_add @@ var "i" @@ int32 10),- "float">: lambda "f" (int32 0)] @@- variant testTypeNumberName (Name "int") (int32 42))- Types.int32-- expectTypeOf "match Timestamp with mixed data types"- (match testTypeTimestampName Nothing [- "unixTimeMillis">: lambda "millis" (primitive _literals_showUint64 @@ var "millis"),- "date">: lambda "dateStr" (var "dateStr")])- (Types.function (Types.var "Timestamp") Types.string)-- H.describe "Polymorphic union eliminations" $ do- expectTypeOf "match PersonOrSomething with string"- (match testTypePersonOrSomethingName Nothing [- "person">: lambda "p" (project testTypePersonName (Name "firstName") @@ var "p"),- "other">: lambda "x" (var "x")])- (Types.function (Types.apply (Types.var "PersonOrSomething") (Types.string)) (Types.string))-- expectTypeOf "match PersonOrSomething instantiated with string"- (match testTypePersonOrSomethingName Nothing [- "person">: lambda "p" (project testTypePersonName (Name "firstName") @@ var "p"),- "other">: lambda "x" (var "x")] @@- variant testTypePersonOrSomethingName (Name "other") (string "test"))- Types.string-- H.describe "Union eliminations with defaults" $ do- expectTypeOf "match Comparison with default case"- (match testTypeComparisonName (Just (string "unknown")) [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal")])- (Types.function (Types.var "Comparison") Types.string)-- expectTypeOf "match Number with default case"- (match testTypeNumberName (Just (int32 (-1))) [- "int">: lambda "i" (var "i")])- (Types.function (Types.var "Number") Types.int32)-- expectTypeOf "match UnionMonomorphic with default"- (match testTypeUnionMonomorphicName (Just (string "fallback")) [- "bool">: lambda "b" (primitive _literals_showBoolean @@ var "b"),- "string">: lambda "s" (var "s")])- (Types.function (Types.var "UnionMonomorphic") Types.string)-- H.describe "Nested union eliminations" $ do- expectTypeOf "nested match statements"- (match testTypePersonOrSomethingName Nothing [- "person">: lambda "p" (project testTypePersonName (Name "firstName") @@ var "p"),- "other">: lambda "x" (- match testTypeNumberName Nothing [- "int">: lambda "i" (primitive _literals_showInt32 @@ var "i"),- "float">: lambda "f" (primitive _literals_showFloat32 @@ var "f")] @@- var "x")])- (Types.function (Types.apply (Types.var "PersonOrSomething") (Types.var "Number")) Types.string)-- expectTypeOf "match in tuple"- (tuple [- match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (int32 1),- "equalTo">: lambda "x" (int32 0),- "greaterThan">: lambda "x" (int32 (-1))],- string "context"])- (Types.product [Types.function (Types.var "Comparison") Types.int32, Types.string])-- H.describe "Union eliminations in complex contexts" $ do- expectTypeOf "match in let binding"- (lets ["matcher">: match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal"),- "greaterThan">: lambda "x" (string "greater")]] $- var "matcher")- (Types.function (Types.var "Comparison") Types.string)-- expectTypeOf "match in record"- (record testTypePersonName [- field "firstName" (match testTypePersonOrSomethingName Nothing [- "person">: lambda "p" (project testTypePersonName (Name "firstName") @@ var "p"),- "other">: lambda "x" (var "x")] @@- variant testTypePersonOrSomethingName (Name "other") (string "John")),- field "lastName" (string "Doe"),- field "age" (int32 30)])- (Types.var "Person")-- expectTypeOf "match with polymorphic result in list"- (list [- match testTypePersonOrSomethingName Nothing [- "person">: lambda "p" (project testTypePersonName (Name "age") @@ var "p"),- "other">: lambda "x" (var "x")] @@- variant testTypePersonOrSomethingName (Name "other") (int32 25),- int32 30])- (Types.list Types.int32)-- H.describe "Higher-order union eliminations" $ do- expectTypeOf "map match over list"- (primitive _lists_map @@- (match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal"),- "greaterThan">: lambda "x" (string "greater")]) @@- list [unitVariant testTypeComparisonName (Name "lessThan"),- unitVariant testTypeComparisonName (Name "equalTo")])- (Types.list Types.string)-- expectTypeOf "compose match with other functions"- (lambda "comp" $- primitive _strings_length @@- (match testTypeComparisonName Nothing [- "lessThan">: lambda "x" (string "less"),- "equalTo">: lambda "x" (string "equal"),- "greaterThan">: lambda "x" (string "greater")] @@- var "comp"))- (Types.function (Types.var "Comparison") Types.int32)-- expectTypeOf "match in lambda body"- (lambda "unionValue" $- match testTypeNumberName Nothing [- "int">: lambda "i" (primitive _math_add @@ var "i" @@ int32 1),- "float">: lambda "f" (int32 0)] @@- var "unionValue")- (Types.function (Types.var "Number") Types.int32)-- H.describe "Recursive union eliminations" $ do- expectTypeOf "match HydraType recursively"- (match testTypeHydraTypeName Nothing [- "literal">: lambda "lit" (- match testTypeHydraLiteralTypeName Nothing [- "boolean">: lambda "b" (primitive _literals_showBoolean @@ var "b"),- "string">: lambda "s" (var "s")] @@- var "lit"),- "list">: lambda "nested" (string "list")])- (Types.function (Types.var "HydraType") Types.string)--checkTypeOfUnit :: H.SpecWith ()-checkTypeOfUnit = H.describe "Unit" $ do- H.describe "Unit term" $ do- expectTypeOf "unit literal"- unit- Types.unit- H.describe "Unit term in polymorphic context" $ do- expectTypeOf "unit from lambda"- (lambda "x" unit)- (Types.forAll "t0" $ Types.function (Types.var "t0") Types.unit)- expectTypeOf "unit in tuple"- (tuple [unit, string "foo"])- (Types.product [Types.unit, Types.string])--checkTypeOfVariables :: H.SpecWith ()-checkTypeOfVariables = H.describe "Variables" $ do- H.describe "Simple variable lookup" $ do- expectTypeOf "int variable"- (lambda "x" $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "variable in let binding"- (lets ["x">: int32 42] $ var "x")- Types.int32- expectTypeOf "multiple variables"- (lets ["x">: string "hello",- "y">: int32 42] $- tuple [var "x", var "y"])- (Types.product [Types.string, Types.int32])-- H.describe "Variable scoping" $ do- expectTypeOf "lambda parameter"- (lambda "x" $ lambda "y" $ var "x")- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.var "t0")))- expectTypeOf "let binding scope"- (lets ["x">: int32 1] $- lets ["y">: string "hello"] $- var "x")- Types.int32- expectTypeOf "variable shadowing"- (lets ["x">: int32 1] $- lambda "x" $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "nested scoping"- (lambda "x" $- lets ["y">: var "x"] $- lambda "z" $- tuple [var "x", var "y", var "z"])- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.product [Types.var "t0", Types.var "t0", Types.var "t1"])))-- H.describe "Polymorphic variables" $ do- expectTypeOf "polymorphic function"- (lets ["id">: lambda "x" $ var "x"] $- var "id")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.var "t0"))- expectTypeOf "polymorphic application"- (lets ["id">: lambda "x" $ var "x"] $- tuple [var "id" @@ int32 42, var "id" @@ string "test"])- (Types.product [Types.int32, Types.string])- expectTypeOf "higher order polymorphic"- (lets ["apply">: lambda "f" $ lambda "x" $ var "f" @@ var "x"] $- var "apply")- (Types.forAlls ["t0", "t1"] $- Types.function (Types.function (Types.var "t0") (Types.var "t1")) (Types.function (Types.var "t0") (Types.var "t1")))-- H.describe "Variables in complex contexts" $ do- expectTypeOf "variable in record"- (lambda "name" $- record testTypePersonName [- field "firstName" (var "name"),- field "lastName" (string "Doe"),- field "age" (int32 25)])- (Types.function Types.string (Types.var "Person"))- expectTypeOf "variable in list"- (lambda "x" $ list [var "x", var "x"])- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.list $ Types.var "t0"))- expectTypeOf "variable in map"- (lambda "key" $ lambda "value" $- Terms.map $ M.singleton (var "key") (var "value"))- (Types.forAlls ["t0", "t1"] $ Types.function (Types.var "t0") (Types.function (Types.var "t1") (Types.map (Types.var "t0") (Types.var "t1"))))- expectTypeOf "variable in optional"- (lambda "x" $ just $ var "x")- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.optional $ Types.var "t0"))-- H.describe "Recursive variables" $ do- expectTypeOf "simple recursion"- (lets ["f">: lambda "x" $ primitive _math_add @@ var "x" @@ int32 1] $- var "f")- (Types.function Types.int32 Types.int32)- expectTypeOf "mutual recursion"- (lets ["f">: lambda "x" $ var "g" @@ var "x",- "g">: lambda "y" $ primitive _math_add @@ var "y" @@ int32 1] $- var "f")- (Types.function Types.int32 Types.int32)--checkTypeOfWrappedTerms :: H.SpecWith ()-checkTypeOfWrappedTerms = H.describe "Wrapped terms" $ do- H.describe "Monomorphic wrapped terms" $ do- expectTypeOf "string alias"- (wrap testTypeStringAliasName (string "hello"))- (Types.var "StringTypeAlias")- expectTypeOf "wrapped integer"- (wrap testTypeStringAliasName (string "wrapped"))- (Types.var "StringTypeAlias")- expectTypeOf "wrapped in tuple"- (tuple [wrap testTypeStringAliasName (string "first"),- string "second"])- (Types.product [Types.var "StringTypeAlias", Types.string])-- H.describe "Polymorphic wrapped terms" $ do- expectTypeOf "polymorphic wrapper with int"- (wrap testTypePolymorphicWrapperName (list [int32 1, int32 2]))- (Types.apply (Types.var "PolymorphicWrapper") Types.int32)- expectTypeOf "polymorphic wrapper with string"- (wrap testTypePolymorphicWrapperName (list [string "a", string "b"]))- (Types.apply (Types.var "PolymorphicWrapper") Types.string)- expectTypeOf "polymorphic wrapper from lambda"- (lambda "x" $ wrap testTypePolymorphicWrapperName (list [var "x"]))- (Types.forAll "t0" $ Types.function (Types.var "t0") (Types.apply (Types.var "PolymorphicWrapper") (Types.var "t0")))-- H.describe "Wrapped terms in complex contexts" $ do- expectTypeOf "wrapped in record"- (record testTypePersonName [- field "firstName" (string "John"),- field "lastName" (string "Doe"),- field "age" (int32 30)])- (Types.var "Person")- expectTypeOf "wrapped in let binding"- (lets ["alias">: wrap testTypeStringAliasName (string "test")] $- var "alias")- (Types.var "StringTypeAlias")- expectTypeOf "wrapped in list"- (list [wrap testTypeStringAliasName (string "first"),- wrap testTypeStringAliasName (string "second")])- (Types.list $ Types.var "StringTypeAlias")-- H.describe "Nested wrapped terms" $ do- expectTypeOf "wrapped tuple"- (wrap testTypePolymorphicWrapperName (list [tuple [int32 1, string "a"]]))- (Types.apply (Types.var "PolymorphicWrapper") (Types.product [Types.int32, Types.string]))- expectTypeOf "wrapped optional"- (wrap testTypePolymorphicWrapperName (list [just $ int32 42]))- (Types.apply (Types.var "PolymorphicWrapper") (Types.optional Types.int32))- expectTypeOf "wrapped map"- (wrap testTypePolymorphicWrapperName (list [Terms.map $ M.singleton (string "key") (int32 42)]))- (Types.apply (Types.var "PolymorphicWrapper") (Types.map Types.string Types.int32))-- H.describe "Multiple wrapping levels" $ do- expectTypeOf "wrapped in optional"- (just $ wrap testTypeStringAliasName (string "wrapped"))- (Types.optional $ Types.var "StringTypeAlias")- expectTypeOf "list of wrapped polymorphic"- (list [wrap testTypePolymorphicWrapperName (list [int32 1]),- wrap testTypePolymorphicWrapperName (list [int32 2])])- (Types.list $ Types.apply (Types.var "PolymorphicWrapper") Types.int32)--checkTypeOfWrapEliminations :: H.SpecWith ()-checkTypeOfWrapEliminations = H.describe "Wrap eliminations" $ do- H.describe "Monomorphic unwrapping" $ do- expectTypeOf "unwrap string alias"- (unwrap testTypeStringAliasName)- (Types.function (Types.var "StringTypeAlias") Types.string)-- H.describe "Polymorphic unwrapping" $ do- expectTypeOf "unwrap polymorphic wrapper"- (unwrap testTypePolymorphicWrapperName)- (Types.forAll "t0" $ Types.function (Types.apply (Types.var "PolymorphicWrapper") (Types.var "t0")) (Types.list $ Types.var "t0"))-- H.describe "Unwrap eliminations in applications" $ do- expectTypeOf "unwrap applied to wrapped term"- (unwrap testTypeStringAliasName @@ wrap testTypeStringAliasName (string "hello"))- Types.string- expectTypeOf "unwrap polymorphic applied"- (unwrap testTypePolymorphicWrapperName @@ wrap testTypePolymorphicWrapperName (list [int32 1, int32 2]))- (Types.list Types.int32)-- H.describe "Unwrap in complex contexts" $ do- expectTypeOf "unwrap in let binding"- (lets ["unwrapper">: unwrap testTypeStringAliasName,- "wrapped">: wrap testTypeStringAliasName (string "test")] $- var "unwrapper" @@ var "wrapped")- Types.string- expectTypeOf "unwrap in tuple"- (tuple [unwrap testTypeStringAliasName, string "context"])- (Types.product [Types.function (Types.var "StringTypeAlias") Types.string, Types.string])- expectTypeOf "unwrap in lambda"- (lambda "wrapped" $ unwrap testTypeStringAliasName @@ var "wrapped")- (Types.function (Types.var "StringTypeAlias") Types.string)-- H.describe "Chained unwrapping" $ do- expectTypeOf "unwrap then process"- (lambda "wrapped" $- primitive _strings_cat2 @@ (unwrap testTypeStringAliasName @@ var "wrapped") @@ string " suffix")- (Types.function (Types.var "StringTypeAlias") Types.string)- expectTypeOf "unwrap polymorphic then map"- (lambda "wrappedList" $- primitive _lists_map @@ (primitive _math_add @@ int32 1) @@ (unwrap testTypePolymorphicWrapperName @@ var "wrappedList"))- (Types.function (Types.apply (Types.var "PolymorphicWrapper") Types.int32) (Types.list Types.int32))-- H.describe "Multiple unwrap operations" $ do- expectTypeOf "unwrap different types"- (lambda "stringWrapped" $ lambda "listWrapped" $- tuple [unwrap testTypeStringAliasName @@ var "stringWrapped",- unwrap testTypePolymorphicWrapperName @@ var "listWrapped"])- (Types.forAll "t0" $ Types.function (Types.var "StringTypeAlias")- (Types.function (Types.apply (Types.var "PolymorphicWrapper") (Types.var "t0"))- (Types.product [Types.string, Types.list $ Types.var "t0"])))--------------------------------------------expectTypeOf :: String -> Term -> Type -> H.SpecWith ()-expectTypeOf desc term typ = H.it desc $ withDefaults expectTypeOfResult desc term typ--typeOfShouldFail :: String -> M.Map Name Type -> Term -> H.SpecWith ()-typeOfShouldFail desc types term = H.it desc $ shouldFail $ do- cx <- graphToInferenceContext testGraph- typeOfInternal cx S.empty types [] term--withDefaults :: (String -> M.Map Name Type -> Term -> x) -> String -> Term -> x-withDefaults f desc = f desc M.empty
+ src/test/haskell/Hydra/Json/AesonSpec.hs view
@@ -0,0 +1,80 @@+-- | Cross-implementation round-trip tests for JSON serialization/parsing.+-- Tests that the new Hydra-native JSON implementation is compatible with+-- the existing Aeson-based implementation.++{-+stack ghci hydra:lib hydra:hydra-test++Test.Hspec.hspec Hydra.Json.AesonSpec.spec+-}++module Hydra.Json.AesonSpec where++import Hydra.Json.Model (Value)+import Hydra.Testing+import Hydra.Parsing (ParseResult(..), ParseSuccess(..), ParseError(..))+import qualified Hydra.Json.Writer as NewSerde+import qualified Hydra.Json.Parser as NewParser+import qualified Hydra.Staging.Json.Serde as AesonSerde+import qualified Hydra.Test.Json.Writer as WriterTests+import qualified Hydra.Test.Json.Parser as ParserTests++import qualified Test.Hspec as H+import qualified Data.List as L+++-- | Extract all JSON values from writer test cases (inputs)+extractWriterValues :: TestGroup -> [(String, Value)]+extractWriterValues group = concatMap extractFromCase (testGroupCases group)+ ++ concatMap extractWriterValues (testGroupSubgroups group)+ where+ extractFromCase tc = case testCaseWithMetadataCase tc of+ TestCaseJsonWriter (WriterTestCase input _) ->+ [(testCaseWithMetadataName tc, input)]+ _ -> []++-- | Extract all JSON values from successful parser test cases (expected outputs)+extractParserValues :: TestGroup -> [(String, Value)]+extractParserValues group = concatMap extractFromCase (testGroupCases group)+ ++ concatMap extractParserValues (testGroupSubgroups group)+ where+ extractFromCase tc = case testCaseWithMetadataCase tc of+ TestCaseJsonParser (ParserTestCase _ (ParseResultSuccess success)) ->+ [(testCaseWithMetadataName tc, parseSuccessValue success)]+ _ -> []++-- | All JSON values from both writer and parser test suites+allJsonValues :: [(String, Value)]+allJsonValues = L.nubBy (\(n1, _) (n2, _) -> n1 == n2) $+ extractWriterValues WriterTests.allTests+ ++ extractParserValues ParserTests.allTests++-- | Test: Aeson writer -> New parser -> Compare+aesonWriterNewParserRoundTrip :: H.SpecWith ()+aesonWriterNewParserRoundTrip = H.describe "Aeson writer -> New parser round trip" $ do+ mapM_ makeTest allJsonValues+ where+ makeTest (name, value) = H.it name $ do+ let serialized = AesonSerde.jsonValueToString value+ case NewParser.parseJson serialized of+ ParseResultSuccess success ->+ parseSuccessValue success `H.shouldBe` value+ ParseResultFailure err ->+ H.expectationFailure $ "Parse failed: " ++ parseErrorMessage err+ ++ " at: " ++ take 50 (parseErrorRemainder err)++-- | Test: New writer -> Aeson parser -> Compare+newWriterAesonParserRoundTrip :: H.SpecWith ()+newWriterAesonParserRoundTrip = H.describe "New writer -> Aeson parser round trip" $ do+ mapM_ makeTest allJsonValues+ where+ makeTest (name, value) = H.it name $ do+ let serialized = NewSerde.printJson value+ case AesonSerde.stringToJsonValue serialized of+ Right parsed -> parsed `H.shouldBe` value+ Left err -> H.expectationFailure $ "Parse failed: " ++ err++spec :: H.Spec+spec = do+ aesonWriterNewParserRoundTrip+ newWriterAesonParserRoundTrip
src/test/haskell/Hydra/MonadsSpec.hs view
@@ -1,3 +1,9 @@+{-+stack ghci hydra:lib hydra:hydra-test++Test.Hspec.hspec Hydra.MonadsSpec.spec+-}+ module Hydra.MonadsSpec where import Hydra.Kernel@@ -11,15 +17,9 @@ import qualified Test.Hspec as H -checkErrorTrace :: H.SpecWith ()-checkErrorTrace = do- H.describe "Check error traces resulting from an explicit failure" $ do-- H.it "Error traces are in the right order" $- H.shouldBe- (unFlow (withTrace "one" $ withTrace "two" $ if False then pure 42 else fail "oops") () emptyTrace)- (FlowState Nothing () emptyTrace {traceMessages = ["Error: oops (one > two)"]})-+-- This test cannot be included in the kernel because it requires+-- building terms with 4000+ nested withTrace calls, which exceeds the trace depth limit+-- during kernel generation. These tests remain as hand-written HSpec tests only. checkMaxTraceDepth :: H.SpecWith () checkMaxTraceDepth = do H.describe "Check breaking out of flows with an infinite loop" $ do@@ -49,5 +49,4 @@ spec :: H.Spec spec = do- checkErrorTrace checkMaxTraceDepth
− src/test/haskell/Hydra/ReductionSpec.hs
@@ -1,175 +0,0 @@-{--stack ghci hydra:lib hydra:hydra-test--Test.Hspec.hspec Hydra.ReductionSpec.spec--}--module Hydra.ReductionSpec where--import Hydra.Kernel-import Hydra.Dsl.Terms as Terms-import Hydra.Lib.Strings-import qualified Hydra.Dsl.Types as Types--import Hydra.TestUtils--import qualified Test.Hspec as H-import qualified Test.QuickCheck as QC-import qualified Data.List as L-import qualified Data.Char as C-import qualified Data.Set as S---checkAlphaConversion :: H.SpecWith ()-checkAlphaConversion = do- H.describe "Tests for alpha conversion" $ do- H.it "Variables are substituted at the top level" $- QC.property $ \v ->- alphaConvert (Name v) (Name $ v ++ "'") (var v) == (var (v ++ "'") :: Term)- H.it "Variables are substituted within subexpressions" $- QC.property $ \v ->- alphaConvert (Name v) (Name $ v ++ "'") (list [int32 42, var v])- == (list [int32 42, var (v ++ "'")] :: Term)- H.it "Lambdas with unrelated variables are transparent to alpha conversion" $- QC.property $ \v ->- alphaConvert (Name v) (Name $ v ++ "1") (lambda (v ++ "2") $ list [int32 42, var v, var (v ++ "2")])- == (lambda (v ++ "2") $ list [int32 42, var (v ++ "1"), var (v ++ "2")] :: Term)- H.it "Lambdas of the same variable are opaque to alpha conversion" $- QC.property $ \v ->- alphaConvert (Name v) (Name $ v ++ "1") (lambda v $ list [int32 42, var v, var (v ++ "2")])- == (lambda v $ list [int32 42, var v, var (v ++ "2")] :: Term)--checkLiterals :: H.SpecWith ()-checkLiterals = do- H.describe "Tests for literal values" $ do-- H.it "Literal terms have no free variables" $- QC.property $ \av -> termIsClosed (literal av :: Term)-- H.it "Literal terms are fully reduced; check using a dedicated function" $- QC.property $ \av -> termIsValue testGraph (literal av :: Term)-- H.it "Literal terms are fully reduced; check by trying to reduce them" $- QC.property $ \av ->- shouldSucceedWith- (eval (literal av))- (literal av :: Term)-- H.it "Literal terms cannot be applied" $- QC.property $ \lv -> shouldSucceedWith- (eval $ apply (literal lv) (literal lv))- (apply (literal lv) (literal lv))--checkMonomorphicPrimitives :: H.SpecWith ()-checkMonomorphicPrimitives = do- H.describe "Tests for monomorphic primitive functions" $ do-- H.it "Example primitives have the expected arity" $ do- H.shouldBe- (primitiveArity <$> lookupPrimitive testGraph _strings_toUpper)- (Just 1)- H.shouldBe- (primitiveArity <$> lookupPrimitive testGraph _strings_splitOn)- (Just 2)-- H.it "Simple applications of a unary function succeed" $- QC.property $ \s ->- shouldSucceedWith- (eval (apply (primitive _strings_toUpper) $ string s))- (string $ fmap C.toUpper s)-- H.it "Simple applications of a binary function succeed" $- QC.property $ \i1 i2 ->- shouldSucceedWith- (eval (apply (apply (primitive _math_add) $ int32 i1) $ int32 i2))- (int32 $ i1 + i2)-- H.it "Incomplete application of a primitive function leaves the term unchanged" $- QC.property $ \s1 ->- shouldSucceedWith- (eval (apply (primitive _strings_splitOn) $ string s1))- (apply (primitive _strings_splitOn) $ string s1)-- H.it "Extra arguments to a primitive function are tolerated" $- QC.property $ \s1 s2 ->- shouldSucceedWith- (eval (apply (apply (primitive _strings_toUpper) $ string s1) $ string s2))- (apply (string $ toUpper s1) (string s2))--checkPolymorphicPrimitives :: H.SpecWith ()-checkPolymorphicPrimitives = do- H.describe "Tests for polymorphic primitive functions" $ do-- H.it "Test polymorphic list length" $ do- QC.property $ \l ->- shouldSucceedWith- (eval (apply (primitive _lists_length) $ list l))- (int32 $ L.length l)--checkNullaryPrimitives :: H.SpecWith ()-checkNullaryPrimitives = do- H.describe "Tests for nullary primitives (constants)" $ do-- H.it "Test empty set constant" $ do- -- shouldSucceedWith- -- (eval (apply (primitive _sets_size) (Terms.set S.empty)))- -- (int32 0)- shouldSucceedWith- (eval (apply (primitive _sets_size) (primitive _sets_empty)))- (int32 0)--testBetaReduceTypeRecursively :: H.SpecWith ()-testBetaReduceTypeRecursively = do- H.describe "Beta reduce types recursively" $ do-- H.it "Try non-application types" $ do- H.shouldBe- (reduce Types.unit)- Types.unit- H.shouldBe- (reduce testTypeLatLon)- testTypeLatLon-- H.it "Try simple application types" $ do- H.shouldBe- (reduce app1)- (Types.function Types.string Types.string)- H.shouldBe- (reduce app2)- testTypeLatLon- H.shouldBe- (reduce app3)- (TypeRecord $ RowType (Name "Example") [Types.field "foo" Types.unit])-- H.it "Try recursive application types" $ do- H.shouldBe- (reduce app4)- (TypeRecord $ RowType (Name "Example") [Types.field "f1" Types.int32, Types.field "f2" Types.int64])---- H.it "Distinguish between eager and lazy evaluation" $ do--- H.shouldBe--- (reduce False app5)--- (TypeRecord $ RowType (Name "Example") [Types.field "foo" app1])--- H.shouldBe--- (reduce True app5)--- (TypeRecord $ RowType (Name "Example") [Types.field "foo" $ Types.function Types.string Types.string])- where- app1 = Types.apply (Types.forAll "t" $ Types.function (Types.var "t") (Types.var "t")) Types.string :: Type- app2 = Types.apply (Types.forAll "x" testTypeLatLon) Types.int32 :: Type- app3 = Types.apply (Types.forAll "a" $ TypeRecord $ RowType (Name "Example") [Types.field "foo" $ Types.var "a"]) Types.unit :: Type- app4 = Types.apply (Types.apply (Types.forAll "x" $ Types.forAll "y" $ TypeRecord $ RowType (Name "Example") [- Types.field "f1" $ Types.var "x",- Types.field "f2" $ Types.var "y"]) Types.int32) Types.int64 :: Type- app5 = Types.apply (Types.forAll "a" $ TypeRecord $ RowType (Name "Example") [Types.field "foo" $ Types.var "a"]) app1--reduce :: Type -> Type-reduce typ = fromFlow typ (schemaContext testGraph) (betaReduceType typ)--spec :: H.Spec-spec = do- checkAlphaConversion- testBetaReduceTypeRecursively- checkLiterals- checkMonomorphicPrimitives- checkPolymorphicPrimitives- checkNullaryPrimitives
src/test/haskell/Hydra/Reference/AlgorithmW.hs view
@@ -6,6 +6,12 @@ -- Lightweight adaptation to Hydra by Joshua Shinavier. -- License: Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0 +{-+ Usage:+ testOne test1+ testOne test2+ etc.+-} module Hydra.Reference.AlgorithmW where import Prelude@@ -17,7 +23,7 @@ import Hydra.Minimal natType = TyLit $ LiteralTypeInteger IntegerTypeInt32-constNeg = Const $ PrimTyped $ TypedPrimitive (Name "hydra.lib.math.neg") $ Forall [] $ TyFn natType natType+constNeg = Const $ PrimTyped $ TypedPrimitive (Name "hydra.lib.math.negate") $ Forall [] $ TyFn natType natType -- Note: Hydra has no built-in pred or succ functions, but neg has the expected type constPred = constNeg constSucc = constNeg@@ -92,7 +98,8 @@ | TyFn MTy MTy | TyProd MTy MTy | TySum MTy MTy- | TyUnit + | TyEither MTy MTy+ | TyUnit | TyVoid deriving (Eq, Show) @@ -106,6 +113,7 @@ showMTy (TyFn t1 t2) = "(" ++ showMTy t1 ++ " -> " ++ showMTy t2 ++ ")" showMTy (TyProd t1 t2) = "(" ++ showMTy t1 ++ " * " ++ showMTy t2 ++ ")" showMTy (TySum t1 t2) = "(" ++ showMTy t1 ++ " + " ++ showMTy t2 ++ ")"+showMTy (TyEither t1 t2) = "(Either " ++ showMTy t1 ++ " " ++ showMTy t2 ++ ")" showMTy TyUnit = "Unit" showMTy TyVoid = "Void" @@ -142,13 +150,14 @@ showFExpr (FTyAbs ab c) = "(/\\" ++ d ++ showFExpr c ++ ")" where d = foldr (\p r -> p ++ " " ++ r) ". " ab -data FTy = FTyVar Var +data FTy = FTyVar Var | FTyLit LiteralType | FTyList FTy | FTyFn FTy FTy | FTyProd FTy FTy | FTySum FTy FTy- | FTyUnit + | FTyEither FTy FTy+ | FTyUnit | FTyVoid | FForall [Var] FTy deriving (Eq, Show)@@ -160,13 +169,14 @@ showFTy (FTyFn t1 t2) = "(" ++ showFTy t1 ++ " -> " ++ showFTy t2 ++ ")" showFTy (FTyProd t1 t2) = "(" ++ showFTy t1 ++ " * " ++ showFTy t2 ++ ")" showFTy (FTySum t1 t2) = "(" ++ showFTy t1 ++ " + " ++ showFTy t2 ++ ")"+showFTy (FTyEither t1 t2) = "(Either " ++ showFTy t1 ++ " " ++ showFTy t2 ++ ")" showFTy FTyUnit = "Unit" showFTy FTyVoid = "Void" showFTy (FForall x t) = "(forall " ++ d ++ showFTy t ++ ")" where d = foldr (\p q -> p ++ " " ++ q) ", " x -mTyToFTy :: MTy -> FTy -mTyToFTy (TyVar v) = FTyVar v +mTyToFTy :: MTy -> FTy+mTyToFTy (TyVar v) = FTyVar v mTyToFTy (TyLit lt) = FTyLit lt mTyToFTy TyUnit = FTyUnit mTyToFTy TyVoid = FTyVoid@@ -174,6 +184,7 @@ mTyToFTy (TyFn x y) = FTyFn (mTyToFTy x) (mTyToFTy y) mTyToFTy (TyProd x y) = FTyProd (mTyToFTy x) (mTyToFTy y) mTyToFTy (TySum x y) = FTySum (mTyToFTy x) (mTyToFTy y)+mTyToFTy (TyEither x y) = FTyEither (mTyToFTy x) (mTyToFTy y) tyToFTy :: TypSch -> FTy tyToFTy (Forall [] t) = mTyToFTy t@@ -213,6 +224,7 @@ vars TyVoid = [] vars (TyProd t1 t2) = vars t1 ++ vars t2 vars (TySum t1 t2) = vars t1 ++ vars t2+ vars (TyEither t1 t2) = vars t1 ++ vars t2 vars (TyLit _) = [] primTy :: Prim -> TypSch@@ -224,8 +236,8 @@ primTy Cons = Forall ["t"] $ TyFn (TyVar "t") (TyFn (TyList (TyVar "t")) (TyList (TyVar "t"))) primTy TT = Forall [] TyUnit primTy FF = Forall ["t"] $ TyFn TyVoid (TyVar "t")-primTy Inl = Forall ["x", "y"] $ (TyVar "x") `TyFn` (TyProd (TyVar "x") (TyVar "y")) -primTy Inr = Forall ["x", "y"] $ (TyVar "y") `TyFn` (TyProd (TyVar "x") (TyVar "y"))+primTy Inl = Forall ["x", "y"] $ (TyVar "x") `TyFn` (TyEither (TyVar "x") (TyVar "y"))+primTy Inr = Forall ["x", "y"] $ (TyVar "y") `TyFn` (TyEither (TyVar "x") (TyVar "y")) primTy Succ = Forall [] $ natType `TyFn` natType primTy Pred = Forall [] $ natType `TyFn` natType primTy Pair = Forall ["x", "y"] $ (TyFn (TyVar "x") (TyFn (TyVar "y") (TyProd (TyVar "x") (TyVar "y"))))@@ -266,6 +278,7 @@ subst f (TyFn t1 t2) = TyFn (subst f t1) (subst f t2) subst f (TyProd t1 t2) = TyProd (subst f t1) (subst f t2) subst f (TySum t1 t2) = TySum (subst f t1) (subst f t2)+ subst f (TyEither t1 t2) = TyEither (subst f t1) (subst f t2) subst f (TyVar v) = case lookup v f of Nothing -> TyVar v Just y -> y@@ -274,14 +287,15 @@ subst f (FTyLit lt) = FTyLit lt subst f FTyUnit = FTyUnit subst f FTyVoid = FTyVoid- subst f (FTyList t) = FTyList $ subst f t - subst f (FTyFn t1 t2) = FTyFn (subst f t1) (subst f t2) + subst f (FTyList t) = FTyList $ subst f t+ subst f (FTyFn t1 t2) = FTyFn (subst f t1) (subst f t2) subst f (FTyProd t1 t2) = FTyProd (subst f t1) (subst f t2) subst f (FTySum t1 t2) = FTySum (subst f t1) (subst f t2)+ subst f (FTyEither t1 t2) = FTyEither (subst f t1) (subst f t2) subst f (FTyVar v) = case lookup v f of Nothing -> FTyVar v Just y -> mTyToFTy y- subst f (FForall vs t) = FForall vs $ subst phi' t + subst f (FForall vs t) = FForall vs $ subst phi' t where phi' = filter (\(v,f')-> not (elem v vs)) f instance Substable TypSch where@@ -301,18 +315,19 @@ where phi' = filter (\(v,f')-> not (elem v vs)) phi subst phi (FLetrec vs p) = FLetrec (map (\(k,t,v)->(k,subst phi t, subst phi v)) vs) (subst phi p) -subst' :: [(Var,FTy)] -> FTy -> FTy +subst' :: [(Var,FTy)] -> FTy -> FTy subst' f (FTyLit lt) = FTyLit lt subst' f FTyUnit = FTyUnit subst' f FTyVoid = FTyVoid-subst' f (FTyList t) = FTyList $ subst' f t -subst' f (FTyFn t1 t2) = FTyFn (subst' f t1) (subst' f t2) +subst' f (FTyList t) = FTyList $ subst' f t+subst' f (FTyFn t1 t2) = FTyFn (subst' f t1) (subst' f t2) subst' f (FTyProd t1 t2) = FTyProd (subst' f t1) (subst' f t2) subst' f (FTySum t1 t2) = FTySum (subst' f t1) (subst' f t2)+subst' f (FTyEither t1 t2) = FTyEither (subst' f t1) (subst' f t2) subst' f (FTyVar v) = case lookup v f of Nothing -> FTyVar v Just y -> y-subst' f (FForall vs t) = FForall vs $ subst' f' t +subst' f (FForall vs t) = FForall vs $ subst' f' t where f' = filter (\(v,f')-> not (elem v vs)) f ------------------------------------@@ -330,6 +345,7 @@ FTyFn w v -> wfTy tvs w >> wfTy tvs v FTyProd w v -> wfTy tvs w >> wfTy tvs v FTySum w v -> wfTy tvs w >> wfTy tvs v+ FTyEither w v -> wfTy tvs w >> wfTy tvs v FTyUnit -> return () FTyVoid -> return () FForall vs y -> wfTy (vs++tvs) y@@ -383,6 +399,7 @@ mgu TyVoid TyVoid = return [] mgu (TyProd a b) (TyProd a' b') = do { s <- mgu a a' ; s' <- mgu (subst s b) (subst s b'); return $ s' `o` s } mgu (TySum a b) (TySum a' b') = do { s <- mgu a a' ; s' <- mgu (subst s b) (subst s b'); return $ s' `o` s }+mgu (TyEither a b) (TyEither a' b') = do { s <- mgu a a' ; s' <- mgu (subst s b) (subst s b'); return $ s' `o` s } mgu (TyFn a b) (TyFn a' b') = do { s <- mgu a a' ; s' <- mgu (subst s b) (subst s b'); return $ s' `o` s } mgu (TyVar a) (TyVar b) | a == b = return [] mgu (TyVar a) b = do { occurs a b; return [(a, b)] }@@ -397,10 +414,11 @@ occurs v (TyLit _) = return () occurs v (TyList l) = occurs v l occurs v TyUnit = return ()-occurs v TyVoid = return () +occurs v TyVoid = return () occurs v (TyFn a b) = do { occurs v a; occurs v b } occurs v (TyProd a b) = do { occurs v a; occurs v b } occurs v (TySum a b) = do { occurs v a; occurs v b }+occurs v (TyEither a b) = do { occurs v a; occurs v b } occurs v (TyVar v') | v == v' = throwError $ "occurs check failed" | otherwise = return () @@ -515,7 +533,7 @@ testOne t = do { putStrLn $ "Untyped input: "- ; putStrLn $ "\t" ++ show t+ ; putStrLn $ "\t" ++ showExpr t ; let out = fst $ runState (runExceptT (w [] t)) 0 ; case out of Left e -> putStrLn $ "\t" ++ "err: " ++ e@@ -523,11 +541,11 @@ ; putStrLn $ "\nType inferred by Hindley-Milner: " ; putStrLn $ "\t" ++ show ty ; putStrLn "\nSystem F translation: "- ; putStrLn $ "\t" ++ show f+ ; putStrLn $ "\t" ++ showFExpr f ; putStrLn "\nSystem F type: " ; case (typeOf (vars ty) [] f) of Left err -> putStrLn $ "\t" ++ "err: " ++ err- Right tt -> do { putStrLn $ " \t" ++ show tt+ Right tt -> do { putStrLn $ " \t" ++ showFTy tt ; if tt == mTyToFTy ty then return () else putStrLn "**** !!! NO MATCH" } } ; putStrLn "" ; putStrLn "------------------------"@@ -650,9 +668,16 @@ f = Abs "x" $ Abs "y" $ App (App (Var "g") (nat 0)) (nat 0) g = Abs "u" $ Abs "v" $ App (App (Var "f") (Var "v")) (nat 0) - test6 :: Expr test6 = Letrec [("f", f), ("g", g)] b where b = App (App (Const Pair) (Var "f")) (Var "g") f = Abs "x" $ Abs "y" $ App (App (Var "g") (nat 0)) (Var "x") g = Abs "u" $ Abs "v" $ App (App (Var "f") (nat 0)) (nat 0)+++++-- For Hydra debugging++test7 :: Expr+test7 = letrec' "foo" (letrec' "id" (Abs "x" (Var "x")) (Var "id")) (str "whatever")
src/test/haskell/Hydra/Reference/AlgorithmWBridge.hs view
@@ -50,12 +50,11 @@ sels <- CM.mapM toStlc els return $ foldr (\el acc -> App (App (Const Cons) el) acc) (Const Nil) sels Core.TermLiteral lit -> pure $ Const $ PrimLiteral lit- Core.TermProduct els -> toPairs <$> CM.mapM toStlc els- where- toPairs sels = case sels of- [] -> Const TT- [h] -> h- (h:r) -> pair h (toPairs r)+ Core.TermPair (t1, t2) -> pair <$> toStlc t1 <*> toStlc t2+ Core.TermEither et -> case et of+ Left l -> App (Const Inl) <$> toStlc l+ Right r -> App (Const Inr) <$> toStlc r+ Core.TermUnit -> pure $ Const TT Core.TermVariable (Core.Name v) -> pure $ Var v _ -> Left $ "Unsupported term: " ++ show term where@@ -64,7 +63,7 @@ pair a b = App (App (Const Pair) a) b hydraTypeSchemeToStlc :: Core.TypeScheme -> Either String TypSch-hydraTypeSchemeToStlc (Core.TypeScheme vars body) = do+hydraTypeSchemeToStlc (Core.TypeScheme vars body _) = do sbody <- toStlc body return $ Forall (Core.unName <$> vars) sbody where@@ -73,22 +72,11 @@ Core.TypeList et -> TyList <$> toStlc et Core.TypeLiteral lt -> pure $ TyLit lt -- TypeMap MapType |--- TypeOptional Type |- Core.TypeProduct types -> toProd <$> (CM.mapM toStlc types)- where- toProd ts = case ts of- [h] -> h- (h:r) -> TyProd h (toProd r)+-- TypeMaybe Type |+ Core.TypePair (Core.PairType first second) -> TyProd <$> toStlc first <*> toStlc second -- TypeRecord RowType | -- TypeSet Type |- Core.TypeSum types -> if L.length types == 0- then pure TyVoid- else if L.length types == 1- then Left $ "unary sums are not yet supported"- else do- stypes <- CM.mapM toStlc types- let rev = L.reverse stypes- return $ L.foldl (\a e -> TySum e a) (TySum (rev !! 1) (rev !! 0)) $ L.drop 2 rev+ Core.TypeEither (Core.EitherType left right) -> TyEither <$> toStlc left <*> toStlc right -- TypeUnion RowType | Core.TypeVariable name -> pure $ TyVar $ Core.unName name -- TypeWrap (Nominal Type)@@ -114,21 +102,23 @@ gather e = case e of FTyApp (FConst Nil) _ -> [] FApp (FApp (FTyApp (FConst Cons) _) hd) tl -> hd:(gather tl)- FApp (FTyApp (FConst Pair) _) lhs -> Core.TermProduct [toTerm lhs, toTerm e2]+ FApp (FTyApp (FConst Pair) _) lhs -> Core.TermPair (toTerm lhs, toTerm e2)+ FTyApp (FConst Inl) _ -> Core.TermEither $ Left $ toTerm e2+ FTyApp (FConst Inr) _ -> Core.TermEither $ Right $ toTerm e2 _ -> Core.TermApplication $ Core.Application (toTerm e1) (toTerm e2) FConst prim -> case prim of PrimLiteral lit -> Core.TermLiteral lit PrimTyped (TypedPrimitive name _) -> Core.TermFunction $ Core.FunctionPrimitive name Nil -> Core.TermList [] Pair -> Terms.lambdas ["a", "b"] $ Terms.pair (Terms.var "a") (Terms.var "b")- TT -> Terms.tuple []+ TT -> Core.TermUnit _ -> Terms.string $ "unexpected primitive: " ++ show prim -- Note: other prims are unsupported; they can be added here as needed FLetrec bindings env -> Core.TermLet $ Core.Let (fmap bindingToHydra bindings) (toTerm env) where bindingToHydra (v, ty, term) = Core.Binding (Core.Name v) (toTerm term) $ Just $ toTypeScheme ty FTyAbs params body -> L.foldl (\t v -> Core.TermTypeLambda $ Core.TypeLambda (Core.Name v) t) (toTerm body) $ L.reverse params- FTyApp fun args -> L.foldl (\t a -> Core.TermTypeApplication $ Core.TypedTerm t a) (toTerm fun) $ L.reverse hargs+ FTyApp fun args -> L.foldl (\t a -> Core.TermTypeApplication $ Core.TypeApplicationTerm t a) (toTerm fun) $ L.reverse hargs where hargs = fmap (\t -> Core.typeSchemeType $ toTypeScheme t) args FVar v -> Core.TermVariable $ Core.Name v@@ -139,24 +129,17 @@ FTyLit lt -> Core.TypeLiteral lt FTyList lt -> Core.TypeList $ toType lt FTyFn dom cod -> Core.TypeFunction $ Core.FunctionType (toType dom) (toType cod)- FTyProd t1 t2 -> Core.TypeProduct (toType <$> (t1:(componentsTypesOf t2)))- where- componentsTypesOf t = case t of- FTyProd t1 t2 -> t1:(componentsTypesOf t2)- _ -> [t]- FTySum t1 t2 -> Core.TypeSum (toType <$> (t1:(componentsTypesOf t2)))- where- componentsTypesOf t = case t of- FTySum t1 t2 -> t1:(componentsTypesOf t2)- _ -> [t]- FTyUnit -> Core.TypeProduct []- FTyVoid -> Core.TypeSum []+ FTyProd t1 t2 -> Core.TypePair $ Core.PairType (toType t1) (toType t2)+ FTySum t1 t2 -> Core.TypeEither $ Core.EitherType (toType t1) (toType t2)+ FTyEither t1 t2 -> Core.TypeEither $ Core.EitherType (toType t1) (toType t2)+ FTyUnit -> Core.TypeUnit+ FTyVoid -> Core.TypeUnit -- | Convert a System F type expression to a Hydra type scheme toTypeScheme :: FTy -> Core.TypeScheme toTypeScheme ty = case ty of- FForall vars body -> Core.TypeScheme (Core.Name <$> vars) $ toType body- _ -> Core.TypeScheme [] $ toType ty+ FForall vars body -> Core.TypeScheme (Core.Name <$> vars) (toType body) Nothing+ _ -> Core.TypeScheme [] (toType ty) Nothing termToInferredFExpr :: HydraContext -> Core.Term -> IO (FExpr, FTy) termToInferredFExpr context term = do
src/test/haskell/Hydra/Reference/AlgorithmWSpec.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE OverloadedStrings #-}- {- stack ghci hydra:lib hydra:hydra-test @@ -15,7 +13,6 @@ import Hydra.Dsl.Terms as Terms import qualified Hydra.Dsl.Annotations as Ann import qualified Hydra.Dsl.Types as Types-import Hydra.Dsl.ShorthandTypes import qualified Hydra.Show.Core as ShowCore import qualified Hydra.Reference.AlgorithmWBridge as W @@ -23,7 +20,7 @@ import Hydra.Testing import Hydra.TestSuiteSpec import Hydra.Test.TestSuite-import qualified Hydra.Dsl.Testing as Testing+import qualified Hydra.Dsl.Meta.Testing as Testing import qualified Test.Hspec as H import qualified Test.QuickCheck as QC@@ -38,11 +35,13 @@ inferType :: Term -> IO (Term, TypeScheme) inferType = W.termToInferredTerm testHydraContext -expectType :: Term -> TypeScheme -> H.Expectation+expectType :: Term -> TypeScheme -> H.SpecWith () expectType term ts = do- result <- inferType term- H.shouldBe (ShowCore.typeScheme $ snd result) (ShowCore.typeScheme ts)- H.shouldBe (ShowCore.term $ removeTypesFromTerm $ fst result) (ShowCore.term $ removeTypesFromTerm term)+ result <- H.runIO $ inferType term+ H.it "inferred type" $+ H.shouldBe (ShowCore.typeScheme $ snd result) (ShowCore.typeScheme ts)+ H.it "inferred term" $+ H.shouldBe (ShowCore.term $ removeTypesFromTerm $ fst result) (ShowCore.term $ removeTypesFromTerm term) algorithmWRunner :: TestRunner algorithmWRunner desc tcase = if Testing.isDisabled tcase || Testing.isDisabledForMinimalInference tcase
− src/test/haskell/Hydra/RewritingSpec.hs
@@ -1,605 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--{--stack ghci hydra:lib hydra:hydra-test--Test.Hspec.hspec Hydra.RewritingSpec.spec--}-module Hydra.RewritingSpec where--import Hydra.Kernel-import Hydra.Monads-import Hydra.Tools.Monads-import Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types-import Hydra.Dsl.ShorthandTypes-import qualified Hydra.Show.Core as ShowCore--import Hydra.TestUtils--import qualified Test.Hspec as H-import qualified Test.QuickCheck as QC-import qualified Data.List as L-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y---data Quux a = QuuxUnit | QuuxValue a | QuuxPair (Quux a) (Quux a) deriving (Eq, Ord, Show)--fsubQuux :: (a -> b) -> (Quux a -> Quux b) -> Quux a -> Quux b-fsubQuux mf recurse q = case q of- QuuxUnit -> QuuxUnit- QuuxValue x -> QuuxValue $ mf x- QuuxPair left right -> QuuxPair (recurse left) (recurse right)--rewriteQuux :: (a -> b) -> ((Quux a -> Quux b) -> Quux a -> Quux b) -> Quux a -> Quux b-rewriteQuux mf f = rewrite (fsubQuux mf) f--myQuuxRewriter :: Quux String -> Quux Int-myQuuxRewriter = rewriteQuux L.length $ \fsub q -> fsub $ case q of- QuuxPair left right -> QuuxPair QuuxUnit right- _ -> q--checkFoldOverTerm :: H.SpecWith ()-checkFoldOverTerm = do- H.describe "Test foldOverTerm" $ do- H.describe "Pre-order" $ do- H.it "test #1" $- H.shouldBe- (traverse TraversalOrderPre node1)- ["a"]- H.it "test #2" $- H.shouldBe- (traverse TraversalOrderPre node2)- ["a", "b", "c", "d"]- H.describe "Post-order" $ do- H.it "test #1" $- H.shouldBe- (traverse TraversalOrderPost node1)- ["a"]- H.it "test #1" $- H.shouldBe- (traverse TraversalOrderPost node2)- ["b", "d", "c", "a"]- where- node label children = Terms.pair (Terms.string label) (Terms.list children)- labelOf term = case term of- TermProduct [TermLiteral (LiteralString label), _] -> Just label- _ -> Nothing- traverse :: TraversalOrder -> Term -> [String]- traverse order = Y.catMaybes . foldOverTerm order (\l t -> l ++ [labelOf t]) []- node1 = node "a" []- node2 = node "a" [node "b" [], node "c" [node "d" []]]--checkStripTerm :: H.SpecWith ()-checkStripTerm = do- H.describe "Tests for stripping annotations from terms" $ do- H.it "Un-annotated terms are not affected" $- QC.property $ \term -> case (term :: Term) of- TermAnnotated _ -> True- _ -> deannotateTerm term == term- H.it "Terms are stripped recursively" $- QC.property $ \term -> case (term :: Term) of- TermAnnotated _ -> True- _ -> deannotateTerm (Terms.annot M.empty (Terms.annot M.empty term)) == term--checkStripType :: H.SpecWith ()-checkStripType = do- H.describe "Tests for stripping annotations from types" $ do- H.it "Un-annotated types are not affected" $- QC.property $ \typ -> case (typ :: Type) of- TypeAnnotated _ -> True- _ -> deannotateType typ == typ- H.it "Types are stripped recursively" $- QC.property $ \typ -> case (typ :: Type) of- TypeAnnotated _ -> True- _ -> deannotateType (Types.annot M.empty (Types.annot M.empty typ)) == typ--testExpandLambdas :: Graph -> H.SpecWith ()-testExpandLambdas g = do- H.describe "Test expanding to (untyped) lambda terms" $ do-- H.describe "Try terms which do not expand" $ do- H.it "test #1" $- noChange (int32 42)- H.it "test #2" $- noChange (list ["foo", "bar"])- H.it "test #3" $- noChange (splitOn @@ "foo" @@ "bar")- H.it "test #4" $- noChange (lambda "x" $ lambda "y" $ splitOn @@ var "x" @@ var "y")- H.it "test #5" $- noChange (lambda "x" $ int32 42)-- H.describe "Try bare function terms" $ do- H.it "test #1" $- expandsTo- toLower- (lambda "v1" $ toLower @@ var "v1")- H.it "test #2" $- expandsTo- splitOn- (lambda "v1" $ lambda "v2" $ splitOn @@ var "v1" @@ var "v2")- H.it "test #3" $- expandsTo- (splitOn @@ var "foo")- (lambda "v1" $ splitOn @@ var "foo" @@ var "v1")- H.it "test #4" $- expandsTo- (splitOn @@ var "foo" @@ var "bar")- (splitOn @@ var "foo" @@ var "bar")- H.it "test #5" $- expandsTo- (splitOn @@ var "foo" @@ var "bar" @@ var "baz")- (splitOn @@ var "foo" @@ var "bar" @@ var "baz")- H.it "test #6" $- expandsTo- (primitive _optionals_maybe @@ (int32 42) @@ length)- -- Note two levels of lambda expansion- (lambda "v1" $ (primitive _optionals_maybe @@ (int32 42) @@ (lambda "v1" $ length @@ var "v1")) @@ var "v1")- H.it "test #7" $- expandsTo- (project (Name "Person") (Name "firstName"))- (lambda "v1" $ ((project (Name "Person") (Name "firstName") @@ var "v1")))- -- TODO: case statement-- H.describe "Try subterms within applications" $ do- H.it "test #1" $- expandsTo- (splitOn @@ "bar")- (lambda "v1" $ splitOn @@ "bar" @@ var "v1")- H.it "test #2" $- expandsTo- (lambda "x" $ splitOn @@ var "x")- (lambda "x" $ lambda "v1" $ splitOn @@ var "x" @@ var "v1")- H.it "test #3" $- expandsTo- ((lambda "x" $ var "x") @@ length)- (lambda "v1" $ length @@ var "v1")-- H.describe "Try let terms" $ do- H.it "test #1" $- noChange- (lets ["foo">: int32 137] $ int32 42)- H.it "test #2" $- expandsTo- (lets ["foo">: splitOn] $ var "foo")- (lets ["foo">: lambda "v1" $ lambda "v2" $ splitOn @@ var "v1" @@ var "v2"] $ var "foo")-- H.describe "Check that complete applications are no-ops" $ do- H.it "test #1" $- noChange- (toLower @@ "FOO")- H.it "test #2" $- noChange- (splitOn @@ "foo" @@ "bar")-- H.describe "Try other subterms" $ do- H.it "test #1" $- expandsTo- (list [lambda "x" $ list ["foo"], splitOn @@ "bar"])- (list [lambda "x" $ list ["foo"], lambda "v1" $ splitOn @@ "bar" @@ var "v1"])-- H.it "Check that lambda expansion is idempotent" $ do- QC.property $ \term -> do- let once = expandLambdas g term- let twice = expandLambdas g once- H.shouldBe once twice- where- length = primitive $ Name "hydra.lib.strings.length"- splitOn = primitive $ Name "hydra.lib.strings.splitOn"- toLower = primitive $ Name "hydra.lib.strings.toLower"- fromList = primitive $ Name "hydra.lib.sets.fromList"- expandsTo termBefore termAfter = do- let result = expandLambdas g termBefore- H.shouldBe (ShowCore.term result) (ShowCore.term termAfter)- noChange term = expandsTo term term---- TODO: merge this into expandLambdas-testExpandTypedLambdas :: H.SpecWith ()-testExpandTypedLambdas = do- H.describe "Test expanding to typed lambda terms" $ do-- H.describe "Try some terms which do not expand" $ do- H.it "test #1" $- noChange (int32 42)- H.it "test #2" $- noChange (list ["foo", "bar"])- H.it "test #3" $- noChange (splitOn @@ "foo" @@ "bar")- H.it "test #4" $- noChange (lambda "x" $ int32 42)-- H.describe "Expand bare function terms" $ do- H.it "test #1" $- expandsTo- toLower- (lambda "v1" $ toLower @@ var "v1")- H.it "test #2" $- expandsTo- splitOn- (lambda "v1" $ lambda "v2" $ splitOn @@ var "v1" @@ var "v2")- H.it "test #3" $- expandsTo- (primitive _optionals_maybe @@ (int32 42) @@ length)- -- Note two levels of lambda expansion- (lambda "v1" $ (primitive _optionals_maybe @@ (int32 42) @@ (lambda "v1" $ length @@ var "v1")) @@ var "v1")- H.it "test #4" $- expandsTo- (project (Name "Person") (Name "firstName"))- (lambda "v1" $ ((project (Name "Person") (Name "firstName") @@ var "v2")))- -- TODO: case statement-- H.describe "Expand subterms within applications" $ do- H.it "test #1" $- expandsTo- (splitOn @@ "bar")- (lambda "v1" $ splitOn @@ "bar" @@ var "v1")- H.it "test #2" $- expandsTo- ((lambda "x" $ var "x") @@ length)- ((lambda "x" $ var "x") @@ (lambda "v1" $ length @@ var "v1"))-- H.describe "Expand arbitrary subterms" $ do- H.it "test #1" $- expandsTo- (list [lambda "x" $ list ["foo"], splitOn @@ "bar"])- (list [lambda "x" $ list ["foo"], lambda "v1" $ splitOn @@ "bar" @@ var "v1"])-- H.it "Check that lambda expansion is idempotent" $ do- QC.property $ \term -> do- let once = expandTypedLambdas term- let twice = expandTypedLambdas once- H.shouldBe once twice-- where- length = primitive $ Name "hydra.lib.strings.length"- splitOn = primitive $ Name "hydra.lib.strings.splitOn"- toLower = primitive $ Name "hydra.lib.strings.toLower"- expandsTo termBefore termAfter = do--- result <- flowToIo testGraph $ expandLambdas termBefore--- H.shouldBe result termAfter- inf <- flowToIo testGraph (inferenceResultTerm <$> inferInGraphContext termBefore)- let result = expandTypedLambdas inf- H.shouldBe (ShowCore.term (removeTermAnnotations result)) (ShowCore.term termAfter)- noChange term = expandsTo term term--testFoldOverTerm :: H.SpecWith ()-testFoldOverTerm = do- H.describe "Test folding over terms" $ do-- H.it "Try a simple fold" $ do- H.shouldBe- (foldOverTerm TraversalOrderPre adds 0- (list [int32 42, (lambda "x" $ var "x") @@ int32 10]))- 52-- H.it "Check that traversal order is respected" $ do- H.shouldBe- (foldOverTerm TraversalOrderPre listLengths []- (list [list [string "foo", string "bar"], (lambda "x" $ var "x") @@ (list [string "quux"])]))- [1, 2, 2]- H.shouldBe- (foldOverTerm TraversalOrderPost listLengths []- (list [list [string "foo", string "bar"], (lambda "x" $ var "x") @@ (list [string "quux"])]))- [2, 1, 2]- where- adds sum term = case term of- TermLiteral (LiteralInteger (IntegerValueInt32 i)) -> sum + i- _ -> sum- listLengths l term = case term of- TermList els -> L.length els:l- _ -> l--testFlattenLetTerms :: H.SpecWith ()-testFlattenLetTerms = do- H.describe "Test flattening of 'let' terms" $ do-- H.it "Non-let terms are unaffected" $ do- H.shouldBe- (flattenLetTerms $ Terms.int32 42)- (Terms.int32 42)- H.shouldBe- (flattenLetTerms $ Terms.list [Terms.string "foo"])- (Terms.list [Terms.string "foo"])-- H.it "Non-nested let terms are unaffected" $- H.shouldBe- (flattenLetTerms letTerm1)- (letTerm1)-- H.it "Nonrecursive, nested bindings are flattened" $- H.shouldBe- (flattenLetTerms letTerm2)- (letTerm2_flattened)-- H.it "Multiple levels of nesting are flattened appropriately" $- H.shouldBe- (flattenLetTerms letTerm3)- (letTerm3_flattened)- where- makeLet body pairs = TermLet $ Let (makeBinding <$> pairs) body- where- makeBinding (k, v) = Binding (Name k) v Nothing- letTerm1 = makeLet (TermList [Terms.var "x", Terms.var "y"]) [- ("x", Terms.int32 1),- ("y", Terms.int32 2)]- letTerm2 = makeLet (TermList [Terms.var "a", Terms.var "b"]) [- ("a", Terms.int32 1),- ("b", letTerm1)]- letTerm2_flattened = makeLet (TermList [Terms.var "a", Terms.var "b"]) [- ("a", Terms.int32 1),- ("b", TermList [Terms.var "b_x", Terms.var "b_y"]),- ("b_x", Terms.int32 1),- ("b_y", Terms.int32 2)]- letTerm3 = makeLet (TermList [Terms.var "a", Terms.var "b"]) [- ("a", Terms.int32 1),- ("b", makeLet (TermList [Terms.var "x", Terms.var "y"]) [- ("x", Terms.int32 1),- ("y", makeLet (TermList [Terms.var "a", Terms.var "q"]) [- ("p", Terms.int32 137),- ("q", TermList [Terms.var "x", Terms.int32 5])])])]- letTerm3_flattened = makeLet (TermList [Terms.var "a", Terms.var "b"]) [- ("a", Terms.int32 1),- ("b", TermList [Terms.var "b_x", Terms.var "b_y"]),- ("b_x", Terms.int32 1),- ("b_y", TermList [Terms.var "a", Terms.var "b_y_q"]),- ("b_y_p", Terms.int32 137),- ("b_y_q", TermList [Terms.var "b_x", Terms.int32 5])]--testFreeVariablesInTerm :: H.SpecWith ()-testFreeVariablesInTerm = do- H.describe "Test free variables" $ do---- H.it "Generated terms never have free variables" $ do--- QC.property $ \(TypedTerm term _) -> do--- H.shouldBe--- (freeVariablesInTerm (term))--- S.empty-- H.it "Free variables in individual terms" $ do- H.shouldBe- (freeVariablesInTerm (string "foo"))- S.empty- H.shouldBe- (freeVariablesInTerm (var "x"))- (S.fromList [Name "x"])- H.shouldBe- (freeVariablesInTerm (list [var "x", (lambda "y" $ var "y") @@ int32 42]))- (S.fromList [Name "x"])- H.shouldBe- (freeVariablesInTerm (list [var "x", (lambda "y" $ var "y") @@ var "y"]))- (S.fromList [Name "x", Name "y"])--testNormalizeTypeVariablesInTerm :: H.SpecWith ()-testNormalizeTypeVariablesInTerm = do- H.describe "No type variables" $ do- H.it "test #1" $ noChange- (int32 42)- H.it "test #2" $ noChange- (tlet (int32 42) [- ("foo", Nothing, string "foo")])- H.it "test #3" $ noChange- (tlet (int32 42) [- ("foo", Just tsString, string "foo")])- H.it "test #4" $ noChange- (withMonoFoo $ int32 42)-- H.describe "Only free type variables" $ do- H.it "test #1" $ noChange- (withPolyFoo $ int32 42)- H.it "test #2" $ noChange- (withMonoFoo const42)- H.it "test #3" $ noChange- (withPolyFoo const42)-- H.describe "Simple polymorphic let bindings" $ do- H.it "test #1" $ changesTo- (withIdBefore id42)- (withIdAfter id42)-- H.describe "Rewriting of bindings does not affect environment" $ do- H.it "test #1" $ changesTo- (withIdBefore const42) -- Free variable "a" coincides with bound variable "a", but in a different branch.- (withIdAfter const42)- H.it "test #2" $ changesTo -- Same substitution in bindings and environment- (withIdBefore (withIdBefore id42))- (withIdAfter (withIdAfter id42))-- H.describe "Nested polymorphic let bindings" $ do- H.it "Parent variable shadows child variable" $ changesTo- (tlet id42 [- ("id", Just faa, tlet (lambdaTyped "y" tA $ var "id2" @@ var "y") [- ("id2", Just faa, lambdaTyped "x" tA $ var "x")])])- (tlet id42 [- ("id", Just ft0t0, tlet (lambdaTyped "y" t0 $ var "id2" @@ var "y") [- ("id2", Just ft1t1, lambdaTyped "x" t1 $ var "x")])])- H.it "No shadowing" $ changesTo- (tlet id42 [- ("id", Just faa, tlet (lambdaTyped "y" tA $ var "id2" @@ var "y") [- ("id2", Just fbb, lambdaTyped "x" tB $ var "x")])])- (tlet id42 [- ("id", Just ft0t0, tlet (lambdaTyped "y" t0 $ var "id2" @@ var "y") [- ("id2", Just ft1t1, lambdaTyped "x" t1 $ var "x")])])- H.it "No shadowing, locally free type variable" $ changesTo- (tlet (var "fun1" @@ string "foo" @@ int32 42) [- ("fun1", Just (Types.poly ["a", "b"] $ Types.functionMany [tA, tB, tPair tA tB]), lambdaTyped "x" tA $ lambdaTyped "y" tB $- tlet (var "fun2" @@ var "x") [- ("fun2", Just (Types.poly ["c"] $ tFun tC $ tPair tC tB), lambdaTyped "z" tC $ pair (var "z") (var "y"))])])- (tlet (var "fun1" @@ string "foo" @@ int32 42) [- ("fun1", Just (Types.poly ["t0", "t1"] $ Types.functionMany [t0, t1, tPair t0 t1]), lambdaTyped "x" t0 $ lambdaTyped "y" t1 $- tlet (var "fun2" @@ var "x") [- ("fun2", Just (Types.poly ["t2"] $ tFun t2 $ tPair t2 t1), lambdaTyped "z" t2 $ pair (var "z") (var "y"))])])- where- changesTo term1 term2 = H.shouldBe (normalize term1) term2- noChange term = H.shouldBe (normalize term) term- normalize = normalizeTypeVariablesInTerm- tlet env triples = TermLet $ Let (toBinding <$> triples) env- where- toBinding (key, mts, value) = Binding (Name key) value mts- t0 = Types.var "t0"- t1 = Types.var "t1"- t2 = Types.var "t2"- const42 = lambdaTyped "x" (Types.function tA tInt32) $ int32 42- faa = Types.poly ["a"] $ tFun tA tA- fbb = Types.poly ["b"] $ tFun tB tB- ft0t0 = Types.poly ["t0"] $ tFun t0 t0- ft1t1 = Types.poly ["t1"] $ tFun t1 t1- id42 = var "id" @@ int32 42- tsString = Types.mono Types.string- tsA = Types.mono $ Types.var "a"- withIdBefore term = tlet term [- ("id", Just faa, lambda "x" $ var "x")]- withIdAfter term = tlet term [- ("id", Just ft0t0, lambda "x" $ var "x")]- withMonoFoo term = tlet term [- ("foo", Just tsString, string "foo")]- withPolyFoo term = tlet term [- ("foo", Just tsA, var "bar")]--testReplaceTerm :: H.SpecWith ()-testReplaceTerm = do- H.describe "Test term replacement" $ do-- H.it "Check that the correct subterms are replaced" $ do- H.shouldBe- (rewriteTerm replaceInts- (int32 42))- (int64 42)- H.shouldBe- (rewriteTerm replaceInts- (list [int32 42, (lambda "x" $ var "x") @@ int32 137]))- (list [int64 42, (lambda "x" $ var "x") @@ int64 137])-- H.it "Check that traversal order is respected" $ do- H.shouldBe- (rewriteTerm replaceListsPre- (list [list [list []]]))- (list [list []])- H.shouldBe- (rewriteTerm replaceListsPost- (list [list [list []]]))- (list [])---- H.it "Check that metadata is replace recursively" $ do--- H.shouldBe--- (rewriteTerm keepTerm replaceKv (list [annot 42 (string "foo")] Int))--- (list [annot "42" (string "foo")])- where- keepTerm recurse term = recurse term-- replaceInts recurse term = case term2 of- TermLiteral (LiteralInteger (IntegerValueInt32 v)) -> int64 $ fromIntegral v- _ -> term2- where- term2 = recurse term-- replaceLists term = case term of- TermList (h:_) -> case h of- TermList [] -> list []- _ -> term- _ -> term-- replaceListsPre recurse = recurse . replaceLists-- replaceListsPost recurse = replaceLists . recurse-- replaceKv i = show i--testRewriteExampleType :: H.SpecWith ()-testRewriteExampleType = do- H.describe "Test rewriting of a made-up recursive type" $ do-- H.it "Rewrite a hand-picked expression" $ do- H.shouldBe- quux2- (myQuuxRewriter quux1)- where- quux1 = QuuxPair QuuxUnit (QuuxPair (QuuxValue "abc") (QuuxValue "12345"))- quux2 = QuuxPair QuuxUnit (QuuxPair QuuxUnit (QuuxValue 5))--testSimplifyTerm :: H.SpecWith ()-testSimplifyTerm = do- H.describe "Test term simplifation (optimization)" $ do-- H.it "Check that 'const' applications are simplified" $ do- H.shouldBe- (simplifyTerm $ (lambda "x" $ string "foo") @@ int32 42)- (string "foo")- H.shouldBe- (simplifyTerm ((lambda "x" $ list [var "x", var "x"]) @@ var "y"))- (list [var "y", var "y"])- H.shouldBe- (simplifyTerm ((lambda "x" $ string "foo") @@ var "y"))- (string "foo")- H.shouldBe- (simplifyTerm ((lambda "x"- ((lambda "a" (list [string "foo", var "a"])) @@ var "x")) @@ var "y"))- (list [string "foo", var "y"])----testStripAnnotations :: H.SpecWith ()---testStripAnnotations = do--- H.describe "Test stripping metadata from terms" $ do------ H.it "Strip type annotations" $ do--- QC.property $ \(TypedTerm term typ) -> do--- shouldSucceedWith--- (getTermType term)--- Nothing--- shouldSucceedWith--- (getTermType $ withType typ term)--- (Just typ)--- shouldSucceedWith--- (getTermType $ strip $ withType typ term)--- Nothing--testTopologicalSortBindings :: H.SpecWith ()-testTopologicalSortBindings = do- H.describe "Test topological sort of bindings" $ do-- H.it "Isolated bindings" $ do- checkBindings- [("a", string "foo"), ("b", string "bar")]- [["a"], ["b"]]-- H.it "Single recursive binding" $ do- checkBindings- [("a", list [var "a"])]- [["a"]]-- H.it "Mutually recursive bindings" $ do- checkBindings- [("a", list [var "b"]), ("b", list [var "a"])]- [["a", "b"]]-- H.it "Mixed bindings" $ do- checkBindings- [("a", var "b"), ("b", list [var "a", var "c"]), ("c", string "foo"), ("d", string "bar")]- [["c"], ["a", "b"], ["d"]]- where- checkBindings bindings expectedVars = H.shouldBe- (topologicalSortBindingMap bindingMap)- expected- where- bindingMap = M.mapKeys (\k -> Name k) $ M.fromList bindings- expected = fmap (fmap (\k -> (Name k, Y.fromMaybe unit $ M.lookup (Name k) bindingMap))) expectedVars--spec :: H.Spec-spec = do- checkFoldOverTerm- checkStripTerm- checkStripType-- testFoldOverTerm-- testExpandLambdas testGraph--- testExpandTypedLambdas -- TODO: restore me / merge with testExpandLambdas- testFlattenLetTerms- testFreeVariablesInTerm- testNormalizeTypeVariablesInTerm- testReplaceTerm- testRewriteExampleType- testSimplifyTerm--- testStripAnnotations -- TODO: restore me- testTopologicalSortBindings
− src/test/haskell/Hydra/SerializationSpec.hs
@@ -1,113 +0,0 @@-module Hydra.SerializationSpec where--import qualified Test.Hspec as H--import Hydra.Ast-import Hydra.Serialization-import Hydra.Ext.Haskell.Operators---check :: Expr -> String -> H.Expectation-check expr printed = printExpr (parenthesize expr) `H.shouldBe` printed--cases :: Expr -> [(Expr, Expr)] -> Expr-cases cond cases = ifx ofOp lhs rhs- where- lhs = spaceSep [cst "case", cond]- rhs = newlineSep (uncurry (ifx caseOp) <$> cases)- ofOp = Op (Symbol "of") (Padding WsSpace $ WsBreakAndIndent " ") (Precedence 0) AssociativityNone--lam :: [String] -> Expr -> Expr-lam vars = ifx lambdaOp $ cst $ "\\" ++ unwords vars--checkAssociativity :: H.SpecWith ()-checkAssociativity = do- H.describe "Unit tests to verify that associativity is respected" $ do-- H.it "Right-associative operator" $ do- check- (ifx arrowOp (ifx arrowOp (cst "a") (cst "b")) (ifx arrowOp (cst "c") (cst "d")))- "(a -> b) -> c -> d"--checkCaseStatements :: H.SpecWith ()-checkCaseStatements = do- H.describe "Unit tests for case statements" $ do-- H.it "Simple case statement" $ do- check- (cases (ifx gtOp (cst "x") (num 42)) [(cst "False", cst "Big"), (cst "True", cst "Small")])- ( "case x > 42 of\n"- ++ " False -> Big\n"- ++ " True -> Small")-- H.it "Nested case statement" $ do- check- (cases (ifx gtOp (cst "x") (num 42)) [- (cst "True", cases (ifx gtOp (cst "x") (num 100)) [(cst "True", cst "ReallyBig"), (cst "False", cst "Big")]),- (cst "False", cst "Small")])- ( "case x > 42 of\n"- ++ " True -> case x > 100 of\n"- ++ " True -> ReallyBig\n"- ++ " False -> Big\n"- ++ " False -> Small")--checkLambdas :: H.SpecWith ()-checkLambdas = do- H.describe "Unit tests for lambda expressions" $ do-- H.it "Simple lambda" $ do- check- (lam ["x", "y"] (ifx plusOp (cst "x") (cst "y")))- "\\x y -> x + y"--checkLists :: H.SpecWith ()-checkLists = do- H.describe "Unit tests for list expressions" $ do-- H.it "Empty list" $ do- check- (bracketList inlineStyle [])- "[]"-- H.it "Simple non-empty list" $ do- check- (bracketList inlineStyle [num 1, num 2, num 3])- "[1, 2, 3]"-- H.it "Nested list" $ do- check- (bracketList inlineStyle [bracketList inlineStyle [num 1, num 3], num 2])- "[[1, 3], 2]"-- H.it "List with parenthesized expression inside" $ do- check- (bracketList inlineStyle [bracketList inlineStyle [num 1, ifx multOp (ifx plusOp (num 2) (num 3)) (ifx plusOp (num 1) (num 10))], num 2])- "[[1, (2 + 3) * (1 + 10)], 2]"--checkPrecedence :: H.SpecWith ()-checkPrecedence = do- H.describe "Unit tests to verify that operator precedence is respected" $ do-- H.it "Check expressions with operators of different precedence" $ do- check- (ifx plusOp (ifx multOp (num 2) (num 3)) (ifx multOp (num 1) (num 10)))- "2 * 3 + 1 * 10"- check- (ifx multOp (ifx plusOp (num 2) (num 3)) (ifx plusOp (num 1) (num 10)))- "(2 + 3) * (1 + 10)"-- H.it "Check an operator which is both left- and right-associative" $ do- check- (ifx multOp (cst "x") (ifx multOp (cst "y") (cst "z")))- "x * y * z"- check- (ifx multOp (ifx multOp (cst "x") (cst "y")) (cst "z"))- "x * y * z"--spec :: H.Spec-spec = do- checkAssociativity- checkCaseStatements- checkLambdas- checkLists- checkPrecedence
− src/test/haskell/Hydra/SortingSpec.hs
@@ -1,157 +0,0 @@-{--stack ghci hydra:lib hydra:hydra-test--Test.Hspec.hspec Hydra.SortingSpec.spec--}-module Hydra.SortingSpec where--import qualified Test.Hspec as H--import Hydra.Sorting-import Hydra.Tools.Monads---checkSort :: [(Int, [Int])] -> Either [[Int]] [Int] -> H.Expectation-checkSort adj exp = H.shouldBe (hydraEitherToHaskellEither $ topologicalSort adj) exp--checkSortSCC :: [(Int, [Int])] -> [[Int]] -> H.Expectation-checkSortSCC adj exp = H.shouldBe (topologicalSortComponents adj) exp--checkSortDiscreteSet :: H.SpecWith ()-checkSortDiscreteSet = H.describe "Check sorting of discrete sets (no dependencies)" $ do-- H.it "Empty set" $- checkSort [] (Right [] :: Either [[Int]] [Int])-- H.it "Singleton set" $- checkSort [(1, [])]- (Right [1])-- H.it "Discrete set with multiple elements" $- checkSort [(3, []), (1, []), (2, [])]--- (Right [3, 2, 1])- (Right [1, 2, 3])--checkSortTreesAndDags :: H.SpecWith ()-checkSortTreesAndDags = H.describe "Check sorting of trees and DAGs" $ do-- H.it "Linked list" $- checkSort [(3, [1]), (2, [3]), (1, [])]- (Right [1, 3, 2])-- H.it "Binary tree" $- checkSort [(3, [1, 4]), (4, [6, 2]), (1, [5]), (2, []), (6, []), (5, [])]--- (Right [6, 5, 2, 4, 1, 3])- (Right [5, 1, 2, 6, 4, 3])-- H.it "Two trees" $- checkSort [(3, [1, 4]), (5, [6, 2]), (2, [7]), (1, []), (4, []), (6, []), (7, [])]--- (Right [7, 6, 4, 2, 5, 1, 3])- (Right [1, 7, 2, 4, 3, 6, 5])-- H.it "Diamond (DAG)" $- checkSort [(1, [3, 4]), (3, [2]), (4, [2]), (2, [5]), (5, [])]- (Right [5, 2, 3, 4, 1])--checkSortCycles :: H.SpecWith ()-checkSortCycles = H.describe "Check that sorting of graphs with cycles fails" $ do-- H.it "Two-node cycle" $- checkSort [(1, [2]), (2, [1])]- (Left [[1, 2]])-- H.it "Cycle with incoming and outgoing edges" $- checkSort [(1, [3]), (3, [2]), (2, [3, 4]), (4, [5]), (5, [])]- (Left [[2, 3]])--checkSortSCCDiscreteSet :: H.SpecWith ()-checkSortSCCDiscreteSet = H.describe "Check sorting of discrete sets (no dependencies)" $ do-- H.it "Empty set" $- checkSortSCC []- ([] :: [[Int]])-- H.it "Singleton set" $- checkSortSCC [(1, [])]- [[1]]-- H.it "Discrete set with multiple elements" $- checkSortSCC [(3, []), (1, []), (2, [])]--- [[3], [2], [1]]- [[1], [2], [3]]--checkSortSCCWeaklyConnectedComponents :: H.SpecWith ()-checkSortSCCWeaklyConnectedComponents = H.describe "Check weakly-connected components" $ do-- H.describe "Single, two-element component" $ do- H.it "test #1" $- checkSortSCC [(1, [2]), (2, [])]- [[2], [1]]- H.it "test #2" $- checkSortSCC [(2, [1]), (1, [])]- [[1], [2]]-- H.it "Multiple-element component" $ do- checkSortSCC [(2, [1, 3]), (1, [3]), (3, [])]- [[3], [1], [2]]--checkSortSCCStronglyConnectedComponents :: H.SpecWith ()-checkSortSCCStronglyConnectedComponents = H.describe "Check strongly-connected components" $ do-- H.describe "Cycle of two nodes" $ do- H.it "test #1" $- checkSortSCC [(1, [2]), (2, [1])]- [[1, 2]]- H.it "test #2" $- checkSortSCC [(2, [1]), (1, [2])]- [[1, 2]]-- H.describe "Cycle of three nodes, ordered naturally" $ do-- H.it "test #1" $- checkSortSCC [(1, [2]), (2, [3]), (3, [1])]- [[1, 2, 3]]- H.it "test #2" $- checkSortSCC [(2, [1]), (3, [2]), (1, [3])]- [[1, 2, 3]]-- H.it "Multiple, disconnected cycles, each ordered naturally" $ do- checkSortSCC- ([(200, [])] ++ [(100, [])] ++ [(300, [])] ++ [(10, [20]), (20, [10])] ++ [(1, [2]), (2, [3]), (3, [1])])--- [[300], [200], [100], [10, 20], [1, 2, 3]]- [[1, 2, 3], [10, 20], [100], [200], [300]]-- H.it "Complex cycles" $ do- checkSortSCC [(1, [2, 3]), (2, [3]), (3, [1])]- [[1, 2, 3]]--checkSortSCCMixed :: H.SpecWith ()-checkSortSCCMixed = H.describe "Check graphs which are a mix of weakly- and strongly-connected components" $ do-- H.it "Chain of three SCCs" $- checkSortSCC- [(1, [2, 10]), (2, [3]), (3, [1]), (10, [20]), (20, [100, 10]), (100, [])]- [[100], [10, 20], [1, 2, 3]]-- H.it "SCCs with dependencies to/from non-SCC nodes" $- checkSortSCC- [(1, [2, 3, 10]), (2, [3]), (3, [1]),- (10, [20, 30]), (20, [30]), (30, []),- (100, [200, 2]), (200, []), (300, [100]),- (1000, []),- (2000, [])]--- [[2000], [1000], [200], [30], [20], [10], [1, 2, 3], [100], [300]]- [[30], [20], [10], [1, 2, 3], [200], [100], [300], [1000], [2000]]--spec :: H.Spec-spec = do- H.describe "Check topological sort (without cycles)" $ do- checkSortDiscreteSet- checkSortTreesAndDags- checkSortCycles-- H.describe "Check sorting of strongly connected components" $ do- checkSortSCCDiscreteSet- checkSortSCCWeaklyConnectedComponents- checkSortSCCStronglyConnectedComponents- checkSortSCCMixed
− src/test/haskell/Hydra/Staging/Json/CoderSpec.hs
@@ -1,140 +0,0 @@-{--stack ghci hydra:lib hydra:hydra-test--Test.Hspec.hspec Hydra.Staging.Json.CoderSpec.spec--}-module Hydra.Staging.Json.CoderSpec where--import Hydra.Kernel-import Hydra.Lib.Literals-import Hydra.Ext.Org.Json.Coder-import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Json as Json-import qualified Hydra.Dsl.Types as Types-import Hydra.Dsl.Tests--import Hydra.TestData-import Hydra.TestUtils--import qualified Data.Bifunctor as BF-import qualified Test.Hspec as H-import qualified Test.HUnit.Lang as HL-import qualified Data.Map as M-import qualified Data.Set as S-import qualified Data.Maybe as Y-import qualified Test.QuickCheck as QC---literalTypeConstraintsAreRespected :: H.SpecWith ()-literalTypeConstraintsAreRespected = H.describe "Verify that JSON's literal type constraints are respected" $ do-- -- TODO: binary data-- H.it "Check booleans" $- QC.property $ \b -> checkJsonCoder Types.boolean (Terms.boolean b) (Json.ValueBoolean b)-- H.it "Check 32-bit floats" $- QC.property $ \f -> checkJsonCoder Types.float32 (Terms.float32 f) (jsonFloat $ realToFrac f)-- H.it "Check 64-bit floats (doubles)" $- QC.property $ \d -> checkJsonCoder Types.float64 (Terms.float64 d) (jsonFloat $ realToFrac d)-- -- TODO: bigfloat-- H.it "Check 32-bit integers" $- QC.property $ \i -> checkJsonCoder Types.int32 (Terms.int32 i) (jsonInt i)-- H.it "Check 16-bit unsigned integers" $- QC.property $ \i -> checkJsonCoder Types.uint16 (Terms.uint16 i) (jsonInt i)-- H.it "Check arbitrary-precision integers" $- QC.property $ \i -> checkJsonCoder Types.bigint (Terms.bigint i) (jsonInt i)-- H.it "Check strings" $- QC.property $ \s -> checkJsonCoder Types.string (Terms.string s) (Json.ValueString s)--supportedTypesPassThrough :: H.SpecWith ()-supportedTypesPassThrough = H.describe "Verify that supported types are mapped directly" $ do-- H.it "Lists become JSON arrays" $- QC.property $ \strings -> checkJsonCoder listOfStringsType- (Terms.list $ Terms.string <$> strings) (Json.ValueArray $ Json.ValueString <$> strings)-- H.it "Maps become JSON objects" $- QC.property $ \keyvals -> checkJsonCoder mapOfStringsToIntsType- (makeMap keyvals) (jsonMap $ BF.bimap id jsonInt <$> keyvals)-- H.it "Optionals become JSON null or type-specific values" $- QC.property $ \ms -> checkJsonCoder optionalStringType- (Terms.optional $ Terms.string <$> ms) (Y.maybe Json.ValueNull Json.ValueString ms)-- H.it "Records become JSON objects" $- QC.property $ \lat lon -> checkJsonCoder testTypeLatLon- (latlonRecord lat lon) (jsonMap [- ("lat", jsonFloat $ realToFrac lat),- ("lon", jsonFloat $ realToFrac lon)])--unsupportedTypesAreTransformed :: H.SpecWith ()-unsupportedTypesAreTransformed = H.describe "Verify that unsupported types are transformed appropriately" $ do-- -- TODO: functions-- H.it "Sets become arrays" $- QC.property $ \strings -> checkJsonCoder setOfStringsType- (stringSet strings)- (Json.ValueArray $ Json.ValueString <$> S.toList strings)-- H.it "Nominal types are dereferenced" $- QC.property $ \s -> checkJsonCoder testTypeStringAlias- (Terms.wrap testTypeStringAliasName $ Terms.string s)- (Json.ValueString s)-- -- TODO: restore me--- H.it "Unions become JSON objects (as records)" $--- QC.property $ \int -> checkJsonCoder stringOrIntType--- (Terms.inject stringOrIntName $ Field (Name "right") $ Terms.int32 int)--- (jsonMap [("right", jsonInt int)])--wrappedTypesAreSupported :: H.SpecWith ()-wrappedTypesAreSupported = H.describe "Verify that nominal types are supported" $ do- H.it "Nominal unions become single-attribute objects" $- QC.property $ \() -> checkJsonCoder (TypeVariable testTypeUnionMonomorphicName)- (Terms.inject testTypeUnionMonomorphicName $ Terms.field "bool" $ Terms.boolean True)- (jsonMap [("bool", jsonBool True)])-- H.it "Nominal enums become single-attribute objects with empty-object values, and type annotations are transparent" $- QC.property $ \() -> checkJsonCoder (TypeVariable testTypeComparisonName)- (Terms.inject testTypeComparisonName $ Terms.field "equalTo" Terms.unit)- (jsonMap [("equalTo", jsonMap [])])--spec :: H.Spec-spec = do- literalTypeConstraintsAreRespected- supportedTypesPassThrough- unsupportedTypesAreTransformed- -- TODO: restore--- wrappedTypesAreSupported--checkJsonCoder :: Type -> Term -> Json.Value -> H.Expectation-checkJsonCoder typ term node = case mstep of- Nothing -> HL.assertFailure (traceSummary trace)- Just step -> do- shouldSucceedWith (coderEncode step term) node- shouldSucceedWith (coderEncode step term >>= coderDecode step) term- where- FlowState mstep _ trace = unFlow (jsonCoder typ) testGraph emptyTrace--jsonBool :: Bool -> Json.Value-jsonBool = Json.ValueBoolean--jsonFloat :: Double -> Json.Value-jsonFloat = Json.ValueNumber--jsonInt :: Integral i => i -> Json.Value-jsonInt = Json.ValueNumber . bigintToBigfloat . fromIntegral--jsonMap :: [(String, Json.Value)] -> Json.Value-jsonMap = Json.ValueObject . M.fromList--jsonNull :: Json.Value-jsonNull = Json.ValueNull
+ src/test/haskell/Hydra/Staging/Json/Serde.hs view
@@ -0,0 +1,86 @@+-- Legacy JSON serializer/deserializer in Haskell which is used as a sanity check for Hydra's native JSON support++module Hydra.Staging.Json.Serde where++import Hydra.Tools.Monads+import qualified Hydra.Compute as Compute+import qualified Hydra.Core as Core+import qualified Hydra.Graph as Graph+import qualified Hydra.Monads as Monads+import qualified Hydra.Ext.Org.Json.Coder as JsonCoder+import qualified Hydra.Tools.Bytestrings as Bytestrings+import qualified Hydra.Json.Model as Json++import qualified Data.ByteString.Lazy as BS+import qualified Control.Monad as CM+import qualified Data.Aeson as A+import qualified Data.Aeson.KeyMap as AKM+import qualified Data.Aeson.Key as AK+import qualified Data.List as L+import qualified Data.Map as M+import qualified Data.Text as T+import qualified Data.Vector as V+import qualified Data.Scientific as SC+import qualified Data.Char as C+import qualified Data.String as String+++aesonValueToBytes :: A.Value -> BS.ByteString+aesonValueToBytes = A.encode++aesonValueToJsonValue :: A.Value -> Json.Value+aesonValueToJsonValue v = case v of+ A.Object km -> Json.ValueObject $ M.fromList (mapPair <$> AKM.toList km)+ where+ mapPair (k, v) = (AK.toString k, aesonValueToJsonValue v)+ A.Array a -> Json.ValueArray (aesonValueToJsonValue <$> V.toList a)+ A.String t -> Json.ValueString $ T.unpack t+ A.Number s -> Json.ValueNumber $ SC.toRealFloat s+ A.Bool b -> Json.ValueBoolean b+ A.Null -> Json.ValueNull++bytesToAesonValue :: BS.ByteString -> Either String A.Value+bytesToAesonValue = A.eitherDecode++bytesToJsonValue :: BS.ByteString -> Either String Json.Value+bytesToJsonValue bs = aesonValueToJsonValue <$> bytesToAesonValue bs++jsonByteStringCoder :: Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph Graph.Graph Core.Term BS.ByteString)+jsonByteStringCoder typ = do+ coder <- JsonCoder.jsonCoder typ+ return Compute.Coder {+ Compute.coderEncode = fmap jsonValueToBytes . Compute.coderEncode coder,+ Compute.coderDecode = \bs -> case bytesToJsonValue bs of+ Left msg -> Monads.fail $ "JSON parsing failed: " ++ msg+ Right v -> Compute.coderDecode coder v}++-- | A convenience which maps typed terms to and from pretty-printed JSON strings, as opposed to JSON objects+jsonStringCoder :: Core.Type -> Compute.Flow Graph.Graph (Compute.Coder Graph.Graph Graph.Graph Core.Term String)+jsonStringCoder typ = do+ serde <- jsonByteStringCoder typ+ return Compute.Coder {+ Compute.coderEncode = fmap Bytestrings.bytesToString . Compute.coderEncode serde,+ Compute.coderDecode = Compute.coderDecode serde . Bytestrings.stringToBytes}++jsonValueToAesonValue :: Json.Value -> A.Value+jsonValueToAesonValue v = case v of+ Json.ValueArray l -> A.Array $ V.fromList (jsonValueToAesonValue <$> l)+ Json.ValueBoolean b -> A.Bool b+ Json.ValueNull -> A.Null+ Json.ValueNumber d -> A.Number $ SC.fromFloatDigits d+ Json.ValueObject m -> A.Object $ AKM.fromList (mapPair <$> M.toList m)+ where+ mapPair (k, v) = (AK.fromString k, jsonValueToAesonValue v)+ Json.ValueString s -> A.String $ T.pack s++jsonValueToBytes :: Json.Value -> BS.ByteString+jsonValueToBytes = aesonValueToBytes . jsonValueToAesonValue++jsonValueToString :: Json.Value -> String+jsonValueToString = Bytestrings.bytesToString . jsonValueToBytes++jsonValuesToString :: [Json.Value] -> String+jsonValuesToString = L.intercalate "\n" . fmap jsonValueToString++stringToJsonValue :: String -> Either String Json.Value+stringToJsonValue = bytesToJsonValue . Bytestrings.stringToBytes
− src/test/haskell/Hydra/Staging/Json/SerdeSpec.hs
@@ -1,107 +0,0 @@--- Note: these tests are dependent on Data.Aeson, both because the Serde depends on Data.Aeson--- and because of the particular serialization style.--module Hydra.Staging.Json.SerdeSpec where--import Hydra.Kernel-import Hydra.Dsl.Terms-import Hydra.Staging.Json.Serde-import qualified Hydra.Dsl.Types as Types--import Hydra.TestData-import Hydra.TestUtils--import qualified Test.Hspec as H-import qualified Data.List as L-import qualified Test.QuickCheck as QC-import qualified Data.Maybe as Y---checkLiterals :: H.SpecWith ()-checkLiterals = H.describe "Test literal values" $ do-- H.it "Booleans become 'true' and 'false'" $ do- QC.property $ \b -> checkSerialization jsonStringCoder- (TypedTerm (boolean b) $ Types.boolean)- (if b then "true" else "false")-- H.it "int32's become numbers, and are serialized in the obvious way" $ do- QC.property $ \i -> checkSerialization jsonStringCoder- (TypedTerm (int32 i) $ Types.int32)- (show i)-- H.it "uint8's and other finite integer types become numbers, and are serialized in the obvious way" $ do- QC.property $ \i -> checkSerialization jsonStringCoder- (TypedTerm (uint8 i) $ Types.uint8)- (show i)-- H.it "bigints become numbers" $ do- QC.property $ \i -> checkSerialization jsonStringCoder- (TypedTerm (bigint i) $ Types.bigint)- (show i)--checkOptionals :: H.SpecWith ()-checkOptionals = H.describe "Test and document serialization of optionals" $ do-- H.it "A 'nothing' becomes 'null' (except when it appears as a field)" $- QC.property $ \mi -> checkSerialization jsonStringCoder- (TypedTerm- (optional $ (Just . int32) =<< mi)- (Types.optional Types.int32))- (Y.maybe "null" show mi)-- H.it "Nested optionals case #1: just x? :: optional<optional<int32>>" $- QC.property $ \mi -> checkSerialization jsonStringCoder- (TypedTerm- (optional $ Just $ optional $ (Just . int32) =<< mi)- (Types.optional $ Types.optional Types.int32))- ("[" ++ Y.maybe "null" show mi ++ "]")-- H.it "Nested optionals case #2: nothing :: optional<optional<int32>>" $- QC.property $ \() -> checkSerialization jsonStringCoder- (TypedTerm- (optional Nothing)- (Types.optional $ Types.optional Types.int32))- "[]"--checkRecordsAndUnions :: H.SpecWith ()-checkRecordsAndUnions = H.describe "Test and document handling of optionals vs. nulls for record and union types" $ do-- H.it "Empty records become empty objects" $- QC.property $ \() -> checkSerialization jsonStringCoder- (TypedTerm unit Types.unit)- "{}"-- H.it "Simple records become simple objects" $- QC.property $ \() -> checkSerialization jsonStringCoder- (TypedTerm (latlonRecord 37 (negate 122)) testTypeLatLon)- "{\"lat\":37,\"lon\":-122}"-- -- TODO: restore me--- H.it "Optionals are omitted from record objects if 'nothing'" $--- QC.property $ \() -> checkSerialization jsonStringCoder--- (TypedTerm--- (record testTypeName [Field (Name "one") $ optional $ Just $ string "test", Field (Name "two") $ optional Nothing])--- (TypeRecord $ RowType testTypeName [Types.field "one" $ Types.optional Types.string, Types.field "two" $ Types.optional Types.int32]))--- "{\"one\":\"test\"}"-- -- TODO: restore me--- H.it "Simple unions become simple objects, via records" $--- QC.property $ \() -> checkSerialization jsonStringCoder--- (TypedTerm--- (inject testTypeName $ Field (Name "left") $ string "test")--- (TypeUnion $ RowType testTypeName [Types.field "left" Types.string, Types.field "right" Types.int32]))--- "{\"left\":\"test\"}"--jsonByteStringCoderIsInformationPreserving :: H.SpecWith ()-jsonByteStringCoderIsInformationPreserving = H.describe "Verify that a round trip from a type+term, to serialized JSON, and back again is a no-op" $ do-- H.it "Generate arbitrary type/term pairs, serialize the terms to JSON, deserialize them, and compare" $- QC.property (checkSerdeRoundTrip jsonByteStringCoder)--spec :: H.Spec-spec = do- checkLiterals- checkOptionals- checkRecordsAndUnions--- jsonByteStringCoderIsInformationPreserving -- TODO: restore me
− src/test/haskell/Hydra/Staging/TestGraph.hs
@@ -1,46 +0,0 @@-module Hydra.Staging.TestGraph (- module Hydra.Staging.TestGraph,- module Hydra.Sources.Libraries,- module Hydra.Test.TestGraph,-) where--import Hydra.Kernel-import Hydra.Sources.Libraries-import Hydra.Dsl.Terms-import Hydra.Sources.Kernel.Types.Core-import Hydra.Dsl.Annotations as Ann-import Hydra.Dsl.Bootstrap-import qualified Hydra.Dsl.Types as Types-import Hydra.Test.TestGraph--import qualified Data.Map as M-import qualified Data.Set as S-import qualified Hydra.Dsl.Terms as Terms---testGraph :: Graph-testGraph = elementsToGraph hydraCoreGraph (Just testSchemaGraph) [testElementArthur, testElementFirstName]--testSchemaGraph :: Graph-testSchemaGraph = elementsToGraph hydraCoreGraph (Just hydraCoreGraph) [- def testTypeBuddyListAName testTypeBuddyListA,- def testTypeBuddyListBName testTypeBuddyListB,- def testTypeComparisonName testTypeComparison,- def testTypeIntListName testTypeIntList,- def testTypeHydraLiteralTypeName testTypeHydraLiteralType,- def testTypeHydraTypeName testTypeHydraType,- def testTypeLatLonName testTypeLatLon,- def testTypeLatLonPolyName testTypeLatLonPoly,- def testTypeListName testTypeList,- def testTypeNumberName testTypeNumber,- def testTypePersonName testTypePerson,- def testTypePersonOrSomethingName testTypePersonOrSomething,- def testTypeSimpleNumberName testTypeSimpleNumber,- def testTypeStringAliasName $ Ann.doc "An alias for the string type" testTypeStringAlias,- def testTypePolymorphicWrapperName testTypePolymorphicWrapper,- def testTypeTimestampName testTypeTimestamp,- def testTypeUnionMonomorphicName testTypeUnionMonomorphic,- def testTypeUnionPolymorphicRecursiveName testTypeUnionPolymorphicRecursive,- def testTypeUnitName testTypeUnit]- where- def = typeElement
src/test/haskell/Hydra/Staging/Yaml/CoderSpec.hs view
@@ -12,7 +12,6 @@ import qualified Hydra.Dsl.Types as Types import Hydra.Dsl.Tests -import Hydra.TestData import Hydra.TestUtils import qualified Data.Bifunctor as BF@@ -88,7 +87,7 @@ H.it "Unions become YAML mappings (as records)" $ QC.property $ \int -> checkYamlCoder stringOrIntType- (variant stringOrIntName (Name "right") $ int32 int)+ (inject stringOrIntName (Name "right") $ int32 int) (yamlMap [(yamlStr "right", yamlInt int)]) spec :: H.Spec
src/test/haskell/Hydra/Staging/Yaml/SerdeSpec.hs view
@@ -1,6 +1,12 @@ -- Note: these tests are dependent on HsYaml, both because the Serde depends on HsYaml -- and because of the particular serialization style. +{-+stack ghci hydra:lib hydra:hydra-test++Test.Hspec.hspec Hydra.Staging.Yaml.SerdeSpec.spec+-}+ module Hydra.Staging.Yaml.SerdeSpec where import Hydra.Kernel@@ -23,22 +29,22 @@ H.it "Booleans become 'true' and 'false' (not 'y' and 'n')" $ do QC.property $ \b -> checkSerialization yamlStringCoder- (TypedTerm (boolean b) Types.boolean)+ (TypeApplicationTerm (boolean b) Types.boolean) (if b then "true" else "false") H.it "int32's become ints, and are serialized in the obvious way" $ do QC.property $ \i -> checkSerialization yamlStringCoder- (TypedTerm (int32 i) Types.int32)+ (TypeApplicationTerm (int32 i) Types.int32) (show i) H.it "uint8's and other finite integer types become ints, and are serialized in the obvious way" $ do QC.property $ \i -> checkSerialization yamlStringCoder- (TypedTerm (uint8 i) Types.uint8)+ (TypeApplicationTerm (uint8 i) Types.uint8) (show i) H.it "bigints become ints" $ do QC.property $ \i -> checkSerialization yamlStringCoder- (TypedTerm (bigint i) Types.bigint)+ (TypeApplicationTerm (bigint i) Types.bigint) (show i) -- TODO: examine quirks around floating-point serialization more closely. These could affect portability of the serialized YAML.@@ -50,23 +56,23 @@ H.it "A 'nothing' becomes 'null' (except when it appears as a field)" $ QC.property $ \mi -> checkSerialization yamlStringCoder- (TypedTerm+ (TypeApplicationTerm (optional $ (Just . int32) =<< mi)- (Types.optional Types.int32))+ (Types.maybe Types.int32)) (Y.maybe "null" show mi) H.it "Nested optionals case #1: just x? :: optional<optional<int32>>" $ QC.property $ \mi -> checkSerialization yamlStringCoder- (TypedTerm+ (TypeApplicationTerm (optional $ Just $ optional $ (Just . int32) =<< mi)- (Types.optional $ Types.optional Types.int32))+ (Types.maybe $ Types.maybe Types.int32)) ("- " ++ Y.maybe "null" show mi) H.it "Nested optionals case #2: nothing :: optional<optional<int32>>" $ QC.property $ \() -> checkSerialization yamlStringCoder- (TypedTerm+ (TypeApplicationTerm (optional Nothing)- (Types.optional $ Types.optional Types.int32))+ (Types.maybe $ Types.maybe Types.int32)) "[]" checkRecordsAndUnions :: H.SpecWith ()@@ -74,25 +80,25 @@ H.it "Empty records become empty objects" $ QC.property $ \() -> checkSerialization yamlStringCoder- (TypedTerm unit Types.unit)+ (TypeApplicationTerm unit Types.unit) "null" H.it "Simple records become simple objects" $ QC.property $ \() -> checkSerialization yamlStringCoder- (TypedTerm (latlonRecord 37.0 (negate 122.0)) testTypeLatLon)+ (TypeApplicationTerm (latlonRecord 37.0 (negate 122.0)) testTypeLatLon) "lat: 37.0\nlon: -122.0" H.it "Optionals are omitted from record objects if 'nothing'" $ QC.property $ \() -> checkSerialization yamlStringCoder- (TypedTerm+ (TypeApplicationTerm (record testTypeName [Field (Name "one") $ optional $ Just $ string "test", Field (Name "two") $ optional Nothing])- (TypeRecord $ RowType testTypeName [Types.field "one" $ Types.optional Types.string, Types.field "two" $ Types.optional Types.int32]))+ (TypeRecord $ RowType testTypeName [Types.field "one" $ Types.maybe Types.string, Types.field "two" $ Types.maybe Types.int32])) "one: test" H.it "Simple unions become simple objects, via records" $ QC.property $ \() -> checkSerialization yamlStringCoder- (TypedTerm- (inject testTypeName $ Field (Name "left") $ string "test")+ (TypeApplicationTerm+ (inject testTypeName (Name "left") (string "test")) (TypeUnion $ RowType testTypeName [Types.field "left" Types.string, Types.field "right" Types.int32])) "left: test\n"
src/test/haskell/Hydra/TestData.hs view
@@ -2,67 +2,10 @@ import Hydra.Kernel import Hydra.Dsl.Terms-import Hydra.Staging.TestGraph import qualified Hydra.Dsl.Terms as Terms-import qualified Hydra.Dsl.Types as Types import qualified Data.Map as M -concatType :: Type-concatType = Types.function Types.string $ Types.function Types.string Types.string--compareStringsType :: Type-compareStringsType = Types.function Types.string Types.string--eitherStringOrInt8Type :: Type-eitherStringOrInt8Type = TypeUnion $ RowType eitherStringOrInt8TypeName- [Types.field "left" Types.string, Types.field "right" Types.int8]--eitherStringOrInt8TypeName :: Name-eitherStringOrInt8TypeName = unqualifyName $ QualifiedName (Just testNamespace) "EitherStringOrInt8"--exampleProjectionType :: Type-exampleProjectionType = Types.function testTypePerson Types.string--listOfInt8sType :: Type-listOfInt8sType = Types.list Types.int8--listOfInt16sType :: Type-listOfInt16sType = Types.list Types.int16--listOfListsOfStringsType :: Type-listOfListsOfStringsType = Types.list $ Types.list Types.string--listOfSetOfStringsType :: Type-listOfSetOfStringsType = Types.list $ Types.set Types.string--listOfStringsType :: Type-listOfStringsType = Types.list Types.string- makeMap :: [(String, Int)] -> Term makeMap keyvals = Terms.map $ M.fromList $ ((\(k, v) -> (string k, int32 v)) <$> keyvals)--mapOfStringsToIntsType :: Type-mapOfStringsToIntsType = Types.map Types.string Types.int32--optionalInt8Type :: Type-optionalInt8Type = Types.optional Types.int8--optionalInt16Type :: Type-optionalInt16Type = Types.optional Types.int16--optionalStringType :: Type-optionalStringType = Types.optional Types.string--setOfStringsType :: Type-setOfStringsType = Types.set Types.string--stringOrIntName :: Name-stringOrIntName = Name "StringOrInt"--stringOrIntType :: Type-stringOrIntType = TypeUnion $ RowType stringOrIntName [Types.field "left" Types.string, Types.field "right" Types.int32]--testTypeName :: Name-testTypeName = unqualifyName $ QualifiedName (Just testNamespace) "TestType"
src/test/haskell/Hydra/TestSuiteSpec.hs view
@@ -10,41 +10,184 @@ import Hydra.TestUtils import Hydra.Testing import Hydra.Inference+import Hydra.Parsing (ParseResult(..)) import Hydra.Test.TestSuite import qualified Hydra.Show.Core as ShowCore-import qualified Hydra.Dsl.Testing as Testing+import qualified Hydra.Dsl.Meta.Testing as Testing+import qualified Hydra.Json.Writer as JsonWriter+import qualified Hydra.Json.Parser as JsonParser+import qualified Hydra.Ext.Org.Json.Coder as JsonCoder+import qualified Hydra.Json.Model as Json+import qualified Hydra.Sorting as Sorting+import qualified Hydra.Serialization as Serialization+import qualified Hydra.Rewriting as Rewriting+import qualified Hydra.Reduction as Reduction+import qualified Hydra.Hoisting as Hoisting+import qualified Hydra.Coders as Coders+import qualified Hydra.Unification as Unification +import qualified Control.Exception import qualified Control.Monad as CM import qualified Test.Hspec as H import qualified Test.HUnit.Lang as HL import qualified Test.QuickCheck as QC import qualified Data.List as L+import qualified Data.IORef as IORef import qualified Data.Map as M import qualified Data.Set as S import qualified Data.Maybe as Y+import qualified Data.Time.Clock as Clock+import qualified Data.Time.Format as TimeFormat+import qualified Data.Time.Clock.POSIX as POSIX+import qualified System.Environment as Env+import qualified System.IO as IO+import qualified System.Process as Proc -type TestRunner = String -> TestCaseWithMetadata -> Y.Maybe H.Expectation+type TestRunner = String -> TestCaseWithMetadata -> Y.Maybe (H.SpecWith ()) defaultTestRunner :: TestRunner-defaultTestRunner desc tcase = if Testing.isDisabled tcase+defaultTestRunner desc tcase = if Testing.isDisabled tcase || Testing.isRequiresFlowDecoding tcase then Nothing else Just $ case testCaseWithMetadataCase tcase of- TestCaseCaseConversion (CaseConversionTestCase fromConvention toConvention fromString toString) -> H.shouldBe- (convertCase fromConvention toConvention fromString)- toString- TestCaseEvaluation (EvaluationTestCase _ input output) -> shouldSucceedWith- (eval input)- output+ TestCaseAlphaConversion (AlphaConversionTestCase term oldVar newVar result) ->+ H.it "alpha conversion" $ H.shouldBe+ (alphaConvert oldVar newVar term)+ result+ TestCaseCaseConversion (CaseConversionTestCase fromConvention toConvention fromString toString) ->+ H.it "case conversion" $ H.shouldBe+ (convertCase fromConvention toConvention fromString)+ toString+ TestCaseDelegatedEvaluation _ ->+ H.it "delegated evaluation (skipped - runs in target language)" $ H.shouldBe True True+ TestCaseEtaExpansion (EtaExpansionTestCase input output) -> expectEtaExpansionResult desc input output+ TestCaseEvaluation (EvaluationTestCase _ input output) ->+ H.it "evaluation" $ shouldSucceedWith+ (ShowCore.term <$> eval input)+ (ShowCore.term output) TestCaseInference (InferenceTestCase input output) -> expectInferenceResult desc input output- TestCaseInferenceFailure (InferenceFailureTestCase input) -> expectInferenceFailure desc input+ TestCaseInferenceFailure (InferenceFailureTestCase input) ->+ H.it "inference failure" $ expectInferenceFailure desc input+ TestCaseJsonCoder (JsonCoderTestCase typ term expectedJson) ->+ H.it "JSON coder" $ checkJsonCoder typ term expectedJson+ TestCaseJsonParser (ParserTestCase input expectedResult) ->+ H.it "JSON parser" $ H.shouldBe+ (JsonParser.parseJson input)+ expectedResult+ TestCaseJsonWriter (WriterTestCase input expectedOutput) ->+ H.it "JSON writer" $ H.shouldBe+ (JsonWriter.printJson input)+ expectedOutput+ TestCaseJsonDecode (JsonDecodeTestCase typ json expected) ->+ H.it "JSON decode" $ checkJsonDecode typ json expected+ TestCaseJsonEncode (JsonEncodeTestCase term expected) ->+ H.it "JSON encode" $ checkJsonEncode term expected+ TestCaseJsonRoundtrip (JsonRoundtripTestCase typ term) ->+ H.it "JSON roundtrip" $ checkJsonRoundtrip typ term+ TestCaseTypeChecking (TypeCheckingTestCase input outputTerm outputType) ->+ expectTypeCheckingResult desc input outputTerm outputType+ TestCaseTypeCheckingFailure (TypeCheckingFailureTestCase input) ->+ H.it "type checking failure" $ H.shouldBe True False -- TODO: implement+ TestCaseTypeReduction (TypeReductionTestCase input output) ->+ H.it "type reduction" $ H.shouldBe+ (fromFlow input (schemaContext testGraph) (betaReduceType input))+ output+ TestCaseTopologicalSort (TopologicalSortTestCase adjList expected) ->+ H.it "topological sort" $ H.shouldBe+ (Sorting.topologicalSort adjList)+ expected+ TestCaseTopologicalSortSCC (TopologicalSortSCCTestCase adjList expected) ->+ H.it "topological sort SCC" $ H.shouldBe+ (Sorting.topologicalSortComponents adjList)+ expected+ TestCaseSerialization (SerializationTestCase input output) ->+ H.it "serialization" $ H.shouldBe+ (Serialization.printExpr (Serialization.parenthesize input))+ output+ TestCaseFlattenLetTerms (FlattenLetTermsTestCase input output) ->+ H.it "flatten let terms" $ H.shouldBe+ (Rewriting.flattenLetTerms input)+ output+ TestCaseFreeVariables (FreeVariablesTestCase input output) ->+ H.it "free variables" $ H.shouldBe+ (Rewriting.freeVariablesInTerm input)+ output+ TestCaseLiftLambdaAboveLet (LiftLambdaAboveLetTestCase input output) ->+ H.it "lift lambda above let" $ H.shouldBe+ (Rewriting.liftLambdaAboveLet input)+ output+ TestCaseSimplifyTerm (SimplifyTermTestCase input output) ->+ H.it "simplify term" $ H.shouldBe+ (Rewriting.simplifyTerm input)+ output+ TestCaseDeannotateTerm (DeannotateTermTestCase input output) ->+ H.it "deannotate term" $ H.shouldBe+ (Rewriting.deannotateTerm input)+ output+ TestCaseDeannotateType (DeannotateTypeTestCase input output) ->+ H.it "deannotate type" $ H.shouldBe+ (Rewriting.deannotateType input)+ output+ TestCaseTopologicalSortBindings (TopologicalSortBindingsTestCase bindings expected) ->+ H.it "topological sort bindings" $ H.shouldBe+ (S.fromList (fmap S.fromList (Rewriting.topologicalSortBindingMap (M.fromList bindings))))+ (S.fromList (fmap S.fromList expected))+ TestCaseNormalizeTypeVariables (NormalizeTypeVariablesTestCase input output) ->+ H.it "normalize type variables" $ H.shouldBe+ (Rewriting.normalizeTypeVariablesInTerm input)+ output+ TestCaseFoldOverTerm (FoldOverTermTestCase input traversalOrder op output) ->+ H.it "fold over term" $ H.shouldBe+ (runFoldOperation traversalOrder op input)+ output+ TestCaseRewriteTerm (RewriteTermTestCase input rewriter output) ->+ H.it "rewrite term" $ H.shouldBe+ (runTermRewriter rewriter input)+ output+ TestCaseRewriteType (RewriteTypeTestCase input rewriter output) ->+ H.it "rewrite type" $ H.shouldBe+ (runTypeRewriter rewriter input)+ output+ TestCaseHoistSubterms (HoistSubtermsTestCase predicate input output) ->+ H.it "hoist subterms" $ H.shouldBe+ (runHoistSubterms predicate input)+ output+ TestCaseHoistCaseStatements (HoistCaseStatementsTestCase input output) ->+ H.it "hoist case statements" $ H.shouldBe+ (Hoisting.hoistCaseStatements emptyTypeContext input)+ output+ TestCaseHoistPolymorphicLetBindings (HoistPolymorphicLetBindingsTestCase input output) ->+ H.it "hoist polymorphic let bindings" $ H.shouldBe+ (ShowCore.let_ $ Hoisting.hoistPolymorphicLetBindings (const True) input)+ (ShowCore.let_ output)+ TestCaseHoistLetBindings (HoistLetBindingsTestCase input output) ->+ H.it "hoist all let bindings" $ H.shouldBe+ (ShowCore.let_ $ Hoisting.hoistAllLetBindings input)+ (ShowCore.let_ output)+ TestCaseSubstInType (SubstInTypeTestCase substitution input output) ->+ H.it "substitute in type" $ H.shouldBe+ (substInType (TypeSubst (M.fromList substitution)) input)+ output+ TestCaseVariableOccursInType (VariableOccursInTypeTestCase variable typ expected) ->+ H.it "variable occurs in type" $ H.shouldBe+ (variableOccursInType variable typ)+ expected+ TestCaseUnifyTypes (UnifyTypesTestCase schemaTypeNames left right expected) ->+ H.it "unify types" $ checkUnifyTypes schemaTypeNames left right expected+ TestCaseJoinTypes (JoinTypesTestCase left right expected) ->+ H.it "join types" $ checkJoinTypes left right expected+ TestCaseUnshadowVariables (UnshadowVariablesTestCase input output) ->+ H.it "unshadow variables" $ H.shouldBe+ (ShowCore.term $ Rewriting.unshadowVariables input)+ (ShowCore.term output) where cx = fromFlow emptyInferenceContext () $ graphToInferenceContext testGraph runTestCase :: String -> TestRunner -> TestCaseWithMetadata -> H.SpecWith ()-runTestCase pdesc runner tcase@(TestCaseWithMetadata name _ mdesc _) = case runner cdesc tcase of+runTestCase pdesc runner tcase@(TestCaseWithMetadata name _ mdesc _) =+ case runner cdesc tcase of Nothing -> return ()- Just e -> H.it desc e+ Just spec -> H.describe desc spec where desc = name ++ Y.maybe ("") (\d -> ": " ++ d) mdesc cdesc = if L.null pdesc then desc else pdesc ++ ", " ++ desc@@ -62,5 +205,298 @@ Nothing -> "" Just d -> " (" ++ d ++ ")" +runTestGroupTimed :: IORef.IORef (M.Map String Double) -> String -> TestRunner -> TestGroup -> H.SpecWith ()+runTestGroupTimed timingsRef hydraPath runner tg = do+ H.describe desc $ do+ H.runIO $ IORef.modifyIORef' timingsRef (M.insert hydraPath 0) -- placeholder+ startRef <- H.runIO $ IORef.newIORef (0 :: Double)+ H.beforeAll_ (recordStart startRef) $ H.afterAll_ (recordStop startRef) $ do+ CM.mapM (runTestCase cdesc runner) $ testGroupCases tg+ CM.sequence [runTestGroupTimed timingsRef subPath runner sub+ | sub <- testGroupSubgroups tg+ , let subPath = hydraPath ++ "/" ++ testGroupName sub]+ return ()+ where+ desc = testGroupName tg ++ descSuffix+ cdesc = if L.null pdesc then desc else pdesc ++ ", " ++ desc+ pdesc = "" -- Not used for benchmark path construction+ descSuffix = case testGroupDescription tg of+ Nothing -> ""+ Just d -> " (" ++ d ++ ")"+ recordStart startRef = do+ now <- POSIX.getPOSIXTime+ IORef.writeIORef startRef (realToFrac now :: Double)+ recordStop startRef = do+ startTime <- IORef.readIORef startRef+ now <- POSIX.getPOSIXTime+ let elapsedMs = (realToFrac now - startTime) * 1000.0+ IORef.modifyIORef' timingsRef (M.insert hydraPath elapsedMs)+ spec :: H.Spec-spec = runTestGroup "" defaultTestRunner allTests+spec = do+ benchmarkOutput <- H.runIO $ Env.lookupEnv "HYDRA_BENCHMARK_OUTPUT"+ case benchmarkOutput of+ Nothing -> runTestGroup "" defaultTestRunner allTests+ Just outputPath -> do+ timingsRef <- H.runIO $ IORef.newIORef M.empty+ let rootPath = testGroupName allTests+ runTestGroupTimed timingsRef rootPath defaultTestRunner allTests+ H.afterAll_ (writeBenchmarkJson outputPath timingsRef allTests) $ do+ -- A dummy test to ensure afterAll_ fires+ H.it "benchmark finalize" $ True `H.shouldBe` True++-- | Check that the JSON coder correctly encodes a term to the expected JSON value+-- and that decoding and re-encoding produces the same term (round-trip)+checkJsonCoder :: Type -> Term -> Json.Value -> H.Expectation+checkJsonCoder typ term expectedJson = case mstep of+ Nothing -> HL.assertFailure (traceSummary trace)+ Just step -> do+ shouldSucceedWith (coderEncode step term) expectedJson+ shouldSucceedWith (coderEncode step term >>= coderDecode step) term+ where+ FlowState mstep _ trace = unFlow (JsonCoder.jsonCoder typ) testGraph emptyTrace++-- | Check that JSON decoding produces the expected result (Either String Term)+checkJsonDecode :: Type -> Json.Value -> Either String Term -> H.Expectation+checkJsonDecode typ json expected = case mstep of+ Nothing -> HL.assertFailure (traceSummary trace)+ Just step -> case expected of+ Left errMsg -> case runFlow (coderDecode step json) of+ Nothing -> return () -- Expected failure, got failure+ Just result -> HL.assertFailure $+ "Expected decode failure with message containing '" ++ errMsg +++ "' but got success: " ++ show result+ Right expectedTerm -> shouldSucceedWith (coderDecode step json) expectedTerm+ where+ FlowState mstep _ trace = unFlow (JsonCoder.jsonCoder typ) testGraph emptyTrace+ runFlow flow = case unFlow flow testGraph emptyTrace of+ FlowState result _ _ -> result++-- | Check that JSON encoding produces the expected result (Either String Value)+checkJsonEncode :: Term -> Either String Json.Value -> H.Expectation+checkJsonEncode term expected = case expected of+ Left _ ->+ -- For encode failures, we'd need a type to create a coder+ -- Since the test case doesn't include a type, skip encoding-only failure tests for now+ H.pendingWith "Encode failure tests require type information"+ Right expectedJson ->+ -- Without a type, we can't create a coder. This test case design may need revision.+ H.pendingWith "Encode tests require type information to create coder"++-- | Check that a term can be encoded to JSON and decoded back to the same term+checkJsonRoundtrip :: Type -> Term -> H.Expectation+checkJsonRoundtrip typ term = case mstep of+ Nothing -> HL.assertFailure (traceSummary trace)+ Just step -> do+ -- Encode the term+ case runFlow (coderEncode step term) of+ Nothing -> HL.assertFailure "Failed to encode term to JSON"+ Just json -> do+ -- Decode it back+ case runFlow (coderDecode step json) of+ Nothing -> HL.assertFailure "Failed to decode JSON back to term"+ Just decoded -> H.shouldBe decoded term+ where+ FlowState mstep _ trace = unFlow (JsonCoder.jsonCoder typ) testGraph emptyTrace+ runFlow flow = case unFlow flow testGraph emptyTrace of+ FlowState result _ _ -> result++-- | Run a fold operation over a term+runFoldOperation :: Coders.TraversalOrder -> FoldOperation -> Term -> Term+runFoldOperation order op = case op of+ FoldOperationSumInt32Literals -> TermLiteral . LiteralInteger . IntegerValueInt32 . sumInt32+ FoldOperationCollectListLengths -> TermList . fmap (TermLiteral . LiteralInteger . IntegerValueInt32) . collectListLengths+ FoldOperationCollectLabels -> TermList . fmap TermLiteral . collectLabels+ where+ sumInt32 :: Term -> Int+ sumInt32 = Rewriting.foldOverTerm order (\acc t -> acc + getInt32 t) 0+ collectListLengths :: Term -> [Int]+ collectListLengths = Rewriting.foldOverTerm order (\acc t -> acc ++ getListLength t) []+ collectLabels = Rewriting.foldOverTerm order (\acc t -> acc ++ getLabel t) []++ getInt32 :: Term -> Int+ getInt32 (TermLiteral (LiteralInteger (IntegerValueInt32 n))) = n+ getInt32 _ = 0++ getListLength (TermList elems) = [length elems]+ getListLength _ = []++ getLabel (TermPair (TermLiteral (LiteralString s), _)) = [LiteralString s]+ getLabel _ = []++-- | Run a term rewriter+runTermRewriter :: TermRewriter -> Term -> Term+runTermRewriter rewriter = Rewriting.rewriteTerm rewrite+ where+ rewrite recurse term = case (rewriter, term) of+ (TermRewriterReplaceFooWithBar, TermLiteral (LiteralString "foo")) ->+ TermLiteral (LiteralString "bar")+ (TermRewriterReplaceInt32WithInt64, TermLiteral (LiteralInteger (IntegerValueInt32 n))) ->+ TermLiteral (LiteralInteger (IntegerValueInt64 (fromIntegral n)))+ _ -> recurse term++-- | Run a type rewriter+runTypeRewriter :: TypeRewriter -> Type -> Type+runTypeRewriter TypeRewriterReplaceStringWithInt32 = Rewriting.rewriteType rewrite+ where+ rewrite recurse typ = case typ of+ TypeLiteral LiteralTypeString -> TypeLiteral (LiteralTypeInteger IntegerTypeInt32)+ _ -> recurse typ++-- | Run hoistSubterms with the given predicate+-- The predicate receives (path, term) where path is the list of TermAccessors from root+runHoistSubterms :: HoistPredicate -> Term -> Term+runHoistSubterms pred term = Hoisting.hoistSubterms (predicateFn pred) emptyTypeContext term+ where+ -- A predicate returns True if the term should be hoisted.+ -- The predicate receives (path, term) for path-aware hoisting decisions.+ predicateFn :: HoistPredicate -> ([TermAccessor], Term) -> Bool+ predicateFn HoistPredicateNothing _ = False+ predicateFn HoistPredicateLists (_, t) = case t of+ TermList _ -> True+ _ -> False+ predicateFn HoistPredicateApplications (_, t) = case t of+ TermApplication _ -> True+ _ -> False+ predicateFn HoistPredicateCaseStatements (_, t) = case t of+ TermFunction (FunctionElimination _) -> True -- Case statements are eliminations+ _ -> False++emptyTypeContext :: TypeContext+emptyTypeContext = TypeContext M.empty M.empty S.empty S.empty S.empty emptyInferenceContext+ where+ emptyInferenceContext = InferenceContext M.empty M.empty M.empty M.empty False++-- | Check unifyTypes result against expected+-- schemaTypeNames is a list of names that should be treated as schema types (not bound during unification)+checkUnifyTypes :: [Name] -> Type -> Type -> Either String TypeSubst -> H.Expectation+checkUnifyTypes schemaTypeNames left right expected = case expected of+ Left errSubstring -> case unifyResult of+ Nothing -> return () -- Expected failure, got failure+ Just result -> HL.assertFailure $+ "Expected unification failure but got success: " ++ show (unTypeSubst result)+ Right expectedSubst -> case unifyResult of+ Nothing -> HL.assertFailure $+ "Expected unification success but got failure (trace: " ++ traceSummary trace ++ ")"+ Just actualSubst -> H.shouldBe actualSubst expectedSubst+ where+ -- Build schema types map from the list of names+ -- Each schema name gets a trivial type scheme (no free variables)+ schemaTypes = M.fromList [(n, TypeScheme [] (TypeVariable n) Nothing) | n <- schemaTypeNames]+ FlowState unifyResult _ trace = unFlow+ (Unification.unifyTypes schemaTypes left right "test")+ testGraph emptyTrace++-- | Check joinTypes result against expected+checkJoinTypes :: Type -> Type -> Either () [TypeConstraint] -> H.Expectation+checkJoinTypes left right expected = case expected of+ Left () -> case joinResult of+ Nothing -> return () -- Expected failure, got failure+ Just result -> HL.assertFailure $+ "Expected join failure but got success with constraints: " ++ show result+ Right expectedConstraints -> case joinResult of+ Nothing -> HL.assertFailure $+ "Expected join success but got failure (trace: " ++ traceSummary trace ++ ")"+ Just actualConstraints -> H.shouldBe actualConstraints expectedConstraints+ where+ FlowState joinResult _ trace = unFlow+ (Unification.joinTypes left right "test")+ testGraph emptyTrace++-- ---- Benchmark JSON output ----++writeBenchmarkJson :: String -> IORef.IORef (M.Map String Double) -> TestGroup -> IO ()+writeBenchmarkJson outputPath timingsRef root = do+ timings <- IORef.readIORef timingsRef+ now <- Clock.getCurrentTime+ let timestamp = TimeFormat.formatTime TimeFormat.defaultTimeLocale "%Y-%m-%dT%H:%M:%SZ" now+ branch <- gitOutput "git" ["rev-parse", "--abbrev-ref", "HEAD"]+ commit <- gitOutput "git" ["rev-parse", "--short", "HEAD"]+ commitMsg <- gitOutput "git" ["log", "-1", "--format=%s"]+ let rootPath = testGroupName root+ groups = testGroupSubgroups root+ groupJsons = [groupToJson timings rootPath g | g <- groups]+ (totalP, totalF, totalS) = foldl (\(p,f,s) g -> let (p',f',s') = countTests g in (p+p',f+f',s+s')) (0,0,0) groups+ totalTime = sum [M.findWithDefault 0 (rootPath ++ "/" ++ testGroupName g) timings | g <- groups]+ json = "{\n" +++ " \"metadata\": {\n" +++ " \"timestamp\": " ++ jsonStr timestamp ++ ",\n" +++ " \"language\": \"haskell\",\n" +++ " \"branch\": " ++ jsonStr branch ++ ",\n" +++ " \"commit\": " ++ jsonStr commit ++ ",\n" +++ " \"commitMessage\": " ++ jsonStr commitMsg ++ "\n" +++ " },\n" +++ " \"groups\": [\n" +++ L.intercalate ",\n" groupJsons ++ "\n" +++ " ],\n" +++ " \"summary\": {\n" +++ " \"totalPassed\": " ++ show totalP ++ ",\n" +++ " \"totalFailed\": " ++ show totalF ++ ",\n" +++ " \"totalSkipped\": " ++ show totalS ++ ",\n" +++ " \"totalTimeMs\": " ++ round1 totalTime ++ "\n" +++ " }\n" +++ "}\n"+ writeFile outputPath json+ IO.hPutStrLn IO.stderr $ "Benchmark results written to " ++ outputPath++groupToJson :: M.Map String Double -> String -> TestGroup -> String+groupToJson timings parentPath group =+ " {\n" +++ " \"failed\": 0,\n" +++ " \"passed\": " ++ show passed ++ ",\n" +++ " \"path\": " ++ jsonStr groupPath ++ ",\n" +++ " \"skipped\": " ++ show skipped ++ ",\n" +++ subgroupsJson +++ " \"totalTimeMs\": " ++ round1 groupTime ++ "}"+ where+ groupPath = parentPath ++ "/" ++ testGroupName group+ groupTime = M.findWithDefault 0 groupPath timings+ (passed, _, skipped) = countTests group+ subs = testGroupSubgroups group+ subgroupsJson+ | null subs = ""+ | otherwise =+ " \"subgroups\": [\n" +++ L.intercalate ",\n" [subgroupToJson timings groupPath s | s <- subs] ++ "\n" +++ " ],\n"++subgroupToJson :: M.Map String Double -> String -> TestGroup -> String+subgroupToJson timings parentPath sub =+ " {\n" +++ " \"failed\": 0,\n" +++ " \"passed\": " ++ show passed ++ ",\n" +++ " \"path\": " ++ jsonStr subPath ++ ",\n" +++ " \"skipped\": " ++ show skipped ++ ",\n" +++ " \"totalTimeMs\": " ++ round1 subTime ++ "}"+ where+ subPath = parentPath ++ "/" ++ testGroupName sub+ subTime = M.findWithDefault 0 subPath timings+ (passed, _, skipped) = countTests sub++countTests :: TestGroup -> (Int, Int, Int)+countTests group = (runnable + subRunnable, 0, skipped + subSkipped)+ where+ (runnable, skipped) = foldl (\(r, s) tc ->+ if Testing.isDisabled tc || Testing.isRequiresFlowDecoding tc+ then (r, s + 1)+ else (r + 1, s)) (0, 0) (testGroupCases group)+ (subRunnable, _, subSkipped) = foldl (\(r, f, s) sub ->+ let (r', f', s') = countTests sub in (r + r', f + f', s + s')) (0, 0, 0) (testGroupSubgroups group)++round1 :: Double -> String+round1 d = show (fromIntegral (round (d * 10)) / 10.0 :: Double)++jsonStr :: String -> String+jsonStr s = "\"" ++ concatMap escChar (filter (/= '\n') s) ++ "\""+ where+ escChar '"' = "\\\""+ escChar '\\' = "\\\\"+ escChar c = [c]++gitOutput :: String -> [String] -> IO String+gitOutput cmd args =+ Control.Exception.catch+ (do+ result <- Proc.readProcess cmd args ""+ return (L.dropWhileEnd (== '\n') result))+ (\e -> let _ = e :: Control.Exception.SomeException in return "unknown")
src/test/haskell/Hydra/TestUtils.hs view
@@ -1,15 +1,38 @@ module Hydra.TestUtils ( module Hydra.TestUtils,- module Hydra.Staging.TestGraph,+ module Hydra.Sources.Libraries,+ module Hydra.Test.TestGraph,+ module Hydra.Test.TestTypes,+ module Hydra.Test.TestTerms, ) where import Hydra.Kernel import Hydra.Adapt.Literals import Hydra.Adapt.Terms import Hydra.Adapt.Utils-import Hydra.Staging.TestGraph import Hydra.ArbitraryCore()+import Hydra.Dsl.Bootstrap+import Hydra.Dsl.Terms+import qualified Hydra.Sources.Kernel.Types.Coders as TypeCoders+import qualified Hydra.Sources.Kernel.Types.Compute as TypeCompute+import qualified Hydra.Sources.Kernel.Types.Core as TypeCore+import qualified Hydra.Sources.Kernel.Terms.Annotations as TermAnnotations+import qualified Hydra.Sources.Kernel.Terms.Constants as TermConstants+import qualified Hydra.Sources.Kernel.Terms.Extract.Core as TermExtractCore+import qualified Hydra.Sources.Kernel.Terms.Lexical as TermLexical+import qualified Hydra.Sources.Kernel.Terms.Monads as TermMonads+import qualified Hydra.Sources.Kernel.Terms.Rewriting as TermRewriting+import qualified Hydra.Sources.Kernel.Terms.Show.Core as TermShowCore+import qualified Hydra.Sources.Decode.Core as TermDecodeCore+import qualified Hydra.Sources.Encode.Core as TermEncodeCore+import Hydra.Sources.Kernel.Types.Core+import Hydra.Sources.Libraries+import Hydra.Test.TestGraph+import Hydra.Test.TestTypes+import Hydra.Test.TestTerms import qualified Hydra.Dsl.Terms as Terms+import qualified Hydra.Dsl.Types as Types+import qualified Hydra.Encode.Core as EncodeCore import qualified Hydra.Show.Core as ShowCore import qualified Test.Hspec as H@@ -21,6 +44,38 @@ import qualified Data.ByteString.Lazy as BS +testGraph :: Graph+testGraph = elementsToGraph hydraCoreGraph (Just testSchemaGraph) (kernelTermBindings ++ dataBindings)+ where+ -- Include only essential kernel term definitions for interpreter tests.+ -- The evaluator needs hydra.monads (and its dependencies) plus hydra.annotations (and its dependencies).+ kernelTermBindings = L.concat $ fmap moduleElements+ [ TermConstants.module_+ , TermShowCore.module_+ , TermMonads.module_+ , TermExtractCore.module_+ , TermLexical.module_+ , TermRewriting.module_+ , TermDecodeCore.module_+ , TermEncodeCore.module_+ , TermAnnotations.module_+ ]+ dataBindings = (\(name, term) -> Binding name term Nothing) <$> M.toList testTerms++testSchemaGraph :: Graph+testSchemaGraph = elementsToGraph hydraCoreGraph (Just hydraCoreGraph)+ -- Only the kernel type modules that define types referenced by the test suite schema graph:+ -- CoderDirection (hydra.coders), Coder (hydra.compute), and Type/Name/ForallType (hydra.core).+ (kernelElements ++ testElements)+ where+ kernelElements = L.concat $ fmap moduleElements+ [ TypeCoders.module_+ , TypeCompute.module_+ , TypeCore.module_+ ]+ testElements = fmap+ (\(n, t) -> Binding n (EncodeCore.type_ t) $ Just $ Types.mono $ TypeVariable _Type) $ M.toList testTypes+ baseLanguage :: Language baseLanguage = hydraLanguage @@ -88,8 +143,8 @@ checkDataAdapter = checkAdapter deannotateTerm termAdapter termTestContext checkSerdeRoundTrip :: (Type -> Flow Graph (Coder Graph Graph Term BS.ByteString))- -> TypedTerm -> H.Expectation-checkSerdeRoundTrip mkSerde (TypedTerm term typ) = do+ -> TypeApplicationTerm -> H.Expectation+checkSerdeRoundTrip mkSerde (TypeApplicationTerm term typ) = do case mserde of Nothing -> HL.assertFailure (traceSummary trace) Just serde -> shouldSucceedWith@@ -99,8 +154,8 @@ FlowState mserde _ trace = unFlow (mkSerde typ) testGraph emptyTrace checkSerialization :: (Type -> Flow Graph (Coder Graph Graph Term String))- -> TypedTerm -> String -> H.Expectation-checkSerialization mkSerdeStr (TypedTerm term typ) expected = do+ -> TypeApplicationTerm -> String -> H.Expectation+checkSerialization mkSerdeStr (TypeApplicationTerm term typ) expected = do case mserde of Nothing -> HL.assertFailure (traceSummary trace) Just serde -> shouldSucceedWith@@ -113,6 +168,14 @@ eval :: Term -> Flow Graph Term eval = reduceTerm True +expectEtaExpansionResult :: String -> Term -> Term -> H.SpecWith ()+expectEtaExpansionResult desc input output = H.it "eta expansion" $ do+ tx <- fromTestFlow desc $ graphToTypeContext testGraph+ -- Use the original etaExpandTypedTerm (monadic) instead of etaExpandTermNew (pure)+ -- to test the production code path+ result <- fromTestFlow desc $ etaExpandTypedTerm tx input+ result `H.shouldBe` output+ expectFailure :: (a -> String) -> String -> Flow () a -> H.Expectation expectFailure print desc f = case my of Nothing -> return ()@@ -128,37 +191,60 @@ cx <- graphToInferenceContext testGraph inferTypeOf cx term -expectInferenceResult :: String -> Term -> TypeScheme -> H.Expectation+expectInferenceResult :: String -> Term -> TypeScheme -> H.SpecWith () expectInferenceResult desc term expected = do- expectSuccess desc (ShowCore.typeScheme . snd <$> result) (ShowCore.typeScheme expected)- expectSuccess desc (ShowCore.term . removeTypesFromTerm . fst <$> result) (ShowCore.term $ removeTypesFromTerm term)- where- result = do- cx <- graphToInferenceContext testGraph- inferTypeOf cx term+ (iterm, its) <- H.runIO $ fromTestFlow desc $ do+ cx <- graphToInferenceContext testGraph+ inferTypeOf cx term + H.it "inferred type" $+ H.shouldBe (ShowCore.typeScheme its) (ShowCore.typeScheme expected)+ H.it "inferred term" $+ H.shouldBe (ShowCore.term $ removeTypesFromTerm iterm) (ShowCore.term $ removeTypesFromTerm term)+ expectSuccess :: (Eq a, Show a) => String -> Flow () a -> a -> H.Expectation-expectSuccess desc f x = case my of+expectSuccess desc flow x = case my of Nothing -> HL.assertFailure $ traceSummary trace Just y -> y `H.shouldBe` x where- FlowState my _ trace = unFlow f2 () emptyTrace- f2 = do+ FlowState my _ trace = unFlow flow2 () emptyTrace+ flow2 = do putAttr key_debugId $ Terms.string desc- f+ flow -expectTypeOfResult :: String -> M.Map Name Type -> Term -> Type -> H.Expectation-expectTypeOfResult desc types term expected = do- expectSuccess desc (ShowCore.type_ <$> result) (ShowCore.type_ expected)- where- result = do- cx <- graphToInferenceContext testGraph+expectTypeCheckingResult :: String -> Term -> Term -> Type -> H.SpecWith ()+expectTypeCheckingResult desc input outputTerm outputType = do+ (iterm, itype, rtype) <- H.runIO $ fromTestFlow desc $ do+ cx <- graphToInferenceContext testGraph+ let tx = TypeContext M.empty M.empty S.empty S.empty S.empty cx - -- typeOf is always called on System F terms- (iterm, ts) <- inferTypeOf cx term- let vars = S.fromList $ typeSchemeVariables ts+ -- typeOf is always called on System F terms+ (iterm, ts) <- inferTypeOf cx input+ let itype = typeSchemeToFType ts - typeOfInternal cx vars types [] iterm+ rtype <- typeOf tx [] iterm+ return (iterm, itype, rtype)++ -- Three labeled assertions as per the type checking specification+ H.it "inferred term" $+ H.shouldBe (ShowCore.term iterm) (ShowCore.term outputTerm)+ H.it "inferred type" $+ H.shouldBe (ShowCore.type_ itype) (ShowCore.type_ outputType)+ H.it "reconstructed type" $+ H.shouldBe (ShowCore.type_ rtype) (ShowCore.type_ outputType)++fromTestFlow :: String -> Flow () a -> IO a+fromTestFlow desc flow = case my of+ Nothing -> fail $ traceSummary trace+ Just y -> return y+ where+ FlowState my _ trace = unFlow flow2 () emptyTrace+ flow2 = do+ putAttr key_debugId $ Terms.string desc+ flow++makeMap :: [(String, Int)] -> Term+makeMap keyvals = Terms.map $ M.fromList $ ((\(k, v) -> (Terms.string k, Terms.int32 v)) <$> keyvals) shouldFail :: Flow Graph a -> H.Expectation shouldFail f = H.shouldBe True (Y.isNothing $ flowStateValue $ unFlow f testGraph emptyTrace)
+ src/test/haskell/Hydra/UpdateGenerationTests.hs view
@@ -0,0 +1,46 @@+module Hydra.UpdateGenerationTests where++import Hydra.Kernel+import Hydra.Staging.Testing.Generation.Generate+import Hydra.Staging.Testing.Generation.HaskellCodec (haskellTestGenerator)+import qualified Hydra.Sources.Test.TestSuite as TestSuite+import qualified Hydra.Test.TestSuite as GenTests+import System.Exit (exitFailure)+++updateGenerationTestsHaskell :: IO ()+updateGenerationTestsHaskell = do+ putStrLn "=== Generate Hydra generation tests ==="+ putStrLn ""++ -- Get the namespaces from TestSuite's term dependencies+ let testNamespaces = moduleTermDependencies TestSuite.module_++ -- Build the lookup function from namespaces and test group hierarchy+ let lookupFn = createTestGroupLookup testNamespaces GenTests.allTests++ -- Get the list of test modules explicitly+ let testModules = TestSuite.testSuiteModules++ -- Generate generation tests to src/gen-test/haskell+ let outputDir = "src/gen-test/haskell"++ putStrLn $ "Generating tests into: " ++ outputDir+ putStrLn ""++ success <- generateGenerationTestSuite haskellTestGenerator outputDir testModules lookupFn++ if success+ then do+ putStrLn ""+ putStrLn "=== Done! ==="+ putStrLn ""+ putStrLn "To view the generated tests:"+ putStrLn $ " ls -R " ++ outputDir+ putStrLn ""+ putStrLn "To run the generated tests:"+ putStrLn " stack test"+ else do+ putStrLn ""+ putStrLn "=== FAILED ==="+ exitFailure
src/test/haskell/Spec.hs view
@@ -1,1 +1,2 @@ {-# OPTIONS_GHC -F -pgmF hspec-discover #-}+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
stack.yaml view
@@ -1,5 +1,8 @@ resolver: lts-24.7 +system-ghc: true+install-ghc: false+ packages: - .